Leaked source code of windows server 2003
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.

404 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. // declare exported functions
  83. #if defined(LINKDLL_EXPORT)
  84. #define LINKDLL __declspec (dllexport)
  85. #else // (LINKDLL_EXPORT)
  86. #define LINKDLL __declspec (dllimport)
  87. #endif // (LINKDLL_EXPORT)
  88. #define SRPDLL LINKDLL
  89. ////////////////////////////////////////////////////////////////////////////
  90. //
  91. // Link Layer defaults
  92. //
  93. ////////////////////////////////////////////////////////////////////////////
  94. #define INVALID_PHYS_ID (DWORD) 0xffffffff
  95. ////////////////////////////////////////////////////////////////////////////
  96. //
  97. // Link Layer Error defines
  98. //
  99. ////////////////////////////////////////////////////////////////////////////
  100. #define LINK_ERROR_BASE ERROR_LOCAL_BASE_ID
  101. #define LINK_SEND_ERROR_BASE LINK_ERROR_BASE + 0x100
  102. #define LINK_SEND_COMP_BASE LINK_ERROR_BASE + 0x200
  103. #define LINK_RCV_ERROR_BASE LINK_ERROR_BASE + 0x300
  104. #define LINK_RCV_COMP_BASE LINK_ERROR_BASE + 0x400
  105. #define LINK_UTIL_ERROR_BASE LINK_ERROR_BASE + 0x500
  106. #define LINK_UTIL_COMP_BASE LINK_ERROR_BASE + 0x600
  107. #define LINK_FATAL_ERROR LINK_ERROR_BASE + 0x700
  108. #define LINK_CONN_ERROR_BASE LINK_ERROR_BASE + 0x800
  109. #define LINK_CONN_COMP_BASE LINK_ERROR_BASE + 0x900
  110. ////////////////////////////////////////////////////////////////////////////
  111. //
  112. // CallBack Prototype for Channel CallBack
  113. //
  114. ////////////////////////////////////////////////////////////////////////////
  115. typedef void (*H245SRCALLBACK)
  116. (
  117. DWORD dwH245Instance,
  118. HRESULT dwMessage,
  119. PBYTE pbyDataBuf,
  120. DWORD dwLength
  121. );
  122. // Link Send Callback error codes
  123. #define LINK_SEND_COMPLETE MAKE_CUSTOM_HRESULT(SEVERITY_SUCCESS, TRUE, FACILITY_H245WS, LINK_SEND_COMP_BASE+ 0)
  124. #define LINK_SEND_ABORT MAKE_CUSTOM_HRESULT(SEVERITY_SUCCESS, TRUE, FACILITY_H245WS, LINK_SEND_COMP_BASE+ 5) // Tx aborted the SDU (not implemented)
  125. #define LINK_SEND_WOULD_BLOCK MAKE_CUSTOM_HRESULT(SEVERITY_SUCCESS, TRUE, FACILITY_H245WS, LINK_SEND_COMP_BASE+20)
  126. #define LINK_SEND_CLOSED MAKE_CUSTOM_HRESULT(SEVERITY_SUCCESS, TRUE, FACILITY_H245WS, LINK_SEND_COMP_BASE+22)
  127. #define LINK_SEND_ERROR MAKE_CUSTOM_HRESULT(SEVERITY_ERROR, TRUE, FACILITY_H245WS, LINK_SEND_COMP_BASE+23)
  128. // Link Receive Callback error codes
  129. #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)
  130. #define LINK_RECV_ABORT MAKE_CUSTOM_HRESULT(SEVERITY_SUCCESS, TRUE, FACILITY_H245WS, LINK_RCV_COMP_BASE+ 7) // Tx aborted the SDU (not implemented)
  131. #define LINK_RECV_ERROR MAKE_CUSTOM_HRESULT(SEVERITY_ERROR, TRUE, FACILITY_H245WS, LINK_RCV_COMP_BASE+10) // from AL2 - _CRC error
  132. #define LINK_RECV_WOULD_BLOCK MAKE_CUSTOM_HRESULT(SEVERITY_SUCCESS, TRUE, FACILITY_H245WS, LINK_RCV_COMP_BASE+20)
  133. #define LINK_RECV_CLOSED MAKE_CUSTOM_HRESULT(SEVERITY_SUCCESS, TRUE, FACILITY_H245WS, LINK_RCV_COMP_BASE+22)
  134. typedef void (*H245CONNECTCALLBACK)
  135. (
  136. DWORD dwH245Instance,
  137. HRESULT dwMessage,
  138. struct _ADDR *LocalAddr,
  139. struct _ADDR *PeerAddr
  140. );
  141. #define LINK_CONNECT_REQUEST MAKE_CUSTOM_HRESULT(SEVERITY_SUCCESS, TRUE, FACILITY_H245WS, LINK_CONN_COMP_BASE+1)
  142. #define LINK_CONNECT_COMPLETE MAKE_CUSTOM_HRESULT(SEVERITY_SUCCESS, TRUE, FACILITY_H245WS, LINK_CONN_COMP_BASE+2)
  143. ////////////////////////////////////////////////////////////////////////////
  144. //
  145. // Link Layer Function Prototypes
  146. //
  147. ////////////////////////////////////////////////////////////////////////////
  148. LINKDLL VOID H245WSShutdown();
  149. /**************************************************************************
  150. ** Function : linkLayerInit
  151. ** Description : This function will initialize the datalink subsystem.
  152. ** This in turn will make appropriate calls to initialize
  153. ** the software and hardware subsystems below this layer.
  154. ** linkLayernit() has to be called before any other service or
  155. ** System control functions are used.
  156. ****************************************************************************/
  157. LINKDLL HRESULT
  158. linkLayerInit
  159. (
  160. DWORD* pdwPhysicalId,
  161. DWORD dwH245Instance,
  162. H245SRCALLBACK cbReceiveComplete,
  163. H245SRCALLBACK cbTransmitComplete
  164. );
  165. typedef
  166. HRESULT
  167. (*PFxnlinkLayerInit)
  168. (
  169. DWORD* pdwPhysicalId,
  170. DWORD dwH245Instance,
  171. H245SRCALLBACK cbReceiveComplete,
  172. H245SRCALLBACK cbTransmitComplete
  173. );
  174. ///////////////////////////////////////////////////////////////
  175. ///
  176. /// SRP Initialization defines
  177. ///
  178. ///////////////////////////////////////////////////////////////
  179. #define LINK_INVALID_INSTANCE MAKE_CUSTOM_HRESULT(SEVERITY_ERROR, TRUE, FACILITY_H245WS, LINK_ERROR_BASE+1)
  180. #define LINK_DUPLICATE_INSTANCE MAKE_CUSTOM_HRESULT(SEVERITY_ERROR, TRUE, FACILITY_H245WS, LINK_ERROR_BASE+2)
  181. #define LINK_MEM_FAILURE MAKE_CUSTOM_HRESULT(SEVERITY_ERROR, TRUE, FACILITY_H245WS, ERROR_OUTOFMEMORY)
  182. #define LINK_INVALID_STATE MAKE_CUSTOM_HRESULT(SEVERITY_ERROR, TRUE, FACILITY_H245WS, LINK_ERROR_BASE+6)
  183. /**************************************************************************
  184. ** Function : linkLayerShutdown
  185. ** Description : This releases all the memory the link layer used for a particular
  186. ** instance. For using any of the linklayer services in that
  187. ** instance again, a linkLayerInit has to be called.
  188. ** This function will shutdown the linklayer session pointed
  189. ** by the dwPhysicalID.
  190. ***************************************************************************/
  191. LINKDLL HRESULT
  192. linkLayerShutdown
  193. (DWORD dwPhysicalId);
  194. typedef
  195. HRESULT
  196. (*PFxnlinkLayerShutdown)
  197. (DWORD dwPhysicalId);
  198. ///////////////////////////////////////////////////////////////
  199. ///
  200. /// SRP Termination defines
  201. ///
  202. ///////////////////////////////////////////////////////////////
  203. /**************************************************************************
  204. ** Function : linkLayerGetInstance
  205. ** Description : Returns the link layer instance corresponding to a physical ID
  206. ***************************************************************************/
  207. LINKDLL DWORD
  208. linkLayerGetInstance
  209. (DWORD dwPhysicalId);
  210. typedef
  211. DWORD
  212. (*PFxnlinkLayerGetInstance)
  213. (DWORD dwPhysicalId);
  214. /**************************************************************************
  215. ** Function : datalinkReceiveRequest
  216. ** Description : Posts one receive message buffer to the link layer subsystem.
  217. ** This buffer will be filled in by the incoming message for
  218. ** the specified channel. H223_DATA_INDICATION will be sendto
  219. ** the client on receiving a complete PDU. Error messages may also be
  220. ** reported.
  221. ***************************************************************************/
  222. LINKDLL HRESULT
  223. datalinkReceiveRequest
  224. (
  225. DWORD dwPhysicalId,
  226. PBYTE pbyDataBuf,
  227. DWORD dwLength
  228. );
  229. typedef
  230. HRESULT
  231. (*PFxndatalinkReceiveRequest)
  232. (
  233. DWORD dwPhysicalId,
  234. PBYTE pbyDataBuf,
  235. DWORD dwLength
  236. );
  237. // Link Receive Request return codes
  238. #define LINK_RECV_NOBUFF MAKE_CUSTOM_HRESULT(SEVERITY_ERROR, TRUE, FACILITY_H245WS, LINK_RCV_ERROR_BASE+ 2) // No room for buffering
  239. /**************************************************************************
  240. ** Function : datalinkSendRequest
  241. ** Description : Hands over the message to be sent to the link layer subsystem.
  242. ***************************************************************************/
  243. LINKDLL HRESULT
  244. datalinkSendRequest
  245. (
  246. DWORD dwPhysicalId,
  247. PBYTE pbyDataBuf,
  248. DWORD dwLength
  249. );
  250. typedef
  251. HRESULT
  252. (*PFxndatalinkSendRequest)
  253. (
  254. DWORD dwPhysicalId,
  255. PBYTE pbyDataBuf,
  256. DWORD dwLength
  257. );
  258. // Link Send Request return codes
  259. #define LINK_SEND_NOBUFF MAKE_CUSTOM_HRESULT(SEVERITY_ERROR, TRUE, FACILITY_H245WS, LINK_SEND_ERROR_BASE+2)
  260. /**************************************************************************
  261. ** Function : linkLayerFlushChannel
  262. ** Description : All the posted transmit and/or receive buffers are released.
  263. ** The bitmasks DATALINK_RECEIVE and DATALINK_RECEIVE can
  264. ** be OR'd together to perform both functions in the same call
  265. **************************************************************************/
  266. LINKDLL HRESULT
  267. linkLayerFlushChannel
  268. (DWORD dwPhysicalId, DWORD dwDirectionMask);
  269. typedef
  270. HRESULT
  271. (*PFxnlinkLayerFlushChannel)
  272. (DWORD dwPhysicalId, DWORD dwDirectionMask);
  273. // Bits for dwDirectionMask
  274. #define DATALINK_RECEIVE 0x01 // Flush buffer in receive direction
  275. #define DATALINK_TRANSMIT 0x02 // Flush buffer in Transmit direction
  276. #define DATALINK_TX_ACTIVES 0x04 // Flush buffers actively being transmitted
  277. #define SHUTDOWN_PENDING 0x08 // Shutdown is in progress
  278. #define FLUSH_SYNCH 0x10 // 0: Asynch call, 1: Synchronous call
  279. #define DATALINK_TRANSMIT_ALL (DATALINK_TRANSMIT | DATALINK_TX_ACTIVES)
  280. #define SHUTDOWN_MASK (DATALINK_RECEIVE | DATALINK_TRANSMIT | SHUTDOWN_PENDING)
  281. // linkLayerFlushChannel Callback
  282. #define LINK_FLUSH_COMPLETE MAKE_CUSTOM_HRESULT(SEVERITY_SUCCESS, TRUE, FACILITY_H245WS, LINK_UTIL_COMP_BASE+1)
  283. /**************************************************************************
  284. ** Function : linkLayerFlushAll
  285. ** Description : All the posted transmit and/or receive buffers are released.
  286. ** Same as LinkLayerFlushChannel except:
  287. ** 1) Synchronous Call
  288. ** 2) Transmit Buffers in progress are flushed
  289. **************************************************************************/
  290. LINKDLL HRESULT
  291. linkLayerFlushAll
  292. (DWORD dwPhysicalId);
  293. typedef
  294. HRESULT
  295. (*PFxnlinkLayerFlushAll)
  296. (DWORD dwPhysicalId);
  297. // linkLayerFlushChannel RETURN CODES same as for linkLayerFlushChannel
  298. #define LINK_UNKNOWN_ADDR MAKE_CUSTOM_HRESULT(SEVERITY_ERROR, TRUE, FACILITY_H245WS, LINK_UTIL_ERROR_BASE + 1)
  299. LINKDLL HRESULT
  300. linkLayerConnect(DWORD dwPhysicalId, struct _ADDR *pAddr, H245CONNECTCALLBACK callback);
  301. LINKDLL HRESULT
  302. linkLayerListen(DWORD* dwPhysicalId, DWORD dwH245Instance, struct _ADDR *pAddr, H245CONNECTCALLBACK callback);
  303. LINKDLL HRESULT
  304. linkLayerAccept(DWORD dwPhysicalIdListen, DWORD dwPhysicalIdAccept, H245CONNECTCALLBACK callback);
  305. #define LL_PDU_SIZE 2048
  306. /**************************************************************************
  307. **
  308. ** Dynamic DLL Function Calls
  309. **
  310. **************************************************************************/
  311. #ifdef UNICODE
  312. #define SRPDLLFILE L"h245srp.dll"
  313. #define H245WSDLLFILE L"h245ws.dll"
  314. #else
  315. #define SRPDLLFILE "h245srp.dll"
  316. #define H245WSDLLFILE "h245ws.dll"
  317. #endif
  318. #define LINKINITIALIZE __TEXT("linkLayerInit")
  319. #define LINKSHUTDOWN __TEXT("linkLayerShutdown")
  320. #define LINKGETINSTANCE __TEXT("linkLayerGetInstance")
  321. #define LINKRECEIVEREQUEST __TEXT("datalinkReceiveRequest")
  322. #define LINKSENDREQUEST __TEXT("datalinkSendRequest")
  323. #define LINKFLUSHCHANNEL __TEXT("linkLayerFlushChannel")
  324. #define LINKFLUSHALL __TEXT("linkLayerFlushAll")
  325. #if defined(__cplusplus)
  326. }
  327. #endif // (__cplusplus)
  328. #endif // LINKAPI_H