libzmq  master
ZeroMQ C++ Core Engine (LIBZMQ)
udp_engine.hpp
Go to the documentation of this file.
1 
2 #ifndef __ZMQ_UDP_ENGINE_HPP_INCLUDED__
3 #define __ZMQ_UDP_ENGINE_HPP_INCLUDED__
4 
5 #include "io_object.hpp"
6 #include "i_engine.hpp"
7 #include "address.hpp"
8 #include "udp_address.hpp"
9 
10 #define MAX_UDP_MSG 8192
11 
12 namespace zmq
13 {
14  class io_thread_t;
15  class session_base_t;
16 
17  class udp_engine_t : public io_object_t, public i_engine
18  {
19  public:
20  udp_engine_t ();
21  ~udp_engine_t ();
22 
23  int init (address_t *address_, bool send_, bool recv_);
24 
25  // i_engine interface implementation.
26  // Plug the engine to the session.
27  void plug (zmq::io_thread_t *io_thread_, class session_base_t *session_);
28 
29  // Terminate and deallocate the engine. Note that 'detached'
30  // events are not fired on termination.
31  void terminate ();
32 
33  // This method is called by the session to signalise that more
34  // messages can be written to the pipe.
35  void restart_input ();
36 
37  // This method is called by the session to signalise that there
38  // are messages to send available.
39  void restart_output ();
40 
41  void zap_msg_available () {};
42 
43  void in_event ();
44  void out_event ();
45 
46  private:
47 
48  bool plugged;
49 
54 
55  unsigned char out_buffer[MAX_UDP_MSG];
56  unsigned char in_buffer[MAX_UDP_MSG];
59  };
60 }
61 
62 #endif
void zap_msg_available()
Definition: udp_engine.hpp:41
unsigned char in_buffer[MAX_UDP_MSG]
Definition: udp_engine.hpp:56
int init(address_t *address_, bool send_, bool recv_)
Definition: udp_engine.cpp:76
#define MAX_UDP_MSG
Definition: udp_engine.hpp:10
address_t * address
Definition: udp_engine.hpp:53
void plug(zmq::io_thread_t *io_thread_, class session_base_t *session_)
Definition: udp_engine.cpp:93
unsigned char out_buffer[MAX_UDP_MSG]
Definition: udp_engine.hpp:55
session_base_t * session
Definition: udp_engine.hpp:51
Definition: address.hpp:35
poller_t::handle_t handle_t
Definition: io_object.hpp:62