#include <peer.hpp>
Public Types | |
typedef P | protocol_type |
Public Member Functions | |
peer_base ()=default | |
peer_base (address addr) | |
peer_base (address addr, unsigned short port) | |
peer_base (const peer_base &x) | |
peer_base (peer_base &&x) noexcept | |
peer_base & | operator= (const peer_base &x) |
peer_base & | operator= (peer_base &&x) noexcept |
~peer_base ()=default | |
int | port () const |
protocol_type | protocol () const |
sockaddr * | data () |
const sockaddr * | data () const |
size_t | size () const |
address & | addr () |
const address & | addr () const |
std::string | to_string () const |
The peer_base class acts like the holder of network endpoint information like socket address and port. The template argument sets the protocol type either TCP or UDP.
P | Protocol type |
typedef P matador::peer_base< P >::protocol_type |
Short to protocol type
|
default |
Default constructor
|
inlineexplicit |
Creates a peer from a given address. Port is set to zero.
addr | Address to create the peer from |
|
inline |
Creates a peer from a given address and port
addr | Address to create the peer from |
port | Port of the endpoint |
|
inline |
Copy creates a peer from the given peer
x | Peer to copy from |
|
inlinenoexcept |
Move creates a peer from a given peer
x | Peer to move from |
|
default |
Destructor
|
inline |
Returns a reference to the address
|
inline |
Returns a reference to the address
|
inline |
Returns the raw pointer to the sockaddr structure
|
inline |
Returns the raw pointer to the sockaddr structure
|
inline |
Copy assigns a given peer to this peer
x | Peer to assign |
|
inlinenoexcept |
Assign moves the given peer to this peer
x | The peer to move assign |
|
inline |
Returns the current port of the peer.
|
inline |
Returns the current IP protocol of the peer address which is either IPv4 or IPv6
|
inline |
Returns the size of the underlying sockaddr structure
|
inline |
Converts the peer endpoint to a string in the format [ip]:[port]