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.

443 lines
13 KiB

  1. /* SCFCall.h
  2. *
  3. * Copyright (c) 1994-1995 by DataBeam Corporation, Lexington, KY
  4. *
  5. * Abstract:
  6. * This class is instantiated to represent a call under the SCF.
  7. * Each call is identified by a call reference value. This class
  8. * sends and receives the packets necessary to negotiate a connection.
  9. *
  10. * Caveats:
  11. *
  12. * Authors:
  13. * James W. Lawwill
  14. */
  15. #ifndef _SCFCall_H_
  16. #define _SCFCall_H_
  17. #include "q922.h"
  18. #include "scf.h"
  19. #define SETUP_PACKET_SIZE 29
  20. #define CONNECT_PACKET_BASE_SIZE 8
  21. #define CONNECT_ACK_PACKET_SIZE 4
  22. #define RELEASE_COMPLETE_PACKET_SIZE 8
  23. /*
  24. ** A CallReference is a number that represents a network request.
  25. */
  26. typedef USHORT CallReference;
  27. /*
  28. ** DataLink Parameters that can be negotiated by the SCF
  29. */
  30. typedef struct
  31. {
  32. USHORT k_factor;
  33. USHORT n201;
  34. USHORT t200;
  35. USHORT default_k_factor;
  36. USHORT default_n201;
  37. USHORT default_t200;
  38. } DataLinkParameters;
  39. typedef DataLinkParameters * PDataLinkParameters;
  40. /*
  41. ** Structure passed during Connect Callbacks
  42. */
  43. typedef struct
  44. {
  45. DLCI dlci;
  46. TransportPriority priority;
  47. CallReference call_reference;
  48. PDataLinkParameters datalink_struct;
  49. } NetworkConnectStruct;
  50. typedef NetworkConnectStruct * PNetworkConnectStruct;
  51. /*
  52. ** States that the call can be in
  53. */
  54. typedef enum
  55. {
  56. NOT_CONNECTED,
  57. SETUP_SENT,
  58. CONNECT_SENT,
  59. CALL_ESTABLISHED
  60. } SCFCallState;
  61. /*
  62. ** Error values
  63. */
  64. typedef enum
  65. {
  66. SCFCALL_NO_ERROR
  67. } SCFCallError;
  68. class SCFCall : public IObject
  69. {
  70. public:
  71. SCFCall (
  72. CLayerSCF *owner_object,
  73. IProtocolLayer * lower_layer,
  74. USHORT message_base,
  75. PDataLinkParameters datalink_parameters,
  76. PMemoryManager memory_manager,
  77. BOOL * initialized);
  78. ~SCFCall (void);
  79. /*
  80. ** This routine gives us a slice of time to transmit packets
  81. */
  82. void PollTransmitter (
  83. USHORT data_to_transmit,
  84. USHORT * pending_data);
  85. /*
  86. ** Link establishment
  87. */
  88. SCFCallError ConnectRequest (
  89. CallReference call_reference,
  90. DLCI dlci,
  91. TransportPriority priority);
  92. SCFCallError ConnectResponse (
  93. BOOL valid_dlci);
  94. SCFCallError DisconnectRequest (void);
  95. /*
  96. ** Packet processing
  97. */
  98. BOOL ProcessSetup (
  99. CallReference call_reference,
  100. LPBYTE packet_address,
  101. USHORT packet_length);
  102. BOOL ProcessConnect (
  103. LPBYTE packet_address,
  104. USHORT packet_length);
  105. BOOL ProcessConnectAcknowledge (
  106. LPBYTE packet_address,
  107. USHORT packet_length);
  108. BOOL ProcessReleaseComplete (
  109. LPBYTE packet_address,
  110. USHORT packet_length);
  111. private:
  112. void SendSetup (void);
  113. void SendConnect (void);
  114. void SendReleaseComplete (void);
  115. void SendConnectAcknowledge (void);
  116. void StartTimerT313 (void);
  117. void StopTimerT313 (void);
  118. void T313Timeout (
  119. TimerEventHandle);
  120. void StartTimerT303 (void);
  121. void StopTimerT303 (void);
  122. void T303Timeout (
  123. TimerEventHandle);
  124. CLayerSCF *m_pSCF;
  125. IProtocolLayer * Lower_Layer;
  126. USHORT m_nMsgBase;
  127. USHORT Packet_Pending;
  128. BOOL Link_Originator;
  129. DataLinkParameters DataLink_Struct;
  130. USHORT Maximum_Packet_Size;
  131. USHORT Lower_Layer_Prepend;
  132. USHORT Lower_Layer_Append;
  133. BOOL Received_Priority;
  134. BOOL Received_K_Factor;
  135. BOOL Received_N201;
  136. BOOL Received_T200;
  137. PMemoryManager Data_Request_Memory_Manager;
  138. CallReference Call_Reference;
  139. DLCI DLC_Identifier;
  140. TransportPriority Priority;
  141. TransportPriority Default_Priority;
  142. SCFCallState State;
  143. USHORT Release_Cause;
  144. ULONG T303_Timeout;
  145. TimerEventHandle T303_Handle;
  146. BOOL T303_Active;
  147. USHORT T303_Count;
  148. ULONG T313_Timeout;
  149. TimerEventHandle T313_Handle;
  150. BOOL T313_Active;
  151. };
  152. typedef SCFCall * PSCFCall;
  153. #endif
  154. /*
  155. * Documentation for Public class members
  156. */
  157. /*
  158. * SCFCall::SCFCall (
  159. * PTransportResources transport_resources,
  160. * IObject * owner_object,
  161. * IProtocolLayer * lower_layer,
  162. * USHORT message_base,
  163. * PChar config_file,
  164. * PDataLinkParameters datalink_parameters,
  165. * PMemoryManager memory_manager,
  166. * BOOL * initialized);
  167. *
  168. * Functional Description
  169. * This is the constructor for the SCFCall class.
  170. *
  171. * Formal Parameters
  172. * transport_resources (i) - Pointer to TransportResources structure.
  173. * owner_object (i) - Address of the owner object
  174. * lower_layer (i) - Address of our lower layer
  175. * message_base (i) - Message base used in owner callbacks
  176. * config_file (i) - Address of configuration file path
  177. * datalink_parameters (i) - Address of structure containing datalink
  178. * parameters that will be arbitrated
  179. * memory_manager (i) - Address of memory manager
  180. *
  181. * Return Value
  182. * None
  183. *
  184. * Side Effects
  185. * None
  186. *
  187. * Caveats
  188. * None
  189. *
  190. */
  191. /*
  192. * SCFCall::~SCFCall ();
  193. *
  194. * Functional Description
  195. * Destructor
  196. *
  197. * Formal Parameters
  198. * None
  199. *
  200. * Return Value
  201. * None
  202. *
  203. * Side Effects
  204. * None
  205. *
  206. * Caveats
  207. * None
  208. */
  209. /*
  210. * void SCFCall::PollTransmitter (
  211. * USHORT data_to_transmit,
  212. * USHORT * pending_data);
  213. *
  214. * Functional Description
  215. * This function gives the class a time slice to transmit data
  216. *
  217. * Formal Parameters
  218. * data_to_transmit (i) - Flags representing data to transmit
  219. * pending_data (o) - Return flags of data transmitted
  220. *
  221. * Return Value
  222. * None
  223. *
  224. * Side Effects
  225. * None
  226. *
  227. * Caveats
  228. * None
  229. *
  230. */
  231. /*
  232. * SCFCallError SCFCall::ConnectRequest (
  233. * CallReference call_reference,
  234. * DLCI dlci,
  235. * USHORT priority);
  236. *
  237. * Functional Description
  238. * This function informs us to initiate a connection with the remote
  239. * SCF. As a result of this, we send a SETUP packet to the remote
  240. * machine
  241. *
  242. * Formal Parameters
  243. * call_reference (i) - Unique value that differentiates our
  244. * call from other calls. This value goes in
  245. * all Q.933 packets.
  246. * dlci (i) - Suggested dlci value.
  247. * priority (i) - Suggested priority in the range of 0 to 14.
  248. * 14 is the highest priority
  249. *
  250. * Return Value
  251. * SCFCALL_NO_ERROR - No error occured
  252. *
  253. * Side Effects
  254. * None
  255. *
  256. * Caveats
  257. * None
  258. *
  259. */
  260. /*
  261. * SCFCallError SCFCall::ConnectResponse (
  262. * BOOL valid_dlci);
  263. *
  264. * Functional Description
  265. * This function is called in response to a NETWORK_CONNECT_INDICATION
  266. * callback to the owner of this object. Previously, the remote site
  267. * sent us a SETUP packet with a suggested DLCI. This DLCI is sent to
  268. * the owner in the NETWORK_CONNECT_INDICATION call. The owner calls
  269. * this function with a BOOL, telling us if the DLCI was valid.
  270. *
  271. * Formal Parameters
  272. * valid_dlci (i) - This is set to TRUE if the user wants to accept
  273. * this call and use the suggested DLCI, FALSE
  274. * if not.
  275. *
  276. * Return Value
  277. * SCFCALL_NO_ERROR - No error occured
  278. *
  279. * Side Effects
  280. * None
  281. *
  282. * Caveats
  283. * None
  284. *
  285. */
  286. /*
  287. * SCFCallError SCFCall::DisconnectRequest (
  288. * void);
  289. *
  290. * Functional Description
  291. * This function is called to release the call. In response to this
  292. * function, we send out a RELEASE COMPLETE packet to the remote site.
  293. *
  294. * Formal Parameters
  295. * None.
  296. *
  297. * Return Value
  298. * SCFCALL_NO_ERROR - No error occured
  299. *
  300. * Side Effects
  301. * None
  302. *
  303. * Caveats
  304. * None
  305. *
  306. */
  307. /*
  308. * BOOL SCFCall::ProcessSetup (
  309. * CallReference call_reference,
  310. * LPBYTE packet_address,
  311. * USHORT packet_length);
  312. *
  313. * Functional Description
  314. * This function is called when we have a SETUP packet to decode.
  315. *
  316. * Formal Parameters
  317. * call_reference (i) - The call reference attached to the packet.
  318. * packet_address (i) - Address of the SETUP packet
  319. * packet_length (i) - Length of the passed in packet.
  320. *
  321. * Return Value
  322. * TRUE - Valid packet
  323. * FALSE - The packet was not a valid Q.933 SETUP packet or
  324. * the packet was not expected
  325. *
  326. * Side Effects
  327. * None
  328. *
  329. * Caveats
  330. * None
  331. *
  332. */
  333. /*
  334. * BOOL SCFCall::ProcessConnect (
  335. * LPBYTE packet_address,
  336. * USHORT packet_length);
  337. *
  338. * Functional Description
  339. * This function is called when we have a CONNECT packet to decode.
  340. *
  341. * Formal Parameters
  342. * packet_address (i) - Address of the CONNECT packet
  343. * packet_length (i) - Length of the passed in packet.
  344. *
  345. * Return Value
  346. * TRUE - Valid packet
  347. * FALSE - The packet was not a valid Q.933 CONNECT packet or
  348. * the packet was not expected
  349. *
  350. * Side Effects
  351. * None
  352. *
  353. * Caveats
  354. * None
  355. *
  356. */
  357. /*
  358. * BOOL SCFCall::ProcessConnectAcknowledge (
  359. * LPBYTE packet_address,
  360. * USHORT packet_length);
  361. *
  362. * Functional Description
  363. * This function is called when we have a CONNECT ACK packet to decode.
  364. *
  365. * Formal Parameters
  366. * packet_address (i) - Address of the CONNECT ACK packet
  367. * packet_length (i) - Length of the passed in packet.
  368. *
  369. * Return Value
  370. * TRUE - Valid packet
  371. * FALSE - The packet was not a valid Q.933 CONNECT ACK packet
  372. * or the packet was not expected.
  373. *
  374. * Side Effects
  375. * None
  376. *
  377. * Caveats
  378. * None
  379. *
  380. */
  381. /*
  382. * BOOL SCFCall::ProcessReleaseComplete (
  383. * LPBYTE packet_address,
  384. * USHORT packet_length);
  385. *
  386. * Functional Description
  387. * This function is called when we have a RELEASE COMPLETE packet to
  388. * decode.
  389. *
  390. * Formal Parameters
  391. * packet_address (i) - Address of the CONNECT ACK packet
  392. * packet_length (i) - Length of the passed in packet.
  393. *
  394. * Return Value
  395. * TRUE - Valid packet
  396. * FALSE - The packet was not a valid Q.933 CONNECT ACK packet
  397. * or the packet was not expected.
  398. *
  399. * Side Effects
  400. * None
  401. *
  402. * Caveats
  403. * None
  404. *
  405. */