xorp

StaticRoute Class Reference

A StaticRoute helper class. More...

#include <static_routes_node.hh>

List of all members.

Public Member Functions

 StaticRoute (bool unicast, bool multicast, const IPv4Net &network, const IPv4 &nexthop, const string &ifname, const string &vifname, uint32_t metric, bool is_backup_route)
 Constructor for a given IPv4 static route.
 StaticRoute (bool unicast, bool multicast, const IPv6Net &network, const IPv6 &nexthop, const string &ifname, const string &vifname, uint32_t metric, bool is_backup_route)
 Constructor for a given IPv6 static route.
bool operator== (const StaticRoute &other) const
 Equality Operator.
bool is_same_route (const StaticRoute &other) const
 Test whether both routes contain same routing information.
bool is_ipv4 () const
 Test if this is an IPv4 route.
bool is_ipv6 () const
 Test if this is an IPv6 route.
bool unicast () const
 Test if this route would be used for unicast routing.
bool multicast () const
 Test if this route would be used for multicast routing.
const IPvXNetnetwork () const
 Get the network address prefix this route applies to.
const IPvXnexthop () const
 Get the address of the next-hop router for this route.
void set_nexthop (const IPvX &v)
 Set the address of the next-hop router for this route.
const string & ifname () const
 Get the name of the physical interface toward the destination.
void set_ifname (const string &v)
 Set the name of the physical interface toward the destination.
const string & vifname () const
 Get the name of the virtual interface toward the destination.
void set_vifname (const string &v)
 Set the name of the virtual interface toward the destination.
uint32_t metric () const
 Get the metric distance for this route.
bool is_backup_route () const
 Test if this is a backup route.
bool is_add_route () const
 Test if this is a route to add.
bool is_replace_route () const
 Test if this is a replacement route.
bool is_delete_route () const
 Test if this is a route to delete.
void set_add_route ()
 Set the type of this route to "a route to add".
void set_replace_route ()
 Set the type of this route to "a replacement route".
void set_delete_route ()
 Set the type of this route to "a route to delete".
bool is_interface_route () const
 Test if the route is interface-specific (e.g., if the interface is explicitly specified).
bool is_valid_entry (string &error_msg) const
 Check whether the route entry is valid.
bool is_ignored () const
 Test if the route is to be ignored.
void set_ignored (bool v)
 Set whether the route is to be ignored.
PolicyTagspolicytags ()
bool is_filtered () const
 Test whether the route has been rejected by a policy filter.
void set_filtered (bool v)
 Set a flag that indicates whether the route is to be considered filtered [rejected by the policy filter].
bool is_accepted_by_nexthop () const
 Test whether the route is accepted based on its next-hop information.
void set_accepted_by_nexthop (bool v)
 Set a flag that indicates whether the route is accepted based on its next-hop information.
bool is_accepted_by_rib () const
 Test whether the route is accepted for transmission to the RIB.

Private Types

enum  RouteType { IDLE_ROUTE, ADD_ROUTE, REPLACE_ROUTE, DELETE_ROUTE }

Private Attributes

bool _unicast
bool _multicast
IPvXNet _network
IPvX _nexthop
string _ifname
string _vifname
uint32_t _metric
bool _is_backup_route
RouteType _route_type
bool _is_ignored
bool _is_filtered
bool _is_accepted_by_nexthop
PolicyTags _policytags

Detailed Description

A StaticRoute helper class.

This class is used to store a routing entry.


Constructor & Destructor Documentation

StaticRoute::StaticRoute ( bool  unicast,
bool  multicast,
const IPv4Net network,
const IPv4 nexthop,
const string &  ifname,
const string &  vifname,
uint32_t  metric,
bool  is_backup_route 
) [inline]

Constructor for a given IPv4 static route.

Parameters:
unicastif true, then the route would be used for unicast routing.
multicastif true, then the route would be used in the MRIB (Multicast Routing Information Base) for multicast purpose (e.g., computing the Reverse-Path Forwarding information).
networkthe network address prefix this route applies to.
nexthopthe address of the next-hop router for this route.
ifnameof the name of the physical interface toward the destination.
vifnameof the name of the virtual interface toward the destination.
metricthe metric distance for this route.
is_backup_routeif true, then this is a backup route.
StaticRoute::StaticRoute ( bool  unicast,
bool  multicast,
const IPv6Net network,
const IPv6 nexthop,
const string &  ifname,
const string &  vifname,
uint32_t  metric,
bool  is_backup_route 
) [inline]

Constructor for a given IPv6 static route.

Parameters:
unicastif true, then the route would be used for unicast routing.
multicastif true, then the route would be used in the MRIB (Multicast Routing Information Base) for multicast purpose (e.g., computing the Reverse-Path Forwarding information).
networkthe network address prefix this route applies to.
nexthopthe address of the next-hop router for this route.
ifnameof the name of the physical interface toward the destination.
vifnameof the name of the virtual interface toward the destination.
metricthe metric distance for this route.
is_backup_routeif true, then this is a backup route.

Member Function Documentation

const string& StaticRoute::ifname ( ) const [inline]

Get the name of the physical interface toward the destination.

Returns:
the name of the physical interface toward the destination.
bool StaticRoute::is_accepted_by_nexthop ( ) const [inline]

Test whether the route is accepted based on its next-hop information.

Returns:
true if the route is accepted based on its next-hop information, otherwise false.
bool StaticRoute::is_accepted_by_rib ( ) const

Test whether the route is accepted for transmission to the RIB.

Returns:
true if route is accepted for transmission to the RIB, otherwise false.
bool StaticRoute::is_add_route ( ) const [inline]

Test if this is a route to add.

Returns:
true if this is a route to add, otherwise false.
bool StaticRoute::is_backup_route ( ) const [inline]

Test if this is a backup route.

Returns:
truf if this is a backup route, otherwise false.
bool StaticRoute::is_delete_route ( ) const [inline]

Test if this is a route to delete.

Returns:
true if this is a route to delete, otherwise false.
bool StaticRoute::is_filtered ( ) const [inline]

Test whether the route has been rejected by a policy filter.

Returns:
true if route has been rejected by a policy filter, otherwise false.
bool StaticRoute::is_ignored ( ) const [inline]

Test if the route is to be ignored.

This method is used only for internal purpose when passing the route around.

Returns:
true if the route is to be ignored, otherwise false.
bool StaticRoute::is_interface_route ( ) const [inline]

Test if the route is interface-specific (e.g., if the interface is explicitly specified).

Returns:
true if the route is interface-specific, otherwise false.
bool StaticRoute::is_ipv4 ( ) const [inline]

Test if this is an IPv4 route.

Returns:
true if this is an IPv4 route, otherwise false.
bool StaticRoute::is_ipv6 ( ) const [inline]

Test if this is an IPv6 route.

Returns:
true if this is an IPv6 route, otherwise false.
bool StaticRoute::is_replace_route ( ) const [inline]

Test if this is a replacement route.

Returns:
true if this is a replacement route, otherwise false.
bool StaticRoute::is_same_route ( const StaticRoute other) const [inline]

Test whether both routes contain same routing information.

Parameters:
otherthe route to compare against.
Returns:
true if both routes contain same routing information, otherwise false.
bool StaticRoute::is_valid_entry ( string &  error_msg) const

Check whether the route entry is valid.

Parameters:
error_msgthe error message (if error).
Returns:
true if the route entry is valid, otherwise false.
uint32_t StaticRoute::metric ( ) const [inline]

Get the metric distance for this route.

Returns:
the metric distance for this route.
bool StaticRoute::multicast ( ) const [inline]

Test if this route would be used for multicast routing.

Returns:
true if this route would be used for multicast routing, otherwise false.
const IPvXNet& StaticRoute::network ( ) const [inline]

Get the network address prefix this route applies to.

Returns:
the network address prefix this route appies to.
const IPvX& StaticRoute::nexthop ( ) const [inline]

Get the address of the next-hop router for this route.

Returns:
the address of the next-hop router for this route.
bool StaticRoute::operator== ( const StaticRoute other) const [inline]

Equality Operator.

Parameters:
otherthe right-hand operand to compare against.
Returns:
true if the left-hand operand is numerically same as the right-hand operand.
PolicyTags& StaticRoute::policytags ( ) [inline]
Returns:
policy-tags for this route.
void StaticRoute::set_accepted_by_nexthop ( bool  v) [inline]

Set a flag that indicates whether the route is accepted based on its next-hop information.

Parameters:
vtrue if the route is accepted based on its next-hop information, otherwise false.
void StaticRoute::set_filtered ( bool  v) [inline]

Set a flag that indicates whether the route is to be considered filtered [rejected by the policy filter].

Parameters:
vtrue if the route should be considered filtered, otherwise false.
void StaticRoute::set_ifname ( const string &  v) [inline]

Set the name of the physical interface toward the destination.

Parameters:
vthe name of the physical interface toward the destination.
void StaticRoute::set_ignored ( bool  v) [inline]

Set whether the route is to be ignored.

This method is used only for internal purpose when passing the route around.

Parameters:
vtrue if the route is to be ignored, otherwise false.
void StaticRoute::set_nexthop ( const IPvX v) [inline]

Set the address of the next-hop router for this route.

Parameters:
vthe address of the next-hop router for this route.
void StaticRoute::set_vifname ( const string &  v) [inline]

Set the name of the virtual interface toward the destination.

Parameters:
vthe name of the virtual interface toward the destination.
bool StaticRoute::unicast ( ) const [inline]

Test if this route would be used for unicast routing.

Returns:
true if this route would be used for unicast routing, otherwise false.
const string& StaticRoute::vifname ( ) const [inline]

Get the name of the virtual interface toward the destination.

Returns:
the name of the virtual interface toward the destination.

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