Main Page | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

Address Class Reference

#include <address.h>

Inheritance diagram for Address:

[legend]
Collaboration diagram for Address:
[legend]
List of all members.

Detailed Description

Base class of all Address classes.

Definition at line 135 of file address.h.

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.

virtual ~Address ()
 Allow destruction of derived classes.

virtual operator const char * () const=0
 Overloaded operator for streaming output.

virtual bool valid () const
 Return if the object contains a valid address.

virtual int get_asn1_length () const=0
 Return the space needed for serialization.

unsigned char & operator[] (const int position)
 Access as an array (read and write).

unsigned char operator[] (const int position) const
 Access as an array (read only).

virtual int get_length () const=0
 Get the length of the binary address (accessible through operator[]).

virtual addr_type get_type () const=0
 Get the type of the address.

virtual SnmpSyntaxoperator= (const SnmpSyntax &val)=0
 Overloaded assignment operator.

virtual unsigned int hashFunction () const

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.

virtual bool is_gen_address () const
 Is this a GenAddress object.

void clear ()
 Reset the object.


Protected Attributes

bool addr_changed
bool valid_flag
unsigned char address_buffer [BUFSIZE]

Friends

class GenAddress
DLLOPT friend int operator== (const Address &lhs, const Address &rhs)
 overloaded equivlence operator, are two addresses equal?

DLLOPT friend int operator!= (const Address &lhs, const Address &rhs)
 overloaded not equivlence operator, are two addresses not equal?

DLLOPT friend int operator> (const Address &lhs, const Address &rhs)
 overloaded > operator, is a1 > a2

DLLOPT friend int operator>= (const Address &lhs, const Address &rhs)
 overloaded >= operator, is a1 >= a2

DLLOPT friend int operator< (const Address &lhs, const Address &rhs)
 overloaded < operator, is a1 < a2

DLLOPT friend int operator<= (const Address &lhs, const Address &rhs)
 overloaded <= operator, is a1 <= a2

DLLOPT friend int operator== (const Address &lhs, const char *rhs)
 equivlence operator overloaded, are an address and a string equal?

DLLOPT friend int operator!= (const Address &lhs, const char *rhs)
 overloaded not equivlence operator, are an address and string not equal?

DLLOPT friend int operator> (const Address &lhs, const char *rhs)
 overloaded < , is an address greater than a string?

DLLOPT friend int operator>= (const Address &lhs, const char *rhs)
 overloaded >=, is an address greater than or equal to a string?

DLLOPT friend int operator< (const Address &lhs, const char *rhs)
 overloaded < , is an address less than a string?

DLLOPT friend int operator<= (const Address &lhs, const char *rhs)
 overloaded <=, is an address less than or equal to a string?


Member Enumeration Documentation

enum Address::addr_type
 

Type returned by Address::get_type().

Enumeration values:
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 144 of file address.h.

enum Address::version_type
 

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

Enumeration values:
version_ipv4  IPv4.
version_ipv6  IPv6.

Definition at line 158 of file address.h.


Constructor & Destructor Documentation

Address::Address  ) 
 

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

virtual Address::~Address  )  [inline, virtual]
 

Allow destruction of derived classes.

Definition at line 172 of file address.h.


Member Function Documentation

void Address::clear  )  [protected, virtual]
 

Reset the object.

Implements SnmpSyntax.

Reimplemented in IpAddress, UdpAddress, and GenAddress.

Referenced by UdpAddress::clear().

virtual void Address::format_output  )  const [protected, pure virtual]
 

Implemented in IpAddress, UdpAddress, and GenAddress.

virtual int Address::get_asn1_length  )  const [pure virtual]
 

Return the space needed for serialization.

Implements SnmpSyntax.

Implemented in IpAddress, UdpAddress, and GenAddress.

virtual int Address::get_length  )  const [pure virtual]
 

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

Implemented in IpAddress, UdpAddress, and GenAddress.

virtual addr_type Address::get_type  )  const [pure virtual]
 

Get the type of the address.

See also:
Address::addr_type

Implemented in IpAddress, UdpAddress, and GenAddress.

virtual unsigned int Address::hashFunction  )  const [inline, virtual]
 

Definition at line 273 of file address.h.

virtual bool Address::is_gen_address  )  const [inline, protected, virtual]
 

Is this a GenAddress object.

Reimplemented in GenAddress.

Definition at line 298 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 IpAddress, UdpAddress, and GenAddress.

virtual SnmpSyntax& Address::operator= const SnmpSyntax val  )  [pure virtual]
 

Overloaded assignment operator.

Reimplemented from SnmpSyntax.

Implemented in IpAddress, UdpAddress, and GenAddress.

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 252 of file address.h.

References BUFSIZE.

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 240 of file address.h.

References BUFSIZE.

virtual bool Address::parse_address const char *  inaddr  )  [protected, pure virtual]
 

Implemented in IpAddress, UdpAddress, and GenAddress.

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 [inline, virtual]
 

Return if the object contains a valid address.

Returns:
true if the object is valid

Implements SnmpSyntax.

Definition at line 226 of file address.h.


Friends And Related Function Documentation

friend class GenAddress [friend]
 

Definition at line 137 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 199 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 178 of file address.h.

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

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 <= operator, is a1 <= a2

Definition at line 192 of file address.h.

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 equivlence operator, are two addresses equal?

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

DLLOPT friend int operator>= const Address lhs,
const char *  rhs
[friend]
 

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

DLLOPT friend int operator>= const Address lhs,
const Address rhs
[friend]
 

overloaded >= operator, is a1 >= a2

Definition at line 185 of file address.h.


Member Data Documentation

bool Address::addr_changed [protected]
 

Definition at line 276 of file address.h.

unsigned char Address::address_buffer[BUFSIZE] [protected]
 

Definition at line 278 of file address.h.

bool Address::valid_flag [protected]
 

Definition at line 277 of file address.h.


The documentation for this class was generated from the following file:
Generated on Tue Jan 4 22:42:14 2005 for SNMP++ by doxygen 1.3.2