File indexing completed on 2025-01-18 09:29:00
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef BOOST_ASIO_LOCAL_DETAIL_ENDPOINT_HPP
0013 #define BOOST_ASIO_LOCAL_DETAIL_ENDPOINT_HPP
0014
0015 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
0016 # pragma once
0017 #endif
0018
0019 #include <boost/asio/detail/config.hpp>
0020
0021 #if defined(BOOST_ASIO_HAS_LOCAL_SOCKETS)
0022
0023 #include <cstddef>
0024 #include <string>
0025 #include <boost/asio/detail/socket_types.hpp>
0026 #include <boost/asio/detail/string_view.hpp>
0027
0028 #include <boost/asio/detail/push_options.hpp>
0029
0030 namespace boost {
0031 namespace asio {
0032 namespace local {
0033 namespace detail {
0034
0035
0036 class endpoint
0037 {
0038 public:
0039
0040 BOOST_ASIO_DECL endpoint();
0041
0042
0043 BOOST_ASIO_DECL endpoint(const char* path_name);
0044
0045
0046 BOOST_ASIO_DECL endpoint(const std::string& path_name);
0047
0048 #if defined(BOOST_ASIO_HAS_STRING_VIEW)
0049
0050 BOOST_ASIO_DECL endpoint(string_view path_name);
0051 #endif
0052
0053
0054 endpoint(const endpoint& other)
0055 : data_(other.data_),
0056 path_length_(other.path_length_)
0057 {
0058 }
0059
0060
0061 endpoint& operator=(const endpoint& other)
0062 {
0063 data_ = other.data_;
0064 path_length_ = other.path_length_;
0065 return *this;
0066 }
0067
0068
0069 boost::asio::detail::socket_addr_type* data()
0070 {
0071 return &data_.base;
0072 }
0073
0074
0075 const boost::asio::detail::socket_addr_type* data() const
0076 {
0077 return &data_.base;
0078 }
0079
0080
0081 std::size_t size() const
0082 {
0083 return path_length_
0084 + offsetof(boost::asio::detail::sockaddr_un_type, sun_path);
0085 }
0086
0087
0088 BOOST_ASIO_DECL void resize(std::size_t size);
0089
0090
0091 std::size_t capacity() const
0092 {
0093 return sizeof(boost::asio::detail::sockaddr_un_type);
0094 }
0095
0096
0097 BOOST_ASIO_DECL std::string path() const;
0098
0099
0100 BOOST_ASIO_DECL void path(const char* p);
0101
0102
0103 BOOST_ASIO_DECL void path(const std::string& p);
0104
0105
0106 BOOST_ASIO_DECL friend bool operator==(
0107 const endpoint& e1, const endpoint& e2);
0108
0109
0110 BOOST_ASIO_DECL friend bool operator<(
0111 const endpoint& e1, const endpoint& e2);
0112
0113 private:
0114
0115 union data_union
0116 {
0117 boost::asio::detail::socket_addr_type base;
0118 boost::asio::detail::sockaddr_un_type local;
0119 } data_;
0120
0121
0122 std::size_t path_length_;
0123
0124
0125 BOOST_ASIO_DECL void init(const char* path, std::size_t path_length);
0126 };
0127
0128 }
0129 }
0130 }
0131 }
0132
0133 #include <boost/asio/detail/pop_options.hpp>
0134
0135 #if defined(BOOST_ASIO_HEADER_ONLY)
0136 # include <boost/asio/local/detail/impl/endpoint.ipp>
0137 #endif
0138
0139 #endif
0140
0141 #endif