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.

319 lines
11 KiB

  1. /* MCATTPRT.h
  2. *
  3. * Copyright (c) 1993-1995 by DataBeam Corporation, Lexington, KY
  4. *
  5. * Abstract:
  6. * This is the interface file for the TCP Transport. If an application
  7. * is making calls directly to the Transport DLL, this file MUST be
  8. * included. All transports have the same interface. This makes
  9. * programming to the Transports simpler for the user.
  10. *
  11. * This file contains all of the prototypes and defintions needed to use
  12. * any of the Transport DLLs.
  13. *
  14. * Transports have 2 modes of operation, either in-band call control or
  15. * out-of-band call control. With in-band call control, the Transport DLL
  16. * makes the physical connection when the TConnectRequest() call is made
  17. * from MCS. It also breaks the physical connection when MCS makes a
  18. * TDisconnectRequest() call. This basic mode of operation works well but
  19. * we have added the out-of-band call control mode for 2 reasons:
  20. *
  21. * 1. Allow the user to make multiple MCS connections without
  22. * breaking the physical connection. This is needed if the
  23. * application is using the GCC Query commands.
  24. *
  25. * 2. Allow the user to use any type of calling mechanism (i.e. TAPI,
  26. * TSAPI,...) that they want.
  27. *
  28. * Caveats:
  29. * None.
  30. *
  31. * Author:
  32. * James W. Lawwill
  33. *
  34. */
  35. #ifndef _MCATTPRT_
  36. #define _MCATTPRT_
  37. #include "databeam.h"
  38. /*
  39. * These are valid return codes from the Transport DLL.
  40. *
  41. * TRANSPORT_NO_ERROR
  42. * The function executed properly, without error. This does not mean
  43. * that the function is complete. Some functions are non-blocking
  44. * (they don't occur immediately), therefore they could still fail.
  45. * A good example of this is the TConnectRequest() function in the
  46. * TCP transport. It takes a few seconds to call the remote site and
  47. * establish a link. If the connection fails or succeeds, a callback
  48. * will be sent back to the user to give them the status.
  49. * TRANSPORT_INITIALIZATION_FAILED
  50. * The TInitialize() function failed. This can occur for a number of
  51. * reasons.
  52. * TRANSPORT_NOT_INITIALIZED
  53. * The user is attempting to use a function even though the TInitialize()
  54. * function failed.
  55. * TRANSPORT_NO_SUCH_CONNECTION
  56. * The user is attempting a function call with an illegal
  57. * TransportConnection handle.
  58. * TRANSPORT_WRITE_QUEUE_FULL
  59. * The TDataRequest() function failed because its write queue is full
  60. * TRANSPORT_READ_QUEUE_FULL
  61. * This return value is returned from the TRANSPORT_DATA_INDICATION
  62. * callback. It occurs when the user application can not handle the
  63. * data packet because it does not currently have room for it. This
  64. * is a flow control mechanism between the user application and the
  65. * Transport DLL.
  66. * TRANSPORT_CONNECT_REQUEST_FAILED
  67. * The TConnectRequest() function failed because the modem was not
  68. * in the proper mode. As we initialize a modem, it is not possible
  69. * to dial out it. Try the TConnectRequest() later.
  70. * TRANSPORT_CONNECT_RESPONSE_FAILED
  71. * The TConnectResponse() function failed. Evidently, the function was
  72. * called at the wrong time.
  73. * TRANSPORT_NO_CONNECTION_AVAILABLE
  74. * The TConnectRequest() function failed because all available modems
  75. * are currently in use.
  76. * TRANSPORT_NOT_READY_TO_TRANSMIT
  77. * The TDataRequest() function failed because it is not ready to send
  78. * data. If you attempt this function before you receive a
  79. * TRANSPORT_CONNECT_INDICATION callback, you will receive this value
  80. * TRANSPORT_ILLEGAL_COMMAND
  81. * TResetDevice() or TProcessCommand() failed because the command submitted
  82. * to the function was invalid.
  83. * TRANSPORT_CONFIGURATION_ERROR
  84. * Return value from TProcessCommand() if the user is enabling a device
  85. * that has an illegal configuration setup in the .ini file
  86. * TRANSPORT_MEMORY_FAILURE
  87. * The function failed because the Transport Stack was not able to allocate
  88. * the memory necessary to perform the function.
  89. */
  90. typedef unsigned long TransportError;
  91. typedef TransportError * PTransportError;
  92. #define TRANSPORT_NO_ERROR 0
  93. #define TRANSPORT_INITIALIZATION_FAILED 1
  94. #define TRANSPORT_NOT_INITIALIZED 2
  95. #define TRANSPORT_NO_SUCH_CONNECTION 3
  96. #define TRANSPORT_WRITE_QUEUE_FULL 4
  97. #define TRANSPORT_READ_QUEUE_FULL 5
  98. #define TRANSPORT_CONNECT_REQUEST_FAILED 6
  99. #define TRANSPORT_MEMORY_FAILURE 7
  100. #define TRANSPORT_NOT_READY_TO_TRANSMIT 8
  101. #define TRANSPORT_CANT_SEND_NOW 9
  102. #define TRANSPORT_ILLEGAL_COMMAND 10
  103. #define TRANSPORT_CONFIGURATION_ERROR 12
  104. #define TRANSPORT_CONNECT_RESPONSE_FAILED 13
  105. #define TRANSPORT_SECURITY_FAILED 14
  106. #define TRANSPORT_BUFFER_TOO_SMALL 15
  107. #define TRANSPORT_NO_PLUGGABLE_CONNECTION 16
  108. #define TRANSPORT_WRITE_FILE_FAILED 17
  109. #define TRANSPORT_ALREADY_INITIALIZED 18
  110. #define TRANSPORT_INVALID_PARAMETER 19
  111. #define TRANSPORT_PHYSICAL_LAYER_NOT_FOUND 20
  112. #define TRANSPORT_NO_T123_STACK 21
  113. /*
  114. * TransportConnection is the handle used by the Transport DLL
  115. * to distinguish one logical connection from another. The DLL assigns
  116. * the transport connection in a TConnectRequest() call or as a
  117. * result of a TRANSPORT_CONNECT_INDICATION callback
  118. */
  119. typedef enum tagTransportType
  120. {
  121. TRANSPORT_TYPE_WINSOCK = 0,
  122. TRANSPORT_TYPE_PLUGGABLE_X224 = 1,
  123. TRANSPORT_TYPE_PLUGGABLE_PSTN = 2,
  124. }
  125. TransportType;
  126. typedef struct tagTransportConnection
  127. {
  128. TransportType eType;
  129. UINT_PTR nLogicalHandle;
  130. }
  131. TransportConnection, *PTransportConnection;
  132. #define PACK_XPRTCONN(x) (MAKELONG((x).nLogicalHandle, (x).eType))
  133. #define UNPACK_XPRTCONN(x,n) { (x).nLogicalHandle = LOWORD((n)); (x).eType = (TransportType) HIWORD((n)); }
  134. #define IS_SAME_TRANSPORT_CONNECTION(x1,x2) (((x1).eType == (x2).eType) && ((x1).nLogicalHandle == (x2).nLogicalHandle))
  135. #define IS_SOCKET(x) (TRANSPORT_TYPE_WINSOCK == (x).eType)
  136. #define IS_PLUGGABLE(x) (TRANSPORT_TYPE_WINSOCK != (x).eType)
  137. #define IS_PLUGGABLE_X224(x) (TRANSPORT_TYPE_PLUGGABLE_X224 == (x).eType)
  138. #define IS_PLUGGABLE_PSTN(x) (TRANSPORT_TYPE_PLUGGABLE_PSTN == (x).eType)
  139. #define IS_VALID_TRANSPORT_CONNECTION_TYPE(x) (IS_SOCKET(x) || IS_PLUGGABLE_X224(x) || IS_PLUGGABLE_PSTN(x))
  140. #define SET_SOCKET_CONNECTION(x,s) { (x).eType = TRANSPORT_TYPE_WINSOCK; (x).nLogicalHandle = (s); }
  141. /*
  142. * This structure is passed back with the TRANSPORT_DATA_INDICATION message.
  143. *
  144. * Since there is only one callback address passed into the Transport DLL and
  145. * there can be many transport connections maintained by this DLL, the
  146. * transport_connection number is included in the structure. This number
  147. * tells the user application which connection the data is associated with.
  148. *
  149. * The other two parameters are the data address and data length
  150. */
  151. typedef struct
  152. {
  153. TransportConnection transport_connection;
  154. unsigned char * user_data;
  155. unsigned long user_data_length;
  156. PMemory memory;
  157. } TransportData;
  158. typedef TransportData * PTransportData;
  159. /*
  160. * The following section defines the callbacks that can be issued to the
  161. * user.
  162. *
  163. * The callback contains three parameters:
  164. * The first is the callback message.
  165. * The second is specific to the callback message.
  166. * The third is the user defined value that is passed in
  167. * during TInitialize().
  168. */
  169. /*
  170. * Message: TRANSPORT_CONNECT_INDICATION
  171. * Parameter:
  172. * TransportConnection transport_connection
  173. *
  174. * Functional Description:
  175. * The user receives this message when an incoming call has been
  176. * received. The user can issue a TConnectResponse() to accept the
  177. * call or a TDisconnectRequest() to terminate the connection.
  178. *
  179. * The user will never receive this callback message if he originates
  180. * the connection. In that case the user will receive a
  181. * TRANSPORT_CONNECT_CONFIRM.
  182. */
  183. /*
  184. * Message: TRANSPORT_DATA_INDICATION
  185. * Parameter:
  186. * PTransportData
  187. * This is the address of the transport data structure
  188. *
  189. * Functional Description:
  190. * The callback returns this message when it has data for the user.
  191. * The message is sent with the address of a TransportData structure,
  192. * which contains the transport_connection, the data address, and the
  193. * data length.
  194. */
  195. /*
  196. * Message: TRANSPORT_EXPEDITED_DATA_INDICATION
  197. * Parameter:
  198. * PTransportData
  199. * This is the address of the transport data structure
  200. *
  201. * Functional Description:
  202. * This callback is currently unsupported.
  203. */
  204. /*
  205. * Message: TRANSPORT_DISCONNECT_INDICATION
  206. * Parameter:
  207. * TransportConnection
  208. *
  209. * Functional Description:
  210. * The callback returns this message when the transport connection
  211. * is broken. It can result from a TDisconnectRequest() call by the
  212. * user, or from an unstable physical connection.
  213. */
  214. /*
  215. * Message: TRANSPORT_CONNECT_CONFIRM
  216. * Parameter:
  217. * TransportConnection
  218. *
  219. * Functional Description:
  220. * The callback returns this message when a new transport connection
  221. * has been established.
  222. *
  223. * This message is issued in response to the user issuing a
  224. * TConnectRequest(). When the Transport Connection is up and
  225. * operational, the user will receive this callback message.
  226. *
  227. * If you are called by another user, you will receive a
  228. * TRANSPORT_CONNECT_INDICATION.
  229. */
  230. /*
  231. * Message: TRANSPORT_STATUS_INDICATION
  232. * Parameter:
  233. * PTransportStatus
  234. * Address of the TransportStatus structure
  235. *
  236. * Functional Description:
  237. * This callback is sent from a Transport Layer to notify the user of a
  238. * change in a physical device. For example, in the case of the PSTN
  239. * Transport Stack, this message will be sent up when the modem detects an
  240. * incoming RING or when a connection is established. Any time the state
  241. * of the modem changes, a message will be sent up. Messages will also be
  242. * sent up when an error occurs
  243. */
  244. #define TRANSPORT_CONNECT_INDICATION 0
  245. #define TRANSPORT_CONNECT_CONFIRM 1
  246. #define TRANSPORT_DATA_INDICATION 2
  247. // #define TRANSPORT_EXPEDITED_DATA_INDICATION 3
  248. #define TRANSPORT_DISCONNECT_INDICATION 4
  249. // #define TRANSPORT_STATUS_INDICATION 5
  250. #define TRANSPORT_BUFFER_EMPTY_INDICATION 6
  251. #ifdef TSTATUS_INDICATION
  252. /*
  253. * Physical Device states
  254. */
  255. typedef enum
  256. {
  257. TSTATE_NOT_READY,
  258. TSTATE_NOT_CONNECTED,
  259. TSTATE_CONNECT_PENDING,
  260. TSTATE_CONNECTED,
  261. TSTATE_REMOVED
  262. } TransportState;
  263. /*
  264. * The following structure is passed to ths user via the
  265. * TRANSPORT_STATUS_INDICATION callback.
  266. *
  267. *
  268. * device_identifier - The device_identifier is only set if a specific
  269. * device is referenced (i.e. "COM1").
  270. *
  271. * remote_address - String specifying the address of the person we
  272. * are linked to.
  273. *
  274. * message - This string is filled in to give the user some
  275. * type of feedback. A message may reflect an
  276. * error in the configuration file, an incoming
  277. * RING from the modem, or a BUSY signal on the
  278. * telephone line.
  279. *
  280. * state - Current state of the device. This is one of
  281. * the TransportState enumerations.
  282. */
  283. typedef struct
  284. {
  285. char * device_identifier;
  286. char * remote_address;
  287. char * message;
  288. TransportState state;
  289. } TransportStatus;
  290. typedef TransportStatus * PTransportStatus;
  291. #endif // TSTATUS_INDICATION
  292. #endif