Socket addressing, BSD style. More...
#include <senf/Socket/Protocols/BSDSocketAddress.hh>

Public Member Functions | |
| 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... | |
Public Member Functions inherited from senf::comparable_safe_bool< BSDSocketAddress > | |
| operator bool_type () const | |
| bool | operator! () const |
Protected Member Functions | |
| 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 () | |
Related Functions | |
(Note that these are not member functions.) | |
| 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... | |
Generic sockaddr interface | |
| struct sockaddr const * | sockaddr_p () const |
| socklen_t | socklen () const |
| socklen_t const * | socklen_p () const |
Additional Inherited Members | |
Protected Types inherited from senf::safe_bool_base | |
| typedef void(safe_bool_base::* | bool_type) () const |
Socket addressing, BSD style.
BSDSocketAddress is the base class of all BSD sockaddr based addressing classes. The sockaddr addressing interface is split into several parts
sockaddr interface AF_INET), INet6SocketAddress (AF_INET6), UNSocketAddress (AF_UNIX) and LLSocketAddress (AF_PACKET) It is not possible to create or store BSDSocketAddress instances: You must either store an address in one of the specifically typed subclasses or using GenericBSDSocketAddress.
A BSDSocketAddress or GenericBSDSocketAddress can be cast (like a downcast) to (the correct) type specific cast using sockaddr_cast:
All these classes provide a generic \c sockaddr API to interface with legacy \c sockaddr
based code (e.g. the BSD socket API). In this base-class, this interface is read-only, the
derived classes however provide a read-write interface.
Definition at line 67 of file BSDSocketAddress.hh.
|
protected |
|
protected |
| bool senf::BSDSocketAddress::boolean_test | ( | ) | const |
Return true, if address is not empty.
An address is considered empty if
| short senf::BSDSocketAddress::family | ( | ) | const |
Return the address family.
This value is found in the addressFamily member of each typed derived class (e.g. INet4Address::addressFamily)
| bool senf::BSDSocketAddress::operator< | ( | BSDSocketAddress const & | other | ) | const |
Compare two arbitrary addresses.
Ordering is based on the in-memory representation. It is primarily useful to use addresses as keys in a map or set.
|
protected |
| bool senf::BSDSocketAddress::operator== | ( | BSDSocketAddress const & | other | ) | const |
Compare two arbitrary addresses.
For addresses to be considered equal, they must have the same family, length and the data must be identical.
| struct sockaddr const* senf::BSDSocketAddress::sockaddr_p | ( | ) | const |
|
protected |
| socklen_t senf::BSDSocketAddress::socklen | ( | ) | const |
|
protected |
| socklen_t const* senf::BSDSocketAddress::socklen_p | ( | ) | const |
|
protected |
|
related |
Output generic socket address.
This stream operator will output a generic BSDSocketAddress in a family depending format.
|
related |
Safe socket address down-cast.
sockaddr_cast allows to safely cast a socket address to it's derived type. Only the family specific derived addressing classes are permissible for Target.
This cast is especially useful to cast a GenericBSDSocketAddress to it's concrete type.
|
related |
Safe socket address down-cast (const)
| char senf::BSDSocketAddress::_b[boost::alignment_of< struct sockaddr_storage >::value] |
Definition at line 121 of file BSDSocketAddress.hh.
| boost::type_with_alignment<boost::alignment_of<struct sockaddr_storage>::value> senf::BSDSocketAddress::a_ |
Definition at line 120 of file BSDSocketAddress.hh.
| socklen_t senf::BSDSocketAddress::len_ |
Definition at line 119 of file BSDSocketAddress.hh.