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.

124 lines
3.7 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\gkibw.cpv $
  13. * *
  14. * $Revision: 1.6 $
  15. * $Date: 12 Feb 1997 01:12:16 $
  16. * *
  17. * $Author: CHULME $
  18. * *
  19. * $Log: S:\sturgeon\src\gki\vcs\gkibw.cpv $
  20. //
  21. // Rev 1.6 12 Feb 1997 01:12:16 CHULME
  22. // Redid thread synchronization to use Gatekeeper.Lock
  23. //
  24. // Rev 1.5 17 Jan 1997 09:02:08 CHULME
  25. // Changed reg.h to gkreg.h to avoid name conflict with inc directory
  26. //
  27. // Rev 1.4 10 Jan 1997 16:15:22 CHULME
  28. // Removed MFC dependency
  29. //
  30. // Rev 1.3 20 Dec 1996 16:38:24 CHULME
  31. // Fixed access synchronization with Gatekeeper lock
  32. //
  33. // Rev 1.2 02 Dec 1996 23:49:48 CHULME
  34. // Added premptive synchronization code
  35. //
  36. // Rev 1.1 22 Nov 1996 15:22:22 CHULME
  37. // Added VCS log to the header
  38. *************************************************************************/
  39. // gkibandwidth.cpp : Handles the GKI_BandwidthRequest API
  40. //
  41. #include "precomp.h"
  42. #include <process.h>
  43. #include <winsock.h>
  44. #include "GKICOM.H"
  45. #include "dspider.h"
  46. #include "dgkilit.h"
  47. #include "DGKIPROT.H"
  48. #include "GATEKPR.H"
  49. #include "gksocket.h"
  50. #include "GKREG.H"
  51. #include "dcall.h"
  52. #include "h225asn.h"
  53. #include "coder.hpp"
  54. #include "dgkiext.h"
  55. #ifdef _DEBUG
  56. #undef THIS_FILE
  57. static char THIS_FILE[] = __FILE__;
  58. #endif
  59. extern "C" HRESULT DLL_EXPORT
  60. GKI_BandwidthRequest(HANDLE hModCall, unsigned short usCallTypeChoice, BandWidth bandWidth)
  61. {
  62. // ABSTRACT: This function is exported. It is called by the client application
  63. // to request a change in the bandwidth of an existing conference.
  64. // The handle supplied by the client is actually a pointer to the CCall
  65. // object, which will be modified
  66. // AUTHOR: Colin Hulme
  67. HRESULT hResult;
  68. CCall *pCall;
  69. #ifdef _DEBUG
  70. char szGKDebug[80];
  71. #endif
  72. SPIDER_TRACE(SP_FUNC, "GKI_BandwidthRequest(%X)\n", hModCall);
  73. #ifdef _DEBUG
  74. if (dwGKIDLLFlags & SP_GKI)
  75. {
  76. SPIDER_TRACE(SP_GKI, "GKI_BandwidthRequest()\n", 0);
  77. wsprintf(szGKDebug, "\thModCall = %p\n", hModCall);
  78. OutputDebugString(szGKDebug);
  79. wsprintf(szGKDebug, "\tusCallTypeChoice = %X\n", usCallTypeChoice);
  80. OutputDebugString(szGKDebug);
  81. wsprintf(szGKDebug, "\tbandWidth = %X\n", bandWidth);
  82. OutputDebugString(szGKDebug);
  83. }
  84. #endif
  85. // Create a Gatekeeper lock object on the stack
  86. // It's constructor will lock pGK and when we return
  87. // from any path, its destructor will unlock pGK
  88. CGatekeeperLock GKLock(g_pGatekeeper);
  89. if (g_pReg == 0)
  90. return (GKI_NOT_REG);
  91. if (g_pReg->GetState() != CRegistration::GK_REGISTERED)
  92. return (GKI_NOT_REG);
  93. // Validate call pointer
  94. pCall = (CCall *)hModCall;
  95. if (IsBadReadPtr(pCall, sizeof(CCall)))
  96. return (GKI_HANDLE_ERROR);
  97. if (pCall != (CCall *)pCall->GetHCall())
  98. return (GKI_HANDLE_ERROR);
  99. // Protect against concurrent PDUs
  100. if (pCall->GetRasMessage() != 0)
  101. return (GKI_BUSY);
  102. // Initialize CCall member variables
  103. pCall->SetCallType(usCallTypeChoice);
  104. pCall->SetBandWidth(bandWidth);
  105. // Create BandwidthRequest structure - Encode and send PDU
  106. if ((hResult = pCall->BandwidthRequest()) != GKI_OK)
  107. return (hResult);
  108. return (GKI_OK);
  109. }