A few common features used by both CROMP clients and servers. More...
#include <cromp_common.h>


Public Types | |
| enum | outcomes { OKAY = basis::common::OKAY, DISALLOWED = basis::common::DISALLOWED, BAD_INPUT = basis::common::BAD_INPUT, NOT_FOUND = basis::common::NOT_FOUND, TIMED_OUT = basis::common::TIMED_OUT, GARBAGE = basis::common::GARBAGE, NO_HANDLER = basis::common::NO_HANDLER, PARTIAL = basis::common::PARTIAL, ENCRYPTION_MISMATCH = basis::common::ENCRYPTION_MISMATCH, NO_SERVER = sockets::communication_commons::NO_SERVER, NO_CONNECTION = sockets::communication_commons::NO_CONNECTION } |
Public Member Functions | |
| cromp_common (const basis::astring &host, int max_per_ent) | |
| cromp_common (sockets::spocket *preexisting, octopi::octopus *singleton) | |
| virtual | ~cromp_common () |
| DEFINE_CLASS_NAME ("cromp_common") | |
| basis::outcome | open_common (const sockets::internet_address &where) |
| basis::outcome | close_common () |
| sockets::spocket * | spock () const |
| sockets::internet_address | other_side () const |
| virtual basis::outcome | add_tentacle (octopi::tentacle *to_add, bool filter=false) |
| basis::astring | responses_text_form () const |
| bool | buffer_clog (int clog_point=1 *basis::MEGABYTE) const |
| basis::outcome | pack_and_ship (const octopi::infoton &request, const octopi::octopus_request_id &item_id, int max_tries) |
| basis::outcome | pack_and_ship (const octopi::infoton_list &requests, int max_tries) |
| basis::outcome | retrieve_and_restore (octopi::infoton *&item, const octopi::octopus_request_id &req_id, int timeout) |
| basis::outcome | retrieve_and_restore_any (octopi::infoton *&item, octopi::octopus_request_id &req_id, int timeout) |
| basis::outcome | push_outgoing (int max_tries) |
| void | grab_anything (bool wait) |
| basis::outcome | send_buffer () |
| int | max_bytes_per_entity () const |
| void | max_bytes_per_entity (int max_bytes_per_entity) |
| octopi::octopus * | octo () const |
| int | pending_sends () const |
| returns the number of bytes still unsent. | |
| int | accumulated_bytes () const |
| returns the number of bytes pending processing from the other side. | |
Static Public Member Functions | |
| static int | default_port () |
| static const char * | outcome_name (const basis::outcome &to_name) |
| static basis::astring | chew_hostname (const sockets::internet_address &addr, sockets::internet_address *resolved=NIL) |
| static double | total_bytes_sent () |
| static double | total_bytes_received () |
| static bool | decode_host (const basis::astring &coded_host, basis::astring &hostname, sockets::machine_uid &machine) |
| static const crypto::rsa_crypto & | localhost_only_key () |
Static Public Attributes | |
| static const int | HOSTCHOP = 6 |
Protected Member Functions | |
| octopi::octopus * | singleton () const |
A few common features used by both CROMP clients and servers.
Definition at line 35 of file cromp_common.h.
| OKAY | |
| DISALLOWED | |
| BAD_INPUT | |
| NOT_FOUND | |
| TIMED_OUT | |
| GARBAGE | |
| NO_HANDLER | |
| PARTIAL | |
| ENCRYPTION_MISMATCH | |
| NO_SERVER | |
| NO_CONNECTION |
Definition at line 79 of file cromp_common.h.
| cromp::cromp_common::cromp_common | ( | const basis::astring & | host, | |
| int | max_per_ent | |||
| ) |
Definition at line 130 of file cromp_common.cpp.
References basis::array< contents >::reset().
| cromp::cromp_common::cromp_common | ( | sockets::spocket * | preexisting, | |
| octopi::octopus * | singleton | |||
| ) |
Definition at line 151 of file cromp_common.cpp.
References chew_hostname(), cromp::DEFAULT_MAX_ENTITY_QUEUE, FUNCDEF, LOG, and basis::array< contents >::reset().
| cromp::cromp_common::~cromp_common | ( | ) | [virtual] |
Definition at line 180 of file cromp_common.cpp.
References close_common(), NIL, and basis::WHACK().
| int cromp::cromp_common::accumulated_bytes | ( | ) | const |
returns the number of bytes pending processing from the other side.
Definition at line 215 of file cromp_common.cpp.
References basis::array< contents >::length().
| outcome cromp::cromp_common::add_tentacle | ( | octopi::tentacle * | to_add, | |
| bool | filter = false | |||
| ) | [virtual] |
Definition at line 206 of file cromp_common.cpp.
References octopi::octopus::add_tentacle().
Referenced by cromp::cromp_client::cromp_client(), cromp::cromp_client::enable_encryption(), and cromp::cromp_server::enable_servers().
| bool cromp::cromp_common::buffer_clog | ( | int | clog_point = 1 * basis::MEGABYTE |
) | const |
Definition at line 347 of file cromp_common.cpp.
References basis::array< contents >::length().
| astring cromp::cromp_common::chew_hostname | ( | const sockets::internet_address & | addr, | |
| sockets::internet_address * | resolved = NIL | |||
| ) | [static] |
Definition at line 221 of file cromp_common.cpp.
References sockets::machine_uid::compact_form(), sockets::internet_address::convert(), FUNCDEF, HOSTCHOP, sockets::internet_address::hostname, basis::astring::length(), LOG, sockets::internet_address::normalize_host(), sockets::internet_address::port, basis::astring::s(), basis::astring::substring(), sockets::machine_uid::text_form(), and sockets::internet_address::text_form().
Referenced by cromp_common().
| outcome cromp::cromp_common::close_common | ( | ) |
Definition at line 310 of file cromp_common.cpp.
References sockets::spocket::disconnect(), and OKAY.
Referenced by cromp::cromp_server::disable_servers(), cromp::cromp_client::reset(), cromp::cromp_client::~cromp_client(), and ~cromp_common().
| bool cromp::cromp_common::decode_host | ( | const basis::astring & | coded_host, | |
| basis::astring & | hostname, | |||
| sockets::machine_uid & | machine | |||
| ) | [static] |
Definition at line 719 of file cromp_common.cpp.
References HOSTCHOP, basis::astring::length(), basis::astring::substring(), and sockets::machine_uid::valid().
| int cromp::cromp_common::default_port | ( | ) | [static] |
Definition at line 204 of file cromp_common.cpp.
| cromp::cromp_common::DEFINE_CLASS_NAME | ( | "cromp_common" | ) |
| void cromp::cromp_common::grab_anything | ( | bool | wait | ) |
Definition at line 610 of file cromp_common.cpp.
Referenced by cromp::cromp_client::keep_alive_pause(), and push_outgoing().
| static const crypto::rsa_crypto& cromp::cromp_common::localhost_only_key | ( | ) | [static] |
Referenced by cromp::cromp_client::enable_encryption().
| void cromp::cromp_common::max_bytes_per_entity | ( | int | max_bytes_per_entity | ) |
Definition at line 272 of file cromp_common.cpp.
References octopi::entity_data_bin::max_bytes_per_entity(), and octopi::octopus::responses().
| int cromp::cromp_common::max_bytes_per_entity | ( | ) | const |
Definition at line 269 of file cromp_common.cpp.
References octopi::entity_data_bin::max_bytes_per_entity().
Referenced by cromp::cromp_client::reset().
| octopi::octopus* cromp::cromp_common::octo | ( | ) | const [inline] |
Definition at line 176 of file cromp_common.h.
Referenced by cromp::cromp_client::decrypt_package_as_needed(), cromp::cromp_server::get_sizes(), cromp::cromp_server::responses_text_form(), and cromp::cromp_server::send_to_client().
| outcome cromp::cromp_common::open_common | ( | const sockets::internet_address & | where | ) |
Definition at line 289 of file cromp_common.cpp.
References FUNCDEF, LOG, OKAY, other_side(), sockets::internet_address::text_form(), and basis::WHACK().
Referenced by cromp::cromp_client::cromp_client(), cromp::cromp_server::enable_servers(), and cromp::cromp_client::reset().
| internet_address cromp::cromp_common::other_side | ( | ) | const |
Definition at line 263 of file cromp_common.cpp.
References sockets::spocket::where().
Referenced by cromp::cromp_client::enable_encryption(), and open_common().
| const char * cromp::cromp_common::outcome_name | ( | const basis::outcome & | to_name | ) | [static] |
Definition at line 316 of file cromp_common.cpp.
References PARTIAL, and basis::outcome::value().
Referenced by cromp::cromp_client::acquire(), cromp::cromp_server::enable_servers(), push_outgoing(), send_buffer(), and cromp::cromp_client::synchronous_request().
| outcome cromp::cromp_common::pack_and_ship | ( | const octopi::infoton_list & | requests, | |
| int | max_tries | |||
| ) |
Definition at line 325 of file cromp_common.cpp.
References BAD_INPUT, structures::amorph< contents >::elements(), cromp::cromp_transaction::flatten(), FUNCDEF, LOG, and push_outgoing().
| outcome cromp::cromp_common::pack_and_ship | ( | const octopi::infoton & | request, | |
| const octopi::octopus_request_id & | item_id, | |||
| int | max_tries | |||
| ) |
Definition at line 353 of file cromp_common.cpp.
References BAD_INPUT, cromp::cromp_transaction::flatten(), FUNCDEF, LOG, octopi::octopus_request_id::mangled_form(), and push_outgoing().
Referenced by cromp::cromp_client::submit().
| int cromp::cromp_common::pending_sends | ( | ) | const |
returns the number of bytes still unsent.
Definition at line 209 of file cromp_common.cpp.
References basis::array< contents >::length().
| outcome cromp::cromp_common::push_outgoing | ( | int | max_tries | ) |
Definition at line 374 of file cromp_common.cpp.
References sockets::spocket::await_writable(), sockets::spocket::connected(), FUNCDEF, grab_anything(), LOG, OKAY, outcome_name(), PARTIAL, cromp::QUICK_CROMP_SNOOZE, send_buffer(), and cromp::SEND_DELAY_TIME.
Referenced by cromp::cromp_client::keep_alive_pause(), and pack_and_ship().
| astring cromp::cromp_common::responses_text_form | ( | ) | const |
Reimplemented in cromp::cromp_server.
Definition at line 260 of file cromp_common.cpp.
References octopi::entity_data_bin::text_form().
| outcome cromp::cromp_common::retrieve_and_restore | ( | octopi::infoton *& | item, | |
| const octopi::octopus_request_id & | req_id, | |||
| int | timeout | |||
| ) |
Definition at line 545 of file cromp_common.cpp.
Referenced by cromp::cromp_client::acquire().
| outcome cromp::cromp_common::retrieve_and_restore_any | ( | octopi::infoton *& | item, | |
| octopi::octopus_request_id & | req_id, | |||
| int | timeout | |||
| ) |
Definition at line 552 of file cromp_common.cpp.
Referenced by cromp::cromp_client::acquire_any().
| outcome cromp::cromp_common::send_buffer | ( | ) |
Definition at line 421 of file cromp_common.cpp.
References DISALLOWED, FUNCDEF, basis::array< contents >::length(), LOG, cromp::MAXIMUM_SEND, basis::minimum(), NO_CONNECTION, basis::array< contents >::observe(), OKAY, sockets::spocket::OS_socket(), outcome_name(), PARTIAL, sockets::spocket::send(), TIMED_OUT, basis::outcome::value(), and basis::array< contents >::zap().
Referenced by push_outgoing().
| octopi::octopus* cromp::cromp_common::singleton | ( | ) | const [inline, protected] |
Definition at line 196 of file cromp_common.h.
| spocket * cromp::cromp_common::spock | ( | ) | const |
Definition at line 202 of file cromp_common.cpp.
Referenced by cromp::cromp_client::connected().
| static double cromp::cromp_common::total_bytes_received | ( | ) | [inline, static] |
Definition at line 163 of file cromp_common.h.
| static double cromp::cromp_common::total_bytes_sent | ( | ) | [inline, static] |
Definition at line 162 of file cromp_common.h.
const int cromp::cromp_common::HOSTCHOP = 6 [static] |
Definition at line 165 of file cromp_common.h.
Referenced by chew_hostname(), and decode_host().
1.6.3