SocketAddress Class Reference
[Socket address data structure and methodology]

An abstract class describing the address of any type of socket. More...

#include <sockaddr.h>

Inheritance diagram for SocketAddress:

Inheritance graph
[legend]
Collaboration diagram for SocketAddress:

Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual ~SocketAddress ()
struct sockaddr * get_addr () const
 Return the current sockaddr being used.
socklen_t length () const
int family () const
virtual std::string get_id () const =0

Protected Member Functions

 SocketAddress ()
 SocketAddress (const struct sockaddr *)
void set_addr (const struct sockaddr *)
 Initialization of the socket parameters.

Protected Attributes

struct sockaddr_storage addr
 Storage of the address.
socklen_t sock_addrlen


Detailed Description

An abstract class describing the address of any type of socket.

The SocketAddress classes are immutable, and provide useful functionality related to socket addresses, such as setting them up given user-friendly address specifications as well as printing them nicely for human consumption.

Definition at line 69 of file sockaddr.h.


Constructor & Destructor Documentation

SocketAddress::SocketAddress (  )  [protected]

Definition at line 55 of file sockaddr.cc.

References addr.

SocketAddress::SocketAddress ( const struct sockaddr *  initaddr  )  [protected]

Definition at line 60 of file sockaddr.cc.

References addr, and set_addr().

Here is the call graph for this function:

SocketAddress::~SocketAddress (  )  [virtual]

Definition at line 66 of file sockaddr.cc.


Member Function Documentation

const sockaddr * SocketAddress::get_addr (  )  const [read]

Return the current sockaddr being used.

Do not try to free the returned address! It was not dynamically allocated. Also, don't modify it! XXX - should we return a copy instead?

Definition at line 98 of file sockaddr.cc.

References addr.

Referenced by UDSSocketAddress::get_id(), socket_sender(), and UDSSocketAddress::unlink().

Here is the caller graph for this function:

socklen_t SocketAddress::length (  )  const

Definition at line 105 of file sockaddr.cc.

References sock_addrlen.

int SocketAddress::family (  )  const

Definition at line 112 of file sockaddr.cc.

References addr.

Referenced by IPSocketAddress::get_id(), and IPSocketAddress::port().

Here is the caller graph for this function:

virtual std::string SocketAddress::get_id (  )  const [pure virtual]

Implemented in IPSocketAddress, and UDSSocketAddress.

void SocketAddress::set_addr ( const struct sockaddr *  val  )  [protected]

Initialization of the socket parameters.

Used by the constructors.

Definition at line 75 of file sockaddr.cc.

References addr, and sock_addrlen.

Referenced by IPSocketAddress::IPSocketAddress(), UDSSocketAddress::set_addr(), and SocketAddress().

Here is the caller graph for this function:


Member Data Documentation

struct sockaddr_storage SocketAddress::addr [read, protected]

Storage of the address.

Definition at line 94 of file sockaddr.h.

Referenced by family(), get_addr(), IPSocketAddress::get_id(), IPSocketAddress::port(), set_addr(), and SocketAddress().

socklen_t SocketAddress::sock_addrlen [protected]

A cache of the length of the address structure. This is kept here largely for systems that don't store it in the various sockaddr structures themselves.

Definition at line 99 of file sockaddr.h.

Referenced by IPSocketAddress::get_id(), length(), set_addr(), and UDSSocketAddress::UDSSocketAddress().


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

Generated on Tue May 13 11:32:50 2008 for consmgr by  doxygen 1.5.5