0
0
mirror of https://github.com/zeromq/libzmq.git synced 2025-01-22 07:29:31 +08:00
libzmq/src/pgm_sender.hpp

105 lines
2.6 KiB
C++
Raw Normal View History

2009-09-11 17:58:37 +02:00
/*
Copyright (c) 2007-2010 iMatix Corporation
2009-09-11 17:58:37 +02:00
This file is part of 0MQ.
0MQ is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by
2009-09-11 17:58:37 +02:00
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
0MQ is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
2009-09-11 17:58:37 +02:00
You should have received a copy of the GNU Lesser General Public License
2009-09-11 17:58:37 +02:00
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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
#include "platform.hpp"
2009-09-24 16:23:49 +02:00
#if defined ZMQ_HAVE_OPENPGM
2009-09-11 17:58:37 +02:00
#ifdef ZMQ_HAVE_WINDOWS
#include "windows.hpp"
#endif
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"
#include "encoder.hpp"
2009-09-11 17:58:37 +02:00
namespace zmq
{
class pgm_sender_t : public io_object_t, public i_engine
{
public:
2009-12-28 11:51:06 +01:00
pgm_sender_t (class 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.
void plug (class io_thread_t *io_thread_, struct i_inout *inout_);
2009-09-11 17:58:37 +02:00
void unplug ();
void terminate ();
void activate_in ();
void activate_out ();
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);
2009-09-11 17:58:37 +02:00
private:
2010-09-28 22:46:56 +02:00
// TX and RX timeout timer ID's.
enum {tx_timer_id = 0xa0, rx_timer_id = 0xa1};
// Timers are running.
bool has_tx_timer;
bool has_rx_timer;
2010-09-28 22:46:56 +02:00
2009-09-11 17:58:37 +02:00
// Message encoder.
encoder_t encoder;
2009-09-11 17:58:37 +02:00
// PGM socket.
pgm_socket_t pgm_socket;
// Socket options.
options_t options;
// 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;
// Output buffer size.
size_t out_buffer_size;
2009-12-28 11:51:06 +01:00
// Number of bytes in the buffer to be written to the socket.
// If zero, there are no data to be sent.
2009-09-11 17:58:37 +02:00
size_t write_size;
pgm_sender_t (const pgm_sender_t&);
void operator = (const pgm_sender_t&);
};
}
#endif
#endif