SNMP++  3.3.4
Address Class Referenceabstract

Base class of all Address classes. More...

#include <address.h>

Inheritance diagram for Address:
Collaboration diagram for Address:

Public Types

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...
 

Public Member Functions

 Address ()
 Default constructor, clears the buffer and sets valid flag to false. More...
 
virtual ~Address ()
 Allow destruction of derived classes. More...
 
virtual operator const char * () const =0
 Overloaded operator for streaming output. More...
 
virtual bool valid () const
 Return if the object contains a valid address. More...
 
virtual int get_asn1_length () const =0
 Return the space needed for serialization. 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 int get_length () const =0
 Get the length of the binary address (accessible through operator[]). More...
 
virtual addr_type get_type () const =0
 Get the type of the address. More...
 
virtual Addressoperator= (const Address &val)=0
 Overloaded assignment operator. More...
 
virtual Addressoperator= (const char *str)
 
virtual unsigned int hashFunction () const
 
- Public Member Functions inherited from SnmpSyntax
virtual const char * get_printable () const =0
 Virtual function for getting a printable ASCII value for any SNMP value. More...
 
virtual SmiUINT32 get_syntax () const =0
 Return the current syntax. More...
 
virtual SnmpSyntaxclone () const =0
 Virtual clone operation for creating a new Value from an existing value. More...
 
virtual ~SnmpSyntax ()
 Virtual destructor to ensure deletion of derived classes... More...
 
virtual SnmpSyntaxoperator= (const SnmpSyntax &)=0
 Overloaded assignment operator. More...
 

Protected Member Functions

virtual bool parse_address (const char *inaddr)=0
 
virtual void format_output () const =0
 
void trim_white_space (char *ptr)
 Trim of whitespaces at the start and the end of the string. More...
 
virtual bool is_gen_address () const
 Is this a GenAddress object. More...
 
void clear ()
 Reset the object. More...
 
- Protected Member Functions inherited from SnmpSyntax
 SnmpSyntax ()
 

Protected Attributes

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

Friends

class GenAddress
 
DLLOPT friend int operator== (const Address &lhs, const Address &rhs)
 overloaded equivlence operator, are two addresses equal? More...
 
DLLOPT friend int operator!= (const Address &lhs, const Address &rhs)
 overloaded not equivlence operator, are two addresses not equal? More...
 
DLLOPT friend int operator> (const Address &lhs, const Address &rhs)
 overloaded > operator, is a1 > a2 More...
 
DLLOPT friend int operator>= (const Address &lhs, const Address &rhs)
 overloaded >= operator, is a1 >= a2 More...
 
DLLOPT friend int operator< (const Address &lhs, const Address &rhs)
 overloaded < operator, is a1 < a2 More...
 
DLLOPT friend int operator<= (const Address &lhs, const Address &rhs)
 overloaded <= operator, is a1 <= a2 More...
 
DLLOPT friend int operator== (const Address &lhs, const char *rhs)
 equivlence operator overloaded, are an address and a string equal? More...
 
DLLOPT friend int operator!= (const Address &lhs, const char *rhs)
 overloaded not equivlence operator, are an address and string not equal? More...
 
DLLOPT friend int operator> (const Address &lhs, const char *rhs)
 overloaded < , is an address greater than a string? More...
 
DLLOPT friend int operator>= (const Address &lhs, const char *rhs)
 overloaded >=, is an address greater than or equal to a string? More...
 
DLLOPT friend int operator< (const Address &lhs, const char *rhs)
 overloaded < , is an address less than a string? More...
 
DLLOPT friend int operator<= (const Address &lhs, const char *rhs)
 overloaded <=, is an address less than or equal to a string? More...
 

Detailed Description

Base class of all Address classes.

Definition at line 125 of file address.h.

Member Enumeration Documentation

Type returned by Address::get_type().

Enumerator
type_ip 

IpAddress (IPv4 or IPv6)

type_ipx 

IpxAddress.

type_udp 

UdpAddress (IPv4 or IPv6)

type_ipxsock 

IpxSockAddress.

type_mac 

MacAddress.

type_invalid 

Used by GenAddress::get_type() if address is not valid.

Definition at line 134 of file address.h.

Type returned by IpAddress::get_ip_version() and UdpAddress::get_ip_version().

Enumerator
version_ipv4 

IPv4.

version_ipv6 

IPv6.

Definition at line 148 of file address.h.

Constructor & Destructor Documentation

Address::Address ( )

Default constructor, clears the buffer and sets valid flag to false.

virtual Address::~Address ( )
inlinevirtual

Allow destruction of derived classes.

Definition at line 162 of file address.h.

Member Function Documentation

void Address::clear ( )
protectedvirtual

Reset the object.

Implements SnmpSyntax.

Reimplemented in GenAddress, UdpAddress, and IpAddress.

Referenced by UdpAddress::clear().

virtual void Address::format_output ( ) const
protectedpure virtual

Implemented in GenAddress, UdpAddress, and IpAddress.

virtual int Address::get_asn1_length ( ) const
pure virtual

Return the space needed for serialization.

Implements SnmpSyntax.

Implemented in GenAddress, UdpAddress, and IpAddress.

virtual int Address::get_length ( ) const
pure virtual

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

Implemented in GenAddress, UdpAddress, and IpAddress.

virtual addr_type Address::get_type ( ) const
pure virtual

Get the type of the address.

See Also
Address::addr_type

Implemented in GenAddress, UdpAddress, and IpAddress.

virtual unsigned int Address::hashFunction ( ) const
inlinevirtual

Definition at line 265 of file address.h.

virtual bool Address::is_gen_address ( ) const
inlineprotectedvirtual

Is this a GenAddress object.

Reimplemented in GenAddress.

Definition at line 290 of file address.h.

virtual Address::operator const char * ( ) const
pure virtual

Overloaded operator for streaming output.

Returns
String containing the numerical address

Implemented in GenAddress, UdpAddress, and IpAddress.

virtual Address& Address::operator= ( const Address val)
pure virtual

Overloaded assignment operator.

Implemented in GenAddress, UdpAddress, and IpAddress.

virtual Address& Address::operator= ( const char *  str)
inlinevirtual

Definition at line 262 of file address.h.

References addr_changed, GenAddress::parse_address(), and valid_flag.

unsigned char& Address::operator[] ( const int  position)
inline

Access as an array (read and write).

Note
Only pass in values between 0 and get_length().
Parameters
position- pos to return
Returns
reference to the byte at the given position

Definition at line 230 of file address.h.

References addr_changed, ADDRBUF, address_buffer, and valid_flag.

unsigned char Address::operator[] ( const int  position) const
inline

Access as an array (read only).

Note
Only pass in values between 0 and get_length().
Parameters
position- pos to return
Returns
the byte at the given position

Definition at line 242 of file address.h.

References ADDRBUF, and address_buffer.

virtual bool Address::parse_address ( const char *  inaddr)
protectedpure virtual

Implemented in GenAddress, UdpAddress, and IpAddress.

void Address::trim_white_space ( char *  ptr)
protected

Trim of whitespaces at the start and the end of the string.

Parameters
ptr- string to trim
virtual bool Address::valid ( ) const
inlinevirtual

Return if the object contains a valid address.

Returns
true if the object is valid

Implements SnmpSyntax.

Definition at line 216 of file address.h.

References valid_flag.

Friends And Related Function Documentation

friend class GenAddress
friend

Definition at line 127 of file address.h.

DLLOPT friend int operator!= ( const Address lhs,
const Address rhs 
)
friend

overloaded not equivlence operator, are two addresses not equal?

Definition at line 168 of file address.h.

DLLOPT friend int operator!= ( const Address lhs,
const char *  rhs 
)
friend

overloaded not equivlence operator, are an address and string not equal?

Definition at line 189 of file address.h.

DLLOPT friend int operator< ( const Address lhs,
const Address rhs 
)
friend

overloaded < operator, is a1 < a2

DLLOPT friend int operator< ( const Address lhs,
const char *  rhs 
)
friend

overloaded < , is an address less than a string?

DLLOPT friend int operator<= ( const Address lhs,
const Address rhs 
)
friend

overloaded <= operator, is a1 <= a2

Definition at line 182 of file address.h.

DLLOPT friend int operator<= ( const Address lhs,
const char *  rhs 
)
friend

overloaded <=, is an address less than or equal to a string?

DLLOPT friend int operator== ( const Address lhs,
const Address rhs 
)
friend

overloaded equivlence operator, are two addresses equal?

DLLOPT friend int operator== ( const Address lhs,
const char *  rhs 
)
friend

equivlence operator overloaded, are an address and a string equal?

DLLOPT friend int operator> ( const Address lhs,
const Address rhs 
)
friend

overloaded > operator, is a1 > a2

DLLOPT friend int operator> ( const Address lhs,
const char *  rhs 
)
friend

overloaded < , is an address greater than a string?

DLLOPT friend int operator>= ( const Address lhs,
const Address rhs 
)
friend

overloaded >= operator, is a1 >= a2

Definition at line 175 of file address.h.

DLLOPT friend int operator>= ( const Address lhs,
const char *  rhs 
)
friend

overloaded >=, is an address greater than or equal to a string?

Member Data Documentation

SNMP_PP_MUTABLE bool Address::addr_changed
protected

Definition at line 268 of file address.h.

Referenced by operator=(), and operator[]().

unsigned char Address::address_buffer[ADDRBUF]
protected

Definition at line 270 of file address.h.

Referenced by operator[]().

bool Address::valid_flag
protected

Definition at line 269 of file address.h.

Referenced by operator=(), operator[](), and valid().


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