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.

178 lines
5.0 KiB

  1. /************************************************************************
  2. * *
  3. * INTEL CORPORATION PROPRIETARY INFORMATION *
  4. * *
  5. * This software is supplied under the terms of a license *
  6. * agreement or non-disclosure agreement with Intel Corporation *
  7. * and may not be copied or disclosed except in accordance *
  8. * with the terms of that agreement. *
  9. * *
  10. * Copyright (C) 1997 Intel Corp. All Rights Reserved *
  11. * *
  12. * $Archive: S:\sturgeon\src\gki\vcs\gkiadm.cpv $
  13. * *
  14. * $Revision: 1.9 $
  15. * $Date: 12 Feb 1997 01:12:06 $
  16. * *
  17. * $Author: CHULME $
  18. * *
  19. * $Log: S:\sturgeon\src\gki\vcs\gkiadm.cpv $
  20. //
  21. // Rev 1.9 12 Feb 1997 01:12:06 CHULME
  22. // Redid thread synchronization to use Gatekeeper.Lock
  23. //
  24. // Rev 1.8 17 Jan 1997 09:02:04 CHULME
  25. // Changed reg.h to gkreg.h to avoid name conflict with inc directory
  26. //
  27. // Rev 1.7 10 Jan 1997 16:15:12 CHULME
  28. // Removed MFC dependency
  29. //
  30. // Rev 1.6 20 Dec 1996 16:38:34 CHULME
  31. // Fixed access synchronization with Gatekeeper lock
  32. //
  33. // Rev 1.5 17 Dec 1996 18:21:58 CHULME
  34. // Switch src and destination fields on ARQ for Callee
  35. //
  36. // Rev 1.4 02 Dec 1996 23:49:32 CHULME
  37. // Added premptive synchronization code
  38. //
  39. // Rev 1.3 22 Nov 1996 15:24:18 CHULME
  40. // Added VCS log to the header
  41. *************************************************************************/
  42. // gkiadmission.cpp : Handles the GKI_AdmissionRequest API
  43. //
  44. #include "precomp.h"
  45. #include <process.h>
  46. #include <winsock.h>
  47. #include "GKICOM.H"
  48. #include "dspider.h"
  49. #include "dgkilit.h"
  50. #include "DGKIPROT.H"
  51. #include "GATEKPR.H"
  52. #include "gksocket.h"
  53. #include "GKREG.H"
  54. #include "dcall.h"
  55. #include "h225asn.h"
  56. #include "coder.hpp"
  57. #include "dgkiext.h"
  58. #ifdef _DEBUG
  59. #undef THIS_FILE
  60. static char THIS_FILE[] = __FILE__;
  61. #endif
  62. extern "C" HRESULT DLL_EXPORT
  63. GKI_AdmissionRequest(unsigned short usCallTypeChoice,
  64. SeqAliasAddr *pRemoteInfo,
  65. TransportAddress *pRemoteCallSignalAddress,
  66. SeqAliasAddr *pDestExtraCallInfo,
  67. LPGUID pCallIdentifier,
  68. BandWidth bandWidth,
  69. ConferenceIdentifier *pConferenceID,
  70. BOOL activeMC,
  71. BOOL answerCall,
  72. unsigned short usCallTransport)
  73. {
  74. // ABSTRACT: This function is exported. It is called by the client application
  75. // to request bandwidth for a conference. It will create a CCall
  76. // object to track all pertanent information. The handle returned
  77. // to the client asynchronously will actually be a pointer to this
  78. // object.
  79. // AUTHOR: Colin Hulme
  80. CCall *pCall;
  81. SeqAliasAddr *pAA;
  82. HRESULT hResult;
  83. #ifdef _DEBUG
  84. char szGKDebug[80];
  85. #endif
  86. SPIDER_TRACE(SP_FUNC, "GKI_AdmissionRequest()\n", 0);
  87. #ifdef _DEBUG
  88. if (dwGKIDLLFlags & SP_GKI)
  89. {
  90. SPIDER_TRACE(SP_GKI, "GKI_AdmissionRequest()\n", 0);
  91. Dump_GKI_AdmissionRequest(usCallTypeChoice,
  92. pRemoteInfo,
  93. pRemoteCallSignalAddress,
  94. pDestExtraCallInfo,
  95. bandWidth,
  96. pConferenceID,
  97. activeMC,
  98. answerCall,
  99. usCallTransport);
  100. }
  101. #endif
  102. // Create a Gatekeeper lock object on the stack
  103. // It's constructor will lock pGK and when we return
  104. // from any path, its destructor will unlock pGK
  105. CGatekeeperLock GKLock(g_pGatekeeper);
  106. if (g_pReg == 0)
  107. return (GKI_NOT_REG);
  108. if (g_pReg->GetState() != CRegistration::GK_REGISTERED)
  109. return (GKI_NOT_REG);
  110. ASSERT(pCallIdentifier);
  111. ASSERT((usCallTransport == ipAddress_chosen) ||(usCallTransport == ipxAddress_chosen));
  112. // Create a call object
  113. pCall = new CCall;
  114. SPIDER_TRACE(SP_NEWDEL, "new pCall = %X\n", pCall);
  115. if (pCall == 0)
  116. return (GKI_NO_MEMORY);
  117. pCall->SetCallType(usCallTypeChoice);
  118. pCall->SetCallIdentifier(pCallIdentifier);
  119. // Add this call to our call list
  120. g_pReg->AddCall(pCall);
  121. for (pAA = pRemoteInfo; pAA != 0; pAA = pAA->next)
  122. {
  123. if ((hResult = pCall->AddRemoteInfo(pAA->value)) != GKI_OK)
  124. {
  125. g_pReg->DeleteCall(pCall);
  126. return (hResult);
  127. }
  128. }
  129. if (pRemoteCallSignalAddress)
  130. pCall->SetRemoteCallSignalAddress(pRemoteCallSignalAddress);
  131. for (pAA = pDestExtraCallInfo; pAA != 0; pAA = pAA->next)
  132. {
  133. if ((hResult = pCall->AddDestExtraCallInfo(pAA->value)) != GKI_OK)
  134. {
  135. g_pReg->DeleteCall(pCall);
  136. return (hResult);
  137. }
  138. }
  139. if ((hResult = pCall->SetLocalCallSignalAddress(usCallTransport)) != GKI_OK)
  140. {
  141. g_pReg->DeleteCall(pCall);
  142. return (hResult);
  143. }
  144. pCall->SetBandWidth(bandWidth);
  145. pCall->SetCallReferenceValue(g_pReg->GetNextCRV());
  146. pCall->SetConferenceID(pConferenceID);
  147. pCall->SetActiveMC(activeMC);
  148. pCall->SetAnswerCall(answerCall);
  149. // Create AdmissionRequest structure - Encode and send PDU
  150. if ((hResult = pCall->AdmissionRequest()) != GKI_OK)
  151. {
  152. g_pReg->DeleteCall(pCall);
  153. return (hResult);
  154. }
  155. return (GKI_OK);
  156. }