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.

138 lines
2.8 KiB

  1. //***************************************************************************
  2. //
  3. // File:
  4. //
  5. // Module: MS SNMP Provider
  6. //
  7. // Purpose:
  8. //
  9. // Copyright (c) 1997-2001 Microsoft Corporation, All Rights Reserved
  10. //
  11. //***************************************************************************
  12. /*--------------------------------------------------
  13. Filename: pdu.hpp
  14. Author: B.Rajeev
  15. Purpose: Provides declarations for the SnmpPdu class
  16. --------------------------------------------------*/
  17. #ifndef __SNMP_PDU__
  18. #define __SNMP_PDU__
  19. // encapsulates an Snmp Pdu. it is represented as an unsigned
  20. // character string (non-null terminated) and its length
  21. class DllImportExport SnmpPdu
  22. {
  23. // a pdu is invalid until the string and its length are specified
  24. // in the constructor or through SetPdu
  25. BOOL is_valid;
  26. UCHAR *ptr;
  27. ULONG length;
  28. RequestId m_RequestId ;
  29. SnmpEncodeDecode :: PduType m_PduType ;
  30. SnmpErrorReport m_ErrorReport ;
  31. SnmpVarBindList *m_SnmpVarBindList ;
  32. SnmpTransportAddress *m_SourceAddress ;
  33. SnmpTransportAddress *m_DestinationAddress ;
  34. SnmpCommunityBasedSecurity *m_SnmpCommunityName ;
  35. void Initialize(IN const UCHAR *frame,
  36. IN const ULONG &frameLength);
  37. void FreeFrame(void);
  38. void FreePdu () ;
  39. public:
  40. SnmpPdu();
  41. SnmpPdu(IN SnmpPdu &snmpPdu);
  42. SnmpPdu(IN const UCHAR *frame, IN const ULONG &frameLength);
  43. virtual ~SnmpPdu(void) ;
  44. ULONG GetFrameLength() const;
  45. UCHAR *GetFrame() const;
  46. void SetPdu(IN const UCHAR *frame, IN const ULONG frameLength);
  47. void SetPdu(IN SnmpPdu &a_SnmpPdu ) ;
  48. virtual BOOL SetVarBindList (
  49. OUT SnmpVarBindList &a_SnmpVarBindList
  50. ) ;
  51. virtual BOOL SetCommunityName (
  52. IN SnmpCommunityBasedSecurity &a_SnmpCommunityBasedSecurity
  53. ) ;
  54. virtual BOOL SetErrorReport (
  55. OUT SnmpErrorReport &a_SnmpErrorReport
  56. ) ;
  57. virtual BOOL SetPduType (
  58. OUT SnmpEncodeDecode :: PduType a_PduType
  59. ) ;
  60. virtual BOOL SetSourceAddress (
  61. IN SnmpTransportAddress &a_TransportAddress
  62. ) ;
  63. virtual BOOL SetDestinationAddress (
  64. IN SnmpTransportAddress &a_TransportAddress
  65. ) ;
  66. virtual BOOL SetRequestId (
  67. IN RequestId request_id
  68. ) ;
  69. virtual SnmpEncodeDecode :: PduType & GetPduType () ;
  70. virtual RequestId & GetRequestId () ;
  71. virtual SnmpErrorReport &GetErrorReport () ;
  72. virtual SnmpCommunityBasedSecurity &GetCommunityName () ;
  73. virtual SnmpVarBindList &GetVarbindList () ;
  74. virtual SnmpTransportAddress &GetSourceAddress () ;
  75. virtual SnmpTransportAddress &GetDestinationAddress () ;
  76. void *operator()(void) const
  77. {
  78. return ( (is_valid)? (void *)this: NULL );
  79. }
  80. operator void *() const
  81. {
  82. return SnmpPdu::operator()();
  83. }
  84. };
  85. #endif // __SNMP_PDU__