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.

229 lines
7.1 KiB

  1. /***************************************************************************
  2. *
  3. * File: h245ws.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: h245ws.h $
  15. * $Revision: 1.19 $
  16. * $Modtime: 31 Jan 1997 15:56:32 $
  17. * $Log: S:\sturgeon\src\h245ws\vcs\h245ws.h_v $
  18. *
  19. * Rev 1.19 31 Jan 1997 16:23:34 SBELL1
  20. * Got rid of unused next pointer and put in definition of SocketTOPhysicalID
  21. *
  22. * Rev 1.18 13 Dec 1996 12:13:06 SBELL1
  23. * moved ifdef _cplusplus to after includes
  24. *
  25. * Rev 1.17 11 Dec 1996 13:45:36 SBELL1
  26. * Changed table/locks to use tstable.h stuff.
  27. *
  28. * Rev 1.16 21 Jun 1996 18:51:44 unknown
  29. * Fixed yet another shutdown bug - linkLayerShutdown re-entrancy check.
  30. *
  31. * Rev 1.14 17 May 1996 16:49:36 EHOWARDX
  32. * Shutdown fix.
  33. *
  34. * Rev 1.13 16 May 1996 13:09:50 EHOWARDX
  35. * Made reporting of IP Addres and port consistent between linkLayerListen
  36. * and LinkLayerConnect.
  37. *
  38. * Rev 1.12 09 May 1996 18:33:06 EHOWARDX
  39. *
  40. * Changes to build with new LINKAPI.H.
  41. *
  42. * Rev 1.11 Apr 29 1996 14:02:28 plantz
  43. * Delete unused or private functions.
  44. *
  45. * Rev 1.10 Apr 29 1996 12:15:38 plantz
  46. * Remove unused members of HWSINST structure.
  47. *
  48. * Rev 1.9 Apr 24 1996 20:46:58 plantz
  49. * Changed ListenCallback to ConnectCallback in HWSINST structure.
  50. *
  51. * Rev 1.8 Apr 24 1996 16:24:14 plantz
  52. * Change to use winsock 1 and not use overlapped I/O.
  53. *
  54. * Rev 1.7 01 Apr 1996 14:20:38 unknown
  55. * Shutdown redesign.
  56. *
  57. * Rev 1.6 27 Mar 1996 13:01:28 EHOWARDX
  58. * Added dwThreadId to H245WS instance structure.
  59. *
  60. * Rev 1.5 19 Mar 1996 20:21:46 EHOWARDX
  61. * Redesigned shutdown.
  62. *
  63. * Rev 1.3 18 Mar 1996 19:07:10 EHOWARDX
  64. * Fixed shutdown; eliminated TPKT/WSCB dependencies.
  65. * Define TPKT to put TPKT/WSCB dependencies back in.
  66. *
  67. * Rev 1.2 14 Mar 1996 17:01:50 EHOWARDX
  68. *
  69. * NT4.0 testing; got rid of HwsAssert(); got rid of TPKT/WSCB.
  70. *
  71. * Rev 1.1 09 Mar 1996 21:12:58 EHOWARDX
  72. * Fixes as result of testing.
  73. *
  74. * Rev 1.0 08 Mar 1996 20:17:56 unknown
  75. * Initial revision.
  76. *
  77. ***************************************************************************/
  78. #ifndef H245WS_H
  79. #define H245WS_H
  80. #ifndef STRICT
  81. #define STRICT
  82. #endif
  83. #ifdef __cplusplus
  84. extern "C"
  85. {
  86. #endif // __cplusplus
  87. /*
  88. * Constants
  89. */
  90. #define SUCCESS 0
  91. #define TPKT_VERSION 3
  92. #define TPKT_HEADER_SIZE 4
  93. // Indexes of permanent events in Events[]
  94. #define EVENT_SOCKET 0
  95. #define EVENT_RECV 1
  96. #define EVENT_SEND 2
  97. #define EVENT_FIRST 3
  98. // Values for byLevel
  99. #define HWS_CRITICAL 0x01
  100. #define HWS_ERROR 0x02
  101. #define HWS_WARNING 0x04
  102. #define HWS_NOTIFY 0x08
  103. #define HWS_TRACE 0x10
  104. #define HWS_TEMP 0x20
  105. #if defined(_DEBUG)
  106. void HwsTrace (DWORD dwInst, BYTE byLevel, LPSTR pszFormat, ...);
  107. #define HWSASSERT ASSERT
  108. #define HWSTRACE0(dwH245Instance,byLevel,a) HwsTrace(dwH245Instance,byLevel,a)
  109. #define HWSTRACE1(dwH245Instance,byLevel,a,b) HwsTrace(dwH245Instance,byLevel,a,b)
  110. #define HWSTRACE2(dwH245Instance,byLevel,a,b,c) HwsTrace(dwH245Instance,byLevel,a,b,c)
  111. #define HWSTRACE3(dwH245Instance,byLevel,a,b,c,d) HwsTrace(dwH245Instance,byLevel,a,b,c,d)
  112. #define HWSTRACE4(dwH245Instance,byLevel,a,b,c,d,e) HwsTrace(dwH245Instance,byLevel,a,b,c,d,e)
  113. #define HWSTRACE5(dwH245Instance,byLevel,a,b,c,d,e,f) HwsTrace(dwH245Instance,byLevel,a,b,c,d,e,f)
  114. #else // (_DEBUG)
  115. #define HWSASSERT(exp)
  116. #define HWSTRACE0(dwH245Instance,byLevel,a)
  117. #define HWSTRACE1(dwH245Instance,byLevel,a,b)
  118. #define HWSTRACE2(dwH245Instance,byLevel,a,b,c)
  119. #define HWSTRACE3(dwH245Instance,byLevel,a,b,c,d)
  120. #define HWSTRACE4(dwH245Instance,byLevel,a,b,c,d,e)
  121. #define HWSTRACE5(dwH245Instance,byLevel,a,b,c,d,e,f)
  122. #endif // (_DEBUG)
  123. // This structure is used for overlapped sends and receives
  124. typedef struct _IO_REQUEST
  125. {
  126. struct _HWSINST * req_pHws; // Pointer back to socket data
  127. BYTE req_TpktHeader[TPKT_HEADER_SIZE];
  128. int req_header_bytes_done;
  129. BYTE * req_client_data;
  130. int req_client_length;
  131. int req_client_bytes_done;
  132. DWORD req_dwMagic; // Request type (send or receive)
  133. #define RECV_REQUEST_MAGIC 0x91827364
  134. #define SEND_REQUEST_MAGIC 0x19283746
  135. } REQUEST, *PREQUEST;
  136. typedef struct _HWSINST
  137. {
  138. UINT hws_uState;
  139. #define HWS_START 0
  140. #define HWS_LISTENING 1 /* Waiting for FD_ACCEPT */
  141. #define HWS_CONNECTING 2 /* Waiting for FD_CONNECT */
  142. #define HWS_CONNECTED 3 /* Data transfer state */
  143. #define HWS_CLOSING 4 /* Waiting for FD_CLOSE */
  144. #define HWS_CLOSED 5 /* Waiting for linkLayerShutdown() */
  145. #define HWS_SHUTDOWN 6 /* linkLayerShutdown() called from callback */
  146. DWORD hws_dwPhysicalId;
  147. DWORD_PTR hws_dwH245Instance;
  148. H245CONNECTCALLBACK hws_h245ConnectCallback;
  149. H245SRCALLBACK hws_h245RecvCallback;
  150. H245SRCALLBACK hws_h245SendCallback;
  151. SOCKET hws_Socket;
  152. SOCKADDR_IN hws_SockAddr;
  153. UINT hws_uSockAddrLen;
  154. // points to a queue used to hold send buffers
  155. PQUEUE hws_pSendQueue;
  156. // points to a queue used to hold receive buffers
  157. PQUEUE hws_pRecvQueue;
  158. // The maximum message size we can send on this socket.
  159. // This value is either an integer or the manifest constant NO_MAX_MSG_SIZE.
  160. UINT hws_uMaxMsgSize;
  161. BOOL hws_bCloseFlag;
  162. #if defined(_DEBUG)
  163. DWORD hws_dwMagic; // Request type (send or receive)
  164. #define HWSINST_MAGIC 0x12345678
  165. #endif // (_DEBUG)
  166. } HWSINST, *PHWSINST;
  167. typedef struct _SOCKET_TO_INSTANCE
  168. {
  169. SOCKET socket;
  170. DWORD dwPhysicalId;
  171. struct _SOCKET_TO_INSTANCE *next;
  172. } SOCKET_TO_INSTANCE, *PSOCKET_TO_INSTANCE;
  173. #define SOCK_TO_PHYSID_TABLE_SIZE 251
  174. ////////////////////////////////////////////////////////////////////////////
  175. //
  176. // Function Prototypes
  177. //
  178. ////////////////////////////////////////////////////////////////////////////
  179. #ifdef UNICODE_TRACE
  180. LPCTSTR
  181. #else
  182. const char *
  183. #endif
  184. SocketErrorText(void);
  185. //PHWSINST FindPhysicalId(DWORD dwPhysicalId);
  186. void NotifyRead (PHWSINST pHws);
  187. void NotifyWrite (PHWSINST pHws);
  188. void ProcessQueuedRecvs(PHWSINST pHws);
  189. void ProcessQueuedSends(PHWSINST pHws);
  190. void SocketCloseEvent (PHWSINST pHws);
  191. DWORD SocketToPhysicalId (SOCKET socket);
  192. BOOL CreateSocketToPhysicalIdMapping(SOCKET socket, DWORD dwPhysicalId);
  193. BOOL RemoveSocketToPhysicalIdMapping(SOCKET socket);
  194. #if defined(__cplusplus)
  195. }
  196. #endif // (__cplusplus)
  197. #endif // H245WS_H
  198.