SNMP++  3.3.4
GenAddress Class Reference

#include <address.h>

Inheritance diagram for GenAddress:
Collaboration diagram for GenAddress:

Public Member Functions

 GenAddress ()
 Construct an empty invalid generic address object. More...
 
 GenAddress (const char *addr, const Address::addr_type use_type=Address::type_invalid)
 Construct a generic address from a string. More...
 
 GenAddress (const Address &addr)
 Construct a generic address from an Address object. More...
 
 GenAddress (const GenAddress &addr)
 Construct a generic address from another generic address object. More...
 
 ~GenAddress ()
 Destructor, free memory. More...
 
SmiUINT32 get_syntax () const
 Return the syntax. More...
 
virtual int get_asn1_length () const
 Return the space needed for serialization. More...
 
SnmpSyntaxclone () const
 Clone this object. More...
 
virtual GenAddressoperator= (const GenAddress &addr)
 Overloaded assignment operator for a GenAddress. More...
 
virtual Addressoperator= (const Address &addr)
 Overloaded assignment operator for a Address. More...
 
virtual SnmpSyntaxoperator= (const SnmpSyntax &val)
 Map other SnmpSyntax objects to GenAddress. More...
 
virtual const char * get_printable () const
 Get a printable ASCII value of the address. More...
 
virtual operator const char * () const
 Overloaded operator for streaming output. More...
 
virtual int get_length () const
 Get the length of the binary address (accessible through operator[]). More...
 
void clear ()
 Reset the object. More...
 
virtual addr_type get_type () const
 Return the type of the address. More...
 
const IpAddresscast_ipaddress () const
 Access the protected address. More...
 
const UdpAddresscast_udpaddress () const
 Access the protected address. More...
 
- Public Member Functions inherited from Address
 Address ()
 Default constructor, clears the buffer and sets valid flag to false. More...
 
virtual ~Address ()
 Allow destruction of derived classes. More...
 
virtual bool valid () const
 Return if the object contains a valid address. More...
 
unsigned char & operator[] (const int position)
 Access as an array (read and write). More...
 
unsigned char operator[] (const int position) const
 Access as an array (read only). More...
 
virtual Addressoperator= (const char *str)
 
virtual unsigned int hashFunction () const
 
- Public Member Functions inherited from SnmpSyntax
virtual ~SnmpSyntax ()
 Virtual destructor to ensure deletion of derived classes... More...
 

Protected Member Functions

virtual bool parse_address (const char *addr)
 
virtual bool parse_address (const char *addr, const Address::addr_type use_type)
 
virtual void format_output () const
 
virtual bool is_gen_address () const
 Is this a GenAddress object. More...
 
- Protected Member Functions inherited from Address
void trim_white_space (char *ptr)
 Trim of whitespaces at the start and the end of the string. More...
 
- Protected Member Functions inherited from SnmpSyntax
 SnmpSyntax ()
 

Protected Attributes

Addressaddress
 
char output_buffer [1]
 
- Protected Attributes inherited from Address
SNMP_PP_MUTABLE bool addr_changed
 
bool valid_flag
 
unsigned char address_buffer [ADDRBUF]
 
- Protected Attributes inherited from SnmpSyntax
SmiVALUE smival
 

Additional Inherited Members

- Public Types inherited from Address
enum  addr_type {
  type_ip, type_ipx, type_udp, type_ipxsock,
  type_mac, type_invalid
}
 Type returned by Address::get_type(). More...
 
enum  version_type { version_ipv4, version_ipv6 }
 Type returned by IpAddress::get_ip_version() and UdpAddress::get_ip_version(). More...
 

Detailed Description

Definition at line 974 of file address.h.

Constructor & Destructor Documentation

GenAddress::GenAddress ( )

Construct an empty invalid generic address object.

GenAddress::GenAddress ( const char *  addr,
const Address::addr_type  use_type = Address::type_invalid 
)

Construct a generic address from a string.

To optimize the speed of the parsing method, use_type can be used to indicate that the address string is of the specified type.

Parameters
addr- address string
use_type- if this value is set, the input string is only parsed for the given type
GenAddress::GenAddress ( const Address addr)

Construct a generic address from an Address object.

Parameters
addr- Any address object
GenAddress::GenAddress ( const GenAddress addr)

Construct a generic address from another generic address object.

Parameters
addr- Generic address object to copy
GenAddress::~GenAddress ( )
inline

Destructor, free memory.

Definition at line 1012 of file address.h.

Member Function Documentation

const IpAddress& GenAddress::cast_ipaddress ( ) const
inline

Access the protected address.

The caller must make sure that this GenAddress object ist valid() and is of the right type (get_type()).

Definition at line 1094 of file address.h.

const UdpAddress& GenAddress::cast_udpaddress ( ) const
inline

Access the protected address.

The caller must make sure that this GenAddress object ist valid() and is of the right type (get_type()).

Definition at line 1101 of file address.h.

void GenAddress::clear ( )
inlinevirtual

Reset the object.

Reimplemented from Address.

Definition at line 1078 of file address.h.

SnmpSyntax* GenAddress::clone ( ) const
inlinevirtual

Clone this object.

Returns
Pointer to the newly created object (allocated through new).

Implements SnmpSyntax.

Definition at line 1035 of file address.h.

virtual void GenAddress::format_output ( ) const
inlineprotectedvirtual

Implements Address.

Definition at line 1142 of file address.h.

virtual int GenAddress::get_asn1_length ( ) const
inlinevirtual

Return the space needed for serialization.

Implements Address.

Definition at line 1027 of file address.h.

virtual int GenAddress::get_length ( ) const
inlinevirtual

Get the length of the binary address (accessible through operator[]).

Implements Address.

Definition at line 1072 of file address.h.

virtual const char* GenAddress::get_printable ( ) const
inlinevirtual

Get a printable ASCII value of the address.

Returns
String containing the numerical address

Implements SnmpSyntax.

Definition at line 1058 of file address.h.

SmiUINT32 GenAddress::get_syntax ( ) const
inlinevirtual

Return the syntax.

Returns
This method returns sNMP_SYNTAX_IPADDR, sNMP_SYNTAX_OCTETS or sNMP_SYNTAX_NULL if the generic address does not have an address object.

Implements SnmpSyntax.

Definition at line 1021 of file address.h.

References sNMP_SYNTAX_NULL.

virtual addr_type GenAddress::get_type ( ) const
inlinevirtual

Return the type of the address.

See Also
Address::addr_type
Returns
Type of the contained address object or Address::type_invalid if it is not valid().

Implements Address.

Definition at line 1086 of file address.h.

virtual bool GenAddress::is_gen_address ( ) const
inlineprotectedvirtual

Is this a GenAddress object.

Reimplemented from Address.

Definition at line 1147 of file address.h.

virtual GenAddress::operator const char * ( ) const
inlinevirtual

Overloaded operator for streaming output.

Returns
String containing the numerical address

Implements Address.

Definition at line 1066 of file address.h.

virtual GenAddress& GenAddress::operator= ( const GenAddress addr)
virtual

Overloaded assignment operator for a GenAddress.

virtual Address& GenAddress::operator= ( const Address addr)
virtual

Overloaded assignment operator for a Address.

Implements Address.

virtual SnmpSyntax& GenAddress::operator= ( const SnmpSyntax val)
virtual

Map other SnmpSyntax objects to GenAddress.

Implements SnmpSyntax.

virtual bool GenAddress::parse_address ( const char *  addr)
inlineprotectedvirtual

Implements Address.

Definition at line 1135 of file address.h.

References Address::type_invalid.

Referenced by Address::operator=().

virtual bool GenAddress::parse_address ( const char *  addr,
const Address::addr_type  use_type 
)
protectedvirtual

Member Data Documentation

Address* GenAddress::address
protected

Definition at line 1131 of file address.h.

char GenAddress::output_buffer[1]
protected

Definition at line 1132 of file address.h.


The documentation for this class was generated from the following file: