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.

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