|
|
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_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:
id | The 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:
id | Identifier of variable that must be written to. |
e | Value that must be written to the variable. |
void sync ()
| sync |
[pure 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 suppress_trace ()
| suppress_trace |
Disable generating trace strings / output.
void allow_trace ()
| allow_trace |
bool trace_allowed ()
| trace_allowed |
[const]
Return true if trace strings should be generated.
const Element& read_trace (const Id& id)
| read_trace |
Support for tracing reads. Executor will call this. This call will then call read()
Parameters:
id | variable 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:
e | value 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 |