File indexing completed on 2025-01-30 09:33:34
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_ASIO_IP_UDP_HPP
0012 #define BOOST_ASIO_IP_UDP_HPP
0013
0014 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
0015 # pragma once
0016 #endif
0017
0018 #include <boost/asio/detail/config.hpp>
0019 #include <boost/asio/basic_datagram_socket.hpp>
0020 #include <boost/asio/detail/socket_types.hpp>
0021 #include <boost/asio/ip/basic_endpoint.hpp>
0022 #include <boost/asio/ip/basic_resolver.hpp>
0023 #include <boost/asio/ip/basic_resolver_iterator.hpp>
0024 #include <boost/asio/ip/basic_resolver_query.hpp>
0025
0026 #include <boost/asio/detail/push_options.hpp>
0027
0028 namespace boost {
0029 namespace asio {
0030 namespace ip {
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043 class udp
0044 {
0045 public:
0046
0047 typedef basic_endpoint<udp> endpoint;
0048
0049
0050 static udp v4() noexcept
0051 {
0052 return udp(BOOST_ASIO_OS_DEF(AF_INET));
0053 }
0054
0055
0056 static udp v6() noexcept
0057 {
0058 return udp(BOOST_ASIO_OS_DEF(AF_INET6));
0059 }
0060
0061
0062 int type() const noexcept
0063 {
0064 return BOOST_ASIO_OS_DEF(SOCK_DGRAM);
0065 }
0066
0067
0068 int protocol() const noexcept
0069 {
0070 return BOOST_ASIO_OS_DEF(IPPROTO_UDP);
0071 }
0072
0073
0074 int family() const noexcept
0075 {
0076 return family_;
0077 }
0078
0079
0080 typedef basic_datagram_socket<udp> socket;
0081
0082
0083 typedef basic_resolver<udp> resolver;
0084
0085
0086 friend bool operator==(const udp& p1, const udp& p2)
0087 {
0088 return p1.family_ == p2.family_;
0089 }
0090
0091
0092 friend bool operator!=(const udp& p1, const udp& p2)
0093 {
0094 return p1.family_ != p2.family_;
0095 }
0096
0097 private:
0098
0099 explicit udp(int protocol_family) noexcept
0100 : family_(protocol_family)
0101 {
0102 }
0103
0104 int family_;
0105 };
0106
0107 }
0108 }
0109 }
0110
0111 #include <boost/asio/detail/pop_options.hpp>
0112
0113 #endif