libzmq  master
ZeroMQ C++ Core Engine (LIBZMQ)
zmq::pipe_t Class Reference

#include <pipe.hpp>

Inheritance diagram for zmq::pipe_t:
Collaboration diagram for zmq::pipe_t:

Public Member Functions

bool check_hwm () const
 
bool check_read ()
 
bool check_write ()
 
void flush ()
 
blob_t get_credential () const
 
blob_t get_identity ()
 
uint32_t get_routing_id ()
 
void hiccup ()
 
bool read (msg_t *msg_)
 
void rollback ()
 
void set_event_sink (i_pipe_events *sink_)
 
void set_hwms (int inhwm_, int outhwm_)
 
void set_hwms_boost (int inhwmboost_, int outhwmboost_)
 
void set_identity (const blob_t &identity_)
 
void set_nodelay ()
 
void set_routing_id (uint32_t routing_id_)
 
void terminate (bool delay_)
 
bool write (msg_t *msg_)
 
- Public Member Functions inherited from zmq::object_t
 object_t (zmq::ctx_t *ctx_, uint32_t tid_)
 
 object_t (object_t *parent_)
 
virtual ~object_t ()
 
ctx_tget_ctx ()
 
uint32_t get_tid ()
 
void process_command (zmq::command_t &cmd_)
 
void send_bind (zmq::own_t *destination_, zmq::pipe_t *pipe_, bool inc_seqnum_=true)
 
void send_inproc_connected (zmq::socket_base_t *socket_)
 
void set_tid (uint32_t id)
 
- Public Member Functions inherited from zmq::array_item_t< 1 >
 array_item_t ()
 
virtual ~array_item_t ()
 
int get_array_index ()
 
void set_array_index (int index_)
 
- Public Member Functions inherited from zmq::array_item_t< 2 >
 array_item_t ()
 
virtual ~array_item_t ()
 
int get_array_index ()
 
void set_array_index (int index_)
 
- Public Member Functions inherited from zmq::array_item_t< 3 >
 array_item_t ()
 
virtual ~array_item_t ()
 
int get_array_index ()
 
void set_array_index (int index_)
 

Private Types

enum  {
  active, delimiter_received, waiting_for_delimiter, term_ack_sent,
  term_req_sent1, term_req_sent2
}
 
typedef ypipe_base_t< msg_tupipe_t
 

Private Member Functions

 pipe_t (object_t *parent_, upipe_t *inpipe_, upipe_t *outpipe_, int inhwm_, int outhwm_, bool conflate_)
 
 pipe_t (const pipe_t &)
 
 ~pipe_t ()
 
const pipe_toperator= (const pipe_t &)
 
void process_activate_read ()
 
void process_activate_write (uint64_t msgs_read_)
 
void process_delimiter ()
 
void process_hiccup (void *pipe_)
 
void process_pipe_term ()
 
void process_pipe_term_ack ()
 
void set_peer (pipe_t *pipe_)
 

Static Private Member Functions

static int compute_lwm (int hwm_)
 
static bool is_delimiter (const msg_t &msg_)
 

Private Attributes

const bool conflate
 
blob_t credential
 
bool delay
 
int hwm
 
blob_t identity
 
bool in_active
 
int inhwmboost
 
upipe_tinpipe
 
int lwm
 
uint64_t msgs_read
 
uint64_t msgs_written
 
bool out_active
 
int outhwmboost
 
upipe_toutpipe
 
pipe_tpeer
 
uint64_t peers_msgs_read
 
int routing_id
 
i_pipe_eventssink
 
enum zmq::pipe_t:: { ... }  state
 

Friends

int pipepair (zmq::object_t *parents_[2], zmq::pipe_t *pipes_[2], int hwms_[2], bool conflate_[2])
 

Additional Inherited Members

- Protected Member Functions inherited from zmq::object_t
zmq::io_thread_tchoose_io_thread (uint64_t affinity_)
 
void connect_pending (const char *addr_, zmq::socket_base_t *bind_socket_)
 
void destroy_socket (zmq::socket_base_t *socket_)
 
zmq::endpoint_t find_endpoint (const char *addr_)
 
void log (const char *format_,...)
 
void pend_connection (const std::string &addr_, const endpoint_t &endpoint, pipe_t **pipes_)
 
virtual void process_attach (zmq::i_engine *engine_)
 
virtual void process_bind (zmq::pipe_t *pipe_)
 
virtual void process_own (zmq::own_t *object_)
 
virtual void process_plug ()
 
virtual void process_reap (zmq::socket_base_t *socket_)
 
virtual void process_reaped ()
 
virtual void process_seqnum ()
 
virtual void process_stop ()
 
virtual void process_term (int linger_)
 
virtual void process_term_ack ()
 
virtual void process_term_req (zmq::own_t *object_)
 
int register_endpoint (const char *addr_, const zmq::endpoint_t &endpoint_)
 
void send_activate_read (zmq::pipe_t *destination_)
 
void send_activate_write (zmq::pipe_t *destination_, uint64_t msgs_read_)
 
void send_attach (zmq::session_base_t *destination_, zmq::i_engine *engine_, bool inc_seqnum_=true)
 
void send_done ()
 
void send_hiccup (zmq::pipe_t *destination_, void *pipe_)
 
void send_own (zmq::own_t *destination_, zmq::own_t *object_)
 
void send_pipe_term (zmq::pipe_t *destination_)
 
void send_pipe_term_ack (zmq::pipe_t *destination_)
 
void send_plug (zmq::own_t *destination_, bool inc_seqnum_=true)
 
void send_reap (zmq::socket_base_t *socket_)
 
void send_reaped ()
 
void send_stop ()
 
void send_term (zmq::own_t *destination_, int linger_)
 
void send_term_ack (zmq::own_t *destination_)
 
void send_term_req (zmq::own_t *destination_, zmq::own_t *object_)
 
int unregister_endpoint (const std::string &addr_, socket_base_t *socket_)
 
void unregister_endpoints (zmq::socket_base_t *socket_)
 

Detailed Description

Definition at line 72 of file pipe.hpp.

Member Typedef Documentation

Definition at line 144 of file pipe.hpp.

Member Enumeration Documentation

anonymous enum
private
Enumerator
active 
delimiter_received 
waiting_for_delimiter 
term_ack_sent 
term_req_sent1 
term_req_sent2 

Definition at line 211 of file pipe.hpp.

Constructor & Destructor Documentation

zmq::pipe_t::pipe_t ( object_t parent_,
upipe_t inpipe_,
upipe_t outpipe_,
int  inhwm_,
int  outhwm_,
bool  conflate_ 
)
private

Definition at line 77 of file pipe.cpp.

zmq::pipe_t::~pipe_t ( )
private

Definition at line 100 of file pipe.cpp.

zmq::pipe_t::pipe_t ( const pipe_t )
private

Member Function Documentation

bool zmq::pipe_t::check_hwm ( ) const

Definition at line 531 of file pipe.cpp.

References hwm, msgs_written, and peers_msgs_read.

Referenced by check_write().

Here is the caller graph for this function:

bool zmq::pipe_t::check_write ( )

Definition at line 206 of file pipe.cpp.

References active, check_hwm(), out_active, state, and unlikely.

Referenced by write(), zmq::pair_t::xhas_out(), zmq::stream_t::xsend(), and zmq::router_t::xsend().

Here is the call graph for this function:

Here is the caller graph for this function:

int zmq::pipe_t::compute_lwm ( int  hwm_)
staticprivate

Definition at line 449 of file pipe.cpp.

Referenced by set_hwms().

Here is the caller graph for this function:

zmq::blob_t zmq::pipe_t::get_credential ( ) const

Definition at line 138 of file pipe.cpp.

References credential.

Referenced by zmq::fq_t::get_credential(), zmq::pair_t::get_credential(), zmq::fq_t::pipe_terminated(), and zmq::pair_t::xpipe_terminated().

Here is the caller graph for this function:

zmq::blob_t zmq::pipe_t::get_identity ( )

Definition at line 133 of file pipe.cpp.

References identity.

Referenced by zmq::stream_t::xhas_in(), zmq::router_t::xhas_in(), zmq::stream_t::xpipe_terminated(), zmq::router_t::xpipe_terminated(), zmq::stream_t::xrecv(), and zmq::router_t::xrecv().

Here is the caller graph for this function:

uint32_t zmq::pipe_t::get_routing_id ( )

Definition at line 123 of file pipe.cpp.

References routing_id.

Referenced by zmq::server_t::xpipe_terminated(), and zmq::server_t::xrecv().

Here is the caller graph for this function:

void zmq::pipe_t::hiccup ( )

Definition at line 486 of file pipe.cpp.

References active, alloc_assert, conflate, in_active, inpipe, peer, zmq::object_t::send_hiccup(), and state.

Referenced by zmq::session_base_t::reconnect().

Here is the call graph for this function:

Here is the caller graph for this function:

bool zmq::pipe_t::is_delimiter ( const msg_t msg_)
staticprivate

Definition at line 444 of file pipe.cpp.

References zmq::msg_t::is_delimiter().

Referenced by check_read().

Here is the call graph for this function:

Here is the caller graph for this function:

const pipe_t& zmq::pipe_t::operator= ( const pipe_t )
private
void zmq::pipe_t::process_activate_read ( )
privatevirtual

Reimplemented from zmq::object_t.

Definition at line 258 of file pipe.cpp.

References active, in_active, zmq::i_pipe_events::read_activated(), sink, state, and waiting_for_delimiter.

Here is the call graph for this function:

void zmq::pipe_t::process_activate_write ( uint64_t  msgs_read_)
privatevirtual

Reimplemented from zmq::object_t.

Definition at line 266 of file pipe.cpp.

References active, out_active, peers_msgs_read, sink, state, and zmq::i_pipe_events::write_activated().

Here is the call graph for this function:

void zmq::pipe_t::process_delimiter ( )
private

Definition at line 472 of file pipe.cpp.

References active, delimiter_received, outpipe, peer, zmq::object_t::send_pipe_term_ack(), state, term_ack_sent, waiting_for_delimiter, and zmq_assert.

Referenced by check_read(), and read().

Here is the call graph for this function:

Here is the caller graph for this function:

void zmq::pipe_t::process_hiccup ( void *  pipe_)
privatevirtual
void zmq::pipe_t::process_pipe_term ( )
privatevirtual

Reimplemented from zmq::object_t.

Definition at line 302 of file pipe.cpp.

References active, delay, delimiter_received, outpipe, peer, zmq::object_t::send_pipe_term_ack(), state, term_ack_sent, term_req_sent1, term_req_sent2, waiting_for_delimiter, and zmq_assert.

Here is the call graph for this function:

void zmq::pipe_t::process_pipe_term_ack ( )
privatevirtual
void zmq::pipe_t::rollback ( )

Definition at line 235 of file pipe.cpp.

References zmq::msg_t::close(), errno_assert, zmq::msg_t::flags, zmq::msg_t::more, outpipe, zmq::ypipe_base_t< T >::unwrite(), and zmq_assert.

Referenced by zmq::session_base_t::clean_pipes(), zmq::router_t::rollback(), and terminate().

Here is the call graph for this function:

Here is the caller graph for this function:

void zmq::pipe_t::set_event_sink ( i_pipe_events sink_)

Definition at line 111 of file pipe.cpp.

References sink, and zmq_assert.

Referenced by zmq::session_base_t::attach_pipe(), zmq::socket_base_t::attach_pipe(), zmq::session_base_t::process_attach(), and zmq::session_base_t::zap_connect().

Here is the caller graph for this function:

void zmq::pipe_t::set_hwms ( int  inhwm_,
int  outhwm_ 
)

Definition at line 509 of file pipe.cpp.

References compute_lwm(), hwm, inhwmboost, lwm, and outhwmboost.

Referenced by zmq::ctx_t::connect_inproc_sockets().

Here is the call graph for this function:

Here is the caller graph for this function:

void zmq::pipe_t::set_hwms_boost ( int  inhwmboost_,
int  outhwmboost_ 
)

Definition at line 525 of file pipe.cpp.

References inhwmboost, and outhwmboost.

Referenced by zmq::socket_base_t::connect(), and zmq::ctx_t::connect_inproc_sockets().

Here is the caller graph for this function:

void zmq::pipe_t::set_identity ( const blob_t identity_)

Definition at line 128 of file pipe.cpp.

References identity.

Referenced by zmq::stream_t::identify_peer(), and zmq::router_t::identify_peer().

Here is the caller graph for this function:

void zmq::pipe_t::set_nodelay ( )

Definition at line 380 of file pipe.cpp.

References delay.

Referenced by zmq::pub_t::xattach_pipe(), zmq::push_t::xattach_pipe(), zmq::scatter_t::xattach_pipe(), zmq::radio_t::xattach_pipe(), and zmq::session_base_t::zap_connect().

Here is the caller graph for this function:

void zmq::pipe_t::set_peer ( pipe_t pipe_)
private

Definition at line 104 of file pipe.cpp.

References peer, and zmq_assert.

Referenced by zmq::pipepair().

Here is the caller graph for this function:

void zmq::pipe_t::set_routing_id ( uint32_t  routing_id_)

Definition at line 118 of file pipe.cpp.

References routing_id.

Referenced by zmq::server_t::xattach_pipe().

Here is the caller graph for this function:

Friends And Related Function Documentation

int pipepair ( zmq::object_t parents_[2],
zmq::pipe_t pipes_[2],
int  hwms_[2],
bool  conflate_[2] 
)
friend

Member Data Documentation

const bool zmq::pipe_t::conflate
private

Definition at line 240 of file pipe.hpp.

Referenced by hiccup(), and process_pipe_term_ack().

blob_t zmq::pipe_t::credential
private

Definition at line 232 of file pipe.hpp.

Referenced by get_credential(), and read().

bool zmq::pipe_t::delay
private

Definition at line 223 of file pipe.hpp.

Referenced by process_pipe_term(), set_nodelay(), and terminate().

int zmq::pipe_t::hwm
private

Definition at line 177 of file pipe.hpp.

Referenced by check_hwm(), and set_hwms().

blob_t zmq::pipe_t::identity
private

Definition at line 226 of file pipe.hpp.

Referenced by get_identity(), and set_identity().

bool zmq::pipe_t::in_active
private

Definition at line 173 of file pipe.hpp.

Referenced by check_read(), hiccup(), process_activate_read(), and read().

int zmq::pipe_t::inhwmboost
private

Definition at line 183 of file pipe.hpp.

Referenced by set_hwms(), and set_hwms_boost().

upipe_t* zmq::pipe_t::inpipe
private

Definition at line 169 of file pipe.hpp.

Referenced by check_read(), hiccup(), process_pipe_term_ack(), and read().

int zmq::pipe_t::lwm
private

Definition at line 180 of file pipe.hpp.

Referenced by read(), and set_hwms().

uint64_t zmq::pipe_t::msgs_read
private

Definition at line 187 of file pipe.hpp.

Referenced by read().

uint64_t zmq::pipe_t::msgs_written
private

Definition at line 188 of file pipe.hpp.

Referenced by check_hwm(), process_hiccup(), and write().

bool zmq::pipe_t::out_active
private

Definition at line 174 of file pipe.hpp.

Referenced by check_write(), process_activate_write(), process_hiccup(), and terminate().

int zmq::pipe_t::outhwmboost
private

Definition at line 184 of file pipe.hpp.

Referenced by set_hwms(), and set_hwms_boost().

upipe_t* zmq::pipe_t::outpipe
private
pipe_t* zmq::pipe_t::peer
private
uint64_t zmq::pipe_t::peers_msgs_read
private

Definition at line 192 of file pipe.hpp.

Referenced by check_hwm(), and process_activate_write().

int zmq::pipe_t::routing_id
private

Definition at line 229 of file pipe.hpp.

Referenced by get_routing_id(), and set_routing_id().

i_pipe_events* zmq::pipe_t::sink
private