OW_NAMESPACE::SocketAddress Class Reference

#include <OW_SocketAddress.hpp>

Collaboration diagram for OW_NAMESPACE::SocketAddress:

Collaboration graph
[legend]
List of all members.

Public Types

enum  AddressType { UNSET, INET, UDS }

Public Member Functions

AddressType getType () const
UInt16 getPort () const
 Get the port associated with the address.
 ~SocketAddress ()
const String getName () const
 Returns the hostname (FQDN) of the address.
const String getAddress () const
 Returns the IP address of the host.
const SocketAddress_tgetNativeForm () const
size_t getNativeFormSize () const
const InetSocketAddress_tgetInetAddress () const
 Get a pointer to the InetSocketAddress_t precondition: getType() == INET.
const UnixSocketAddress_tgetUnixAddress () const
 Get a pointer to the UnixSocketAddress_t precondition: getType() == UDS.
void assignFromNativeForm (const UnixSocketAddress_t *address, size_t len)
const String toString () const
 Returns the IP address and the port with a colon in between.
void assignFromNativeForm (const InetSocketAddress_t *address, size_t len)
 SocketAddress ()

Static Public Member Functions

static SocketAddress getByName (const String &host, unsigned short port=0)
 Do a DNS lookup on a hostname and return an SocketAddress for that host.
static SocketAddress getAnyLocalHost (UInt16 port=0)
 Get an SocketAddress appropriate for referring to the local host.
static SocketAddress allocEmptyAddress (AddressType type)
 Allocate an empty SocketAddress.
static SocketAddress getUDS (const String &filename)

Static Public Attributes

static const char *const ALL_LOCAL_ADDRESSES = "0.0.0.0"

Private Member Functions

 SocketAddress (const InetSocketAddress_t &nativeForm)
 SocketAddress (const UnixSocketAddress_t &nativeForm)

Static Private Member Functions

static SocketAddress getFromNativeForm (const InetAddress_t &nativeForm, UInt16 nativePort, const String &hostname)
static SocketAddress getFromNativeForm (const InetSocketAddress_t &nativeForm)
static SocketAddress getFromNativeForm (const UnixSocketAddress_t &nativeForm)

Private Attributes

String m_name
String m_address
size_t m_nativeSize
InetSocketAddress_t m_inetNativeAddress
UnixSocketAddress_t m_UDSNativeAddress
AddressType m_type

Detailed Description

Definition at line 52 of file OW_SocketAddress.hpp.


Member Enumeration Documentation

enum OW_NAMESPACE::SocketAddress::AddressType
 

Enumerator:
UNSET 
INET 
UDS 

Definition at line 57 of file OW_SocketAddress.hpp.


Constructor & Destructor Documentation

OW_NAMESPACE::SocketAddress::~SocketAddress  )  [inline]
 

Definition at line 100 of file OW_SocketAddress.hpp.

OW_NAMESPACE::SocketAddress::SocketAddress  ) 
 

Definition at line 106 of file OW_SocketAddress.cpp.

Referenced by allocEmptyAddress(), and getFromNativeForm().

OW_NAMESPACE::SocketAddress::SocketAddress const InetSocketAddress_t nativeForm  )  [private]
 

Definition at line 323 of file OW_SocketAddress.cpp.

References assignFromNativeForm().

OW_NAMESPACE::SocketAddress::SocketAddress const UnixSocketAddress_t nativeForm  )  [private]
 

Definition at line 315 of file OW_SocketAddress.cpp.

References assignFromNativeForm().


Member Function Documentation

SocketAddress OW_NAMESPACE::SocketAddress::allocEmptyAddress AddressType  type  )  [static]
 

Allocate an empty SocketAddress.

Returns:
an empty address

Definition at line 344 of file OW_SocketAddress.cpp.

References getFromNativeForm(), INET, OW_THROW, SocketAddress(), and UDS.

Referenced by OW_NAMESPACE::ServerSocketImpl::doListen(), OW_NAMESPACE::HTTPServer::getLocalHTTPAddress(), and OW_NAMESPACE::HTTPServer::getLocalHTTPSAddress().

void OW_NAMESPACE::SocketAddress::assignFromNativeForm const InetSocketAddress_t address,
size_t  len
 

Definition at line 284 of file OW_SocketAddress.cpp.

References INET, m_address, m_inetNativeAddress, m_nativeSize, and m_type.

void OW_NAMESPACE::SocketAddress::assignFromNativeForm const UnixSocketAddress_t address,
size_t  len
 

Definition at line 295 of file OW_SocketAddress.cpp.

References m_address, m_name, m_nativeSize, m_type, m_UDSNativeAddress, and UDS.

Referenced by OW_NAMESPACE::ServerSocketImpl::fillAddrParms(), OW_NAMESPACE::SocketBaseImpl::fillInetAddrParms(), OW_NAMESPACE::SocketBaseImpl::fillUnixAddrParms(), and SocketAddress().

const String OW_NAMESPACE::SocketAddress::getAddress  )  const
 

Returns the IP address of the host.

Returns:
The IP address of the host

Definition at line 334 of file OW_SocketAddress.cpp.

References m_address.

Referenced by toString().

SocketAddress OW_NAMESPACE::SocketAddress::getAnyLocalHost UInt16  port = 0  )  [static]
 

Get an SocketAddress appropriate for referring to the local host.

Parameters:
port The port
Returns:
An SocketAddress representing the local machine

Definition at line 232 of file OW_SocketAddress.cpp.

References getFromNativeForm(), OW_NAMESPACE::gethostbynameMutex, OW_NAMESPACE::hton32(), OW_NAMESPACE::String::indexOf(), and OW_NAMESPACE::String::npos.

Referenced by OW_NAMESPACE::OpenWBEM_UnitaryComputerSystem::doSimpleEnumInstances(), and OW_NAMESPACE::HTTPSvrConnection::getHostName().

SocketAddress OW_NAMESPACE::SocketAddress::getByName const String host,
unsigned short  port = 0
[static]
 

Do a DNS lookup on a hostname and return an SocketAddress for that host.

Parameters:
host The hostname
port The port
Returns:
An SocketAddress for the host and port
Exceptions:
UnknownHostException 

Definition at line 118 of file OW_SocketAddress.cpp.

References OW_NAMESPACE::String::c_str().

Referenced by OW_NAMESPACE::ServerSocketImpl::doListen().

SocketAddress OW_NAMESPACE::SocketAddress::getFromNativeForm const UnixSocketAddress_t nativeForm  )  [static, private]
 

Definition at line 174 of file OW_SocketAddress.cpp.

References SocketAddress().

SocketAddress OW_NAMESPACE::SocketAddress::getFromNativeForm const InetSocketAddress_t nativeForm  )  [static, private]
 

Definition at line 165 of file OW_SocketAddress.cpp.

References SocketAddress().

SocketAddress OW_NAMESPACE::SocketAddress::getFromNativeForm const InetAddress_t nativeForm,
UInt16  nativePort,
const String hostname
[static, private]
 

Definition at line 183 of file OW_SocketAddress.cpp.

References OW_NAMESPACE::hton16(), INET, m_name, m_type, and SocketAddress().

Referenced by allocEmptyAddress(), and getAnyLocalHost().

const InetSocketAddress_t * OW_NAMESPACE::SocketAddress::getInetAddress  )  const
 

Get a pointer to the InetSocketAddress_t precondition: getType() == INET.

Definition at line 215 of file OW_SocketAddress.cpp.

References m_inetNativeAddress.

Referenced by OW_NAMESPACE::ServerSocketImpl::doListen().

const String OW_NAMESPACE::SocketAddress::getName  )  const
 

Returns the hostname (FQDN) of the address.

Returns:
The hostname of the address.

Definition at line 329 of file OW_SocketAddress.cpp.

References m_name.

Referenced by OW_NAMESPACE::HTTPSvrConnection::getHostName().

const SocketAddress_t * OW_NAMESPACE::SocketAddress::getNativeForm  )  const
 

Definition at line 197 of file OW_SocketAddress.cpp.

References INET, m_inetNativeAddress, m_type, m_UDSNativeAddress, and UDS.

size_t OW_NAMESPACE::SocketAddress::getNativeFormSize  )  const
 

Definition at line 339 of file OW_SocketAddress.cpp.

References m_nativeSize.

UInt16 OW_NAMESPACE::SocketAddress::getPort  )  const
 

Get the port associated with the address.

Returns:
The port

Definition at line 307 of file OW_SocketAddress.cpp.

References INET, m_inetNativeAddress, m_type, OW_NAMESPACE::ntoh16(), and OW_ASSERT.

Referenced by toString().

AddressType OW_NAMESPACE::SocketAddress::getType  )  const [inline]
 

Definition at line 63 of file OW_SocketAddress.hpp.

Referenced by OW_NAMESPACE::ServerSocketImpl::accept(), OW_NAMESPACE::ServerSocketImpl::close(), OW_NAMESPACE::SocketBaseImpl::connect(), and OW_NAMESPACE::ServerSocketImpl::fillAddrParms().

SocketAddress OW_NAMESPACE::SocketAddress::getUDS const String filename  )  [static]
 

Definition at line 70 of file OW_SocketAddress.cpp.

References OW_NAMESPACE::String::c_str(), OW_NAMESPACE::String::length(), m_address, m_name, m_nativeSize, m_type, m_UDSNativeAddress, and UDS.

Referenced by OW_NAMESPACE::ServerSocketImpl::doListen().

const UnixSocketAddress_t * OW_NAMESPACE::SocketAddress::getUnixAddress  )  const
 

Get a pointer to the UnixSocketAddress_t precondition: getType() == UDS.

Definition at line 224 of file OW_SocketAddress.cpp.

References m_UDSNativeAddress.

const String OW_NAMESPACE::SocketAddress::toString  )  const
 

Returns the IP address and the port with a colon in between.

Returns:
The IP and port seperated by a colon.

Definition at line 367 of file OW_SocketAddress.cpp.

References getAddress(), getPort(), INET, m_name, m_type, OW_ASSERT, and UNSET.

Referenced by OW_NAMESPACE::ServerSocketImpl::close(), OW_NAMESPACE::HTTPServerSelectableCallback::doSelected(), and OW_NAMESPACE::HTTPSvrConnection::run().


Member Data Documentation

const char *const OW_NAMESPACE::SocketAddress::ALL_LOCAL_ADDRESSES = "0.0.0.0" [static]
 

Definition at line 55 of file OW_SocketAddress.hpp.

Referenced by OW_NAMESPACE::ServerSocketImpl::doListen().

String OW_NAMESPACE::SocketAddress::m_address [private]
 

Definition at line 153 of file OW_SocketAddress.hpp.

Referenced by assignFromNativeForm(), getAddress(), and getUDS().

InetSocketAddress_t OW_NAMESPACE::SocketAddress::m_inetNativeAddress [private]
 

Definition at line 156 of file OW_SocketAddress.hpp.

Referenced by assignFromNativeForm(), getInetAddress(), getNativeForm(), and getPort().

String OW_NAMESPACE::SocketAddress::m_name [private]
 

Definition at line 152 of file OW_SocketAddress.hpp.

Referenced by assignFromNativeForm(), getFromNativeForm(), getName(), getUDS(), and toString().

size_t OW_NAMESPACE::SocketAddress::m_nativeSize [private]
 

Definition at line 154 of file OW_SocketAddress.hpp.

Referenced by assignFromNativeForm(), getNativeFormSize(), and getUDS().

AddressType OW_NAMESPACE::SocketAddress::m_type [private]
 

Definition at line 162 of file OW_SocketAddress.hpp.

Referenced by assignFromNativeForm(), getFromNativeForm(), getNativeForm(), getPort(), getUDS(), and toString().

UnixSocketAddress_t OW_NAMESPACE::SocketAddress::m_UDSNativeAddress [private]
 

Definition at line 159 of file OW_SocketAddress.hpp.

Referenced by assignFromNativeForm(), getNativeForm(), getUDS(), and getUnixAddress().


The documentation for this class was generated from the following files:
Generated on Thu Feb 9 09:14:54 2006 for openwbem by  doxygen 1.4.6