vmci_connecter.hpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MPL-2.0 */
2 
3 #ifndef __ZMQ_VMCI_CONNECTER_HPP_INCLUDED__
4 #define __ZMQ_VMCI_CONNECTER_HPP_INCLUDED__
5 
6 #include "platform.hpp"
7 
8 #if defined ZMQ_HAVE_VMCI
9 
10 #include "fd.hpp"
11 #include "own.hpp"
12 #include "stdint.hpp"
13 #include "io_object.hpp"
15 
16 namespace zmq
17 {
18 class io_thread_t;
19 class session_base_t;
20 struct address_t;
21 
22 class vmci_connecter_t ZMQ_FINAL : public stream_connecter_base_t
23 {
24  public:
25  // If 'delayed_start' is true connecter first waits for a while,
26  // then starts connection process.
27  vmci_connecter_t (zmq::io_thread_t *io_thread_,
28  zmq::session_base_t *session_,
29  const options_t &options_,
30  address_t *addr_,
31  bool delayed_start_);
32  ~vmci_connecter_t ();
33 
34  protected:
35  std::string get_socket_name (fd_t fd_, socket_end_t socket_end_) const;
36 
37  private:
38  // ID of the timer used to check the connect timeout, must be different from stream_connecter_base_t::reconnect_timer_id.
39  enum
40  {
41  connect_timer_id = 2
42  };
43 
44  // Handlers for incoming commands.
45  void process_term (int linger_);
46 
47  // Handlers for I/O events.
48  void in_event ();
49  void out_event ();
50  void timer_event (int id_);
51 
52  // Internal function to start the actual connection establishment.
53  void start_connecting ();
54 
55  // Internal function to add a connect timer
56  void add_connect_timer ();
57 
58  // Internal function to return a reconnect backoff delay.
59  // Will modify the current_reconnect_ivl used for next call
60  // Returns the currently used interval
61  int get_new_reconnect_ivl ();
62 
63  // Open VMCI connecting socket. Returns -1 in case of error,
64  // 0 if connect was successful immediately. Returns -1 with
65  // EAGAIN errno if async connect was launched.
66  int open ();
67 
68  // Get the file descriptor of newly created connection. Returns
69  // retired_fd if the connection was unsuccessful.
70  fd_t connect ();
71 
72  // True iff a timer has been started.
73  bool _connect_timer_started;
74 
75  ZMQ_NON_COPYABLE_NOR_MOVABLE (vmci_connecter_t)
76 };
77 }
78 
79 #endif
80 
81 #endif
zmq::get_socket_name
std::string get_socket_name(fd_t fd_, socket_end_t socket_end_)
Definition: address.hpp:120
zmq::session_base_t
Definition: session_base.hpp:21
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
io_object.hpp
fd_t
zmq_fd_t fd_t
Definition: libzmq/tests/testutil.hpp:98
stream_connecter_base.hpp
zmq::socket_end_t
socket_end_t
Definition: address.hpp:110
own.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:01