diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2006-03-08 10:45:52 +0000 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2006-03-08 10:45:52 +0000 |
commit | 29375ef2aa9c8abdccd945693d9ef983f1c56f0d (patch) | |
tree | 5958aafc64777367b15fa9d9fff3c706349b49e4 /ASNMP | |
parent | 2d52a736db95d62230c75d618ef18eb9b87f5242 (diff) | |
download | ATCD-29375ef2aa9c8abdccd945693d9ef983f1c56f0d.tar.gz |
ChangeLogTag: Wed Mar 8 10:17:12 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl>
Diffstat (limited to 'ASNMP')
-rw-r--r-- | ASNMP/asnmp/address.h | 515 | ||||
-rw-r--r-- | ASNMP/asnmp/asn1.h | 53 | ||||
-rw-r--r-- | ASNMP/asnmp/counter.h | 58 | ||||
-rw-r--r-- | ASNMP/asnmp/ctr64.h | 76 | ||||
-rw-r--r-- | ASNMP/asnmp/enttraps.h | 103 | ||||
-rw-r--r-- | ASNMP/asnmp/gauge.h | 60 | ||||
-rw-r--r-- | ASNMP/asnmp/integer.h | 94 | ||||
-rw-r--r-- | ASNMP/asnmp/octet.h | 114 | ||||
-rw-r--r-- | ASNMP/asnmp/oid.h | 135 | ||||
-rw-r--r-- | ASNMP/asnmp/oid_def.h | 29 | ||||
-rw-r--r-- | ASNMP/asnmp/pdu.h | 154 | ||||
-rw-r--r-- | ASNMP/asnmp/sagent.h | 55 | ||||
-rw-r--r-- | ASNMP/asnmp/smi.h | 28 | ||||
-rw-r--r-- | ASNMP/asnmp/smival.h | 32 | ||||
-rw-r--r-- | ASNMP/asnmp/snmp.h | 84 | ||||
-rw-r--r-- | ASNMP/asnmp/snmperrs.h | 28 | ||||
-rw-r--r-- | ASNMP/asnmp/target.h | 150 | ||||
-rw-r--r-- | ASNMP/asnmp/timetick.h | 58 | ||||
-rw-r--r-- | ASNMP/asnmp/transaction.h | 60 | ||||
-rw-r--r-- | ASNMP/asnmp/transaction_result.h | 29 | ||||
-rw-r--r-- | ASNMP/asnmp/vb.h | 136 | ||||
-rw-r--r-- | ASNMP/asnmp/wpdu.h | 59 |
22 files changed, 1081 insertions, 1029 deletions
diff --git a/ASNMP/asnmp/address.h b/ASNMP/asnmp/address.h index 7061b353982..f8131c19485 100644 --- a/ASNMP/asnmp/address.h +++ b/ASNMP/asnmp/address.h @@ -1,25 +1,21 @@ -// -*-C++-*- -// $Id$ #ifndef ADDRESS_ #define ADDRESS_ -// ============================================================================ -// -// = LIBRARY -// asnmp -// -// = FILENAME -// address.h -// -// = DESCRIPTION -// Address class definition. Encapsulates various network -// addresses into easy to use, safe and portable classes. -// -// = AUTHOR -// Peter E Mellquist -// -// ============================================================================ +//============================================================================= +/** + * @file address.h + * + * $Id$ + * + * Address class definition. Encapsulates various network + * addresses into easy to use, safe and portable classes. + * + * + * @author Peter E Mellquist + */ +//============================================================================= + /*=================================================================== Copyright (c) 1996 @@ -102,201 +98,207 @@ class SIPAddress; // aka ipv6 //-------------------------------------------------------------------- //----[ Address class ]----------------------------------------------- //-------------------------------------------------------------------- +/** + * @class + * + * @brief Defines the member functions for the abstract base class + * Address. An Address is a unique network endpoint. + */ class ASNMP_Export Address: public SnmpSyntax - // = TITLE - // Defines the member functions for the abstract base class - // Address. An Address is a unique network endpoint. { public: + /// allow destruction of derived classes virtual ~Address(); - // allow destruction of derived classes + /// overloaded equivlence operator, are two addresses equal? friend ASNMP_Export bool operator==( const Address &lhs,const Address &rhs); - // overloaded equivlence operator, are two addresses equal? + /// overloaded not equivlence operator, are two addresses not equal? friend ASNMP_Export bool operator!=( const Address &lhs,const Address &rhs); - // overloaded not equivlence operator, are two addresses not equal? + /// overloaded > operator, is a1 > a2 friend ASNMP_Export bool operator>( const Address &lhs,const Address &rhs); - // overloaded > operator, is a1 > a2 + /// overloaded >= operator, is a1 >= a2 friend ASNMP_Export bool operator>=( const Address &lhs,const Address &rhs); - // overloaded >= operator, is a1 >= a2 + /// overloaded < operator, is a1 < a2 friend ASNMP_Export bool operator<( const Address &lhs,const Address &rhs); - // overloaded < operator, is a1 < a2 + /// overloaded <= operator, is a1 <= a2 friend ASNMP_Export bool operator<=( const Address &lhs,const Address &rhs); - // overloaded <= operator, is a1 <= a2 + /// equivlence operator overloaded, are an address and a string equal? friend ASNMP_Export bool operator==( const Address &lhs,const char *rhs); - // equivlence operator overloaded, are an address and a string equal? + /// overloaded not equivlence operator, are an address and string not equal? friend ASNMP_Export bool operator!=( const Address &lhs,const char *rhs); - // overloaded not equivlence operator, are an address and string not equal? + /// overloaded < , is an address greater than a string? friend ASNMP_Export bool operator>( const Address &lhs,const char *rhs); - // overloaded < , is an address greater than a string? + /// overloaded >=, is an address greater than or equal to a string? friend ASNMP_Export bool operator>=( const Address &lhs,const char *rhs); - // overloaded >=, is an address greater than or equal to a string? + /// overloaded < , is an address less than a string? friend ASNMP_Export bool operator<( const Address &lhs,const char *rhs); - // overloaded < , is an address less than a string? + /// overloaded <=, is an address less than or equal to a string? friend ASNMP_Export bool operator<=( const Address &lhs,const char *rhs); - // overloaded <=, is an address less than or equal to a string? + /// overloaded const char * cast virtual operator const char *() const = 0; - // overloaded const char * cast + /// verify the is the address object constructed ok virtual int valid() const; - // verify the is the address object constructed ok + /// return a suitable buffer to contain the address virtual void to_octet(OctetStr& octet) const = 0; - // return a suitable buffer to contain the address + /// (pure virtual) syntax type virtual SmiUINT32 get_syntax() = 0; - // (pure virtual) syntax type + /// for non const [], allows reading and writing unsigned char& operator[]( const int position); - // for non const [], allows reading and writing + /// get a printable ASCII value virtual const char *to_string() = 0; - // get a printable ASCII value + /// create a new instance of this Value virtual SnmpSyntax *clone() const = 0; - // create a new instance of this Value + /// return the type of address virtual addr_type get_type() const = 0; - // return the type of address + /// overloaded assignment operator virtual SnmpSyntax& operator=( SnmpSyntax &val) = 0; - // overloaded assignment operator + /// return a hash key virtual unsigned int hashFunction() const { return 0;}; - // return a hash key protected: + /// state of constructed object (1/0) + /// addr internal representation int valid_flag; - // state of constructed object (1/0) unsigned char address_buffer[MAX_ADDR_SZ]; - // addr internal representation + /// parse the address string + /// redefined for each specific address subclass virtual int parse_address( const char * inaddr) =0; - // parse the address string - // redefined for each specific address subclass + /// format the output + /// redefined for each specific address subclass virtual void format_output() =0; - // format the output - // redefined for each specific address subclass + /// a reused trimm white space method void trim_white_space( char * ptr); - // a reused trimm white space method }; //----------------------------------------------------------------------- //---------[ IPv4 Address Class ]---------------------------------------- //----------------------------------------------------------------------- +/** + * @class IpAddress + * + * @brief Defines the member functions for the concrete class IpAddress + * An IP Version 4 Address is 4 bytes long and consists of a + * Network, Sub Network, and host component. + */ class ASNMP_Export IpAddress : public Address - // = TITLE - // Defines the member functions for the concrete class IpAddress - // An IP Version 4 Address is 4 bytes long and consists of a - // Network, Sub Network, and host component. { public: + /// default construct an IP address with a string IpAddress( const char *inaddr = ""); - // default construct an IP address with a string + /// construct an IP address with another IP address IpAddress( const IpAddress &ipaddr); - // construct an IP address with another IP address + /// construct an IP address with a GenAddress IpAddress( const GenAddress &genaddr); - // construct an IP address with a GenAddress + /// destructor (ensure that SnmpSyntax::~SnmpSyntax() is overridden) ~IpAddress(); - // destructor (ensure that SnmpSyntax::~SnmpSyntax() is overridden) + /// copy an instance of this Value SnmpSyntax& operator=( SnmpSyntax &val); - // copy an instance of this Value + /// assignment to another IpAddress object overloaded IpAddress& operator=( const IpAddress &ipaddress); - // assignment to another IpAddress object overloaded // TODO: add ability to set addr given long + /// create a new instance of this Value SnmpSyntax *clone() const; - // create a new instance of this Value + /// return the DNS Fully Qualified Domain Name (host.domain) + /// on failure returns dotted_quad string const char *resolve_hostname(int& was_found); - // return the DNS Fully Qualified Domain Name (host.domain) - // on failure returns dotted_quad string + /// return string representation of object (dotted quad returned) virtual const char *to_string() ; - // return string representation of object (dotted quad returned) + /// const char * operator overloaded for streaming output virtual operator const char *() const; - // const char * operator overloaded for streaming output + /// logically AND two IPaddresses and + /// return the new one void mask( const IpAddress& ipaddr); - // logically AND two IPaddresses and - // return the new one + /// return the type virtual addr_type get_type() const; - // return the type + /// syntax type virtual SmiUINT32 get_syntax(); - // syntax type + /// is this the loopback address? 127.0.0.1/loopback/1.0.0.127.in-addr.arpa int is_loopback() const; - // is this the loopback address? 127.0.0.1/loopback/1.0.0.127.in-addr.arpa + /// determine if this is a multicast address int is_multicast() const; - // determine if this is a multicast address + /// determine if this a broadcast address int is_broadcast() const; - // determine if this a broadcast address + /// per RFC 1597, private addresses are:: 10, 172.16, and 192.168.0 int is_private() const; - // per RFC 1597, private addresses are:: 10, 172.16, and 192.168.0 + /// convert address into octet string format in network byte order virtual void to_octet(OctetStr& octet) const; - // convert address into octet string format in network byte order protected: char output_buffer[MAX_DISPLAY_SZ]; // output buffer + /// friendly name storage char iv_friendly_name_[MAX_DISPLAY_SZ]; - // friendly name storage + /// did resolver call work? some addrs won't resolve int iv_friendly_name_status_; - // did resolver call work? some addrs won't resolve + /// redefined parse address + /// specific to IP addresses virtual int parse_address( const char *inaddr); - // redefined parse address - // specific to IP addresses + /// redefined format output + /// specific to IP addresses virtual void format_output(); - // redefined format output - // specific to IP addresses + /// parse a dotted string int parse_dotted_ipstring( const char *inaddr); - // parse a dotted string + /// using the currently defined address, do a gethostbyname() + /// and try to fill up the name int addr_to_friendly(); - // using the currently defined address, do a gethostbyname() - // and try to fill up the name + /// thread safe routine to lookup ip address given hostname + /// return <> 0 on error static int resolve_to_address(const char *hostname, in_addr& quad_addr); - // thread safe routine to lookup ip address given hostname - // return <> 0 on error + /// thread safe routine to lookup name given ip address + /// return <> 0 on error static int resolve_to_hostname(const in_addr& quad_addr, char *hostname); - // thread safe routine to lookup name given ip address - // return <> 0 on error }; @@ -304,22 +306,25 @@ protected: //--------------[ DNS Iterator Class ]------------------------------------ //------------------------------------------------------------------------ +/** + * @class Address_Iter + * + * @brief Defines routines to obtain information on a hostname/FQDN + * such as multiple addresses + */ class ASNMP_Export Address_Iter - // = TITLE - // Defines routines to obtain information on a hostname/FQDN - // such as multiple addresses { public: Address_Iter(const char *hostname); // fully qualified domain name, hostname + /// did hostname resolve via DNS? int valid() const; - // did hostname resolve via DNS? + /// how many addresses associated with this hostname int how_many_addresses(); - // how many addresses associated with this hostname + /// return next address int next(IpAddress& addr); - // return next address private: Address_Iter(const Address_Iter&); @@ -334,152 +339,161 @@ private: //------------------------------------------------------------------------ //---------[ UDP/IPv4 Address Class ]------------------------------------- //------------------------------------------------------------------------ +/** + * @class + * + * @brief Defines the member functions for the concrete class UdpAddress + * A Udp Address consists of an IP Version 4 Address (IpAddress) + * and a 2 byte unsigned port number. (see /etc/services file) + * User Datagram Protocol (UDP) is a best effort transport + */ class ASNMP_Export UdpAddress : public IpAddress - // = TITLE - // Defines the member functions for the concrete class UdpAddress - // A Udp Address consists of an IP Version 4 Address (IpAddress) - // and a 2 byte unsigned port number. (see /etc/services file) - // User Datagram Protocol (UDP) is a best effort transport { public: + /// default constructor with a dotted string in the form of addr:port UdpAddress( const char *inaddr = ""); - // default constructor with a dotted string in the form of addr:port + /// construct an Udp address with another Udp address UdpAddress( const UdpAddress &udpaddr); - // construct an Udp address with another Udp address + /// construct a Udp address with a GenAddress UdpAddress( const GenAddress &genaddr); - // construct a Udp address with a GenAddress + /// construct a Udp address with an IpAddress + /// default port # to zero UdpAddress( const IpAddress &ipaddr); - // construct a Udp address with an IpAddress - // default port # to zero + /// destructor ~UdpAddress(); - // destructor + /// syntax type SmiUINT32 get_syntax(); - // syntax type + /// copy an instance of this Value SnmpSyntax& operator=( SnmpSyntax &val); - // copy an instance of this Value + /// assignment to another IpAddress object overloaded UdpAddress& operator=( const UdpAddress &udpaddr); - // assignment to another IpAddress object overloaded + /// create a new instance of this Value SnmpSyntax *clone() const; - // create a new instance of this Value + /// output in the form of address:port virtual const char *to_string() ; - // output in the form of address:port + /// const char * operator overloaded for streaming output virtual operator const char *() const; - // const char * operator overloaded for streaming output + /// set the port number void set_port( const unsigned short p); - // set the port number + /// get the port number unsigned short get_port() const; - // get the port number + /// return the type virtual addr_type get_type() const; - // return the type protected: + /// output buffer char output_buffer[MAX_DISPLAY_SZ]; - // output buffer + /// redefined parse address + /// specific to IP addresses virtual int parse_address( const char *inaddr); - // redefined parse address - // specific to IP addresses + /// redefined format output + /// specific to IP addresses virtual void format_output(); - // redefined format output - // specific to IP addresses }; //------------------------------------------------------------------------- //---------[ 802.3 MAC Address Class ]------------------------------------- //------------------------------------------------------------------------- +/** + * @class + * + * @brief Defines the member functions for the concrete class MacAddress. + * A Media Access Control Address consists of 48 bits as defined + * in IEEE 802.3 specifications. + */ class ASNMP_Export MacAddress : public Address - // = TITLE - // Defines the member functions for the concrete class MacAddress. - // A Media Access Control Address consists of 48 bits as defined - // in IEEE 802.3 specifications. { public: + /// constructor with a string argument MacAddress( const char *inaddr = ""); - // constructor with a string argument + /// constructor with another MAC object MacAddress( const MacAddress &macaddr); - // constructor with another MAC object + /// construct a MacAddress with a GenAddress MacAddress( const GenAddress &genaddr); - // construct a MacAddress with a GenAddress + /// destructor ~MacAddress(); - // destructor + /// syntax type SmiUINT32 get_syntax(); - // syntax type + /// copy an instance of this Value SnmpSyntax& operator=( SnmpSyntax &val); - // copy an instance of this Value + /// assignment to another IpAddress object overloaded MacAddress& operator=( const MacAddress &macaddress); - // assignment to another IpAddress object overloaded + /// create a new instance of this Value SnmpSyntax *clone() const; - // create a new instance of this Value + /// create a string to internal class storage representing object virtual const char *to_string(); - // create a string to internal class storage representing object + /// const char * operator overloaded for streaming output virtual operator const char *() const; - // const char * operator overloaded for streaming output + /// return the type virtual addr_type get_type() const; - // return the type + /// return a hash key unsigned int hashFunction() const; - // return a hash key + /// return byte array of the mac address virtual void to_octet(OctetStr& octet) const; - // return byte array of the mac address protected: + /// output buffer containing string representation of object char output_buffer[MAX_DISPLAY_SZ]; - // output buffer containing string representation of object + /// redefined parse address for macs virtual int parse_address( const char *inaddr); - // redefined parse address for macs + /// redefined format output for MACs virtual void format_output(); - // redefined format output for MACs }; //------------------------------------------------------------------------ //---------[ Netbios Address Class ]-------------------------------------- //------------------------------------------------------------------------ +/** + * @class + * + * @brief Defines the member functions for the concrete class NetbiosAddress. + * The IBM/Microsoft address for NETBIOS, NETBEUI protocol transport. + */ class ASNMP_Export NetbiosAddress : public Address - // = TITLE - // Defines the member functions for the concrete class NetbiosAddress. - // The IBM/Microsoft address for NETBIOS, NETBEUI protocol transport. { public: + /// default constructor with string arg NetbiosAddress( const char *inaddr = ""); - // default constructor with string arg + /// set name and service type NetbiosAddress( const char *inaddr, nb_service svc); - // set name and service type + /// copy constructor NetbiosAddress( const NetbiosAddress& nbaddr); - // copy constructor + /// construct with a GenAddress NetbiosAddress( const GenAddress& genaddr); - // construct with a GenAddress ~NetbiosAddress(); @@ -487,33 +501,33 @@ public: NetbiosAddress& operator=( const NetbiosAddress &nbaddr); + /// retrieve the network service type nb_service get_service_type() const; - // retrieve the network service type + /// set the service type (workstation, server, etc) void set_service_type(nb_service nbservice); - // set the service type (workstation, server, etc) + /// const char * operator overloaded for streaming output virtual operator const char *() const; - // const char * operator overloaded for streaming output + /// syntax type virtual SmiUINT32 get_syntax(); - // syntax type + /// copy an instance of this Value SnmpSyntax& operator=( SnmpSyntax &val); - // copy an instance of this Value + /// create a new instance of this Value SnmpSyntax *clone() const; - // create a new instance of this Value + /// output byte buffer containing netbios name virtual void to_octet(OctetStr& octet) const; - // output byte buffer containing netbios name protected: void InitNBAddr(const char *inaddr); char output_buffer[MAX_DISPLAY_SZ]; + /// output buffer to hold string representation virtual void format_output(); - // output buffer to hold string representation virtual int parse_address( const char *inaddr); virtual addr_type get_type() const; }; @@ -521,20 +535,23 @@ protected: //------------------------------------------------------------------------ //---------[ DecNet Address Class ]--------------------------------------- //------------------------------------------------------------------------ +/** + * @class + * + * @brief Defines the member functions for the concrete class DecNetAddress. + * DecNet Phase ? address consists of two octets (CISCO-TC.my) + */ class ASNMP_Export DecNetAddress : public Address - // = TITLE - // Defines the member functions for the concrete class DecNetAddress. - // DecNet Phase ? address consists of two octets (CISCO-TC.my) { public: + /// default constructor with string arg DecNetAddress( const char *inaddr = ""); - // default constructor with string arg + /// copy constructor DecNetAddress( const DecNetAddress& decaddr); - // copy constructor + /// construct with a GenAddress DecNetAddress( const GenAddress& genaddr); - // construct with a GenAddress ~DecNetAddress(); @@ -542,20 +559,20 @@ class ASNMP_Export DecNetAddress : public Address DecNetAddress& operator=( const DecNetAddress &decaddr); + /// convert address into octet string format 2 bytes of decnet address virtual void to_octet(OctetStr& octet) const; - // convert address into octet string format 2 bytes of decnet address + /// const char * operator overloaded for streaming output virtual operator const char *() const; - // const char * operator overloaded for streaming output + /// syntax type virtual SmiUINT32 get_syntax(); - // syntax type + /// copy an instance of this Value SnmpSyntax& operator=( SnmpSyntax &val); - // copy an instance of this Value + /// create a new instance of this Value SnmpSyntax *clone() const; - // create a new instance of this Value protected: virtual int parse_address( const char *inaddr); @@ -567,20 +584,23 @@ class ASNMP_Export DecNetAddress : public Address //------------------------------------------------------------------------ //---------[ AppleTalk Address Class ]------------------------------------ //------------------------------------------------------------------------ +/** + * @class + * + * @brief Defines the member functions for the concrete class DecNetAddress. + * DecNet Phase ? address consists of two octets (CISCO-TC.my) + */ class ASNMP_Export AppleTalkAddress : public Address - // = TITLE - // Defines the member functions for the concrete class DecNetAddress. - // DecNet Phase ? address consists of two octets (CISCO-TC.my) { public: + /// default constructor with string arg AppleTalkAddress( const char *inaddr = ""); - // default constructor with string arg + /// copy constructor AppleTalkAddress( const AppleTalkAddress& atkaddr); - // copy constructor + /// construct with a GenAddress AppleTalkAddress( const GenAddress& genaddr); - // construct with a GenAddress ~AppleTalkAddress(); @@ -588,32 +608,32 @@ class ASNMP_Export AppleTalkAddress : public Address AppleTalkAddress& operator=( const AppleTalkAddress &atkaddr); + /// convert address into octet string format 3 bytes of atk address virtual void to_octet(OctetStr& octet) const; - // convert address into octet string format 3 bytes of atk address + /// get the host part of the address char get_host_address() const; - // get the host part of the address + /// set the host part of the address void set_host_address(const char); - // set the host part of the address + /// get the 2 byte atk network address short get_net_address() const; - // get the 2 byte atk network address + /// set the host 2 byte atk network address void set_net_address(const short atknet); - // set the host 2 byte atk network address + /// const char * operator overloaded for streaming output virtual operator const char *() const; - // const char * operator overloaded for streaming output + /// syntax type virtual SmiUINT32 get_syntax(); - // syntax type + /// copy an instance of this Value SnmpSyntax& operator=( SnmpSyntax &val); - // copy an instance of this Value + /// create a new instance of this Value SnmpSyntax *clone() const; - // create a new instance of this Value private: virtual int parse_address( const char *inaddr); @@ -625,64 +645,67 @@ class ASNMP_Export AppleTalkAddress : public Address //------------------------------------------------------------------------ //---------[ IPX Address Class ]------------------------------------------ //------------------------------------------------------------------------ +/** + * @class IpxAddress + * + * @brief Defines the member functions for the concrete class IpxAddress. + * Novell's IPX (version ?) network protocol endpoint + */ class ASNMP_Export IpxAddress : public Address - // = TITLE - // Defines the member functions for the concrete class IpxAddress. - // Novell's IPX (version ?) network protocol endpoint { public: + /// default constructor with a string arg IpxAddress( const char *inaddr = ""); - // default constructor with a string arg + /// constructor with another ipx object IpxAddress( const IpxAddress &ipxaddr); - // constructor with another ipx object + /// construct with a GenAddress IpxAddress( const GenAddress &genaddr); - // construct with a GenAddress + /// destructor ~IpxAddress(); - // destructor + /// syntax type virtual SmiUINT32 get_syntax(); - // syntax type + /// copy an instance of this Value SnmpSyntax& operator=( SnmpSyntax &val); - // copy an instance of this Value + /// assignment to another IpxAddress object overloaded IpxAddress& operator=( const IpxAddress &ipxaddress); - // assignment to another IpxAddress object overloaded + /// get the host id portion of an ipx address int get_hostid( MacAddress& mac); - // get the host id portion of an ipx address + /// create a new instance of this Value SnmpSyntax *clone() const; - // create a new instance of this Value + /// create string represtation of object value virtual const char *to_string(); - // create string represtation of object value + /// const char * operator overloaded for streaming output virtual operator const char *() const; - // const char * operator overloaded for streaming output + /// return the type virtual addr_type get_type() const; - // return the type + /// return byte sequence containing ipx address virtual void to_octet(OctetStr& octet) const; - // return byte sequence containing ipx address protected: + /// ipx format separator {:,/} char separator; - // ipx format separator {:,/} + /// output buffer to hold string representation char output_buffer[MAX_DISPLAY_SZ]; - // output buffer to hold string representation + /// redefined parse address for ipx strings virtual int parse_address( const char *inaddr); - // redefined parse address for ipx strings + /// redefined format output for ipx strings + /// uses same separator as when constructed virtual void format_output(); - // redefined format output for ipx strings - // uses same separator as when constructed }; @@ -690,127 +713,133 @@ protected: //------------------------------------------------------------------------ //---------[ IpxSock Address Class ]-------------------------------------- //------------------------------------------------------------------------ +/** + * @class IpxSockAddress + * + * @brief Defines the member functions for the concrete class IpxAddress. + * Novell's IPX (version ?) network protocol endpoint + */ class ASNMP_Export IpxSockAddress : public IpxAddress - // = TITLE - // Defines the member functions for the concrete class IpxAddress. - // Novell's IPX (version ?) network protocol endpoint { public: + /// constructor with a dotted string IpxSockAddress( const char *inaddr = ""); - // constructor with a dotted string + /// construct an Udp address with another Udp address IpxSockAddress( const IpxSockAddress &ipxaddr); - // construct an Udp address with another Udp address + ///constructor with a GenAddress IpxSockAddress( const GenAddress &genaddr); - //constructor with a GenAddress + ///constructor with a IpxAddress + /// default socket # is 0 IpxSockAddress( const IpxAddress &ipxaddr); - //constructor with a IpxAddress - // default socket # is 0 + /// destructor ~IpxSockAddress(); - // destructor + /// syntax type virtual SmiUINT32 get_syntax(); - // syntax type + /// copy an instance of this Value SnmpSyntax& operator=( SnmpSyntax &val); - // copy an instance of this Value + /// assignment to another IpxAddress object overloaded IpxSockAddress& operator=( const IpxSockAddress &ipxaddr); - // assignment to another IpxAddress object overloaded + /// create a new instance of this Value SnmpSyntax *clone() const; - // create a new instance of this Value + /// set the socket number void set_socket( const unsigned short s); - // set the socket number + /// get the socket number unsigned short get_socket() const; - // get the socket number + /// create string representation of object value virtual const char *to_string(); - // create string representation of object value + /// const char * operator overloaded for streaming output virtual operator const char *() const; - // const char * operator overloaded for streaming output + /// return the type virtual addr_type get_type() const; - // return the type protected: + /// output buffer to hold string representation of object char output_buffer[MAX_DISPLAY_SZ]; - // output buffer to hold string representation of object + /// redefined parse address for ipx strings virtual int parse_address( const char *inaddr); - // redefined parse address for ipx strings + /// redefined format output + /// specific to IP addresses virtual void format_output(); - // redefined format output - // specific to IP addresses }; //------------------------------------------------------------------------- //--------[ Generic Address ]---------------------------------------------- //------------------------------------------------------------------------- +/** + * @class GenAddress + * + * @brief Defines the member functions for the concrete class GenAddress. + * This class attempts to determine an address type given a char string. + */ class ASNMP_Export GenAddress : public Address - // = TITLE - // Defines the member functions for the concrete class GenAddress. - // This class attempts to determine an address type given a char string. { public: + /// constructor with a string argument GenAddress( const char *addr = ""); - // constructor with a string argument + /// constructor with an Address GenAddress( const Address &addr); - // constructor with an Address + /// constructor with another GenAddress GenAddress( const GenAddress &addr); - // constructor with another GenAddress + /// destructor ~GenAddress(); - // destructor + /// get the snmp syntax of the contained address SmiUINT32 get_syntax(); - // get the snmp syntax of the contained address + /// create a new instance of this Value SnmpSyntax *clone() const; - // create a new instance of this Value + /// assignment of a GenAddress GenAddress& operator=( const GenAddress &addr); - // assignment of a GenAddress + /// copy an instance of this Value SnmpSyntax& operator=( SnmpSyntax &val); - // copy an instance of this Value + /// string representation of object value virtual const char *to_string(); - // string representation of object value + /// const char * operator overloaded for streaming output virtual operator const char *() const; - // const char * operator overloaded for streaming output + /// return the type virtual addr_type get_type() const; - // return the type + /// return the address as a octet sequence virtual void to_octet(OctetStr& octet) const; - // return the address as a octet sequence protected: + /// pointer to a a concrete address Address *address; - // pointer to a a concrete address + /// output buffer of objects value char output_buffer[MAX_DISPLAY_SZ]; - // output buffer of objects value + /// redefined parse address for macs virtual int parse_address( const char *addr); - // redefined parse address for macs + /// format output for a generic address virtual void format_output(); - // format output for a generic address + /// initialize smi data structure void init_smi(); - // initialize smi data structure }; #endif //_ADDRESS diff --git a/ASNMP/asnmp/asn1.h b/ASNMP/asnmp/asn1.h index 0c141c188d2..3be7e3925ef 100644 --- a/ASNMP/asnmp/asn1.h +++ b/ASNMP/asnmp/asn1.h @@ -1,25 +1,22 @@ /* -*-C++-*- */ -// $Id$ #ifndef ASN1 #define ASN1 -// ============================================================================ -// -// = LIBRARY -// asnmp -// -// = FILENAME -// asn1.h -// -// = DESCRIPTION -// Abstract Syntax Notation One, ASN.1 -// As defined in ISO/IS 8824 and ISO/IS 8825 -// This implements a subset of the above International Standards that -// is sufficient to implement SNMP. -// -// = AUTHOR -// Steve Waldbusser/CMU ? -// -// ============================================================================ +//============================================================================= +/** + * @file asn1.h + * + * $Id$ + * + * Abstract Syntax Notation One, ASN.1 + * As defined in ISO/IS 8824 and ISO/IS 8825 + * This implements a subset of the above International Standards that + * is sufficient to implement SNMP. + * + * + * @author Steve Waldbusser/CMU ? + */ +//============================================================================= + /********************************************************************** Copyright 1988, 1989, 1991, 1992 by Carnegie Mellon University @@ -161,10 +158,13 @@ struct counter64 { }; // CMU Interface class for ASN.1 routines +/** + * @class asn1 + * + * @brief Defines the member functions for the asn1 concrete interface class + * CMU routines for performing ASN.1 data marshalling / representation + */ class ASNMP_Export asn1 - // = TITLE - // Defines the member functions for the asn1 concrete interface class - // CMU routines for performing ASN.1 data marshalling / representation { public: @@ -271,10 +271,13 @@ static unsigned char * build_unsigned_int64( unsigned char *data, // CMU Interface class for SNMPv1, SNMPv2c routines +/** + * @class cmu_snmp + * + * @brief Defines the static functions for the cmu_snmp concrete class. + * These routine create cmu pdu's that can be sent/received on/from agents + */ class ASNMP_Export cmu_snmp - // = TITLE - // Defines the static functions for the cmu_snmp concrete class. - // These routine create cmu pdu's that can be sent/received on/from agents { public: static struct snmp_pdu *pdu_create( int command); diff --git a/ASNMP/asnmp/counter.h b/ASNMP/asnmp/counter.h index 7cffb132a48..36fda2f84ce 100644 --- a/ASNMP/asnmp/counter.h +++ b/ASNMP/asnmp/counter.h @@ -1,22 +1,19 @@ /* -*-C++-*- */ -// $Id$ #ifndef COUNTER_ #define COUNTER_ -// ============================================================================ -// -// = LIBRARY -// asnmp -// -// = FILENAME -// counter.h -// -// = DESCRIPTION -// Class definition for SMI Counter32 class. -// -// = AUTHOR -// Peter E Mellquist -// -// ============================================================================ +//============================================================================= +/** + * @file counter.h + * + * $Id$ + * + * Class definition for SMI Counter32 class. + * + * + * @author Peter E Mellquist + */ +//============================================================================= + /*=================================================================== Copyright (c) 1996 Hewlett-Packard Company @@ -44,36 +41,39 @@ // This class does not behave as defined by the abstract model // in RFC 1155 section 3.2.3.3 -class ASNMP_Export Counter32: public SnmpUInt32 - // = TITLE - // Defines the member functions for the Counter32 concrete class - // This class implements RFC 1155 Counter Object and is named - // Counter32 after the RFC1902 redefinition of V1 SMI datatypes +/** + * @class Counter32 + * + * @brief Defines the member functions for the Counter32 concrete class + * This class implements RFC 1155 Counter Object and is named + * Counter32 after the RFC1902 redefinition of V1 SMI datatypes + */ +class ASNMP_Export Counter32 : public SnmpUInt32 { public: + /// constructor with a value Counter32( const unsigned long i = 0); - // constructor with a value + /// copy constructor Counter32( const Counter32 &c); - // copy constructor + /// syntax type SmiUINT32 get_syntax(); - // syntax type + /// create a new instance of this Value SnmpSyntax *clone() const; - // create a new instance of this Value + /// copy an instance of this Value SnmpSyntax& operator=( SnmpSyntax &val); - // copy an instance of this Value + /// overloaded assignment Counter32& operator=( const Counter32 &uli); - // overloaded assignment + /// overloaded assignment Counter32& operator=( const unsigned long i); - // overloaded assignment + /// otherwise, behave like an unsigned long int operator unsigned long(); - // otherwise, behave like an unsigned long int }; #endif // COUNTER_ diff --git a/ASNMP/asnmp/ctr64.h b/ASNMP/asnmp/ctr64.h index 7f166932430..6b97b9966f2 100644 --- a/ASNMP/asnmp/ctr64.h +++ b/ASNMP/asnmp/ctr64.h @@ -1,22 +1,19 @@ /* -*-C++-*- */ -// $Id$ #ifndef CTR64_ #define CTR64_ -// ============================================================================ -// -// = LIBRARY -// asnmp -// -// = FILENAME -// ctr64.h -// -// = DESCRIPTION -// SNMP Counter64 class definition. -// -// = AUTHOR -// Peter E Mellquist -// -// ============================================================================ +//============================================================================= +/** + * @file ctr64.h + * + * $Id$ + * + * SNMP Counter64 class definition. + * + * + * @author Peter E Mellquist + */ +//============================================================================= + /*=================================================================== Copyright (c) 1996 Hewlett-Packard Company @@ -44,65 +41,68 @@ // a single entity. This type has is available in SNMPv2 but // may be used anywhere where needed. // -class ASNMP_Export Counter64: public SnmpSyntax - // = TITLE - // Defines the member functions for the Counter64 concrete class - // This class implements RFC 1902 64 bit Counter Object. +/** + * @class Counter64 + * + * @brief Defines the member functions for the Counter64 concrete class + * This class implements RFC 1902 64 bit Counter Object. + */ +class ASNMP_Export Counter64 : public SnmpSyntax { public: + /// default constructor Counter64( ACE_UINT64 llw = 0); - // default constructor + /// constructor with values Counter64( unsigned long hiparm, unsigned long loparm); - // constructor with values + /// copy constructor Counter64( const Counter64 &ctr64); - // copy constructor + /// destructor (ensure that SnmpSyntax::~SnmpSyntax() is overridden) ~Counter64(); - // destructor (ensure that SnmpSyntax::~SnmpSyntax() is overridden) + /// syntax type SmiUINT32 get_syntax(); - // syntax type + /// return a long double representation long double to_long_double() const; - // return a long double representation + /// assign a long double to a counter64 Counter64& assign( long double ld); - // assign a long double to a counter64 + /// return the high part unsigned long high() const; - // return the high part + /// return the low part unsigned long low() const; - // return the low part + /// set the high part void set_high( const unsigned long h); - // set the high part + /// set the low part void set_low( const unsigned long l); - // set the low part + /// overloaded assignment Counter64& operator=( const ACE_UINT64 rhs); - // overloaded assignment + /// overloaded assignment Counter64& operator=( const Counter64 &rhs); - // overloaded assignment + /// get a printable ASCII representation const char *to_string(); - // get a printable ASCII representation + /// create a new instance of this Value SnmpSyntax *clone() const; - // create a new instance of this Value + /// copy an instance of this Value SnmpSyntax& operator=( SnmpSyntax &val); - // copy an instance of this Value + /// general validity test, always true int valid() const; - // general validity test, always true + /// otherwise, behave like an ACE_UINT64 operator ACE_UINT64(); - // otherwise, behave like an ACE_UINT64 protected: char output_buffer[CTR64OUTBUF]; diff --git a/ASNMP/asnmp/enttraps.h b/ASNMP/asnmp/enttraps.h index 460c2bae121..433538eb258 100644 --- a/ASNMP/asnmp/enttraps.h +++ b/ASNMP/asnmp/enttraps.h @@ -1,22 +1,19 @@ /* -*-C++-*- */ -// $Id$ #ifndef ENTTRAPS_ #define ENTTRAPS_ -// ============================================================================ -// -// = LIBRARY -// asnmp -// -// = FILENAME -// enttraps.cpp -// -// = DESCRIPTION -// constants for Enterprise Traps -// -// = AUTHOR -// Peter E Mellquist -// Michael R MacFaden mrm@cisco.com - rework & ACE port -// ============================================================================ +//============================================================================= +/** + * @file enttraps.h + * + * $Id$ + * + * constants for Enterprise Traps + * + * + * @author Peter E MellquistMichael R MacFaden mrm@cisco.com - rework & ACE port + */ +//============================================================================= + /*=================================================================== Copyright (c) 1996 Hewlett-Packard Company @@ -36,46 +33,61 @@ #include "asnmp/asn1.h" // ASN.1 header file //--------------[ well known trap ids ]----------------------------------- -class ASNMP_Export snmpTrapsOid: public Oid - // = TITLE - // Defines the member functions for the snmpTrapsOid base class - // to implement the traps defined in RFC 1215 +/** + * @class snmpTrapsOid + * + * @brief Defines the member functions for the snmpTrapsOid base class + * to implement the traps defined in RFC 1215 + */ +class ASNMP_Export snmpTrapsOid : public Oid { public: snmpTrapsOid (void):Oid("1.3.6.1.6.3.1.1.5"){} SnmpSyntax& operator=( SnmpSyntax &val){ return Oid::operator=(val); } }; -class ASNMP_Export snmpTrapEnterpriseOid: public Oid - // = TITLE - // Defines the default Enterprise Oid for this software package +/** + * @class snmpTrapEnterpriseOid + * + * @brief Defines the default Enterprise Oid for this software package + */ +class ASNMP_Export snmpTrapEnterpriseOid : public Oid { public: snmpTrapEnterpriseOid(void): Oid("1.3.6.1.6.3.1.1.4.3.0") { } SnmpSyntax& operator=( SnmpSyntax &val){ return Oid::operator=(val); } }; -class ASNMP_Export coldStartOid: public snmpTrapsOid - // = TITLE - // Defines the RFC 1215 agent cold start generic trap (system reboot) +/** + * @class coldStartOid + * + * @brief Defines the RFC 1215 agent cold start generic trap (system reboot) + */ +class ASNMP_Export coldStartOid : public snmpTrapsOid { public: coldStartOid( void){*this+=".1";} SnmpSyntax& operator=( SnmpSyntax &val){ return snmpTrapsOid::operator=(val); } }; -class ASNMP_Export warmStartOid: public snmpTrapsOid - // = TITLE - // Defines the RFC 1215 agent warm start generic trap (agent reboot) +/** + * @class warmStartOid + * + * @brief Defines the RFC 1215 agent warm start generic trap (agent reboot) + */ +class ASNMP_Export warmStartOid : public snmpTrapsOid { public: warmStartOid( void){*this+=".2";} SnmpSyntax& operator=( SnmpSyntax &val){ return snmpTrapsOid::operator=(val); } }; -class ASNMP_Export linkDownOid: public snmpTrapsOid - // = TITLE - // Defines the RFC 1215 interface (link) down trap +/** + * @class linkDownOid + * + * @brief Defines the RFC 1215 interface (link) down trap + */ +class ASNMP_Export linkDownOid : public snmpTrapsOid { public: linkDownOid( void){*this+=".3";} @@ -84,27 +96,36 @@ class ASNMP_Export linkDownOid: public snmpTrapsOid // SMI LinkUp Oid -class ASNMP_Export linkUpOid: public snmpTrapsOid - // = TITLE - // Defines the RFC 1215 interface (link) up trap +/** + * @class linkUpOid + * + * @brief Defines the RFC 1215 interface (link) up trap + */ +class ASNMP_Export linkUpOid : public snmpTrapsOid { public: linkUpOid( void){*this+=".4";} SnmpSyntax& operator=( SnmpSyntax &val){ return snmpTrapsOid::operator=(val); } }; -class ASNMP_Export authenticationFailureOid: public snmpTrapsOid - // = TITLE - // Defines the RFC 1215 device/agent invalid access trap +/** + * @class authenticationFailureOid + * + * @brief Defines the RFC 1215 device/agent invalid access trap + */ +class ASNMP_Export authenticationFailureOid : public snmpTrapsOid { public: authenticationFailureOid( void){*this+=".5";} SnmpSyntax& operator=( SnmpSyntax &val){ return snmpTrapsOid::operator=(val); } }; -class ASNMP_Export egpNeighborLossOid: public snmpTrapsOid - // = TITLE - // Defines the RFC 1215 Exterior Gateway Protocol neighbor loss trap +/** + * @class egpNeighborLossOid + * + * @brief Defines the RFC 1215 Exterior Gateway Protocol neighbor loss trap + */ +class ASNMP_Export egpNeighborLossOid : public snmpTrapsOid { public: egpNeighborLossOid( void){*this+=".6";} diff --git a/ASNMP/asnmp/gauge.h b/ASNMP/asnmp/gauge.h index 882a6f87c93..202edaf98bf 100644 --- a/ASNMP/asnmp/gauge.h +++ b/ASNMP/asnmp/gauge.h @@ -1,24 +1,21 @@ /* -*-C++-*- */ -// $Id$ #ifndef GAUGE_ #define GAUGE_ -// ============================================================================ -// -// = LIBRARY -// asnmp -// -// = FILENAME -// gauge32.cpp -// -// = DESCRIPTION -// Class definition for SMI Gauge32 class. -// This class currently does not behave as defined by the abstract model -// in RFC 1155 section 3.2.3.4 (ie the value doesn't latch on the max value) -// -// = AUTHOR -// Peter E Mellquist -// -// ============================================================================ +//============================================================================= +/** + * @file gauge.h + * + * $Id$ + * + * Class definition for SMI Gauge32 class. + * This class currently does not behave as defined by the abstract model + * in RFC 1155 section 3.2.3.4 (ie the value doesn't latch on the max value) + * + * + * @author Peter E Mellquist + */ +//============================================================================= + /*=================================================================== Copyright (c) 1996 Hewlett-Packard Company @@ -43,37 +40,40 @@ // objects may be set or get into Vb objects. // +/** + * @class Gauge32: + * + * @brief Define RFC1902 Gauge datatype from RFC 1155 section 3.2.3.4 + * Note that this datatype does not behave exactly (acts like a long) + */ class ASNMP_Export Gauge32: public SnmpUInt32 - // = TITLE - // Define RFC1902 Gauge datatype from RFC 1155 section 3.2.3.4 - // Note that this datatype does not behave exactly (acts like a long) { public: + /// constructor with a value Gauge32( const unsigned long i = 0); - // constructor with a value + /// copy constructor Gauge32 ( const Gauge32 &g); - // copy constructor + /// destructor for a Gauge32 (ensure that Value::~Value() is overridden) ~Gauge32(); - // destructor for a Gauge32 (ensure that Value::~Value() is overridden) + /// syntax type SmiUINT32 get_syntax(); - // syntax type + /// create a new instance of this Value SnmpSyntax *clone() const; - // create a new instance of this Value + /// overloaded assignment Gauge32& operator=( const Gauge32 &uli); - // overloaded assignment + /// overloaded assignment Gauge32& operator=( const unsigned long i); - // overloaded assignment + /// otherwise, behave like an unsigned int operator unsigned long(); - // otherwise, behave like an unsigned int + /// copy an instance of this Value SnmpSyntax& operator=( SnmpSyntax &val); - // copy an instance of this Value }; #endif //GAUGE_ diff --git a/ASNMP/asnmp/integer.h b/ASNMP/asnmp/integer.h index 9d21228837b..d120684c095 100644 --- a/ASNMP/asnmp/integer.h +++ b/ASNMP/asnmp/integer.h @@ -1,22 +1,18 @@ /* -*-C++-*- */ -// $Id$ #ifndef SNMPINTEGER_ #define SNMPINTEGER_ -// ============================================================================ -// -// = LIBRARY -// asnmp -// -// = FILENAME -// integer.cpp -// -// = DESCRIPTION -// Class definition for Integer classes convertable to SMI. -// -// = AUTHOR -// Jeff Meyer -// -// ============================================================================ +//============================================================================= +/** + * @file integer.h + * + * $Id$ + * + * Class definition for Integer classes convertable to SMI. + * + * + */ +//============================================================================= + /*=================================================================== Copyright (c) 1996 Hewlett-Packard Company @@ -46,95 +42,101 @@ // // 32 bit unsigned integer class -class ASNMP_Export SnmpUInt32: public SnmpSyntax - // = TITLE - // Implement RFC 1920 Unsigned Integer SMI datatype +/** + * @class SnmpUInt32 + * + * @brief Implement RFC 1920 Unsigned Integer SMI datatype + */ +class ASNMP_Export SnmpUInt32 : public SnmpSyntax { public: + /// default constructor SnmpUInt32 (const unsigned long i = 0); - // default constructor + /// copy constructor SnmpUInt32( const SnmpUInt32 &c); - // copy constructor + /// destructor (ensure that SnmpSyntax::~SnmpSyntax() is overridden) virtual ~SnmpUInt32(); - // destructor (ensure that SnmpSyntax::~SnmpSyntax() is overridden) + /// syntax type virtual SmiUINT32 get_syntax(); - // syntax type + /// overloaded assignment SnmpUInt32& operator=( const unsigned long i); - // overloaded assignment + /// overloaded assignment SnmpUInt32& operator=( const SnmpUInt32 &uli); - // overloaded assignment + /// otherwise, behave like an unsigned long int operator unsigned long(); - // otherwise, behave like an unsigned long int + /// get a printable ASCII value virtual const char *to_string(); - // get a printable ASCII value + /// create a new instance of this Value virtual SnmpSyntax *clone() const; - // create a new instance of this Value + /// copy an instance of this Value SnmpSyntax& operator=( SnmpSyntax &val); - // copy an instance of this Value + /// did object construct properly int valid() const; - // did object construct properly protected: + /// contain string representation of object int valid_flag; char output_buffer[INTOUTBUF]; - // contain string representation of object }; // 32 bit signed integer class -class ASNMP_Export SnmpInt32: public SnmpSyntax + /** + * @class SnmpInt32 + * + * @brief Implement RFC 1902 32 bit Integer SMI data object + */ +class ASNMP_Export SnmpInt32 : public SnmpSyntax { - // = TITLE - // Implement RFC 1902 32 bit Integer SMI data object public: + /// constructor with value SnmpInt32 (const long i = 0); - // constructor with value + /// constructor with value SnmpInt32 (const SnmpInt32 &c); - // constructor with value + /// destructor (ensure that SnmpSyntax::~SnmpSyntax() is overridden) virtual ~SnmpInt32(); - // destructor (ensure that SnmpSyntax::~SnmpSyntax() is overridden) + /// syntax type virtual SmiUINT32 get_syntax(); - // syntax type + /// overloaded assignment SnmpInt32& operator=( const long i); - // overloaded assignment + /// overloaded assignment SnmpInt32& operator=( const SnmpInt32 &li); - // overloaded assignment + /// otherwise, behave like a long int operator long(); - // otherwise, behave like a long int + /// create a new instance of this Value SnmpSyntax *clone() const; - // create a new instance of this Value + /// copy an instance of this Value SnmpSyntax& operator=( SnmpSyntax &val); - // copy an instance of this Value + /// get a printable ASCII value const char *to_string(); - // get a printable ASCII value + /// logical state of object int valid() const; - // logical state of object protected: + /// contain string representation of object int valid_flag; char output_buffer[INTOUTBUF]; - // contain string representation of object }; #endif diff --git a/ASNMP/asnmp/octet.h b/ASNMP/asnmp/octet.h index bb0a68432d1..5e8c8d63d98 100644 --- a/ASNMP/asnmp/octet.h +++ b/ASNMP/asnmp/octet.h @@ -1,27 +1,22 @@ -// -*-C++-*- -// $Id$ #ifndef OCTET_CLS_ #define OCTET_CLS_ -// ============================================================================ -// -// = LIBRARY -// asnmp -// -// = FILENAME -// octet.h -// -// = DESCRIPTION -// This class is fully contained and does not rely on or any other -// SNMP libraries. This class is portable across any platform -// which supports C++. -// -// = AUTHOR -// Peter E Mellquist / design/original code -// Michael R. MacFaden / modified for ACE, added suboid(),collapse ctor's -// -// ============================================================================ +//============================================================================= +/** + * @file octet.h + * + * $Id$ + * + * This class is fully contained and does not rely on or any other + * SNMP libraries. This class is portable across any platform + * which supports C++. + * + * + * @author Peter E Mellquist / design/original code Michael R. MacFaden / modified for ACE + */ +//============================================================================= + /*=================================================================== Copyright (c) 1996 Hewlett-Packard Company @@ -41,107 +36,112 @@ //------------------------------------------------------------------------ #include "asnmp/smival.h" -class ASNMP_Export OctetStr: public SnmpSyntax - // = TITLE - // Implement RFC1155 Octet SMI data object +/** + * @class OctetStr + * + * @brief Implement RFC1155 Octet SMI data object + */ +class ASNMP_Export OctetStr : public SnmpSyntax { public: + /// construct octet from byte buffer, assume c style string if size == -1 OctetStr( const char *string = "", long size = -1); - // construct octet from byte buffer, assume c style string if size == -1 + /// constructor using another octet object OctetStr ( const OctetStr &octet); - // constructor using another octet object + /// destructor ~OctetStr(); - // destructor + /// syntax type SmiUINT32 get_syntax(); - // syntax type + /// set octet from byte buffer, assume c style string if size == -1 void set_data( const SmiBYTE* string, long int size = -1); - // set octet from byte buffer, assume c style string if size == -1 + /// assignment to a string operator overloaded OctetStr& operator=( const char *string); - // assignment to a string operator overloaded + /// assignment to another oid object overloaded OctetStr& operator=( const OctetStr &octet); - // assignment to another oid object overloaded + /// equivlence operator overloaded friend ASNMP_Export bool operator==( const OctetStr &lhs, const OctetStr &rhs); - // equivlence operator overloaded + /// not equivlence operator overloaded friend ASNMP_Export bool operator!=( const OctetStr &lhs, const OctetStr &rhs); - // not equivlence operator overloaded + /// less than < overloaded friend ASNMP_Export bool operator<( const OctetStr &lhs, const OctetStr &rhs); - // less than < overloaded + /// less than <= overloaded friend ASNMP_Export bool operator<=( const OctetStr &lhs,const OctetStr &rhs); - // less than <= overloaded + /// greater than > overloaded friend ASNMP_Export bool operator>( const OctetStr &lhs, const OctetStr &rhs); - // greater than > overloaded + /// greater than >= overloaded friend ASNMP_Export bool operator>=( const OctetStr &lhs, const OctetStr &rhs); - // greater than >= overloaded + /// equivlence operator overloaded friend ASNMP_Export bool operator==( const OctetStr &lhs,const char *rhs); - // equivlence operator overloaded + /// not equivlence operator overloaded friend ASNMP_Export bool operator!=( const OctetStr &lhs,const char *rhs); - // not equivlence operator overloaded + /// less than < operator overloaded friend ASNMP_Export bool operator<( const OctetStr &lhs,const char *rhs); - // less than < operator overloaded + /// less than <= operator overloaded friend ASNMP_Export bool operator<=( const OctetStr &lhs,char *rhs); - // less than <= operator overloaded + /// greater than > operator overloaded friend ASNMP_Export bool operator>( const OctetStr &lhs,const char *rhs); - // greater than > operator overloaded + /// greater than >= operator overloaded friend ASNMP_Export bool operator>=( const OctetStr &lhs,const char *rhs); - // greater than >= operator overloaded + /// append operator, appends a string OctetStr& operator+=( const char *a); - // append operator, appends a string + /// appends an int OctetStr& operator+=( const char c); - // appends an int + /// append one octetStr to another OctetStr& operator+=( const OctetStr& octetstr); - // append one octetStr to another + /// for non const [], allows reading and writing SmiBYTE& operator[]( int position); - // for non const [], allows reading and writing + /** + * compare the n leftmost bytes (left-to-right) + * returns 0, equal + * returns -1, < + * returns 1 , > + */ int left_comparison( const long n, const OctetStr &o) const; - // compare the n leftmost bytes (left-to-right) - // returns 0, equal - // returns -1, < - // returns 1 , > + /// return the len of the oid size_t length() const ; - // return the len of the oid + /// returns validity int valid() const; - // returns validity + /// returns pointer to internal data SmiBYTE *data() const; - // returns pointer to internal data + /// get a printable ASCII value const char *to_string(); - // get a printable ASCII value + /// get an ASCII formattted hex dump of the contents const char *to_string_hex(); - // get an ASCII formattted hex dump of the contents + /// create a new instance of this Value SnmpSyntax *clone() const; - // create a new instance of this Value + /// copy an instance of this Value SnmpSyntax& operator=( SnmpSyntax &val); - // copy an instance of this Value protected: //----[ instance variables ] diff --git a/ASNMP/asnmp/oid.h b/ASNMP/asnmp/oid.h index 7de02013ef4..77118b518f0 100644 --- a/ASNMP/asnmp/oid.h +++ b/ASNMP/asnmp/oid.h @@ -1,29 +1,25 @@ -// -*-C++-*- -// $Id$ #ifndef OID_CLS_ #define OID_CLS_ -// ============================================================================ -// -// = LIBRARY -// asnmp -// -// = FILENAME -// oid.h -// -// = DESCRIPTION -// This class is fully contained and does not rely on or any other -// SNMP libraries. This class is portable across any platform -// which supports C++. Ported to ACE by Mike MacFaden mrm@cisco.com -// and modified for MT. Some API cleanup: collapse constructors, -// add suboid() method remove unnecessary overload, and update a few -// names and types to improve clarity. -// -// = AUTHOR -// Peter E Mellquist -// -// ============================================================================ +//============================================================================= +/** + * @file oid.h + * + * $Id$ + * + * This class is fully contained and does not rely on or any other + * SNMP libraries. This class is portable across any platform + * which supports C++. Ported to ACE by Mike MacFaden mrm@cisco.com + * and modified for MT. Some API cleanup: collapse constructors, + * add suboid() method remove unnecessary overload, and update a few + * names and types to improve clarity. + * + * + * @author Peter E Mellquist + */ +//============================================================================= + /*=================================================================== Copyright (c) 1996 Hewlett-Packard Company @@ -49,122 +45,129 @@ #include "asnmp/smival.h" // derived class for all values -class ASNMP_Export Oid: public SnmpSyntax - // = TITLE - // Implement RFC 1155 Object Identifier (OID) datatype +/** + * @class Oid + * + * @brief Implement RFC 1155 Object Identifier (OID) datatype + */ +class ASNMP_Export Oid : public SnmpSyntax { public: + /// constructor using a dotted string Oid( const char * dotted_oid_string = "", size_t size = unsigned(-1) ); - // constructor using a dotted string + /// constructor using another oid object Oid ( const Oid &oid); - // constructor using another oid object + /// constructor from raw form Oid(const unsigned long *raw_oid, size_t oid_len); - // constructor from raw form + /// destructor ~Oid(); - // destructor + /// syntax type SmiUINT32 get_syntax(); - // syntax type + /// assignment to another oid object overloaded Oid& operator=( const Oid &oid); - // assignment to another oid object overloaded + /// equal operator overloaded friend ASNMP_Export bool operator==( const Oid &lhs,const Oid &rhs); - // equal operator overloaded + /// not equal operator overloaded friend ASNMP_Export bool operator!=( const Oid &lhs,const Oid &rhs); - // not equal operator overloaded + /// less than < overloaded friend ASNMP_Export bool operator<( const Oid &lhs,const Oid &rhs); - // less than < overloaded + /// less than <= overloaded friend ASNMP_Export bool operator<=( const Oid &lhs,const Oid &rhs); - // less than <= overloaded + /// greater than > overloaded friend ASNMP_Export bool operator>( const Oid &lhs,const Oid &rhs); - // greater than > overloaded + /// greater than >= overloaded friend ASNMP_Export bool operator>=( const Oid &lhs,const Oid &rhs); - // greater than >= overloaded + /// append operator, appends a string Oid& operator+=( const char *a); - // append operator, appends a string + /// appends an int Oid& operator+=( const unsigned long i); - // appends an int + /// appends an Oid Oid& operator+=( const Oid &o); - // appends an Oid + /// allows element access unsigned long & operator[]( size_t position); - // allows element access + /// return the WinSnmp oid part SmiLPOID oidval(); - // return the WinSnmp oid part + /// reset the data from raw 1 byte format void set_data( const char *dotted_oid_string); - // reset the data from raw 1 byte format + /// reset the data from raw 4byte integer format void set_data( const unsigned long *raw_oid, const size_t oid_len); - // reset the data from raw 4byte integer format + /// return the len of the oid size_t length() const; - // return the len of the oid + /// trim off the n rightmost values of an oid void trim( const size_t how_many = 1); - // trim off the n rightmost values of an oid + /// the equivalent of a substr(new_str, 0, 1) int suboid(Oid& oid, size_t start = 0, size_t how_many = size_t (-1)); - // the equivalent of a substr(new_str, 0, 1) + /** + * compare the n leftmost bytes (left-to-right) + * returns 0, equal + * returns -1, < + * returns 1 , > + */ int left_comparison( const unsigned long n, const Oid &o) const; - // compare the n leftmost bytes (left-to-right) - // returns 0, equal - // returns -1, < - // returns 1 , > + /** + * compare the n rightmost bytes (right-to-left) + * returns 0, equal + * returns -1, < + * returns 1 , > + */ int right_comparison( const unsigned long n, const Oid &o) const; - // compare the n rightmost bytes (right-to-left) - // returns 0, equal - // returns -1, < - // returns 1 , > + /// is the Oid object valid int valid() const; - // is the Oid object valid + /// return dotted string value from the right + /// where the user specifies how many positions to print const char *to_string(); - // return dotted string value from the right - // where the user specifies how many positions to print + /// create a new instance of this Value SnmpSyntax *clone() const; - // create a new instance of this Value + /// copy an instance of this Value SnmpSyntax& operator=( SnmpSyntax &val); - // copy an instance of this Value protected: + /// used for returning oid string char *iv_str; - // used for returning oid string + /// convert a string to an smi oid int StrToOid( const char *string, SmiLPOID dstOid, size_t& how_many_bytes); - // convert a string to an smi oid + /// clone an smi oid int OidCopy( SmiLPOID srcOid, SmiLPOID dstOid, size_t& how_many_bytes); - // clone an smi oid + /// convert an smi oid to its string representation int OidToStr(SmiLPOID srcOid, SmiUINT32 size, char *string, size_t& how_many_bytes); - // convert an smi oid to its string representation private: + /// release memory, re-init data members void set_invalid(); - // release memory, re-init data members + /// initialize object data members void set_null(); - // initialize object data members void init_value( const SmiLPOID srcOid, size_t len); void init_value(const unsigned long *raw_oid, size_t oid_len); }; diff --git a/ASNMP/asnmp/oid_def.h b/ASNMP/asnmp/oid_def.h index bdf46ec4f88..31ccbfa3e4a 100644 --- a/ASNMP/asnmp/oid_def.h +++ b/ASNMP/asnmp/oid_def.h @@ -1,22 +1,19 @@ /* -*-C++-*- */ -// $Id$ #ifndef OID_DEF #define OID_DEF -// ============================================================================ -// -// = LIBRARY -// asnmp -// -// = FILENAME -// address.cpp -// -// = DESCRIPTION -// Well known Oids defined in RFC 1215 -// -// = AUTHOR -// Peter E Mellquist -// -// ============================================================================ +//============================================================================= +/** + * @file oid_def.h + * + * $Id$ + * + * Well known Oids defined in RFC 1215 + * + * + * @author Peter E Mellquist + */ +//============================================================================= + /*=================================================================== Copyright (c) 1996 diff --git a/ASNMP/asnmp/pdu.h b/ASNMP/asnmp/pdu.h index cf2f3ee8aaf..a2d84388da0 100644 --- a/ASNMP/asnmp/pdu.h +++ b/ASNMP/asnmp/pdu.h @@ -1,23 +1,21 @@ /* -*-C++-*- */ -// $Id$ #ifndef PDU_CLS_ #define PDU_CLS_ -// ============================================================================ -// -// = 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 -// ============================================================================ +//============================================================================= +/** + * @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 + */ +//============================================================================= + /*=================================================================== Copyright (c) 1996 Hewlett-Packard Company @@ -40,173 +38,181 @@ #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_ diff --git a/ASNMP/asnmp/sagent.h b/ASNMP/asnmp/sagent.h index ced6bb4fff5..d220c3ed459 100644 --- a/ASNMP/asnmp/sagent.h +++ b/ASNMP/asnmp/sagent.h @@ -1,24 +1,20 @@ /* -*-C++-*- */ -// $Id$ #ifndef SAGENT_CLS_ #define SAGENT_CLS_ -// ============================================================================ -// -// = LIBRARY -// asnmp -// -// = FILENAME -// sagent.h -// -// = DESCRIPTION -// SNMP agent class defintion. The sagent class provides an object oriented -// approach for creating SNMP Agents. The sagent class is an encapsulation of SNMP -// sessions, gets, sets, etc. -// -// = AUTHOR -// Michael R. MacFaden -// -// ============================================================================ +//============================================================================= +/** + * @file sagent.h + * + * $Id$ + * + * SNMP agent class defintion. The sagent class provides an object oriented + * approach for creating SNMP Agents. The sagent class is an encapsulation of SNMP + * sessions, gets, sets, etc. + * + * @author Michael R. MacFaden + */ +//============================================================================= + #include "ace/Reactor.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) @@ -39,10 +35,13 @@ #define DEF_AGENT_PORT (161) +/** + * @class sagent + * + * @brief Concrete class sagent defines the session and interface to + * communicate with another SNMP Version 1 manager + */ class ASNMP_Export sagent : public ACE_Event_Handler, private Snmp - // = TITLE - // Concrete class sagent defines the session and interface to - // communicate with another SNMP Version 1 manager { public: @@ -50,24 +49,24 @@ class ASNMP_Export sagent : public ACE_Event_Handler, private Snmp // override the next three methods (callbacks) to implment your agent // + /// retrieve data from a peer agent for a given list of oid values virtual int handle_get( Pdu &pdu, UdpTarget &target) = 0; - // retrieve data from a peer agent for a given list of oid values + /// retrieve data lexically adjacent to the oids specified in the pdu + /// from the peer agent virtual int handle_get_next( Pdu &pdu, UdpTarget &target) = 0; - // retrieve data lexically adjacent to the oids specified in the pdu - // from the peer agent + /// set data in the agent from the list of oids in the pdu virtual int handle_set( Pdu &pdu, UdpTarget &target) = 0; - // set data in the agent from the list of oids in the pdu + /// new pdu received from mgr (reactor calls this) virtual int handle_input(ACE_HANDLE); - // new pdu received from mgr (reactor calls this) + /// retrieve io descriptor (reactor uses this) virtual ACE_HANDLE get_handle() const; - // retrieve io descriptor (reactor uses this) + /// send a response pdu to the mgr int respond(Pdu& pdu, UdpTarget& tgt); - // send a response pdu to the mgr protected: sagent(unsigned short port = DEF_AGENT_PORT); diff --git a/ASNMP/asnmp/smi.h b/ASNMP/asnmp/smi.h index 4fac7f8c1bc..3e505c64cb8 100644 --- a/ASNMP/asnmp/smi.h +++ b/ASNMP/asnmp/smi.h @@ -1,23 +1,17 @@ /* -*-C++-*- */ -// $Id$ #ifndef SMIDEF_ #define SMIDEF_ -// ============================================================================ -// -// = LIBRARY -// asnmp -// -// = FILENAME -// smi.h -// -// = DESCRIPTION -// Address class definition. Encapsulates various network -// addresses into easy to use, safe and portable classes. -// -// = AUTHOR -// ?? -// -// ============================================================================ +//============================================================================= +/** + * @file smi.h + * + * $Id$ + * + * Address class definition. Encapsulates various network + * addresses into easy to use, safe and portable classes. + */ +//============================================================================= + /*=================================================================== Copyright (c) 1996 Hewlett-Packard Company diff --git a/ASNMP/asnmp/smival.h b/ASNMP/asnmp/smival.h index c8bd6b8a5c9..e754206f506 100644 --- a/ASNMP/asnmp/smival.h +++ b/ASNMP/asnmp/smival.h @@ -1,24 +1,20 @@ /* -*-C++-*- */ -// $Id$ #ifndef SMIVALUE_ #define SMIVALUE_ -// ============================================================================ -// -// = LIBRARY -// tests -// -// = FILENAME -// smival.h -// -// = DESCRIPTION -// SMIValue class definition. Superclass for the various types -// of SNMP values (Address, Oid, Octet, etc.). Provides -// only a few functions, most info is in subclass. -// -// = AUTHOR -// Jeff Meyer -// -// ============================================================================ +//============================================================================= +/** + * @file smival.h + * + * $Id$ + * + * SMIValue class definition. Superclass for the various types + * of SNMP values (Address, Oid, Octet, etc.). Provides + * only a few functions, most info is in subclass. + * + * + */ +//============================================================================= + /*=================================================================== Copyright (c) 1996 Hewlett-Packard Company diff --git a/ASNMP/asnmp/snmp.h b/ASNMP/asnmp/snmp.h index c46e9d078ce..5bae232baa0 100644 --- a/ASNMP/asnmp/snmp.h +++ b/ASNMP/asnmp/snmp.h @@ -1,26 +1,23 @@ /* -*-C++-*- */ -// $Id$ #ifndef SNMP_CLS_ #define SNMP_CLS_ -// ============================================================================ -// -// = LIBRARY -// asnmp -// -// = FILENAME -// snmp.h -// -// = DESCRIPTION -// SNMP class defintion. The Snmp class provides an object oriented -// approach to SNMP. The SNMP class is an encapsulation of SNMP -// sessions, gets, sets, etc. The class manages all SNMP -// resources and provides complete retry and timeout capability. -// -// = AUTHOR -// Peter E Mellquist design, first implementation -// Michael R. MacFaden port to ACE / use Reactor pattern -// -// ============================================================================ +//============================================================================= +/** + * @file snmp.h + * + * $Id$ + * + * SNMP class defintion. The Snmp class provides an object oriented + * approach to SNMP. The SNMP class is an encapsulation of SNMP + * sessions, gets, sets, etc. The class manages all SNMP + * resources and provides complete retry and timeout capability. + * + * + * @author Peter E Mellquist design + * @author first implementation Michael R. MacFaden port to ACE / use Reactor pattern + */ +//============================================================================= + /*=================================================================== Copyright (c) 1996 Hewlett-Packard Company @@ -63,10 +60,13 @@ class ASNMP_Export Snmp_Result }; // Snmp session class - supports Version 1 operations in blocking mode +/** + * @class Snmp + * + * @brief Concrete class Snmp defined the session and interface to + * communicate with another SNMP Version 1 agent + */ class ASNMP_Export Snmp : public transaction_result - // = TITLE - // Concrete class Snmp defined the session and interface to - // communicate with another SNMP Version 1 agent { Snmp_Result * result_; Pdu * pdu_; @@ -75,39 +75,41 @@ public: Snmp(unsigned short port = INADDR_ANY); virtual ~Snmp(); + /// retrieve data from a peer agent for a given list of oid values + /// default port 161 int get( Pdu &pdu, UdpTarget &target, Snmp_Result * cb = 0); - // retrieve data from a peer agent for a given list of oid values - // default port 161 + /** + * retrieve data lexically adjacent to the oids specified in the pdu + * from the peer agent + * default port 161 + */ int get_next( Pdu &pdu, UdpTarget &target, Snmp_Result * cb = 0); - // retrieve data lexically adjacent to the oids specified in the pdu - // from the peer agent - // default port 161 + /// set data in the agent from the list of oids in the pdu + /// default port 161 int set( Pdu &pdu, UdpTarget &target, Snmp_Result * cb = 0); - // set data in the agent from the list of oids in the pdu - // default port 161 + /// send an SNMPv1 trap (unreliable) to a remote system (def port 162) int trap( Pdu &pdu, UdpTarget &target); - // send an SNMPv1 trap (unreliable) to a remote system (def port 162) + /// status of object after construction int valid() const; - // status of object after construction + /// given error code, return string reason static const char * error_string(int code); - // given error code, return string reason + /// retrieve a reason string if any of the above commands fail const char * error_string(); - // retrieve a reason string if any of the above commands fail + /// for async transaction results void result(transaction * t, int rc); - // for async transaction results + /// allow the host name to be overriden static void override_host_name(const char* name); - // allow the host name to be overriden + /// returns the overriden host name static void get_host_name(char* name, int len); - // returns the overriden host name protected: void check_default_port(UdpTarget& target,unsigned short port=DEF_AGENT_PORT); @@ -117,17 +119,17 @@ protected: Snmp(const Snmp&); + /// io object ACE_SOCK_Dgram iv_snmp_session_; - // io object + /// status of construction int construct_status_; - // status of construction + /// result code from last transaction int last_transaction_status_; - // result code from last transaction + /// transaction request id unsigned req_id_; - // transaction request id static char host_name_[MAXHOSTNAMELEN]; }; diff --git a/ASNMP/asnmp/snmperrs.h b/ASNMP/asnmp/snmperrs.h index 08a4997217e..7aafdc0619a 100644 --- a/ASNMP/asnmp/snmperrs.h +++ b/ASNMP/asnmp/snmperrs.h @@ -1,22 +1,18 @@ /* -*-C++-*- */ -// $Id$ #ifndef SNMPERRS_H_ #define SNMPERRS_H_ -// ============================================================================ -// -// = LIBRARY -// asnmp -// -// = FILENAME -// snmperrs.h -// -// = DESCRIPTION -// Definition of error macros and error strings -// -// = AUTHOR -// Jeff Meyer -// -// ============================================================================ +//============================================================================= +/** + * @file snmperrs.h + * + * $Id$ + * + * Definition of error macros and error strings + * + * + */ +//============================================================================= + /*=================================================================== Copyright (c) 1996 Hewlett-Packard Company diff --git a/ASNMP/asnmp/target.h b/ASNMP/asnmp/target.h index 1a42cb75b37..084088e5f4f 100644 --- a/ASNMP/asnmp/target.h +++ b/ASNMP/asnmp/target.h @@ -1,23 +1,19 @@ -// -*-C++-*- -// $Id$ #ifndef TARGET_ #define TARGET_ -// ============================================================================ -// -// = LIBRARY -// asnmp -// -// = FILENAME -// target.h -// -// = DESCRIPTION -// -// = AUTHOR -// Peter E Mellquist -// Michael R. MacFaden (ported to ACE) -// ============================================================================ +//============================================================================= +/** + * @file target.h + * + * $Id$ + * + * @brief + * + * @author Peter E Mellquist Michael R. MacFaden (ported to ACE) + */ +//============================================================================= + /*=================================================================== Copyright (c) 1996 Hewlett-Packard Company @@ -70,173 +66,183 @@ enum ASNMP_Defs { // Abstract class used to provide a virtual interface into Targets // +/** + * @class SnmpTarget + * + * @brief Abstract Base class SnmpTarget is used to Collect all transmission + * details to communicate with an SNMP + */ class ASNMP_Export SnmpTarget - // = TITLE - // Abstract Base class SnmpTarget is used to Collect all transmission - // details to communicate with an SNMP { public: + /// allow destruction of derived classes virtual ~SnmpTarget(); - // allow destruction of derived classes + /// return validity of target int valid() const; - // return validity of target + /// set the retry value void set_retry( const int r); - // set the retry value + /// set the object's timeout (in seconds) void set_timeout( const unsigned long t); - // set the object's timeout (in seconds) + /// set the instance version void set_version( const snmp_version v); - // set the instance version + /// all classes constructed will have this write community string void set_max_pdu_size(const unsigned long max_pdu_sz); - // all classes constructed will have this write community string + /// change the "class" default default timeout (in seconds) void set_default_timeout( const unsigned long t); - // change the "class" default default timeout (in seconds) + /// change the default send retries void set_default_retry( const int r); - // change the default send retries + /// all classes constructed will have this write community string void set_default_max_pdu_size(const unsigned long max_pdu_sz); - // all classes constructed will have this write community string + /// change class default void set_default_version( const snmp_version v); - // change class default // *** get methods *** + /// get the retry value int get_default_retry() const; - // get the retry value + /// get the timeout (seconds) unsigned long get_timeout() const; - // get the timeout (seconds) + /// get instance max buffer size unsigned long get_max_pdu_size() const; - // get instance max buffer size + /// all classes constructed will have this write community string void get_default_max_pdu_size(const unsigned long max_pdu_sz); - // all classes constructed will have this write community string + /// get the version snmp_version get_version() const; - // get the version snmp_version get_default_version() const; + /// return send retry number for this instancd int get_retry() const; - // return send retry number for this instancd + /** + * virtual clone operation for creating a new SnmpTarget from an existing + * SnmpTarget. The caller MUST use the delete operation on the return + * value when done. + */ virtual SnmpTarget *clone() const = 0; - // virtual clone operation for creating a new SnmpTarget from an existing - // SnmpTarget. The caller MUST use the delete operation on the return - // value when done. + /// manipulate the base part friend bool operator==(const SnmpTarget& lhs, const SnmpTarget& rhs); - // manipulate the base part SnmpTarget& operator=(const SnmpTarget& lhs); protected: + /// SnmpTarget(const SnmpTarget &); SnmpTarget(); - // SnmpTarget(const SnmpTarget &); + /// used by derived class instances int validity_; - // used by derived class instances + /// instance value xmit timeout in milli secs unsigned long timeout_; - // instance value xmit timeout in milli secs + /// instance value number of retries int retries_; - // instance value number of retries + /// size of pdu unsigned max_pdu_size_; - // size of pdu + /// instance value the snmp version snmp_version version_; - // instance value the snmp version // class wide default values + /// xmit timeout in secs static unsigned long default_timeout_; - // xmit timeout in secs + /// number of retries static int default_retries_; - // number of retries + /// snmp protocol version static unsigned long default_max_pdu_size_; static snmp_version default_version_; - // snmp protocol version }; //----[ UdpTarget class ]---------------------------------------------- // UDP/IP transport using "community string" based agents (targets) // -class ASNMP_Export UdpTarget: public SnmpTarget - // = TITLE - // Concrete class UdpTarget contains all Details for communicating - // with a SNMPv1 agent over UDP/IPv4 transport +/** + * @class UdpTarget + * + * @brief Concrete class UdpTarget contains all Details for communicating + * with a SNMPv1 agent over UDP/IPv4 transport + */ +class ASNMP_Export UdpTarget : public SnmpTarget { public: UdpTarget(); + /** + * constructor with only address + * assumes default as public, public + * can be constructed with IP address object + */ UdpTarget( const UdpAddress& udp); - // constructor with only address - // assumes default as public, public - // can be constructed with IP address object + /// can be constructed with Udp address object TODO: merge addresses UdpTarget( ACE_INET_Addr& ace_inet_addr); - // can be constructed with Udp address object TODO: merge addresses + /// destructor ~UdpTarget(); - // destructor // ** set *** + /// set the read community using an OctetStr void set_read_community( const OctetStr& new_read_community); - // set the read community using an OctetStr + /// set the write community using an OctetStr void set_write_community( const OctetStr& write_community); - // set the write community using an OctetStr + /// set the address int set_address( UdpAddress &udp_address); - // set the address // ** get *** + /// get the read community as an Octet Str object void get_read_community( OctetStr& read_community_oct) const; - // get the read community as an Octet Str object + /// get the write community as an OctetStr void get_write_community( OctetStr &write_community_oct) const; - // get the write community as an OctetStr + /// get the address void get_address( UdpAddress& address) const; - // get the address + /// all classes constructed will have this read community string void set_default_read_community(const OctetStr& rd_community); - // all classes constructed will have this read community string + /// all classes constructed will have this write community string void set_default_write_community(const OctetStr& wr_community); - // all classes constructed will have this write community string + /// all classes constructed will have this read community string void get_default_read_community(OctetStr& rd_community) const; - // all classes constructed will have this read community string + /// all classes constructed will have this write community string void get_default_write_community(OctetStr& wr_community) const; - // all classes constructed will have this write community string + /// overloaded assignment UdpTarget& operator=( const UdpTarget& target); - // overloaded assignment + /// compare two C targets friend bool operator==( const UdpTarget &lhs, const UdpTarget &rhs); - // compare two C targets + /// string representation of object const char *to_string(); - // string representation of object + /// clone from existing UdpTarget SnmpTarget *clone() const; - // clone from existing UdpTarget protected: static OctetStr default_rd_community_; @@ -246,8 +252,8 @@ class ASNMP_Export UdpTarget: public SnmpTarget UdpAddress udp_address_; snmp_version version_; + /// to_string() rep of data char output_buffer_[MAX_TARGET_STRING_REP]; - // to_string() rep of data }; diff --git a/ASNMP/asnmp/timetick.h b/ASNMP/asnmp/timetick.h index 9de4687a832..ca52a3e1d9d 100644 --- a/ASNMP/asnmp/timetick.h +++ b/ASNMP/asnmp/timetick.h @@ -1,22 +1,19 @@ /* -*-C++-*- */ -// $Id$ #ifndef TIMETICKS_ #define TIMETICKS_ -// ============================================================================ -// -// = LIBRARY -// asnmp -// -// = FILENAME -// timetick.h -// -// = DESCRIPTION -// Class definition for SMI Timeticks class. -// -// = AUTHOR -// Michael R. MacFaden <mrm@cisco.com> -// -// ============================================================================ +//============================================================================= +/** + * @file timetick.h + * + * $Id$ + * + * Class definition for SMI Timeticks class. + * + * + * @author Michael R. MacFaden <mrm@cisco.com> + */ +//============================================================================= + /*=================================================================== Copyright (c) 1996 Hewlett-Packard Company @@ -42,44 +39,47 @@ // integers but is recognized as a distinct SMI type. TimeTicks // objects may be get or set into Vb objects. // -class ASNMP_Export TimeTicks: public SnmpUInt32 - // = TITLE - // Define RFC1155 TimeTicks Data object +/** + * @class TimeTicks + * + * @brief Define RFC1155 TimeTicks Data object + */ +class ASNMP_Export TimeTicks : public SnmpUInt32 { public: TimeTicks( const unsigned long i = 0); + /// copy constructor TimeTicks( const TimeTicks &t); - // copy constructor + /// destructor ~TimeTicks(); - // destructor + /// syntax type SmiUINT32 get_syntax(); - // syntax type + /// get a printable ASCII value const char *to_string(); - // get a printable ASCII value + /// create a new instance of this Value SnmpSyntax *clone() const; - // create a new instance of this Value + /// copy an instance of this Value SnmpSyntax& operator=(SnmpSyntax &val); - // copy an instance of this Value + /// overloaded assignment TimeTicks& operator=( const TimeTicks &uli); - // overloaded assignment + /// overloaded assignment TimeTicks& operator=( const unsigned long int i); - // overloaded assignment + /// otherwise, behave like an unsigned long operator unsigned long(); - // otherwise, behave like an unsigned long protected: + /// for storing printed form char output_buffer[TICKOUTBUF]; - // for storing printed form }; #endif // TIMETICKS_ diff --git a/ASNMP/asnmp/transaction.h b/ASNMP/asnmp/transaction.h index 98d5890913e..d114bd40d1f 100644 --- a/ASNMP/asnmp/transaction.h +++ b/ASNMP/asnmp/transaction.h @@ -1,21 +1,18 @@ /* -*-C++-*- */ -// $Id$ #ifndef TRANSACTION_ #define TRANSACTION_ -// ============================================================================ -// -// = LIBRARY -// asnmp -// -// = FILENAME -// transaction.h -// -// = DESCRIPTION -// -// = AUTHOR -// Michael R. MacFaden port to ACE / use Reactor pattern -// -// ============================================================================ +//============================================================================= +/** + * @file transaction.h + * + * $Id$ + * + * @brief + * + * @author Michael R. MacFaden port to ACE / use Reactor pattern + */ +//============================================================================= + #include "ace/Event_Handler.h" @@ -29,48 +26,51 @@ #include "asnmp/wpdu.h" // cmu adapter class #include "ace/SOCK_Dgram.h" +/** + * @class transaction + * + * @brief Used to manage the details of a particular transaction betwen + * two SNMP agents. Uses SnmpTarget class to implement retry/timeout + */ class ASNMP_Export transaction : public ACE_Event_Handler - // = TITLE - // Used to manage the details of a particular transaction betwen - // two SNMP agents. Uses SnmpTarget class to implement retry/timeout { int retry_counter_; transaction_result * result_; public: + /// constructor + /// destructor transaction(const Pdu& pdu, const UdpTarget& target, ACE_SOCK_Dgram& io); transaction(ACE_SOCK_Dgram& io); - // constructor ~transaction(); - // destructor + /// begin polling for values int run(); int run(transaction_result *r); // Async interface, with callback object - // begin polling for values + /// return pdu with result from agent after run() is completed rc = 0 + /// optionally get community str int result(Pdu& pdu, char *comm_str = 0, ACE_INET_Addr *from_addr = 0); - // return pdu with result from agent after run() is completed rc = 0 - // optionally get community str + /// called by reactor when data is ready to be read in from OS memory + /// used for resend in asynchronous run() virtual int handle_input (ACE_HANDLE fd); - // called by reactor when data is ready to be read in from OS memory virtual int handle_timeout (const ACE_Time_Value &, const void *); - // used for resend in asynchronous run() + /// transmit buffer command to network... int send(); - // transmit buffer command to network... + /// pre: handle_input called + /// retrieve the sender's from address from the last pkt const ACE_INET_Addr& get_from_addr() const; - // pre: handle_input called - // retrieve the sender's from address from the last pkt + /// Return session_ handle. ACE_HANDLE get_handle () const; - // Return session_ handle. private: + /// disallow copy construction transaction(const transaction&); - // disallow copy construction wpdu wp_; // wire pdu UdpTarget params_; // params diff --git a/ASNMP/asnmp/transaction_result.h b/ASNMP/asnmp/transaction_result.h index 7968572d19b..9ea94c60e8e 100644 --- a/ASNMP/asnmp/transaction_result.h +++ b/ASNMP/asnmp/transaction_result.h @@ -1,22 +1,19 @@ /* -*-C++-*- */ -// $Id$ #ifndef TRANSACTION_RESULT_H_ #define TRANSACTION_RESULT_H_ -// ============================================================================ -// -// = LIBRARY -// asnmp -// -// = FILENAME -// transaction_result.h -// -// = DESCRIPTION -// An object respresenting a request/reply operation between mgr/agent -// -// = AUTHOR -// Michael R. MacFaden -// -// ============================================================================ +//============================================================================= +/** + * @file transaction_result.h + * + * $Id$ + * + * An object respresenting a request/reply operation between mgr/agent + * + * + * @author Michael R. MacFaden + */ +//============================================================================= + class transaction; class ASNMP_Export transaction_result diff --git a/ASNMP/asnmp/vb.h b/ASNMP/asnmp/vb.h index be6bdabfd37..b82adb2bc0e 100644 --- a/ASNMP/asnmp/vb.h +++ b/ASNMP/asnmp/vb.h @@ -1,27 +1,24 @@ -// -*-C++-*- -// $Id$ #ifndef VB_CLS_ #define VB_CLS_ -// ============================================================================ -// -// = LIBRARY -// asnmp -// -// = FILENAME -// vb.h -// -// = DESCRIPTION -// This module contains the class definition for the variable binding (VB) -// class. The VB class is an encapsulation of a SNMP VB. A VB object is -// composed of one SNMP++ Oid and one SMI value. The Vb class utilizes Oid -// objects and thus requires the Oid class. To use this class, -// set oid, value then call valid() to be sure object was constructed correctly. -// -// = AUTHOR -// Peter E Mellquist -// ============================================================================ +//============================================================================= +/** + * @file vb.h + * + * $Id$ + * + * This module contains the class definition for the variable binding (VB) + * class. The VB class is an encapsulation of a SNMP VB. A VB object is + * composed of one SNMP++ Oid and one SMI value. The Vb class utilizes Oid + * objects and thus requires the Oid class. To use this class, + * set oid, value then call valid() to be sure object was constructed correctly. + * + * + * @author Peter E Mellquist + */ +//============================================================================= + /*=================================================================== Copyright (c) 1996 Hewlett-Packard Company @@ -65,139 +62,144 @@ // The vb class keeps its own memory for objects and does not // utilize pointers to external data structures. // +/** + * @class Vb + * + * @brief Implement the concrete Variable Bindings aka Varbind + * composite type. Varbinds hold 1 Oid and 1 Value (Any SMI value) + */ class ASNMP_Export Vb - // = TITLE - // Implement the concrete Variable Bindings aka Varbind - // composite type. Varbinds hold 1 Oid and 1 Value (Any SMI value) { public: + /// constructor with no arguments + /// makes an vb, unitialized (does not make object valid) Vb( void); - // constructor with no arguments - // makes an vb, unitialized (does not make object valid) + /// constructor to initialize the oid + /// makes a vb with oid portion initialized (does not make object valid) Vb( const Oid &oid); - // constructor to initialize the oid - // makes a vb with oid portion initialized (does not make object valid) + /// constructor to initialize the oid + /// makes a vb with oid portion and value portion initialized, (valid) Vb( const Oid& vb, const SnmpSyntax &val, const SmiUINT32=SNMP_CLASS_SUCCESS); - // constructor to initialize the oid - // makes a vb with oid portion and value portion initialized, (valid) + /// copy constructor Vb( const Vb &vb); - // copy constructor + /** + * destructor + * if the vb has a oid or an octect string then + * the associated memory needs to be freed + */ ~Vb(); - // destructor - // if the vb has a oid or an octect string then - // the associated memory needs to be freed + /// return validity of Vb object (both oid and value set return 1 else 0) int valid() const; - // return validity of Vb object (both oid and value set return 1 else 0) + /// assignment to another Vb object overloaded Vb& operator=( const Vb &vb); - // assignment to another Vb object overloaded + /// equivlence operator overloaded friend ASNMP_Export bool operator==( const Vb &lhs, const Vb &rhs); - // equivlence operator overloaded //-----[ set oid / get oid part]------------------------------------------ + /// set value oid only with another oid void set_oid( const Oid& oid); - // set value oid only with another oid + /// get oid portion void get_oid( Oid &oid) const; - // get oid portion //-----[ set value part]-------------------------------------------------- + /// set a Vb null, if its not already void set_null(); - // set a Vb null, if its not already + /// returns 0 on success and a value void set_value( const TimeTicks& ticks); - // returns 0 on success and a value + /// returns 0 on success and a value void set_value( const Oid& oid); - // returns 0 on success and a value + /// returns 0 on success and a value void set_value( const Counter32& ctr); - // returns 0 on success and a value + /// returns 0 on success and a value void set_value( const Counter64& ctr); - // returns 0 on success and a value + /// returns 0 on success and a value void set_value( const Gauge32& ctr); - // returns 0 on success and a value + /// returns 0 on success and a value void set_value( const SnmpUInt32& ctr); - // returns 0 on success and a value + /// returns 0 on success and a value void set_value( const SnmpInt32& ctr); - // returns 0 on success and a value + /// get an octet string object void set_value( const OctetStr& oct_str); - // get an octet string object //----[ get value ]------------------------------------------------ + /// returns 0 on success and a value int get_value( TimeTicks& ticks); - // returns 0 on success and a value + /// returns 0 on success and a value int get_value( Oid& oid); - // returns 0 on success and a value + /// returns 0 on success and a value int get_value( Counter32& ctr); - // returns 0 on success and a value + /// returns 0 on success and a value int get_value( Counter64& ctr); - // returns 0 on success and a value + /// returns 0 on success and a value int get_value( Gauge32& ctr); - // returns 0 on success and a value + /// returns 0 on success and a value int get_value( SnmpUInt32& ctr); - // returns 0 on success and a value + /// returns 0 on success and a value int get_value( SnmpInt32& ctr); - // returns 0 on success and a value + /// get an octet string object int get_value( OctetStr& oct_str); - // get an octet string object // escape hatch + /// for other derived types that can be casted void set_value( const SnmpSyntax &val); - // for other derived types that can be casted + /// gets a general value int get_value( SnmpSyntax &val); - // gets a general value + /// return the current syntax + /// Or.. if a V2 VB exception is present then return the exception value SmiUINT32 get_syntax(); - // return the current syntax - // Or.. if a V2 VB exception is present then return the exception value + /// set the exception status friend ASNMP_Export void set_exception_status( Vb *vb, const SmiUINT32 status); - // set the exception status + /// return fomatted version of this object const char *to_string(); - // return fomatted version of this object + /// returns a formatted version of the value const char *to_string_value(); - // returns a formatted version of the value + /// returns a formatted version of the value const char *to_string_oid(); - // returns a formatted version of the value protected: + /// display vb as [ oid / value ] char *output_; - // display vb as [ oid / value ] + /// a vb is made up of a oid Oid iv_vb_oid_; - // a vb is made up of a oid + /// and a value... SnmpSyntax *iv_vb_value_; - // and a value... + /// are there any vb exceptions?? SmiUINT32 exception_status_; - // are there any vb exceptions?? void free_vb(); }; diff --git a/ASNMP/asnmp/wpdu.h b/ASNMP/asnmp/wpdu.h index 1485560baeb..7feec356bc8 100644 --- a/ASNMP/asnmp/wpdu.h +++ b/ASNMP/asnmp/wpdu.h @@ -1,24 +1,21 @@ /* -*-C++-*- */ -// $Id$ #ifndef WPDU_H_ #define WPDU_H_ -// ============================================================================ -// -// = LIBRARY -// asnmp -// -// = FILENAME -// wpdu.h -// -// = DESCRIPTION -// Adapter class. Converts a Pdu and GenTarget into a format -// that can be stuffed out a I/O port -// -// = AUTHOR -// Michael R. MacFaden re-worked api, use ACE API -// Peter E Mellquist wrote original class snmpmsg -// -// ============================================================================ +//============================================================================= +/** + * @file wpdu.h + * + * $Id$ + * + * Adapter class. Converts a Pdu and GenTarget into a format + * that can be stuffed out a I/O port + * + * + * @author Michael R. MacFaden re-worked api + * @author use ACE APIPeter E Mellquist wrote original class snmpmsg + */ +//============================================================================= + #include "ace/config-all.h" @@ -34,32 +31,34 @@ // PDU / Target -> iovec buffer // iovec buffer -> PDU / Target struct snmp_pdu; +/** + * @class wpdu + * + * @brief Implement an Adapter pattern between CMU SNMP and HP SNMP++ + */ class ASNMP_Export wpdu - // = TITLE - // Implement an Adapter pattern between CMU SNMP and HP SNMP++ - // { public: + /// construct CMU data from HP SNMP++ objects + /// construct HP SNMP++ objects from raw buffer via CMU SNMP datatypes wpdu(const Pdu& pdu, const UdpTarget& target); - // construct CMU data from HP SNMP++ objects wpdu(const iovec& buffer); - // construct HP SNMP++ objects from raw buffer via CMU SNMP datatypes wpdu(); // same as using iovec? ~wpdu(); + /// constructor completed ok? rc = 1 else 0 int valid() const; - // constructor completed ok? rc = 1 else 0 + /// return raw data stream via CMU code const iovec& get_buffer() const; - // return raw data stream via CMU code + /// return HP SNMP++ pdu int get_pdu(Pdu& pdu, snmp_version& version); - // return HP SNMP++ pdu + /// return community strptr const unsigned char *get_community() const; - // return community strptr private: int convert_vb_to_smival( Vb &tempvb, SmiVALUE *smival ); @@ -69,14 +68,14 @@ private: static void copy_iovec(iovec& dest, const iovec& src); int set_trap_info(snmp_pdu *raw_pdu, const Pdu& pdu) const; + /// raw format iovec iovec_; - // raw format + /// object construction state int valid_flag_; - // object construction state + /// snmp version snmp_version version_; - // snmp version unsigned char community_name[MAX_COMM_STR_LEN]; unsigned long comm_len; // = MAX_COMM_STR_LEN; |