class RIB

Master class for a RIB. More...

 
LOGO
 Annotated List  Files  Globals  Hierarchy  Index  Top

Public Methods

Protected Members


Detailed Description

RIB is the master class for a Routing Information Base. It holds the RibVif table, routing tables for each protocol, etc. Typically we would have one RIB for IPv4 unicast, one for IPv4 multicast topology, one for IPv6 unicast and one for IPv6 multicast.

Note that the XRL commands assume some level of filtering has already taken place to route to command to the right RIB.

 RIB (RibTransportType rib_type, RibManager& rib_manager, EventLoop& eventloop)

RIB

RIB Constructor.

Parameters:

rib_typeindicates whether this RIB holds UNICAST or MULTICAST routing information. In the case of multicast, this is the topology information, not the forwarding information.
rib_managerthe main RIB manager process holding stuff that's common to all the individual RIBs.
eventloopthe main event loop.
 ~RIB ()

~RIB

[virtual]

RIB Destructor.

void  set_errors_are_fatal ()

set_errors_are_fatal

Set test-mode: abort on some errors that we'd normally mask.

list<string>  registered_protocol_names ()

registered_protocol_names

[const]

Get the list with the registered protocol names.

Returns: the list with the registered protocol names.

void  initialize (RegisterServer& register_server)

initialize

Initialize the RIB. Note that it is an error to initialize the table twice.

Parameters:

register_serverthe RegisterServer to initialize the Rib with.
int  initialize_redist_all (const string& all)

initialize_redist_all

Initialize the RIB's RedistTable at the end so that the winning routes are exported to the RIB clients (e.g., the FEA). Note that it is an error to initialize the table twice.

Parameters:

alla keyword string which can be used by RIB clients to register with the RIB to receive the winning routes from the RedistTable.

Returns: XORP_OK on success, otherwise XORP_ERROR.

See also: RedistTable

int  initialize_policy_redist ()

initialize_policy_redist

Initialize the RIB's PolicyRedistTable. The PolicyRedistTable enables route redistribution according to policy configuration. Based on the policy tags of routes passing through this table, a redistribution request is sent to the relevant protocols. If routes are being deleted, protocols are informed to stop advertising the route.

int  initialize_register (RegisterServer& register_server)

initialize_register

Initialize the RIB's RegisterTable. The RegisterTable allows routing protocols such as BGP to register interest in routing information that affects specfic addresses. Note that it is an error to initialize the table twice.

Parameters:

register_serverthe RegisterServer to initialize the Rib with.

Returns: XORP_OK on success, otherwise XORP_ERROR.

int  new_origin_table (const string& tablename, const string& target_class, const string& target_instance, uint32_t admin_distance, ProtocolType protocol_type)

new_origin_table

Add a new OriginTable. Use is deprecated, except in test suites.

Parameters:

tablenamehuman-readable name for this table to help in debugging.
target_classthe XRL target class of the routing protocol that will supply routes to this OriginTable.
target_instancethe XRL target instance of the routing protocol that will supply routes to this OriginTable.
admin_distancedefault administrative distance to be applied to routes that enter the RIB through this OriginTable.
protocol_typethe routing protocol type (ProtocolType).

Returns: XORP_OK on success, otherwise XORP_ERROR.

See also: OriginTable

int  new_vif (const string& vifname, const Vif& vif)

new_vif

[virtual]

Inform the RIB about the existence of a Virtual Interface. Note that it is an error to add twice a vif with the same vifname.

Parameters:

vifnamethe name of the VIF, as understood by the FEA.
vifVif class instance giving the information about this vif.

Returns: XORP_OK on success, otherwise XORP_ERROR.

See also: Vif

int  delete_vif (const string& vifname)

delete_vif

[virtual]

Inform the RIB that a VIF no longer exists.

Parameters:

vifnamethe name of the VIF, as previously indicated by new_vif.

Returns: XORP_OK on success, otherwise XORP_ERROR.

void  destroy_deleted_vif (RibVif* rib_vif)

destroy_deleted_vif

[virtual]

Destroy a VIF container for a VIF that no longer exists.

Parameters:

rib_vifthe VIF container that will be destroyed.
int  set_vif_flags (const string& vifname, bool is_p2p, bool is_loopback, bool is_multicast, bool is_broadcast, bool is_up, uint32_t mtu)

set_vif_flags

[virtual]

Set the vif flags of a configured vif.

Parameters:

vifnamethe name of the vif.
is_pim_registertrue if the vif is a PIM Register interface.
is_p2ptrue if the vif is point-to-point interface.
is_loopbacktrue if the vif is a loopback interface.
is_multicasttrue if the vif is multicast capable.
is_broadcasttrue if the vif is broadcast capable.
is_uptrue if the underlying vif is UP.
mtuthe MTU of the vif.

Returns: XORP_OK on success, otherwise XORP_ERROR.

int  add_vif_address (const string& vifname, const A& addr, const IPNet<A>& subnet, const A& broadcast_addr, const A& peer_addr)

add_vif_address

[virtual]

Add an address and subnet to a existing VIF. Each VIF may have multiple addresses and associated subnets.

Parameters:

vifnamethe name of the VIF the address will be added to.
addrthe address to be added. This must be one of the addresses of this router.
subnetthe subnet that is connected to this VIF corresponding to the address addr.
broadcastthe broadcast address to add. In case of IPv6 this address is ignored.
peerthe peer address to add.

Returns: XORP_OK on success, otherwise XORP_ERROR.

int  delete_vif_address (const string& vifname, const A& addr)

delete_vif_address

[virtual]

Remove an address and the associated subnet from an existing VIF.

Parameters:

vifnamethe name of the VIF the address will be removed from.
addrthe address to be removed. This must be an address previously added by add_vif_address.

Returns: XORP_OK on success, otherwise XORP_ERROR.

int  add_connected_route (const RibVif& vif, const IPNet<A>& net, const A& nexthop_addr, const A& peer_addr)

add_connected_route

Add a route to the "connected" OriginTable.

Parameters:

vifthe vif with the connected route.
netthe subnet (address and prefix length) of the route.
nexthop_addrthe nexthop address of the route to add.
peer_addrthe peer address for the route to add (if a point-to-point interface).

Returns: XORP_OK on success, otherwise XORP_ERROR.

int  delete_connected_route (const RibVif& vif, const IPNet<A>& net, const A& peer_addr)

delete_connected_route

Delete a route from the "connected" OriginTable.

Parameters:

vifthe vif with the connected route.
netthe subnet (address and prefix length) of the route.
peer_addrthe peer address for the route to delete (if a point-to-point interface).

Returns: XORP_OK on success, otherwise XORP_ERROR.

int  add_route (const string& tablename, const IPNet<A>& net, const A& nexthop_addr, const string& ifname, const string& vifname, uint32_t metric, const PolicyTags& policytags)

add_route

[virtual]

Add a route via the OriginTable called tablename.

Parameters:

tablenamethe name of the OriginTable into which the route should be inserted.
netthe subnet (address and prefix length) of the route.
nexthop_addrthe nexthop that packets destined for net should be forwarded to.
ifnamethe name of the physical interface toward the destination. If an empty string the interface will be chosen by RIB.
vifnamethe name of the virtual interface toward the destination. If an empty string the interface will be chosen by RIB.
metricthe routing protocol metric associated with this route.
policytagsthe policy-tags for this route.

Returns: XORP_OK on success, otherwise XORP_ERROR.

int  replace_route (const string& tablename, const IPNet<A>& net, const A& nexthop_addr, const string& ifname, const string& vifname, uint32_t metric, const PolicyTags& policytags)

replace_route

[virtual]

Replace an existing route via the OriginTable called tablename.

Parameters:

tablenamethe name of the OriginTable in which the route should be replaced.
netthe subnet (address and prefix length) of the route.
nexthop_addrthe new nexthop that packets destined for net should be forwarded to.
ifnamethe name of the physical interface toward the destination. If an empty string the interface will be chosen by RIB.
vifnamethe name of the virtual interface toward the destination. If an empty string the interface will be chosen by RIB.
metricthe new routing protocol metric associated with this
policytagsthe policy-tags for this route. route.

Returns: XORP_OK on success, otherwise XORP_ERROR.

int  verify_route (const A& lookupaddr, const string& ifname, const A& nexthop_addr, uint32_t metric, RibVerifyType matchtype)

verify_route

[virtual]

Verify the result of a route lookup in the RIB matches the parameters we expect. Intended for testing purposes only.

Parameters:

lookupaddrthe destination to be verified.
nexthop_addrthe expected next hop address.
ifnamethe expected interface.
metricthe expected routing protocol metric.
typethe expected type of match.

Returns: XORP_OK on success, otherwise XORP_ERROR.

int  delete_route (const string& tablename, const IPNet<A>& subnet)

delete_route

[virtual]

Delete an existing route via the OriginTable called tablename.

Parameters:

tablenamethe name of the OriginTable in which the route should be deleted.
subnetthe subnet (address and prefix length) of the route to be deleted.

Returns: XORP_OK on success, otherwise XORP_ERROR.

const A&  lookup_route (const A& lookupaddr)

lookup_route

[virtual]

Lookup an address in the RIB to determine the nexthop router to which packets for this address will be forwarded.

Parameters:

lookupaddrthe address to be looked up.

Returns: pointer to address of next hop for lookupaddr if available, otherwise A::ZERO().

RouteRange<A>*  route_range_lookup (const A& lookupaddr)

route_range_lookup

[virtual]

Used for debugging only

RouteRegister<A>*  route_register (const A& lookupaddr, const string& module)

route_register

[virtual]

Register interest in being notified about all changes to routing information that would affect traffic destined for a particular address.

Parameters:

lookupaddrthe address to register interest in.
modulethe XRL module name to which notifications of changes should be sent.
int  route_deregister (const IPNet<A>& subnet, const string& module)

route_deregister

[virtual]

De-register interest in being notified about all changes to routing information for a particular address.

Parameters:

lookupaddrthe address to de-register interest in.
modulethe XRL module name to which notifications of changes should no longer be sent.

Returns: XORP_OK on success, otherwise XORP_ERROR.

See also: route_register

Protocol*  find_protocol (const string& protocol)

find_protocol

Find a routing protocol, given its protocol name.

Parameters:

protocolthe name of the protocol to search for.

Returns: pointer to protocol if exists, NULL otherwise.

RedistTable<A>*  protocol_redist_table (const string& protocol)

protocol_redist_table

Get route redistribution table for specified routing protocol.

int  add_igp_table (const string& tablename, const string& target_class, const string& target_instance)

add_igp_table

[virtual]

Create the OriginTable for an IGP protocol and plumb it into the RIB. Typically this will be called when a new instance of an IGP routing protocol such as OSPF starts up.

Parameters:

tablenamethe routing protocol name. This should be one of the list of names the RIB knows about, or the incorrect default administrative distance will be applied.
target_classthe XRL target class of the routing protocol that will supply routes to this OriginTable.
target_instancethe XRL target instance of the routing protocol that will supply routes to this OriginTable.

Returns: XORP_OK on success, otherwise XORP_ERROR.

int  delete_igp_table (const string& tablename, const string& target_class, const string& target_instance)

delete_igp_table

[virtual]

Delete the OriginTable for an IGP protocol and unplumb it from the RIB. Typically this will be called when an instance of an IGP routing protocol such as OSPF exits.

Parameters:

tablenamethe routing protocol name, previously registered using add_igp_table.
target_classthe XRL target class of the routing protocol that supplied routes to this OriginTable.
target_instancethe XRL target instance of the routing protocol that supplied routes to this OriginTable.

Returns: XORP_OK on success, otherwise XORP_ERROR.

int  add_egp_table (const string& tablename, const string& target_class, const string& target_instance)

add_egp_table

[virtual]

Create the OriginTable for an EGP protocol and plumb it into the RIB. Typically this will be called when a new instance of an EGP routing protocol such as EBGP or IBGP starts up. Note that EBGP and IBGP should register separately.

Parameters:

tablenamethe routing protocol name. This should be one of the list of names the RIB knows about, or the incorrect default administrative distance will be applied.
target_classthe XRL target class of the routing protocol that will supply routes to this OriginTable.
target_instancethe XRL target instance of the routing protocol that will supply routes to this OriginTable.

Returns: XORP_OK on success, otherwise XORP_ERROR.

int  delete_egp_table (const string& tablename, const string& target_class, const string& target_instance)

delete_egp_table

[virtual]

Delete the OriginTable for an EGP protocol and unplumb it from the RIB. Typically this will be called when an instance of an EGP routing protocol such as BGP exits.

Parameters:

tablenamethe routing protocol name, previously registered using add_igp_table.
target_classthe XRL target class of the routing protocol that supplied routes to this OriginTable.
target_instancethe XRL target instance of the routing protocol that supplied routes to this OriginTable.

Returns: XORP_OK on success, otherwise XORP_ERROR.

void  target_death (const string& target_class, const string& target_instance)

target_death

An XRL Target died. We need to check if it's a routing protocol, and if it was, clean up after it.

Parameters:

target_classthe XRL Class of the target that died.
target_instancethe XRL Class Instance of the target that died.
void  print_rib ()

print_rib

[const]

Print the RIB structure for debugging

string  name ()

name

[const]

Get RIB name.

void  push_routes ()

push_routes

Push routes through policy filters for re-filtering.

int  set_protocol_admin_distance (const string& protocol_name, const uint32_t& admin_distance)

set_protocol_admin_distance

Set the admin distance associated with a routing protocol.

Parameters:

protocol_namethe canonical name of a routing protocol, in lower case. Eg "ospf", "ibgp", etc.
admin_distancethe admin distance to set.

Returns: XORP_OK on success, otherwise XORP_ERROR.

map<string, uint32_t>&  get_protocol_admin_distances ()

get_protocol_admin_distances

Get the map of all registered admin distances.

Returns: a reference to the _admin_distance map.

uint32_t  get_protocol_admin_distance (const string& protocol_name)

get_protocol_admin_distance

Get the admin distance associated with a routing protocol.

Parameters:

protocol_namethe canonical name of a routing protocol, in lower case. Eg "ospf", "ibgp", etc.

Returns: the admin distance; UNKNOWN_ADMIN_DISTANCE if unknown.

RibManager& _rib_manager

_rib_manager

[protected]

EventLoop& _eventloop

_eventloop

[protected]

RouteTable<A>* _final_table

_final_table

[protected]

RegisterTable<A>* _register_table

_register_table

[protected]

bool _multicast

_multicast

[protected]

bool _errors_are_fatal

_errors_are_fatal

[protected]

PolicyRedistTable<A>* _policy_redist_table

_policy_redist_table

[protected]

list<RouteTable<A>* > _tables

_tables

[protected]

map<string, Protocol* > _protocols

_protocols

[protected]

map<string, OriginTable<A>* > _routing_protocol_instances

_routing_protocol_instances

[protected]

map<string, RibVif*> _vifs

_vifs

[protected]

map<string, RibVif*> _deleted_vifs

_deleted_vifs

[protected]

map<string, uint32_t> _admin_distances

_admin_distances

[protected]

map<A, IPExternalNextHop<A> > _external_nexthops

_external_nexthops

[protected]

map<A, IPPeerNextHop<A> > _peer_nexthops

_peer_nexthops

[protected]


Generated by: bms on anglepoise.lon.incunabulum.net on Wed Jul 23 10:06:07 2008, using kdoc 2.0a54+XORP.