Statistics
| Revision:

root / tmp / org.txm.statsengine.r.core.win32 / res / win32 / library / BH / include / boost / asio / raw_socket_service.hpp @ 2486

History | View | Annotate | Download (13.8 kB)

1 2486 sjacqu01
//
2 2486 sjacqu01
// raw_socket_service.hpp
3 2486 sjacqu01
// ~~~~~~~~~~~~~~~~~~~~~~
4 2486 sjacqu01
//
5 2486 sjacqu01
// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6 2486 sjacqu01
//
7 2486 sjacqu01
// Distributed under the Boost Software License, Version 1.0. (See accompanying
8 2486 sjacqu01
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 2486 sjacqu01
//
10 2486 sjacqu01
11 2486 sjacqu01
#ifndef BOOST_ASIO_RAW_SOCKET_SERVICE_HPP
12 2486 sjacqu01
#define BOOST_ASIO_RAW_SOCKET_SERVICE_HPP
13 2486 sjacqu01
14 2486 sjacqu01
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
15 2486 sjacqu01
# pragma once
16 2486 sjacqu01
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17 2486 sjacqu01
18 2486 sjacqu01
#include <boost/asio/detail/config.hpp>
19 2486 sjacqu01
#include <cstddef>
20 2486 sjacqu01
#include <boost/asio/async_result.hpp>
21 2486 sjacqu01
#include <boost/asio/detail/type_traits.hpp>
22 2486 sjacqu01
#include <boost/asio/error.hpp>
23 2486 sjacqu01
#include <boost/asio/io_service.hpp>
24 2486 sjacqu01
25 2486 sjacqu01
#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
26 2486 sjacqu01
# include <boost/asio/detail/null_socket_service.hpp>
27 2486 sjacqu01
#elif defined(BOOST_ASIO_HAS_IOCP)
28 2486 sjacqu01
# include <boost/asio/detail/win_iocp_socket_service.hpp>
29 2486 sjacqu01
#else
30 2486 sjacqu01
# include <boost/asio/detail/reactive_socket_service.hpp>
31 2486 sjacqu01
#endif
32 2486 sjacqu01
33 2486 sjacqu01
#include <boost/asio/detail/push_options.hpp>
34 2486 sjacqu01
35 2486 sjacqu01
namespace boost {
36 2486 sjacqu01
namespace asio {
37 2486 sjacqu01
38 2486 sjacqu01
/// Default service implementation for a raw socket.
39 2486 sjacqu01
template <typename Protocol>
40 2486 sjacqu01
class raw_socket_service
41 2486 sjacqu01
#if defined(GENERATING_DOCUMENTATION)
42 2486 sjacqu01
  : public boost::asio::io_service::service
43 2486 sjacqu01
#else
44 2486 sjacqu01
  : public boost::asio::detail::service_base<raw_socket_service<Protocol> >
45 2486 sjacqu01
#endif
46 2486 sjacqu01
{
47 2486 sjacqu01
public:
48 2486 sjacqu01
#if defined(GENERATING_DOCUMENTATION)
49 2486 sjacqu01
  /// The unique service identifier.
50 2486 sjacqu01
  static boost::asio::io_service::id id;
51 2486 sjacqu01
#endif
52 2486 sjacqu01
53 2486 sjacqu01
  /// The protocol type.
54 2486 sjacqu01
  typedef Protocol protocol_type;
55 2486 sjacqu01
56 2486 sjacqu01
  /// The endpoint type.
57 2486 sjacqu01
  typedef typename Protocol::endpoint endpoint_type;
58 2486 sjacqu01
59 2486 sjacqu01
private:
60 2486 sjacqu01
  // The type of the platform-specific implementation.
61 2486 sjacqu01
#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
62 2486 sjacqu01
  typedef detail::null_socket_service<Protocol> service_impl_type;
63 2486 sjacqu01
#elif defined(BOOST_ASIO_HAS_IOCP)
64 2486 sjacqu01
  typedef detail::win_iocp_socket_service<Protocol> service_impl_type;
65 2486 sjacqu01
#else
66 2486 sjacqu01
  typedef detail::reactive_socket_service<Protocol> service_impl_type;
67 2486 sjacqu01
#endif
68 2486 sjacqu01
69 2486 sjacqu01
public:
70 2486 sjacqu01
  /// The type of a raw socket.
71 2486 sjacqu01
#if defined(GENERATING_DOCUMENTATION)
72 2486 sjacqu01
  typedef implementation_defined implementation_type;
73 2486 sjacqu01
#else
74 2486 sjacqu01
  typedef typename service_impl_type::implementation_type implementation_type;
75 2486 sjacqu01
#endif
76 2486 sjacqu01
77 2486 sjacqu01
  /// (Deprecated: Use native_handle_type.) The native socket type.
78 2486 sjacqu01
#if defined(GENERATING_DOCUMENTATION)
79 2486 sjacqu01
  typedef implementation_defined native_type;
80 2486 sjacqu01
#else
81 2486 sjacqu01
  typedef typename service_impl_type::native_handle_type native_type;
82 2486 sjacqu01
#endif
83 2486 sjacqu01
84 2486 sjacqu01
  /// The native socket type.
85 2486 sjacqu01
#if defined(GENERATING_DOCUMENTATION)
86 2486 sjacqu01
  typedef implementation_defined native_handle_type;
87 2486 sjacqu01
#else
88 2486 sjacqu01
  typedef typename service_impl_type::native_handle_type native_handle_type;
89 2486 sjacqu01
#endif
90 2486 sjacqu01
91 2486 sjacqu01
  /// Construct a new raw socket service for the specified io_service.
92 2486 sjacqu01
  explicit raw_socket_service(boost::asio::io_service& io_service)
93 2486 sjacqu01
    : boost::asio::detail::service_base<
94 2486 sjacqu01
        raw_socket_service<Protocol> >(io_service),
95 2486 sjacqu01
      service_impl_(io_service)
96 2486 sjacqu01
  {
97 2486 sjacqu01
  }
98 2486 sjacqu01
99 2486 sjacqu01
  /// Construct a new raw socket implementation.
100 2486 sjacqu01
  void construct(implementation_type& impl)
101 2486 sjacqu01
  {
102 2486 sjacqu01
    service_impl_.construct(impl);
103 2486 sjacqu01
  }
104 2486 sjacqu01
105 2486 sjacqu01
#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
106 2486 sjacqu01
  /// Move-construct a new raw socket implementation.
107 2486 sjacqu01
  void move_construct(implementation_type& impl,
108 2486 sjacqu01
      implementation_type& other_impl)
109 2486 sjacqu01
  {
110 2486 sjacqu01
    service_impl_.move_construct(impl, other_impl);
111 2486 sjacqu01
  }
112 2486 sjacqu01
113 2486 sjacqu01
  /// Move-assign from another raw socket implementation.
114 2486 sjacqu01
  void move_assign(implementation_type& impl,
115 2486 sjacqu01
      raw_socket_service& other_service,
116 2486 sjacqu01
      implementation_type& other_impl)
117 2486 sjacqu01
  {
118 2486 sjacqu01
    service_impl_.move_assign(impl, other_service.service_impl_, other_impl);
119 2486 sjacqu01
  }
120 2486 sjacqu01
121 2486 sjacqu01
  /// Move-construct a new raw socket implementation from another protocol
122 2486 sjacqu01
  /// type.
123 2486 sjacqu01
  template <typename Protocol1>
124 2486 sjacqu01
  void converting_move_construct(implementation_type& impl,
125 2486 sjacqu01
      typename raw_socket_service<
126 2486 sjacqu01
        Protocol1>::implementation_type& other_impl,
127 2486 sjacqu01
      typename enable_if<is_convertible<
128 2486 sjacqu01
        Protocol1, Protocol>::value>::type* = 0)
129 2486 sjacqu01
  {
130 2486 sjacqu01
    service_impl_.template converting_move_construct<Protocol1>(
131 2486 sjacqu01
        impl, other_impl);
132 2486 sjacqu01
  }
133 2486 sjacqu01
#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
134 2486 sjacqu01
135 2486 sjacqu01
  /// Destroy a raw socket implementation.
136 2486 sjacqu01
  void destroy(implementation_type& impl)
137 2486 sjacqu01
  {
138 2486 sjacqu01
    service_impl_.destroy(impl);
139 2486 sjacqu01
  }
140 2486 sjacqu01
141 2486 sjacqu01
  // Open a new raw socket implementation.
142 2486 sjacqu01
  boost::system::error_code open(implementation_type& impl,
143 2486 sjacqu01
      const protocol_type& protocol, boost::system::error_code& ec)
144 2486 sjacqu01
  {
145 2486 sjacqu01
    if (protocol.type() == BOOST_ASIO_OS_DEF(SOCK_RAW))
146 2486 sjacqu01
      service_impl_.open(impl, protocol, ec);
147 2486 sjacqu01
    else
148 2486 sjacqu01
      ec = boost::asio::error::invalid_argument;
149 2486 sjacqu01
    return ec;
150 2486 sjacqu01
  }
151 2486 sjacqu01
152 2486 sjacqu01
  /// Assign an existing native socket to a raw socket.
153 2486 sjacqu01
  boost::system::error_code assign(implementation_type& impl,
154 2486 sjacqu01
      const protocol_type& protocol, const native_handle_type& native_socket,
155 2486 sjacqu01
      boost::system::error_code& ec)
156 2486 sjacqu01
  {
157 2486 sjacqu01
    return service_impl_.assign(impl, protocol, native_socket, ec);
158 2486 sjacqu01
  }
159 2486 sjacqu01
160 2486 sjacqu01
  /// Determine whether the socket is open.
161 2486 sjacqu01
  bool is_open(const implementation_type& impl) const
162 2486 sjacqu01
  {
163 2486 sjacqu01
    return service_impl_.is_open(impl);
164 2486 sjacqu01
  }
165 2486 sjacqu01
166 2486 sjacqu01
  /// Close a raw socket implementation.
167 2486 sjacqu01
  boost::system::error_code close(implementation_type& impl,
168 2486 sjacqu01
      boost::system::error_code& ec)
169 2486 sjacqu01
  {
170 2486 sjacqu01
    return service_impl_.close(impl, ec);
171 2486 sjacqu01
  }
172 2486 sjacqu01
173 2486 sjacqu01
  /// (Deprecated: Use native_handle().) Get the native socket implementation.
174 2486 sjacqu01
  native_type native(implementation_type& impl)
175 2486 sjacqu01
  {
176 2486 sjacqu01
    return service_impl_.native_handle(impl);
177 2486 sjacqu01
  }
178 2486 sjacqu01
179 2486 sjacqu01
  /// Get the native socket implementation.
180 2486 sjacqu01
  native_handle_type native_handle(implementation_type& impl)
181 2486 sjacqu01
  {
182 2486 sjacqu01
    return service_impl_.native_handle(impl);
183 2486 sjacqu01
  }
184 2486 sjacqu01
185 2486 sjacqu01
  /// Cancel all asynchronous operations associated with the socket.
186 2486 sjacqu01
  boost::system::error_code cancel(implementation_type& impl,
187 2486 sjacqu01
      boost::system::error_code& ec)
188 2486 sjacqu01
  {
189 2486 sjacqu01
    return service_impl_.cancel(impl, ec);
190 2486 sjacqu01
  }
191 2486 sjacqu01
192 2486 sjacqu01
  /// Determine whether the socket is at the out-of-band data mark.
193 2486 sjacqu01
  bool at_mark(const implementation_type& impl,
194 2486 sjacqu01
      boost::system::error_code& ec) const
195 2486 sjacqu01
  {
196 2486 sjacqu01
    return service_impl_.at_mark(impl, ec);
197 2486 sjacqu01
  }
198 2486 sjacqu01
199 2486 sjacqu01
  /// Determine the number of bytes available for reading.
200 2486 sjacqu01
  std::size_t available(const implementation_type& impl,
201 2486 sjacqu01
      boost::system::error_code& ec) const
202 2486 sjacqu01
  {
203 2486 sjacqu01
    return service_impl_.available(impl, ec);
204 2486 sjacqu01
  }
205 2486 sjacqu01
206 2486 sjacqu01
  // Bind the raw socket to the specified local endpoint.
207 2486 sjacqu01
  boost::system::error_code bind(implementation_type& impl,
208 2486 sjacqu01
      const endpoint_type& endpoint, boost::system::error_code& ec)
209 2486 sjacqu01
  {
210 2486 sjacqu01
    return service_impl_.bind(impl, endpoint, ec);
211 2486 sjacqu01
  }
212 2486 sjacqu01
213 2486 sjacqu01
  /// Connect the raw socket to the specified endpoint.
214 2486 sjacqu01
  boost::system::error_code connect(implementation_type& impl,
215 2486 sjacqu01
      const endpoint_type& peer_endpoint, boost::system::error_code& ec)
216 2486 sjacqu01
  {
217 2486 sjacqu01
    return service_impl_.connect(impl, peer_endpoint, ec);
218 2486 sjacqu01
  }
219 2486 sjacqu01
220 2486 sjacqu01
  /// Start an asynchronous connect.
221 2486 sjacqu01
  template <typename ConnectHandler>
222 2486 sjacqu01
  BOOST_ASIO_INITFN_RESULT_TYPE(ConnectHandler,
223 2486 sjacqu01
      void (boost::system::error_code))
224 2486 sjacqu01
  async_connect(implementation_type& impl,
225 2486 sjacqu01
      const endpoint_type& peer_endpoint,
226 2486 sjacqu01
      BOOST_ASIO_MOVE_ARG(ConnectHandler) handler)
227 2486 sjacqu01
  {
228 2486 sjacqu01
    detail::async_result_init<
229 2486 sjacqu01
      ConnectHandler, void (boost::system::error_code)> init(
230 2486 sjacqu01
        BOOST_ASIO_MOVE_CAST(ConnectHandler)(handler));
231 2486 sjacqu01
232 2486 sjacqu01
    service_impl_.async_connect(impl, peer_endpoint, init.handler);
233 2486 sjacqu01
234 2486 sjacqu01
    return init.result.get();
235 2486 sjacqu01
  }
236 2486 sjacqu01
237 2486 sjacqu01
  /// Set a socket option.
238 2486 sjacqu01
  template <typename SettableSocketOption>
239 2486 sjacqu01
  boost::system::error_code set_option(implementation_type& impl,
240 2486 sjacqu01
      const SettableSocketOption& option, boost::system::error_code& ec)
241 2486 sjacqu01
  {
242 2486 sjacqu01
    return service_impl_.set_option(impl, option, ec);
243 2486 sjacqu01
  }
244 2486 sjacqu01
245 2486 sjacqu01
  /// Get a socket option.
246 2486 sjacqu01
  template <typename GettableSocketOption>
247 2486 sjacqu01
  boost::system::error_code get_option(const implementation_type& impl,
248 2486 sjacqu01
      GettableSocketOption& option, boost::system::error_code& ec) const
249 2486 sjacqu01
  {
250 2486 sjacqu01
    return service_impl_.get_option(impl, option, ec);
251 2486 sjacqu01
  }
252 2486 sjacqu01
253 2486 sjacqu01
  /// Perform an IO control command on the socket.
254 2486 sjacqu01
  template <typename IoControlCommand>
255 2486 sjacqu01
  boost::system::error_code io_control(implementation_type& impl,
256 2486 sjacqu01
      IoControlCommand& command, boost::system::error_code& ec)
257 2486 sjacqu01
  {
258 2486 sjacqu01
    return service_impl_.io_control(impl, command, ec);
259 2486 sjacqu01
  }
260 2486 sjacqu01
261 2486 sjacqu01
  /// Gets the non-blocking mode of the socket.
262 2486 sjacqu01
  bool non_blocking(const implementation_type& impl) const
263 2486 sjacqu01
  {
264 2486 sjacqu01
    return service_impl_.non_blocking(impl);
265 2486 sjacqu01
  }
266 2486 sjacqu01
267 2486 sjacqu01
  /// Sets the non-blocking mode of the socket.
268 2486 sjacqu01
  boost::system::error_code non_blocking(implementation_type& impl,
269 2486 sjacqu01
      bool mode, boost::system::error_code& ec)
270 2486 sjacqu01
  {
271 2486 sjacqu01
    return service_impl_.non_blocking(impl, mode, ec);
272 2486 sjacqu01
  }
273 2486 sjacqu01
274 2486 sjacqu01
  /// Gets the non-blocking mode of the native socket implementation.
275 2486 sjacqu01
  bool native_non_blocking(const implementation_type& impl) const
276 2486 sjacqu01
  {
277 2486 sjacqu01
    return service_impl_.native_non_blocking(impl);
278 2486 sjacqu01
  }
279 2486 sjacqu01
280 2486 sjacqu01
  /// Sets the non-blocking mode of the native socket implementation.
281 2486 sjacqu01
  boost::system::error_code native_non_blocking(implementation_type& impl,
282 2486 sjacqu01
      bool mode, boost::system::error_code& ec)
283 2486 sjacqu01
  {
284 2486 sjacqu01
    return service_impl_.native_non_blocking(impl, mode, ec);
285 2486 sjacqu01
  }
286 2486 sjacqu01
287 2486 sjacqu01
  /// Get the local endpoint.
288 2486 sjacqu01
  endpoint_type local_endpoint(const implementation_type& impl,
289 2486 sjacqu01
      boost::system::error_code& ec) const
290 2486 sjacqu01
  {
291 2486 sjacqu01
    return service_impl_.local_endpoint(impl, ec);
292 2486 sjacqu01
  }
293 2486 sjacqu01
294 2486 sjacqu01
  /// Get the remote endpoint.
295 2486 sjacqu01
  endpoint_type remote_endpoint(const implementation_type& impl,
296 2486 sjacqu01
      boost::system::error_code& ec) const
297 2486 sjacqu01
  {
298 2486 sjacqu01
    return service_impl_.remote_endpoint(impl, ec);
299 2486 sjacqu01
  }
300 2486 sjacqu01
301 2486 sjacqu01
  /// Disable sends or receives on the socket.
302 2486 sjacqu01
  boost::system::error_code shutdown(implementation_type& impl,
303 2486 sjacqu01
      socket_base::shutdown_type what, boost::system::error_code& ec)
304 2486 sjacqu01
  {
305 2486 sjacqu01
    return service_impl_.shutdown(impl, what, ec);
306 2486 sjacqu01
  }
307 2486 sjacqu01
308 2486 sjacqu01
  /// Send the given data to the peer.
309 2486 sjacqu01
  template <typename ConstBufferSequence>
310 2486 sjacqu01
  std::size_t send(implementation_type& impl,
311 2486 sjacqu01
      const ConstBufferSequence& buffers,
312 2486 sjacqu01
      socket_base::message_flags flags, boost::system::error_code& ec)
313 2486 sjacqu01
  {
314 2486 sjacqu01
    return service_impl_.send(impl, buffers, flags, ec);
315 2486 sjacqu01
  }
316 2486 sjacqu01
317 2486 sjacqu01
  /// Start an asynchronous send.
318 2486 sjacqu01
  template <typename ConstBufferSequence, typename WriteHandler>
319 2486 sjacqu01
  BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
320 2486 sjacqu01
      void (boost::system::error_code, std::size_t))
321 2486 sjacqu01
  async_send(implementation_type& impl, const ConstBufferSequence& buffers,
322 2486 sjacqu01
      socket_base::message_flags flags,
323 2486 sjacqu01
      BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
324 2486 sjacqu01
  {
325 2486 sjacqu01
    detail::async_result_init<
326 2486 sjacqu01
      WriteHandler, void (boost::system::error_code, std::size_t)> init(
327 2486 sjacqu01
        BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
328 2486 sjacqu01
329 2486 sjacqu01
    service_impl_.async_send(impl, buffers, flags, init.handler);
330 2486 sjacqu01
331 2486 sjacqu01
    return init.result.get();
332 2486 sjacqu01
  }
333 2486 sjacqu01
334 2486 sjacqu01
  /// Send raw data to the specified endpoint.
335 2486 sjacqu01
  template <typename ConstBufferSequence>
336 2486 sjacqu01
  std::size_t send_to(implementation_type& impl,
337 2486 sjacqu01
      const ConstBufferSequence& buffers, const endpoint_type& destination,
338 2486 sjacqu01
      socket_base::message_flags flags, boost::system::error_code& ec)
339 2486 sjacqu01
  {
340 2486 sjacqu01
    return service_impl_.send_to(impl, buffers, destination, flags, ec);
341 2486 sjacqu01
  }
342 2486 sjacqu01
343 2486 sjacqu01
  /// Start an asynchronous send.
344 2486 sjacqu01
  template <typename ConstBufferSequence, typename WriteHandler>
345 2486 sjacqu01
  BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
346 2486 sjacqu01
      void (boost::system::error_code, std::size_t))
347 2486 sjacqu01
  async_send_to(implementation_type& impl,
348 2486 sjacqu01
      const ConstBufferSequence& buffers, const endpoint_type& destination,
349 2486 sjacqu01
      socket_base::message_flags flags,
350 2486 sjacqu01
      BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
351 2486 sjacqu01
  {
352 2486 sjacqu01
    detail::async_result_init<
353 2486 sjacqu01
      WriteHandler, void (boost::system::error_code, std::size_t)> init(
354 2486 sjacqu01
        BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
355 2486 sjacqu01
356 2486 sjacqu01
    service_impl_.async_send_to(impl, buffers,
357 2486 sjacqu01
        destination, flags, init.handler);
358 2486 sjacqu01
359 2486 sjacqu01
    return init.result.get();
360 2486 sjacqu01
  }
361 2486 sjacqu01
362 2486 sjacqu01
  /// Receive some data from the peer.
363 2486 sjacqu01
  template <typename MutableBufferSequence>
364 2486 sjacqu01
  std::size_t receive(implementation_type& impl,
365 2486 sjacqu01
      const MutableBufferSequence& buffers,
366 2486 sjacqu01
      socket_base::message_flags flags, boost::system::error_code& ec)
367 2486 sjacqu01
  {
368 2486 sjacqu01
    return service_impl_.receive(impl, buffers, flags, ec);
369 2486 sjacqu01
  }
370 2486 sjacqu01
371 2486 sjacqu01
  /// Start an asynchronous receive.
372 2486 sjacqu01
  template <typename MutableBufferSequence, typename ReadHandler>
373 2486 sjacqu01
  BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
374 2486 sjacqu01
      void (boost::system::error_code, std::size_t))
375 2486 sjacqu01
  async_receive(implementation_type& impl,
376 2486 sjacqu01
      const MutableBufferSequence& buffers,
377 2486 sjacqu01
      socket_base::message_flags flags,
378 2486 sjacqu01
      BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
379 2486 sjacqu01
  {
380 2486 sjacqu01
    detail::async_result_init<
381 2486 sjacqu01
      ReadHandler, void (boost::system::error_code, std::size_t)> init(
382 2486 sjacqu01
        BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
383 2486 sjacqu01
384 2486 sjacqu01
    service_impl_.async_receive(impl, buffers, flags, init.handler);
385 2486 sjacqu01
386 2486 sjacqu01
    return init.result.get();
387 2486 sjacqu01
  }
388 2486 sjacqu01
389 2486 sjacqu01
  /// Receive raw data with the endpoint of the sender.
390 2486 sjacqu01
  template <typename MutableBufferSequence>
391 2486 sjacqu01
  std::size_t receive_from(implementation_type& impl,
392 2486 sjacqu01
      const MutableBufferSequence& buffers, endpoint_type& sender_endpoint,
393 2486 sjacqu01
      socket_base::message_flags flags, boost::system::error_code& ec)
394 2486 sjacqu01
  {
395 2486 sjacqu01
    return service_impl_.receive_from(impl, buffers, sender_endpoint, flags,
396 2486 sjacqu01
        ec);
397 2486 sjacqu01
  }
398 2486 sjacqu01
399 2486 sjacqu01
  /// Start an asynchronous receive that will get the endpoint of the sender.
400 2486 sjacqu01
  template <typename MutableBufferSequence, typename ReadHandler>
401 2486 sjacqu01
  BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
402 2486 sjacqu01
      void (boost::system::error_code, std::size_t))
403 2486 sjacqu01
  async_receive_from(implementation_type& impl,
404 2486 sjacqu01
      const MutableBufferSequence& buffers, endpoint_type& sender_endpoint,
405 2486 sjacqu01
      socket_base::message_flags flags,
406 2486 sjacqu01
      BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
407 2486 sjacqu01
  {
408 2486 sjacqu01
    detail::async_result_init<
409 2486 sjacqu01
      ReadHandler, void (boost::system::error_code, std::size_t)> init(
410 2486 sjacqu01
        BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
411 2486 sjacqu01
412 2486 sjacqu01
    service_impl_.async_receive_from(impl, buffers,
413 2486 sjacqu01
        sender_endpoint, flags, init.handler);
414 2486 sjacqu01
415 2486 sjacqu01
    return init.result.get();
416 2486 sjacqu01
  }
417 2486 sjacqu01
418 2486 sjacqu01
private:
419 2486 sjacqu01
  // Destroy all user-defined handler objects owned by the service.
420 2486 sjacqu01
  void shutdown_service()
421 2486 sjacqu01
  {
422 2486 sjacqu01
    service_impl_.shutdown_service();
423 2486 sjacqu01
  }
424 2486 sjacqu01
425 2486 sjacqu01
  // The platform-specific implementation.
426 2486 sjacqu01
  service_impl_type service_impl_;
427 2486 sjacqu01
};
428 2486 sjacqu01
429 2486 sjacqu01
} // namespace asio
430 2486 sjacqu01
} // namespace boost
431 2486 sjacqu01
432 2486 sjacqu01
#include <boost/asio/detail/pop_options.hpp>
433 2486 sjacqu01
434 2486 sjacqu01
#endif // BOOST_ASIO_RAW_SOCKET_SERVICE_HPP