activemq-cpp-3.6.0
decaf::net::InetAddress Class Reference

Represents an IP address. More...

#include <src/main/decaf/net/InetAddress.h>

Inheritance diagram for decaf::net::InetAddress:

Public Member Functions

virtual ~InetAddress ()
virtual
decaf::lang::ArrayPointer
< unsigned char > 
getAddress () const
 Returns the Raw IP address in Network byte order.
virtual std::string getHostAddress () const
 Returns a textual representation of the IP Address.
virtual std::string getHostName () const
 Get the host name associated with this InetAddress instance.
virtual std::string toString () const
 Returns a string representation of the InetAddress in the form 'hostname / ipaddress'.
virtual InetAddressclone () const
 Returns a newly allocated copy of this InetAddress.
virtual bool isAnyLocalAddress () const
 Check if this InetAddress is a valid wildcard address.
virtual bool isLoopbackAddress () const
 Check if this InetAddress is a valid loopback address.
virtual bool isMulticastAddress () const
 Check if this InetAddress is a valid Multicast address.
virtual bool isLinkLocalAddress () const
 Check if this InetAddress is a valid link local address.
virtual bool isSiteLocalAddress () const
 Check if this InetAddress is a valid site local address.
virtual bool isMCGlobal () const
 Check if this InetAddress is Multicast and has Global scope.
virtual bool isMCNodeLocal () const
 Check if this InetAddress is Multicast and has Node Local scope.
virtual bool isMCLinkLocal () const
 Check if this InetAddress is Multicast and has Link Local scope.
virtual bool isMCSiteLocal () const
 Check if this InetAddress is Multicast and has Site Local scope.
virtual bool isMCOrgLocal () const
 Check if this InetAddress is Multicast and has Organization scope.

Static Public Member Functions

static InetAddress getByAddress (const unsigned char *bytes, int numBytes)
 Given a raw IP Address in byte array form, create and return a new InetAddress instance.
static InetAddress getByAddress (const std::string &hostname, const unsigned char *bytes, int numBytes)
 Given a host name and IPAddress return a new InetAddress.
static InetAddress getLocalHost ()
 Gets an InetAddress that is the local host address.

Protected Member Functions

 InetAddress ()
 InetAddress (const unsigned char *ipAddress, int numBytes)
 InetAddress (const std::string &hostname, const unsigned char *ipAddress, int numBytes)

Static Protected Member Functions

static unsigned int bytesToInt (const unsigned char *bytes, int start)
 Converts the bytes in an address array to an int starting from the value start treating the start value as the high order byte.
static InetAddress getAnyAddress ()
static InetAddress getLoopbackAddress ()

Protected Attributes

std::string hostname
bool reached
decaf::lang::ArrayPointer
< unsigned char > 
addressBytes

Static Protected Attributes

static const unsigned char loopbackBytes [4]
static const unsigned char anyBytes [4]

Detailed Description

Represents an IP address.

Since
1.0

Constructor & Destructor Documentation

decaf::net::InetAddress::InetAddress ( )
protected
decaf::net::InetAddress::InetAddress ( const unsigned char *  ipAddress,
int  numBytes 
)
protected
decaf::net::InetAddress::InetAddress ( const std::string &  hostname,
const unsigned char *  ipAddress,
int  numBytes 
)
protected
virtual decaf::net::InetAddress::~InetAddress ( )
virtual

Member Function Documentation

static unsigned int decaf::net::InetAddress::bytesToInt ( const unsigned char *  bytes,
int  start 
)
staticprotected

Converts the bytes in an address array to an int starting from the value start treating the start value as the high order byte.

Parameters
bytesThe array of bytes to convert to an int.
startThe index in the array to treat as the high order byte.
Returns
an unsigned int that represents the address value.
virtual InetAddress* decaf::net::InetAddress::clone ( ) const
virtual

Returns a newly allocated copy of this InetAddress.

The caller owns the resulting copy and must delete it.

Returns
a new InetAddress instance that is a copy of this one, caller owns.

Reimplemented in decaf::net::Inet4Address, and decaf::net::Inet6Address.

virtual decaf::lang::ArrayPointer<unsigned char> decaf::net::InetAddress::getAddress ( ) const
virtual

Returns the Raw IP address in Network byte order.

The returned address is a copy of the bytes contained in this InetAddress.

Returns
and ArrayPointer containing the raw bytes of the network address.
static InetAddress decaf::net::InetAddress::getAnyAddress ( )
staticprotected
static InetAddress decaf::net::InetAddress::getByAddress ( const unsigned char *  bytes,
int  numBytes 
)
static

Given a raw IP Address in byte array form, create and return a new InetAddress instance.

An IPV4 address must be only four bytes in length and an IPV6 address must be 16 bytes in length.

Returns
a copy of an InetAddress that represents the given byte array address.
Exceptions
UnknownHostExceptionif the address array length is invalid.
static InetAddress decaf::net::InetAddress::getByAddress ( const std::string &  hostname,
const unsigned char *  bytes,
int  numBytes 
)
static

Given a host name and IPAddress return a new InetAddress.

There is no name service checking or address validation done on the provided host name. The host name can either be machine name or the text based representation of the IP Address.

An IPV4 address must be only four bytes in length and an IPV6 address must be 16 bytes in length.

Returns
a copy of an InetAddress that represents the given byte array address.
Exceptions
UnknownHostExceptionif the address array length is invalid.
virtual std::string decaf::net::InetAddress::getHostAddress ( ) const
virtual

Returns a textual representation of the IP Address.

Returns
the string form of the IP Address.
virtual std::string decaf::net::InetAddress::getHostName ( ) const
virtual

Get the host name associated with this InetAddress instance.

If a host name was set upon construction then that value is returned, otherwise a reverse name lookup with be performed to attempt to get the host name associated with the set IP Address. If the host name cannot be resolved the textual representation of the IP Address is returned instead.

Returns
the name of the host associated with this set IP Address.
static InetAddress decaf::net::InetAddress::getLocalHost ( )
static

Gets an InetAddress that is the local host address.

If the localhost value cannot be resolved than the InetAddress for Loopback is returned.

Returns
a new InetAddress object that contains the local host address.
Exceptions
UnknownHostExceptionif the address for local host is not found.
static InetAddress decaf::net::InetAddress::getLoopbackAddress ( )
staticprotected
virtual bool decaf::net::InetAddress::isAnyLocalAddress ( ) const
inlinevirtual

Check if this InetAddress is a valid wildcard address.

Returns
true if the address is a wildcard address.

Reimplemented in decaf::net::Inet4Address.

virtual bool decaf::net::InetAddress::isLinkLocalAddress ( ) const
inlinevirtual

Check if this InetAddress is a valid link local address.

Returns
true if the address is a link local address.

Reimplemented in decaf::net::Inet4Address.

virtual bool decaf::net::InetAddress::isLoopbackAddress ( ) const
inlinevirtual

Check if this InetAddress is a valid loopback address.

Returns
true if the address is a loopback address.

Reimplemented in decaf::net::Inet4Address.

virtual bool decaf::net::InetAddress::isMCGlobal ( ) const
inlinevirtual

Check if this InetAddress is Multicast and has Global scope.

Returns
true if the address is Multicast and has Global scope.

Reimplemented in decaf::net::Inet4Address.

virtual bool decaf::net::InetAddress::isMCLinkLocal ( ) const
inlinevirtual

Check if this InetAddress is Multicast and has Link Local scope.

Returns
true if the address is Multicast and has Link Local scope.

Reimplemented in decaf::net::Inet4Address.

virtual bool decaf::net::InetAddress::isMCNodeLocal ( ) const
inlinevirtual

Check if this InetAddress is Multicast and has Node Local scope.

Returns
true if the address is Multicast and has Node Local scope.

Reimplemented in decaf::net::Inet4Address.

virtual bool decaf::net::InetAddress::isMCOrgLocal ( ) const
inlinevirtual

Check if this InetAddress is Multicast and has Organization scope.

Returns
true if the address is Multicast and has Organization scope.

Reimplemented in decaf::net::Inet4Address.

virtual bool decaf::net::InetAddress::isMCSiteLocal ( ) const
inlinevirtual

Check if this InetAddress is Multicast and has Site Local scope.

Returns
true if the address is Multicast and has Site Local scope.

Reimplemented in decaf::net::Inet4Address.

virtual bool decaf::net::InetAddress::isMulticastAddress ( ) const
inlinevirtual

Check if this InetAddress is a valid Multicast address.

Returns
true if the address is a Multicast address.

Reimplemented in decaf::net::Inet4Address.

virtual bool decaf::net::InetAddress::isSiteLocalAddress ( ) const
inlinevirtual

Check if this InetAddress is a valid site local address.

Returns
true if the address is a site local address.

Reimplemented in decaf::net::Inet4Address.

virtual std::string decaf::net::InetAddress::toString ( ) const
virtual

Returns a string representation of the InetAddress in the form 'hostname / ipaddress'.

If the hostname is not resolved than it appears as empty.

Returns
string value of this InetAddress.

Field Documentation

decaf::lang::ArrayPointer<unsigned char> decaf::net::InetAddress::addressBytes
mutableprotected
const unsigned char decaf::net::InetAddress::anyBytes[4]
staticprotected
std::string decaf::net::InetAddress::hostname
mutableprotected
const unsigned char decaf::net::InetAddress::loopbackBytes[4]
staticprotected
bool decaf::net::InetAddress::reached
mutableprotected

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