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.

207 lines
8.4 KiB

  1. /****************************************************************************/
  2. // nl.h
  3. //
  4. // Network layer.
  5. //
  6. // Copyright (C) 1997-2000 Microsoft Corporation
  7. /****************************************************************************/
  8. #ifndef _H_NL
  9. #define _H_NL
  10. extern "C" {
  11. #include <adcgdata.h>
  12. }
  13. #include "td.h"
  14. #include "mcs.h"
  15. #include "objs.h"
  16. class CUI;
  17. class CCD;
  18. class CMCS;
  19. class CNC;
  20. class CUT;
  21. class CRCV;
  22. /****************************************************************************/
  23. /* Protocol name. */
  24. /****************************************************************************/
  25. #define NL_PROTOCOL_T128 _T("T.128")
  26. /****************************************************************************/
  27. /* Transport type, passed to NL_Connect */
  28. /****************************************************************************/
  29. #define NL_TRANSPORT_TCP 1
  30. /****************************************************************************/
  31. /* Callback function prototypes */
  32. /****************************************************************************/
  33. /****************************************************************************/
  34. /* Name: CB_SL_INITIALIZED */
  35. /* */
  36. /* Purpose: Called when Network initialization is complete */
  37. /****************************************************************************/
  38. typedef void (PDCCALLBACK CB_SL_INITIALIZED) (PVOID inst);
  39. /****************************************************************************/
  40. /* Name: CB_SL_TERMINATING */
  41. /* */
  42. /* Purpose: Called before network terminates */
  43. /* */
  44. /* Operation: This function is called on the NL's receive thread to allow */
  45. /* resources to be freed prior to termination. */
  46. /****************************************************************************/
  47. typedef void (PDCCALLBACK CB_SL_TERMINATING)(PVOID inst);
  48. /****************************************************************************/
  49. /* Name: CB_SL_CONNECTED */
  50. /* */
  51. /* Purpose: Called when a connection to the Server is complete */
  52. /* */
  53. /* Params: channelID - ID of T.128 broadcast channel */
  54. /* pUserData - user data from Server */
  55. /* userDataLength - length of user data */
  56. /****************************************************************************/
  57. typedef void (PDCCALLBACK CB_SL_CONNECTED)(
  58. PVOID inst,
  59. unsigned channelID,
  60. PVOID pUserData,
  61. unsigned userDataLength,
  62. UINT32 serverVersion);
  63. /****************************************************************************/
  64. /* Name: CB_SL_DISCONNECTED */
  65. /* */
  66. /* Purpose: Called a connection to the Server is disconnected */
  67. /* */
  68. /* Params: result - reason for disconnection */
  69. /****************************************************************************/
  70. typedef void (PDCCALLBACK CB_SL_DISCONNECTED) (PVOID inst, unsigned result);
  71. /****************************************************************************/
  72. /* Name: CB_SL_PACKET_RECEIVED */
  73. /* */
  74. /* Purpose: Called when a packet is received from the Server */
  75. /* */
  76. /* Params: pData - packet received */
  77. /* dataLen - length of packet received */
  78. /* flags - security flags (RNS_SEC_xxx) */
  79. /* userID - ID of user who sent the packet */
  80. /* priority - priority on which packet was received */
  81. /****************************************************************************/
  82. typedef HRESULT (PDCCALLBACK CB_SL_PACKET_RECEIVED)(
  83. PVOID inst,
  84. PBYTE pData,
  85. unsigned dataLen,
  86. unsigned flags,
  87. unsigned userID,
  88. unsigned priority);
  89. /****************************************************************************/
  90. /* Name: CB_SL_BUFFER_AVAILABLE */
  91. /* */
  92. /* Purpose: Called when the network is ready to send again after being */
  93. /* busy for a period */
  94. /****************************************************************************/
  95. typedef void (PDCCALLBACK CB_SL_BUFFER_AVAILABLE) (PVOID inst);
  96. /****************************************************************************/
  97. /* Structures */
  98. /****************************************************************************/
  99. /****************************************************************************/
  100. /* Structure: NLtoSL_CALLBACKS */
  101. /* */
  102. /* Description: list of callbacks passed to NL_Init(). */
  103. /****************************************************************************/
  104. typedef struct tagNL_CALLBACKS
  105. {
  106. CB_SL_INITIALIZED onInitialized;
  107. CB_SL_TERMINATING onTerminating;
  108. CB_SL_CONNECTED onConnected;
  109. CB_SL_DISCONNECTED onDisconnected;
  110. CB_SL_PACKET_RECEIVED onPacketReceived;
  111. CB_SL_BUFFER_AVAILABLE onBufferAvailable;
  112. } NL_CALLBACKS, FAR *PNL_CALLBACKS;
  113. /****************************************************************************/
  114. /* Structure: NL_BUFHND */
  115. /* */
  116. /* Description: Buffer Handle */
  117. /****************************************************************************/
  118. typedef ULONG_PTR NL_BUFHND;
  119. typedef NL_BUFHND FAR *PNL_BUFHND;
  120. /****************************************************************************/
  121. /* Macroed functions */
  122. /****************************************************************************/
  123. #ifdef DC_DEBUG
  124. #define NL_SetNetworkThroughput TD_SetNetworkThroughput
  125. #define NL_GetNetworkThroughput TD_GetNetworkThroughput
  126. #endif /* DC_DEBUG */
  127. #define NL_GetBuffer MCS_GetBuffer
  128. #define NL_SendPacket MCS_SendPacket
  129. #define NL_FreeBuffer MCS_FreeBuffer
  130. /****************************************************************************/
  131. /* Structure: NL_GLOBAL_DATA */
  132. /****************************************************************************/
  133. typedef struct tagNL_GLOBAL_DATA
  134. {
  135. NL_CALLBACKS callbacks;
  136. UT_THREAD_DATA threadData;
  137. } NL_GLOBAL_DATA, FAR *PNL_GLOBAL_DATA;
  138. class CNL
  139. {
  140. public:
  141. CNL(CObjs* objs);
  142. ~CNL();
  143. public:
  144. // API Functions
  145. void DCAPI NL_Init(PNL_CALLBACKS);
  146. void DCAPI NL_Term();
  147. HRESULT DCAPI NL_Connect(BOOL, PTCHAR, unsigned, PTCHAR, PVOID, unsigned);
  148. void DCAPI NL_Disconnect();
  149. public:
  150. //
  151. // public data members
  152. //
  153. NL_GLOBAL_DATA _NL;
  154. private:
  155. CUI* _pUi;
  156. CCD* _pCd;
  157. CMCS* _pMcs;
  158. CNC* _pNc;
  159. CUT* _pUt;
  160. CRCV* _pRcv;
  161. private:
  162. CObjs* _pClientObjects;
  163. };
  164. #endif // _H_NL