Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

440 lines
14 KiB

  1. /***************************************************************************
  2. *
  3. * File: linkapi.h
  4. *
  5. * INTEL Corporation Proprietary Information
  6. * Copyright (c) 1996 Intel Corporation.
  7. *
  8. * This listing is supplied under the terms of a license agreement
  9. * with INTEL Corporation and may not be used, copied, nor disclosed
  10. * except in accordance with the terms of that agreement.
  11. *
  12. ***************************************************************************
  13. *
  14. * $Workfile: linkapi.h $
  15. * $Revision: 1.17 $
  16. * $Modtime: 11 Dec 1996 13:57:14 $
  17. * $Log: S:\sturgeon\src\include\vcs\linkapi.h_v $
  18. *
  19. * Rev 1.17 11 Dec 1996 14:10:48 SBELL1
  20. * changed parameters to linkLayerInit/Listen
  21. *
  22. * Rev 1.16.1.0 11 Dec 1996 13:57:14 SBELL1
  23. * CHanged parameters to linkLayerInit and Listen.
  24. *
  25. * Rev 1.16 14 Oct 1996 14:00:20 EHOWARDX
  26. *
  27. * Unicode changes.
  28. *
  29. * Rev 1.15 15 Aug 1996 14:00:08 rodellx
  30. *
  31. * Added additional address validation error case for DOMAIN_NAME addresses
  32. * which cannot be resolved, but are used with SocketBind().
  33. *
  34. * Rev 1.14 11 Jul 1996 18:42:10 rodellx
  35. *
  36. * Fixed bug where HRESULT ids were in violation of Facility and/or Code
  37. * value rules.
  38. *
  39. * Rev 1.13 10 Jul 1996 21:36:26 rodellx
  40. *
  41. * Changed error code base to required value defined by apierror.h.
  42. *
  43. * Rev 1.12 May 28 1996 18:09:08 plantz
  44. * Change all error and message codes to use HRESULT. Deleted unused codes.
  45. *
  46. * Rev 1.11 09 May 1996 18:28:36 EHOWARDX
  47. * Eliminated unnessary formal parameters.
  48. *
  49. * Rev 1.4 25 Apr 1996 21:43:50 helgebax
  50. * Copied Philip's changes from sturgeon\src\include.
  51. *
  52. * Rev 1.10 Apr 25 1996 21:07:16 plantz
  53. * Add messages for connect callback.
  54. * Add connect callback parameter to link layer accept.
  55. *
  56. * Rev 1.9 Apr 25 1996 15:36:50 plantz
  57. * Remove #include incommon.h and dependencies on types defined in incommon
  58. * (use pointers to incomplete structure types instead).
  59. *
  60. * Rev 1.8 Apr 24 1996 20:54:08 plantz
  61. * Change name of H245LISTENCALLBACK to H245CONNECTCALLBACK and add additional
  62. * parameters. Add it as an parameter to linkLayerConnect as well as
  63. * linkLayerListen.
  64. *
  65. * Rev 1.7 Apr 24 1996 17:00:04 plantz
  66. * Merge 1.3.1.0 with 1.6 (changes to support Q931).
  67. *
  68. * Rev 1.6 19 Apr 1996 10:35:36 EHOWARDX
  69. * Encorporate Dan's latest SRPAPI.H changes.
  70. *
  71. * Rev 1.3.1.0 Apr 23 1996 13:45:26 plantz
  72. * Changes to support Q.931.
  73. *
  74. *****************************************************************************/
  75. #ifndef LINKAPI_H
  76. #define LINKAPI_H
  77. #include "apierror.h"
  78. #if defined(__cplusplus)
  79. extern "C"
  80. {
  81. #endif // (__cplusplus)
  82. #if defined(REMOVE_FROM_TSP)
  83. // declare exported functions
  84. #if defined(LINKDLL_EXPORT)
  85. #define LINKDLL __declspec (dllexport)
  86. #else // (LINKDLL_EXPORT)
  87. #define LINKDLL __declspec (dllimport)
  88. #endif // (LINKDLL_EXPORT)
  89. #define SRPDLL LINKDLL
  90. #else
  91. #define LINKDLL
  92. #define SRPDLL
  93. #endif
  94. ////////////////////////////////////////////////////////////////////////////
  95. //
  96. // Link Layer defaults
  97. //
  98. ////////////////////////////////////////////////////////////////////////////
  99. #define INVALID_PHYS_ID (DWORD) 0xffffffff
  100. ////////////////////////////////////////////////////////////////////////////
  101. //
  102. // Link Layer Error defines
  103. //
  104. ////////////////////////////////////////////////////////////////////////////
  105. #define LINK_ERROR_BASE ERROR_LOCAL_BASE_ID
  106. #define LINK_SEND_ERROR_BASE LINK_ERROR_BASE + 0x100
  107. #define LINK_SEND_COMP_BASE LINK_ERROR_BASE + 0x200
  108. #define LINK_RCV_ERROR_BASE LINK_ERROR_BASE + 0x300
  109. #define LINK_RCV_COMP_BASE LINK_ERROR_BASE + 0x400
  110. #define LINK_UTIL_ERROR_BASE LINK_ERROR_BASE + 0x500
  111. #define LINK_UTIL_COMP_BASE LINK_ERROR_BASE + 0x600
  112. #define LINK_FATAL_ERROR LINK_ERROR_BASE + 0x700
  113. #define LINK_CONN_ERROR_BASE LINK_ERROR_BASE + 0x800
  114. #define LINK_CONN_COMP_BASE LINK_ERROR_BASE + 0x900
  115. ////////////////////////////////////////////////////////////////////////////
  116. //
  117. // CallBack Prototype for Channel CallBack
  118. //
  119. ////////////////////////////////////////////////////////////////////////////
  120. typedef void (*H245SRCALLBACK)
  121. (
  122. DWORD dwH245Instance,
  123. HRESULT dwMessage,
  124. PBYTE pbyDataBuf,
  125. DWORD dwLength
  126. );
  127. // Link Send Callback error codes
  128. #define LINK_SEND_COMPLETE MAKE_CUSTOM_HRESULT(SEVERITY_SUCCESS, TRUE, FACILITY_H245WS, LINK_SEND_COMP_BASE+ 0)
  129. #define LINK_SEND_ABORT MAKE_CUSTOM_HRESULT(SEVERITY_SUCCESS, TRUE, FACILITY_H245WS, LINK_SEND_COMP_BASE+ 5) // Tx aborted the SDU (not implemented)
  130. #define LINK_SEND_WOULD_BLOCK MAKE_CUSTOM_HRESULT(SEVERITY_SUCCESS, TRUE, FACILITY_H245WS, LINK_SEND_COMP_BASE+20)
  131. #define LINK_SEND_CLOSED MAKE_CUSTOM_HRESULT(SEVERITY_SUCCESS, TRUE, FACILITY_H245WS, LINK_SEND_COMP_BASE+22)
  132. #define LINK_SEND_ERROR MAKE_CUSTOM_HRESULT(SEVERITY_ERROR, TRUE, FACILITY_H245WS, LINK_SEND_COMP_BASE+23)
  133. // Link Receive Callback error codes
  134. #define LINK_RECV_DATA MAKE_CUSTOM_HRESULT(SEVERITY_SUCCESS, TRUE, FACILITY_H245WS, LINK_RCV_COMP_BASE+ 6) // DATA.INDICATION from H.223 (Should not be zero)
  135. #define LINK_RECV_ABORT MAKE_CUSTOM_HRESULT(SEVERITY_SUCCESS, TRUE, FACILITY_H245WS, LINK_RCV_COMP_BASE+ 7) // Tx aborted the SDU (not implemented)
  136. #define LINK_RECV_ERROR MAKE_CUSTOM_HRESULT(SEVERITY_ERROR, TRUE, FACILITY_H245WS, LINK_RCV_COMP_BASE+10) // from AL2 - _CRC error
  137. #define LINK_RECV_WOULD_BLOCK MAKE_CUSTOM_HRESULT(SEVERITY_SUCCESS, TRUE, FACILITY_H245WS, LINK_RCV_COMP_BASE+20)
  138. #define LINK_RECV_CLOSED MAKE_CUSTOM_HRESULT(SEVERITY_SUCCESS, TRUE, FACILITY_H245WS, LINK_RCV_COMP_BASE+22)
  139. typedef void (*H245CONNECTCALLBACK)
  140. (
  141. DWORD dwH245Instance,
  142. HRESULT dwMessage,
  143. struct _ADDR *LocalAddr,
  144. struct _ADDR *PeerAddr
  145. );
  146. #define LINK_CONNECT_REQUEST MAKE_CUSTOM_HRESULT(SEVERITY_SUCCESS, TRUE, FACILITY_H245WS, LINK_CONN_COMP_BASE+1)
  147. #define LINK_CONNECT_COMPLETE MAKE_CUSTOM_HRESULT(SEVERITY_SUCCESS, TRUE, FACILITY_H245WS, LINK_CONN_COMP_BASE+2)
  148. ////////////////////////////////////////////////////////////////////////////
  149. //
  150. // Link Layer Function Prototypes
  151. //
  152. ////////////////////////////////////////////////////////////////////////////
  153. /**************************************************************************
  154. ** Function : linkLayerInit
  155. ** Description : This function will initialize the datalink subsystem.
  156. ** This in turn will make appropriate calls to initialize
  157. ** the software and hardware subsystems below this layer.
  158. ** linkLayernit() has to be called before any other service or
  159. ** System control functions are used.
  160. ****************************************************************************/
  161. LINKDLL HRESULT
  162. linkLayerInit
  163. (
  164. DWORD* pdwPhysicalId,
  165. DWORD dwH245Instance,
  166. H245SRCALLBACK cbReceiveComplete,
  167. H245SRCALLBACK cbTransmitComplete
  168. );
  169. typedef
  170. HRESULT
  171. (*PFxnlinkLayerInit)
  172. (
  173. DWORD* pdwPhysicalId,
  174. DWORD dwH245Instance,
  175. H245SRCALLBACK cbReceiveComplete,
  176. H245SRCALLBACK cbTransmitComplete
  177. );
  178. ///////////////////////////////////////////////////////////////
  179. ///
  180. /// SRP Initialization defines
  181. ///
  182. ///////////////////////////////////////////////////////////////
  183. #define LINK_INVALID_INSTANCE MAKE_CUSTOM_HRESULT(SEVERITY_ERROR, TRUE, FACILITY_H245WS, LINK_ERROR_BASE+1)
  184. #define LINK_DUPLICATE_INSTANCE MAKE_CUSTOM_HRESULT(SEVERITY_ERROR, TRUE, FACILITY_H245WS, LINK_ERROR_BASE+2)
  185. #define LINK_MEM_FAILURE MAKE_CUSTOM_HRESULT(SEVERITY_ERROR, TRUE, FACILITY_H245WS, ERROR_OUTOFMEMORY)
  186. #define LINK_INVALID_STATE MAKE_CUSTOM_HRESULT(SEVERITY_ERROR, TRUE, FACILITY_H245WS, LINK_ERROR_BASE+6)
  187. /**************************************************************************
  188. ** Function : linkLayerShutdown
  189. ** Description : This releases all the memory the link layer used for a particular
  190. ** instance. For using any of the linklayer services in that
  191. ** instance again, a linkLayerInit has to be called.
  192. ** This function will shutdown the linklayer session pointed
  193. ** by the dwPhysicalID.
  194. ***************************************************************************/
  195. LINKDLL HRESULT
  196. linkLayerShutdown
  197. (DWORD dwPhysicalId);
  198. typedef
  199. HRESULT
  200. (*PFxnlinkLayerShutdown)
  201. (DWORD dwPhysicalId);
  202. ///////////////////////////////////////////////////////////////
  203. ///
  204. /// SRP Termination defines
  205. ///
  206. ///////////////////////////////////////////////////////////////
  207. /**************************************************************************
  208. ** Function : linkLayerGetInstance
  209. ** Description : Returns the link layer instance corresponding to a physical ID
  210. ***************************************************************************/
  211. LINKDLL DWORD
  212. linkLayerGetInstance
  213. (DWORD dwPhysicalId);
  214. typedef
  215. DWORD
  216. (*PFxnlinkLayerGetInstance)
  217. (DWORD dwPhysicalId);
  218. /**************************************************************************
  219. ** Function : datalinkReceiveRequest
  220. ** Description : Posts one receive message buffer to the link layer subsystem.
  221. ** This buffer will be filled in by the incoming message for
  222. ** the specified channel. H223_DATA_INDICATION will be sendto
  223. ** the client on receiving a complete PDU. Error messages may also be
  224. ** reported.
  225. ***************************************************************************/
  226. LINKDLL HRESULT
  227. datalinkReceiveRequest
  228. (
  229. DWORD dwPhysicalId,
  230. PBYTE pbyDataBuf,
  231. DWORD dwLength
  232. );
  233. typedef
  234. HRESULT
  235. (*PFxndatalinkReceiveRequest)
  236. (
  237. DWORD dwPhysicalId,
  238. PBYTE pbyDataBuf,
  239. DWORD dwLength
  240. );
  241. // Link Receive Request return codes
  242. #define LINK_RECV_NOBUFF MAKE_CUSTOM_HRESULT(SEVERITY_ERROR, TRUE, FACILITY_H245WS, LINK_RCV_ERROR_BASE+ 2) // No room for buffering
  243. /**************************************************************************
  244. ** Function : datalinkCancelReceiveRequest
  245. ** Description : Posts one receive message buffer to the link layer subsystem.
  246. ** This buffer will be filled in by the incoming message for
  247. ** the specified channel. H223_DATA_INDICATION will be sendto
  248. ** the client on receiving a complete PDU. Error messages may also be
  249. ** reported.
  250. ***************************************************************************/
  251. LINKDLL HRESULT
  252. datalinkCancelReceiveRequest
  253. (
  254. DWORD dwPhysicalId,
  255. PBYTE pbyDataBuf
  256. );
  257. typedef
  258. HRESULT
  259. (*PFxndatalinkCancelReceiveRequest)
  260. (
  261. DWORD dwPhysicalId,
  262. PBYTE pbyDataBuf
  263. );
  264. /**************************************************************************
  265. ** Function : datalinkSendRequest
  266. ** Description : Hands over the message to be sent to the link layer subsystem.
  267. ***************************************************************************/
  268. LINKDLL HRESULT
  269. datalinkSendRequest
  270. (
  271. DWORD dwPhysicalId,
  272. PBYTE pbyDataBuf,
  273. DWORD dwLength
  274. );
  275. typedef
  276. HRESULT
  277. (*PFxndatalinkSendRequest)
  278. (
  279. DWORD dwPhysicalId,
  280. PBYTE pbyDataBuf,
  281. DWORD dwLength
  282. );
  283. // Link Send Request return codes
  284. #define LINK_SEND_NOBUFF MAKE_CUSTOM_HRESULT(SEVERITY_ERROR, TRUE, FACILITY_H245WS, LINK_SEND_ERROR_BASE+2)
  285. /**************************************************************************
  286. ** Function : linkLayerFlushChannel
  287. ** Description : All the posted transmit and/or receive buffers are released.
  288. ** The bitmasks DATALINK_RECEIVE and DATALINK_RECEIVE can
  289. ** be OR'd together to perform both functions in the same call
  290. **************************************************************************/
  291. LINKDLL HRESULT
  292. linkLayerFlushChannel
  293. (DWORD dwPhysicalId, DWORD dwDirectionMask);
  294. typedef
  295. HRESULT
  296. (*PFxnlinkLayerFlushChannel)
  297. (DWORD dwPhysicalId, DWORD dwDirectionMask);
  298. // Bits for dwDirectionMask
  299. #define DATALINK_RECEIVE 0x01 // Flush buffer in receive direction
  300. #define DATALINK_TRANSMIT 0x02 // Flush buffer in Transmit direction
  301. #define DATALINK_TX_ACTIVES 0x04 // Flush buffers actively being transmitted
  302. #define SHUTDOWN_PENDING 0x08 // Shutdown is in progress
  303. #define FLUSH_SYNCH 0x10 // 0: Asynch call, 1: Synchronous call
  304. #define DATALINK_TRANSMIT_ALL (DATALINK_TRANSMIT | DATALINK_TX_ACTIVES)
  305. #define SHUTDOWN_MASK (DATALINK_RECEIVE | DATALINK_TRANSMIT | SHUTDOWN_PENDING)
  306. // linkLayerFlushChannel Callback
  307. #define LINK_FLUSH_COMPLETE MAKE_CUSTOM_HRESULT(SEVERITY_SUCCESS, TRUE, FACILITY_H245WS, LINK_UTIL_COMP_BASE+1)
  308. /**************************************************************************
  309. ** Function : linkLayerFlushAll
  310. ** Description : All the posted transmit and/or receive buffers are released.
  311. ** Same as LinkLayerFlushChannel except:
  312. ** 1) Synchronous Call
  313. ** 2) Transmit Buffers in progress are flushed
  314. **************************************************************************/
  315. LINKDLL HRESULT
  316. linkLayerFlushAll
  317. (DWORD dwPhysicalId);
  318. typedef
  319. HRESULT
  320. (*PFxnlinkLayerFlushAll)
  321. (DWORD dwPhysicalId);
  322. // linkLayerFlushChannel RETURN CODES same as for linkLayerFlushChannel
  323. #define LINK_UNKNOWN_ADDR MAKE_CUSTOM_HRESULT(SEVERITY_ERROR, TRUE, FACILITY_H245WS, LINK_UTIL_ERROR_BASE + 1)
  324. LINKDLL HRESULT
  325. linkLayerConnect(DWORD dwPhysicalId, struct _ADDR *pAddr, H245CONNECTCALLBACK callback);
  326. LINKDLL HRESULT
  327. linkLayerListen(DWORD* dwPhysicalId, DWORD dwH245Instance, struct _ADDR *pAddr, H245CONNECTCALLBACK callback);
  328. LINKDLL HRESULT
  329. linkLayerAccept(DWORD dwPhysicalIdListen, DWORD dwPhysicalIdAccept, H245CONNECTCALLBACK callback);
  330. #define LL_PDU_SIZE 2048
  331. /**************************************************************************
  332. **
  333. ** Dynamic DLL Function Calls
  334. **
  335. **************************************************************************/
  336. #ifdef UNICODE
  337. #define SRPDLLFILE L"h245srp.dll"
  338. #define H245WSDLLFILE L"h245ws.dll"
  339. #else
  340. #define SRPDLLFILE "h245srp.dll"
  341. #define H245WSDLLFILE "h245ws.dll"
  342. #endif
  343. #if defined(REMOVE_FROM_TSP)
  344. #define LINKINITIALIZE __TEXT("linkLayerInit")
  345. #define LINKSHUTDOWN __TEXT("linkLayerShutdown")
  346. #define LINKGETINSTANCE __TEXT("linkLayerGetInstance")
  347. #define LINKRECEIVEREQUEST __TEXT("datalinkReceiveRequest")
  348. #define LINKSENDREQUEST __TEXT("datalinkSendRequest")
  349. #define LINKFLUSHCHANNEL __TEXT("linkLayerFlushChannel")
  350. #define LINKFLUSHALL __TEXT("linkLayerFlushAll")
  351. #endif // REMOVE_FROM_TSP
  352. #if defined(__cplusplus)
  353. }
  354. #endif // (__cplusplus)
  355. #endif // LINKAPI_H