11 #ifndef ASIO_IP_BASIC_ENDPOINT_HPP 12 #define ASIO_IP_BASIC_ENDPOINT_HPP 14 #if defined(_MSC_VER) && (_MSC_VER >= 1200) 16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 22 #if !defined(ASIO_NO_IOSTREAM) 24 #endif // !defined(ASIO_NO_IOSTREAM) 43 template <
typename InternetProtocol>
52 #if defined(GENERATING_DOCUMENTATION) 81 unsigned short port_num)
82 : impl_(internet_protocol.family(), port_num)
90 : impl_(addr, port_num)
100 #if defined(ASIO_HAS_MOVE) 106 #endif // defined(ASIO_HAS_MOVE) 115 #if defined(ASIO_HAS_MOVE) 122 #endif // defined(ASIO_HAS_MOVE) 128 return InternetProtocol::v4();
129 return InternetProtocol::v6();
171 void port(
unsigned short port_num)
173 impl_.
port(port_num);
192 return e1.impl_ == e2.impl_;
203 friend bool operator<(const basic_endpoint<InternetProtocol>& e1,
206 return e1.impl_ < e2.impl_;
213 return e2.impl_ < e1.impl_;
217 friend bool operator<=(const basic_endpoint<InternetProtocol>& e1,
235 #if !defined(ASIO_NO_IOSTREAM) 249 template <
typename Elem,
typename Traits,
typename InternetProtocol>
251 std::basic_ostream<Elem, Traits>& os,
254 #endif // !defined(ASIO_NO_IOSTREAM) 263 #endif // ASIO_IP_BASIC_ENDPOINT_HPP std::size_t capacity() const
Get the capacity of the endpoint in the native type.
basic_endpoint(const InternetProtocol &internet_protocol, unsigned short port_num)
Describes an endpoint for a version-independent IP socket.
std::basic_ostream< Elem, Traits > & operator<<(std::basic_ostream< Elem, Traits > &os, const basic_endpoint< InternetProtocol > &endpoint)
Output an endpoint as a string.
void address(const asio::ip::address &addr)
Set the IP address associated with the endpoint.
protocol_type protocol() const
The protocol associated with the endpoint.
ASIO_DECL asio::ip::address address() const
asio::detail::socket_addr_type * data()
InternetProtocol protocol_type
The protocol type associated with the endpoint.
friend bool operator>=(const basic_endpoint< InternetProtocol > &e1, const basic_endpoint< InternetProtocol > &e2)
Compare endpoints for ordering.
basic_endpoint(const asio::ip::address &addr, unsigned short port_num)
sockaddr socket_addr_type
data_type * data()
Get the underlying endpoint in the native type.
friend bool operator>(const basic_endpoint< InternetProtocol > &e1, const basic_endpoint< InternetProtocol > &e2)
Compare endpoints for ordering.
asio::ip::address address() const
Get the IP address associated with the endpoint.
friend bool operator!=(const basic_endpoint< InternetProtocol > &e1, const basic_endpoint< InternetProtocol > &e2)
Compare two endpoints for inequality.
friend bool operator==(const basic_endpoint< InternetProtocol > &e1, const basic_endpoint< InternetProtocol > &e2)
Compare two endpoints for equality.
unsigned short port() const
void resize(std::size_t new_size)
Set the underlying size of the endpoint in the native type.
Implements version-independent IP addresses.
asio::detail::socket_addr_type data_type
ASIO_DECL unsigned short port() const
const data_type * data() const
Get the underlying endpoint in the native type.
std::size_t capacity() const
void port(unsigned short port_num)
basic_endpoint(const basic_endpoint &other)
Copy constructor.
std::size_t size() const
Get the underlying size of the endpoint in the native type.
basic_endpoint()
Default constructor.
ASIO_DECL void resize(std::size_t new_size)
basic_endpoint & operator=(const basic_endpoint &other)
Assign from another endpoint.