Describes an endpoint for a version-independent IP socket. More...
#include <basic_endpoint.hpp>
Classes | |
union | data_union |
Public Types | |
typedef asio::detail::socket_addr_type | data_type |
typedef InternetProtocol | protocol_type |
The protocol type associated with the endpoint. | |
Public Member Functions | |
asio::ip::address | address () const |
Get the IP address associated with the endpoint. | |
void | address (const asio::ip::address &addr) |
Set the IP address associated with the endpoint. | |
basic_endpoint () | |
Default constructor. | |
basic_endpoint (const InternetProtocol &protocol, unsigned short port_num) | |
basic_endpoint (const asio::ip::address &addr, unsigned short port_num) | |
basic_endpoint (const basic_endpoint &other) | |
Copy constructor. | |
std::size_t | capacity () const |
Get the capacity of the endpoint in the native type. | |
data_type * | data () |
Get the underlying endpoint in the native type. | |
const data_type * | data () const |
Get the underlying endpoint in the native type. | |
basic_endpoint & | operator= (const basic_endpoint &other) |
Assign from another endpoint. | |
unsigned short | port () const |
void | port (unsigned short port_num) |
protocol_type | protocol () const |
The protocol associated with the endpoint. | |
void | resize (std::size_t size) |
Set the underlying size of the endpoint in the native type. | |
std::size_t | size () const |
Get the underlying size of the endpoint in the native type. | |
Private Member Functions | |
bool | is_v4 () const |
Private Attributes | |
union asio::ip::basic_endpoint::data_union | data_ |
Friends | |
bool | operator!= (const basic_endpoint< InternetProtocol > &e1, const basic_endpoint< InternetProtocol > &e2) |
Compare two endpoints for inequality. | |
bool | operator< (const basic_endpoint< InternetProtocol > &e1, const basic_endpoint< InternetProtocol > &e2) |
Compare endpoints for ordering. | |
bool | operator== (const basic_endpoint< InternetProtocol > &e1, const basic_endpoint< InternetProtocol > &e2) |
Compare two endpoints for equality. | |
Related Functions | |
(Note that these are not member functions.) | |
template<typename Elem , typename Traits , typename InternetProtocol > | |
std::basic_ostream< Elem, Traits > & | operator<< (std::basic_ostream< Elem, Traits > &os, const basic_endpoint< InternetProtocol > &endpoint) |
Output an endpoint as a string. |
Describes an endpoint for a version-independent IP socket.
The asio::ip::basic_endpoint class template describes an endpoint that may be associated with a particular socket.
Definition at line 50 of file ip/basic_endpoint.hpp.
typedef asio::detail::socket_addr_type asio::ip::basic_endpoint< InternetProtocol >::data_type |
The type of the endpoint structure. This type is dependent on the underlying implementation of the socket layer.
Definition at line 61 of file ip/basic_endpoint.hpp.
typedef InternetProtocol asio::ip::basic_endpoint< InternetProtocol >::protocol_type |
The protocol type associated with the endpoint.
Definition at line 54 of file ip/basic_endpoint.hpp.
asio::ip::basic_endpoint< InternetProtocol >::basic_endpoint | ( | ) | [inline] |
Default constructor.
Definition at line 65 of file ip/basic_endpoint.hpp.
asio::ip::basic_endpoint< InternetProtocol >::basic_endpoint | ( | const InternetProtocol & | protocol, |
unsigned short | port_num | ||
) | [inline] |
Construct an endpoint using a port number, specified in the host's byte order. The IP address will be the any address (i.e. INADDR_ANY or in6addr_any). This constructor would typically be used for accepting new connections.
asio::ip::tcp::endpoint ep(asio::ip::tcp::v4(), 1234);
To specify an IPv6 UDP endpoint for port 9876, use:
asio::ip::udp::endpoint ep(asio::ip::udp::v6(), 9876);
Definition at line 89 of file ip/basic_endpoint.hpp.
asio::ip::basic_endpoint< InternetProtocol >::basic_endpoint | ( | const asio::ip::address & | addr, |
unsigned short | port_num | ||
) | [inline] |
Construct an endpoint using a port number and an IP address. This constructor may be used for accepting connections on a specific interface or for making a connection to a remote endpoint.
Definition at line 115 of file ip/basic_endpoint.hpp.
asio::ip::basic_endpoint< InternetProtocol >::basic_endpoint | ( | const basic_endpoint< InternetProtocol > & | other | ) | [inline] |
Copy constructor.
Definition at line 142 of file ip/basic_endpoint.hpp.
asio::ip::address asio::ip::basic_endpoint< InternetProtocol >::address | ( | ) | const [inline] |
Get the IP address associated with the endpoint.
Definition at line 232 of file ip/basic_endpoint.hpp.
void asio::ip::basic_endpoint< InternetProtocol >::address | ( | const asio::ip::address & | addr | ) | [inline] |
Set the IP address associated with the endpoint.
Definition at line 250 of file ip/basic_endpoint.hpp.
std::size_t asio::ip::basic_endpoint< InternetProtocol >::capacity | ( | ) | const [inline] |
Get the capacity of the endpoint in the native type.
Definition at line 194 of file ip/basic_endpoint.hpp.
data_type* asio::ip::basic_endpoint< InternetProtocol >::data | ( | ) | [inline] |
Get the underlying endpoint in the native type.
Definition at line 163 of file ip/basic_endpoint.hpp.
const data_type* asio::ip::basic_endpoint< InternetProtocol >::data | ( | ) | const [inline] |
Get the underlying endpoint in the native type.
Definition at line 169 of file ip/basic_endpoint.hpp.
bool asio::ip::basic_endpoint< InternetProtocol >::is_v4 | ( | ) | const [inline, private] |
Definition at line 283 of file ip/basic_endpoint.hpp.
basic_endpoint& asio::ip::basic_endpoint< InternetProtocol >::operator= | ( | const basic_endpoint< InternetProtocol > & | other | ) | [inline] |
Assign from another endpoint.
Definition at line 148 of file ip/basic_endpoint.hpp.
unsigned short asio::ip::basic_endpoint< InternetProtocol >::port | ( | ) | const [inline] |
Get the port associated with the endpoint. The port number is always in the host's byte order.
Definition at line 201 of file ip/basic_endpoint.hpp.
void asio::ip::basic_endpoint< InternetProtocol >::port | ( | unsigned short | port_num | ) | [inline] |
Set the port associated with the endpoint. The port number is always in the host's byte order.
Definition at line 217 of file ip/basic_endpoint.hpp.
protocol_type asio::ip::basic_endpoint< InternetProtocol >::protocol | ( | ) | const [inline] |
The protocol associated with the endpoint.
Definition at line 155 of file ip/basic_endpoint.hpp.
void asio::ip::basic_endpoint< InternetProtocol >::resize | ( | std::size_t | size | ) | [inline] |
Set the underlying size of the endpoint in the native type.
Definition at line 184 of file ip/basic_endpoint.hpp.
std::size_t asio::ip::basic_endpoint< InternetProtocol >::size | ( | ) | const [inline] |
Get the underlying size of the endpoint in the native type.
Definition at line 175 of file ip/basic_endpoint.hpp.
bool operator!= | ( | const basic_endpoint< InternetProtocol > & | e1, |
const basic_endpoint< InternetProtocol > & | e2 | ||
) | [friend] |
Compare two endpoints for inequality.
Definition at line 264 of file ip/basic_endpoint.hpp.
bool operator< | ( | const basic_endpoint< InternetProtocol > & | e1, |
const basic_endpoint< InternetProtocol > & | e2 | ||
) | [friend] |
Compare endpoints for ordering.
Definition at line 271 of file ip/basic_endpoint.hpp.
std::basic_ostream< Elem, Traits > & operator<< | ( | std::basic_ostream< Elem, Traits > & | os, |
const basic_endpoint< InternetProtocol > & | endpoint | ||
) | [related] |
Output an endpoint as a string.
Used to output a human-readable string for a specified endpoint.
os | The output stream to which the string will be written. |
endpoint | The endpoint to be written. |
Definition at line 337 of file ip/basic_endpoint.hpp.
bool operator== | ( | const basic_endpoint< InternetProtocol > & | e1, |
const basic_endpoint< InternetProtocol > & | e2 | ||
) | [friend] |
Compare two endpoints for equality.
Definition at line 257 of file ip/basic_endpoint.hpp.
union asio::ip::basic_endpoint::data_union asio::ip::basic_endpoint< InternetProtocol >::data_ [private] |