xorp

VarRW Class Reference

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

#include <varrw.hh>

Inheritance diagram for VarRW:
FileVarRW SemanticVarRW SingleVarRW TestVarRW BGPVarRW< A > Fib2mribVarRW OlsrVarRW OspfVarRW< A > RIBVarRW< A > RIPVarRW< A > StaticRoutesVarRW BGPVarRWExport< A >

List of all members.

Public Types

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

Public Member Functions

virtual const Elementread (const Id &id)=0
 Read a variable from a route [such as nexthop].
virtual void write (const Id &id, const Element &e)=0
 Write a variable to a route.
virtual void sync ()
 VarRW must perform all pending writes to the route now.
void enable_trace (bool on)
 Enable/disable generating trace strings / output.
const Elementread_trace (const Id &id)
 Support for tracing reads.
void write_trace (const Id &id, const Element &e)
 Support for tracing writes.
uint32_t trace ()
 Obtain the final trace value.
string tracelog ()
 Obtain the actual trace from the varrw.
virtual string more_tracelog ()
 Obtain any VarRW specific traces.
void reset_trace ()

Private Attributes

bool _do_trace
uint32_t _trace
ostringstream _tracelog

Detailed Description

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

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.


Member Function Documentation

string VarRW::more_tracelog ( ) [virtual]

Obtain any VarRW specific traces.

Returns:
string representation of specific VarRW traces.

Reimplemented in BGPVarRW< A >, and BGPVarRW< IPv4 >.

virtual const Element& VarRW::read ( const Id &  id) [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.

Returns:
Element requested, or ElemNull of element is not available.
Parameters:
idThe variable that is being requested [such as metric].

Implemented in SingleVarRW, SemanticVarRW, TestVarRW, and FileVarRW.

const Element & VarRW::read_trace ( const Id &  id)

Support for tracing reads.

Executor will call this. This call will then call read()

Parameters:
idvariable to read.
Returns:
variable desired.
void VarRW::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.

Reimplemented in SingleVarRW, SemanticVarRW, and FileVarRW.

uint32_t VarRW::trace ( )

Obtain the final trace value.

Should be called after executing the policy in case it changes.

Returns:
trace value.
string VarRW::tracelog ( )

Obtain the actual trace from the varrw.

Returns:
string representation of what was read and written.
virtual void VarRW::write ( const Id &  id,
const Element e 
) [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.

Implemented in SingleVarRW, SemanticVarRW, TestVarRW, and FileVarRW.

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

Support for tracing writes.

Executor will call this. This will then call write()

@ param id variable to write to.

Parameters:
evalue to write.

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