#include <RouteEntry.h>
Each entry contains an endpoint id pattern that is matched against the destination address in the various bundles to determine if the route entry should be used for the bundle.
An entry also has a forwarding action type code which indicates whether the bundle should be forwarded to this next hop and others (ForwardingInfo::COPY_ACTION) or sent only to the given next hop (ForwardingInfo::FORWARD_ACTION). The entry also stores the custody transfer timeout parameters, unique for a given route.
There is also a pointer to either an interface or a link for each entry. In case the entry contains a link, then that link will be used to send the bundle. If there is no link, there must be an interface. In that case, bundles which match the entry will cause the router to create a new link to the given endpoint whenever a bundle arrives that matches the route entry. This new link is then typically added to the route table.
Definition at line 54 of file RouteEntry.h.
Public Types | |
typedef ForwardingInfo::action_t | action_t |
Share the ForwardingInfo::action_t type. | |
Public Member Functions | |
RouteEntry (const EndpointIDPattern &dest_pattern, const LinkRef &link) | |
First constructor requires a destination pattern and a next hop link. | |
RouteEntry (const EndpointIDPattern &dest_pattern, const EndpointIDPattern &route_to) | |
Alternate constructor requires a destination pattern and a route destination endpoint id. | |
~RouteEntry () | |
Destructor. | |
int | parse_options (int argc, const char **argv, const char **invalidp=NULL) |
Hook to parse route configuration options. | |
int | format (char *buf, size_t sz) const |
Virtual from formatter. | |
void | dump (oasys::StringBuffer *buf, oasys::StringVector *long_strings, int dest_eid_width, int source_eid_width, int next_hop_width) const |
Dump a string representation of the route entry. | |
virtual void | serialize (oasys::SerializeAction *a) |
Virtual from SerializableObject. | |
const EndpointIDPattern & | dest_pattern () const |
Accessors. | |
const EndpointIDPattern & | source_pattern () const |
Accessors. | |
const LinkRef & | link () const |
Accessors. | |
const EndpointIDPattern & | route_to () const |
Accessors. | |
u_int | priority () const |
Accessors. | |
RouteEntryInfo * | info () const |
Accessors. | |
const CustodyTimerSpec & | custody_spec () const |
Accessors. | |
action_t | action () const |
Accessors. | |
const std::string & | next_hop_str () const |
Accessors. | |
void | set_action (action_t action) |
Setters. | |
void | set_info (RouteEntryInfo *info) |
Setters. | |
Static Public Member Functions | |
static void | dump_header (oasys::StringBuffer *buf, int dest_eid_width, int source_eid_width, int next_hop_width) |
Dump a header string in preparation for subsequent calls to dump();. | |
Static Private Member Functions | |
static void | append_long_string (oasys::StringBuffer *buf, oasys::StringVector *long_strings, int width, const std::string &str) |
Helper for dump(). | |
Private Attributes | |
EndpointIDPattern | dest_pattern_ |
The pattern that matches bundles' destination eid. | |
EndpointIDPattern | source_pattern_ |
The pattern that matches bundles' source eid. | |
u_int | bundle_cos_ |
Bit vector of the bundle priority classes that should match this route. | |
u_int | priority_ |
Route priority. | |
LinkRef | link_ |
Next hop link if known. | |
EndpointIDPattern | route_to_ |
Route destination for recursive lookups. | |
u_int32_t | action_ |
Forwarding action code. | |
CustodyTimerSpec | custody_spec_ |
Custody timer specification. | |
RouteEntryInfo * | info_ |
Abstract pointer to any algorithm-specific state that needs to be stored in the route entry. | |
Classes | |
class | DestMatches |
Predicate to match the destination pattern for a route. More... | |
class | NextHopMatches |
Predicate to match the destination pattern for a route. More... |
dtn::RouteEntry::RouteEntry | ( | const EndpointIDPattern & | dest_pattern, | |
const LinkRef & | link | |||
) |
First constructor requires a destination pattern and a next hop link.
Definition at line 30 of file RouteEntry.cc.
dtn::RouteEntry::RouteEntry | ( | const EndpointIDPattern & | dest_pattern, | |
const EndpointIDPattern & | route_to | |||
) |
Alternate constructor requires a destination pattern and a route destination endpoint id.
Definition at line 47 of file RouteEntry.cc.
dtn::RouteEntry::~RouteEntry | ( | ) |
int dtn::RouteEntry::parse_options | ( | int | argc, | |
const char ** | argv, | |||
const char ** | invalidp = NULL | |||
) |
Hook to parse route configuration options.
Definition at line 72 of file RouteEntry.cc.
References action(), action_, bundle_cos_, dtn::ForwardingInfo::COPY_ACTION, custody_spec_, dtn::ForwardingInfo::FORWARD_ACTION, dtn::CustodyTimerSpec::parse_options(), priority_, and source_pattern_.
Referenced by dtn::RouteCommand::exec().
int dtn::RouteEntry::format | ( | char * | buf, | |
size_t | sz | |||
) | const |
Virtual from formatter.
Definition at line 116 of file RouteEntry.cc.
References action(), dtn::ForwardingInfo::action_to_str(), dest_pattern(), and next_hop_str().
void dtn::RouteEntry::dump_header | ( | oasys::StringBuffer * | buf, | |
int | dest_eid_width, | |||
int | source_eid_width, | |||
int | next_hop_width | |||
) | [static] |
Dump a header string in preparation for subsequent calls to dump();.
Definition at line 136 of file RouteEntry.cc.
References dtn::DASHES.
Referenced by dtn::RouteTable::dump().
void dtn::RouteEntry::dump | ( | oasys::StringBuffer * | buf, | |
oasys::StringVector * | long_strings, | |||
int | dest_eid_width, | |||
int | source_eid_width, | |||
int | next_hop_width | |||
) | const |
Dump a string representation of the route entry.
Any endpoint ids or link names that don't fit into the column width get put into the long_strings vector.
Definition at line 199 of file RouteEntry.cc.
References action(), dtn::ForwardingInfo::action_to_str(), append_long_string(), bundle_cos_, dtn::Bundle::COS_BULK, dtn::Bundle::COS_EXPEDITED, dtn::Bundle::COS_NORMAL, custody_spec(), dest_pattern(), next_hop_str(), priority(), and source_pattern().
void dtn::RouteEntry::serialize | ( | oasys::SerializeAction * | a | ) | [virtual] |
Virtual from SerializableObject.
Definition at line 225 of file RouteEntry.cc.
References action_, bundle_cos_, custody_spec_, dest_pattern_, link_, priority_, route_to_, and source_pattern_.
const EndpointIDPattern& dtn::RouteEntry::dest_pattern | ( | ) | const [inline] |
Accessors.
Definition at line 117 of file RouteEntry.h.
References dest_pattern_.
Referenced by dtn::RouteTable::del_entry(), dtn::RouteTable::dump(), dump(), format(), dtn::RouteTable::get_matching_helper(), dtn::RouteEntry::DestMatches::operator()(), and dtn::TableBasedRouter::tcl_dump_state().
const EndpointIDPattern& dtn::RouteEntry::source_pattern | ( | ) | const [inline] |
Accessors.
Definition at line 118 of file RouteEntry.h.
References source_pattern_.
Referenced by dtn::RouteTable::dump(), dump(), and dtn::TableBasedRouter::tcl_dump_state().
const LinkRef& dtn::RouteEntry::link | ( | ) | const [inline] |
Accessors.
Definition at line 119 of file RouteEntry.h.
References link_.
Referenced by dtn::RouteTable::del_entry(), dtn::RouteTable::dump(), dtn::TableBasedRouter::fwd_to_nexthop(), dtn::RouteTable::get_matching_helper(), next_hop_str(), dtn::RoutePrioritySort::operator()(), dtn::RouteEntry::NextHopMatches::operator()(), dtn::TableBasedRouter::route_bundle(), and dtn::TableBasedRouter::should_fwd().
const EndpointIDPattern& dtn::RouteEntry::route_to | ( | ) | const [inline] |
Accessors.
Definition at line 120 of file RouteEntry.h.
References route_to_.
Referenced by dtn::RouteTable::dump(), dtn::RouteTable::get_matching_helper(), and next_hop_str().
u_int dtn::RouteEntry::priority | ( | ) | const [inline] |
Accessors.
Definition at line 121 of file RouteEntry.h.
References priority_.
Referenced by dump(), dtn::RoutePrioritySort::operator()(), and dtn::TableBasedRouter::tcl_dump_state().
RouteEntryInfo* dtn::RouteEntry::info | ( | ) | const [inline] |
Accessors.
Definition at line 122 of file RouteEntry.h.
References info_.
Referenced by dtn::DTLSRRouter::is_dynamic_route().
const CustodyTimerSpec& dtn::RouteEntry::custody_spec | ( | ) | const [inline] |
Accessors.
Definition at line 123 of file RouteEntry.h.
References custody_spec_.
Referenced by dump(), and dtn::TableBasedRouter::fwd_to_nexthop().
action_t dtn::RouteEntry::action | ( | ) | const [inline] |
Accessors.
Definition at line 125 of file RouteEntry.h.
References action_.
Referenced by dump(), format(), dtn::TableBasedRouter::fwd_to_nexthop(), parse_options(), and dtn::TableBasedRouter::should_fwd().
const std::string& dtn::RouteEntry::next_hop_str | ( | ) | const [inline] |
Accessors.
Definition at line 127 of file RouteEntry.h.
References link(), route_to(), and dtn::EndpointID::str().
Referenced by dump(), format(), and dtn::TableBasedRouter::tcl_dump_state().
void dtn::RouteEntry::set_action | ( | action_t | action | ) | [inline] |
Setters.
Definition at line 133 of file RouteEntry.h.
References action_.
Referenced by dtn::TableBasedRouter::add_nexthop_route(), and dtn::TableBasedRouter::add_subscriber().
void dtn::RouteEntry::set_info | ( | RouteEntryInfo * | info | ) | [inline] |
void dtn::RouteEntry::append_long_string | ( | oasys::StringBuffer * | buf, | |
oasys::StringVector * | long_strings, | |||
int | width, | |||
const std::string & | str | |||
) | [static, private] |
The pattern that matches bundles' destination eid.
Definition at line 145 of file RouteEntry.h.
Referenced by dest_pattern(), and serialize().
The pattern that matches bundles' source eid.
Definition at line 148 of file RouteEntry.h.
Referenced by parse_options(), serialize(), and source_pattern().
u_int dtn::RouteEntry::bundle_cos_ [private] |
Bit vector of the bundle priority classes that should match this route.
Definition at line 151 of file RouteEntry.h.
Referenced by dump(), parse_options(), and serialize().
u_int dtn::RouteEntry::priority_ [private] |
Route priority.
Definition at line 154 of file RouteEntry.h.
Referenced by parse_options(), priority(), and serialize().
LinkRef dtn::RouteEntry::link_ [private] |
Next hop link if known.
Definition at line 157 of file RouteEntry.h.
Referenced by link(), and serialize().
EndpointIDPattern dtn::RouteEntry::route_to_ [private] |
Route destination for recursive lookups.
Definition at line 160 of file RouteEntry.h.
Referenced by route_to(), and serialize().
u_int32_t dtn::RouteEntry::action_ [private] |
Forwarding action code.
Definition at line 163 of file RouteEntry.h.
Referenced by action(), parse_options(), serialize(), and set_action().
Custody timer specification.
Definition at line 166 of file RouteEntry.h.
Referenced by custody_spec(), parse_options(), and serialize().
RouteEntryInfo* dtn::RouteEntry::info_ [private] |
Abstract pointer to any algorithm-specific state that needs to be stored in the route entry.
Definition at line 170 of file RouteEntry.h.
Referenced by info(), set_info(), and ~RouteEntry().