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) 18 #include "asio/detail/config.hpp" 19 #include "asio/ip/address.hpp" 20 #include "asio/ip/detail/endpoint.hpp" 22 #if !defined(ASIO_NO_IOSTREAM) 24 #endif // !defined(ASIO_NO_IOSTREAM) 26 #include "asio/detail/push_options.hpp" 43 template <
typename InternetProtocol>
52 #if defined(GENERATING_DOCUMENTATION) 81 unsigned short port_num) ASIO_NOEXCEPT
82 : impl_(internet_protocol.family(), port_num)
90 unsigned short port_num) ASIO_NOEXCEPT
91 : impl_(addr, port_num)
101 #if defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) 107 #endif // defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) 116 #if defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) 123 #endif // defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) 129 return InternetProtocol::v4();
130 return InternetProtocol::v6();
134 data_type*
data() ASIO_NOEXCEPT
140 const data_type*
data() const ASIO_NOEXCEPT
146 std::size_t
size() const ASIO_NOEXCEPT
154 impl_.resize(new_size);
160 return impl_.capacity();
165 unsigned short port() const ASIO_NOEXCEPT
172 void port(
unsigned short port_num) ASIO_NOEXCEPT
174 impl_.port(port_num);
180 return impl_.address();
193 return e1.impl_ == e2.impl_;
204 friend bool operator<(const basic_endpoint<InternetProtocol>& e1,
207 return e1.impl_ < e2.impl_;
214 return e2.impl_ < e1.impl_;
218 friend bool operator<=(const basic_endpoint<InternetProtocol>& e1,
236 #if !defined(ASIO_NO_IOSTREAM) 250 template <
typename Elem,
typename Traits,
typename InternetProtocol>
252 std::basic_ostream<Elem, Traits>& os,
255 #endif // !defined(ASIO_NO_IOSTREAM) 260 #include "asio/detail/pop_options.hpp" 262 #include "asio/ip/impl/basic_endpoint.hpp" 264 #endif // ASIO_IP_BASIC_ENDPOINT_HPP Describes an endpoint for a version-independent IP socket.
Definition: basic_endpoint.hpp:44
std::basic_ostream< Elem, Traits > & operator<<(std::basic_ostream< Elem, Traits > &os, const basic_endpoint< InternetProtocol > &endpoint)
Output an endpoint as a string.
Definition: basic_endpoint.hpp:28
InternetProtocol protocol_type
The protocol type associated with the endpoint.
Definition: basic_endpoint.hpp:48
data_type * data() ASIO_NOEXCEPT
Get the underlying endpoint in the native type.
Definition: basic_endpoint.hpp:134
const data_type * data() const ASIO_NOEXCEPT
Get the underlying endpoint in the native type.
Definition: basic_endpoint.hpp:140
basic_endpoint(const InternetProtocol &internet_protocol, unsigned short port_num) ASIO_NOEXCEPT
Construct an endpoint using a port number, specified in the host's byte order.
Definition: basic_endpoint.hpp:80
friend bool operator==(const basic_endpoint< InternetProtocol > &e1, const basic_endpoint< InternetProtocol > &e2) ASIO_NOEXCEPT
Compare two endpoints for equality.
Definition: basic_endpoint.hpp:190
friend bool operator!=(const basic_endpoint< InternetProtocol > &e1, const basic_endpoint< InternetProtocol > &e2) ASIO_NOEXCEPT
Compare two endpoints for inequality.
Definition: basic_endpoint.hpp:197
void resize(std::size_t new_size)
Set the underlying size of the endpoint in the native type.
Definition: basic_endpoint.hpp:152
Implements version-independent IP addresses.
Definition: address.hpp:46
basic_endpoint & operator=(const basic_endpoint &other) ASIO_NOEXCEPT
Assign from another endpoint.
Definition: basic_endpoint.hpp:110
asio::detail::socket_addr_type data_type
The type of the endpoint structure.
Definition: basic_endpoint.hpp:55
friend bool operator>(const basic_endpoint< InternetProtocol > &e1, const basic_endpoint< InternetProtocol > &e2) ASIO_NOEXCEPT
Compare endpoints for ordering.
Definition: basic_endpoint.hpp:211
Definition: endpoint.hpp:32
basic_endpoint(const basic_endpoint &other) ASIO_NOEXCEPT
Copy constructor.
Definition: basic_endpoint.hpp:96
std::size_t size() const ASIO_NOEXCEPT
Get the underlying size of the endpoint in the native type.
Definition: basic_endpoint.hpp:146
unsigned short port() const ASIO_NOEXCEPT
Get the port associated with the endpoint.
Definition: basic_endpoint.hpp:165
protocol_type protocol() const ASIO_NOEXCEPT
The protocol associated with the endpoint.
Definition: basic_endpoint.hpp:126
void port(unsigned short port_num) ASIO_NOEXCEPT
Set the port associated with the endpoint.
Definition: basic_endpoint.hpp:172
void address(const asio::ip::address &addr) ASIO_NOEXCEPT
Set the IP address associated with the endpoint.
Definition: basic_endpoint.hpp:184
Definition: any_io_executor.hpp:28
friend bool operator>=(const basic_endpoint< InternetProtocol > &e1, const basic_endpoint< InternetProtocol > &e2) ASIO_NOEXCEPT
Compare endpoints for ordering.
Definition: basic_endpoint.hpp:225
std::size_t capacity() const ASIO_NOEXCEPT
Get the capacity of the endpoint in the native type.
Definition: basic_endpoint.hpp:158
basic_endpoint(const asio::ip::address &addr, unsigned short port_num) ASIO_NOEXCEPT
Construct an endpoint using a port number and an IP address.
Definition: basic_endpoint.hpp:89
asio::ip::address address() const ASIO_NOEXCEPT
Get the IP address associated with the endpoint.
Definition: basic_endpoint.hpp:178
basic_endpoint() ASIO_NOEXCEPT
Default constructor.
Definition: basic_endpoint.hpp:59