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

#include <socks_connecter.hpp>

Inheritance diagram for zmq::socks_connecter_t:
Collaboration diagram for zmq::socks_connecter_t:

Public Member Functions

 socks_connecter_t (zmq::io_thread_t *io_thread_, zmq::session_base_t *session_, const options_t &options_, address_t *addr_, address_t *proxy_addr_, bool delayed_start_)
 
 ~socks_connecter_t ()
 
- Public Member Functions inherited from zmq::own_t
 own_t (zmq::ctx_t *parent_, uint32_t tid_)
 
 own_t (zmq::io_thread_t *io_thread_, const options_t &options_)
 
void inc_seqnum ()
 
void register_term_acks (int count_)
 
void unregister_term_ack ()
 
- 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::io_object_t
 io_object_t (zmq::io_thread_t *io_thread_=NULL)
 
 ~io_object_t ()
 
void plug (zmq::io_thread_t *io_thread_)
 
void unplug ()
 
- Public Member Functions inherited from zmq::i_poll_events
virtual ~i_poll_events ()
 

Private Types

enum  {
  unplugged, waiting_for_reconnect_time, waiting_for_proxy_connection, sending_greeting,
  waiting_for_choice, sending_request, waiting_for_response
}
 
enum  { reconnect_timer_id = 1 }
 
enum  { socks_no_auth_required = 0 }
 

Private Member Functions

 socks_connecter_t (const socks_connecter_t &)
 
zmq::fd_t check_proxy_connection ()
 
void close ()
 
int connect_to_proxy ()
 
void error ()
 
int get_new_reconnect_ivl ()
 
virtual void in_event ()
 
void initiate_connect ()
 
int open ()
 
const socks_connecter_toperator= (const socks_connecter_t &)
 
virtual void out_event ()
 
int parse_address (const std::string &address_, std::string &hostname_, uint16_t &port_)
 
virtual void process_plug ()
 
int process_server_response (const socks_choice_t &response)
 
int process_server_response (const socks_response_t &response)
 
virtual void process_term (int linger_)
 
void start_timer ()
 
virtual void timer_event (int id_)
 

Private Attributes

address_taddr
 
socks_choice_decoder_t choice_decoder
 
int current_reconnect_ivl
 
const bool delayed_start
 
std::string endpoint
 
socks_greeting_encoder_t greeting_encoder
 
handle_t handle
 
bool handle_valid
 
address_tproxy_addr
 
socks_request_encoder_t request_encoder
 
socks_response_decoder_t response_decoder
 
fd_t s
 
zmq::session_base_tsession
 
zmq::socket_base_tsocket
 
int status
 
bool timer_started
 

Additional Inherited Members

- Protected Types inherited from zmq::io_object_t
typedef poller_t::handle_t handle_t
 
- Protected Member Functions inherited from zmq::own_t
virtual ~own_t ()
 
bool is_terminating ()
 
void launch_child (own_t *object_)
 
virtual void process_destroy ()
 
void term_child (own_t *object_)
 
void terminate ()
 
- 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_activate_read ()
 
virtual void process_activate_write (uint64_t msgs_read_)
 
virtual void process_attach (zmq::i_engine *engine_)
 
virtual void process_bind (zmq::pipe_t *pipe_)
 
virtual void process_hiccup (void *pipe_)
 
virtual void process_pipe_term ()
 
virtual void process_pipe_term_ack ()
 
virtual void process_reap (zmq::socket_base_t *socket_)
 
virtual void process_reaped ()
 
virtual void process_stop ()
 
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_)
 
- Protected Member Functions inherited from zmq::io_object_t
handle_t add_fd (fd_t fd_)
 
void add_timer (int timout_, int id_)
 
void cancel_timer (int id_)
 
void reset_pollin (handle_t handle_)
 
void reset_pollout (handle_t handle_)
 
void rm_fd (handle_t handle_)
 
void set_pollin (handle_t handle_)
 
void set_pollout (handle_t handle_)
 
- Protected Attributes inherited from zmq::own_t
options_t options
 

Detailed Description

Definition at line 47 of file socks_connecter.hpp.

Member Enumeration Documentation

anonymous enum
private
Enumerator
unplugged 
waiting_for_reconnect_time 
waiting_for_proxy_connection 
sending_greeting 
waiting_for_choice 
sending_request 
waiting_for_response 

Definition at line 59 of file socks_connecter.hpp.

anonymous enum
private
Enumerator
reconnect_timer_id 

Definition at line 70 of file socks_connecter.hpp.

anonymous enum
private
Enumerator
socks_no_auth_required 

Definition at line 73 of file socks_connecter.hpp.

Constructor & Destructor Documentation

zmq::socks_connecter_t::socks_connecter_t ( zmq::io_thread_t io_thread_,
zmq::session_base_t session_,
const options_t options_,
address_t addr_,
address_t proxy_addr_,
bool  delayed_start_ 
)

Definition at line 55 of file socks_connecter.cpp.

References addr, endpoint, zmq::session_base_t::get_socket(), zmq::address_t::protocol, proxy_addr, session, socket, zmq::address_t::to_string(), and zmq_assert.

Here is the call graph for this function:

zmq::socks_connecter_t::~socks_connecter_t ( )

Definition at line 77 of file socks_connecter.cpp.

References LIBZMQ_DELETE, proxy_addr, zmq::retired_fd, s, and zmq_assert.

zmq::socks_connecter_t::socks_connecter_t ( const socks_connecter_t )
private

Member Function Documentation

zmq::fd_t zmq::socks_connecter_t::check_proxy_connection ( )
private
void zmq::socks_connecter_t::close ( )
private

Definition at line 440 of file socks_connecter.cpp.

References endpoint, errno_assert, zmq::socket_base_t::event_closed(), zmq::retired_fd, s, socket, and zmq_assert.

Referenced by connect_to_proxy(), error(), initiate_connect(), and process_term().

Here is the call graph for this function:

Here is the caller graph for this function:

void zmq::socks_connecter_t::error ( )
private
int zmq::socks_connecter_t::get_new_reconnect_ivl ( )
private

Definition at line 287 of file socks_connecter.cpp.

References current_reconnect_ivl, zmq::generate_random(), zmq::own_t::options, zmq::options_t::reconnect_ivl, and zmq::options_t::reconnect_ivl_max.

Referenced by start_timer().

Here is the call graph for this function:

Here is the caller graph for this function:

void zmq::socks_connecter_t::initiate_connect ( )
private
int zmq::socks_connecter_t::open ( )
private
const socks_connecter_t& zmq::socks_connecter_t::operator= ( const socks_connecter_t )
private
int zmq::socks_connecter_t::parse_address ( const std::string &  address_,
std::string &  hostname_,
uint16_t &  port_ 
)
private

Definition at line 454 of file socks_connecter.cpp.

Referenced by in_event().

Here is the caller graph for this function:

void zmq::socks_connecter_t::process_plug ( )
privatevirtual

Reimplemented from zmq::object_t.

Definition at line 83 of file socks_connecter.cpp.

References delayed_start, initiate_connect(), and start_timer().

Here is the call graph for this function:

int zmq::socks_connecter_t::process_server_response ( const socks_choice_t response)
private

Definition at line 248 of file socks_connecter.cpp.

References zmq::socks_choice_t::method.

Referenced by in_event().

Here is the caller graph for this function:

int zmq::socks_connecter_t::process_server_response ( const socks_response_t response)
private

Definition at line 255 of file socks_connecter.cpp.

References zmq::socks_response_t::response_code.

void zmq::socks_connecter_t::process_term ( int  linger_)
privatevirtual
void zmq::socks_connecter_t::start_timer ( )
private

Definition at line 279 of file socks_connecter.cpp.

References zmq::io_object_t::add_timer(), endpoint, zmq::socket_base_t::event_connect_retried(), get_new_reconnect_ivl(), reconnect_timer_id, socket, status, and waiting_for_reconnect_time.

Referenced by error(), initiate_connect(), and process_plug().

Here is the call graph for this function:

Here is the caller graph for this function:

void zmq::socks_connecter_t::timer_event ( int  id_)
privatevirtual

Reimplemented from zmq::io_object_t.

Definition at line 261 of file socks_connecter.cpp.

References initiate_connect(), reconnect_timer_id, status, waiting_for_reconnect_time, and zmq_assert.

Here is the call graph for this function:

Member Data Documentation

address_t* zmq::socks_connecter_t::addr
private

Definition at line 123 of file socks_connecter.hpp.

Referenced by in_event(), and socks_connecter_t().

socks_choice_decoder_t zmq::socks_connecter_t::choice_decoder
private

Definition at line 118 of file socks_connecter.hpp.

Referenced by error(), and in_event().

int zmq::socks_connecter_t::current_reconnect_ivl
private

Definition at line 150 of file socks_connecter.hpp.

Referenced by get_new_reconnect_ivl().

const bool zmq::socks_connecter_t::delayed_start
private

Definition at line 141 of file socks_connecter.hpp.

Referenced by process_plug().

std::string zmq::socks_connecter_t::endpoint
private
socks_greeting_encoder_t zmq::socks_connecter_t::greeting_encoder
private

Definition at line 117 of file socks_connecter.hpp.

Referenced by error(), and out_event().

handle_t zmq::socks_connecter_t::handle
private

Definition at line 134 of file socks_connecter.hpp.

Referenced by error(), in_event(), initiate_connect(), out_event(), and process_term().

bool zmq::socks_connecter_t::handle_valid
private

Definition at line 138 of file socks_connecter.hpp.

address_t* zmq::socks_connecter_t::proxy_addr
private

Definition at line 126 of file socks_connecter.hpp.

Referenced by connect_to_proxy(), socks_connecter_t(), and ~socks_connecter_t().

socks_request_encoder_t zmq::socks_connecter_t::request_encoder
private

Definition at line 119 of file socks_connecter.hpp.

Referenced by error(), in_event(), and out_event().

socks_response_decoder_t zmq::socks_connecter_t::response_decoder
private

Definition at line 120 of file socks_connecter.hpp.

Referenced by error(), and in_event().

fd_t zmq::socks_connecter_t::s
private
zmq::session_base_t* zmq::socks_connecter_t::session
private

Definition at line 147 of file socks_connecter.hpp.

Referenced by in_event(), and socks_connecter_t().

zmq::socket_base_t* zmq::socks_connecter_t::socket
private
int zmq::socks_connecter_t::status
private
bool zmq::socks_connecter_t::timer_started
private

Definition at line 144 of file socks_connecter.hpp.