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

#include <msg.hpp>

Collaboration diagram for zmq::msg_t:

Classes

struct  content_t
 

Public Types

enum  {
  more = 1, command = 2, credential = 32, identity = 64,
  shared = 128
}
 
enum  { msg_t_size = 64 }
 
enum  { max_vsm_size }
 

Public Member Functions

void add_refs (int refs_)
 
bool check ()
 
int close ()
 
int copy (msg_t &src_)
 
void * data ()
 
unsigned char flags ()
 
uint32_t get_routing_id ()
 
const char * group ()
 
int init ()
 
int init (void *data, size_t size_, msg_free_fn *ffn_, void *hint, content_t *content_=NULL)
 
int init_data (void *data_, size_t size_, msg_free_fn *ffn_, void *hint_)
 
int init_delimiter ()
 
int init_external_storage (content_t *content_, void *data_, size_t size_, msg_free_fn *ffn_, void *hint_)
 
int init_join ()
 
int init_leave ()
 
int init_size (size_t size_)
 
bool is_cmsg () const
 
bool is_credential () const
 
bool is_delimiter () const
 
bool is_identity () const
 
bool is_join () const
 
bool is_leave () const
 
bool is_vsm () const
 
bool is_zcmsg () const
 
metadata_tmetadata () const
 
int move (msg_t &src_)
 
void reset_flags (unsigned char flags_)
 
void reset_metadata ()
 
int reset_routing_id ()
 
bool rm_refs (int refs_)
 
void set_flags (unsigned char flags_)
 
int set_group (const char *group_)
 
int set_group (const char *, size_t length)
 
void set_metadata (metadata_t *metadata_)
 
int set_routing_id (uint32_t routing_id_)
 
size_t size ()
 

Private Types

enum  type_t {
  type_min = 101, type_vsm = 101, type_lmsg = 102, type_delimiter = 103,
  type_cmsg = 104, type_zclmsg = 105, type_join = 106, type_leave = 107,
  type_max = 107
}
 

Private Member Functions

zmq::atomic_counter_trefcnt ()
 

Private Attributes

union {
   struct {
      unsigned char   flags
 
      char   group [16]
 
      metadata_t *   metadata
 
      uint32_t   routing_id
 
      unsigned char   type
 
      unsigned char   unused [msg_t_size-(sizeof(metadata_t
         *)+ 2+ 16+ sizeof(uint32_t))]
 
   }   base
 
   struct {
      void *   data
 
      unsigned char   flags
 
      char   group [16]
 
      metadata_t *   metadata
 
      uint32_t   routing_id
 
      size_t   size
 
      unsigned char   type
 
      unsigned char   unused [msg_t_size-(sizeof(metadata_t
         *)+ sizeof(void
         *)+ sizeof(size_t)+
          2+ 16+ sizeof(uint32_t))]
 
   }   cmsg
 
   struct {
      unsigned char   flags
 
      char   group [16]
 
      metadata_t *   metadata
 
      uint32_t   routing_id
 
      unsigned char   type
 
      unsigned char   unused [msg_t_size-(sizeof(metadata_t
         *)+ 2+ 16+ sizeof(uint32_t))]
 
   }   delimiter
 
   struct {
      content_t *   content
 
      unsigned char   flags
 
      char   group [16]
 
      metadata_t *   metadata
 
      uint32_t   routing_id
 
      unsigned char   type
 
      unsigned char   unused [msg_t_size-(sizeof(metadata_t
         *)+ sizeof(content_t
         *)+ 2+ 16+ sizeof(uint32_t))]
 
   }   lmsg
 
   struct {
      unsigned char   data [max_vsm_size]
 
      unsigned char   flags
 
      char   group [16]
 
      metadata_t *   metadata
 
      uint32_t   routing_id
 
      unsigned char   size
 
      unsigned char   type
 
   }   vsm
 
   struct {
      content_t *   content
 
      unsigned char   flags
 
      char   group [16]
 
      metadata_t *   metadata
 
      uint32_t   routing_id
 
      unsigned char   type
 
      unsigned char   unused [msg_t_size-(sizeof(metadata_t
         *)+ sizeof(content_t
         *)+ 2+ 16+ sizeof(uint32_t))]
 
   }   zclmsg
 
u
 

Detailed Description

Definition at line 55 of file msg.hpp.

Member Enumeration Documentation

anonymous enum
Enumerator
more 
command 
credential 
identity 
shared 

Definition at line 76 of file msg.hpp.

anonymous enum
Enumerator
msg_t_size 

Definition at line 136 of file msg.hpp.

anonymous enum
Enumerator
max_vsm_size 

Definition at line 137 of file msg.hpp.

enum zmq::msg_t::type_t
private
Enumerator
type_min 
type_vsm 
type_lmsg 
type_delimiter 
type_cmsg 
type_zclmsg 
type_join 
type_leave 
type_max 

Definition at line 145 of file msg.hpp.

Member Function Documentation

void zmq::msg_t::add_refs ( int  refs_)

Definition at line 457 of file msg.cpp.

References zmq::atomic_counter_t::add(), is_zcmsg(), refcnt(), zmq::atomic_counter_t::set(), shared, type_lmsg, u, and zmq_assert.

Referenced by zmq::dist_t::distribute().

Here is the call graph for this function:

Here is the caller graph for this function:

bool zmq::msg_t::check ( )

Definition at line 50 of file msg.cpp.

References type_max, type_min, and u.

Referenced by close(), copy(), move(), zmq::socket_base_t::recv(), zmq::socket_base_t::send(), and zmq::dbuffer_t< msg_t >::write().

Here is the caller graph for this function:

int zmq::msg_t::close ( )

Definition at line 217 of file msg.cpp.

References check(), is_zcmsg(), LIBZMQ_DELETE, shared, type_lmsg, u, unlikely, and zmq_assert.

Referenced by zmq::session_base_t::clean_pipes(), zmq::ctx_t::connect_inproc_sockets(), copy(), zmq::dist_t::distribute(), zmq::v1_decoder_t::eight_byte_size_ready(), zmq::encoder_base_t< raw_encoder_t >::encode(), zmq::stream_engine_t::error(), zmq::router_t::identify_peer(), zmq::udp_engine_t::in_event(), move(), zmq::v1_decoder_t::one_byte_size_ready(), zmq::udp_engine_t::out_event(), zmq::stream_engine_t::plug(), zmq::plain_client_t::process_handshake_command(), zmq::null_mechanism_t::process_handshake_command(), zmq::plain_server_t::process_handshake_command(), zmq::pipe_t::process_hiccup(), zmq::stream_engine_t::process_identity_msg(), zmq::pipe_t::process_pipe_term_ack(), zmq::dish_session_t::pull_msg(), zmq::radio_session_t::push_msg(), zmq::dish_session_t::push_msg(), zmq::pipe_t::read(), zmq::null_mechanism_t::receive_and_process_zap_reply(), zmq::plain_server_t::receive_and_process_zap_reply(), zmq::fq_t::recvpipe(), zmq::udp_engine_t::restart_output(), rm_refs(), zmq::pipe_t::rollback(), zmq::xsub_t::send_subscription(), zmq::dish_t::send_subscriptions(), zmq::lb_t::sendpipe(), zmq::v2_decoder_t::size_ready(), zmq::stream_engine_t::write_credential(), zmq::dealer_t::xattach_pipe(), zmq::router_t::xattach_pipe(), zmq::dish_t::xjoin(), zmq::dish_t::xleave(), zmq::xpub_t::xread_activated(), zmq::radio_t::xread_activated(), zmq::stream_t::xrecv(), zmq::pair_t::xrecv(), zmq::xpub_t::xrecv(), zmq::req_t::xsend(), zmq::stream_t::xsend(), zmq::xsub_t::xsend(), zmq::server_t::xsend(), zmq::router_t::xsend(), zmq::sub_t::xsetsockopt(), zmq::xpub_t::xsetsockopt(), zmq::dish_t::~dish_t(), zmq::raw_decoder_t::~raw_decoder_t(), zmq::router_t::~router_t(), zmq::stream_engine_t::~stream_engine_t(), zmq::stream_t::~stream_t(), zmq::v1_decoder_t::~v1_decoder_t(), zmq::v2_decoder_t::~v2_decoder_t(), zmq::xpub_t::~xpub_t(), and zmq::xsub_t::~xsub_t().

Here is the call graph for this function:

Here is the caller graph for this function:

int zmq::msg_t::copy ( msg_t src_)

Definition at line 295 of file msg.cpp.

References zmq::atomic_counter_t::add(), base, check(), close(), data(), flags(), is_zcmsg(), lmsg, refcnt(), zmq::atomic_counter_t::set(), shared, size(), type_cmsg, type_lmsg, type_vsm, type_zclmsg, u, unlikely, zclmsg, and zmq_assert.

Referenced by capture(), and zmq::xpub_t::xattach_pipe().

Here is the call graph for this function:

Here is the caller graph for this function:

void* zmq::msg_t::data ( )

Referenced by copy(), and init().

Here is the caller graph for this function:

unsigned char zmq::msg_t::flags ( )

Referenced by copy().

Here is the caller graph for this function:

uint32_t zmq::msg_t::get_routing_id ( )

Definition at line 522 of file msg.cpp.

References u.

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

Here is the caller graph for this function:

const char* zmq::msg_t::group ( )

Referenced by reset_routing_id().

Here is the caller graph for this function:

int zmq::msg_t::init ( )

Definition at line 82 of file msg.cpp.

References type_vsm, and u.

Referenced by capture(), zmq::session_base_t::clean_pipes(), zmq::raw_decoder_t::decode(), zmq::dish_t::dish_t(), zmq::dist_t::distribute(), zmq::v1_decoder_t::eight_byte_size_ready(), zmq::encoder_base_t< raw_encoder_t >::encode(), zmq::stream_engine_t::error(), zmq::router_t::identify_peer(), move(), zmq::v1_decoder_t::one_byte_size_ready(), zmq::stream_engine_t::plug(), zmq::plain_client_t::process_handshake_command(), zmq::plain_server_t::process_handshake_command(), zmq::null_mechanism_t::process_handshake_command(), zmq::stream_engine_t::process_identity_msg(), zmq::proxy(), zmq::session_base_t::push_msg(), zmq::dish_session_t::push_msg(), zmq::raw_decoder_t::raw_decoder_t(), zmq::dbuffer_t< msg_t >::read(), zmq::null_mechanism_t::receive_and_process_zap_reply(), zmq::plain_server_t::receive_and_process_zap_reply(), zmq::fq_t::recvpipe(), zmq::router_t::router_t(), zmq::null_mechanism_t::send_zap_request(), zmq::plain_server_t::send_zap_request(), zmq::lb_t::sendpipe(), zmq::v2_decoder_t::size_ready(), zmq::stream_engine_t::stream_engine_t(), zmq::stream_t::stream_t(), zmq::v1_decoder_t::v1_decoder_t(), zmq::v2_decoder_t::v2_decoder_t(), zmq::session_base_t::write_zap_msg(), zmq::dealer_t::xattach_pipe(), zmq::router_t::xattach_pipe(), zmq::xpub_t::xattach_pipe(), zmq::xpub_t::xpub_t(), zmq::pair_t::xrecv(), zmq::req_t::xsend(), zmq::stream_t::xsend(), zmq::pair_t::xsend(), zmq::xsub_t::xsend(), zmq::server_t::xsend(), zmq::router_t::xsend(), zmq::xpub_t::xsetsockopt(), and zmq::xsub_t::xsub_t().

Here is the caller graph for this function:

int zmq::msg_t::init ( void *  data,
size_t  size_,
msg_free_fn ffn_,
void *  hint,
content_t content_ = NULL 
)

Definition at line 55 of file msg.cpp.

References data(), init_data(), init_external_storage(), init_size(), and max_vsm_size.

Here is the call graph for this function:

int zmq::msg_t::init_data ( void *  data_,
size_t  size_,
msg_free_fn ffn_,
void *  hint_ 
)

Definition at line 148 of file msg.cpp.

References type_cmsg, type_lmsg, u, and zmq_assert.

Referenced by init(), and zmq::req_t::xsend().

Here is the caller graph for this function:

int zmq::msg_t::init_delimiter ( )

Definition at line 187 of file msg.cpp.

References type_delimiter, and u.

Referenced by zmq::pipe_t::terminate().

Here is the caller graph for this function:

int zmq::msg_t::init_external_storage ( content_t content_,
void *  data_,
size_t  size_,
msg_free_fn ffn_,
void *  hint_ 
)

Definition at line 126 of file msg.cpp.

References type_zclmsg, u, and zmq_assert.

Referenced by init().

Here is the caller graph for this function:

int zmq::msg_t::init_join ( )

Definition at line 197 of file msg.cpp.

References type_join, and u.

Referenced by zmq::radio_session_t::push_msg(), zmq::dish_t::send_subscriptions(), and zmq::dish_t::xjoin().

Here is the caller graph for this function:

int zmq::msg_t::init_leave ( )

Definition at line 207 of file msg.cpp.

References type_leave, and u.

Referenced by zmq::radio_session_t::push_msg(), and zmq::dish_t::xleave().

Here is the caller graph for this function:

bool zmq::msg_t::is_cmsg ( ) const

Definition at line 437 of file msg.cpp.

References type_cmsg, and u.

bool zmq::msg_t::is_credential ( ) const

Definition at line 422 of file msg.cpp.

References credential, and u.

Referenced by zmq::pipe_t::read().

Here is the caller graph for this function:

bool zmq::msg_t::is_delimiter ( ) const

Definition at line 427 of file msg.cpp.

References type_delimiter, and u.

Referenced by zmq::pipe_t::is_delimiter(), and zmq::pipe_t::read().

Here is the caller graph for this function:

bool zmq::msg_t::is_identity ( ) const

Definition at line 417 of file msg.cpp.

References identity, and u.

Referenced by zmq::pipe_t::read(), zmq::pipe_t::write(), zmq::router_t::xhas_in(), and zmq::router_t::xrecv().

Here is the caller graph for this function:

bool zmq::msg_t::is_join ( ) const

Definition at line 447 of file msg.cpp.

References type_join, and u.

Referenced by zmq::dish_session_t::pull_msg(), and zmq::radio_t::xread_activated().

Here is the caller graph for this function:

bool zmq::msg_t::is_leave ( ) const

Definition at line 452 of file msg.cpp.

References type_leave, and u.

Referenced by zmq::dish_session_t::pull_msg(), and zmq::radio_t::xread_activated().

Here is the caller graph for this function:

bool zmq::msg_t::is_vsm ( ) const

Definition at line 432 of file msg.cpp.

References type_vsm, and u.

Referenced by zmq::dist_t::distribute().

Here is the caller graph for this function:

bool zmq::msg_t::is_zcmsg ( ) const

Definition at line 442 of file msg.cpp.

References type_zclmsg, and u.

Referenced by add_refs(), close(), copy(), zmq::raw_decoder_t::decode(), rm_refs(), and zmq::v2_decoder_t::size_ready().

Here is the caller graph for this function:

metadata_t* zmq::msg_t::metadata ( ) const

Referenced by reset_flags().

Here is the caller graph for this function:

int zmq::msg_t::move ( msg_t src_)

Definition at line 274 of file msg.cpp.

References check(), close(), init(), and unlikely.

Referenced by zmq::stream_t::xrecv(), zmq::xsub_t::xrecv(), zmq::router_t::xrecv(), and zmq::dish_t::xrecv().

Here is the call graph for this function:

Here is the caller graph for this function:

zmq::atomic_counter_t * zmq::msg_t::refcnt ( )
private

Definition at line 567 of file msg.cpp.

References type_lmsg, type_zclmsg, u, and zmq_assert.

Referenced by add_refs(), and copy().

Here is the caller graph for this function:

void zmq::msg_t::reset_flags ( unsigned char  flags_)

Definition at line 389 of file msg.cpp.

References metadata(), and u.

Referenced by zmq::socket_base_t::send(), 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:

void zmq::msg_t::reset_metadata ( )

Definition at line 407 of file msg.cpp.

References LIBZMQ_DELETE, and u.

Referenced by zmq::socket_base_t::send().

Here is the caller graph for this function:

int zmq::msg_t::reset_routing_id ( )

Definition at line 537 of file msg.cpp.

References group(), and u.

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

Here is the call graph for this function:

Here is the caller graph for this function:

bool zmq::msg_t::rm_refs ( int  refs_)

Definition at line 480 of file msg.cpp.

References close(), is_zcmsg(), shared, type_lmsg, type_zclmsg, u, and zmq_assert.

Referenced by zmq::dist_t::distribute().

Here is the call graph for this function:

Here is the caller graph for this function:

int zmq::msg_t::set_group ( const char *  group_)

Definition at line 548 of file msg.cpp.

Referenced by zmq::radio_session_t::push_msg(), zmq::dish_session_t::push_msg(), zmq::dish_t::send_subscriptions(), zmq::dish_t::xjoin(), and zmq::dish_t::xleave().

Here is the caller graph for this function:

int zmq::msg_t::set_group ( const char *  group_,
size_t  length 
)

Definition at line 553 of file msg.cpp.

References u, and ZMQ_GROUP_MAX_LENGTH.

void zmq::msg_t::set_metadata ( zmq::metadata_t metadata_)

Definition at line 399 of file msg.cpp.

References zmq::metadata_t::add_ref(), and u.

Referenced by zmq::stream_engine_t::decode_and_push(), zmq::stream_engine_t::push_raw_msg_to_session(), zmq::stream_t::xhas_in(), zmq::stream_t::xrecv(), zmq::router_t::xrecv(), and zmq::xpub_t::xrecv().

Here is the call graph for this function:

Here is the caller graph for this function:

int zmq::msg_t::set_routing_id ( uint32_t  routing_id_)

Definition at line 527 of file msg.cpp.

References u.

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

Here is the caller graph for this function:

size_t zmq::msg_t::size ( )

Referenced by copy().

Here is the caller graph for this function:

Member Data Documentation

struct { ... } zmq::msg_t::base

Referenced by copy().

struct { ... } zmq::msg_t::cmsg
content_t* zmq::msg_t::content

Definition at line 196 of file msg.hpp.

void * zmq::msg_t::data

Definition at line 187 of file msg.hpp.

Referenced by zmq::stream_engine_t::decode_and_push(), zmq::v1_decoder_t::flags_ready(), zmq::stream_engine_t::handshake(), zmq::router_t::identify_peer(), zmq::stream_engine_t::identity_msg(), zmq::udp_engine_t::in_event(), zmq::xsub_t::match(), zmq::null_mechanism_t::next_handshake_command(), zmq::udp_engine_t::out_event(), zmq::mechanism_t::peer_identity(), zmq::plain_client_t::process_handshake_command(), zmq::null_mechanism_t::process_handshake_command(), zmq::stream_engine_t::process_heartbeat_message(), zmq::plain_server_t::process_hello(), zmq::plain_server_t::process_initiate(), zmq::plain_server_t::produce_error(), zmq::plain_client_t::produce_hello(), zmq::plain_client_t::produce_initiate(), zmq::stream_engine_t::produce_ping_message(), zmq::stream_engine_t::produce_pong_message(), zmq::plain_server_t::produce_ready(), zmq::plain_server_t::produce_welcome(), zmq::proxy(), zmq::radio_session_t::pull_msg(), zmq::dish_session_t::pull_msg(), zmq::radio_session_t::push_msg(), zmq::dish_session_t::push_msg(), zmq::raw_encoder_t::raw_message_ready(), zmq::pipe_t::read(), zmq::xsub_t::send_subscription(), zmq::null_mechanism_t::send_zap_request(), zmq::plain_server_t::send_zap_request(), zmq::v2_encoder_t::size_ready(), zmq::v1_encoder_t::size_ready(), zmq::v2_decoder_t::size_ready(), zmq::stream_engine_t::write_credential(), zmq::stream_engine_t::write_subscription_msg(), zmq::stream_t::xhas_in(), zmq::router_t::xhas_in(), zmq::xpub_t::xread_activated(), zmq::req_t::xrecv(), zmq::stream_t::xrecv(), zmq::router_t::xrecv(), zmq::xpub_t::xrecv(), zmq::stream_t::xsend(), zmq::xsub_t::xsend(), zmq::xpub_t::xsend(), zmq::router_t::xsend(), zmq::sub_t::xsetsockopt(), and zmq::xpub_t::xsetsockopt().

void* zmq::msg_t::data

Definition at line 222 of file msg.hpp.

struct { ... } zmq::msg_t::delimiter
struct { ... } zmq::msg_t::lmsg

Referenced by copy().

uint32_t zmq::msg_t::routing_id

Definition at line 183 of file msg.hpp.

size_t zmq::msg_t::size

Definition at line 223 of file msg.hpp.

unsigned char zmq::msg_t::type

Definition at line 180 of file msg.hpp.

unsigned char zmq::msg_t::unused[msg_t_size-(sizeof(metadata_t *)+ 2+ 16+ sizeof(uint32_t))]

Definition at line 179 of file msg.hpp.

struct { ... } zmq::msg_t::vsm
struct { ... } zmq::msg_t::zclmsg

Referenced by copy().