Source code of Windows XP (NT5)
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.

182 lines
6.4 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. // DEBUG OPTIONS
  59. #define CODER_DEBUG 0x00000001
  60. #define CODER_SUPER_DEBUG 0x00000002
  61. // Coder Error Messages
  62. #define CODER_NOERROR 0
  63. #define CODER_ERROR 1
  64. // Protocol version information
  65. #define ITU_T 0
  66. #define RECOMMENDATION 0
  67. #define SERIES 8 // H225.0
  68. #define RECOMM_NUMBER 2250
  69. #define VERSION 0
  70. #define ADDITIONAL 1
  71. typedef struct _percallInfo
  72. {
  73. unsigned char bit_mask;
  74. NonStandardParameter prCllInf_nnStndrdDt; /* optional */
  75. CallReferenceValue callReferenceValue;
  76. ConferenceIdentifier conferenceID;
  77. ossBoolean originator; /* optional */
  78. struct _seqofP17 {
  79. struct _seqofP17 *next;
  80. RTPSession value;
  81. } *audio; /* optional */
  82. struct _seqofP18 {
  83. struct _seqofP18 *next;
  84. RTPSession value;
  85. } *video; /* optional */
  86. struct _seqofP19 {
  87. struct _seqofP19 *next;
  88. TransportChannelInfo value;
  89. } *data; /* optional */
  90. TransportChannelInfo h245;
  91. TransportChannelInfo callSignaling;
  92. CallType callType;
  93. BandWidth bandWidth;
  94. CallModel callModel;
  95. } PERCALLINFO, *PPERCALLINFO;
  96. typedef struct _seqpercallInfo{
  97. struct _seqpercallInfo *next;
  98. struct _percallInfo value;
  99. } SEQPERCALLINFO, *PSEQPERCALLINFO;
  100. typedef struct _seqtransadds{
  101. struct _seqtransadds *next;
  102. TransportAddress value;
  103. } SEQTRANSADDS, *PSEQTRANSADDS;
  104. typedef struct _seqaliasadds {
  105. struct _seqaliasadds *next;
  106. AliasAddress value;
  107. } SEQALIASADDS, *PSEQALIASADDS;
  108. class Coder{
  109. private:
  110. OssGlobal m_World;
  111. CRITICAL_SECTION m_critSec;
  112. public:
  113. struct ObjectID_ m_protocolIdentifier1,m_protocolIdentifier2,m_protocolIdentifier3,
  114. m_protocolIdentifier4,m_protocolIdentifier5,m_protocolIdentifier6;
  115. public:
  116. Coder();
  117. ~Coder();
  118. #ifdef _CONSOLE
  119. // Print a H323 structure
  120. int Print(RasMessage *pData);
  121. // Print an encoded H323 structure
  122. void Print(OssBuf *pOssBuf);
  123. #else
  124. int InitCoder();
  125. #endif
  126. // Creates an OssBuf
  127. int Encode(RasMessage *pInputData, OssBuf *pOutputOssBuf);
  128. // Create memory to hold decoded OssBuf
  129. // For H323 this is a rasStruct
  130. int Decode(OssBuf *pInputOssBuf, RasMessage **pOutputData);
  131. // Used to free buffer created by decode
  132. int Free(RasMessage *pData);
  133. // Used to free buffer created by encode
  134. void Free(OssBuf ossBuf);
  135. int Copy(RasMessage **pDestination,RasMessage *pSource);
  136. // Compare rasStruct
  137. // return of 1 means structures are not the same
  138. // return of 0 means structures are the same
  139. int Compare(RasMessage *pOriginal, RasMessage *pCopied);
  140. // Returns the sequence number out of any RasMessage
  141. // Returns zero on error
  142. RequestSeqNum GetSequenceNumber(RasMessage *prasStruct);
  143. RequestSeqNum SetSequenceNumber(RasMessage &rasStruct,RequestSeqNum reqNum);
  144. // Returns a pointer EndpointIdentifier for any RasMessage
  145. // NULL for RasMessage that have no EndpointIdentifier
  146. EndpointIdentifier *GetEndpointID(RasMessage *prasStruct);
  147. // Returns a pointer to a valid H323 protocolIdentifier linked list
  148. // when a valid Rasmessage is passed in and sets the protocol Identifier
  149. // item in RasMessages that have an protocol Identifier
  150. // If in an RasMessage that doesn't have a protocol identifer is passed in,
  151. // NULL is returned.
  152. ProtocolIdentifier SetProtocolIdentifier(RasMessage &rasStruct);
  153. // Returns TRUE if protocols match, FALSE - otherwise
  154. BOOL VerifyProtocolIdentifier(RasMessage &rasStruct);
  155. // finds the requested protocol rasAddress and copies it
  156. DWORD CopyRasAddress(TransportAddress *pDestAddress, RasMessage *prasStruct, unsigned short choice);
  157. DWORD CopyRasAddress(TransportAddress *pDestAddress, PSEQTRANSADDS pSrcSeqRasAddress, unsigned short choice);
  158. // finds the requested protocol callSignalAddress and copies it
  159. DWORD CopyCallSignal(TransportAddress *pCallSignalAddress, RasMessage *prasStruct, unsigned short choice);
  160. DWORD CopyCallSignal(TransportAddress *pDestCallSignalAddress, PSEQTRANSADDS pSrcSeqCSAAddress, unsigned short choice);
  161. };
  162. #endif