ws_connecter.hpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MPL-2.0 */
2 
3 #ifndef __WS_CONNECTER_HPP_INCLUDED__
4 #define __WS_CONNECTER_HPP_INCLUDED__
5 
6 #include "fd.hpp"
7 #include "stdint.hpp"
9 
10 namespace zmq
11 {
12 class ws_connecter_t ZMQ_FINAL : public stream_connecter_base_t
13 {
14  public:
15  // If 'delayed_start' is true connecter first waits for a while,
16  // then starts connection process.
17  ws_connecter_t (zmq::io_thread_t *io_thread_,
18  zmq::session_base_t *session_,
19  const options_t &options_,
20  address_t *addr_,
21  bool delayed_start_,
22  bool wss_,
23  const std::string &tls_hostname_);
24  ~ws_connecter_t ();
25 
26  protected:
27  void create_engine (fd_t fd, const std::string &local_address_);
28 
29  private:
30  // ID of the timer used to check the connect timeout, must be different from stream_connecter_base_t::reconnect_timer_id.
31  enum
32  {
33  connect_timer_id = 2
34  };
35 
36  // Handlers for incoming commands.
37  void process_term (int linger_);
38 
39  // Handlers for I/O events.
40  void out_event ();
41  void timer_event (int id_);
42 
43  // Internal function to start the actual connection establishment.
44  void start_connecting ();
45 
46  // Internal function to add a connect timer
47  void add_connect_timer ();
48 
49  // Open TCP connecting socket. Returns -1 in case of error,
50  // 0 if connect was successful immediately. Returns -1 with
51  // EAGAIN errno if async connect was launched.
52  int open ();
53 
54  // Get the file descriptor of newly created connection. Returns
55  // retired_fd if the connection was unsuccessful.
56  fd_t connect ();
57 
58  // Tunes a connected socket.
59  bool tune_socket (fd_t fd_);
60 
61  // True iff a timer has been started.
62  bool _connect_timer_started;
63 
64  bool _wss;
66 
67  ZMQ_NON_COPYABLE_NOR_MOVABLE (ws_connecter_t)
68 };
69 }
70 
71 #endif
zmq::session_base_t
Definition: session_base.hpp:21
zmq::ZMQ_FINAL::_wss
bool _wss
Definition: ws_connecter.hpp:64
zmq::ZMQ_FINAL::_hostname
const std::string & _hostname
Definition: ws_connecter.hpp:65
string
GLsizei const GLchar *const * string
Definition: glcorearb.h:3083
zmq
Definition: zmq.hpp:229
stdint.hpp
ZMQ_NON_COPYABLE_NOR_MOVABLE
#define ZMQ_NON_COPYABLE_NOR_MOVABLE(classname)
Definition: macros.hpp:58
fd.hpp
fd_t
zmq_fd_t fd_t
Definition: libzmq/tests/testutil.hpp:98
stream_connecter_base.hpp
ZMQ_FINAL
Definition: unittest_ip_resolver.cpp:26
options_
DebugStringOptions options_
Definition: src/google/protobuf/descriptor.cc:2410


libaditof
Author(s):
autogenerated on Wed May 21 2025 02:07:02