int process_welcome (const uint8_t *msg_data_, size_t msg_size_, uint8_t *cn_precom_) { return process_welcome (msg_data_, msg_size_, server_key, cn_secret, cn_server, cn_cookie, cn_precom_); }
int zmq::curve_client_t::process_handshake_command (msg_t *msg_) { const unsigned char *msg_data = static_cast<unsigned char *> (msg_->data ()); const size_t msg_size = msg_->size (); int rc = 0; if (curve_client_tools_t::is_handshake_command_welcome (msg_data, msg_size)) rc = process_welcome (msg_data, msg_size); else if (curve_client_tools_t::is_handshake_command_ready (msg_data, msg_size)) rc = process_ready (msg_data, msg_size); else if (curve_client_tools_t::is_handshake_command_error (msg_data, msg_size)) rc = process_error (msg_data, msg_size); else { session->get_socket ()->event_handshake_failed_protocol ( session->get_endpoint (), ZMQ_PROTOCOL_ERROR_ZMTP_UNEXPECTED_COMMAND); errno = EPROTO; rc = -1; } if (rc == 0) { rc = msg_->close (); errno_assert (rc == 0); rc = msg_->init (); errno_assert (rc == 0); } return rc; }
int zmq::plain_client_t::process_handshake_command (msg_t *msg_) { const unsigned char *cmd_data = static_cast <unsigned char *> (msg_->data ()); const size_t data_size = msg_->size (); int rc = 0; if (data_size >= 8 && !memcmp (cmd_data, "\7WELCOME", 8)) rc = process_welcome (cmd_data, data_size); else if (data_size >= 6 && !memcmp (cmd_data, "\5READY", 6)) rc = process_ready (cmd_data, data_size); else if (data_size >= 6 && !memcmp (cmd_data, "\5ERROR", 6)) rc = process_error (cmd_data, data_size); else { // Temporary support for security debugging puts ("PLAIN I: invalid handshake command"); errno = EPROTO; rc = -1; } if (rc == 0) { rc = msg_->close (); errno_assert (rc == 0); rc = msg_->init (); errno_assert (rc == 0); } return rc; }
int zmq::curve_client_t::process_handshake_command (msg_t *msg_) { const unsigned char *msg_data = static_cast <unsigned char *> (msg_->data ()); const size_t msg_size = msg_->size (); int rc = 0; if (msg_size >= 8 && !memcmp (msg_data, "\7WELCOME", 8)) rc = process_welcome (msg_data, msg_size); else if (msg_size >= 6 && !memcmp (msg_data, "\5READY", 6)) rc = process_ready (msg_data, msg_size); else if (msg_size >= 6 && !memcmp (msg_data, "\5ERROR", 6)) rc = process_error (msg_data, msg_size); else { errno = EPROTO; rc = -1; } if (rc == 0) { rc = msg_->close (); errno_assert (rc == 0); rc = msg_->init (); errno_assert (rc == 0); } return rc; }
int zmq::curve_client_t::process_handshake_command (msg_t *msg_) { int rc = 0; switch (state) { case expect_welcome: rc = process_welcome (msg_); if (rc == 0) state = send_initiate; break; case expect_ready: rc = process_ready (msg_); if (rc == 0) state = connected; break; default: errno = EPROTO; rc = -1; break; } if (rc == 0) { rc = msg_->close (); errno_assert (rc == 0); rc = msg_->init (); errno_assert (rc == 0); } return rc; }
int zmq::plain_mechanism_t::process_handshake_command (msg_t *msg_) { int rc = 0; switch (state) { case waiting_for_hello: rc = process_hello (msg_); if (rc == 0) state = expecting_zap_reply? waiting_for_zap_reply: sending_welcome; break; case waiting_for_welcome: rc = process_welcome (msg_); if (rc == 0) state = sending_initiate; break; case waiting_for_initiate: rc = process_initiate (msg_); if (rc == 0) state = sending_ready; break; case waiting_for_ready: rc = process_ready (msg_); if (rc == 0) state = ready; break; default: // Temporary support for security debugging puts ("PLAIN I: invalid handshake command"); errno = EPROTO; rc = -1; break; } if (rc == 0) { rc = msg_->close (); errno_assert (rc == 0); rc = msg_->init (); errno_assert (rc == 0); } return rc; }