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_ICMP_HPP
0012 #define BOOST_ASIO_IP_ICMP_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/detail/socket_types.hpp>
0020 #include <boost/asio/basic_raw_socket.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 icmp
0044 {
0045 public:
0046
0047 typedef basic_endpoint<icmp> endpoint;
0048
0049
0050 static icmp v4() noexcept
0051 {
0052 return icmp(BOOST_ASIO_OS_DEF(IPPROTO_ICMP),
0053 BOOST_ASIO_OS_DEF(AF_INET));
0054 }
0055
0056
0057 static icmp v6() noexcept
0058 {
0059 return icmp(BOOST_ASIO_OS_DEF(IPPROTO_ICMPV6),
0060 BOOST_ASIO_OS_DEF(AF_INET6));
0061 }
0062
0063
0064 int type() const noexcept
0065 {
0066 return BOOST_ASIO_OS_DEF(SOCK_RAW);
0067 }
0068
0069
0070 int protocol() const noexcept
0071 {
0072 return protocol_;
0073 }
0074
0075
0076 int family() const noexcept
0077 {
0078 return family_;
0079 }
0080
0081
0082 typedef basic_raw_socket<icmp> socket;
0083
0084
0085 typedef basic_resolver<icmp> resolver;
0086
0087
0088 friend bool operator==(const icmp& p1, const icmp& p2)
0089 {
0090 return p1.protocol_ == p2.protocol_ && p1.family_ == p2.family_;
0091 }
0092
0093
0094 friend bool operator!=(const icmp& p1, const icmp& p2)
0095 {
0096 return p1.protocol_ != p2.protocol_ || p1.family_ != p2.family_;
0097 }
0098
0099 private:
0100
0101 explicit icmp(int protocol_id, int protocol_family) noexcept
0102 : protocol_(protocol_id),
0103 family_(protocol_family)
0104 {
0105 }
0106
0107 int protocol_;
0108 int family_;
0109 };
0110
0111 }
0112 }
0113 }
0114
0115 #include <boost/asio/detail/pop_options.hpp>
0116
0117 #endif