TcaController Class Reference

#include <TcaController.h>

List of all members.


Detailed Description

Definition at line 32 of file TcaController.h.

Public Types

enum  Role { TCA_MOBILE, TCA_ROUTER, TCA_GATEWAY }

Public Member Functions

 TcaController (Role role, const std::string &link_id, const std::string &ask_addr, const std::string &adv_str, int registry_ttl, int control_ttl)
virtual ~TcaController ()
bool init (bool tidy)
void run ()
bool send_bundle (const dtn_bundle_spec_t &spec, const std::string &payload)
bool recv_bundle (dtn_bundle_spec_t &spec, std::string &payload, unsigned int timeout=0)
bool send_bundle (const std::string &dest, const std::string &payload)

Protected Member Functions

bool dtn_reg (dtn_endpoint_id_t &eid, dtn_reg_id_t &id)
bool handle_bundle_received (const dtn_bundle_spec_t &spec, const std::string &payload)
bool handle_reg_received (const dtn_bundle_spec_t &spec, const dtn::TcaControlBundle &cb)
bool route_reg (const dtn_bundle_spec_t &spec, const dtn::TcaControlBundle &cb)
bool gate_reg (const dtn_bundle_spec_t &spec, const dtn::TcaControlBundle &cb)
bool handle_unb (const dtn_bundle_spec_t &spec, const dtn::TcaControlBundle &cb)
bool handle_coa_sent (const dtn_bundle_spec_t &spec, const dtn::TcaControlBundle &cb)
bool handle_link_announce (const dtn_bundle_spec_t &spec, const dtn::TcaControlBundle &cb)
bool handle_ask (const dtn_bundle_spec_t &spec, const dtn::TcaControlBundle &cb)
bool handle_ask_received (const dtn_bundle_spec_t &spec, const dtn::TcaControlBundle &cb)
bool handle_ask_sent (const dtn_bundle_spec_t &spec, const dtn::TcaControlBundle &cb)
bool handle_adv (const dtn_bundle_spec_t &spec, const dtn::TcaControlBundle &cb)
bool handle_adv_sent (const dtn_bundle_spec_t &spec, const dtn::TcaControlBundle &cb)
bool handle_routes (const dtn_bundle_spec_t &spec, const dtn::TcaControlBundle &cb)
bool ask (const std::string &link)
bool get_routes ()
bool add_route (const std::string &route_pattern, const std::string &link)
bool del_route (const std::string &route_pattern)
bool get_registration (const TcaEndpointID &eid, RegRecord &rr)
bool do_registration (const TcaEndpointID &eid, const std::string &link_addr)
bool test_all ()
void eat_bundles (bool verbose=true)

Protected Attributes

Role role_
std::string link_id_
std::string ask_addr_
std::string adv_str_
int registry_ttl_
int control_ttl_
TcaRegistry registry_
dtn_handle_t handle_
dtn_endpoint_id_t local_eid_


Member Enumeration Documentation

enum TcaController::Role

Enumerator:
TCA_MOBILE 
TCA_ROUTER 
TCA_GATEWAY 

Definition at line 36 of file TcaController.h.


Constructor & Destructor Documentation

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 104 of file TcaController.cc.

TcaController::~TcaController (  )  [virtual]

Definition at line 118 of file TcaController.cc.

References dtn_close(), and handle_.


Member Function Documentation

bool TcaController::init ( bool  tidy  ) 

Definition at line 154 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 202 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 860 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 889 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 927 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 125 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 225 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_reg_received ( const dtn_bundle_spec_t spec,
const dtn::TcaControlBundle cb 
) [protected]

Definition at line 286 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 dtn::TcaControlBundle cb 
) [protected]

Definition at line 503 of file TcaController.cc.

References add_route(), dtn::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 dtn::TcaControlBundle cb 
) [protected]

Definition at line 560 of file TcaController.cc.

References add_route(), dtn::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 dtn::TcaControlBundle cb 
) [protected]

Definition at line 310 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().

bool TcaController::handle_coa_sent ( const dtn_bundle_spec_t spec,
const dtn::TcaControlBundle cb 
) [protected]

Definition at line 346 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 384 of file TcaController.cc.

References dtn::TcaControlBundle::args_, ask(), and check_nargs().

Referenced by handle_bundle_received().

bool TcaController::handle_ask ( const dtn_bundle_spec_t spec,
const dtn::TcaControlBundle cb 
) [protected]

Definition at line 399 of file TcaController.cc.

Referenced by handle_bundle_received().

bool TcaController::handle_ask_received ( const dtn_bundle_spec_t spec,
const dtn::TcaControlBundle cb 
) [protected]

Definition at line 411 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 438 of file TcaController.cc.

References del_route(), dtn::TcaWrappedBundle::dest(), TcaEndpointID::set_app(), and TcaEndpointID::str().

Referenced by handle_bundle_received().

bool TcaController::handle_adv ( const dtn_bundle_spec_t spec,
const dtn::TcaControlBundle cb 
) [protected]

Definition at line 454 of file TcaController.cc.

Referenced by handle_bundle_received().

bool TcaController::handle_adv_sent ( const dtn_bundle_spec_t spec,
const dtn::TcaControlBundle cb 
) [protected]

Definition at line 467 of file TcaController.cc.

References del_route(), dtn::TcaWrappedBundle::dest(), TcaEndpointID::set_app(), and TcaEndpointID::str().

Referenced by handle_bundle_received().

bool TcaController::handle_routes ( const dtn_bundle_spec_t spec,
const dtn::TcaControlBundle cb 
) [protected]

Definition at line 488 of file TcaController.cc.

References dtn::TcaControlBundle::args_.

Referenced by handle_bundle_received().

bool TcaController::ask ( const std::string &  link  )  [protected]

Definition at line 676 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 708 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 721 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 741 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 757 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 776 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 797 of file TcaController.cc.

References add_route(), del_route(), and get_routes().

void TcaController::eat_bundles ( bool  verbose = true  )  [protected]

Definition at line 816 of file TcaController.cc.

References dtn_errno(), DTN_ETIMEOUT, DTN_PAYLOAD_MEM, dtn_recv(), dtn_strerror(), handle_, and recv_bundle().

Referenced by init().


Member Data Documentation

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().

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().

std::string TcaController::ask_addr_ [protected]

Definition at line 62 of file TcaController.h.

Referenced by run().

std::string TcaController::adv_str_ [protected]

Definition at line 63 of file TcaController.h.

Referenced by handle_ask_received().

int TcaController::registry_ttl_ [protected]

Definition at line 64 of file TcaController.h.

Referenced by do_registration().

int TcaController::control_ttl_ [protected]

Definition at line 65 of file TcaController.h.

Referenced by gate_reg(), and send_bundle().

TcaRegistry TcaController::registry_ [protected]

Definition at line 67 of file TcaController.h.

Referenced by do_registration(), get_registration(), and init().

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().

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().


The documentation for this class was generated from the following files:
Generated on Thu Jun 7 16:56:55 2007 for DTN Reference Implementation by  doxygen 1.5.1