IPv6 socket address. More...
#include <senf/Socket/Protocols/INet/INetAddressing.hh>
Public Member Functions | |
INet6Address | address () const |
Get printable address representation. More... | |
void | address (INet6Address const &addr) |
Change address. More... | |
unsigned | port () const |
Get port number. More... | |
void | port (unsigned port) |
Change port number. More... | |
std::string | iface () const |
Get interface name. More... | |
void | iface (std::string const &iface) |
Change interface. 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_INET6 |
Related Functions | |
(Note that these are not member functions.) | |
std::ostream & | operator<< (std::ostream &os, INet6SocketAddress const &addr) |
Output INet6SocketAddress instance as it's string representation. 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 | |
INet6SocketAddress () | |
Create empty instance. More... | |
INet6SocketAddress (std::string const &addr, INet6Address::Resolve_t resolve=INet6Address::ResolveINet6) | |
Initialize/convert from string representation. More... | |
INet6SocketAddress (INet6Address const &addr, unsigned port) | |
Initialize from address and port. More... | |
INet6SocketAddress (INet6Address const &addr, unsigned port, std::string const &iface) | |
Initialize explicitly from given parameters. More... | |
INet6SocketAddress (unsigned port) | |
Initialize from port and set to 'unspecified' addr. More... | |
INet6SocketAddress (const INet6SocketAddress &other) | |
INet6SocketAddress & | operator= (const INet6SocketAddress &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 () | |
IPv6 socket address.
This class wraps the standard sockaddr_in6
structure. INet6SocketAddress provides access to all members of the sockaddr_in6 structure. Additionally, INet6SocketAddress supports the string representations
[
address [ %
zone-id ] ]:
port :
portWhere address is an arbitrary numeric IPv6 address, zone-id is an optional network interface name and port is the port number. So some example addresses are
[2001:db8:1::1]:80
www.go6.net:80
[fe80::1%eth0]:443
Definition at line 132 of file INetAddressing.hh.
senf::INet6SocketAddress::INet6SocketAddress | ( | ) |
Create empty instance.
|
explicit |
Initialize/convert from string representation.
AddressSyntaxException | if the address syntax is invalid |
UnknownHostnameException | if the address cannot be resolved. |
[in] | addr | Address to parse |
[in] | resolve | If this is INet6Address::ResolveINet4, support IPv4 addresses. See INet6Address. |
Definition at line 88 of file INetAddressing.cc.
senf::INet6SocketAddress::INet6SocketAddress | ( | INet6Address const & | addr, |
unsigned | port | ||
) |
Initialize from address and port.
senf::INet6SocketAddress::INet6SocketAddress | ( | INet6Address const & | addr, |
unsigned | port, | ||
std::string const & | iface | ||
) |
Initialize explicitly from given parameters.
AddressSyntaxException | if the given iface cannot be resolved. |
|
explicit |
Initialize from port and set to 'unspecified' addr.
The address is set to [::]
[in] | port | port number |
senf::INet6SocketAddress::INet6SocketAddress | ( | const INet6SocketAddress & | other | ) |
INet6Address senf::INet6SocketAddress::address | ( | ) | const |
Get printable address representation.
void senf::INet6SocketAddress::address | ( | INet6Address const & | addr | ) |
Change address.
std::string senf::INet6SocketAddress::iface | ( | ) | const |
Get interface name.
Definition at line 120 of file INetAddressing.cc.
void senf::INet6SocketAddress::iface | ( | std::string const & | iface | ) |
Change interface.
AddressSyntaxException | if the given iface cannot be resolved. |
INet6SocketAddress& senf::INet6SocketAddress::operator= | ( | const INet6SocketAddress & | other | ) |
unsigned senf::INet6SocketAddress::port | ( | ) | const |
Get port number.
void senf::INet6SocketAddress::port | ( | unsigned | port | ) |
Change port number.
|
related |
Output INet6SocketAddress instance as it's string representation.
|
static |
Definition at line 136 of file INetAddressing.hh.