|
xorp
|
The StaticRoutes node class. More...
#include <static_routes_node.hh>
Public Types | |
|
typedef multimap< IPvXNet, StaticRoute > | Table |
Public Member Functions | |
| StaticRoutesNode (EventLoop &eventloop) | |
| Constructor for a given event loop. | |
| virtual | ~StaticRoutesNode () |
| Destructor. | |
| EventLoop & | eventloop () |
| Get the event loop this node is added to. | |
| const string & | protocol_name () const |
| Get the protocol name. | |
| int | startup () |
| Startup the node operation. | |
| int | shutdown () |
| Shutdown the node operation. | |
| ProcessStatus | node_status (string &reason_msg) |
| Get the node status (see ProcessStatus). | |
| bool | is_done () const |
| Test if the node processing is done. | |
| bool | is_enabled () const |
| Test whether the node operation is enabled. | |
| void | set_enabled (bool enable) |
| Enable/disable node operation. | |
| int | add_route4 (bool unicast, bool multicast, const IPv4Net &network, const IPv4 &nexthop, const string &ifname, const string &vifname, uint32_t metric, bool is_backup_route, string &error_msg) |
| Add a static IPv4 route. | |
| int | add_route6 (bool unicast, bool multicast, const IPv6Net &network, const IPv6 &nexthop, const string &ifname, const string &vifname, uint32_t metric, bool is_backup_route, string &error_msg) |
| Add a static IPv6 route. | |
| int | replace_route4 (bool unicast, bool multicast, const IPv4Net &network, const IPv4 &nexthop, const string &ifname, const string &vifname, uint32_t metric, bool is_backup_route, string &error_msg) |
| Replace a static IPv4 route. | |
| int | replace_route6 (bool unicast, bool multicast, const IPv6Net &network, const IPv6 &nexthop, const string &ifname, const string &vifname, uint32_t metric, bool is_backup_route, string &error_msg) |
| Replace a static IPv6 route. | |
| int | delete_route4 (bool unicast, bool multicast, const IPv4Net &network, const IPv4 &nexthop, const string &ifname, const string &vifname, bool is_backup_route, string &error_msg) |
| Delete a static IPv4 route. | |
| int | delete_route6 (bool unicast, bool multicast, const IPv6Net &network, const IPv6 &nexthop, const string &ifname, const string &vifname, bool is_backup_route, string &error_msg) |
| Delete a static IPv6 route. | |
| StaticRoutesNode::Table::iterator | find_route (StaticRoutesNode::Table &table, const StaticRoute &key_route) |
| Find a route from the routing table. | |
| StaticRoutesNode::Table::iterator | find_best_accepted_route (StaticRoutesNode::Table &table, const StaticRoute &key_route) |
| Find the best accepted route from the routing table. | |
| bool | is_log_trace () const |
| Test if trace log is enabled. | |
| void | set_log_trace (bool is_enabled) |
| Enable/disable trace log. | |
| void | configure_filter (const uint32_t &filter, const string &conf) |
| Configure a policy filter. | |
| void | reset_filter (const uint32_t &filter) |
| Reset a policy filter. | |
| void | push_routes () |
| Push all the routes through the policy filters for re-filtering. | |
| void | push_pull_rib_routes (bool is_push) |
| Push or pull all the routes to/from the RIB. | |
Protected Member Functions | |
| void | tree_complete () |
| void | updates_made () |
| void | incr_startup_requests_n () |
| void | decr_startup_requests_n () |
| void | incr_shutdown_requests_n () |
| void | decr_shutdown_requests_n () |
| void | update_status () |
Private Member Functions | |
| void | status_change (ServiceBase *service, ServiceStatus old_status, ServiceStatus new_status) |
| A method invoked when the status of a service changes. | |
| virtual const ServiceBase * | ifmgr_mirror_service_base () const =0 |
| Get a reference to the service base of the interface manager. | |
| virtual const IfMgrIfTree & | ifmgr_iftree () const =0 |
| Get a reference to the interface manager tree. | |
| virtual void | fea_register_startup ()=0 |
| Initiate registration with the FEA. | |
| virtual void | fea_register_shutdown ()=0 |
| Initiate de-registration with the FEA. | |
| virtual void | rib_register_startup ()=0 |
| Initiate registration with the RIB. | |
| virtual void | rib_register_shutdown ()=0 |
| Initiate de-registration with the RIB. | |
| int | add_route (const StaticRoute &static_route, string &error_msg) |
| Add a static IPvX route. | |
| int | replace_route (const StaticRoute &static_route, string &error_msg) |
| Replace a static IPvX route. | |
| int | delete_route (const StaticRoute &static_route, string &error_msg) |
| Delete a static IPvX route. | |
| void | prepare_route_for_transmission (StaticRoute &orig_route, StaticRoute ©_route) |
| Prepare a copy of a route for transmission to the RIB. | |
| virtual void | inform_rib_route_change (const StaticRoute &static_route)=0 |
| Inform the RIB about a route change. | |
| virtual void | cancel_rib_route_change (const StaticRoute &static_route)=0 |
| Cancel a pending request to inform the RIB about a route change. | |
| bool | update_route (const IfMgrIfTree &iftree, StaticRoute &route) |
| Update a route received from the user configuration. | |
| bool | do_filtering (StaticRoute &route) |
| Do policy filtering on a route. | |
| bool | is_accepted_by_nexthop (const StaticRoute &route) const |
| Test whether a route is accepted based on its next-hop information. | |
| void | inform_rib (const StaticRoute &r) |
| Inform the RIB about a route. | |
| void | set_node_status (ProcessStatus v) |
| Set the node status. | |
Private Attributes | |
| EventLoop & | _eventloop |
| ProcessStatus | _node_status |
| const string | _protocol_name |
| bool | _is_enabled |
| StaticRoutesNode::Table | _static_routes |
| map< IPvXNet, StaticRoute > | _winning_routes_unicast |
| map< IPvXNet, StaticRoute > | _winning_routes_multicast |
| size_t | _startup_requests_n |
| size_t | _shutdown_requests_n |
| IfMgrIfTree | _iftree |
| bool | _is_log_trace |
| PolicyFilters | _policy_filters |
The StaticRoutes node class.
There should be one node per StaticRoutes instance.
| StaticRoutesNode::StaticRoutesNode | ( | EventLoop & | eventloop | ) |
Constructor for a given event loop.
| eventloop | the event loop to use. |
| int StaticRoutesNode::add_route | ( | const StaticRoute & | static_route, |
| string & | error_msg | ||
| ) | [private] |
Add a static IPvX route.
| static_route | the route to add. |
| error_msg | the error message (if error). |
| int StaticRoutesNode::add_route4 | ( | bool | unicast, |
| bool | multicast, | ||
| const IPv4Net & | network, | ||
| const IPv4 & | nexthop, | ||
| const string & | ifname, | ||
| const string & | vifname, | ||
| uint32_t | metric, | ||
| bool | is_backup_route, | ||
| string & | error_msg | ||
| ) |
Add a static IPv4 route.
| unicast | if true, then the route would be used for unicast routing. |
| multicast | if 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). |
| network | the network address prefix this route applies to. |
| nexthop | the address of the next-hop router for this route. |
| ifname | of the name of the physical interface toward the destination. |
| vifname | of the name of the virtual interface toward the destination. |
| metric | the metric distance for this route. |
| is_backup_route | if true, then this is a backup route operation. |
| error_msg | the error message (if error). |
| int StaticRoutesNode::add_route6 | ( | bool | unicast, |
| bool | multicast, | ||
| const IPv6Net & | network, | ||
| const IPv6 & | nexthop, | ||
| const string & | ifname, | ||
| const string & | vifname, | ||
| uint32_t | metric, | ||
| bool | is_backup_route, | ||
| string & | error_msg | ||
| ) |
Add a static IPv6 route.
| unicast | if true, then the route would be used for unicast routing. |
| multicast | if 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). |
| network | the network address prefix this route applies to. |
| nexthop | the address of the next-hop router for this route. |
| ifname | of the name of the physical interface toward the destination. |
| vifname | of the name of the virtual interface toward the destination. |
| metric | the metric distance for this route. |
| is_backup_route | if true, then this is a backup route operation. |
| error_msg | the error message (if error). |
| virtual void StaticRoutesNode::cancel_rib_route_change | ( | const StaticRoute & | static_route | ) | [private, pure virtual] |
Cancel a pending request to inform the RIB about a route change.
This is a pure virtual function, and it must be implemented by the communication-wrapper class that inherits this base class.
Implemented in XrlStaticRoutesNode.
| void StaticRoutesNode::configure_filter | ( | const uint32_t & | filter, |
| const string & | conf | ||
| ) |
Configure a policy filter.
Will throw an exception on error.
Export filter is not supported by static routes.
| filter | identifier of filter to configure. |
| conf | configuration of the filter. |
| int StaticRoutesNode::delete_route | ( | const StaticRoute & | static_route, |
| string & | error_msg | ||
| ) | [private] |
Delete a static IPvX route.
| static_route | the route to delete. |
| error_msg | the error message (if error). |
| int StaticRoutesNode::delete_route4 | ( | bool | unicast, |
| bool | multicast, | ||
| const IPv4Net & | network, | ||
| const IPv4 & | nexthop, | ||
| const string & | ifname, | ||
| const string & | vifname, | ||
| bool | is_backup_route, | ||
| string & | error_msg | ||
| ) |
Delete a static IPv4 route.
| unicast | if true, then the route would be used for unicast routing. |
| multicast | if 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). |
| network | the network address prefix this route applies to. |
| nexthop | the address of the next-hop router for this route. |
| ifname | of the name of the physical interface toward the destination. |
| vifname | of the name of the virtual interface toward the destination. |
| is_backup_route | if true, then this is a backup route operation. |
| error_msg | the error message (if error). |
| int StaticRoutesNode::delete_route6 | ( | bool | unicast, |
| bool | multicast, | ||
| const IPv6Net & | network, | ||
| const IPv6 & | nexthop, | ||
| const string & | ifname, | ||
| const string & | vifname, | ||
| bool | is_backup_route, | ||
| string & | error_msg | ||
| ) |
Delete a static IPv6 route.
| unicast | if true, then the route would be used for unicast routing. |
| multicast | if 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). |
| network | the network address prefix this route applies to. |
| nexthop | the address of the next-hop router for this route. |
| ifname | of the name of the physical interface toward the destination. |
| vifname | of the name of the virtual interface toward the destination. |
| is_backup_route | if true, then this is a backup route operation. |
| error_msg | the error message (if error). |
| bool StaticRoutesNode::do_filtering | ( | StaticRoute & | route | ) | [private] |
Do policy filtering on a route.
| route | route to filter. |
| EventLoop& StaticRoutesNode::eventloop | ( | ) | [inline] |
| virtual void StaticRoutesNode::fea_register_shutdown | ( | ) | [private, pure virtual] |
Initiate de-registration with the FEA.
This is a pure virtual function, and it must be implemented by the communication-wrapper class that inherits this base class.
Implemented in XrlStaticRoutesNode.
| virtual void StaticRoutesNode::fea_register_startup | ( | ) | [private, pure virtual] |
Initiate registration with the FEA.
This is a pure virtual function, and it must be implemented by the communication-wrapper class that inherits this base class.
Implemented in XrlStaticRoutesNode.
| StaticRoutesNode::Table::iterator StaticRoutesNode::find_best_accepted_route | ( | StaticRoutesNode::Table & | table, |
| const StaticRoute & | key_route | ||
| ) |
| StaticRoutesNode::Table::iterator StaticRoutesNode::find_route | ( | StaticRoutesNode::Table & | table, |
| const StaticRoute & | key_route | ||
| ) |
| virtual const IfMgrIfTree& StaticRoutesNode::ifmgr_iftree | ( | ) | const [private, pure virtual] |
Get a reference to the interface manager tree.
This is a pure virtual function, and it must be implemented by the communication-wrapper class that inherits this base class.
Implemented in XrlStaticRoutesNode.
| virtual const ServiceBase* StaticRoutesNode::ifmgr_mirror_service_base | ( | ) | const [private, pure virtual] |
| void StaticRoutesNode::inform_rib | ( | const StaticRoute & | r | ) | [private] |
| virtual void StaticRoutesNode::inform_rib_route_change | ( | const StaticRoute & | static_route | ) | [private, pure virtual] |
| bool StaticRoutesNode::is_accepted_by_nexthop | ( | const StaticRoute & | route | ) | const [private] |
| bool StaticRoutesNode::is_done | ( | ) | const [inline] |
| bool StaticRoutesNode::is_enabled | ( | ) | const [inline] |
| bool StaticRoutesNode::is_log_trace | ( | ) | const [inline] |
Test if trace log is enabled.
This method is used to test whether to output trace log debug messges.
| ProcessStatus StaticRoutesNode::node_status | ( | string & | reason_msg | ) |
| void StaticRoutesNode::prepare_route_for_transmission | ( | StaticRoute & | orig_route, |
| StaticRoute & | copy_route | ||
| ) | [private] |
| const string& StaticRoutesNode::protocol_name | ( | ) | const [inline] |
| void StaticRoutesNode::push_pull_rib_routes | ( | bool | is_push | ) |
| int StaticRoutesNode::replace_route | ( | const StaticRoute & | static_route, |
| string & | error_msg | ||
| ) | [private] |
Replace a static IPvX route.
| static_route | the replacement route. |
| error_msg | the error message (if error). |
| int StaticRoutesNode::replace_route4 | ( | bool | unicast, |
| bool | multicast, | ||
| const IPv4Net & | network, | ||
| const IPv4 & | nexthop, | ||
| const string & | ifname, | ||
| const string & | vifname, | ||
| uint32_t | metric, | ||
| bool | is_backup_route, | ||
| string & | error_msg | ||
| ) |
Replace a static IPv4 route.
| unicast | if true, then the route would be used for unicast routing. |
| multicast | if 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). |
| network | the network address prefix this route applies to. |
| nexthop | the address of the next-hop router for this route. |
| ifname | of the name of the physical interface toward the destination. |
| vifname | of the name of the virtual interface toward the destination. |
| metric | the metric distance for this route. |
| is_backup_route | if true, then this is a backup route operation. |
| error_msg | the error message (if error). |
| int StaticRoutesNode::replace_route6 | ( | bool | unicast, |
| bool | multicast, | ||
| const IPv6Net & | network, | ||
| const IPv6 & | nexthop, | ||
| const string & | ifname, | ||
| const string & | vifname, | ||
| uint32_t | metric, | ||
| bool | is_backup_route, | ||
| string & | error_msg | ||
| ) |
Replace a static IPv6 route.
| unicast | if true, then the route would be used for unicast routing. |
| multicast | if 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). |
| network | the network address prefix this route applies to. |
| nexthop | the address of the next-hop router for this route. |
| ifname | of the name of the physical interface toward the destination. |
| vifname | of the name of the virtual interface toward the destination. |
| metric | the metric distance for this route. |
| is_backup_route | if true, then this is a backup route operation. |
| error_msg | the error message (if error). |
| void StaticRoutesNode::reset_filter | ( | const uint32_t & | filter | ) |
Reset a policy filter.
| filter | identifier of filter to reset. |
| virtual void StaticRoutesNode::rib_register_shutdown | ( | ) | [private, pure virtual] |
Initiate de-registration with the RIB.
This is a pure virtual function, and it must be implemented by the communication-wrapper class that inherits this base class.
Implemented in XrlStaticRoutesNode.
| virtual void StaticRoutesNode::rib_register_startup | ( | ) | [private, pure virtual] |
Initiate registration with the RIB.
This is a pure virtual function, and it must be implemented by the communication-wrapper class that inherits this base class.
Implemented in XrlStaticRoutesNode.
| void StaticRoutesNode::set_enabled | ( | bool | enable | ) |
| void StaticRoutesNode::set_log_trace | ( | bool | is_enabled | ) | [inline] |
Enable/disable trace log.
This method is used to enable/disable trace log debug messages output.
| is_enabled | if true, trace log is enabled, otherwise is disabled. |
| void StaticRoutesNode::set_node_status | ( | ProcessStatus | v | ) | [inline, private] |
| int StaticRoutesNode::shutdown | ( | ) | [virtual] |
Implements ServiceBase.
Reimplemented in XrlStaticRoutesNode.
| int StaticRoutesNode::startup | ( | ) | [virtual] |
Implements ServiceBase.
Reimplemented in XrlStaticRoutesNode.
| void StaticRoutesNode::status_change | ( | ServiceBase * | service, |
| ServiceStatus | old_status, | ||
| ServiceStatus | new_status | ||
| ) | [private, virtual] |
A method invoked when the status of a service changes.
| service | the service whose status has changed. |
| old_status | the old status. |
| new_status | the new status. |
Implements ServiceChangeObserverBase.
| bool StaticRoutesNode::update_route | ( | const IfMgrIfTree & | iftree, |
| StaticRoute & | route | ||
| ) | [private] |