]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/asio/test/ip/icmp.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / asio / test / ip / icmp.cpp
CommitLineData
7c673cae
FG
1//
2// icmp.cpp
3// ~~~~~~~~
4//
b32b8144 5// Copyright (c) 2003-2017 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
FG
24#include "../archetypes/deprecated_async_result.hpp"
25#include "../archetypes/gettable_socket_option.hpp"
7c673cae
FG
26#include "../archetypes/io_control_command.hpp"
27#include "../archetypes/settable_socket_option.hpp"
28
29//------------------------------------------------------------------------------
30
31// ip_icmp_socket_compile test
b32b8144 32// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
7c673cae
FG
33// The following test checks that all public member functions on the class
34// ip::icmp::socket compile and link correctly. Runtime failures are ignored.
35
36namespace ip_icmp_socket_compile {
37
b32b8144 38struct connect_handler
7c673cae 39{
b32b8144
FG
40 connect_handler() {}
41 void operator()(const boost::system::error_code&) {}
42#if defined(BOOST_ASIO_HAS_MOVE)
43 connect_handler(connect_handler&&) {}
44private:
45 connect_handler(const connect_handler&);
46#endif // defined(BOOST_ASIO_HAS_MOVE)
47};
7c673cae 48
b32b8144 49struct send_handler
7c673cae 50{
b32b8144
FG
51 send_handler() {}
52 void operator()(const boost::system::error_code&, std::size_t) {}
53#if defined(BOOST_ASIO_HAS_MOVE)
54 send_handler(send_handler&&) {}
55private:
56 send_handler(const send_handler&);
57#endif // defined(BOOST_ASIO_HAS_MOVE)
58};
7c673cae 59
b32b8144 60struct receive_handler
7c673cae 61{
b32b8144
FG
62 receive_handler() {}
63 void operator()(const boost::system::error_code&, std::size_t) {}
64#if defined(BOOST_ASIO_HAS_MOVE)
65 receive_handler(receive_handler&&) {}
66private:
67 receive_handler(const receive_handler&);
68#endif // defined(BOOST_ASIO_HAS_MOVE)
69};
7c673cae
FG
70
71void test()
72{
73 using namespace boost::asio;
74 namespace ip = boost::asio::ip;
75
76 try
77 {
b32b8144 78 io_context ioc;
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;
b32b8144
FG
90#if !defined(BOOST_ASIO_NO_DEPRECATED)
91 archetypes::deprecated_lazy_handler dlazy;
92#endif // !defined(BOOST_ASIO_NO_DEPRECATED)
7c673cae
FG
93 boost::system::error_code ec;
94
95 // basic_datagram_socket constructors.
96
b32b8144
FG
97 ip::icmp::socket socket1(ioc);
98 ip::icmp::socket socket2(ioc, ip::icmp::v4());
99 ip::icmp::socket socket3(ioc, ip::icmp::v6());
100 ip::icmp::socket socket4(ioc, ip::icmp::endpoint(ip::icmp::v4(), 0));
101 ip::icmp::socket socket5(ioc, ip::icmp::endpoint(ip::icmp::v6(), 0));
7c673cae
FG
102#if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
103 ip::icmp::socket::native_handle_type native_socket1
104 = ::socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
b32b8144 105 ip::icmp::socket socket6(ioc, ip::icmp::v4(), native_socket1);
7c673cae
FG
106#endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
107
108#if defined(BOOST_ASIO_HAS_MOVE)
109 ip::icmp::socket socket7(std::move(socket6));
110#endif // defined(BOOST_ASIO_HAS_MOVE)
111
112 // basic_datagram_socket operators.
113
114#if defined(BOOST_ASIO_HAS_MOVE)
b32b8144 115 socket1 = ip::icmp::socket(ioc);
7c673cae
FG
116 socket1 = std::move(socket2);
117#endif // defined(BOOST_ASIO_HAS_MOVE)
118
119 // basic_io_object functions.
120
b32b8144
FG
121#if !defined(BOOST_ASIO_NO_DEPRECATED)
122 io_context& ioc_ref = socket1.get_io_context();
123 (void)ioc_ref;
124#endif // !defined(BOOST_ASIO_NO_DEPRECATED)
125
126 ip::icmp::socket::executor_type ex = socket1.get_executor();
127 (void)ex;
7c673cae
FG
128
129 // basic_socket functions.
130
131 ip::icmp::socket::lowest_layer_type& lowest_layer = socket1.lowest_layer();
132 (void)lowest_layer;
133
134 const ip::icmp::socket& socket8 = socket1;
135 const ip::icmp::socket::lowest_layer_type& lowest_layer2
136 = socket8.lowest_layer();
137 (void)lowest_layer2;
138
139 socket1.open(ip::icmp::v4());
140 socket1.open(ip::icmp::v6());
141 socket1.open(ip::icmp::v4(), ec);
142 socket1.open(ip::icmp::v6(), ec);
143
144#if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
145 ip::icmp::socket::native_handle_type native_socket2
146 = ::socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
147 socket1.assign(ip::icmp::v4(), native_socket2);
148 ip::icmp::socket::native_handle_type native_socket3
149 = ::socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
150 socket1.assign(ip::icmp::v4(), native_socket3, ec);
151#endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
152
153 bool is_open = socket1.is_open();
154 (void)is_open;
155
156 socket1.close();
157 socket1.close(ec);
158
b32b8144
FG
159 socket1.release();
160 socket1.release(ec);
7c673cae 161
b32b8144 162 ip::icmp::socket::native_handle_type native_socket4
7c673cae 163 = socket1.native_handle();
b32b8144 164 (void)native_socket4;
7c673cae
FG
165
166 socket1.cancel();
167 socket1.cancel(ec);
168
169 bool at_mark1 = socket1.at_mark();
170 (void)at_mark1;
171 bool at_mark2 = socket1.at_mark(ec);
172 (void)at_mark2;
173
174 std::size_t available1 = socket1.available();
175 (void)available1;
176 std::size_t available2 = socket1.available(ec);
177 (void)available2;
178
179 socket1.bind(ip::icmp::endpoint(ip::icmp::v4(), 0));
180 socket1.bind(ip::icmp::endpoint(ip::icmp::v6(), 0));
181 socket1.bind(ip::icmp::endpoint(ip::icmp::v4(), 0), ec);
182 socket1.bind(ip::icmp::endpoint(ip::icmp::v6(), 0), ec);
183
184 socket1.connect(ip::icmp::endpoint(ip::icmp::v4(), 0));
185 socket1.connect(ip::icmp::endpoint(ip::icmp::v6(), 0));
186 socket1.connect(ip::icmp::endpoint(ip::icmp::v4(), 0), ec);
187 socket1.connect(ip::icmp::endpoint(ip::icmp::v6(), 0), ec);
188
189 socket1.async_connect(ip::icmp::endpoint(ip::icmp::v4(), 0),
b32b8144 190 connect_handler());
7c673cae 191 socket1.async_connect(ip::icmp::endpoint(ip::icmp::v6(), 0),
b32b8144 192 connect_handler());
7c673cae
FG
193 int i1 = socket1.async_connect(ip::icmp::endpoint(ip::icmp::v4(), 0), lazy);
194 (void)i1;
195 int i2 = socket1.async_connect(ip::icmp::endpoint(ip::icmp::v6(), 0), lazy);
196 (void)i2;
b32b8144
FG
197#if !defined(BOOST_ASIO_NO_DEPRECATED)
198 double d1 = socket1.async_connect(
199 ip::icmp::endpoint(ip::icmp::v4(), 0), dlazy);
200 (void)d1;
201 double d2 = socket1.async_connect(
202 ip::icmp::endpoint(ip::icmp::v6(), 0), dlazy);
203 (void)d2;
204#endif // !defined(BOOST_ASIO_NO_DEPRECATED)
7c673cae
FG
205
206 socket1.set_option(settable_socket_option1);
207 socket1.set_option(settable_socket_option1, ec);
208 socket1.set_option(settable_socket_option2);
209 socket1.set_option(settable_socket_option2, ec);
210 socket1.set_option(settable_socket_option3);
211 socket1.set_option(settable_socket_option3, ec);
212
213 socket1.get_option(gettable_socket_option1);
214 socket1.get_option(gettable_socket_option1, ec);
215 socket1.get_option(gettable_socket_option2);
216 socket1.get_option(gettable_socket_option2, ec);
217 socket1.get_option(gettable_socket_option3);
218 socket1.get_option(gettable_socket_option3, ec);
219
220 socket1.io_control(io_control_command);
221 socket1.io_control(io_control_command, ec);
222
223 bool non_blocking1 = socket1.non_blocking();
224 (void)non_blocking1;
225 socket1.non_blocking(true);
226 socket1.non_blocking(false, ec);
227
228 bool non_blocking2 = socket1.native_non_blocking();
229 (void)non_blocking2;
230 socket1.native_non_blocking(true);
231 socket1.native_non_blocking(false, ec);
232
233 ip::icmp::endpoint endpoint1 = socket1.local_endpoint();
234 ip::icmp::endpoint endpoint2 = socket1.local_endpoint(ec);
235
236 ip::icmp::endpoint endpoint3 = socket1.remote_endpoint();
237 ip::icmp::endpoint endpoint4 = socket1.remote_endpoint(ec);
238
239 socket1.shutdown(socket_base::shutdown_both);
240 socket1.shutdown(socket_base::shutdown_both, ec);
241
242 // basic_datagram_socket functions.
243
244 socket1.send(buffer(mutable_char_buffer));
245 socket1.send(buffer(const_char_buffer));
246 socket1.send(null_buffers());
247 socket1.send(buffer(mutable_char_buffer), in_flags);
248 socket1.send(buffer(const_char_buffer), in_flags);
249 socket1.send(null_buffers(), in_flags);
250 socket1.send(buffer(mutable_char_buffer), in_flags, ec);
251 socket1.send(buffer(const_char_buffer), in_flags, ec);
252 socket1.send(null_buffers(), in_flags, ec);
253
b32b8144
FG
254 socket1.async_send(buffer(mutable_char_buffer), send_handler());
255 socket1.async_send(buffer(const_char_buffer), send_handler());
256 socket1.async_send(null_buffers(), send_handler());
257 socket1.async_send(buffer(mutable_char_buffer), in_flags, send_handler());
258 socket1.async_send(buffer(const_char_buffer), in_flags, send_handler());
259 socket1.async_send(null_buffers(), in_flags, send_handler());
7c673cae
FG
260 int i3 = socket1.async_send(buffer(mutable_char_buffer), lazy);
261 (void)i3;
262 int i4 = socket1.async_send(buffer(const_char_buffer), lazy);
263 (void)i4;
264 int i5 = socket1.async_send(null_buffers(), lazy);
265 (void)i5;
266 int i6 = socket1.async_send(buffer(mutable_char_buffer), in_flags, lazy);
267 (void)i6;
268 int i7 = socket1.async_send(buffer(const_char_buffer), in_flags, lazy);
269 (void)i7;
270 int i8 = socket1.async_send(null_buffers(), in_flags, lazy);
271 (void)i8;
b32b8144
FG
272#if !defined(BOOST_ASIO_NO_DEPRECATED)
273 double d3 = socket1.async_send(buffer(mutable_char_buffer), dlazy);
274 (void)d3;
275 double d4 = socket1.async_send(buffer(const_char_buffer), dlazy);
276 (void)d4;
277 double d5 = socket1.async_send(null_buffers(), dlazy);
278 (void)d5;
279 double d6 = socket1.async_send(
280 buffer(mutable_char_buffer), in_flags, dlazy);
281 (void)d6;
282 double d7 = socket1.async_send(buffer(const_char_buffer), in_flags, dlazy);
283 (void)d7;
284 double d8 = socket1.async_send(null_buffers(), in_flags, dlazy);
285 (void)d8;
286#endif // !defined(BOOST_ASIO_NO_DEPRECATED)
7c673cae
FG
287
288 socket1.send_to(buffer(mutable_char_buffer),
289 ip::icmp::endpoint(ip::icmp::v4(), 0));
290 socket1.send_to(buffer(mutable_char_buffer),
291 ip::icmp::endpoint(ip::icmp::v6(), 0));
292 socket1.send_to(buffer(const_char_buffer),
293 ip::icmp::endpoint(ip::icmp::v4(), 0));
294 socket1.send_to(buffer(const_char_buffer),
295 ip::icmp::endpoint(ip::icmp::v6(), 0));
296 socket1.send_to(null_buffers(),
297 ip::icmp::endpoint(ip::icmp::v4(), 0));
298 socket1.send_to(null_buffers(),
299 ip::icmp::endpoint(ip::icmp::v6(), 0));
300 socket1.send_to(buffer(mutable_char_buffer),
301 ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags);
302 socket1.send_to(buffer(mutable_char_buffer),
303 ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags);
304 socket1.send_to(buffer(const_char_buffer),
305 ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags);
306 socket1.send_to(buffer(const_char_buffer),
307 ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags);
308 socket1.send_to(null_buffers(),
309 ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags);
310 socket1.send_to(null_buffers(),
311 ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags);
312 socket1.send_to(buffer(mutable_char_buffer),
313 ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags, ec);
314 socket1.send_to(buffer(mutable_char_buffer),
315 ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags, ec);
316 socket1.send_to(buffer(const_char_buffer),
317 ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags, ec);
318 socket1.send_to(buffer(const_char_buffer),
319 ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags, ec);
320 socket1.send_to(null_buffers(),
321 ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags, ec);
322 socket1.send_to(null_buffers(),
323 ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags, ec);
324
325 socket1.async_send_to(buffer(mutable_char_buffer),
b32b8144 326 ip::icmp::endpoint(ip::icmp::v4(), 0), send_handler());
7c673cae 327 socket1.async_send_to(buffer(mutable_char_buffer),
b32b8144 328 ip::icmp::endpoint(ip::icmp::v6(), 0), send_handler());
7c673cae 329 socket1.async_send_to(buffer(const_char_buffer),
b32b8144 330 ip::icmp::endpoint(ip::icmp::v4(), 0), send_handler());
7c673cae 331 socket1.async_send_to(buffer(const_char_buffer),
b32b8144 332 ip::icmp::endpoint(ip::icmp::v6(), 0), send_handler());
7c673cae 333 socket1.async_send_to(null_buffers(),
b32b8144 334 ip::icmp::endpoint(ip::icmp::v4(), 0), send_handler());
7c673cae 335 socket1.async_send_to(null_buffers(),
b32b8144 336 ip::icmp::endpoint(ip::icmp::v6(), 0), send_handler());
7c673cae 337 socket1.async_send_to(buffer(mutable_char_buffer),
b32b8144 338 ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags, send_handler());
7c673cae 339 socket1.async_send_to(buffer(mutable_char_buffer),
b32b8144 340 ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags, send_handler());
7c673cae 341 socket1.async_send_to(buffer(const_char_buffer),
b32b8144 342 ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags, send_handler());
7c673cae 343 socket1.async_send_to(buffer(const_char_buffer),
b32b8144 344 ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags, send_handler());
7c673cae 345 socket1.async_send_to(null_buffers(),
b32b8144 346 ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags, send_handler());
7c673cae 347 socket1.async_send_to(null_buffers(),
b32b8144 348 ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags, send_handler());
7c673cae
FG
349 int i9 = socket1.async_send_to(buffer(mutable_char_buffer),
350 ip::icmp::endpoint(ip::icmp::v4(), 0), lazy);
351 (void)i9;
352 int i10 = socket1.async_send_to(buffer(mutable_char_buffer),
353 ip::icmp::endpoint(ip::icmp::v6(), 0), lazy);
354 (void)i10;
355 int i11 = socket1.async_send_to(buffer(const_char_buffer),
356 ip::icmp::endpoint(ip::icmp::v4(), 0), lazy);
357 (void)i11;
358 int i12 = socket1.async_send_to(buffer(const_char_buffer),
359 ip::icmp::endpoint(ip::icmp::v6(), 0), lazy);
360 (void)i12;
361 int i13 = socket1.async_send_to(null_buffers(),
362 ip::icmp::endpoint(ip::icmp::v4(), 0), lazy);
363 (void)i13;
364 int i14 = socket1.async_send_to(null_buffers(),
365 ip::icmp::endpoint(ip::icmp::v6(), 0), lazy);
366 (void)i14;
367 int i15 = socket1.async_send_to(buffer(mutable_char_buffer),
368 ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags, lazy);
369 (void)i15;
370 int i16 = socket1.async_send_to(buffer(mutable_char_buffer),
371 ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags, lazy);
372 (void)i16;
373 int i17 = socket1.async_send_to(buffer(const_char_buffer),
374 ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags, lazy);
375 (void)i17;
376 int i18 = socket1.async_send_to(buffer(const_char_buffer),
377 ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags, lazy);
378 (void)i18;
379 int i19 = socket1.async_send_to(null_buffers(),
380 ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags, lazy);
381 (void)i19;
382 int i20 = socket1.async_send_to(null_buffers(),
383 ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags, lazy);
384 (void)i20;
b32b8144
FG
385#if !defined(BOOST_ASIO_NO_DEPRECATED)
386 double d9 = socket1.async_send_to(buffer(mutable_char_buffer),
387 ip::icmp::endpoint(ip::icmp::v4(), 0), dlazy);
388 (void)d9;
389 double d10 = socket1.async_send_to(buffer(mutable_char_buffer),
390 ip::icmp::endpoint(ip::icmp::v6(), 0), dlazy);
391 (void)d10;
392 double d11 = socket1.async_send_to(buffer(const_char_buffer),
393 ip::icmp::endpoint(ip::icmp::v4(), 0), dlazy);
394 (void)d11;
395 double d12 = socket1.async_send_to(buffer(const_char_buffer),
396 ip::icmp::endpoint(ip::icmp::v6(), 0), dlazy);
397 (void)d12;
398 double d13 = socket1.async_send_to(null_buffers(),
399 ip::icmp::endpoint(ip::icmp::v4(), 0), dlazy);
400 (void)d13;
401 double d14 = socket1.async_send_to(null_buffers(),
402 ip::icmp::endpoint(ip::icmp::v6(), 0), dlazy);
403 (void)d14;
404 double d15 = socket1.async_send_to(buffer(mutable_char_buffer),
405 ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags, dlazy);
406 (void)d15;
407 double d16 = socket1.async_send_to(buffer(mutable_char_buffer),
408 ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags, dlazy);
409 (void)d16;
410 double d17 = socket1.async_send_to(buffer(const_char_buffer),
411 ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags, dlazy);
412 (void)d17;
413 double d18 = socket1.async_send_to(buffer(const_char_buffer),
414 ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags, dlazy);
415 (void)d18;
416 double d19 = socket1.async_send_to(null_buffers(),
417 ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags, dlazy);
418 (void)d19;
419 double d20 = socket1.async_send_to(null_buffers(),
420 ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags, dlazy);
421 (void)d20;
422#endif // !defined(BOOST_ASIO_NO_DEPRECATED)
7c673cae
FG
423
424 socket1.receive(buffer(mutable_char_buffer));
425 socket1.receive(null_buffers());
426 socket1.receive(buffer(mutable_char_buffer), in_flags);
427 socket1.receive(null_buffers(), in_flags);
428 socket1.receive(buffer(mutable_char_buffer), in_flags, ec);
429 socket1.receive(null_buffers(), in_flags, ec);
430
b32b8144
FG
431 socket1.async_receive(buffer(mutable_char_buffer), receive_handler());
432 socket1.async_receive(null_buffers(), receive_handler());
7c673cae 433 socket1.async_receive(buffer(mutable_char_buffer), in_flags,
b32b8144
FG
434 receive_handler());
435 socket1.async_receive(null_buffers(), in_flags, receive_handler());
7c673cae
FG
436 int i21 = socket1.async_receive(buffer(mutable_char_buffer), lazy);
437 (void)i21;
438 int i22 = socket1.async_receive(null_buffers(), lazy);
439 (void)i22;
440 int i23 = socket1.async_receive(buffer(mutable_char_buffer),
441 in_flags, lazy);
442 (void)i23;
443 int i24 = socket1.async_receive(null_buffers(), in_flags, lazy);
444 (void)i24;
b32b8144
FG
445#if !defined(BOOST_ASIO_NO_DEPRECATED)
446 double d21 = socket1.async_receive(buffer(mutable_char_buffer), dlazy);
447 (void)d21;
448 double d22 = socket1.async_receive(null_buffers(), dlazy);
449 (void)d22;
450 double d23 = socket1.async_receive(buffer(mutable_char_buffer),
451 in_flags, dlazy);
452 (void)d23;
453 double d24 = socket1.async_receive(null_buffers(), in_flags, dlazy);
454 (void)d24;
455#endif // !defined(BOOST_ASIO_NO_DEPRECATED)
7c673cae
FG
456
457 ip::icmp::endpoint endpoint;
458 socket1.receive_from(buffer(mutable_char_buffer), endpoint);
459 socket1.receive_from(null_buffers(), endpoint);
460 socket1.receive_from(buffer(mutable_char_buffer), endpoint, in_flags);
461 socket1.receive_from(null_buffers(), endpoint, in_flags);
462 socket1.receive_from(buffer(mutable_char_buffer), endpoint, in_flags, ec);
463 socket1.receive_from(null_buffers(), endpoint, in_flags, ec);
464
465 socket1.async_receive_from(buffer(mutable_char_buffer),
b32b8144 466 endpoint, receive_handler());
7c673cae 467 socket1.async_receive_from(null_buffers(),
b32b8144 468 endpoint, receive_handler());
7c673cae 469 socket1.async_receive_from(buffer(mutable_char_buffer),
b32b8144 470 endpoint, in_flags, receive_handler());
7c673cae 471 socket1.async_receive_from(null_buffers(),
b32b8144 472 endpoint, in_flags, receive_handler());
7c673cae
FG
473 int i25 = socket1.async_receive_from(buffer(mutable_char_buffer),
474 endpoint, lazy);
475 (void)i25;
476 int i26 = socket1.async_receive_from(null_buffers(),
477 endpoint, lazy);
478 (void)i26;
479 int i27 = socket1.async_receive_from(buffer(mutable_char_buffer),
480 endpoint, in_flags, lazy);
481 (void)i27;
482 int i28 = socket1.async_receive_from(null_buffers(),
483 endpoint, in_flags, lazy);
484 (void)i28;
b32b8144
FG
485#if !defined(BOOST_ASIO_NO_DEPRECATED)
486 double d25 = socket1.async_receive_from(buffer(mutable_char_buffer),
487 endpoint, dlazy);
488 (void)d25;
489 double d26 = socket1.async_receive_from(null_buffers(),
490 endpoint, dlazy);
491 (void)d26;
492 double d27 = socket1.async_receive_from(buffer(mutable_char_buffer),
493 endpoint, in_flags, dlazy);
494 (void)d27;
495 double d28 = socket1.async_receive_from(null_buffers(),
496 endpoint, in_flags, dlazy);
497 (void)d28;
498#endif // !defined(BOOST_ASIO_NO_DEPRECATED)
7c673cae
FG
499 }
500 catch (std::exception&)
501 {
502 }
503}
504
505} // namespace ip_icmp_socket_compile
506
507//------------------------------------------------------------------------------
508
509// ip_icmp_resolver_compile test
510// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
511// The following test checks that all public member functions on the class
512// ip::icmp::resolver compile and link correctly. Runtime failures are ignored.
513
514namespace ip_icmp_resolver_compile {
515
b32b8144 516struct resolve_handler
7c673cae 517{
b32b8144
FG
518 resolve_handler() {}
519 void operator()(const boost::system::error_code&,
520 boost::asio::ip::icmp::resolver::results_type) {}
521#if defined(BOOST_ASIO_HAS_MOVE)
522 resolve_handler(resolve_handler&&) {}
523private:
524 resolve_handler(const resolve_handler&);
525#endif // defined(BOOST_ASIO_HAS_MOVE)
526};
7c673cae
FG
527
528void test()
529{
530 using namespace boost::asio;
531 namespace ip = boost::asio::ip;
532
533 try
534 {
b32b8144 535 io_context ioc;
7c673cae 536 archetypes::lazy_handler lazy;
b32b8144
FG
537#if !defined(BOOST_ASIO_NO_DEPRECATED)
538 archetypes::deprecated_lazy_handler dlazy;
539#endif // !defined(BOOST_ASIO_NO_DEPRECATED)
7c673cae 540 boost::system::error_code ec;
b32b8144 541#if !defined(BOOST_ASIO_NO_DEPRECATED)
7c673cae 542 ip::icmp::resolver::query q(ip::icmp::v4(), "localhost", "0");
b32b8144 543#endif // !defined(BOOST_ASIO_NO_DEPRECATED)
7c673cae
FG
544 ip::icmp::endpoint e(ip::address_v4::loopback(), 0);
545
546 // basic_resolver constructors.
547
b32b8144
FG
548 ip::icmp::resolver resolver(ioc);
549
550#if defined(BOOST_ASIO_HAS_MOVE)
551 ip::icmp::resolver resolver2(std::move(resolver));
552#endif // defined(BOOST_ASIO_HAS_MOVE)
553
554 // basic_resolver operators.
555
556#if defined(BOOST_ASIO_HAS_MOVE)
557 resolver = ip::icmp::resolver(ioc);
558 resolver = std::move(resolver2);
559#endif // defined(BOOST_ASIO_HAS_MOVE)
7c673cae
FG
560
561 // basic_io_object functions.
562
b32b8144
FG
563#if !defined(BOOST_ASIO_NO_DEPRECATED)
564 io_context& ioc_ref = resolver.get_io_context();
565 (void)ioc_ref;
566#endif // !defined(BOOST_ASIO_NO_DEPRECATED)
567
568 ip::icmp::resolver::executor_type ex = resolver.get_executor();
569 (void)ex;
7c673cae
FG
570
571 // basic_resolver functions.
572
573 resolver.cancel();
574
b32b8144
FG
575#if !defined(BOOST_ASIO_NO_DEPRECATED)
576 ip::icmp::resolver::results_type results1 = resolver.resolve(q);
577 (void)results1;
578
579 ip::icmp::resolver::results_type results2 = resolver.resolve(q, ec);
580 (void)results2;
581#endif // !defined(BOOST_ASIO_NO_DEPRECATED)
582
583 ip::icmp::resolver::results_type results3 = resolver.resolve("", "");
584 (void)results3;
585
586 ip::icmp::resolver::results_type results4 = resolver.resolve("", "", ec);
587 (void)results4;
7c673cae 588
b32b8144
FG
589 ip::icmp::resolver::results_type results5 =
590 resolver.resolve("", "", ip::icmp::resolver::flags());
591 (void)results5;
7c673cae 592
b32b8144
FG
593 ip::icmp::resolver::results_type results6 =
594 resolver.resolve("", "", ip::icmp::resolver::flags(), ec);
595 (void)results6;
7c673cae 596
b32b8144
FG
597 ip::icmp::resolver::results_type results7 =
598 resolver.resolve(ip::icmp::v4(), "", "");
599 (void)results7;
7c673cae 600
b32b8144
FG
601 ip::icmp::resolver::results_type results8 =
602 resolver.resolve(ip::icmp::v4(), "", "", ec);
603 (void)results8;
604
605 ip::icmp::resolver::results_type results9 =
606 resolver.resolve(ip::icmp::v4(), "", "", ip::icmp::resolver::flags());
607 (void)results9;
608
609 ip::icmp::resolver::results_type results10 =
610 resolver.resolve(ip::icmp::v4(), "", "", ip::icmp::resolver::flags(), ec);
611 (void)results10;
612
613 ip::icmp::resolver::results_type results11 = resolver.resolve(e);
614 (void)results11;
615
616 ip::icmp::resolver::results_type results12 = resolver.resolve(e, ec);
617 (void)results12;
618
619#if !defined(BOOST_ASIO_NO_DEPRECATED)
620 resolver.async_resolve(q, resolve_handler());
7c673cae
FG
621 int i1 = resolver.async_resolve(q, lazy);
622 (void)i1;
b32b8144
FG
623 double d1 = resolver.async_resolve(q, dlazy);
624 (void)d1;
625#endif // !defined(BOOST_ASIO_NO_DEPRECATED)
7c673cae 626
b32b8144
FG
627 resolver.async_resolve("", "", resolve_handler());
628 int i2 = resolver.async_resolve("", "", lazy);
7c673cae 629 (void)i2;
b32b8144
FG
630#if !defined(BOOST_ASIO_NO_DEPRECATED)
631 double d2 = resolver.async_resolve("", "", dlazy);
632 (void)d2;
633#endif // !defined(BOOST_ASIO_NO_DEPRECATED)
634
635 resolver.async_resolve("", "",
636 ip::icmp::resolver::flags(), resolve_handler());
637 int i3 = resolver.async_resolve("", "",
638 ip::icmp::resolver::flags(), lazy);
639 (void)i3;
640#if !defined(BOOST_ASIO_NO_DEPRECATED)
641 double d3 = resolver.async_resolve("", "",
642 ip::icmp::resolver::flags(), dlazy);
643 (void)d3;
644#endif // !defined(BOOST_ASIO_NO_DEPRECATED)
645
646 resolver.async_resolve(ip::icmp::v4(), "", "", resolve_handler());
647 int i4 = resolver.async_resolve(ip::icmp::v4(), "", "", lazy);
648 (void)i4;
649#if !defined(BOOST_ASIO_NO_DEPRECATED)
650 double d4 = resolver.async_resolve(ip::icmp::v4(), "", "", dlazy);
651 (void)d4;
652#endif // !defined(BOOST_ASIO_NO_DEPRECATED)
653
654 resolver.async_resolve(ip::icmp::v4(),
655 "", "", ip::icmp::resolver::flags(), resolve_handler());
656 int i5 = resolver.async_resolve(ip::icmp::v4(),
657 "", "", ip::icmp::resolver::flags(), lazy);
658 (void)i5;
659#if !defined(BOOST_ASIO_NO_DEPRECATED)
660 double d5 = resolver.async_resolve(ip::icmp::v4(),
661 "", "", ip::icmp::resolver::flags(), dlazy);
662 (void)d5;
663#endif // !defined(BOOST_ASIO_NO_DEPRECATED)
664
665 resolver.async_resolve(e, resolve_handler());
666 int i6 = resolver.async_resolve(e, lazy);
667 (void)i6;
668#if !defined(BOOST_ASIO_NO_DEPRECATED)
669 double d6 = resolver.async_resolve(e, dlazy);
670 (void)d6;
671#endif // !defined(BOOST_ASIO_NO_DEPRECATED)
7c673cae
FG
672 }
673 catch (std::exception&)
674 {
675 }
676}
677
678} // namespace ip_icmp_resolver_compile
679
680//------------------------------------------------------------------------------
681
682BOOST_ASIO_TEST_SUITE
683(
684 "ip/icmp",
685 BOOST_ASIO_TEST_CASE(ip_icmp_socket_compile::test)
686 BOOST_ASIO_TEST_CASE(ip_icmp_resolver_compile::test)
687)