Logo
~Sockets~
~Examples~
~Contact~


SocketAddress Class Reference
[Basic sockets]

This class and its subclasses is intended to be used as replacement for the internal data type 'ipaddr_t' and various implementations of IPv6 addressing found throughout the library. More...

#include <SocketAddress.h>

Inheritance diagram for SocketAddress:

List of all members.


Public Member Functions

virtual ~SocketAddress ()
virtual operator struct sockaddr * ()=0
 Get a pointer to the address struct.
virtual operator socklen_t ()=0
 Get length of address struct.
virtual bool operator== (SocketAddress &)=0
 Compare two addresses.
virtual void SetPort (port_t port)=0
 Set port number.
virtual port_t GetPort ()=0
 Get port number.
virtual void SetAddress (struct sockaddr *sa)=0
 Set socket address.
virtual std::string Convert (bool include_port)=0
 Convert address to text.
virtual std::string Reverse ()=0
 Reverse lookup of address.
virtual int GetFamily ()=0
 Get address family.
virtual bool IsValid ()=0
 Address structure is valid.
virtual std::auto_ptr
< SocketAddress
GetCopy ()=0
 Get a copy of this SocketAddress object.

Detailed Description

This class and its subclasses is intended to be used as replacement for the internal data type 'ipaddr_t' and various implementations of IPv6 addressing found throughout the library.

'ipaddr_t' is an IPv4 address in network byte order. 'port_t' is the portnumber in host byte order. 'struct in6_addr' is an IPv6 address. 'struct in_addr' is an IPv4 address.

Definition at line 56 of file SocketAddress.h.


Constructor & Destructor Documentation

virtual SocketAddress::~SocketAddress (  )  [inline, virtual]

Definition at line 59 of file SocketAddress.h.

00059 {}


Member Function Documentation

virtual SocketAddress::operator struct sockaddr * (  )  [pure virtual]

Get a pointer to the address struct.

Implemented in Ipv4Address.

virtual SocketAddress::operator socklen_t (  )  [pure virtual]

Get length of address struct.

Implemented in Ipv4Address.

virtual bool SocketAddress::operator== ( SocketAddress  )  [pure virtual]

Compare two addresses.

Implemented in Ipv4Address.

virtual void SocketAddress::SetPort ( port_t  port  )  [pure virtual]

Set port number.

Parameters:
port Port number in host byte order

Implemented in Ipv4Address.

Referenced by UdpSocket::Bind().

virtual port_t SocketAddress::GetPort (  )  [pure virtual]

Get port number.

Returns:
Port number in host byte order.

Implemented in Ipv4Address.

Referenced by UdpSocket::Bind(), SctpSocket::Bind(), ListenSocket< X >::Bind(), and TcpSocket::Open().

virtual void SocketAddress::SetAddress ( struct sockaddr *  sa  )  [pure virtual]

Set socket address.

Parameters:
sa Pointer to either 'struct sockaddr_in' or 'struct sockaddr_in6'.

Implemented in Ipv4Address.

virtual std::string SocketAddress::Convert ( bool  include_port  )  [pure virtual]

Convert address to text.

Implemented in Ipv4Address.

virtual std::string SocketAddress::Reverse (  )  [pure virtual]

Reverse lookup of address.

Implemented in Ipv4Address.

virtual int SocketAddress::GetFamily (  )  [pure virtual]

virtual bool SocketAddress::IsValid (  )  [pure virtual]

virtual std::auto_ptr<SocketAddress> SocketAddress::GetCopy (  )  [pure virtual]

Get a copy of this SocketAddress object.

Implemented in Ipv4Address.

Referenced by Socket::SetClientRemoteAddress(), and Socket::SetRemoteAddress().


The documentation for this class was generated from the following file:
Page, code, and content Copyright (C) 2007 by Anders Hedström
Generated for C++ Sockets by  doxygen 1.4.4