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

#include <plain_server.hpp>

Inheritance diagram for zmq::plain_server_t:
Collaboration diagram for zmq::plain_server_t:

Public Member Functions

 plain_server_t (session_base_t *session_, const std::string &peer_address_, const options_t &options_)
 
virtual ~plain_server_t ()
 
virtual int next_handshake_command (msg_t *msg_)
 
virtual int process_handshake_command (msg_t *msg_)
 
virtual status_t status () const
 
virtual int zap_msg_available ()
 
- Public Member Functions inherited from zmq::mechanism_t
 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 ()
 
void peer_identity (msg_t *msg_)
 
void set_peer_identity (const void *id_ptr, size_t id_size)
 
void set_user_id (const void *user_id, size_t size)
 

Private Types

enum  state_t {
  waiting_for_hello, sending_welcome, waiting_for_initiate, sending_ready,
  waiting_for_zap_reply, sending_error, error_command_sent, ready
}
 

Private Member Functions

int process_hello (msg_t *msg_)
 
int process_initiate (msg_t *msg_)
 
int produce_error (msg_t *msg_) const
 
int produce_ready (msg_t *msg_) const
 
int produce_welcome (msg_t *msg_) const
 
int receive_and_process_zap_reply ()
 
void send_zap_request (const std::string &username, const std::string &password)
 

Private Attributes

const std::string peer_address
 
session_base_t *const session
 
state_t state
 
std::string status_code
 

Additional Inherited Members

- Public Types inherited from zmq::mechanism_t
enum  status_t { handshaking, ready, error }
 
- Protected Member Functions inherited from zmq::mechanism_t
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 inherited from zmq::mechanism_t
options_t options
 
metadata_t::dict_t zap_properties
 
metadata_t::dict_t zmtp_properties
 

Detailed Description

Definition at line 42 of file plain_server.hpp.

Member Enumeration Documentation

Enumerator
waiting_for_hello 
sending_welcome 
waiting_for_initiate 
sending_ready 
waiting_for_zap_reply 
sending_error 
error_command_sent 
ready 

Definition at line 59 of file plain_server.hpp.

Constructor & Destructor Documentation

zmq::plain_server_t::plain_server_t ( session_base_t session_,
const std::string &  peer_address_,
const options_t options_ 
)

Definition at line 44 of file plain_server.cpp.

zmq::plain_server_t::~plain_server_t ( )
virtual

Definition at line 54 of file plain_server.cpp.

Member Function Documentation

int zmq::plain_server_t::next_handshake_command ( msg_t msg_)
virtual

Implements zmq::mechanism_t.

Definition at line 58 of file plain_server.cpp.

References error_command_sent, produce_error(), produce_ready(), produce_welcome(), ready, sending_error, sending_ready, sending_welcome, state, and waiting_for_initiate.

Here is the call graph for this function:

int zmq::plain_server_t::process_handshake_command ( msg_t msg_)
virtual

Implements zmq::mechanism_t.

Definition at line 85 of file plain_server.cpp.

References zmq::msg_t::close(), EPROTO, errno_assert, zmq::msg_t::init(), process_hello(), process_initiate(), state, waiting_for_hello, and waiting_for_initiate.

Here is the call graph for this function:

int zmq::plain_server_t::process_hello ( msg_t msg_)
private

Definition at line 137 of file plain_server.cpp.

References zmq::msg_t::data, EPROTO, receive_and_process_zap_reply(), send_zap_request(), sending_error, sending_welcome, session, zmq::msg_t::size, state, status_code, waiting_for_zap_reply, and zmq::session_base_t::zap_connect().

Referenced by process_handshake_command().

Here is the call graph for this function:

Here is the caller graph for this function:

int zmq::plain_server_t::process_initiate ( msg_t msg_)
private

Definition at line 224 of file plain_server.cpp.

References zmq::msg_t::data, EPROTO, zmq::mechanism_t::parse_metadata(), sending_ready, zmq::msg_t::size, and state.

Referenced by process_handshake_command().

Here is the call graph for this function:

Here is the caller graph for this function:

int zmq::plain_server_t::produce_error ( msg_t msg_) const
private

Definition at line 272 of file plain_server.cpp.

References zmq::msg_t::data, zmq::msg_t::init_size(), status_code, and zmq_assert.

Referenced by next_handshake_command().

Here is the call graph for this function:

Here is the caller graph for this function:

int zmq::plain_server_t::produce_ready ( msg_t msg_) const
private
int zmq::plain_server_t::produce_welcome ( msg_t msg_) const
private

Definition at line 216 of file plain_server.cpp.

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

Referenced by next_handshake_command().

Here is the call graph for this function:

Here is the caller graph for this function:

int zmq::plain_server_t::receive_and_process_zap_reply ( )
private
void zmq::plain_server_t::send_zap_request ( const std::string &  username,
const std::string &  password 
)
private
zmq::mechanism_t::status_t zmq::plain_server_t::status ( ) const
virtual
int zmq::plain_server_t::zap_msg_available ( )
virtual

Reimplemented from zmq::mechanism_t.

Definition at line 123 of file plain_server.cpp.

References EFSM, receive_and_process_zap_reply(), sending_error, sending_welcome, state, status_code, and waiting_for_zap_reply.

Here is the call graph for this function:

Member Data Documentation

const std::string zmq::plain_server_t::peer_address
private

Definition at line 72 of file plain_server.hpp.

Referenced by send_zap_request().

session_base_t* const zmq::plain_server_t::session
private

Definition at line 70 of file plain_server.hpp.

Referenced by process_hello(), receive_and_process_zap_reply(), and send_zap_request().

state_t zmq::plain_server_t::state
private
std::string zmq::plain_server_t::status_code
private