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.

114 lines
3.3 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\gkiloc.cpv $
  13. * *
  14. * $Revision: 1.6 $
  15. * $Date: 12 Feb 1997 01:11:46 $
  16. * *
  17. * $Author: CHULME $
  18. * *
  19. * $Log: S:\sturgeon\src\gki\vcs\gkiloc.cpv $
  20. //
  21. // Rev 1.6 12 Feb 1997 01:11:46 CHULME
  22. // Redid thread synchronization to use Gatekeeper.Lock
  23. //
  24. // Rev 1.5 17 Jan 1997 09:02:14 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:36 CHULME
  28. // Removed MFC dependency
  29. //
  30. // Rev 1.3 20 Dec 1996 16:38:20 CHULME
  31. // Fixed access synchronization with Gatekeeper lock
  32. //
  33. // Rev 1.2 02 Dec 1996 23:49:52 CHULME
  34. // Added premptive synchronization code
  35. //
  36. // Rev 1.1 22 Nov 1996 15:22:02 CHULME
  37. // Added VCS log to the header
  38. *************************************************************************/
  39. // gkilocation.cpp : Handles the GKI_LocationRequest 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_LocationRequest(SeqAliasAddr *pLocationInfo)
  61. {
  62. // ABSTRACT: This function is exported. It is called by the client application
  63. // to request the transport address for a terminal that is registered.
  64. // with the supplied alias addresses.
  65. // AUTHOR: Colin Hulme
  66. SeqAliasAddr *pAA;
  67. HRESULT hResult;
  68. #ifdef _DEBUG
  69. char szGKDebug[80];
  70. #endif
  71. SPIDER_TRACE(SP_FUNC, "GKI_LocationRequest()\n", 0);
  72. #ifdef _DEBUG
  73. if (dwGKIDLLFlags & SP_GKI)
  74. {
  75. SPIDER_TRACE(SP_GKI, "GKI_LocationRequest()\n", 0);
  76. Dump_GKI_LocationRequest(pLocationInfo);
  77. }
  78. #endif
  79. // Create a Gatekeeper lock object on the stack
  80. // It's constructor will lock pGK and when we return
  81. // from any path, its destructor will unlock pGK
  82. CGatekeeperLock GKLock(g_pGatekeeper);
  83. if (g_pReg == 0)
  84. return (GKI_NOT_REG);
  85. // Protect against concurrent PDUs
  86. if (g_pReg->GetRasMessage() != 0)
  87. return (GKI_BUSY);
  88. if (g_pReg->GetState() != CRegistration::GK_REGISTERED)
  89. return (GKI_NOT_REG);
  90. // Initialize CRegistration member variables
  91. for (pAA = pLocationInfo; pAA != 0; pAA = pAA->next)
  92. {
  93. if ((hResult = g_pReg->AddLocationInfo(pAA->value)) != GKI_OK)
  94. return (hResult);
  95. }
  96. // Create LocationRequest structure - Encode and send PDU
  97. if ((hResult = g_pReg->LocationRequest()) != GKI_OK)
  98. return (hResult);
  99. return (GKI_OK);
  100. }