xorp

RouteEntry< A > Class Template Reference

An OLSR internal route entry. More...

#include <route_manager.hh>

Inheritance diagram for RouteEntry< A >:
NONCOPYABLE IPRouteEntry< A > ResolvedIPRouteEntry< A >

List of all members.

Public Types

enum  PathType { intra_area = 1, inter_area = 2, type1 = 3, type2 = 4 }
 

The ordering is important used to select the best route.


typedef A Addr
typedef IPNet< A > Net
typedef RouteEntryOrigin< A > Origin

Public Member Functions

OlsrTypes::VertexType destination_type () const
void set_destination_type (const OlsrTypes::VertexType vt)
 Set the type of the destination in this route entry.
bool direct () const
void set_direct (bool is_direct)
 Set if the destination is directly connected.
IPv4 nexthop () const
void set_nexthop (const IPv4 &nexthop)
 Set protocol address of next hop.
OlsrTypes::FaceID faceid ()
void set_faceid (const OlsrTypes::FaceID faceid)
 Set the ID of the interface used to reach the destination.
uint32_t cost () const
void set_cost (const uint32_t cost)
 Set OLSR protocol cost of route.
IPv4 originator () const
void set_originator (const IPv4 &originator)
 Set the originator of this route.
IPv4 main_address () const
void set_main_address (const IPv4 &main_addr)
 Set the main address of the destination.
bool filtered () const
void set_filtered (const bool was_filtered)
 Set if this route has been filtered by policy filters.
string str ()
void set_destination_type (OspfTypes::VertexType destination_type)
OspfTypes::VertexType get_destination_type () const
void set_discard (bool discard)
bool get_discard () const
void set_directly_connected (bool direct)
bool get_directly_connected () const
void set_address (uint32_t address)
uint32_t get_address () const
void set_router_id (OspfTypes::RouterID id)
OspfTypes::RouterID get_router_id () const
void set_area_border_router (bool area_border_router)
bool get_area_border_router () const
void set_as_boundary_router (bool as_boundary_router)
bool get_as_boundary_router () const
void set_area (OspfTypes::AreaID area)
OspfTypes::AreaID get_area () const
void set_path_type (PathType path_type)
PathType get_path_type () const
void set_cost (uint32_t cost)
uint32_t get_cost () const
void set_type_2_cost (uint32_t type_2_cost)
uint32_t get_type_2_cost () const
void set_nexthop (A nexthop)
get_nexthop () const
void set_nexthop_id (uint32_t nexthop_id)
uint32_t get_nexthop_id ()
void set_advertising_router (uint32_t advertising_router)
uint32_t get_advertising_router () const
void set_lsa (Lsa::LsaRef lsar)
Lsa::LsaRef get_lsa () const
void set_filtered (bool filtered)
bool get_filtered () const
string str ()
 RouteEntry (RibVif *vif, NextHop *nexthop, const Protocol &protocol, uint32_t metric)
 Constructor for a route entry.
virtual ~RouteEntry ()
 Destructor.
RibVifvif () const
 Get the VIF.
NextHopnexthop () const
 Get the NextHop router.
void set_nexthop (NextHop *v)
 Set the NextHop router.
uint16_t admin_distance () const
 Get the Administrative Distance.
void set_admin_distance (uint16_t ad)
 Set the Administrative Distance.
const Protocolprotocol () const
 Get the routing protocol.
virtual string str () const =0
 Display the route for debugging purposes.
void set_metric (uint32_t metric)
 Set the routing protocol metric on this route.
uint32_t metric () const
 Get the routing protocol metric.
 RouteEntry (const Net &n, const Addr &nh, const string &ifname, const string &vifname, uint16_t cost, Origin *&o, uint16_t tag)
 Constructor.
 RouteEntry (const Net &n, const Addr &nh, const string &ifname, const string &vifname, uint16_t cost, Origin *&o, uint16_t tag, const PolicyTags &policytags)
 ~RouteEntry ()
 Destructor.
const IPNet< A > & net () const
 Get network.
bool set_nexthop (const A &nh)
 Set next hop.
const A & nexthop () const
 Get next hop.
const string & ifname () const
 Get the outgoing interface name.
bool set_ifname (const string &ifname)
 Set the outgoing interface name.
const string & vifname () const
 Get the outgoing vif name.
bool set_vifname (const string &vifname)
 Set the outgoing vif name.
bool set_cost (uint16_t cost)
 Set the cost metric.
uint16_t cost () const
 Get the cost metric.
bool set_origin (Origin *origin)
 Set the origin.
const Originorigin () const
 Get the origin.
Originorigin ()
 Get the origin.
bool set_tag (uint16_t tag)
 Set the tag value.
uint16_t tag () const
 Get the tag.
void set_timer (const XorpTimer &t)
 Set a Timer Event associated with this route.
const XorpTimertimer () const
 Get Timer associated with route.
const PolicyTagspolicytags () const
PolicyTagspolicytags ()
bool set_policytags (const PolicyTags &tags)
 Replace policy-tags of route.
bool filtered () const
void set_filtered (bool v)
 Set if route is accepted or rejected.

Protected Member Functions

void dissociate ()
void associate (Origin *o)

Protected Attributes

RibVif_vif
NextHop_nexthop
const Protocol_protocol
uint16_t _admin_distance
uint32_t _metric
Net _net
Addr _nh
string _ifname
string _vifname
uint16_t _cost
Origin_origin
uint16_t _tag
uint16_t _ref_cnt
XorpTimer _timer
PolicyTags _policytags

Private Member Functions

void ref ()
uint16_t unref ()
uint16_t ref_cnt () const

Private Attributes

OlsrTypes::VertexType _destination_type
bool _direct
IPv4 _nexthop
OlsrTypes::FaceID _faceid
uint32_t _cost
IPv4 _originator
IPv4 _main_address
bool _filtered
OspfTypes::VertexType _destination_type
bool _discard
uint32_t _address
OspfTypes::RouterID _id
bool _area_border_router
bool _as_boundary_router
OspfTypes::AreaID _area
PathType _path_type
uint32_t _type_2_cost
_nexthop
uint32_t _nexthop_id
uint32_t _advertising_router
Lsa::LsaRef _lsar

Friends

class RouteEntryRef< A >

Detailed Description

template<typename A>
class RouteEntry< A >

An OLSR internal route entry.

RIP Route Entry Class.

Base class for RIB routing table entries.

External view of a routing entry.

OLSRv1, unlike OSPF, does not implement areas, therefore there is no need in the current design to have logical separation between the routes which it processes internally and those which it exports to the RIB.

It also has no concept of network LSAs [HNA routes are not used in calculating reachability in the OLSR topology] therefore the address property is not present here, nor is the 'discard' flag, nor is the path type.

TODO: Import this definition into UML. TODO: Templatize to hold IPv6.

This is the base class from which RIB routing table entries are derived. It's not useful by itself.

This class is used for storing RIPv2 and RIPng route entries. It is a template class taking an address family type as a template argument. Only IPv4 and IPv6 types may be supplied.


Constructor & Destructor Documentation

template<typename A>
RouteEntry< A >::RouteEntry ( RibVif vif,
NextHop nexthop,
const Protocol protocol,
uint32_t  metric 
)

Constructor for a route entry.

Parameters:
vifthe Virtual Interface on which packets matching this routing table entry should be forwarded.
nexthopthe NextHop router to which packets matching this entry should be forwarded.
protocolthe routing protocol that originated this route.
metricthe routing protocol metric for this route.
template<typename A >
RouteEntry< A >::RouteEntry ( const Net n,
const Addr &  nh,
const string &  ifname,
const string &  vifname,
uint16_t  cost,
Origin *&  o,
uint16_t  tag 
)

Constructor.

The constructor set the internal state according to the parameters and if the Origin is non-null makes the appropriate call to tell the Origin of it's existence.

template<typename A>
RouteEntry< A >::~RouteEntry ( )

Destructor.

Cleans up state associated with RouteEntry. If the Origin associated with the RouteEntry is not-null, the Origin is informed of the destruction.


Member Function Documentation

template<typename A>
uint16_t RouteEntry< A >::admin_distance ( ) const [inline]

Get the Administrative Distance.

Returns:
the Administrative Distance associated with this route. Admin Distance is a parameter typically assigned on a per-routing-protocol basis. When two routes for the same subnet come from different routing protocols, the one with the lower admin distance is prefered.
template<typename A>
uint16_t RouteEntry< A >::cost ( ) const [inline]

Get the cost metric.

Returns:
the cost associated with the route entry.
template<typename A>
uint32_t RouteEntry< A >::cost ( ) const [inline]
Returns:
OLSR protocol cost of route.
template<typename A>
bool RouteEntry< A >::direct ( ) const [inline]
Returns:
true if the destination is directly connected.

Strictly speaking, we should still add it to the RIB; the local node MAY use ARP for L2 resolution, but we may still wish to redistribute routes for these destinations, in order to see OLSR protocol specific information for those destinations.

template<typename A>
OlsrTypes::FaceID RouteEntry< A >::faceid ( ) [inline]
Returns:
the ID of the interface used to reach the destination.
template<typename A>
bool RouteEntry< A >::filtered ( ) const [inline]
Returns:
true if route was rejected by policy filter.
template<typename A>
bool RouteEntry< A >::filtered ( ) const [inline]
Returns:
true if this route has been filtered by policy filters.
template<typename A>
const string& RouteEntry< A >::ifname ( ) const [inline]

Get the outgoing interface name.

Returns:
the outgoing interface name.
template<typename A>
IPv4 RouteEntry< A >::main_address ( ) const [inline]
Returns:
the OLSR main address of the destination. May be unset.
template<typename A>
uint32_t RouteEntry< A >::metric ( ) const [inline]

Get the routing protocol metric.

Returns:
the routing protocol metric for this route.
template<typename A>
IPv4 RouteEntry< A >::nexthop ( ) const [inline]
Returns:
protocol address of next hop.
template<typename A>
NextHop* RouteEntry< A >::nexthop ( ) const [inline]

Get the NextHop router.

Returns:
the NextHop router to which packets matching this entry should be forwarded.
template<typename A>
const A& RouteEntry< A >::nexthop ( ) const [inline]

Get next hop.

Returns:
nexthop address associated with the route entry.
template<typename A>
const Origin* RouteEntry< A >::origin ( ) const [inline]

Get the origin.

Returns:
a pointer to the origin associated with the route entry.
template<typename A>
Origin* RouteEntry< A >::origin ( ) [inline]

Get the origin.

Returns:
a pointer to the origin associated with the route entry.
template<typename A>
IPv4 RouteEntry< A >::originator ( ) const [inline]
Returns:
main address of node which originated this route.
template<typename A>
const PolicyTags& RouteEntry< A >::policytags ( ) const [inline]
Returns:
policy-tags associated with route.

Reimplemented in IPRouteEntry< A >.

template<typename A>
const Protocol& RouteEntry< A >::protocol ( ) const [inline]

Get the routing protocol.

Returns:
the routing protocol that originated this route.
See also:
Protocol.
template<typename A>
void RouteEntry< A >::set_admin_distance ( uint16_t  ad) [inline]

Set the Administrative Distance.

Parameters:
adthe administrative distance to apply to this route.
template<typename A >
bool RouteEntry< A >::set_cost ( uint16_t  cost)

Set the cost metric.

Parameters:
costthe new cost to be associated with the Route Entry.
Returns:
true if stored cost changed, false otherwise.
template<typename A>
void RouteEntry< A >::set_cost ( const uint32_t  cost) [inline]

Set OLSR protocol cost of route.

Parameters:
costOLSR protocol cost of route.
template<typename A>
void RouteEntry< A >::set_destination_type ( const OlsrTypes::VertexType  vt) [inline]

Set the type of the destination in this route entry.

The VertexType is re-used for this.

Parameters:
vtdestination type.
template<typename A>
void RouteEntry< A >::set_direct ( bool  is_direct) [inline]

Set if the destination is directly connected.

Parameters:
is_directtrue if destination is directly connected.
template<typename A>
void RouteEntry< A >::set_faceid ( const OlsrTypes::FaceID  faceid) [inline]

Set the ID of the interface used to reach the destination.

Parameters:
faceidthe ID of the outward interface.
template<typename A>
void RouteEntry< A >::set_filtered ( const bool  was_filtered) [inline]

Set if this route has been filtered by policy filters.

Parameters:
was_filteredtrue if the route has been filtered.
template<typename A>
void RouteEntry< A >::set_filtered ( bool  v) [inline]

Set if route is accepted or rejected.

Parameters:
vtrue if route is filtered
template<typename A >
bool RouteEntry< A >::set_ifname ( const string &  ifname)

Set the outgoing interface name.

Parameters:
ifnamethe outgoing interface name.
Returns:
true if the stored interface name changed, false otherwise.
template<typename A>
void RouteEntry< A >::set_main_address ( const IPv4 main_addr) [inline]

Set the main address of the destination.

Applicable only if if this is a route which is tagged with such information (N1, N2, TC, MID). May be the same as the destination.

Parameters:
main_addrthe OLSR main address of the destination.
template<typename A>
void RouteEntry< A >::set_metric ( uint32_t  metric) [inline]

Set the routing protocol metric on this route.

Parameters:
metricthe routing protocol metric to be set on this route.
template<typename A >
bool RouteEntry< A >::set_nexthop ( const A &  nh)

Set next hop.

Parameters:
nhthe new nexthop to be associated with Route Entry.
Returns:
true if the stored nexthop changed, false otherwise.
template<typename A>
void RouteEntry< A >::set_nexthop ( NextHop v) [inline]

Set the NextHop router.

Parameters:
vthe NextHop router to be set on this route.
template<typename A>
void RouteEntry< A >::set_nexthop ( const IPv4 nexthop) [inline]

Set protocol address of next hop.

Parameters:
nexthopaddress of next hop.
template<typename A >
bool RouteEntry< A >::set_origin ( Origin origin)

Set the origin.

If the origin is different from the stored origin, the RouteEntry dissociates itself from the current origin and informs the new origin of it's existence.

Parameters:
originthe new origin to be associated with the route entry.
Returns:
true if the stored origin changed, false otherwise.
template<typename A>
void RouteEntry< A >::set_originator ( const IPv4 originator) [inline]

Set the originator of this route.

Parameters:
originatormain address of node originating this route.
template<typename A >
bool RouteEntry< A >::set_policytags ( const PolicyTags tags)

Replace policy-tags of route.

Returns:
true if tags were modified.
Parameters:
tagsnew policy-tags.
template<typename A >
bool RouteEntry< A >::set_tag ( uint16_t  tag)

Set the tag value.

Parameters:
tagthe tag value to be associated with the route entry.
Returns:
true if the stored tag changed, false otherwise.
template<typename A >
bool RouteEntry< A >::set_vifname ( const string &  vifname)

Set the outgoing vif name.

Parameters:
vifnamethe outgoing vif name.
Returns:
true if the stored vif name changed, false otherwise.
template<typename A>
string RouteEntry< A >::str ( )
Returns:
a string representation of the route entry.
template<typename A>
uint16_t RouteEntry< A >::tag ( ) const [inline]

Get the tag.

Returns:
tag value associated with the route entry.
template<typename A>
RibVif* RouteEntry< A >::vif ( ) const [inline]

Get the VIF.

Returns:
the Virtual Interface on which packets matching this routing table entry should be forwarded.
template<typename A>
const string& RouteEntry< A >::vifname ( ) const [inline]

Get the outgoing vif name.

Returns:
the outgoing vif name.

The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations