Clementine
connect.hpp
1 //
2 // connect.hpp
3 // ~~~~~~~~~~~
4 //
5 // Copyright (c) 2003-2020 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 
11 #ifndef ASIO_CONNECT_HPP
12 #define ASIO_CONNECT_HPP
13 
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
15 # pragma once
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17 
18 #include "asio/detail/config.hpp"
19 #include "asio/async_result.hpp"
20 #include "asio/basic_socket.hpp"
21 #include "asio/detail/type_traits.hpp"
22 #include "asio/error.hpp"
23 
24 #include "asio/detail/push_options.hpp"
25 
26 namespace asio {
27 
28 namespace detail
29 {
30  char (&has_iterator_helper(...))[2];
31 
32  template <typename T>
33  char has_iterator_helper(T*, typename T::iterator* = 0);
34 
35  template <typename T>
37  {
38  enum { value = (sizeof((has_iterator_helper)((T*)(0))) == 1) };
39  };
40 } // namespace detail
41 
44 template <typename T>
46 {
47 #if defined(GENERATING_DOCUMENTATION)
48  static const bool value;
50 #else
51  enum
52  {
54  };
55 #endif
56 };
57 
65 
67 
90 template <typename Protocol, typename Executor, typename EndpointSequence>
91 typename Protocol::endpoint connect(basic_socket<Protocol, Executor>& s,
92  const EndpointSequence& endpoints,
94  EndpointSequence>::value>::type* = 0);
95 
97 
126 template <typename Protocol, typename Executor, typename EndpointSequence>
127 typename Protocol::endpoint connect(basic_socket<Protocol, Executor>& s,
128  const EndpointSequence& endpoints, asio::error_code& ec,
130  EndpointSequence>::value>::type* = 0);
131 
132 #if !defined(ASIO_NO_DEPRECATED)
133 
157 template <typename Protocol, typename Executor, typename Iterator>
158 Iterator connect(basic_socket<Protocol, Executor>& s, Iterator begin,
159  typename enable_if<!is_endpoint_sequence<Iterator>::value>::type* = 0);
160 
163 
185 template <typename Protocol, typename Executor, typename Iterator>
187  Iterator begin, asio::error_code& ec,
188  typename enable_if<!is_endpoint_sequence<Iterator>::value>::type* = 0);
189 #endif // !defined(ASIO_NO_DEPRECATED)
190 
192 
218 template <typename Protocol, typename Executor, typename Iterator>
220  Iterator begin, Iterator end);
221 
223 
255 template <typename Protocol, typename Executor, typename Iterator>
257  Iterator begin, Iterator end, asio::error_code& ec);
258 
260 
310 template <typename Protocol, typename Executor,
311  typename EndpointSequence, typename ConnectCondition>
312 typename Protocol::endpoint connect(basic_socket<Protocol, Executor>& s,
313  const EndpointSequence& endpoints, ConnectCondition connect_condition,
315  EndpointSequence>::value>::type* = 0);
316 
318 
377 template <typename Protocol, typename Executor,
378  typename EndpointSequence, typename ConnectCondition>
379 typename Protocol::endpoint connect(basic_socket<Protocol, Executor>& s,
380  const EndpointSequence& endpoints, ConnectCondition connect_condition,
381  asio::error_code& ec,
383  EndpointSequence>::value>::type* = 0);
384 
385 #if !defined(ASIO_NO_DEPRECATED)
386 
421 template <typename Protocol, typename Executor,
422  typename Iterator, typename ConnectCondition>
424  Iterator begin, ConnectCondition connect_condition,
425  typename enable_if<!is_endpoint_sequence<Iterator>::value>::type* = 0);
426 
429 
462 template <typename Protocol, typename Executor,
463  typename Iterator, typename ConnectCondition>
464 Iterator connect(basic_socket<Protocol, Executor>& s, Iterator begin,
465  ConnectCondition connect_condition, asio::error_code& ec,
466  typename enable_if<!is_endpoint_sequence<Iterator>::value>::type* = 0);
467 #endif // !defined(ASIO_NO_DEPRECATED)
468 
470 
523 template <typename Protocol, typename Executor,
524  typename Iterator, typename ConnectCondition>
525 Iterator connect(basic_socket<Protocol, Executor>& s, Iterator begin,
526  Iterator end, ConnectCondition connect_condition);
527 
529 
591 template <typename Protocol, typename Executor,
592  typename Iterator, typename ConnectCondition>
594  Iterator begin, Iterator end, ConnectCondition connect_condition,
595  asio::error_code& ec);
596 
606 
609 
668 template <typename Protocol, typename Executor, typename EndpointSequence,
669  ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
670  typename Protocol::endpoint)) RangeConnectHandler
671  ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(Executor)>
672 ASIO_INITFN_AUTO_RESULT_TYPE(RangeConnectHandler,
673  void (asio::error_code, typename Protocol::endpoint))
674 async_connect(basic_socket<Protocol, Executor>& s,
675  const EndpointSequence& endpoints,
676  ASIO_MOVE_ARG(RangeConnectHandler) handler
677  ASIO_DEFAULT_COMPLETION_TOKEN(Executor),
679  EndpointSequence>::value>::type* = 0);
680 
681 #if !defined(ASIO_NO_DEPRECATED)
682 
717 template <typename Protocol, typename Executor, typename Iterator,
718  ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
719  Iterator)) IteratorConnectHandler
720  ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(Executor)>
721 ASIO_INITFN_AUTO_RESULT_TYPE(IteratorConnectHandler,
722  void (asio::error_code, Iterator))
723 async_connect(basic_socket<Protocol, Executor>& s, Iterator begin,
724  ASIO_MOVE_ARG(IteratorConnectHandler) handler
725  ASIO_DEFAULT_COMPLETION_TOKEN(Executor),
726  typename enable_if<!is_endpoint_sequence<Iterator>::value>::type* = 0);
727 #endif // !defined(ASIO_NO_DEPRECATED)
728 
731 
778 template <typename Protocol, typename Executor, typename Iterator,
779  ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
780  Iterator)) IteratorConnectHandler
781  ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(Executor)>
782 ASIO_INITFN_AUTO_RESULT_TYPE(IteratorConnectHandler,
783  void (asio::error_code, Iterator))
784 async_connect(basic_socket<Protocol, Executor>& s, Iterator begin, Iterator end,
785  ASIO_MOVE_ARG(IteratorConnectHandler) handler
786  ASIO_DEFAULT_COMPLETION_TOKEN(Executor));
787 
790 
883 template <typename Protocol, typename Executor,
884  typename EndpointSequence, typename ConnectCondition,
885  ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
886  typename Protocol::endpoint)) RangeConnectHandler
887  ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(Executor)>
888 ASIO_INITFN_AUTO_RESULT_TYPE(RangeConnectHandler,
889  void (asio::error_code, typename Protocol::endpoint))
890 async_connect(basic_socket<Protocol, Executor>& s,
891  const EndpointSequence& endpoints, ConnectCondition connect_condition,
892  ASIO_MOVE_ARG(RangeConnectHandler) handler
893  ASIO_DEFAULT_COMPLETION_TOKEN(Executor),
895  EndpointSequence>::value>::type* = 0);
896 
897 #if !defined(ASIO_NO_DEPRECATED)
898 
944 template <typename Protocol, typename Executor,
945  typename Iterator, typename ConnectCondition,
946  ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
947  Iterator)) IteratorConnectHandler
948  ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(Executor)>
949 ASIO_INITFN_AUTO_RESULT_TYPE(IteratorConnectHandler,
950  void (asio::error_code, Iterator))
951 async_connect(basic_socket<Protocol, Executor>& s, Iterator begin,
952  ConnectCondition connect_condition,
953  ASIO_MOVE_ARG(IteratorConnectHandler) handler
954  ASIO_DEFAULT_COMPLETION_TOKEN(Executor),
955  typename enable_if<!is_endpoint_sequence<Iterator>::value>::type* = 0);
956 #endif // !defined(ASIO_NO_DEPRECATED)
957 
960 
1056 template <typename Protocol, typename Executor,
1057  typename Iterator, typename ConnectCondition,
1058  ASIO_COMPLETION_TOKEN_FOR(void (asio::error_code,
1059  Iterator)) IteratorConnectHandler
1060  ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(Executor)>
1061 ASIO_INITFN_AUTO_RESULT_TYPE(IteratorConnectHandler,
1062  void (asio::error_code, Iterator))
1063 async_connect(basic_socket<Protocol, Executor>& s, Iterator begin,
1064  Iterator end, ConnectCondition connect_condition,
1065  ASIO_MOVE_ARG(IteratorConnectHandler) handler
1066  ASIO_DEFAULT_COMPLETION_TOKEN(Executor));
1067 
1070 } // namespace asio
1071 
1072 #include "asio/detail/pop_options.hpp"
1073 
1074 #include "asio/impl/connect.hpp"
1075 
1076 #endif
Definition: blocking.hpp:208
Definition: connect.hpp:36
Executor const EndpointSequence ConnectCondition enable_if< is_endpoint_sequence< EndpointSequence >::value >::type * ASIO_INITFN_AUTO_RESULT_TYPE(IteratorConnectHandler, void(asio::error_code, Iterator)) async_connect(basic_socket< Protocol
(Deprecated: Use range overload.) Asynchronously establishes a socket connection by trying each endpo...
Definition: chrono.h:284
Type trait used to determine whether a type is an endpoint sequence that can be used with with connec...
Definition: connect.hpp:45
Definition: type_traits.hpp:97
Class to represent an error code value.
Definition: error_code.hpp:80
Iterator connect(basic_socket< Protocol, Executor > &s, Iterator begin, Iterator end, ConnectCondition connect_condition, asio::error_code &ec)
Establishes a socket connection by trying each endpoint in a sequence.
Definition: connect.hpp:229
Provides socket functionality.
Definition: basic_socket.hpp:52
Definition: any_io_executor.hpp:28