Template for generic AddressingPolicy implementation based on the BSD socket API. More...
#include <senf/Socket/Protocols/BSDAddressingPolicy.hh>
Static Public Member Functions | |
template<class SPolicy > | |
static void | peer (SocketHandle< SPolicy > const &handle, Address &addr) |
Return address of remote peer on connected sockets. More... | |
static void | local (FileHandle const &handle, Address &addr) |
Return local of socket. More... | |
template<class SPolicy > | |
static void | connect (SocketHandle< SPolicy > const &handle, Address const &addr) |
Connect to remote host. More... | |
static void | bind (FileHandle const &handle, Address const &addr) |
Set local socket address. More... | |
Template for generic AddressingPolicy implementation based on the BSD socket API.
This template provides an implementation template to implement generic addressing policy classes which rely on the standard BSD socket API for their implementation (connect/bind/getsockname/getpeername).
The Address template parameter specifies the address type of the addressing policy. This type must have two members: sockaddr_p()
and socklen()
. The first must return a struct sockaddr *
to the address, the second must return the size of the address in bytes. The pointer returned by sockaddr_p()
must be non-const if called on a non-const address. The underlying socket address stored at that pointer might be modified.
This template class is inherited into addressing policy classes via private inheritance. Then the members supported by the respective addressing policy are made available via using
declarations (See INet4AddressingPolicy for an Example).
Definition at line 75 of file BSDAddressingPolicy.hh.
|
static |
Set local socket address.
[in] | handle | socket handle |
[in] | addr | local socket address |
|
static |
Connect to remote host.
This member is only available if the socket handles communication policy is ConnectedCommunicationPolicy.
[in] | handle | socket handle |
[in] | addr | address of remote peer to connect to |
|
static |
Return local of socket.
[in] | handle | socket handle to check |
[out] | addr | local socket address |
|
static |
Return address of remote peer on connected sockets.
This member is only available if the socket handles communication policy is ConnectedCommunicationPolicy.
[in] | handle | socket handle to get peer address of |
[out] | addr | address of remote peer |