class RIB

Master class for a RIB. More...

Definition#include <rib.hh>
Template formRIB<class A>
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Protected Members


Detailed Description

RIB is the master class for a Routing Information Base. It holds the Vif 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)

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 ()

~RIB

[virtual]

RIB Destructor.

int  initialize_export (FeaClient *fea)

initialize_export

Initialize the RIB's ExportTable so that the winning routes are exported to the Forwarding Engine.

Returns: -1 if already initialized.

See also: ExportTable

int  initialize_register (RegisterServer *regserv)

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.

Returns: -1 if already initialized.

int  new_origin_table (const string& tablename, int admin_distance, int igp)

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
admin_distancedefault administrative distance to be applied to routes that enter the RIB through this OriginTable.
igptrue if the routing protocol that will inject routes is a Interior Gateway Protocol such as OSPF. False if it's an EGP such as BGP (or IBGP).

Returns: -1 if table cannot be created, 0 otherwise.

See also: OriginTable

int  new_merged_table (const string& tablename, const string& table_a, const string& table_b)

new_merged_table

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

Parameters:
tablenamehuman-readable name for this table to help in debugging
table_aparent routing table that will feed routes in to this MergedTable
table_bparent routing table that will feed routes in to this MergedTable

Returns: 0 on success, -1 if table_a or table_b does not exist.

See also: MergedTable

int  new_extint_table (const string& tablename, const string& t_ext, const string& t_int)

new_extint_table

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

Parameters:
tablenamehuman-readable name for this table to help in debugging
t_extparent routing table that will feed EGP routes in to this ExtIntTable
t_intparent routing table that will feed IGP routes in to this ExtIntTable

Returns: 0 on success, -1 if t_ext or t_int does not exist.

See also: ExtIntTable

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

new_vif

[virtual]

Inform the RIB about the existence of a Virtual Interface.

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

Returns: 0 on success, -1 if vif named vifname already exists.

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: 0 on success, -1 if vif named vifname doesn't exist.

int  add_vif_address (const string& vifname, const A& addr, const IPNet<A>& net)

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.
netthe subnet that is connected to this VIF corresponding to the address addr.

Returns: 0 on success, -1 if vif is unknown.

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: 0 on success, -1 if vif is unknown or addr is not an address on this vif.

int  add_route (const string& tablename, const IPNet<A>& net, const A& addr, uint32_t metric)

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.
addrthe nexthop that packets destined for net should be forwarded to.
therouting protocol metric associated with this route.

Returns: 0 on success, -1 otherwise.

int  replace_route (const string& tablename, const IPNet<A>& net, const A& addr, uint32_t metric)

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.
addrthe new nexthop that packets destined for net should be forwarded to.
thenew routing protocol metric associated with this route.

Returns: 0 on success, -1 otherwise.

int  verify_route (const A& lookupaddr, const string& ifname, const A& nexthop, uint32_t metric)

verify_route

[virtual]

Verify that expected routing information is correct. This is intended for testing purposes only.

Returns: 0 on successful verification, -1 otherwise.

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: 0 on success, -1 otherwise.

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, A::ZERO() otherwise.

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.

bool  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: true on successful deregistration, false if the entry to be deregistered was not found.

See also: route_register

int  redist_enable (const string& fromtable, const string& totable)

redist_enable

[virtual]

Enable Redistribution.

Parameters:
fromtablethe name of the source redistribition table.
totablethe name of the destination table to which routes should be redistributed (must be an OriginTable<A> name).

Returns: 0 on success, -1 if either table does not exists or redistribution is already enabled.

int  redist_disable (const string& fromtable, const string& totable)

redist_disable

[virtual]

Disable redistribution.

Parameters:
fromtablethe name of the source redistribition table.
totablethe name of the destination table to which routes were previously redistributed (must be an OriginTable<A> name).

Returns: 0 on success, -1 if table does not exist.

int  add_igp_table (const string& tablename)

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.

Returns: 0 on success, -1 otherwise.

int  delete_igp_table (const string& tablename)

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 .

Returns: 0 on success, -1 otherwise.

int  add_egp_table (const string& tablename)

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.

Returns: 0 on success, -1 otherwise.

int  delete_egp_table (const string& tablename)

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 .

Returns: 0 on success, -1 otherwise.

void  print_rib ()

print_rib

[const]

Print the RIB structure for debugging

RouteTable<A>* _final_table

_final_table

[protected]

RegisterTable<A>* _register_table

_register_table

[protected]

bool _mcast

_mcast

[protected]

map<const string, RouteTable<A>*> _tables

_tables

[protected]

map<const string, Vif> _vifs

_vifs

[protected]

map<const string, int> _admin_distances

_admin_distances

[protected]

map<const A, IPExternalNextHop<A> > _external_nexthops

_external_nexthops

[protected]

map<const A, IPPeerNextHop<A> > _peer_nexthops

_peer_nexthops

[protected]


Generated by: pavlin on possum.icir.org on Wed Dec 11 16:51:00 2002, using kdoc 2.0a54+XORP.