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.

328 lines
10 KiB

  1. /****************************************************************************
  2. *
  3. * $Archive: S:/STURGEON/SRC/CALLCONT/VCS/ccmain.h_v $
  4. *
  5. * INTEL Corporation Prorietary Information
  6. *
  7. * This listing is supplied under the terms of a license agreement
  8. * with INTEL Corporation and may not be copied nor disclosed except
  9. * in accordance with the terms of that agreement.
  10. *
  11. * Copyright (c) 1993-1994 Intel Corporation.
  12. *
  13. * $Revision: 1.81 $
  14. * $Date: 31 Jan 1997 13:13:50 $
  15. * $Author: MANDREWS $
  16. *
  17. * Deliverable:
  18. *
  19. * Abstract:
  20. *
  21. *
  22. * Notes:
  23. *
  24. ***************************************************************************/
  25. #include <winerror.h>
  26. #ifdef GATEKEEPER
  27. #include "gkiman.h"
  28. #endif // GATEKEEPER
  29. #define MASTER_SLAVE_RETRY_MAX 10
  30. typedef struct {
  31. #ifdef _DEBUG
  32. CRITICAL_SECTION LockInfoLock;
  33. WORD wLockCount;
  34. WORD wNumQueuedThreads;
  35. HANDLE hOwningThread;
  36. #endif
  37. HANDLE Lock;
  38. } LOCK, *PLOCK;
  39. typedef struct {
  40. LOCK Lock;
  41. WORD wNumThreads;
  42. } THREADCOUNT;
  43. typedef enum {
  44. INITIALIZING_STATE,
  45. OPERATIONAL_STATE,
  46. SHUTDOWN_STATE
  47. } CALL_CONTROL_STATE;
  48. // The following typedef is not in callcont.h because it is only used internally
  49. typedef DWORD HHANGUP, *PHHANGUP;
  50. typedef enum {
  51. TS_FALSE,
  52. TS_TRUE,
  53. TS_UNKNOWN
  54. } TRISTATE;
  55. typedef enum {
  56. UNCONNECTED_MODE,
  57. POINT_TO_POINT_MODE,
  58. MULTIPOINT_MODE
  59. } CONFMODE;
  60. typedef enum {
  61. NEVER_ATTACHED, // Endpoint has never been attached to the conference
  62. ATTACHED, // Endpoint is currently attached to the conference
  63. DETACHED // Endpoint was once attached to the conference, but is now detached
  64. } ATTACHSTATE;
  65. typedef struct CallQueue_t {
  66. CC_HCALL hCall;
  67. struct CallQueue_t *pNext;
  68. struct CallQueue_t *pPrev;
  69. } CALL_QUEUE, *PCALL_QUEUE;
  70. #define NUM_TERMINAL_ALLOCATION_SLOTS 24 // 24*sizeof(BYTE) = 192 = max. terminal number
  71. #define NUM_CHANNEL_ALLOCATION_SLOTS 32 // 32*sizeof(BYTE) = 256 = max. channel number
  72. typedef enum {
  73. TERMINAL_ID_INVALID,
  74. TERMINAL_ID_REQUESTED,
  75. TERMINAL_ID_VALID
  76. } TERMINALIDSTATE;
  77. typedef struct {
  78. TERMINALIDSTATE TerminalIDState;
  79. CC_PARTICIPANTINFO ParticipantInfo;
  80. PCALL_QUEUE pEnqueuedRequestsForTerminalID; // list of calls waiting to get this peer's terminal ID
  81. } PARTICIPANTINFO, *PPARTICIPANTINFO;
  82. typedef struct Conference_t {
  83. CC_HCONFERENCE hConference; // handle for this conference object
  84. CC_CONFERENCEID ConferenceID; // conference ID (0 => conference ID has not
  85. // been established)
  86. PARTICIPANTINFO LocalParticipantInfo;
  87. BYTE TerminalNumberAllocation[NUM_TERMINAL_ALLOCATION_SLOTS];
  88. BYTE ChannelNumberAllocation[NUM_CHANNEL_ALLOCATION_SLOTS];
  89. BOOL bDeferredDelete;
  90. BOOL bMultipointCapable;
  91. BOOL bForceMC;
  92. BOOL bAutoAccept;
  93. ATTACHSTATE LocalEndpointAttached;
  94. BOOL bDynamicConferenceID;
  95. BOOL bDynamicTerminalID;
  96. PCC_TERMCAP pLocalH245H2250MuxCapability;
  97. PCC_TERMCAPLIST pLocalH245TermCapList; // terminal capabilities
  98. PCC_TERMCAPDESCRIPTORS pLocalH245TermCapDescriptors; // terminal capability descriptors
  99. BOOL bSessionTableInternallyConstructed; // TRUE => session table must be
  100. // deallocated by Call Control; FALSE => must be
  101. // deallocated by SessionTableConstructor
  102. PCC_SESSIONTABLE pSessionTable;
  103. PCC_TERMCAP pConferenceH245H2250MuxCapability;
  104. PCC_TERMCAPLIST pConferenceTermCapList;
  105. PCC_TERMCAPDESCRIPTORS pConferenceTermCapDescriptors;
  106. DWORD_PTR dwConferenceToken; // conference token specified by user in
  107. // CreateConference()
  108. CC_SESSIONTABLE_CONSTRUCTOR SessionTableConstructor;
  109. CC_TERMCAP_CONSTRUCTOR TermCapConstructor;
  110. CC_CONFERENCE_CALLBACK ConferenceCallback; // conference callback location
  111. CC_CONFERENCE_CALLBACK SaveConferenceCallback; // saved copy of the conference callback location
  112. struct Call_t *pEnqueuedCalls;
  113. struct Call_t *pPlacedCalls;
  114. struct Call_t *pEstablishedCalls;
  115. struct Call_t *pVirtualCalls;
  116. struct Channel_t *pChannels;
  117. TRISTATE tsMultipointController;
  118. TRISTATE tsMaster;
  119. CONFMODE ConferenceMode;
  120. PCC_ADDR pMultipointControllerAddr;
  121. PCC_VENDORINFO pVendorInfo;
  122. PCALL_QUEUE pEnqueuedRequestModeCalls;
  123. BOOL bInTable;
  124. struct Conference_t *pNextInTable;
  125. struct Conference_t *pPrevInTable;
  126. LOCK Lock;
  127. } CONFERENCE, *PCONFERENCE, **PPCONFERENCE;
  128. // State of call object
  129. typedef enum {
  130. INCOMING, // incoming call request has been received,
  131. // but not yet accepted or rejected
  132. ENQUEUED, // call has been enqueued on conference for later placement
  133. PLACED, // call has been placed, awaiting RINGING, CONNECT or RELEASECOMPLETE
  134. RINGING, // RINGING received, awaiting CONNECT or RELEASECOMPLETE
  135. TERMCAP, // CONNECT received or incoming call accepted,
  136. // awaiting completion of terminal capability exchange
  137. CALL_COMPLETE // call placement complete (either success or failure)
  138. } CALLSTATE;
  139. typedef enum {
  140. NEED_TO_SEND_TERMCAP,
  141. AWAITING_TERMCAP,
  142. AWAITING_ACK,
  143. TERMCAP_COMPLETE
  144. } TERMCAPSTATE;
  145. typedef enum {
  146. MASTER_SLAVE_NOT_STARTED,
  147. MASTER_SLAVE_IN_PROGRESS,
  148. MASTER_SLAVE_COMPLETE
  149. } MASTERSLAVESTATE;
  150. typedef enum {
  151. CALLER,
  152. CALLEE,
  153. VIRTUAL,
  154. THIRD_PARTY_INVITOR,
  155. THIRD_PARTY_INTERMEDIARY // we're the MC in a third party invite
  156. } CALLTYPE;
  157. typedef struct Call_t {
  158. CC_HCALL hCall;
  159. CC_HCONFERENCE hConference;
  160. HQ931CALL hQ931Call;
  161. HQ931CALL hQ931CallInvitor; // Invitor in third party invite
  162. PPARTICIPANTINFO pPeerParticipantInfo;
  163. BOOL bMarkedForDeletion;
  164. PCC_NONSTANDARDDATA pLocalNonStandardData;
  165. PCC_NONSTANDARDDATA pPeerNonStandardData;
  166. PCC_ADDR pQ931LocalConnectAddr;
  167. PCC_ADDR pQ931PeerConnectAddr;
  168. PCC_ADDR pQ931DestinationAddr;
  169. PCC_ADDR pSourceCallSignalAddress;
  170. PCC_TERMCAPLIST pPeerH245TermCapList;
  171. PCC_TERMCAP pPeerH245H2250MuxCapability;
  172. PCC_TERMCAPDESCRIPTORS pPeerH245TermCapDescriptors;
  173. PCC_ALIASNAMES pLocalAliasNames;
  174. PCC_ALIASNAMES pPeerAliasNames;
  175. PCC_ALIASNAMES pPeerExtraAliasNames;
  176. PCC_ALIASITEM pPeerExtension;
  177. PWSTR pszLocalDisplay;
  178. PWSTR pszPeerDisplay;
  179. PCC_VENDORINFO pPeerVendorInfo;
  180. DWORD_PTR dwUserToken;
  181. TERMCAPSTATE OutgoingTermCapState; // NEED_TO_SEND_TERMCAP, AWAITING_ACK, or
  182. // TERMCAP_COMPLETE
  183. TERMCAPSTATE IncomingTermCapState; // AWAITING_TERMCAP or TERMCAP_COMPLETE
  184. MASTERSLAVESTATE MasterSlaveState;
  185. struct Call_t *pNext;
  186. struct Call_t *pPrev;
  187. CALLSTATE CallState;
  188. CALLTYPE CallType;
  189. BOOL bCallerIsMC;
  190. CC_CONFERENCEID ConferenceID;
  191. BOOL bLinkEstablished;
  192. H245_INST_T H245Instance;
  193. DWORD dwH245PhysicalID;
  194. WORD wMasterSlaveRetry;
  195. GUID CallIdentifier;
  196. #ifdef GATEKEEPER
  197. GKICALL GkiCall;
  198. #endif // GATEKEEPER
  199. BOOL bInTable;
  200. struct Call_t *pNextInTable;
  201. struct Call_t *pPrevInTable;
  202. LOCK Lock;
  203. } CALL, *PCALL, **PPCALL;
  204. // Channel types must be bit maps
  205. #define TX_CHANNEL 0x01
  206. #define RX_CHANNEL 0x02
  207. #define TXRX_CHANNEL 0x04 // bi-directional channel
  208. #define PROXY_CHANNEL 0x08
  209. #define ALL_CHANNELS (TX_CHANNEL | RX_CHANNEL | TXRX_CHANNEL | PROXY_CHANNEL)
  210. typedef struct Channel_t {
  211. CC_HCHANNEL hChannel;
  212. CC_HCONFERENCE hConference;
  213. DWORD_PTR dwUserToken;
  214. BYTE bSessionID;
  215. BYTE bAssociatedSessionID;
  216. WORD wLocalChannelNumber;
  217. WORD wRemoteChannelNumber;
  218. BOOL bMultipointChannel;
  219. WORD wNumOutstandingRequests;
  220. PCC_TERMCAP pTxH245TermCap;
  221. PCC_TERMCAP pRxH245TermCap;
  222. H245_MUX_T *pTxMuxTable;
  223. H245_MUX_T *pRxMuxTable;
  224. H245_ACCESS_T *pSeparateStack;
  225. CC_HCALL hCall;
  226. BYTE bChannelType;
  227. BOOL bCallbackInvoked;
  228. TRISTATE tsAccepted;
  229. PCALL_QUEUE pCloseRequests;
  230. PCC_ADDR pLocalRTPAddr;
  231. PCC_ADDR pLocalRTCPAddr;
  232. PCC_ADDR pPeerRTPAddr;
  233. PCC_ADDR pPeerRTCPAddr;
  234. DWORD dwChannelBitRate;
  235. BOOL bLocallyOpened;
  236. struct Channel_t *pNext;
  237. struct Channel_t *pPrev;
  238. BOOL bInTable;
  239. struct Channel_t *pNextInTable;
  240. struct Channel_t *pPrevInTable;
  241. LOCK Lock;
  242. } CHANNEL, *PCHANNEL, **PPCHANNEL;
  243. typedef struct Listen_t {
  244. CC_HLISTEN hListen;
  245. CC_ADDR ListenAddr;
  246. DWORD_PTR dwListenToken;
  247. CC_LISTEN_CALLBACK ListenCallback;
  248. HQ931LISTEN hQ931Listen;
  249. PCC_ALIASNAMES pLocalAliasNames; // local alias names
  250. BOOL bInTable;
  251. struct Listen_t *pNextInTable;
  252. struct Listen_t *pPrevInTable;
  253. LOCK Lock;
  254. } LISTEN, *PLISTEN, **PPLISTEN;
  255. typedef struct Hangup_t {
  256. HHANGUP hHangup;
  257. CC_HCONFERENCE hConference;
  258. DWORD_PTR dwUserToken;
  259. WORD wNumCalls;
  260. BOOL bInTable;
  261. struct Hangup_t *pNextInTable;
  262. struct Hangup_t *pPrevInTable;
  263. LOCK Lock;
  264. } HANGUP, *PHANGUP, **PPHANGUP;
  265. #ifdef FORCE_SERIALIZE_CALL_CONTROL
  266. #define EnterCallControlTop() {CCLOCK_AcquireLock();}
  267. #define LeaveCallControlTop(f) {CCLOCK_RelinquishLock(); \
  268. return f;}
  269. #define EnterCallControl()
  270. #define HResultLeaveCallControl(f) {return f;}
  271. #define DWLeaveCallControl(f) {return f;}
  272. #else
  273. #define EnterCallControlTop() EnterCallControl()
  274. #define LeaveCallControlTop(f) HResultLeaveCallControl(f)
  275. #define EnterCallControl() {AcquireLock(&ThreadCount.Lock); \
  276. ThreadCount.wNumThreads++; \
  277. RelinquishLock(&ThreadCount.Lock);}
  278. #define NullLeaveCallControl() {AcquireLock(&ThreadCount.Lock); \
  279. ThreadCount.wNumThreads--; \
  280. RelinquishLock(&ThreadCount.Lock); \
  281. return;}
  282. #define HResultLeaveCallControl(f) {HRESULT stat; \
  283. stat = f; \
  284. AcquireLock(&ThreadCount.Lock); \
  285. ThreadCount.wNumThreads--; \
  286. RelinquishLock(&ThreadCount.Lock); \
  287. return stat;}
  288. #define DWLeaveCallControl(f) {DWORD stat; \
  289. stat = f; \
  290. AcquireLock(&ThreadCount.Lock); \
  291. ThreadCount.wNumThreads--; \
  292. RelinquishLock(&ThreadCount.Lock); \
  293. return stat;}
  294. #endif
  295.