#include <TcaController.h>
Definition at line 53 of file TcaController.h.
enum TcaController::Role |
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 125 of file TcaController.cc.
TcaController::~TcaController | ( | ) | [virtual] |
Definition at line 175 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().
void TcaController::run | ( | ) |
Definition at line 223 of file TcaController.cc.
References ask(), ask_addr_, handle_bundle_received(), recv_bundle(), and RECV_TIMEOUT.
Referenced by main().
bool TcaController::send_bundle | ( | const dtn_bundle_spec_t & | spec, | |
const std::string & | payload | |||
) |
Definition at line 881 of file TcaController.cc.
References bundle_id, dtn_bundle_spec_t::dest, dtn_errno(), DTN_PAYLOAD_MEM, 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::recv_bundle | ( | dtn_bundle_spec_t & | spec, | |
std::string & | payload, | |||
unsigned int | timeout = 0 | |||
) |
Definition at line 910 of file TcaController.cc.
References DTN_PAYLOAD_MEM, dtn_recv(), and handle_.
Referenced by eat_bundles(), and run().
bool TcaController::send_bundle | ( | const std::string & | dest, | |
const std::string & | payload | |||
) |
Definition at line 948 of file TcaController.cc.
References control_ttl_, COS_NORMAL, DOPTS_NONE, dtn_copy_eid(), dtn_parse_eid_string(), local_eid_, and send_bundle().
bool TcaController::dtn_reg | ( | dtn_endpoint_id_t & | eid, | |
dtn_reg_id_t & | id | |||
) | [protected] |
Definition at line 146 of file TcaController.cc.
References dtn_copy_eid(), dtn_errno(), DTN_REG_DEFER, DTN_REGID_NONE, dtn_register(), dtn_strerror(), handle_, REG_EXPIRATION_TIME, and dtn_endpoint_id_t::uri.
Referenced by init().
bool TcaController::handle_bundle_received | ( | const dtn_bundle_spec_t & | spec, | |
const std::string & | payload | |||
) | [protected] |
Definition at line 246 of file TcaController.cc.
References TcaControlBundle::CB_ADV, TcaControlBundle::CB_ADV_SENT, TcaControlBundle::CB_ASK, TcaControlBundle::CB_ASK_RECEIVED, TcaControlBundle::CB_ASK_SENT, TcaControlBundle::CB_COA, TcaControlBundle::CB_COA_SENT, TcaControlBundle::CB_CONTACT_DOWN, TcaControlBundle::CB_CONTACT_UP, TcaControlBundle::CB_LINK_ANNOUNCE, TcaControlBundle::CB_LINK_AVAILABLE, TcaControlBundle::CB_LINK_UNAVAILABLE, TcaControlBundle::CB_REG_RECEIVED, TcaControlBundle::CB_ROUTES, TcaControlBundle::CB_UNB, 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 TcaControlBundle::type_.
Referenced by run().
bool TcaController::handle_reg_received | ( | const dtn_bundle_spec_t & | spec, | |
const TcaControlBundle & | cb | |||
) | [protected] |
Definition at line 307 of file TcaController.cc.
References gate_reg(), role_, route_reg(), TCA_GATEWAY, TCA_MOBILE, and TCA_ROUTER.
Referenced by handle_bundle_received().
bool TcaController::route_reg | ( | const dtn_bundle_spec_t & | spec, | |
const TcaControlBundle & | cb | |||
) | [protected] |
Definition at line 524 of file TcaController.cc.
References add_route(), TcaControlBundle::args_, check_nargs(), del_route(), link_id_, pattern(), role_, send_bundle(), and TCA_GATEWAY.
Referenced by gate_reg(), and handle_reg_received().
bool TcaController::gate_reg | ( | const dtn_bundle_spec_t & | spec, | |
const TcaControlBundle & | cb | |||
) | [protected] |
Definition at line 581 of file TcaController.cc.
References add_route(), TcaControlBundle::args_, 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::handle_unb | ( | const dtn_bundle_spec_t & | spec, | |
const TcaControlBundle & | cb | |||
) | [protected] |
Definition at line 331 of file TcaController.cc.
References add_route(), TcaControlBundle::args_, TcaEndpointID::c_str(), get_registration(), RegRecord::link_addr_, role_, TcaEndpointID::str(), and TCA_GATEWAY.
Referenced by handle_bundle_received().
bool TcaController::handle_coa_sent | ( | const dtn_bundle_spec_t & | spec, | |
const TcaControlBundle & | cb | |||
) | [protected] |
Definition at line 367 of file TcaController.cc.
References add_route(), 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 TcaControlBundle & | cb | |||
) | [protected] |
Definition at line 405 of file TcaController.cc.
References TcaControlBundle::args_, ask(), and check_nargs().
Referenced by handle_bundle_received().
bool TcaController::handle_ask | ( | const dtn_bundle_spec_t & | spec, | |
const TcaControlBundle & | cb | |||
) | [protected] |
bool TcaController::handle_ask_received | ( | const dtn_bundle_spec_t & | spec, | |
const TcaControlBundle & | cb | |||
) | [protected] |
Definition at line 432 of file TcaController.cc.
References add_route(), adv_str_, TcaControlBundle::args_, TcaWrappedBundle::dest(), send_bundle(), TcaEndpointID::set_app(), TcaWrappedBundle::source(), and TcaEndpointID::str().
Referenced by handle_bundle_received().
bool TcaController::handle_ask_sent | ( | const dtn_bundle_spec_t & | spec, | |
const TcaControlBundle & | cb | |||
) | [protected] |
Definition at line 459 of file TcaController.cc.
References del_route(), TcaWrappedBundle::dest(), TcaEndpointID::set_app(), and TcaEndpointID::str().
Referenced by handle_bundle_received().
bool TcaController::handle_adv | ( | const dtn_bundle_spec_t & | spec, | |
const TcaControlBundle & | cb | |||
) | [protected] |
bool TcaController::handle_adv_sent | ( | const dtn_bundle_spec_t & | spec, | |
const TcaControlBundle & | cb | |||
) | [protected] |
Definition at line 488 of file TcaController.cc.
References del_route(), TcaWrappedBundle::dest(), TcaEndpointID::set_app(), and TcaEndpointID::str().
Referenced by handle_bundle_received().
bool TcaController::handle_routes | ( | const dtn_bundle_spec_t & | spec, | |
const TcaControlBundle & | cb | |||
) | [protected] |
Definition at line 509 of file TcaController.cc.
References TcaControlBundle::args_.
Referenced by handle_bundle_received().
bool TcaController::ask | ( | const std::string & | link | ) | [protected] |
Definition at line 697 of file TcaController.cc.
References add_route(), link_id_, pattern(), and send_bundle().
Referenced by handle_link_announce(), and run().
bool TcaController::get_routes | ( | ) | [protected] |
Definition at line 729 of file TcaController.cc.
References send_bundle().
Referenced by test_all().
bool TcaController::add_route | ( | const std::string & | route_pattern, | |
const std::string & | link | |||
) | [protected] |
Definition at line 742 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::del_route | ( | const std::string & | route_pattern | ) | [protected] |
Definition at line 762 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::get_registration | ( | const TcaEndpointID & | eid, | |
RegRecord & | rr | |||
) | [protected] |
Definition at line 778 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::do_registration | ( | const TcaEndpointID & | eid, | |
const std::string & | link_addr | |||
) | [protected] |
Definition at line 797 of file TcaController.cc.
References TcaEndpointID::get_hostid(), registry_, registry_ttl_, and TcaRegistry::write().
Referenced by gate_reg(), and handle_coa_sent().
bool TcaController::test_all | ( | ) | [protected] |
Definition at line 818 of file TcaController.cc.
References add_route(), del_route(), and get_routes().
void TcaController::eat_bundles | ( | bool | verbose = true |
) | [protected] |
Definition at line 837 of file TcaController.cc.
References dtn_errno(), DTN_ETIMEOUT, DTN_PAYLOAD_MEM, dtn_recv(), dtn_strerror(), handle_, and recv_bundle().
Referenced by init().
Role TcaController::role_ [protected] |
Definition at line 81 of file TcaController.h.
Referenced by handle_coa_sent(), handle_reg_received(), handle_unb(), init(), and route_reg().
std::string TcaController::link_id_ [protected] |
Definition at line 82 of file TcaController.h.
Referenced by ask(), gate_reg(), handle_coa_sent(), and route_reg().
std::string TcaController::ask_addr_ [protected] |
std::string TcaController::adv_str_ [protected] |
int TcaController::registry_ttl_ [protected] |
int TcaController::control_ttl_ [protected] |
TcaRegistry TcaController::registry_ [protected] |
Definition at line 88 of file TcaController.h.
Referenced by do_registration(), get_registration(), and init().
dtn_handle_t TcaController::handle_ [protected] |
Definition at line 89 of file TcaController.h.
Referenced by dtn_reg(), eat_bundles(), init(), recv_bundle(), send_bundle(), and ~TcaController().
dtn_endpoint_id_t TcaController::local_eid_ [protected] |
Definition at line 90 of file TcaController.h.
Referenced by gate_reg(), handle_coa_sent(), init(), and send_bundle().