senf::INet4SocketAddress Class Reference
[Addressing classes]

IPv4 socket address. More...

#include <senf/Socket/Protocols/INet/INetAddressing.hh>

Inheritance diagram for senf::INet4SocketAddress:
Inheritance graph
[legend]

List of all members.


Detailed Description

IPv4 socket address.

INet4Address wraps the standard sockaddr_in datatype. It provides simple accessor methods to access the host and port. It does not integrate gethostbyname or DNS lookup.

Implementation note:
This implementation is based on sockaddr_in, which is needed since it needs to provide a non-const struct sockaddr * for legacy compatibility.

Definition at line 53 of file INetAddressing.hh.


Public Member Functions

INet4Address  address () const
  Return address.
unsigned  port () const
  Return port number.
void  address (INet4Address const &addr)
  Set address.
void  port (unsigned p)
  Set port number.

Static Public Attributes

static short const  addressFamily = AF_INET

Related Functions

(Note that these are not member functions.)

std::ostream &  operator<< (std::ostream &os, INet4SocketAddress const &addr)
  Write address and port to os.

Structors and default members

  INet4SocketAddress ()
  INet4SocketAddress (std::string const &addr)
  Set address and port.
  INet4SocketAddress (INet4Address const &addr, unsigned port)
  Set address and port explicitly.
  INet4SocketAddress (unsigned port)
  Set port, address is set to 0.0.0.0.
  INet4SocketAddress (const INet4SocketAddress &other)
INet4SocketAddress operator= (const INet4SocketAddress &other)

Constructor & Destructor Documentation

senf::INet4SocketAddress::
INet4SocketAddress ()

Definition at line 36 of file INetAddressing.cci.

senf::INet4SocketAddress::
INet4SocketAddress ( std::string const &  addr )

Set address and port.

This constructor expects a string of the form 'host:port'. The constructor will use this value to initialize the host and port members. Since it uses the INet4Address::from_string constructor, this call may block while waiting for the resolver.

Exceptions:
AddressSyntaxException  if the address syntax is invalid
UnknownHostnameException  if the address cannot be resolved.

Definition at line 47 of file INetAddressing.cc.

senf::INet4SocketAddress::
INet4SocketAddress ( INet4Address const &  addr,
unsigned  port )

Set address and port explicitly.

Parameters:
[in]  addr  IP address
[in]  port  port number

Definition at line 62 of file INetAddressing.cc.

senf::INet4SocketAddress::
INet4SocketAddress ( unsigned  port )

Set port, address is set to 0.0.0.0.

Parameters:
[in]  port  port number

Definition at line 69 of file INetAddressing.cc.

senf::INet4SocketAddress::
INet4SocketAddress ( const INet4SocketAddress other )

Definition at line 40 of file INetAddressing.cci.


Member Function Documentation

void senf::INet4SocketAddress::
address ( INet4Address const &  addr )

Set address.

Definition at line 63 of file INetAddressing.cci.

senf::INet4Address senf::INet4SocketAddress::
address ()

Return address.

Definition at line 51 of file INetAddressing.cci.

senf::INet4SocketAddress & senf::INet4SocketAddress::
operator= ( const INet4SocketAddress other )

Definition at line 45 of file INetAddressing.cci.

void senf::INet4SocketAddress::
port ( unsigned  p )

Set port number.

Definition at line 68 of file INetAddressing.cci.

unsigned senf::INet4SocketAddress::
port ()

Return port number.

Definition at line 57 of file INetAddressing.cci.


Friends And Related Function Documentation

std::ostream &
operator<< ( std::ostream &  os,
INet4SocketAddress const &  addr )

Write address and port to os.


Member Data Documentation

short const senf::INet4SocketAddress::addressFamily = AF_INET
[static]

Definition at line 57 of file INetAddressing.hh.


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