req.hpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MPL-2.0 */
2 
3 #ifndef __ZMQ_REQ_HPP_INCLUDED__
4 #define __ZMQ_REQ_HPP_INCLUDED__
5 
6 #include "dealer.hpp"
7 #include "stdint.hpp"
8 
9 namespace zmq
10 {
11 class ctx_t;
12 class msg_t;
13 class io_thread_t;
14 class socket_base_t;
15 
16 class req_t ZMQ_FINAL : public dealer_t
17 {
18  public:
19  req_t (zmq::ctx_t *parent_, uint32_t tid_, int sid_);
20  ~req_t ();
21 
22  // Overrides of functions from socket_base_t.
23  int xsend (zmq::msg_t *msg_);
24  int xrecv (zmq::msg_t *msg_);
25  bool xhas_in ();
26  bool xhas_out ();
27  int xsetsockopt (int option_, const void *optval_, size_t optvallen_);
28  void xpipe_terminated (zmq::pipe_t *pipe_);
29 
30  protected:
31  // Receive only from the pipe the request was sent to, discarding
32  // frames from other pipes.
33  int recv_reply_pipe (zmq::msg_t *msg_);
34 
35  private:
36  // If true, request was already sent and reply wasn't received yet or
37  // was received partially.
39 
40  // If true, we are starting to send/recv a message. The first part
41  // of the message must be empty message part (backtrace stack bottom).
43 
44  // The pipe the request was sent to and where the reply is expected.
45  zmq::pipe_t *_reply_pipe;
46 
47  // Whether request id frames shall be sent and expected.
49 
50  // The current request id. It is incremented every time before a new
51  // request is sent.
52  uint32_t _request_id;
53 
54  // If false, send() will reset its internal state and terminate the
55  // reply_pipe's connection instead of failing if a previous request is
56  // still pending.
57  bool _strict;
58 
60 };
61 
62 class req_session_t ZMQ_FINAL : public session_base_t
63 {
64  public:
65  req_session_t (zmq::io_thread_t *io_thread_,
66  bool connect_,
67  zmq::socket_base_t *socket_,
68  const options_t &options_,
69  address_t *addr_);
70  ~req_session_t ();
71 
72  // Overrides of the functions from session_base_t.
73  int push_msg (msg_t *msg_);
74  void reset ();
75 
76  private:
77  enum
78  {
81  body
82  } _state;
83 
84  ZMQ_NON_COPYABLE_NOR_MOVABLE (req_session_t)
85 };
86 }
87 
88 #endif
zmq::ZMQ_FINAL
Definition: channel.hpp:17
zmq::session_base_t
Definition: session_base.hpp:21
zmq::ZMQ_FINAL::_message_begins
bool _message_begins
Definition: req.hpp:42
zmq::ZMQ_FINAL::_strict
bool _strict
Definition: req.hpp:57
zmq::options_t
Definition: options.hpp:34
zmq::ZMQ_FINAL::_request_id
uint32_t _request_id
Definition: req.hpp:52
zmq::socket_base_t
Definition: socket_base.hpp:31
zmq::ZMQ_FINAL::_reply_pipe
zmq::pipe_t * _reply_pipe
Definition: req.hpp:45
zmq
Definition: zmq.hpp:229
stdint.hpp
zmq::ZMQ_FINAL::request_id
@ request_id
Definition: req.hpp:80
ZMQ_NON_COPYABLE_NOR_MOVABLE
#define ZMQ_NON_COPYABLE_NOR_MOVABLE(classname)
Definition: macros.hpp:58
zmq::ZMQ_FINAL::_receiving_reply
bool _receiving_reply
Definition: req.hpp:38
zmq::address_t
Definition: address.hpp:64
zmq::ZMQ_FINAL::bottom
@ bottom
Definition: req.hpp:79
dealer.hpp
zmq::ZMQ_FINAL::_request_id_frames_enabled
bool _request_id_frames_enabled
Definition: req.hpp:48
ZMQ_FINAL
Definition: unittest_ip_resolver.cpp:26
zmq::msg_t
Definition: msg.hpp:33
options_
DebugStringOptions options_
Definition: src/google/protobuf/descriptor.cc:2410


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