|
xorp
|
Interface used by policy filters to execute a policy on a route. More...
#include <varrw.hh>
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 Element & | read (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 Element & | read_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 |
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.
| string VarRW::more_tracelog | ( | ) | [virtual] |
Obtain any VarRW specific 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.
| id | The 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()
| id | variable to read. |
| 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 | ( | ) |
| string VarRW::tracelog | ( | ) |
| 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.
| id | Identifier of variable that must be written to. |
| e | Value 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.
| e | value to write. |