class VarRW

Interface used by policy filters to execute a policy on a route. More...

 
LOGO
 Annotated List  Files  Globals  Hierarchy  Index  Top

Public Types

Public Methods


Detailed Description

It deals with reading and writing field/variables/attributes of a route [such as nexthop, metric and so on].

A routing protocol must implement this interface in order to support policy filtering.

typedef int Id

Id

enum { VAR_TRACE = 0, VAR_POLICYTAGS, VAR_FILTER_IM, VAR_FILTER_SM, VAR_FILTER_EX, VAR_TAG = 5, VAR_PROTOCOL = 10, VAR_MAX = 32 }

 VarRW ()

VarRW

 ~VarRW ()

~VarRW

[virtual]

const Element&  read (const Id& id)

read

[pure virtual]

Read a variable from a route [such as nexthop].

If the protocol doesn't support the requested variable, and exception should be thrown.

If the variable is not present in the current route, then an ElemNull should be returned [for example if ipv6 is requested on a v4 route].

VarRW is responsible for deleting the object read [it owns it]. However care must be taken not to delete objects that were obtained by write() even though we pass them to read() later.

Parameters:

idThe variable that is being requested [such as metric].

Returns: Element requested, or ElemNull of element is not available.

void  write (const Id& id, const Element& e)

write

[pure virtual]

Write a variable to a route.

VarRW does not own Element, so it must not delete it.

Parameters:

idIdentifier of variable that must be written to.
eValue that must be written to the variable.
void  sync ()

sync

[virtual]

VarRW must perform all pending writes to the route now.

This is usefull in scenarios where VarRW decides to cache read and writes and perform the actual writes at the end [i.e. it stores pointers to elements].

All pointers to elements [by write] may become invalid after a sync.

void  enable_trace (bool on)

enable_trace

Enable/disable generating trace strings / output.

const Element&  read_trace (const Id& id)

read_trace

Support for tracing reads. Executor will call this. This call will then call read()

Parameters:

idvariable to read.

Returns: variable desired.

void  write_trace (const Id& id, const Element& e)

write_trace

Support for tracing writes. Executor will call this. This will then call write()

@ param id variable to write to.

Parameters:

evalue to write.
uint32_t  trace ()

trace

Obtain the final trace value. Should be called after executing the policy in case it changes.

Returns: trace value.

string  tracelog ()

tracelog

Obtain the actual trace from the varrw.

Returns: string representation of what was read and written.

string  more_tracelog ()

more_tracelog

[virtual]

Obtain any VarRW specific traces.

Returns: string representation of specific VarRW traces.

void  reset_trace ()

reset_trace


Generated by: pavlin on kobe.xorp.net on Wed Jan 7 19:11:01 2009, using kdoc 2.0a54+XORP.