diff options
Diffstat (limited to 'ASNMP/asnmp/pdu.h')
-rw-r--r-- | ASNMP/asnmp/pdu.h | 154 |
1 files changed, 74 insertions, 80 deletions
diff --git a/ASNMP/asnmp/pdu.h b/ASNMP/asnmp/pdu.h index a2d84388da0..cf2f3ee8aaf 100644 --- a/ASNMP/asnmp/pdu.h +++ b/ASNMP/asnmp/pdu.h @@ -1,21 +1,23 @@ /* -*-C++-*- */ +// $Id$ #ifndef PDU_CLS_ #define PDU_CLS_ -//============================================================================= -/** - * @file pdu.h - * - * $Id$ - * - * Pdu class definition. Encapsulation of an SMI Protocol - * Data Unit (PDU) aka Packet in C++. - * - * - * @author Peter E Mellquist original code Michael MacFaden mrm@cisco.com ACE port - * @author add iterator class for pdus - */ -//============================================================================= - +// ============================================================================ +// +// = LIBRARY +// asnmp +// +// = FILENAME +// pdu.h +// +// = DESCRIPTION +// Pdu class definition. Encapsulation of an SMI Protocol +// Data Unit (PDU) aka Packet in C++. +// +// = AUTHOR +// Peter E Mellquist original code +// Michael MacFaden mrm@cisco.com ACE port, add iterator class for pdus +// ============================================================================ /*=================================================================== Copyright (c) 1996 Hewlett-Packard Company @@ -38,181 +40,173 @@ #define MAX_VBS 25 #include "asnmp/vb.h" // include Vb class definition -/** - * @class Pdu - * - * @brief Protocol Data Unit (PDU) concrete class. An abstraction of the - * data packet used to by two SNMP sessions to communicate. - */ class ASNMP_Export Pdu + // = TITLE + // Protocol Data Unit (PDU) concrete class. An abstraction of the + // data packet used to by two SNMP sessions to communicate. { public: - /// constructor no args Pdu( void); + // constructor no args - /// constructor with vbs and count Pdu( Vb* pvbs, const int pvb_count); + // constructor with vbs and count - /// constructor with another Pdu instance Pdu( const Pdu &pdu); + // constructor with another Pdu instance - /// destructor ~Pdu(); + // destructor - /// assignment to another Pdu object overloaded Pdu& operator=( const Pdu &pdu); + // assignment to another Pdu object overloaded - /// append a vb to the pdu Pdu& operator+=( Vb &vb); + // append a vb to the pdu // TODO: add Pdu& operator-=(const Vb &vb); - /// extract all Vbs from Pdu int get_vblist( Vb* pvbs, const int pvb_count); + // extract all Vbs from Pdu - /// deposit all Vbs to Pdu int set_vblist( Vb* pvbs, const int pvb_count); + // deposit all Vbs to Pdu - /// get a particular vb - /// where 0 is the first vb int get_vb( Vb &vb, const int index = 0) const; + // get a particular vb + // where 0 is the first vb - /// set a particular vb - /// where 0 is the first vb int set_vb( Vb &vb, const int index); + // set a particular vb + // where 0 is the first vb - /// return number of vbs int get_vb_count() const; + // return number of vbs - /// return the error status int get_error_status() const; + // return the error status - /// return the complete error info from this pdu const char *agent_error_reason(); + // return the complete error info from this pdu - /// set the error status friend ASNMP_Export void set_error_status( Pdu *pdu, const int status); + // set the error status - /// return the error index int get_error_index() const; + // return the error index - /// set the error index friend ASNMP_Export void set_error_index( Pdu *pdu, const int index); + // set the error index - /// clear error status friend ASNMP_Export void clear_error_status( Pdu *pdu); + // clear error status - /// clear error index friend ASNMP_Export void clear_error_index( Pdu *pdu); + // clear error index - /// return the request id unsigned long get_request_id() const; + // return the request id - /// set the request id friend void set_request_id( Pdu *pdu, const unsigned long rid); + // set the request id - /// get the pdu type unsigned short get_type() const; + // get the pdu type - /// set the pdu type void set_type( unsigned short type); + // set the pdu type - /// returns validity of Pdu instance int valid() const; + // returns validity of Pdu instance - /// trim off count vbs from the end of the vb list int trim(const int count=1); + // trim off count vbs from the end of the vb list - /// delete a Vb anywhere within the Pdu int delete_vb( const int position); + // delete a Vb anywhere within the Pdu - /// delete_all vbs in pdu void delete_all_vbs(); + // delete_all vbs in pdu - /// set notify timestamp void set_notify_timestamp( const TimeTicks & timestamp); + // set notify timestamp - /// get notify timestamp void get_notify_timestamp( TimeTicks & timestamp) const; + // get notify timestamp - /// set the notify id void set_notify_id( const Oid id); + // set the notify id - /// get the notify id void get_notify_id( Oid &id) const; + // get the notify id - /// set the notify enterprise void set_notify_enterprise( const Oid &enterprise); + // set the notify enterprise - /// get the notify enterprise void get_notify_enterprise( Oid & enterprise) const; + // get the notify enterprise - /// return fomatted version of this object const char *to_string(); + // return fomatted version of this object protected: - /// pointer to array of Vbs Vb *vbs_[MAX_VBS]; + // pointer to array of Vbs - /// count of Vbs int vb_count_; + // count of Vbs - /// SMI error status int error_status_; + // SMI error status - /// SMI error index int error_index_; + // SMI error index - /// valid boolean status of object construction - /// SMI request id int validity_; + // valid boolean status of object construction unsigned long request_id_; + // SMI request id - /// derived at run time based on request type unsigned short pdu_type_; + // derived at run time based on request type - /** - * a timestamp associated with an infor - * for notify Pdu objects only - * traps & notifies - */ TimeTicks notify_timestamp_; + // a timestamp associated with an infor + // for notify Pdu objects only + // traps & notifies - /// an id Oid notify_id_; + // an id Oid notify_enterprise_; private: - /// buffer for to_string() char *output_; + // buffer for to_string() }; -/** - * @class VbIter - * - * @brief Utility class to iterate once through a PDU varbind list - */ class ASNMP_Export VbIter + // = TITLE + // Utility class to iterate once through a PDU varbind list { public: - /// default constructor VbIter(Pdu& pdu); + // default constructor - /// returns 1 if ok, else 0 if none left int next(Vb& vb); + // returns 1 if ok, else 0 if none left private: - /// disallow copy constructor use VbIter(const VbIter&); + // disallow copy constructor use - /// current object in list int idx_; + // current object in list - /// ptr to pdu being interated over Pdu *pdu_; + // ptr to pdu being interated over }; #endif //PDU_CLS_ |