SNMP++  3.3.4
UdpAddress Class Reference

#include <address.h>

Inheritance diagram for UdpAddress:
Collaboration diagram for UdpAddress:

Public Member Functions

 UdpAddress ()
 Construct an empty invalid UDP address. More...
 
 UdpAddress (const char *inaddr)
 Construct an UDP address from a string. More...
 
 UdpAddress (const UdpAddress &udpaddr)
 Construct an UDP address from another UDP address. More...
 
 UdpAddress (const GenAddress &genaddr)
 Construct an UDP address from a GenAddress. More...
 
 UdpAddress (const IpAddress &ipaddr)
 Construct an UDP address from a IP address. More...
 
 ~UdpAddress ()
 Destructor (ensure that SnmpSyntax::~SnmpSyntax() is overridden). More...
 
virtual SnmpSyntaxoperator= (const SnmpSyntax &val)
 Map other SnmpSyntax objects to UdpAddress. More...
 
virtual Addressoperator= (const Address &val)
 Map other Address objects to UdpAddress. More...
 
virtual UdpAddressoperator= (const UdpAddress &udpaddr)
 Overloaded assignment operator for UdpAddress. More...
 
virtual UdpAddressoperator= (const IpAddress &ipaddr)
 Overloaded assignment operator for IpAddress. 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 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...
 
void set_port (const unsigned short p)
 Set the port number. More...
 
unsigned short get_port () const
 Get the port number. More...
 
virtual int get_length () const
 Get the length of the binary address (accessible through operator[]). More...
 
virtual addr_type get_type () const
 Return the type of the address. More...
 
virtual bool map_to_ipv6 ()
 Map a IPv4 UDP address to a IPv6 UDP address. More...
 
void clear ()
 Reset the object. More...
 
virtual bool set_scope (const unsigned int scope)
 Set the IPv6 scope. More...
 
- Public Member Functions inherited from IpAddress
 IpAddress ()
 Construct an empty invalid IP address. More...
 
 IpAddress (const char *inaddr)
 Construct an IP address from a string. More...
 
 IpAddress (const IpAddress &ipaddr)
 Construct an IP address from another IP address. More...
 
 IpAddress (const GenAddress &genaddr)
 Construct an IP address from a GenAddress. More...
 
 ~IpAddress ()
 Destructor (ensure that SnmpSyntax::~SnmpSyntax() is overridden). More...
 
char * friendly_name (int &status)
 Return the friendly name. More...
 
void mask (const IpAddress &ipaddr)
 Logically AND the address with the param. More...
 
int get_match_bits (const IpAddress match_ip) const
 Get the count of matching bits from the left. More...
 
virtual version_type get_ip_version () const
 Return the IP version of the address. More...
 
virtual unsigned int get_scope () const
 Get the IPv6 scope. More...
 
bool has_ipv6_scope () const
 
- 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 *inaddr)
 
virtual void format_output () const
 
- Protected Member Functions inherited from IpAddress
int parse_dotted_ipstring (const char *inaddr)
 
int parse_coloned_ipstring (const char *inaddr)
 
int addr_to_friendly ()
 
- 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...
 
virtual bool is_gen_address () const
 Is this a GenAddress object. More...
 
- Protected Member Functions inherited from SnmpSyntax
 SnmpSyntax ()
 

Protected Attributes

SNMP_PP_MUTABLE char output_buffer [OUTBUFF]
 
char sep
 
- Protected Attributes inherited from IpAddress
SNMP_PP_MUTABLE char output_buffer [OUTBUFF]
 
char iv_friendly_name [MAX_FRIENDLY_NAME]
 
int iv_friendly_name_status
 
version_type ip_version
 
bool have_ipv6_scope
 
- 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 499 of file address.h.

Constructor & Destructor Documentation

UdpAddress::UdpAddress ( )

Construct an empty invalid UDP address.

UdpAddress::UdpAddress ( const char *  inaddr)

Construct an UDP address from a string.

The following formats can be used additional to those recognized by IpAdress:

  • Port added to IPv4 address with '/' or ':' ("192.168.17.1:161", "192.168.17.1/161", "printsrv/161")
  • Port added to IPv6 address with '/' or using '[...]:' ("::1/162", "[::1]/162", "[::1]:162")
Parameters
inaddr- Hostname or IP address
UdpAddress::UdpAddress ( const UdpAddress udpaddr)

Construct an UDP address from another UDP address.

Parameters
udpaddr- address to copy
UdpAddress::UdpAddress ( const GenAddress genaddr)

Construct an UDP address from a GenAddress.

Parameters
genaddr- address to copy
UdpAddress::UdpAddress ( const IpAddress ipaddr)

Construct an UDP address from a IP address.

The port will be set to 0.

Parameters
ipaddr- address to copy
UdpAddress::~UdpAddress ( )
inline

Destructor (ensure that SnmpSyntax::~SnmpSyntax() is overridden).

Definition at line 546 of file address.h.

Member Function Documentation

void UdpAddress::clear ( )
inlinevirtual

Reset the object.

Reimplemented from IpAddress.

Definition at line 643 of file address.h.

References Address::clear().

SnmpSyntax* UdpAddress::clone ( ) const
inlinevirtual

Clone this object.

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

Reimplemented from IpAddress.

Definition at line 587 of file address.h.

virtual void UdpAddress::format_output ( ) const
protectedvirtual

Reimplemented from IpAddress.

virtual int UdpAddress::get_asn1_length ( ) const
inlinevirtual

Return the space needed for serialization.

Reimplemented from IpAddress.

Definition at line 580 of file address.h.

virtual int UdpAddress::get_length ( ) const
inlinevirtual

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

Reimplemented from IpAddress.

Definition at line 622 of file address.h.

References UDPIP6LEN_NO_SCOPE, UDPIP6LEN_WITH_SCOPE, and UDPIPLEN.

unsigned short UdpAddress::get_port ( ) const

Get the port number.

Returns
The port number, or 0 is the object is not valid.
virtual const char* UdpAddress::get_printable ( ) const
inlinevirtual

Get a printable ASCII value of the address.

Returns
String containing the numerical address

Reimplemented from IpAddress.

Definition at line 594 of file address.h.

SmiUINT32 UdpAddress::get_syntax ( ) const
inlinevirtual

Return the syntax.

Returns
This method always returns sNMP_SYNTAX_OCTETS.

Reimplemented from IpAddress.

Definition at line 575 of file address.h.

References sNMP_SYNTAX_OCTETS.

virtual addr_type UdpAddress::get_type ( ) const
inlinevirtual

Return the type of the address.

See Also
Address::addr_type
Returns
Always Address:type_udp

Reimplemented from IpAddress.

Definition at line 631 of file address.h.

virtual bool UdpAddress::map_to_ipv6 ( )
virtual

Map a IPv4 UDP address to a IPv6 UDP address.

Returns
- TRUE if no error occured.

Reimplemented from IpAddress.

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

Overloaded operator for streaming output.

Returns
String containing the numerical address

Reimplemented from IpAddress.

Definition at line 602 of file address.h.

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

Map other SnmpSyntax objects to UdpAddress.

Reimplemented from IpAddress.

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

Map other Address objects to UdpAddress.

Reimplemented from IpAddress.

virtual UdpAddress& UdpAddress::operator= ( const UdpAddress udpaddr)
virtual

Overloaded assignment operator for UdpAddress.

virtual UdpAddress& UdpAddress::operator= ( const IpAddress ipaddr)
virtual

Overloaded assignment operator for IpAddress.

Reimplemented from IpAddress.

virtual bool UdpAddress::parse_address ( const char *  inaddr)
protectedvirtual

Reimplemented from IpAddress.

void UdpAddress::set_port ( const unsigned short  p)

Set the port number.

Note
If the object is not valid(), the port may not be set.
virtual bool UdpAddress::set_scope ( const unsigned int  scope)
virtual

Set the IPv6 scope.

Reimplemented from IpAddress.

Member Data Documentation

SNMP_PP_MUTABLE char UdpAddress::output_buffer[OUTBUFF]
protected

Definition at line 652 of file address.h.

char UdpAddress::sep
protected

Definition at line 653 of file address.h.


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