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.

153 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 OSS 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_InitModule(void);
  62. int GK_TermModule(void);
  63. int GK_InitWorld(ASN1_CODER_INFO *pWorld);
  64. int GK_TermWorld(ASN1_CODER_INFO *pWorld);
  65. int GK_Encode(ASN1_CODER_INFO *pWorld, void *pStruct, int nPDU, ASN1_BUF *pBuf);
  66. int GK_Decode(ASN1_CODER_INFO *pWorld, void **ppStruct, int nPDU, ASN1_BUF *pBuf);
  67. }
  68. // DEBUG OPTIONS
  69. #define CODER_DEBUG 0x00000001
  70. #define CODER_SUPER_DEBUG 0x00000002
  71. // Coder Error Messages
  72. #define CODER_NOERROR 0
  73. #define CODER_ERROR 1
  74. // Protocol version information
  75. #define ITU_T 0
  76. #define RECOMMENDATION 0
  77. #define SERIES 8 // H225.0
  78. #define RECOMM_NUMBER 2250
  79. #define VERSION 0
  80. #define ADDITIONAL 1
  81. typedef struct InfoRequestResponse_perCallInfo SEQPERCALLINFO, *PSEQPERCALLINFO;
  82. typedef struct _seqtransadds{
  83. struct _seqtransadds *next;
  84. TransportAddress value;
  85. } SEQTRANSADDS, *PSEQTRANSADDS;
  86. typedef struct _seqaliasadds {
  87. struct _seqaliasadds *next;
  88. AliasAddress value;
  89. } SEQALIASADDS, *PSEQALIASADDS;
  90. class Coder{
  91. private:
  92. ASN1_CODER_INFO m_World;
  93. CRITICAL_SECTION m_critSec;
  94. public:
  95. struct ObjectID_ m_protocolIdentifier1,m_protocolIdentifier2,m_protocolIdentifier3,
  96. m_protocolIdentifier4,m_protocolIdentifier5,m_protocolIdentifier6;
  97. public:
  98. Coder();
  99. ~Coder();
  100. int InitCoder();
  101. // Creates an OssBuf
  102. int Encode(RasMessage *pInputData, ASN1_BUF *pOutputOssBuf);
  103. // Create memory to hold decoded OssBuf
  104. // For H323 this is a rasStruct
  105. int Decode(ASN1_BUF *pInputOssBuf, RasMessage **pOutputData);
  106. // Used to free buffer created by decode
  107. int Free(RasMessage *pData);
  108. // Used to free buffer created by encode
  109. void Free(ASN1_BUF Asn1Buf);
  110. // Returns the sequence number out of any RasMessage
  111. // Returns zero on error
  112. RequestSeqNum GetSequenceNumber(RasMessage *prasStruct);
  113. RequestSeqNum SetSequenceNumber(RasMessage &rasStruct,RequestSeqNum reqNum);
  114. // Returns a pointer EndpointIdentifier for any RasMessage
  115. // NULL for RasMessage that have no EndpointIdentifier
  116. EndpointIdentifier *GetEndpointID(RasMessage *prasStruct);
  117. // Returns a pointer to a valid H323 protocolIdentifier linked list
  118. // when a valid Rasmessage is passed in and sets the protocol Identifier
  119. // item in RasMessages that have an protocol Identifier
  120. // If in an RasMessage that doesn't have a protocol identifer is passed in,
  121. // NULL is returned.
  122. ProtocolIdentifier SetProtocolIdentifier(RasMessage &rasStruct);
  123. // Returns TRUE if protocols match, FALSE - otherwise
  124. BOOL VerifyProtocolIdentifier(RasMessage &rasStruct);
  125. // finds the requested protocol rasAddress and copies it
  126. DWORD CopyRasAddress(TransportAddress *pDestAddress, RasMessage *prasStruct, unsigned short choice);
  127. DWORD CopyRasAddress(TransportAddress *pDestAddress, PSEQTRANSADDS pSrcSeqRasAddress, unsigned short choice);
  128. // finds the requested protocol callSignalAddress and copies it
  129. DWORD CopyCallSignal(TransportAddress *pCallSignalAddress, RasMessage *prasStruct, unsigned short choice);
  130. DWORD CopyCallSignal(TransportAddress *pDestCallSignalAddress, PSEQTRANSADDS pSrcSeqCSAAddress, unsigned short choice);
  131. };
  132. #endif