SNMP++
3.3.11
|
#include <address.h>
Public Member Functions | |
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... | |
virtual SnmpSyntax & | operator= (const SnmpSyntax &val) |
Map other SnmpSyntax objects to IpAddress. More... | |
virtual Address & | operator= (const Address &val) |
Map other Address objects to IpAddress. More... | |
virtual IpAddress & | operator= (const IpAddress &ipaddress) |
Overloaded assignment operator for other IP addresses. More... | |
SnmpSyntax * | clone () const |
Clone this object. More... | |
const char * | friendly_name (int &status) |
Return the friendly name. 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 | 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 int | get_length () const |
Get the length of the binary address (accessible through operator[]). More... | |
virtual int | get_inet_address_type () const |
Get the InetAddressType value for this address. More... | |
virtual addr_type | get_type () const |
Return the type of the address. More... | |
virtual SmiUINT32 | get_syntax () const |
Return the syntax. More... | |
virtual OctetStr * | clone_as_hex () const |
Return clone as binary string. More... | |
virtual int | get_asn1_length () const |
Return the space needed for serialization. More... | |
virtual version_type | get_ip_version () const |
Return the IP version of the address. More... | |
virtual bool | map_to_ipv6 () |
Map a IPv4 address to a IPv6 address. More... | |
virtual unsigned int | get_scope () const |
Get the IPv6 scope. More... | |
virtual bool | set_scope (const unsigned int scope) |
Set the IPv6 scope. More... | |
void | clear () |
Reset the object. More... | |
bool | has_ipv6_scope () const |
virtual Address & | operator= (const Address &val)=0 |
Overloaded assignment operator. More... | |
virtual Address & | operator= (const char *str) |
virtual SnmpSyntax & | operator= (const SnmpSyntax &val)=0 |
Overloaded assignment operator. 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 Address & | operator= (const char *str) |
virtual unsigned int | hashFunction () const |
virtual SnmpSyntax & | operator= (const SnmpSyntax &val)=0 |
Overloaded assignment operator. More... | |
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 |
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] |
std::string | iv_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... | |
enum | InetAddressType { e_unknown = 0, e_ipv4 = 1, e_ipv6 = 2, e_ipv4z = 3, e_ipv6z = 4, e_dns = 16 } |
Type returned by Address::get_inet_address_type() More... | |
IpAddress::IpAddress | ( | ) |
Construct an empty invalid IP address.
IpAddress::IpAddress | ( | const char * | inaddr | ) |
Construct an IP address from a string.
The following formats can be used:
inaddr | - Hostname or IP address |
IpAddress::IpAddress | ( | const IpAddress & | ipaddr | ) |
Construct an IP address from another IP address.
ipaddr | - address to copy |
IpAddress::IpAddress | ( | const GenAddress & | genaddr | ) |
Construct an IP address from a GenAddress.
genaddr | - address to copy |
|
inline |
Destructor (ensure that SnmpSyntax::~SnmpSyntax() is overridden).
|
protected |
|
virtual |
|
inlinevirtual |
Clone this object.
Implements SnmpSyntax.
Reimplemented in UdpAddress.
|
virtual |
Return clone as binary string.
|
protectedvirtual |
Implements Address.
Reimplemented in UdpAddress.
const char* IpAddress::friendly_name | ( | int & | status | ) |
Return the friendly name.
Does a reverse DNS lookup for the IP address.
status | - The errno value for the lookup |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
Return the IP version of the address.
|
inlinevirtual |
Get the length of the binary address (accessible through operator[]).
Implements Address.
Reimplemented in UdpAddress.
Definition at line 422 of file address.h.
References IP6LEN_NO_SCOPE, IP6LEN_WITH_SCOPE, and IPLEN.
int IpAddress::get_match_bits | ( | const IpAddress | match_ip | ) | const |
Get the count of matching bits from the left.
match_ip | - address to match with |
|
inlinevirtual |
Get a printable ASCII value of the address.
Implements SnmpSyntax.
Reimplemented in UdpAddress.
|
virtual |
Get the IPv6 scope.
|
inlinevirtual |
Return the syntax.
Implements SnmpSyntax.
Reimplemented in UdpAddress.
Definition at line 445 of file address.h.
References sNMP_SYNTAX_IPADDR.
|
inlinevirtual |
Return the type of the address.
Implements Address.
Reimplemented in UdpAddress.
|
virtual |
Map a IPv4 address to a IPv6 address.
Reimplemented in UdpAddress.
void IpAddress::mask | ( | const IpAddress & | ipaddr | ) |
Logically AND the address with the param.
ipaddr | - address to use as mask |
|
inlinevirtual |
Overloaded operator for streaming output.
Implements Address.
Reimplemented in UdpAddress.
virtual SnmpSyntax& SnmpSyntax::operator= |
Overloaded assignment operator.
virtual Address& Address::operator= |
Overloaded assignment operator.
|
virtual |
Overloaded assignment operator for other IP addresses.
Reimplemented in UdpAddress.
|
protectedvirtual |
Implements Address.
Reimplemented in UdpAddress.
|
protected |
|
protected |
|
virtual |
Set the IPv6 scope.
Reimplemented in UdpAddress.
|
protected |
|
protected |