xorp

RouteWalker< A > Class Template Reference

Asynchronous RouteDB walker. More...

#include <route_db.hh>

Inheritance diagram for RouteWalker< A >:
NONCOPYABLE

List of all members.

Public Types

enum  State { STATE_RUNNING, STATE_PAUSED }
typedef A Addr
typedef IPNet< A > Net
typedef RouteDB< A >
::RouteContainer 
RouteContainer
typedef RouteDB< A >::Route Route

Public Member Functions

 RouteWalker (RouteDB< A > &route_db)
State state () const
const Routenext_route ()
 Move iterator to next available route.
const Routecurrent_route ()
 Get current route.
void pause (uint32_t pause_ms)
 Pause route walking operation.
void resume ()
 Resume route walking.
void reset ()
 Effect a reset.

Private Attributes

RouteDB< A > & _route_db
State _state
Net _last_visited
RouteContainer::iterator _pos

Static Private Attributes

static const Net NO_NET

Detailed Description

template<typename A>
class RouteWalker< A >

Asynchronous RouteDB walker.

The RouteWalker class walks the routes in a RouteDB. It assumes the walking is broken up into a number of shorter walks, and that each short walk is triggered from a XorpTimer. The end of a short walk causes state to saved and is signalled using the pause() method. When the next short walk is ready to start, resume() should be called. These calls save and resume state are relatively expensive.


Member Function Documentation

template<typename A >
const RouteWalker< A >::Route * RouteWalker< A >::current_route ( )

Get current route.

Returns:
pointer to route if available, 0 if route not available or not in STATE_RUNNING state.
template<typename A >
const RouteWalker< A >::Route * RouteWalker< A >::next_route ( )

Move iterator to next available route.

Returns:
true on success, false if route not available or instance is not in the STATE_RUNNING state.
template<typename A >
void RouteWalker< A >::pause ( uint32_t  pause_ms)

Pause route walking operation.

The instance state is transitioned from STATE_RUNNING to STATE_PAUSED on the assumption that route walking will be resumed at some point in the future (resume). If the current route has a deletion timer associated with it that would expire within pause_ms, the timer expiry is pushed back so it will expire at a time after the expected resume time. Thus in most cases a walk can safely resume from where it was paused.

Parameters:
pause_msthe expected time before resume is called.
template<typename A >
void RouteWalker< A >::reset ( )

Effect a reset.

The internal iterator is moved to the first stored route and the state is set to STATE_RUNNING.

template<typename A >
void RouteWalker< A >::resume ( )

Resume route walking.

The instance state is transitioned from STATE_PAUSED to STATE_RUNNING. The internal iterator is checked for validity and recovery steps taken should the route pointed to have been deleted.

template<typename A>
State RouteWalker< A >::state ( ) const [inline]
Returns:
current state of instance.

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