pgm_sender.hpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MPL-2.0 */
2 
3 #ifndef __ZMQ_PGM_SENDER_HPP_INCLUDED__
4 #define __ZMQ_PGM_SENDER_HPP_INCLUDED__
5 
6 #if defined ZMQ_HAVE_OPENPGM
7 
8 #include "stdint.hpp"
9 #include "io_object.hpp"
10 #include "i_engine.hpp"
11 #include "options.hpp"
12 #include "pgm_socket.hpp"
13 #include "v1_encoder.hpp"
14 #include "msg.hpp"
15 
16 namespace zmq
17 {
18 class io_thread_t;
19 class session_base_t;
20 
21 class pgm_sender_t ZMQ_FINAL : public io_object_t, public i_engine
22 {
23  public:
24  pgm_sender_t (zmq::io_thread_t *parent_, const options_t &options_);
25  ~pgm_sender_t ();
26 
27  int init (bool udp_encapsulation_, const char *network_);
28 
29  // i_engine interface implementation.
30  bool has_handshake_stage () { return false; };
31  void plug (zmq::io_thread_t *io_thread_, zmq::session_base_t *session_);
32  void terminate ();
33  bool restart_input ();
34  void restart_output ();
35  void zap_msg_available () {}
36  const endpoint_uri_pair_t &get_endpoint () const;
37 
38  // i_poll_events interface implementation.
39  void in_event ();
40  void out_event ();
41  void timer_event (int token);
42 
43  private:
44  // Unplug the engine from the session.
45  void unplug ();
46 
47  // TX and RX timeout timer ID's.
48  enum
49  {
50  tx_timer_id = 0xa0,
51  rx_timer_id = 0xa1
52  };
53 
54  const endpoint_uri_pair_t _empty_endpoint;
55 
56  // Timers are running.
57  bool has_tx_timer;
58  bool has_rx_timer;
59 
60  session_base_t *session;
61 
62  // Message encoder.
63  v1_encoder_t encoder;
64 
65  msg_t msg;
66 
67  // Keeps track of message boundaries.
68  bool more_flag;
69 
70  // PGM socket.
71  pgm_socket_t pgm_socket;
72 
73  // Socket options.
74  options_t options;
75 
76  // Poll handle associated with PGM socket.
77  handle_t handle;
78  handle_t uplink_handle;
79  handle_t rdata_notify_handle;
80  handle_t pending_notify_handle;
81 
82  // Output buffer from pgm_socket.
83  unsigned char *out_buffer;
84 
85  // Output buffer size.
86  size_t out_buffer_size;
87 
88  // Number of bytes in the buffer to be written to the socket.
89  // If zero, there are no data to be sent.
90  size_t write_size;
91 
92  ZMQ_NON_COPYABLE_NOR_MOVABLE (pgm_sender_t)
93 };
94 }
95 #endif
96 
97 #endif
zmq::session_base_t
Definition: session_base.hpp:21
init
WEPOLL_INTERNAL int init(void)
Definition: wepoll.c:858
options
Message * options
Definition: src/google/protobuf/descriptor.cc:3119
encoder
static char encoder[85+1]
Definition: zmq_utils.cpp:72
zmq
Definition: zmq.hpp:229
v1_encoder.hpp
stdint.hpp
ZMQ_NON_COPYABLE_NOR_MOVABLE
#define ZMQ_NON_COPYABLE_NOR_MOVABLE(classname)
Definition: macros.hpp:58
pgm_socket.hpp
msg.hpp
options.hpp
io_object.hpp
i_engine.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:06:57