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

UdpAddress Class Reference

#include <address.h>

Inheritance diagram for UdpAddress:

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

Public Member Functions

 UdpAddress ()
 Construct an empty invalid UDP address.

 UdpAddress (const char *inaddr)
 Construct an UDP address from a string.

 UdpAddress (const UdpAddress &udpaddr)
 Construct an UDP address from another UDP address.

 UdpAddress (const GenAddress &genaddr)
 Construct an UDP address from a GenAddress.

 UdpAddress (const IpAddress &ipaddr)
 Construct an UDP address from a IP address.

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

SnmpSyntaxoperator= (const SnmpSyntax &val)
 Map other SnmpSyntax objects to UdpAddress.

UdpAddressoperator= (const UdpAddress &udpaddr)
 Overloaded assignment operator for UdpAddress.

UdpAddressoperator= (const IpAddress &ipaddr)
 Overloaded assignment operator for IpAddress.

UdpAddressoperator= (const char *inaddr)
 Overloaded assignment operator for strings.

SmiUINT32 get_syntax () const
 Return the syntax.

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

SnmpSyntaxclone () const
 Clone this object.

virtual const char * get_printable () const
 Get a printable ASCII value of the address.

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

void set_port (const unsigned short p)
 Set the port number.

unsigned short get_port () const
 Get the port number.

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

virtual addr_type get_type () const
 Return the type of the address.

virtual int map_to_ipv6 ()
 Map a IPv4 UDP address to a IPv6 UDP address.

void clear ()
 Reset the object.


Protected Member Functions

virtual bool parse_address (const char *inaddr)
virtual void format_output () const

Protected Attributes

char output_buffer [OUTBUFF]
char sep

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


Member Function Documentation

void UdpAddress::clear  )  [inline, virtual]
 

Reset the object.

Reimplemented from IpAddress.

Definition at line 622 of file address.h.

References Address::clear().

SnmpSyntax* UdpAddress::clone  )  const [inline, virtual]
 

Clone this object.

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

Reimplemented from IpAddress.

Definition at line 567 of file address.h.

virtual void UdpAddress::format_output  )  const [protected, virtual]
 

Reimplemented from IpAddress.

virtual int UdpAddress::get_asn1_length  )  const [inline, virtual]
 

Return the space needed for serialization.

Reimplemented from IpAddress.

Definition at line 559 of file address.h.

References UDPIP6LEN, and UDPIPLEN.

virtual int UdpAddress::get_length  )  const [inline, virtual]
 

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

Reimplemented from IpAddress.

Definition at line 602 of file address.h.

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

Get a printable ASCII value of the address.

Returns:
String containing the numerical address

Reimplemented from IpAddress.

Definition at line 574 of file address.h.

SmiUINT32 UdpAddress::get_syntax  )  const [inline, virtual]
 

Return the syntax.

Returns:
This method always returns sNMP_SYNTAX_OCTETS.

Reimplemented from IpAddress.

Definition at line 554 of file address.h.

References SmiUINT32, and sNMP_SYNTAX_OCTETS.

virtual addr_type UdpAddress::get_type  )  const [inline, virtual]
 

Return the type of the address.

See also:
Address::addr_type
Returns:
Always Address:type_udp

Reimplemented from IpAddress.

Definition at line 610 of file address.h.

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

Overloaded operator for streaming output.

Returns:
String containing the numerical address

Reimplemented from IpAddress.

Definition at line 582 of file address.h.

UdpAddress& UdpAddress::operator= const char *  inaddr  ) 
 

Overloaded assignment operator for strings.

Reimplemented from IpAddress.

UdpAddress& UdpAddress::operator= const IpAddress ipaddr  ) 
 

Overloaded assignment operator for IpAddress.

Reimplemented from IpAddress.

UdpAddress& UdpAddress::operator= const UdpAddress udpaddr  ) 
 

Overloaded assignment operator for UdpAddress.

SnmpSyntax& UdpAddress::operator= const SnmpSyntax val  )  [virtual]
 

Map other SnmpSyntax objects to UdpAddress.

Reimplemented from IpAddress.

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

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.


Member Data Documentation

char UdpAddress::output_buffer[OUTBUFF] [protected]
 

Reimplemented from IpAddress.

Definition at line 626 of file address.h.

char UdpAddress::sep [protected]
 

Definition at line 627 of file address.h.


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