libzmq  master
ZeroMQ C++ Core Engine (LIBZMQ)
zmq::mechanism_t Class Referenceabstract

#include <mechanism.hpp>

Inheritance diagram for zmq::mechanism_t:
Collaboration diagram for zmq::mechanism_t:

Public Types

enum  status_t { handshaking, ready, error }
 

Public Member Functions

 mechanism_t (const options_t &options_)
 
virtual ~mechanism_t ()
 
virtual int decode (msg_t *)
 
virtual int encode (msg_t *)
 
blob_t get_user_id () const
 
const metadata_t::dict_tget_zap_properties ()
 
const metadata_t::dict_tget_zmtp_properties ()
 
virtual int next_handshake_command (msg_t *msg_)=0
 
void peer_identity (msg_t *msg_)
 
virtual int process_handshake_command (msg_t *msg_)=0
 
void set_peer_identity (const void *id_ptr, size_t id_size)
 
void set_user_id (const void *user_id, size_t size)
 
virtual status_t status () const =0
 
virtual int zap_msg_available ()
 

Protected Member Functions

size_t add_property (unsigned char *ptr, const char *name, const void *value, size_t value_len) const
 
int parse_metadata (const unsigned char *ptr_, size_t length, bool zap_flag=false)
 
virtual int property (const std::string &name_, const void *value_, size_t length_)
 
const char * socket_type_string (int socket_type) const
 

Protected Attributes

options_t options
 
metadata_t::dict_t zap_properties
 
metadata_t::dict_t zmtp_properties
 

Private Member Functions

bool check_socket_type (const std::string &type_) const
 

Private Attributes

blob_t identity
 
blob_t user_id
 

Detailed Description

Definition at line 46 of file mechanism.hpp.

Member Enumeration Documentation

Enumerator
handshaking 
ready 
error 

Definition at line 50 of file mechanism.hpp.

Constructor & Destructor Documentation

zmq::mechanism_t::mechanism_t ( const options_t options_)

Definition at line 39 of file mechanism.cpp.

zmq::mechanism_t::~mechanism_t ( )
virtual

Definition at line 44 of file mechanism.cpp.

Member Function Documentation

size_t zmq::mechanism_t::add_property ( unsigned char *  ptr,
const char *  name,
const void *  value,
size_t  value_len 
) const
protected

Definition at line 86 of file mechanism.cpp.

References zmq::put_uint32(), and zmq_assert.

Referenced by get_zap_properties(), zmq::null_mechanism_t::next_handshake_command(), zmq::plain_client_t::produce_initiate(), and zmq::plain_server_t::produce_ready().

Here is the call graph for this function:

Here is the caller graph for this function:

bool zmq::mechanism_t::check_socket_type ( const std::string &  type_) const
private

Definition at line 169 of file mechanism.cpp.

References options, zmq::options_t::type, ZMQ_CLIENT, ZMQ_DEALER, ZMQ_DISH, ZMQ_GATHER, ZMQ_PAIR, ZMQ_PUB, ZMQ_PULL, ZMQ_PUSH, ZMQ_RADIO, ZMQ_REP, ZMQ_REQ, ZMQ_ROUTER, ZMQ_SCATTER, ZMQ_SERVER, ZMQ_SUB, ZMQ_XPUB, and ZMQ_XSUB.

Referenced by parse_metadata().

Here is the caller graph for this function:

virtual int zmq::mechanism_t::decode ( msg_t )
inlinevirtual

Definition at line 68 of file mechanism.hpp.

Referenced by zmq::stream_engine_t::decode_and_push().

Here is the caller graph for this function:

virtual int zmq::mechanism_t::encode ( msg_t )
inlinevirtual

Definition at line 66 of file mechanism.hpp.

Referenced by zmq::stream_engine_t::produce_ping_message(), zmq::stream_engine_t::produce_pong_message(), and zmq::stream_engine_t::pull_and_encode().

Here is the caller graph for this function:

zmq::blob_t zmq::mechanism_t::get_user_id ( ) const

Definition at line 69 of file mechanism.cpp.

References user_id.

Referenced by zmq::stream_engine_t::write_credential(), and zap_msg_available().

Here is the caller graph for this function:

const metadata_t::dict_t& zmq::mechanism_t::get_zap_properties ( )
inline

Definition at line 88 of file mechanism.hpp.

References add_property(), parse_metadata(), property(), socket_type_string(), and zap_properties.

Referenced by zmq::stream_engine_t::mechanism_ready().

Here is the call graph for this function:

Here is the caller graph for this function:

const metadata_t::dict_t& zmq::mechanism_t::get_zmtp_properties ( )
inline

Definition at line 84 of file mechanism.hpp.

References zmtp_properties.

Referenced by zmq::stream_engine_t::mechanism_ready().

Here is the caller graph for this function:

virtual int zmq::mechanism_t::next_handshake_command ( msg_t msg_)
pure virtual

Implemented in zmq::null_mechanism_t, zmq::plain_server_t, and zmq::plain_client_t.

Referenced by zmq::stream_engine_t::next_handshake_command().

Here is the caller graph for this function:

int zmq::mechanism_t::parse_metadata ( const unsigned char *  ptr_,
size_t  length,
bool  zap_flag = false 
)
protected
void zmq::mechanism_t::peer_identity ( msg_t msg_)

Definition at line 53 of file mechanism.cpp.

References zmq::msg_t::data, errno_assert, zmq::msg_t::identity, identity, zmq::msg_t::init_size(), and zmq::msg_t::set_flags().

Referenced by zmq::stream_engine_t::mechanism_ready(), and zap_msg_available().

Here is the call graph for this function:

Here is the caller graph for this function:

virtual int zmq::mechanism_t::process_handshake_command ( msg_t msg_)
pure virtual

Implemented in zmq::null_mechanism_t, zmq::plain_server_t, and zmq::plain_client_t.

Referenced by zmq::stream_engine_t::process_handshake_command().

Here is the caller graph for this function:

int zmq::mechanism_t::property ( const std::string &  name_,
const void *  value_,
size_t  length_ 
)
protectedvirtual

Definition at line 161 of file mechanism.cpp.

Referenced by get_zap_properties(), and parse_metadata().

Here is the caller graph for this function:

void zmq::mechanism_t::set_peer_identity ( const void *  id_ptr,
size_t  id_size 
)

Definition at line 48 of file mechanism.cpp.

References identity.

Referenced by parse_metadata(), and zap_msg_available().

Here is the caller graph for this function:

void zmq::mechanism_t::set_user_id ( const void *  user_id,
size_t  size 
)

Definition at line 61 of file mechanism.cpp.

References user_id, and zap_properties.

Referenced by zmq::null_mechanism_t::receive_and_process_zap_reply(), zmq::plain_server_t::receive_and_process_zap_reply(), and zap_msg_available().

Here is the caller graph for this function:

const char * zmq::mechanism_t::socket_type_string ( int  socket_type) const
protected

Definition at line 74 of file mechanism.cpp.

References zmq_assert.

Referenced by get_zap_properties(), zmq::null_mechanism_t::next_handshake_command(), zmq::plain_client_t::produce_initiate(), and zmq::plain_server_t::produce_ready().

Here is the caller graph for this function:

virtual status_t zmq::mechanism_t::status ( ) const
pure virtual
virtual int zmq::mechanism_t::zap_msg_available ( )
inlinevirtual

Reimplemented in zmq::null_mechanism_t, and zmq::plain_server_t.

Definition at line 71 of file mechanism.hpp.

References get_user_id(), peer_identity(), set_peer_identity(), set_user_id(), size, status(), and user_id.

Referenced by zmq::stream_engine_t::zap_msg_available().

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

blob_t zmq::mechanism_t::identity
private

Definition at line 128 of file mechanism.hpp.

Referenced by peer_identity(), and set_peer_identity().

blob_t zmq::mechanism_t::user_id
private

Definition at line 130 of file mechanism.hpp.

Referenced by get_user_id(), set_user_id(), and zap_msg_available().

metadata_t::dict_t zmq::mechanism_t::zap_properties
protected

Definition at line 122 of file mechanism.hpp.

Referenced by get_zap_properties(), parse_metadata(), and set_user_id().

metadata_t::dict_t zmq::mechanism_t::zmtp_properties
protected

Definition at line 119 of file mechanism.hpp.

Referenced by get_zmtp_properties(), and parse_metadata().