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.

151 lines
5.7 KiB

  1. /***********************************************************************
  2. * INTEL Corporation Proprietary Information *
  3. * *
  4. * This listing is supplied under the terms of a license agreement *
  5. * with INTEL Corporation and may not be copied nor disclosed except *
  6. * in accordance with the terms of that agreement. *
  7. * *
  8. * Copyright (c) 1997 Intel Corporation. All rights reserved. *
  9. ***********************************************************************
  10. * *
  11. * $Archive: S:\sturgeon\src\include\vcs\coder.hpv $
  12. *
  13. * $Revision: 1.4 $
  14. * $Date: 16 Jan 1997 15:25:06 $
  15. *
  16. * $Author: BPOLING $
  17. *
  18. * $Log: S:\sturgeon\src\include\vcs\coder.hpv $
  19. //
  20. // Rev 1.4 16 Jan 1997 15:25:06 BPOLING
  21. // changed copyrights to 1997
  22. //
  23. // Rev 1.3 18 Dec 1996 21:49:58 BPOLING
  24. // builds with msdev and for windows only
  25. //
  26. // Rev 1.2 09 Dec 1996 14:13:54 EHOWARDX
  27. // Updated copyright notice.
  28. *
  29. * Rev 1.1 15 Nov 1996 16:16:14 BPOLING
  30. * vcs header added.
  31. * *
  32. ***********************************************************************
  33. * *
  34. * coder.hpp *
  35. * *
  36. * PURPOSE: Encode/Decode ANS.1 Gatekeeper PDU using the ANS.1 *
  37. * compiler functions. *
  38. * *
  39. * FUNCTIONS: *
  40. * *
  41. * COMMENTS: *
  42. * *
  43. ***********************************************************************/
  44. /************************************************************************
  45. * Include Files *
  46. ***********************************************************************/
  47. /************************************************************************
  48. * Manifest Constants *
  49. ***********************************************************************/
  50. /************************************************************************
  51. * GLOBAL VARIABLES *
  52. ************************************************************************/
  53. /************************************************************************
  54. * Class Definitions *
  55. ***********************************************************************/
  56. #ifndef _CODER_HPP
  57. #define _CODER_HPP
  58. #include "av_asn1.h"
  59. #include "gk_asn1.h"
  60. extern "C" {
  61. int GK_InitWorld(ASN1_CODER_INFO *pWorld);
  62. int GK_TermWorld(ASN1_CODER_INFO *pWorld);
  63. int GK_Encode(ASN1_CODER_INFO *pWorld, void *pStruct, int nPDU, ASN1_BUF *pBuf);
  64. int GK_Decode(ASN1_CODER_INFO *pWorld, void **ppStruct, int nPDU, ASN1_BUF *pBuf);
  65. }
  66. // DEBUG OPTIONS
  67. #define CODER_DEBUG 0x00000001
  68. #define CODER_SUPER_DEBUG 0x00000002
  69. // Coder Error Messages
  70. #define CODER_NOERROR 0
  71. #define CODER_ERROR 1
  72. // Protocol version information
  73. #define ITU_T 0
  74. #define RECOMMENDATION 0
  75. #define SERIES 8 // H225.0
  76. #define RECOMM_NUMBER 2250
  77. #define VERSION 0
  78. #define ADDITIONAL 2
  79. // typedef struct InfoRequestResponse_perCallInfo SEQPERCALLINFO, *PSEQPERCALLINFO;
  80. typedef struct _seqtransadds{
  81. struct _seqtransadds *next;
  82. TransportAddress value;
  83. } SEQTRANSADDS, *PSEQTRANSADDS;
  84. typedef struct _seqaliasadds {
  85. struct _seqaliasadds *next;
  86. AliasAddress value;
  87. } SEQALIASADDS, *PSEQALIASADDS;
  88. class Coder{
  89. private:
  90. ASN1_CODER_INFO m_World;
  91. CRITICAL_SECTION m_critSec;
  92. public:
  93. struct ObjectID_ m_protocolIdentifier1,m_protocolIdentifier2,m_protocolIdentifier3,
  94. m_protocolIdentifier4,m_protocolIdentifier5,m_protocolIdentifier6;
  95. public:
  96. Coder();
  97. ~Coder();
  98. int InitCoder();
  99. // Creates an OssBuf
  100. int Encode(RasMessage *pInputData, ASN1_BUF *pOutputOssBuf);
  101. // Create memory to hold decoded OssBuf
  102. // For H323 this is a rasStruct
  103. int Decode(ASN1_BUF *pInputOssBuf, RasMessage **pOutputData);
  104. // Used to free buffer created by decode
  105. int Free(RasMessage *pData);
  106. // Used to free buffer created by encode
  107. void Free(ASN1_BUF Asn1Buf);
  108. // Returns the sequence number out of any RasMessage
  109. // Returns zero on error
  110. RequestSeqNum GetSequenceNumber(RasMessage *prasStruct);
  111. RequestSeqNum SetSequenceNumber(RasMessage &rasStruct,RequestSeqNum reqNum);
  112. // Returns a pointer EndpointIdentifier for any RasMessage
  113. // NULL for RasMessage that have no EndpointIdentifier
  114. EndpointIdentifier *GetEndpointID(RasMessage *prasStruct);
  115. // Returns a pointer to a valid H323 protocolIdentifier linked list
  116. // when a valid Rasmessage is passed in and sets the protocol Identifier
  117. // item in RasMessages that have an protocol Identifier
  118. // If in an RasMessage that doesn't have a protocol identifer is passed in,
  119. // NULL is returned.
  120. ProtocolIdentifier SetProtocolIdentifier(RasMessage &rasStruct);
  121. // Returns TRUE if protocols match, FALSE - otherwise
  122. BOOL VerifyProtocolIdentifier(RasMessage &rasStruct);
  123. // finds the requested protocol rasAddress and copies it
  124. DWORD CopyRasAddress(TransportAddress *pDestAddress, RasMessage *prasStruct, unsigned short choice);
  125. DWORD CopyRasAddress(TransportAddress *pDestAddress, PSEQTRANSADDS pSrcSeqRasAddress, unsigned short choice);
  126. // finds the requested protocol callSignalAddress and copies it
  127. DWORD CopyCallSignal(TransportAddress *pCallSignalAddress, RasMessage *prasStruct, unsigned short choice);
  128. DWORD CopyCallSignal(TransportAddress *pDestCallSignalAddress, PSEQTRANSADDS pSrcSeqCSAAddress, unsigned short choice);
  129. };
  130. #endif