IPv4 socket address. More...
#include <senf/Socket/Protocols/INet/INetAddressing.hh>
Public Member Functions | |
INet4Address | address () const |
Return address. More... | |
unsigned | port () const |
Return port number. More... | |
void | address (INet4Address const &addr) |
Set address. More... | |
void | port (unsigned p) |
Set port number. More... | |
Public Member Functions inherited from senf::BSDSocketAddress | |
bool | operator== (BSDSocketAddress const &other) const |
Compare two arbitrary addresses. More... | |
bool | operator< (BSDSocketAddress const &other) const |
Compare two arbitrary addresses. More... | |
bool | boolean_test () const |
Return true , if address is not empty. More... | |
short | family () const |
Return the address family. More... | |
struct sockaddr const * | sockaddr_p () const |
socklen_t | socklen () const |
socklen_t const * | socklen_p () const |
Public Member Functions inherited from senf::comparable_safe_bool< BSDSocketAddress > | |
operator bool_type () const | |
bool | operator! () const |
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. More... | |
Related Functions inherited from senf::BSDSocketAddress | |
template<class Target > | |
Target & | sockaddr_cast (BSDSocketAddress &source) |
Safe socket address down-cast. More... | |
template<class Target > | |
Target const & | sockaddr_cast (BSDSocketAddress const &source) |
Safe socket address down-cast (const) More... | |
std::ostream & | operator<< (std::ostream &os, BSDSocketAddress const &addr) |
Output generic socket address. More... | |
Structors and default members | |
INet4SocketAddress () | |
INet4SocketAddress (std::string const &addr) | |
Set address and port. More... | |
INet4SocketAddress (INet4Address const &addr, unsigned port) | |
Set address and port explicitly. More... | |
INet4SocketAddress (unsigned port) | |
Set port, address is set to 0.0.0.0. More... | |
INet4SocketAddress (const INet4SocketAddress &other) | |
INet4SocketAddress & | operator= (const INet4SocketAddress &other) |
Additional Inherited Members | |
Protected Types inherited from senf::safe_bool_base | |
typedef void(safe_bool_base::* | bool_type) () const |
Protected Member Functions inherited from senf::BSDSocketAddress | |
BSDSocketAddress (socklen_t len, short family) | |
BSDSocketAddress (BSDSocketAddress const &other) | |
BSDSocketAddress & | operator= (BSDSocketAddress const &other) |
struct sockaddr * | sockaddr_p () |
socklen_t * | socklen_p () |
void | socklen (socklen_t len) |
Protected Member Functions inherited from senf::comparable_safe_bool< BSDSocketAddress > | |
~comparable_safe_bool () | |
Protected Member Functions inherited from senf::safe_bool_base | |
void | this_type_does_not_support_comparisons () const |
safe_bool_base () | |
safe_bool_base (const safe_bool_base &) | |
safe_bool_base & | operator= (const safe_bool_base &) |
~safe_bool_base () | |
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.
Definition at line 44 of file INetAddressing.hh.
senf::INet4SocketAddress::INet4SocketAddress | ( | ) |
|
explicit |
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.
AddressSyntaxException | if the address syntax is invalid |
UnknownHostnameException | if the address cannot be resolved. |
Definition at line 38 of file INetAddressing.cc.
senf::INet4SocketAddress::INet4SocketAddress | ( | INet4Address const & | addr, |
unsigned | port | ||
) |
Set address and port explicitly.
[in] | addr | IP address |
[in] | port | port number |
Definition at line 52 of file INetAddressing.cc.
|
explicit |
Set port, address is set to 0.0.0.0.
[in] | port | port number |
Definition at line 59 of file INetAddressing.cc.
senf::INet4SocketAddress::INet4SocketAddress | ( | const INet4SocketAddress & | other | ) |
INet4Address senf::INet4SocketAddress::address | ( | ) | const |
Return address.
void senf::INet4SocketAddress::address | ( | INet4Address const & | addr | ) |
Set address.
INet4SocketAddress& senf::INet4SocketAddress::operator= | ( | const INet4SocketAddress & | other | ) |
unsigned senf::INet4SocketAddress::port | ( | ) | const |
Return port number.
void senf::INet4SocketAddress::port | ( | unsigned | p | ) |
Set port number.
|
related |
Write address and port to os.
|
static |
Definition at line 48 of file INetAddressing.hh.