xorp

ExternalRoutes Class Reference

Class which manages distribution of external routes throughout the OLSR domain. More...

#include <external.hh>

List of all members.

Public Member Functions

 ExternalRoutes (Olsr &olsr, EventLoop &eventloop, FaceManager &fm, Neighborhood &nh)
FaceManagerface_manager ()
RouteManagerroute_manager ()
void set_route_manager (RouteManager *rm)
TimeVal get_hna_interval () const
void set_hna_interval (const TimeVal &hna_interval)
 Set the HNA send timer.
TimeVal get_hna_hold_time () const
OlsrTypes::ExternalID update_hna_route_in (const IPv4Net &dest, const IPv4 &lasthop, const uint16_t distance, const TimeVal &expiry_time, bool &is_created) throw (BadExternalRoute)
 Update or create a route entry learned from HNA.
OlsrTypes::ExternalID add_hna_route_in (const IPv4Net &dest, const IPv4 &lasthop, const uint16_t distance, const TimeVal &expiry_time) throw (BadExternalRoute)
 Create a route entry learned from HNA.
bool delete_hna_route_in (OlsrTypes::ExternalID erid)
 Delete an HNA learned route entry given its ID.
void clear_hna_routes_in ()
 Clear the learned HNA routes.
const ExternalRouteget_hna_route_in (const IPv4Net &dest, const IPv4 &lasthop) throw (BadExternalRoute)
 Look up an ExternalRoute learned from HNA, given its origin and destination network prefix.
OlsrTypes::ExternalID get_hna_route_in_id (const IPv4Net &dest, const IPv4 &lasthop) throw (BadExternalRoute)
 Look up the ID of a learned HNA entry.
const ExternalRouteget_hna_route_in_by_id (const OlsrTypes::ExternalID erid) throw (BadExternalRoute)
 Look up a learned HNA route entry by its ID.
size_t hna_origin_count () const
 Calculate the number of unique OLSR nodes with HNA entries in this node's HNA learned route database.
size_t hna_dest_count () const
 Calculate the number of unique HNA prefixes which have been learned.
size_t hna_entry_count () const
void get_hna_route_in_list (list< OlsrTypes::ExternalID > &hnalist)
 Fill out a list of all the external learned route IDs.
bool originate_hna_route_out (const IPv4Net &dest) throw (BadExternalRoute)
 Originate an HNA route.
void withdraw_hna_route_out (const IPv4Net &dest) throw (BadExternalRoute)
 Withdraw an HNA route.
void clear_hna_routes_out ()
 Clear the advertised HNA routes.
OlsrTypes::ExternalID get_hna_route_out_id (const IPv4Net &dest) throw (BadExternalRoute)
 Look up the ID of an originated HNA entry.
void push_external_routes ()
 Push candidate HNA routes to the RouteManager.
void start_hna_send_timer ()
void stop_hna_send_timer ()
void restart_hna_send_timer ()
void reschedule_hna_send_timer ()
 Reschedule the HNA send timer (if the HNA interval has changed).
void reschedule_immediate_hna_send_timer ()
 Schedule the HNA send timer to fire as soon as possible.
bool event_send_hna ()
 Callback method to: service the HNA transmission timer.
bool event_receive_hna (Message *msg, const IPv4 &remote_addr, const IPv4 &local_addr)
 Process incoming HNA message.
void event_hna_route_in_expired (const OlsrTypes::ExternalID erid)
 Callback method to: delete a learned route entry when it expires.

Private Types

typedef multimap< IPv4Net,
OlsrTypes::ExternalID
ExternalDestInMap
 Map of learned routes by destination to route ID covering that destination.
typedef map
< OlsrTypes::ExternalID,
ExternalRoute * > 
ExternalRouteMap
 HNA entries learned by this node.
typedef map< IPv4Net,
OlsrTypes::ExternalID
ExternalDestOutMap
 Map of originated route IDs by destination.

Private Attributes

Olsr_olsr
EventLoop_eventloop
FaceManager_fm
Neighborhood_nh
RouteManager_rm
ExternalRouteOrderPred _routes_in_order_pred
bool _is_early_hna_enabled
OlsrTypes::ExternalID _next_erid
TimeVal _hna_interval
 the interval at which HNA broadcasts are flooded throughout the OLSR domain by this node, if routes are originated.
XorpTimer _hna_send_timer
ExternalDestInMap _routes_in_by_dest
ExternalRouteMap _routes_in
ExternalDestOutMap _routes_out_by_dest
ExternalRouteMap _routes_out
 HNA entries originated by this node.

Detailed Description

Class which manages distribution of external routes throughout the OLSR domain.


Member Function Documentation

OlsrTypes::ExternalID ExternalRoutes::add_hna_route_in ( const IPv4Net dest,
const IPv4 lasthop,
const uint16_t  distance,
const TimeVal expiry_time 
) throw (BadExternalRoute)

Create a route entry learned from HNA.

Parameters:
destThe destination being updated.
lasthopThe last-hop to reach the destination; usually this is the origin of the route.
distancethe number of hops to reach lasthop.
expiry_timeThe time at which the entry will expire.
Returns:
The ID of the created route entry.
Exceptions:
BadExternalRouteif the route could not be created.
bool ExternalRoutes::delete_hna_route_in ( OlsrTypes::ExternalID  erid)

Delete an HNA learned route entry given its ID.

Parameters:
eridThe ID of the external route to delete.
Returns:
true if the entry was found and deleted.
void ExternalRoutes::event_hna_route_in_expired ( const OlsrTypes::ExternalID  erid)

Callback method to: delete a learned route entry when it expires.

Parameters:
eridThe ID of the external route to delete.
bool ExternalRoutes::event_receive_hna ( Message msg,
const IPv4 remote_addr,
const IPv4 local_addr 
)

Process incoming HNA message.

Section 12.5: HNA Message Processing.

Parameters:
msgthe message to process.
remote_addrthe source address of the Packet containing msg.
local_addrthe address of the OLSR interface where the Packet containing msg was received.
Returns:
true if msg was consumed by this method, otherwise false.
bool ExternalRoutes::event_send_hna ( )

Callback method to: service the HNA transmission timer.

Section 12: Non-OLSR Interfaces.

Flood a HNA message to the rest of the OLSR domain which contains this node's Host and Network Associations.

Returns:
true if the callback should be rescheduled, otherwise false.
const ExternalRoute * ExternalRoutes::get_hna_route_in ( const IPv4Net dest,
const IPv4 lasthop 
) throw (BadExternalRoute)

Look up an ExternalRoute learned from HNA, given its origin and destination network prefix.

Parameters:
destthe destination network prefix.
lasthopthe origin.
Returns:
pointer to the ExternalRoute.
Exceptions:
BadExternalRouteif the route could not be found.
const ExternalRoute * ExternalRoutes::get_hna_route_in_by_id ( const OlsrTypes::ExternalID  erid) throw (BadExternalRoute)

Look up a learned HNA route entry by its ID.

Parameters:
eridthe ID of the learned ExternalRoute.
Returns:
the pointer to the learned ExternalRoute.
Exceptions:
BadExternalRouteif the route could not be found.
OlsrTypes::ExternalID ExternalRoutes::get_hna_route_in_id ( const IPv4Net dest,
const IPv4 lasthop 
) throw (BadExternalRoute)

Look up the ID of a learned HNA entry.

Both the destination and the OLSR last-hop must be specified to match.

Parameters:
destThe destination address.
lasthopThe last-hop advertised for the destination.
Returns:
the ID of the learned external route.
Exceptions:
BadExternalRouteif the route could not be found.
void ExternalRoutes::get_hna_route_in_list ( list< OlsrTypes::ExternalID > &  hnalist)

Fill out a list of all the external learned route IDs.

Parameters:
hnalistthe list to fill out.
OlsrTypes::ExternalID ExternalRoutes::get_hna_route_out_id ( const IPv4Net dest) throw (BadExternalRoute)

Look up the ID of an originated HNA entry.

Both the destination and the OLSR last-hop must be specified to match.

Parameters:
destThe destination address.
Returns:
the ID of the originated external route.
Exceptions:
BadExternalRouteif the route could not be found.
size_t ExternalRoutes::hna_dest_count ( ) const

Calculate the number of unique HNA prefixes which have been learned.

Used only by the protocol simulator.

Returns:
the number of unique destinations in the HNA route-in map.
size_t ExternalRoutes::hna_entry_count ( ) const [inline]
Returns:
the number of entries in the learned HNA route database.
size_t ExternalRoutes::hna_origin_count ( ) const

Calculate the number of unique OLSR nodes with HNA entries in this node's HNA learned route database.

Used only by the protocol simulator.

As we don't currently maintain a list of origins for HNA, this is a more computationally expensive invariant than for TC or MID.

Returns:
the number of unique origins in the HNA route-in map.
bool ExternalRoutes::originate_hna_route_out ( const IPv4Net dest) throw (BadExternalRoute)

Originate an HNA route.

Parameters:
destthe network for which to originate HNA broadcasts.
Returns:
true if the route was originated successfully.
Exceptions:
BadExternalRouteif the route could not be originated.
void ExternalRoutes::push_external_routes ( )

Push candidate HNA routes to the RouteManager.

12.6: The distance to the last-hop, as measured from the HNA message, is used as the current discriminator; this is what's specified in the RFC.

TODO: Deal with the metric here rather than in the RouteManager. For now, RouteManager will invent a metric before plumbing to the RIB.

void ExternalRoutes::set_hna_interval ( const TimeVal hna_interval)

Set the HNA send timer.

Parameters:
hna_intervalthe interval between HNA advertisements.

The timer will only be restarted if previously scheduled. If the period of the HNA broadcasts is changed, a HNA broadcast MAY be scheduled to take place immediately.

OlsrTypes::ExternalID ExternalRoutes::update_hna_route_in ( const IPv4Net dest,
const IPv4 lasthop,
const uint16_t  distance,
const TimeVal expiry_time,
bool &  is_created 
) throw (BadExternalRoute)

Update or create a route entry learned from HNA.

If the origin of the HNA route is not reachable in the OLSR SPT, the route will be rejected; see NOTES. TODO: In future distance may also be treated as an advertised metric.

Parameters:
destThe destination being updated.
lasthopThe last-hop to reach the destination.
distancethe number of hops to reach lasthop.
expiry_timeThe time at which the entry will expire.
is_createdreference to a boolean which is set to true iff a new entry was created by this method.
Returns:
The ID of the created or updated route entry.
Exceptions:
BadExternalRouteif the route could not be created.
void ExternalRoutes::withdraw_hna_route_out ( const IPv4Net dest) throw (BadExternalRoute)

Withdraw an HNA route.

Parameters:
destthe network to withdraw from HNA broadcasts.
Exceptions:
BadExternalRouteif no route to the given destination could be found.

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