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