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.

376 lines
12 KiB

  1. //****************************************************************************
  2. //
  3. // Microsoft NT Remote Access Service
  4. //
  5. // Copyright (C) 1994-95 Microsft Corporation. All rights reserved.
  6. //
  7. // Filename: rastapi.h
  8. //
  9. // Revision History
  10. //
  11. // Mar 28 1992 Gurdeep Singh Pall Created
  12. //
  13. //
  14. // Description: This file contains all structs for TAPI.DLL
  15. //
  16. //****************************************************************************
  17. #include <wanpub.h> // for NDIS_WAN_MEDIUM_SUBTYPE
  18. #define DEVICETYPE_ISDN "ISDN"
  19. #define DEVICETYPE_X25 "X25"
  20. #define DEVICETYPE_UNIMODEM "MODEM"
  21. #define DEVICETYPE_PPTP "VPN"
  22. #define DEVICETYPE_ATM "ATM"
  23. #define REMOTEACCESS_APP "RemoteAccess"
  24. #define CONTROLBLOCKSIGNATURE 0x06051932
  25. #define CLIENT_USAGE "Client"
  26. #define SERVER_USAGE "Server"
  27. #define ROUTER_USAGE "Router"
  28. #define REGISTRY_RASMAN_TAPI_KEY "Software\\Microsoft\\RAS\\Tapi Devices"
  29. #define REGISTRY_ADDRESS "Address"
  30. #define REGISTRY_FRIENDLYNAME "Friendly Name"
  31. #define REGISTRY_MEDIATYPE "Media Type"
  32. #define REGISTRY_USAGE "Usage"
  33. #define LOW_MAJOR_VERSION 0x0001
  34. #define LOW_MINOR_VERSION 0x0003
  35. #define HIGH_MAJOR_VERSION 0x0002
  36. #define HIGH_MINOR_VERSION 0x0000
  37. #define LOW_VERSION ((LOW_MAJOR_VERSION << 16) | LOW_MINOR_VERSION)
  38. #define HIGH_VERSION ((HIGH_MAJOR_VERSION << 16) | HIGH_MINOR_VERSION)
  39. #define LOW_EXT_MAJOR_VERSION 0x0000
  40. #define LOW_EXT_MINOR_VERSION 0x0000
  41. #define HIGH_EXT_MAJOR_VERSION 0x0000
  42. #define HIGH_EXT_MINOR_VERSION 0x0000
  43. #define LOW_EXT_VERSION ((LOW_EXT_MAJOR_VERSION << 16) | LOW_EXT_MINOR_VERSION)
  44. #define HIGH_EXT_VERSION ((HIGH_EXT_MAJOR_VERSION << 16) | HIGH_EXT_MINOR_VERSION)
  45. // Generic indexes
  46. #define ADDRESS_INDEX 0
  47. #define CONNECTBPS_INDEX 1
  48. // ISDN param indexes
  49. #define ISDN_ADDRESS_INDEX ADDRESS_INDEX
  50. #define ISDN_CONNECTBPS_INDEX CONNECTBPS_INDEX
  51. #define ISDN_LINETYPE_INDEX 2
  52. #define ISDN_FALLBACK_INDEX 3
  53. #define ISDN_COMPRESSION_INDEX 4
  54. #define ISDN_CHANNEL_AGG_INDEX 5
  55. // X25 indexes
  56. #define X25_ADDRESS_INDEX ADDRESS_INDEX
  57. #define X25_CONNECTBPS_INDEX CONNECTBPS_INDEX
  58. #define X25_DIAGNOSTICS_INDEX 2
  59. #define X25_USERDATA_INDEX 3
  60. #define X25_FACILITIES_INDEX 4
  61. enum PORT_STATE {
  62. PS_CLOSED,
  63. PS_OPEN,
  64. PS_LISTENING,
  65. PS_CONNECTED,
  66. PS_CONNECTING,
  67. PS_DISCONNECTING,
  68. PS_UNINITIALIZED,
  69. PS_UNAVAILABLE,
  70. } ;
  71. typedef enum PORT_STATE PORT_STATE ;
  72. typedef enum PORT_STATE LINE_STATE ;
  73. enum LISTEN_SUBSTATE {
  74. LS_WAIT,
  75. LS_RINGING,
  76. LS_ACCEPT,
  77. LS_ANSWER,
  78. LS_COMPLETE,
  79. LS_ERROR,
  80. } ;
  81. typedef enum LISTEN_SUBSTATE LISTEN_SUBSTATE ;
  82. struct TapiLineInfo {
  83. struct TapiLineInfo *TLI_Next;
  84. DWORD TLI_LineId ; // Returned by LineInitialize
  85. HLINE TLI_LineHandle ; // Returned by LineOpen
  86. // struct TapiPortControlBlock *pTPCB; // TAPI port associated with this line
  87. LINE_STATE TLI_LineState ; // open?, closed?, listen posted?.
  88. DWORD TLI_OpenCount ;
  89. DWORD NegotiatedApiVersion;
  90. DWORD NegotiatedExtVersion;
  91. BOOL CharModeSupported;
  92. BOOL TLI_MultiEndpoint;
  93. DeviceInfo *TLI_pDeviceInfo; // pointer to the deviceinfo block
  94. DWORD TLI_MediaMode ; // Media mode to use for lineopens.
  95. #define MAX_PROVIDER_NAME 48
  96. CHAR TLI_ProviderName[MAX_PROVIDER_NAME] ;
  97. } ;
  98. typedef struct TapiLineInfo TapiLineInfo ;
  99. typedef enum RASTAPI_DEV_CMD
  100. {
  101. RASTAPI_DEV_SEND, // Send a buffer to the miniport
  102. RASTAPI_DEV_RECV, // Read a buffer from the miniport
  103. RASTAPI_DEV_PPP_MODE // Put the miniport into PPP framing mode
  104. } RASTAPI_DEV_CMD;
  105. typedef struct RASTAPI_DEV_SPECIFIC
  106. {
  107. RASTAPI_DEV_CMD Command; // RASTAPI_DEV_SEND, RASTAPI_DEV_RECV, RASTAPI_DEV_PPP_MODE
  108. DWORD Reserved;
  109. DWORD DataSize;
  110. UCHAR Data[1];
  111. } RASTAPI_DEV_SPECIFIC, *PRASTAPI_DEV_SPECIFIC;
  112. //
  113. // Magic Cookie used in DEV_DATA_MODES command
  114. //
  115. #define MINIPORT_COOKIE 0x494E494D
  116. //
  117. // DEV_SPECIFIC Flags
  118. //
  119. #define CHAR_MODE 0x00000001 // Miniport supports character mode
  120. typedef struct RASTAPI_DEV_DATA_MODES
  121. {
  122. DWORD MagicCookie;
  123. DWORD DataModes;
  124. } RASTAPI_DEV_DATA_MODES, *PRASTAPI_DEV_DATA_MODES;
  125. typedef struct _RECV_FIFO
  126. {
  127. DWORD Count; // # of elements in fifo
  128. DWORD In; // indexs into circular buffer
  129. DWORD Out; //
  130. DWORD Size; // Size of Buffer
  131. BYTE Buffer[1]; // storage
  132. } RECV_FIFO, *PRECV_FIFO;
  133. #define RASTAPI_FLAG_UNAVAILABLE 0x00000001
  134. #define RASTAPI_FLAG_DIALEDIN 0x00000002
  135. struct TapiPortControlBlock {
  136. DWORD TPCB_Signature ; // Unique signature for verifying block ptr.
  137. struct TapiPortControlBlock *TPCB_next; // next TAPI port in the list
  138. HANDLE TPCB_Handle ; // Handle used to identify this port
  139. CHAR TPCB_Name[MAX_PORT_NAME] ; // Friendly Name of the port
  140. CHAR TPCB_Address[MAX_PORT_NAME] ; // Address - please note for legacy tapi dev. this is
  141. // a GUID - so has to be at least 16 bytes.
  142. PORT_STATE TPCB_State ; // State of the port
  143. LISTEN_SUBSTATE TPCB_ListenState ; // state of the listen
  144. CHAR TPCB_DeviceType[MAX_DEVICETYPE_NAME] ; // ISDN, etc.
  145. CHAR TPCB_DeviceName [MAX_DEVICE_NAME] ; // Digiboard etc.
  146. RASMAN_USAGE TPCB_Usage ; // CALLIN, CALLOUT or BOTH
  147. TapiLineInfo *TPCB_Line ; // Handle to the "line" this port belongs to
  148. DWORD TPCB_AddressId ; // Address ID for this "port"
  149. DWORD TPCB_CallId; // CallI ID for this "port"
  150. HCALL TPCB_CallHandle ; // When connected the call id
  151. HANDLE TPCB_IoCompletionPort; // passed in on open
  152. DWORD TPCB_CompletionKey; // passed in on open
  153. DWORD TPCB_RequestId ; // id for async requests.
  154. DWORD TPCB_AsyncErrorCode ; // used to store asycn returned code.
  155. CHAR TPCB_Info[6][100] ; // port info associated with this connection
  156. HANDLE TPCB_Endpoint ; // used to store asyncmac context for unimodem ports
  157. HANDLE TPCB_CommHandle ; // used to store comm port handle used in unimodem ports
  158. RAS_OVERLAPPED TPCB_ReadOverlapped ; // used in read async ops.
  159. RAS_OVERLAPPED TPCB_WriteOverlapped ; // used in write async ops.
  160. RAS_OVERLAPPED TPCB_DiscOverlapped; // used in signaling disconnection
  161. PBYTE TPCB_DevConfig ; // Opaque blob of data used for configuring tapi
  162. // devices - this is passed in to
  163. // us using DeviceSetDevConfig() ;
  164. DWORD TPCB_SizeOfDevConfig ; // Size of the above blob.
  165. PBYTE TPCB_DefaultDevConfig ; // The current config for the device that is saved
  166. // away before we write any changes
  167. // to the device. This allows RAS to be a good
  168. // citizen by not overwriting defauls.
  169. DWORD TPCB_DefaultDevConfigSize ;
  170. DWORD TPCB_DisconnectReason ; // Reason for disconnection.
  171. DWORD TPCB_NumberOfRings ; // Number of rings received so far.
  172. DWORD IdleReceived;
  173. BOOL TPCB_dwFlags; // is this client dialed in
  174. RASTAPI_CONNECT_INFO *TPCB_pConnectInfo;
  175. //
  176. // Char Mode Support ( for USR )
  177. //
  178. DWORD TPCB_SendRequestId; // Request Id stored to id the event in callback
  179. // that send completed for a char mode port
  180. PVOID TPCB_SendDesc; // Send Desc passed to lineDevSpecific call for send request
  181. DWORD TPCB_RecvRequestId; // Request Id stored to id the event in callback that recv completed
  182. // for a char mode port
  183. PVOID TPCB_RecvDesc; // Recv Desc passed to lineDevSpecific call
  184. PBYTE TPCB_RasmanRecvBuffer;
  185. DWORD TPCB_RasmanRecvBufferSize;
  186. PRECV_FIFO TPCB_RecvFifo;
  187. DWORD TPCB_ModeRequestId; // Request id stored to id the event that mode was set for a char mode
  188. PVOID TPCB_ModeRequestDesc; // desc.
  189. BOOL TPCB_CharMode; // CharMode ?
  190. } ;
  191. typedef struct TapiPortControlBlock TapiPortControlBlock ;
  192. struct _ZOMBIE_CALL {
  193. LIST_ENTRY Linkage;
  194. DWORD RequestID;
  195. HCALL hCall;
  196. } ;
  197. typedef struct _ZOMBIE_CALL ZOMBIE_CALL;
  198. VOID FAR PASCAL RasTapiCallback ( HANDLE,
  199. DWORD,
  200. ULONG_PTR,
  201. ULONG_PTR,
  202. ULONG_PTR,
  203. ULONG_PTR) ;
  204. VOID SetIsdnParams ( TapiPortControlBlock *,
  205. LINECALLPARAMS *) ;
  206. VOID GetMutex (HANDLE, DWORD) ;
  207. VOID FreeMutex (HANDLE) ;
  208. DWORD EnumerateTapiPorts (HANDLE) ;
  209. VOID PostDisconnectCompletion( TapiPortControlBlock * );
  210. VOID PostNotificationCompletion( TapiPortControlBlock * );
  211. VOID PostNotificationNewPort ( PortMediaInfo *);
  212. VOID PostNotificationRemoveLine ( DWORD );
  213. DWORD dwAddPorts( PBYTE, LPVOID );
  214. DWORD dwRemovePort ( TapiPortControlBlock * );
  215. DWORD CopyDataToFifo(PRECV_FIFO, PBYTE, DWORD);
  216. DWORD CopyDataFromFifo(PRECV_FIFO, PBYTE, DWORD);
  217. // rtnetcfg.cpp
  218. DWORD dwGetNumberOfRings ( PDWORD pdwRings );
  219. DWORD dwGetPortUsage(DWORD *pdwUsage);
  220. LONG lrIsModemRasEnabled(HKEY hkey,
  221. BOOL *pfRasEnabled,
  222. BOOL *pfRouterEnabled );
  223. DeviceInfo * GetDeviceInfo(PBYTE pbAddress, BOOL fModem);
  224. DWORD GetEndPointInfo(DeviceInfo **ppDeviceInfo,
  225. PBYTE pbAddress,
  226. BOOL fForceRead,
  227. NDIS_WAN_MEDIUM_SUBTYPE eDeviceType);
  228. // init.c
  229. DWORD GetDeviceTypeFromDeviceGuid( GUID *pDeviceGuid );
  230. VOID RasTapiTrace( CHAR * Format, ... ) ;
  231. VOID TraceEndPointInfo(DeviceInfo *pInfo);
  232. DWORD DwRasErrorFromDisconnectMode(DWORD dm);
  233. //diag.c
  234. DWORD
  235. DwGetConnectInfo(
  236. TapiPortControlBlock *port,
  237. HCALL hCall,
  238. LINECALLINFO *pLineCallInfo
  239. );