123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- #ifndef BOOST_ASIO_GENERIC_DETAIL_ENDPOINT_HPP
- #define BOOST_ASIO_GENERIC_DETAIL_ENDPOINT_HPP
- #if defined(_MSC_VER) && (_MSC_VER >= 1200)
- # pragma once
- #endif
- #include <boost/asio/detail/config.hpp>
- #include <cstddef>
- #include <boost/asio/detail/socket_types.hpp>
- #include <boost/asio/detail/push_options.hpp>
- namespace boost {
- namespace asio {
- namespace generic {
- namespace detail {
- class endpoint
- {
- public:
-
- BOOST_ASIO_DECL endpoint();
-
- BOOST_ASIO_DECL endpoint(const void* sock_addr,
- std::size_t sock_addr_size, int sock_protocol);
-
- endpoint(const endpoint& other)
- : data_(other.data_),
- size_(other.size_),
- protocol_(other.protocol_)
- {
- }
-
- endpoint& operator=(const endpoint& other)
- {
- data_ = other.data_;
- size_ = other.size_;
- protocol_ = other.protocol_;
- return *this;
- }
-
- int family() const
- {
- return data_.base.sa_family;
- }
-
- int protocol() const
- {
- return protocol_;
- }
-
- boost::asio::detail::socket_addr_type* data()
- {
- return &data_.base;
- }
-
- const boost::asio::detail::socket_addr_type* data() const
- {
- return &data_.base;
- }
-
- std::size_t size() const
- {
- return size_;
- }
-
- BOOST_ASIO_DECL void resize(std::size_t size);
-
- std::size_t capacity() const
- {
- return sizeof(boost::asio::detail::sockaddr_storage_type);
- }
-
- BOOST_ASIO_DECL friend bool operator==(
- const endpoint& e1, const endpoint& e2);
-
- BOOST_ASIO_DECL friend bool operator<(
- const endpoint& e1, const endpoint& e2);
- private:
-
- union data_union
- {
- boost::asio::detail::socket_addr_type base;
- boost::asio::detail::sockaddr_storage_type generic;
- } data_;
-
- std::size_t size_;
-
- int protocol_;
-
- BOOST_ASIO_DECL void init(const void* sock_addr,
- std::size_t sock_addr_size, int sock_protocol);
- };
- }
- }
- }
- }
- #include <boost/asio/detail/pop_options.hpp>
- #if defined(BOOST_ASIO_HEADER_ONLY)
- # include <boost/asio/generic/detail/impl/endpoint.ipp>
- #endif
- #endif
|