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.

303 lines
8.4 KiB

  1. /*==========================================================================
  2. *
  3. * Copyright (C) 1998-2000 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: Locals.h
  6. * Content: Global information for the DNSerial service provider
  7. *
  8. *
  9. * History:
  10. * Date By Reason
  11. * ==== == ======
  12. * 11/25/98 jtk Created
  13. ***************************************************************************/
  14. #ifndef __LOCALS_H__
  15. #define __LOCALS_H__
  16. #undef DPF_SUBCOMP
  17. #define DPF_SUBCOMP DN_SUBCOMP_MODEM
  18. //**********************************************************************
  19. // Constant definitions
  20. //**********************************************************************
  21. //
  22. // max 32-bit value
  23. //
  24. #define UINT32_MAX ((DWORD) 0xFFFFFFFF)
  25. #define WORD_MAX ((WORD) 0xFFFF)
  26. //
  27. // invalid port ID
  28. //
  29. #define INVALID_DEVICE_ID -1
  30. //
  31. // string for name of a com port
  32. //
  33. #define COM_PORT_STRING "COM"
  34. #define COM_PORT_TEMPLATE "COM%d"
  35. #define COM_PORT_STRING_LENGTH 7
  36. //
  37. // no error code from TAPI
  38. //
  39. #define LINEERR_NONE 0
  40. //
  41. // event indicies for all threads
  42. //
  43. #define SP_CLOSING_EVENT_INDEX 0
  44. #define USER_CANCEL_EVENT_INDEX 1
  45. #define MAX_ACTIVE_WIN9X_ENDPOINTS 25
  46. #define MAX_PHONE_NUMBER_LENGTH 200
  47. //
  48. // enumeration of flow control
  49. //
  50. typedef enum
  51. {
  52. FLOW_NONE, // no flow control
  53. FLOW_XONXOFF, // XON/XOFF flow control
  54. FLOW_RTS, // RTS
  55. FLOW_DTR, // DTR
  56. FLOW_RTSDTR // RTS/DTR
  57. } SP_FLOW_CONTROL;
  58. // definitions of communication types
  59. typedef DWORD SP_BAUD_RATE;
  60. typedef DWORD SP_STOP_BITS;
  61. typedef DWORD SP_PARITY_TYPE; // SP_PARITY is reserved in WINBASE.H
  62. // buffer limits for XON/XOFF flow control
  63. #define XON_LIMIT 100
  64. #define XOFF_LIMIT 100
  65. // XON/XOFF flow control characters
  66. #define ASCII_XON 0x11
  67. #define ASCII_XOFF 0x13
  68. // timeout intervals (milliseconds)
  69. #define WRITE_TIMEOUT_MS 5000
  70. #define READ_TIMEOUT_MS 500
  71. // maximum user data allowed in a message
  72. #define MAX_MESSAGE_SIZE 1500
  73. #define MAX_USER_PAYLOAD ( MAX_MESSAGE_SIZE - sizeof( _MESSAGE_HEADER ) )
  74. //
  75. // Message start tokens (make non-ascii to reduce chance of being user data)
  76. // The tokens need to be arranged such that all messages start with the INITIAL_DATA_SUB_TOKEN
  77. // Note that enums use the bottom 2 bits of the 'command' token for RTT.
  78. // The high-bit of the 'command' token is reserved.
  79. //
  80. #define SERIAL_HEADER_START 0xCC
  81. #define SERIAL_DATA_USER_DATA 0x40
  82. #define SERIAL_DATA_ENUM_QUERY 0x60
  83. #define SERIAL_DATA_ENUM_RESPONSE 0x20
  84. #define ENUM_RTT_MASK 0x03
  85. //
  86. // enumerated constants for IO completion returns
  87. //
  88. typedef enum _IO_COMPLETION_KEY
  89. {
  90. IO_COMPLETION_KEY_UNKNONW = 0, // invalid value
  91. IO_COMPLETION_KEY_SP_CLOSE, // SP is closing, bail on completion threads
  92. IO_COMPLETION_KEY_TAPI_MESSAGE, // TAPI sent a message
  93. IO_COMPLETION_KEY_IO_COMPLETE, // IO operation complete
  94. IO_COMPLETION_KEY_NEW_JOB, // new job notification
  95. } IO_COMPLETION_KEY;
  96. //
  97. // enumerated values indicating how to open provider
  98. //
  99. typedef enum _LINK_DIRECTION
  100. {
  101. LINK_DIRECTION_UNKNOWN = 0, // unknown state
  102. LINK_DIRECTION_INCOMING, // incoming state
  103. LINK_DIRECTION_OUTGOING // outgoing state
  104. } LINK_DIRECTION;
  105. //
  106. // initialization states of address components
  107. //
  108. typedef enum _SP_ADDRESS_COMPONENT_STATE
  109. {
  110. SP_ADDRESS_COMPONENT_UNINITIALIZED = 0,
  111. SP_ADDRESS_COMPONENT_INITIALIZATION_FAILED,
  112. SP_ADDRESS_COMPONENT_INITIALIZED
  113. } SP_ADDRESS_COMPONENT_STATE;
  114. typedef enum _ADDRESS_TYPE
  115. {
  116. ADDRESS_TYPE_UNKNOWN = 0,
  117. ADDRESS_TYPE_REMOTE_HOST,
  118. ADDRESS_TYPE_LOCAL_ADAPTER,
  119. ADDRESS_TYPE_LOCAL_ADAPTER_HOST_FORMAT
  120. } ADDRESS_TYPE;
  121. //
  122. // default enum retries for serial SP and retry time (milliseconds)
  123. //
  124. #define DEFAULT_ENUM_RETRY_COUNT 5
  125. #define DEFAULT_ENUM_RETRY_INTERVAL 1500
  126. #define DEFAULT_ENUM_TIMEOUT 1500
  127. //**********************************************************************
  128. // Macro definitions
  129. //**********************************************************************
  130. //**********************************************************************
  131. // Structure definitions
  132. //**********************************************************************
  133. //
  134. // structure for all TAPI information
  135. //
  136. typedef struct _TAPI_INFO
  137. {
  138. HLINEAPP hApplicationInstance; // from lineInitializeEx()
  139. DWORD dwVersion; // negotiated version
  140. DWORD dwLinesAvailable; // number of TAPI lines available
  141. } TAPI_INFO;
  142. //**********************************************************************
  143. // Variable definitions
  144. //**********************************************************************
  145. // DLL instance
  146. extern HINSTANCE g_hModemDLLInstance;
  147. #ifndef DPNBUILD_LIBINTERFACE
  148. //
  149. // count of outstanding COM interfaces
  150. //
  151. extern volatile LONG g_lModemOutstandingInterfaceCount;
  152. #endif // ! DPNBUILD_LIBINTERFACE
  153. extern const TCHAR g_NullToken;
  154. //
  155. // thread count
  156. //
  157. extern INT g_iThreadCount;
  158. //
  159. // GUIDs for munging device IDs
  160. //
  161. extern GUID g_ModemSPEncryptionGuid;
  162. extern GUID g_SerialSPEncryptionGuid;
  163. #ifdef DBG
  164. extern CBilink g_blDPNModemCritSecsHeld;
  165. #endif // DBG
  166. //**********************************************************************
  167. // TAPI Function prototypes
  168. //**********************************************************************
  169. //
  170. // TAPI interface functions
  171. //
  172. #ifdef UNICODE
  173. #define TAPI_APPEND_LETTER "W"
  174. #else
  175. #define TAPI_APPEND_LETTER "A"
  176. #endif // UNICODE
  177. // UNICODE and ANSI versions same
  178. typedef LONG WINAPI TAPI_lineClose( HLINE hLine );
  179. typedef LONG WINAPI TAPI_lineDeallocateCall( HCALL hCall );
  180. typedef LONG WINAPI TAPI_lineGetMessage( HLINEAPP hLineApp,
  181. LPLINEMESSAGE lpMessage,
  182. DWORD dwTimeout );
  183. typedef LONG WINAPI TAPI_lineShutdown( HLINEAPP hLineApp );
  184. typedef LONG WINAPI TAPI_lineAnswer( HCALL hCall,
  185. LPCSTR lpsUserUserInfo,
  186. DWORD dwSize );
  187. typedef LONG WINAPI TAPI_lineDrop( HCALL hCall,
  188. LPCSTR lpsUserUserInfo,
  189. DWORD dwSize );
  190. typedef LONG WINAPI TAPI_lineNegotiateAPIVersion( HLINEAPP hLineApp,
  191. DWORD dwDeviceID,
  192. DWORD dwAPILowVersion,
  193. DWORD dwAPIHighVersion,
  194. LPDWORD lpdwAPIVersion,
  195. LPLINEEXTENSIONID lpExtensionID );
  196. // Unicode vs. ANSI
  197. typedef LONG WINAPI TAPI_lineConfigDialog( DWORD dwDeviceID,
  198. HWND hwndOwner,
  199. LPCTSTR lpszDeviceClass );
  200. typedef LONG WINAPI TAPI_lineGetDevCaps( HLINEAPP hLineApp,
  201. DWORD dwDeviceID,
  202. DWORD dwAPIVersion,
  203. DWORD dwExtVersion,
  204. LPLINEDEVCAPS lpLineDevCaps );
  205. typedef LONG WINAPI TAPI_lineGetID( HLINE hLine,
  206. DWORD dwAddressID,
  207. HCALL hCall,
  208. DWORD dwSelect,
  209. LPVARSTRING lpDeviceID,
  210. LPCTSTR lpszDeviceClass );
  211. typedef LONG WINAPI TAPI_lineInitializeEx( LPHLINEAPP lphLineApp,
  212. HINSTANCE hInstance,
  213. LINECALLBACK lpfnCallback,
  214. LPCTSTR lpszFriendlyAppName,
  215. LPDWORD lpdwNumDevs,
  216. LPDWORD lpdwAPIVersion,
  217. LPLINEINITIALIZEEXPARAMS lpLineInitializeExParams );
  218. typedef LONG WINAPI TAPI_lineMakeCall( HLINEAPP hLineApp,
  219. LPHCALL lphCall,
  220. LPCTSTR lpszDestAddress,
  221. DWORD dwCountryCode,
  222. LPLINECALLPARAMS const lpCallParams );
  223. typedef LONG WINAPI TAPI_lineOpen( HLINEAPP hLineApp,
  224. DWORD dwDeviceID,
  225. LPHLINE lphLine,
  226. DWORD dwAPIVersion,
  227. DWORD dwExtVersion,
  228. DWORD_PTR dwCallbackInstance,
  229. DWORD dwPrivileges,
  230. DWORD dwMediaModes,
  231. LPLINECALLPARAMS const lpCallParams );
  232. extern TAPI_lineAnswer* p_lineAnswer;
  233. extern TAPI_lineClose* p_lineClose;
  234. extern TAPI_lineConfigDialog* p_lineConfigDialog;
  235. extern TAPI_lineDeallocateCall* p_lineDeallocateCall;
  236. extern TAPI_lineDrop* p_lineDrop;
  237. extern TAPI_lineGetDevCaps* p_lineGetDevCaps;
  238. extern TAPI_lineGetID* p_lineGetID;
  239. extern TAPI_lineGetMessage* p_lineGetMessage;
  240. extern TAPI_lineInitializeEx* p_lineInitializeEx;
  241. extern TAPI_lineMakeCall* p_lineMakeCall;
  242. extern TAPI_lineNegotiateAPIVersion* p_lineNegotiateAPIVersion;
  243. extern TAPI_lineOpen* p_lineOpen;
  244. extern TAPI_lineShutdown* p_lineShutdown;
  245. //**********************************************************************
  246. // Function definitions
  247. //**********************************************************************
  248. #endif // __LOCALS_H__