#include <senf/Socket/Protocols/BSDAddressingPolicy.hh>
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 84 of file 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. |
|
static void | local (FileHandle const &handle, Address &addr) |
Return local of socket. |
|
template<class SPolicy > | |
static void | connect (SocketHandle< SPolicy > const &handle, Address const &addr) |
Connect to remote host. |
|
static void | bind (FileHandle const &handle, Address const &addr) |
Set local socket address. |
void senf::BSDAddressingPolicyMixin< Address >:: | ||||
bind | ( | FileHandle const & | handle, | |
Address const & | addr | ) | ||
Set local socket address.
[in] | handle | socket handle |
[in] | addr | local socket address |
Definition at line 95 of file BSDAddressingPolicy.cti.
void senf::BSDAddressingPolicyMixin< Address >:: | ||||
connect | ( | SocketHandle< SPolicy > const & | handle, | |
Address const & | addr | ) | ||
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 |
Definition at line 77 of file BSDAddressingPolicy.cti.
void senf::BSDAddressingPolicyMixin< Address >:: | ||||
local | ( | FileHandle const & | handle, | |
Address & | addr | ) | ||
Return local of socket.
[in] | handle | socket handle to check |
[out] | addr | local socket address |
Definition at line 82 of file BSDAddressingPolicy.cti.
void senf::BSDAddressingPolicyMixin< Address >:: | ||||
peer | ( | SocketHandle< SPolicy > const & | handle, | |
Address & | addr | ) | ||
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 |
Definition at line 55 of file BSDAddressingPolicy.cti.