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.

82 lines
1.8 KiB

  1. #ifndef _CODER_HPP
  2. #define _CODER_HPP
  3. #define ObjectID_ ASN1objectidentifier_s
  4. typedef struct
  5. {
  6. ASN1encoding_t pEncInfo;
  7. ASN1decoding_t pDecInfo;
  8. }ASN1_CODER_INFO;
  9. typedef struct
  10. {
  11. ULONG length;
  12. PBYTE value;
  13. }ASN1_BUF;
  14. #include "t126.h"
  15. extern "C" {
  16. int T126_InitModule(void);
  17. int T126_TermModule(void);
  18. int T126_InitCoder(ASN1_CODER_INFO *pCoder);
  19. int T126_TermCoder(ASN1_CODER_INFO *pCoder);
  20. int T126_Encode(ASN1_CODER_INFO *pCoder, void *pStruct, int nPDU, ASN1_BUF *pBuf);
  21. int T126_Decode(ASN1_CODER_INFO *pCoder, void **ppStruct, int nPDU, ASN1_BUF *pBuf);
  22. }
  23. // DEBUG OPTIONS
  24. #define CODER_DEBUG 0x00000001
  25. #define CODER_SUPER_DEBUG 0x00000002
  26. // Coder Error Messages
  27. #define CODER_NOERROR 0
  28. #define CODER_ERROR 1
  29. // Protocol version information
  30. #define ITU_T 0
  31. #define RECOMMENDATION 0
  32. #define SERIES 20 // H225.0
  33. #define RECOMM_NUMBER 126
  34. #define VERSION 0
  35. #define ADDITIONAL 1
  36. class Coder{
  37. private:
  38. ASN1_CODER_INFO p_Coder;
  39. CRITICAL_SECTION m_critSec;
  40. public:
  41. struct ObjectID_ m_protocolIdentifier1,m_protocolIdentifier2,m_protocolIdentifier3,
  42. m_protocolIdentifier4,m_protocolIdentifier5,m_protocolIdentifier6;
  43. public:
  44. Coder();
  45. ~Coder();
  46. int InitCoder();
  47. // Creates an OssBuf
  48. int Encode(SIPDU *pInputData, ASN1_BUF *pOutputOssBuf);
  49. // Create memory to hold decoded OssBuf
  50. // For H323 this is a rasStruct
  51. int Decode(ASN1_BUF *pInputOssBuf, SIPDU **pOutputData);
  52. // Used to free buffer created by decode
  53. int Free(SIPDU *pData);
  54. // Used to free buffer created by encode
  55. void Free(ASN1_BUF Asn1Buf);
  56. // Returns TRUE if protocols match, FALSE - otherwise
  57. __inline int freePDU(ASN1_CODER_INFO *pCoder, int nPDU, void *pDecoded,
  58. ASN1module_t pModule)
  59. {
  60. ASN1_FreeDecoded(pCoder->pDecInfo, pDecoded, nPDU);
  61. return ASN1_SUCCESS;
  62. }
  63. };
  64. #endif