icmp.cpp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577
  1. //
  2. // icmp.cpp
  3. // ~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
  6. //
  7. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  8. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  9. //
  10. // Disable autolinking for unit tests.
  11. #if !defined(BOOST_ALL_NO_LIB)
  12. #define BOOST_ALL_NO_LIB 1
  13. #endif // !defined(BOOST_ALL_NO_LIB)
  14. // Test that header file is self-contained.
  15. #include <boost/asio/ip/icmp.hpp>
  16. #include <cstring>
  17. #include <boost/asio/io_context.hpp>
  18. #include <boost/asio/placeholders.hpp>
  19. #include "../unit_test.hpp"
  20. #include "../archetypes/async_result.hpp"
  21. #include "../archetypes/gettable_socket_option.hpp"
  22. #include "../archetypes/io_control_command.hpp"
  23. #include "../archetypes/settable_socket_option.hpp"
  24. //------------------------------------------------------------------------------
  25. // ip_icmp_socket_compile test
  26. // ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  27. // The following test checks that all public member functions on the class
  28. // ip::icmp::socket compile and link correctly. Runtime failures are ignored.
  29. namespace ip_icmp_socket_compile {
  30. struct connect_handler
  31. {
  32. connect_handler() {}
  33. void operator()(const boost::system::error_code&) {}
  34. #if defined(BOOST_ASIO_HAS_MOVE)
  35. connect_handler(connect_handler&&) {}
  36. private:
  37. connect_handler(const connect_handler&);
  38. #endif // defined(BOOST_ASIO_HAS_MOVE)
  39. };
  40. struct send_handler
  41. {
  42. send_handler() {}
  43. void operator()(const boost::system::error_code&, std::size_t) {}
  44. #if defined(BOOST_ASIO_HAS_MOVE)
  45. send_handler(send_handler&&) {}
  46. private:
  47. send_handler(const send_handler&);
  48. #endif // defined(BOOST_ASIO_HAS_MOVE)
  49. };
  50. struct receive_handler
  51. {
  52. receive_handler() {}
  53. void operator()(const boost::system::error_code&, std::size_t) {}
  54. #if defined(BOOST_ASIO_HAS_MOVE)
  55. receive_handler(receive_handler&&) {}
  56. private:
  57. receive_handler(const receive_handler&);
  58. #endif // defined(BOOST_ASIO_HAS_MOVE)
  59. };
  60. void test()
  61. {
  62. using namespace boost::asio;
  63. namespace ip = boost::asio::ip;
  64. try
  65. {
  66. io_context ioc;
  67. const io_context::executor_type ioc_ex = ioc.get_executor();
  68. char mutable_char_buffer[128] = "";
  69. const char const_char_buffer[128] = "";
  70. socket_base::message_flags in_flags = 0;
  71. archetypes::settable_socket_option<void> settable_socket_option1;
  72. archetypes::settable_socket_option<int> settable_socket_option2;
  73. archetypes::settable_socket_option<double> settable_socket_option3;
  74. archetypes::gettable_socket_option<void> gettable_socket_option1;
  75. archetypes::gettable_socket_option<int> gettable_socket_option2;
  76. archetypes::gettable_socket_option<double> gettable_socket_option3;
  77. archetypes::io_control_command io_control_command;
  78. archetypes::lazy_handler lazy;
  79. boost::system::error_code ec;
  80. // basic_datagram_socket constructors.
  81. ip::icmp::socket socket1(ioc);
  82. ip::icmp::socket socket2(ioc, ip::icmp::v4());
  83. ip::icmp::socket socket3(ioc, ip::icmp::v6());
  84. ip::icmp::socket socket4(ioc, ip::icmp::endpoint(ip::icmp::v4(), 0));
  85. ip::icmp::socket socket5(ioc, ip::icmp::endpoint(ip::icmp::v6(), 0));
  86. #if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
  87. ip::icmp::socket::native_handle_type native_socket1
  88. = ::socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
  89. ip::icmp::socket socket6(ioc, ip::icmp::v4(), native_socket1);
  90. #endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
  91. ip::icmp::socket socket7(ioc_ex);
  92. ip::icmp::socket socket8(ioc_ex, ip::icmp::v4());
  93. ip::icmp::socket socket9(ioc_ex, ip::icmp::v6());
  94. ip::icmp::socket socket10(ioc_ex, ip::icmp::endpoint(ip::icmp::v4(), 0));
  95. ip::icmp::socket socket11(ioc_ex, ip::icmp::endpoint(ip::icmp::v6(), 0));
  96. #if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
  97. ip::icmp::socket::native_handle_type native_socket2
  98. = ::socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
  99. ip::icmp::socket socket12(ioc_ex, ip::icmp::v4(), native_socket2);
  100. #endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
  101. #if defined(BOOST_ASIO_HAS_MOVE)
  102. ip::icmp::socket socket13(std::move(socket6));
  103. #endif // defined(BOOST_ASIO_HAS_MOVE)
  104. // basic_datagram_socket operators.
  105. #if defined(BOOST_ASIO_HAS_MOVE)
  106. socket1 = ip::icmp::socket(ioc);
  107. socket1 = std::move(socket2);
  108. #endif // defined(BOOST_ASIO_HAS_MOVE)
  109. // basic_io_object functions.
  110. ip::icmp::socket::executor_type ex = socket1.get_executor();
  111. (void)ex;
  112. // basic_socket functions.
  113. ip::icmp::socket::lowest_layer_type& lowest_layer = socket1.lowest_layer();
  114. (void)lowest_layer;
  115. const ip::icmp::socket& socket14 = socket1;
  116. const ip::icmp::socket::lowest_layer_type& lowest_layer2
  117. = socket14.lowest_layer();
  118. (void)lowest_layer2;
  119. socket1.open(ip::icmp::v4());
  120. socket1.open(ip::icmp::v6());
  121. socket1.open(ip::icmp::v4(), ec);
  122. socket1.open(ip::icmp::v6(), ec);
  123. #if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
  124. ip::icmp::socket::native_handle_type native_socket3
  125. = ::socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
  126. socket1.assign(ip::icmp::v4(), native_socket3);
  127. ip::icmp::socket::native_handle_type native_socket4
  128. = ::socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
  129. socket1.assign(ip::icmp::v4(), native_socket4, ec);
  130. #endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
  131. bool is_open = socket1.is_open();
  132. (void)is_open;
  133. socket1.close();
  134. socket1.close(ec);
  135. socket1.release();
  136. socket1.release(ec);
  137. ip::icmp::socket::native_handle_type native_socket5
  138. = socket1.native_handle();
  139. (void)native_socket5;
  140. socket1.cancel();
  141. socket1.cancel(ec);
  142. bool at_mark1 = socket1.at_mark();
  143. (void)at_mark1;
  144. bool at_mark2 = socket1.at_mark(ec);
  145. (void)at_mark2;
  146. std::size_t available1 = socket1.available();
  147. (void)available1;
  148. std::size_t available2 = socket1.available(ec);
  149. (void)available2;
  150. socket1.bind(ip::icmp::endpoint(ip::icmp::v4(), 0));
  151. socket1.bind(ip::icmp::endpoint(ip::icmp::v6(), 0));
  152. socket1.bind(ip::icmp::endpoint(ip::icmp::v4(), 0), ec);
  153. socket1.bind(ip::icmp::endpoint(ip::icmp::v6(), 0), ec);
  154. socket1.connect(ip::icmp::endpoint(ip::icmp::v4(), 0));
  155. socket1.connect(ip::icmp::endpoint(ip::icmp::v6(), 0));
  156. socket1.connect(ip::icmp::endpoint(ip::icmp::v4(), 0), ec);
  157. socket1.connect(ip::icmp::endpoint(ip::icmp::v6(), 0), ec);
  158. socket1.async_connect(ip::icmp::endpoint(ip::icmp::v4(), 0),
  159. connect_handler());
  160. socket1.async_connect(ip::icmp::endpoint(ip::icmp::v6(), 0),
  161. connect_handler());
  162. int i1 = socket1.async_connect(ip::icmp::endpoint(ip::icmp::v4(), 0), lazy);
  163. (void)i1;
  164. int i2 = socket1.async_connect(ip::icmp::endpoint(ip::icmp::v6(), 0), lazy);
  165. (void)i2;
  166. socket1.set_option(settable_socket_option1);
  167. socket1.set_option(settable_socket_option1, ec);
  168. socket1.set_option(settable_socket_option2);
  169. socket1.set_option(settable_socket_option2, ec);
  170. socket1.set_option(settable_socket_option3);
  171. socket1.set_option(settable_socket_option3, ec);
  172. socket1.get_option(gettable_socket_option1);
  173. socket1.get_option(gettable_socket_option1, ec);
  174. socket1.get_option(gettable_socket_option2);
  175. socket1.get_option(gettable_socket_option2, ec);
  176. socket1.get_option(gettable_socket_option3);
  177. socket1.get_option(gettable_socket_option3, ec);
  178. socket1.io_control(io_control_command);
  179. socket1.io_control(io_control_command, ec);
  180. bool non_blocking1 = socket1.non_blocking();
  181. (void)non_blocking1;
  182. socket1.non_blocking(true);
  183. socket1.non_blocking(false, ec);
  184. bool non_blocking2 = socket1.native_non_blocking();
  185. (void)non_blocking2;
  186. socket1.native_non_blocking(true);
  187. socket1.native_non_blocking(false, ec);
  188. ip::icmp::endpoint endpoint1 = socket1.local_endpoint();
  189. (void)endpoint1;
  190. ip::icmp::endpoint endpoint2 = socket1.local_endpoint(ec);
  191. (void)endpoint2;
  192. ip::icmp::endpoint endpoint3 = socket1.remote_endpoint();
  193. (void)endpoint3;
  194. ip::icmp::endpoint endpoint4 = socket1.remote_endpoint(ec);
  195. (void)endpoint4;
  196. socket1.shutdown(socket_base::shutdown_both);
  197. socket1.shutdown(socket_base::shutdown_both, ec);
  198. // basic_datagram_socket functions.
  199. socket1.send(buffer(mutable_char_buffer));
  200. socket1.send(buffer(const_char_buffer));
  201. socket1.send(null_buffers());
  202. socket1.send(buffer(mutable_char_buffer), in_flags);
  203. socket1.send(buffer(const_char_buffer), in_flags);
  204. socket1.send(null_buffers(), in_flags);
  205. socket1.send(buffer(mutable_char_buffer), in_flags, ec);
  206. socket1.send(buffer(const_char_buffer), in_flags, ec);
  207. socket1.send(null_buffers(), in_flags, ec);
  208. socket1.async_send(buffer(mutable_char_buffer), send_handler());
  209. socket1.async_send(buffer(const_char_buffer), send_handler());
  210. socket1.async_send(null_buffers(), send_handler());
  211. socket1.async_send(buffer(mutable_char_buffer), in_flags, send_handler());
  212. socket1.async_send(buffer(const_char_buffer), in_flags, send_handler());
  213. socket1.async_send(null_buffers(), in_flags, send_handler());
  214. int i3 = socket1.async_send(buffer(mutable_char_buffer), lazy);
  215. (void)i3;
  216. int i4 = socket1.async_send(buffer(const_char_buffer), lazy);
  217. (void)i4;
  218. int i5 = socket1.async_send(null_buffers(), lazy);
  219. (void)i5;
  220. int i6 = socket1.async_send(buffer(mutable_char_buffer), in_flags, lazy);
  221. (void)i6;
  222. int i7 = socket1.async_send(buffer(const_char_buffer), in_flags, lazy);
  223. (void)i7;
  224. int i8 = socket1.async_send(null_buffers(), in_flags, lazy);
  225. (void)i8;
  226. socket1.send_to(buffer(mutable_char_buffer),
  227. ip::icmp::endpoint(ip::icmp::v4(), 0));
  228. socket1.send_to(buffer(mutable_char_buffer),
  229. ip::icmp::endpoint(ip::icmp::v6(), 0));
  230. socket1.send_to(buffer(const_char_buffer),
  231. ip::icmp::endpoint(ip::icmp::v4(), 0));
  232. socket1.send_to(buffer(const_char_buffer),
  233. ip::icmp::endpoint(ip::icmp::v6(), 0));
  234. socket1.send_to(null_buffers(),
  235. ip::icmp::endpoint(ip::icmp::v4(), 0));
  236. socket1.send_to(null_buffers(),
  237. ip::icmp::endpoint(ip::icmp::v6(), 0));
  238. socket1.send_to(buffer(mutable_char_buffer),
  239. ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags);
  240. socket1.send_to(buffer(mutable_char_buffer),
  241. ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags);
  242. socket1.send_to(buffer(const_char_buffer),
  243. ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags);
  244. socket1.send_to(buffer(const_char_buffer),
  245. ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags);
  246. socket1.send_to(null_buffers(),
  247. ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags);
  248. socket1.send_to(null_buffers(),
  249. ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags);
  250. socket1.send_to(buffer(mutable_char_buffer),
  251. ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags, ec);
  252. socket1.send_to(buffer(mutable_char_buffer),
  253. ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags, ec);
  254. socket1.send_to(buffer(const_char_buffer),
  255. ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags, ec);
  256. socket1.send_to(buffer(const_char_buffer),
  257. ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags, ec);
  258. socket1.send_to(null_buffers(),
  259. ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags, ec);
  260. socket1.send_to(null_buffers(),
  261. ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags, ec);
  262. socket1.async_send_to(buffer(mutable_char_buffer),
  263. ip::icmp::endpoint(ip::icmp::v4(), 0), send_handler());
  264. socket1.async_send_to(buffer(mutable_char_buffer),
  265. ip::icmp::endpoint(ip::icmp::v6(), 0), send_handler());
  266. socket1.async_send_to(buffer(const_char_buffer),
  267. ip::icmp::endpoint(ip::icmp::v4(), 0), send_handler());
  268. socket1.async_send_to(buffer(const_char_buffer),
  269. ip::icmp::endpoint(ip::icmp::v6(), 0), send_handler());
  270. socket1.async_send_to(null_buffers(),
  271. ip::icmp::endpoint(ip::icmp::v4(), 0), send_handler());
  272. socket1.async_send_to(null_buffers(),
  273. ip::icmp::endpoint(ip::icmp::v6(), 0), send_handler());
  274. socket1.async_send_to(buffer(mutable_char_buffer),
  275. ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags, send_handler());
  276. socket1.async_send_to(buffer(mutable_char_buffer),
  277. ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags, send_handler());
  278. socket1.async_send_to(buffer(const_char_buffer),
  279. ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags, send_handler());
  280. socket1.async_send_to(buffer(const_char_buffer),
  281. ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags, send_handler());
  282. socket1.async_send_to(null_buffers(),
  283. ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags, send_handler());
  284. socket1.async_send_to(null_buffers(),
  285. ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags, send_handler());
  286. int i9 = socket1.async_send_to(buffer(mutable_char_buffer),
  287. ip::icmp::endpoint(ip::icmp::v4(), 0), lazy);
  288. (void)i9;
  289. int i10 = socket1.async_send_to(buffer(mutable_char_buffer),
  290. ip::icmp::endpoint(ip::icmp::v6(), 0), lazy);
  291. (void)i10;
  292. int i11 = socket1.async_send_to(buffer(const_char_buffer),
  293. ip::icmp::endpoint(ip::icmp::v4(), 0), lazy);
  294. (void)i11;
  295. int i12 = socket1.async_send_to(buffer(const_char_buffer),
  296. ip::icmp::endpoint(ip::icmp::v6(), 0), lazy);
  297. (void)i12;
  298. int i13 = socket1.async_send_to(null_buffers(),
  299. ip::icmp::endpoint(ip::icmp::v4(), 0), lazy);
  300. (void)i13;
  301. int i14 = socket1.async_send_to(null_buffers(),
  302. ip::icmp::endpoint(ip::icmp::v6(), 0), lazy);
  303. (void)i14;
  304. int i15 = socket1.async_send_to(buffer(mutable_char_buffer),
  305. ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags, lazy);
  306. (void)i15;
  307. int i16 = socket1.async_send_to(buffer(mutable_char_buffer),
  308. ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags, lazy);
  309. (void)i16;
  310. int i17 = socket1.async_send_to(buffer(const_char_buffer),
  311. ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags, lazy);
  312. (void)i17;
  313. int i18 = socket1.async_send_to(buffer(const_char_buffer),
  314. ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags, lazy);
  315. (void)i18;
  316. int i19 = socket1.async_send_to(null_buffers(),
  317. ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags, lazy);
  318. (void)i19;
  319. int i20 = socket1.async_send_to(null_buffers(),
  320. ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags, lazy);
  321. (void)i20;
  322. socket1.receive(buffer(mutable_char_buffer));
  323. socket1.receive(null_buffers());
  324. socket1.receive(buffer(mutable_char_buffer), in_flags);
  325. socket1.receive(null_buffers(), in_flags);
  326. socket1.receive(buffer(mutable_char_buffer), in_flags, ec);
  327. socket1.receive(null_buffers(), in_flags, ec);
  328. socket1.async_receive(buffer(mutable_char_buffer), receive_handler());
  329. socket1.async_receive(null_buffers(), receive_handler());
  330. socket1.async_receive(buffer(mutable_char_buffer), in_flags,
  331. receive_handler());
  332. socket1.async_receive(null_buffers(), in_flags, receive_handler());
  333. int i21 = socket1.async_receive(buffer(mutable_char_buffer), lazy);
  334. (void)i21;
  335. int i22 = socket1.async_receive(null_buffers(), lazy);
  336. (void)i22;
  337. int i23 = socket1.async_receive(buffer(mutable_char_buffer),
  338. in_flags, lazy);
  339. (void)i23;
  340. int i24 = socket1.async_receive(null_buffers(), in_flags, lazy);
  341. (void)i24;
  342. ip::icmp::endpoint endpoint;
  343. socket1.receive_from(buffer(mutable_char_buffer), endpoint);
  344. socket1.receive_from(null_buffers(), endpoint);
  345. socket1.receive_from(buffer(mutable_char_buffer), endpoint, in_flags);
  346. socket1.receive_from(null_buffers(), endpoint, in_flags);
  347. socket1.receive_from(buffer(mutable_char_buffer), endpoint, in_flags, ec);
  348. socket1.receive_from(null_buffers(), endpoint, in_flags, ec);
  349. socket1.async_receive_from(buffer(mutable_char_buffer),
  350. endpoint, receive_handler());
  351. socket1.async_receive_from(null_buffers(),
  352. endpoint, receive_handler());
  353. socket1.async_receive_from(buffer(mutable_char_buffer),
  354. endpoint, in_flags, receive_handler());
  355. socket1.async_receive_from(null_buffers(),
  356. endpoint, in_flags, receive_handler());
  357. int i25 = socket1.async_receive_from(buffer(mutable_char_buffer),
  358. endpoint, lazy);
  359. (void)i25;
  360. int i26 = socket1.async_receive_from(null_buffers(),
  361. endpoint, lazy);
  362. (void)i26;
  363. int i27 = socket1.async_receive_from(buffer(mutable_char_buffer),
  364. endpoint, in_flags, lazy);
  365. (void)i27;
  366. int i28 = socket1.async_receive_from(null_buffers(),
  367. endpoint, in_flags, lazy);
  368. (void)i28;
  369. }
  370. catch (std::exception&)
  371. {
  372. }
  373. }
  374. } // namespace ip_icmp_socket_compile
  375. //------------------------------------------------------------------------------
  376. // ip_icmp_resolver_compile test
  377. // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  378. // The following test checks that all public member functions on the class
  379. // ip::icmp::resolver compile and link correctly. Runtime failures are ignored.
  380. namespace ip_icmp_resolver_compile {
  381. struct resolve_handler
  382. {
  383. resolve_handler() {}
  384. void operator()(const boost::system::error_code&,
  385. boost::asio::ip::icmp::resolver::results_type) {}
  386. #if defined(BOOST_ASIO_HAS_MOVE)
  387. resolve_handler(resolve_handler&&) {}
  388. private:
  389. resolve_handler(const resolve_handler&);
  390. #endif // defined(BOOST_ASIO_HAS_MOVE)
  391. };
  392. void test()
  393. {
  394. using namespace boost::asio;
  395. namespace ip = boost::asio::ip;
  396. try
  397. {
  398. io_context ioc;
  399. const io_context::executor_type ioc_ex = ioc.get_executor();
  400. archetypes::lazy_handler lazy;
  401. boost::system::error_code ec;
  402. #if !defined(BOOST_ASIO_NO_DEPRECATED)
  403. ip::icmp::resolver::query q(ip::icmp::v4(), "localhost", "0");
  404. #endif // !defined(BOOST_ASIO_NO_DEPRECATED)
  405. ip::icmp::endpoint e(ip::address_v4::loopback(), 0);
  406. // basic_resolver constructors.
  407. ip::icmp::resolver resolver(ioc);
  408. ip::icmp::resolver resolver2(ioc_ex);
  409. #if defined(BOOST_ASIO_HAS_MOVE)
  410. ip::icmp::resolver resolver3(std::move(resolver));
  411. #endif // defined(BOOST_ASIO_HAS_MOVE)
  412. // basic_resolver operators.
  413. #if defined(BOOST_ASIO_HAS_MOVE)
  414. resolver = ip::icmp::resolver(ioc);
  415. resolver = std::move(resolver3);
  416. #endif // defined(BOOST_ASIO_HAS_MOVE)
  417. // basic_io_object functions.
  418. ip::icmp::resolver::executor_type ex = resolver.get_executor();
  419. (void)ex;
  420. // basic_resolver functions.
  421. resolver.cancel();
  422. #if !defined(BOOST_ASIO_NO_DEPRECATED)
  423. ip::icmp::resolver::results_type results1 = resolver.resolve(q);
  424. (void)results1;
  425. ip::icmp::resolver::results_type results2 = resolver.resolve(q, ec);
  426. (void)results2;
  427. #endif // !defined(BOOST_ASIO_NO_DEPRECATED)
  428. ip::icmp::resolver::results_type results3 = resolver.resolve("", "");
  429. (void)results3;
  430. ip::icmp::resolver::results_type results4 = resolver.resolve("", "", ec);
  431. (void)results4;
  432. ip::icmp::resolver::results_type results5 =
  433. resolver.resolve("", "", ip::icmp::resolver::flags());
  434. (void)results5;
  435. ip::icmp::resolver::results_type results6 =
  436. resolver.resolve("", "", ip::icmp::resolver::flags(), ec);
  437. (void)results6;
  438. ip::icmp::resolver::results_type results7 =
  439. resolver.resolve(ip::icmp::v4(), "", "");
  440. (void)results7;
  441. ip::icmp::resolver::results_type results8 =
  442. resolver.resolve(ip::icmp::v4(), "", "", ec);
  443. (void)results8;
  444. ip::icmp::resolver::results_type results9 =
  445. resolver.resolve(ip::icmp::v4(), "", "", ip::icmp::resolver::flags());
  446. (void)results9;
  447. ip::icmp::resolver::results_type results10 =
  448. resolver.resolve(ip::icmp::v4(), "", "", ip::icmp::resolver::flags(), ec);
  449. (void)results10;
  450. ip::icmp::resolver::results_type results11 = resolver.resolve(e);
  451. (void)results11;
  452. ip::icmp::resolver::results_type results12 = resolver.resolve(e, ec);
  453. (void)results12;
  454. #if !defined(BOOST_ASIO_NO_DEPRECATED)
  455. resolver.async_resolve(q, resolve_handler());
  456. int i1 = resolver.async_resolve(q, lazy);
  457. (void)i1;
  458. #endif // !defined(BOOST_ASIO_NO_DEPRECATED)
  459. resolver.async_resolve("", "", resolve_handler());
  460. int i2 = resolver.async_resolve("", "", lazy);
  461. (void)i2;
  462. resolver.async_resolve("", "",
  463. ip::icmp::resolver::flags(), resolve_handler());
  464. int i3 = resolver.async_resolve("", "",
  465. ip::icmp::resolver::flags(), lazy);
  466. (void)i3;
  467. resolver.async_resolve(ip::icmp::v4(), "", "", resolve_handler());
  468. int i4 = resolver.async_resolve(ip::icmp::v4(), "", "", lazy);
  469. (void)i4;
  470. resolver.async_resolve(ip::icmp::v4(),
  471. "", "", ip::icmp::resolver::flags(), resolve_handler());
  472. int i5 = resolver.async_resolve(ip::icmp::v4(),
  473. "", "", ip::icmp::resolver::flags(), lazy);
  474. (void)i5;
  475. resolver.async_resolve(e, resolve_handler());
  476. int i6 = resolver.async_resolve(e, lazy);
  477. (void)i6;
  478. }
  479. catch (std::exception&)
  480. {
  481. }
  482. }
  483. } // namespace ip_icmp_resolver_compile
  484. //------------------------------------------------------------------------------
  485. BOOST_ASIO_TEST_SUITE
  486. (
  487. "ip/icmp",
  488. BOOST_ASIO_TEST_CASE(ip_icmp_socket_compile::test)
  489. BOOST_ASIO_TEST_CASE(ip_icmp_resolver_compile::test)
  490. )