libzmq/src/pgm_sender.hpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

98 lines
2.1 KiB
C++
Raw Permalink Normal View History

/* SPDX-License-Identifier: MPL-2.0 */
2009-09-11 17:58:37 +02:00
2009-09-15 09:57:11 +02:00
#ifndef __ZMQ_PGM_SENDER_HPP_INCLUDED__
#define __ZMQ_PGM_SENDER_HPP_INCLUDED__
2009-09-11 17:58:37 +02:00
2009-09-24 16:23:49 +02:00
#if defined ZMQ_HAVE_OPENPGM
2009-09-11 17:58:37 +02:00
#include "stdint.hpp"
#include "io_object.hpp"
#include "i_engine.hpp"
#include "options.hpp"
#include "pgm_socket.hpp"
2013-03-18 02:05:51 +01:00
#include "v1_encoder.hpp"
#include "msg.hpp"
2009-09-11 17:58:37 +02:00
namespace zmq
{
class io_thread_t;
class session_base_t;
2009-09-11 17:58:37 +02:00
class pgm_sender_t ZMQ_FINAL : public io_object_t, public i_engine
{
public:
pgm_sender_t (zmq::io_thread_t *parent_, const options_t &options_);
2009-09-11 17:58:37 +02:00
~pgm_sender_t ();
int init (bool udp_encapsulation_, const char *network_);
2009-09-11 17:58:37 +02:00
// i_engine interface implementation.
bool has_handshake_stage () { return false; };
void plug (zmq::io_thread_t *io_thread_, zmq::session_base_t *session_);
void terminate ();
bool restart_input ();
void restart_output ();
void zap_msg_available () {}
const endpoint_uri_pair_t &get_endpoint () const;
2009-09-11 17:58:37 +02:00
// i_poll_events interface implementation.
void in_event ();
void out_event ();
2010-09-28 22:46:56 +02:00
void timer_event (int token);
private:
2012-05-27 15:15:09 +02:00
// Unplug the engine from the session.
void unplug ();
2010-09-28 22:46:56 +02:00
// TX and RX timeout timer ID's.
enum
2009-09-11 17:58:37 +02:00
{
2010-09-28 22:46:56 +02:00
tx_timer_id = 0xa0,
rx_timer_id = 0xa1
};
2009-09-11 17:58:37 +02:00
const endpoint_uri_pair_t _empty_endpoint;
2009-09-11 17:58:37 +02:00
// Timers are running.
2010-09-28 22:46:56 +02:00
bool has_tx_timer;
bool has_rx_timer;
2013-03-18 02:05:51 +01:00
session_base_t *session;
2009-09-11 17:58:37 +02:00
// Message encoder.
v1_encoder_t encoder;
msg_t msg;
2009-09-11 17:58:37 +02:00
// Keeps track of message boundaries.
bool more_flag;
// PGM socket.
pgm_socket_t pgm_socket;
// Socket options.
2009-09-28 18:06:06 +02:00
options_t options;
2009-09-11 17:58:37 +02:00
// Poll handle associated with PGM socket.
handle_t handle;
handle_t uplink_handle;
2009-09-28 18:06:06 +02:00
handle_t rdata_notify_handle;
handle_t pending_notify_handle;
2009-09-11 17:58:37 +02:00
// Output buffer from pgm_socket.
unsigned char *out_buffer;
2009-12-28 11:51:06 +01:00
// Output buffer size.
2009-09-11 17:58:37 +02:00
size_t out_buffer_size;
// Number of bytes in the buffer to be written to the socket.
// If zero, there are no data to be sent.
size_t write_size;
2009-09-11 17:58:37 +02:00
ZMQ_NON_COPYABLE_NOR_MOVABLE (pgm_sender_t)
};
2009-09-11 17:58:37 +02:00
}
#endif
#endif