#include <TcaController.h>
Definition at line 32 of file TcaController.h.
enum TcaController::Role |
TcaController::TcaController | ( | TcaController::Role | role, | |
const std::string & | link_id, | |||
const std::string & | ask_addr, | |||
const std::string & | adv_str, | |||
int | registry_ttl, | |||
int | control_ttl | |||
) |
Definition at line 107 of file TcaController.cc.
TcaController::~TcaController | ( | ) | [virtual] |
bool TcaController::add_route | ( | const std::string & | route_pattern, | |
const std::string & | link | |||
) | [protected] |
Definition at line 724 of file TcaController.cc.
References send_bundle().
Referenced by ask(), gate_reg(), handle_ask_received(), handle_coa_sent(), handle_unb(), route_reg(), and test_all().
bool TcaController::ask | ( | const std::string & | link | ) | [protected] |
Definition at line 679 of file TcaController.cc.
References add_route(), link_id_, pattern(), and send_bundle().
Referenced by handle_link_announce(), and run().
bool TcaController::del_route | ( | const std::string & | route_pattern | ) | [protected] |
Definition at line 744 of file TcaController.cc.
References send_bundle().
Referenced by handle_adv_sent(), handle_ask_sent(), handle_coa_sent(), route_reg(), and test_all().
bool TcaController::do_registration | ( | const TcaEndpointID & | eid, | |
const std::string & | link_addr | |||
) | [protected] |
Definition at line 779 of file TcaController.cc.
References TcaEndpointID::get_hostid(), registry_, registry_ttl_, and TcaRegistry::write().
Referenced by gate_reg(), and handle_coa_sent().
bool TcaController::dtn_reg | ( | dtn_endpoint_id_t & | eid, | |
dtn_reg_id_t & | id | |||
) | [protected] |
Definition at line 128 of file TcaController.cc.
References dtn_copy_eid(), dtn_errno(), DTN_REG_DEFER, DTN_REGID_NONE, dtn_register(), dtn_strerror(), dtn_reg_info_t::endpoint, dtn_reg_info_t::expiration, dtn_reg_info_t::flags, handle_, REG_EXPIRATION_TIME, dtn_reg_info_t::regid, and dtn_endpoint_id_t::uri.
Referenced by init().
void TcaController::eat_bundles | ( | bool | verbose = true |
) | [protected] |
Definition at line 819 of file TcaController.cc.
References dtn_errno(), DTN_ETIMEOUT, DTN_PAYLOAD_MEM, dtn_recv(), dtn_strerror(), handle_, and recv_bundle().
Referenced by init().
bool TcaController::gate_reg | ( | const dtn_bundle_spec_t & | spec, | |
const dtn::TcaControlBundle & | cb | |||
) | [protected] |
Definition at line 563 of file TcaController.cc.
References add_route(), dtn::TcaControlBundle::args_, TcaEndpointID::c_str(), control_ttl_, COS_NORMAL, do_registration(), DOPTS_NONE, get_registration(), RegRecord::link_addr_, link_id_, local_eid_, make_spec(), pattern(), route_reg(), send_bundle(), TcaEndpointID::set_app(), src, TcaEndpointID::str(), and dtn_endpoint_id_t::uri.
Referenced by handle_reg_received().
bool TcaController::get_registration | ( | const TcaEndpointID & | eid, | |
RegRecord & | rr | |||
) | [protected] |
Definition at line 760 of file TcaController.cc.
References TcaEndpointID::get_hostid(), RegRecord::host_, TcaRegistry::read(), registry_, and RegRecord::str().
Referenced by gate_reg(), and handle_unb().
bool TcaController::get_routes | ( | ) | [protected] |
Definition at line 711 of file TcaController.cc.
References send_bundle().
Referenced by test_all().
bool TcaController::handle_adv | ( | const dtn_bundle_spec_t & | spec, | |
const dtn::TcaControlBundle & | cb | |||
) | [protected] |
bool TcaController::handle_adv_sent | ( | const dtn_bundle_spec_t & | spec, | |
const dtn::TcaControlBundle & | cb | |||
) | [protected] |
Definition at line 470 of file TcaController.cc.
References del_route(), dtn::TcaWrappedBundle::dest(), TcaEndpointID::set_app(), and TcaEndpointID::str().
Referenced by handle_bundle_received().
bool TcaController::handle_ask | ( | const dtn_bundle_spec_t & | spec, | |
const dtn::TcaControlBundle & | cb | |||
) | [protected] |
bool TcaController::handle_ask_received | ( | const dtn_bundle_spec_t & | spec, | |
const dtn::TcaControlBundle & | cb | |||
) | [protected] |
Definition at line 414 of file TcaController.cc.
References add_route(), adv_str_, dtn::TcaControlBundle::args_, dtn::TcaWrappedBundle::dest(), send_bundle(), TcaEndpointID::set_app(), dtn::TcaWrappedBundle::source(), and TcaEndpointID::str().
Referenced by handle_bundle_received().
bool TcaController::handle_ask_sent | ( | const dtn_bundle_spec_t & | spec, | |
const dtn::TcaControlBundle & | cb | |||
) | [protected] |
Definition at line 441 of file TcaController.cc.
References del_route(), dtn::TcaWrappedBundle::dest(), TcaEndpointID::set_app(), and TcaEndpointID::str().
Referenced by handle_bundle_received().
bool TcaController::handle_bundle_received | ( | const dtn_bundle_spec_t & | spec, | |
const std::string & | payload | |||
) | [protected] |
Definition at line 228 of file TcaController.cc.
References dtn::TcaControlBundle::CB_ADV, dtn::TcaControlBundle::CB_ADV_SENT, dtn::TcaControlBundle::CB_ASK, dtn::TcaControlBundle::CB_ASK_RECEIVED, dtn::TcaControlBundle::CB_ASK_SENT, dtn::TcaControlBundle::CB_COA, dtn::TcaControlBundle::CB_COA_SENT, dtn::TcaControlBundle::CB_CONTACT_DOWN, dtn::TcaControlBundle::CB_CONTACT_UP, dtn::TcaControlBundle::CB_LINK_ANNOUNCE, dtn::TcaControlBundle::CB_LINK_AVAILABLE, dtn::TcaControlBundle::CB_LINK_UNAVAILABLE, dtn::TcaControlBundle::CB_REG_RECEIVED, dtn::TcaControlBundle::CB_ROUTES, dtn::TcaControlBundle::CB_UNB, dtn::TcaControlBundle::code_, handle_adv(), handle_adv_sent(), handle_ask(), handle_ask_received(), handle_ask_sent(), handle_coa_sent(), handle_link_announce(), handle_reg_received(), handle_routes(), handle_unb(), and dtn::TcaControlBundle::type_.
Referenced by run().
bool TcaController::handle_coa_sent | ( | const dtn_bundle_spec_t & | spec, | |
const dtn::TcaControlBundle & | cb | |||
) | [protected] |
Definition at line 349 of file TcaController.cc.
References add_route(), dtn::TcaControlBundle::args_, del_route(), do_registration(), link_id_, local_eid_, pattern(), role_, TcaEndpointID::set_app(), src, TcaEndpointID::str(), TCA_MOBILE, and dtn_endpoint_id_t::uri.
Referenced by handle_bundle_received().
bool TcaController::handle_link_announce | ( | const dtn_bundle_spec_t & | spec, | |
const dtn::TcaControlBundle & | cb | |||
) | [protected] |
Definition at line 387 of file TcaController.cc.
References dtn::TcaControlBundle::args_, ask(), and check_nargs().
Referenced by handle_bundle_received().
bool TcaController::handle_reg_received | ( | const dtn_bundle_spec_t & | spec, | |
const dtn::TcaControlBundle & | cb | |||
) | [protected] |
Definition at line 289 of file TcaController.cc.
References gate_reg(), role_, route_reg(), TCA_GATEWAY, TCA_MOBILE, and TCA_ROUTER.
Referenced by handle_bundle_received().
bool TcaController::handle_routes | ( | const dtn_bundle_spec_t & | spec, | |
const dtn::TcaControlBundle & | cb | |||
) | [protected] |
Definition at line 491 of file TcaController.cc.
References dtn::TcaControlBundle::args_.
Referenced by handle_bundle_received().
bool TcaController::handle_unb | ( | const dtn_bundle_spec_t & | spec, | |
const dtn::TcaControlBundle & | cb | |||
) | [protected] |
Definition at line 313 of file TcaController.cc.
References add_route(), dtn::TcaControlBundle::args_, TcaEndpointID::c_str(), get_registration(), RegRecord::link_addr_, role_, TcaEndpointID::str(), and TCA_GATEWAY.
Referenced by handle_bundle_received().
Definition at line 157 of file TcaController.cc.
References dtn_build_local_eid(), dtn_open(), dtn_reg(), dtn_strerror(), DTN_SUCCESS, eat_bundles(), handle_, TcaRegistry::init_addrs(), TcaRegistry::init_nodes(), local_eid_, registry_, role_, and TCA_GATEWAY.
Referenced by main().
bool TcaController::recv_bundle | ( | dtn_bundle_spec_t & | spec, | |
std::string & | payload, | |||
unsigned int | timeout = 0 | |||
) |
Definition at line 892 of file TcaController.cc.
References dtn_bundle_payload_t::buf, dtn_bundle_payload_t::buf_len, dtn_bundle_payload_t::buf_val, DTN_PAYLOAD_MEM, dtn_recv(), handle_, dtn_bundle_spec_t::source, and dtn_endpoint_id_t::uri.
Referenced by eat_bundles(), and run().
bool TcaController::route_reg | ( | const dtn_bundle_spec_t & | spec, | |
const dtn::TcaControlBundle & | cb | |||
) | [protected] |
Definition at line 506 of file TcaController.cc.
References add_route(), dtn::TcaControlBundle::args_, check_nargs(), del_route(), link_id_, pattern(), role_, send_bundle(), TcaEndpointID::set_app(), TcaEndpointID::str(), and TCA_GATEWAY.
Referenced by gate_reg(), and handle_reg_received().
void TcaController::run | ( | ) |
Definition at line 205 of file TcaController.cc.
References ask(), ask_addr_, handle_bundle_received(), recv_bundle(), and RECV_TIMEOUT.
Referenced by main().
bool TcaController::send_bundle | ( | const std::string & | dest, | |
const std::string & | payload | |||
) |
Definition at line 930 of file TcaController.cc.
References control_ttl_, COS_NORMAL, dtn_bundle_spec_t::dest, dtn_bundle_spec_t::dopts, DOPTS_NONE, dtn_copy_eid(), dtn_parse_eid_string(), dtn_bundle_spec_t::expiration, local_eid_, dtn_bundle_spec_t::priority, dtn_bundle_spec_t::replyto, send_bundle(), and dtn_bundle_spec_t::source.
bool TcaController::send_bundle | ( | const dtn_bundle_spec_t & | spec, | |
const std::string & | payload | |||
) |
Definition at line 863 of file TcaController.cc.
References bundle_id, dtn_bundle_spec_t::dest, dtn_errno(), DTN_PAYLOAD_MEM, DTN_REGID_NONE, dtn_send(), dtn_set_payload(), dtn_strerror(), handle_, dtn_bundle_spec_t::source, and dtn_endpoint_id_t::uri.
Referenced by add_route(), ask(), del_route(), gate_reg(), get_routes(), handle_ask_received(), route_reg(), and send_bundle().
bool TcaController::test_all | ( | ) | [protected] |
Definition at line 800 of file TcaController.cc.
References add_route(), del_route(), and get_routes().
std::string TcaController::adv_str_ [protected] |
std::string TcaController::ask_addr_ [protected] |
int TcaController::control_ttl_ [protected] |
dtn_handle_t TcaController::handle_ [protected] |
Definition at line 68 of file TcaController.h.
Referenced by dtn_reg(), eat_bundles(), init(), recv_bundle(), send_bundle(), and ~TcaController().
std::string TcaController::link_id_ [protected] |
Definition at line 61 of file TcaController.h.
Referenced by ask(), gate_reg(), handle_coa_sent(), and route_reg().
dtn_endpoint_id_t TcaController::local_eid_ [protected] |
Definition at line 69 of file TcaController.h.
Referenced by gate_reg(), handle_coa_sent(), init(), and send_bundle().
TcaRegistry TcaController::registry_ [protected] |
Definition at line 67 of file TcaController.h.
Referenced by do_registration(), get_registration(), and init().
int TcaController::registry_ttl_ [protected] |
Role TcaController::role_ [protected] |
Definition at line 60 of file TcaController.h.
Referenced by handle_coa_sent(), handle_reg_received(), handle_unb(), init(), and route_reg().