xorp

BGPVarRW< A > Class Template Reference

Allows reading an modifying a BGP route. More...

#include <bgp_varrw.hh>

Inheritance diagram for BGPVarRW< A >:
SingleVarRW NONCOPYABLE VarRW BGPVarRWExport< A >

List of all members.

Public Types

enum  {
  VAR_NETWORK4 = VAR_PROTOCOL, VAR_NEXTHOP4, VAR_NETWORK6, VAR_NEXTHOP6,
  VAR_ASPATH, VAR_ORIGIN, VAR_NEIGHBOR, VAR_LOCALPREF,
  VAR_COMMUNITY, VAR_MED, VAR_MED_REMOVE, VAR_AGGREGATE_PREFIX_LEN,
  VAR_AGGREGATE_BRIEF_MODE, VAR_WAS_AGGREGATED, VAR_BGPMAX
}
typedef Element *(BGPVarRW::* ReadCallback )()
typedef void(BGPVarRW::* WriteCallback )(const Element &e)

Public Member Functions

 BGPVarRW (const string &name)
 This varrw allows for routes to remain untouched even though they are filtered.
void set_peer (const A &peer)
void set_self (const A &self)
void attach_route (InternalMessage< A > &rtmsg, bool no_modify)
 Attach a route to the varrw.
void detach_route (InternalMessage< A > &rtmsg)
InternalMessage< A > * filtered_message ()
 Caller owns the message [responsible for delete].
Elementsingle_read (const Id &id)
 Read of a variable.
void single_write (const Id &id, const Element &e)
 Write of a variable.
void end_write ()
 Marks the end of writes in case there were any modified fields.
bool modified ()
 If a route is modified, the caller may obtain it via the filtered_message call.
virtual string more_tracelog ()
 Output basic BGP specific information.
virtual Elementread_neighbor ()
 Reads the neighbor variable.
Elementread_neighbor_base_cb ()
 Callback wrapper used to call the virtual read_neighbor() method.
Elementread_policytags ()
Elementread_filter_im ()
Elementread_filter_sm ()
Elementread_filter_ex ()
Elementread_network4 ()
Elementread_network6 ()
Elementread_nexthop4 ()
Elementread_nexthop6 ()
Elementread_aspath ()
Elementread_origin ()
Elementread_localpref ()
Elementread_community ()
Elementread_med ()
Elementread_med_remove ()
Elementread_aggregate_prefix_len ()
Elementread_aggregate_brief_mode ()
Elementread_was_aggregated ()
Elementread_tag ()
void write_filter_im (const Element &e)
void write_filter_sm (const Element &e)
void write_filter_ex (const Element &e)
void write_policytags (const Element &e)
void write_nexthop4 (const Element &e)
void write_nexthop6 (const Element &e)
void write_aspath (const Element &e)
void write_origin (const Element &e)
void write_aggregate_prefix_len (const Element &e)
void write_aggregate_brief_mode (const Element &e)
void write_was_aggregated (const Element &e)
void write_localpref (const Element &e)
void write_community (const Element &e)
void write_med (const Element &e)
void write_med_remove (const Element &e)
void write_tag (const Element &e)
template<>
Elementread_network4 ()
template<>
Elementread_network6 ()
template<>
Elementread_nexthop6 ()
template<>
Elementread_nexthop4 ()
template<>
void write_nexthop4 (const Element &)
template<>
void write_nexthop6 (const Element &e)

Protected Attributes

ElementFactory _ef
string _name

Private Member Functions

void cleanup ()
void write_nexthop (const Element &e)
 BGPVarRW (const BGPVarRW &)
BGPVarRWoperator= (const BGPVarRW &)

Private Attributes

InternalMessage< A > * _rtmsg
bool _got_fmsg
PolicyTags_ptags
bool _wrote_ptags
FPAListRef _palist
bool _no_modify
bool _modified
RefPf _pfilter [3]
bool _wrote_pfilter [3]
bool _route_modify
_self
_peer
uint32_t _aggr_prefix_len
bool _aggr_brief_mode

Static Private Attributes

static BGPVarRWCallbacks< A > _callbacks

Detailed Description

template<class A>
class BGPVarRW< A >

Allows reading an modifying a BGP route.

If the route is modified, the user is responsible for retrieving the filtered message and deleting it.

Non-copyable due to inheritance from VarRW.


Constructor & Destructor Documentation

template<class A >
BGPVarRW< A >::BGPVarRW ( const string &  name)

This varrw allows for routes to remain untouched even though they are filtered.

This is useful in order to check if a route will be accepted or rejected, without caring about its modifications.

Parameters:
namethe name of the filter to print in case of tracing.

Member Function Documentation

template<class A>
void BGPVarRW< A >::attach_route ( InternalMessage< A > &  rtmsg,
bool  no_modify 
)

Attach a route to the varrw.

Parameters:
rtmsgthe message to filter and possibly modify.
no_modifyif true, the route will not be modified.
template<class A >
InternalMessage< A > * BGPVarRW< A >::filtered_message ( )

Caller owns the message [responsible for delete].

Calling multiple times will always return the same message, not a copy.

Returns:
the modified message. Null if no changes were made.
template<class A >
bool BGPVarRW< A >::modified ( )

If a route is modified, the caller may obtain it via the filtered_message call.

Returns:
true if route was modified. False otherwise.
template<class A >
string BGPVarRW< A >::more_tracelog ( ) [virtual]

Output basic BGP specific information.

Returns:
BGP trace based on verbosity level returned from trace().

Reimplemented from VarRW.

template<class A >
Element * BGPVarRW< A >::read_neighbor ( ) [virtual]

Reads the neighbor variable.

This is different on input/output branch.

Returns:
the neighbor variable.

Reimplemented in BGPVarRWExport< A >.

template<class A>
Element* BGPVarRW< A >::read_neighbor_base_cb ( ) [inline]

Callback wrapper used to call the virtual read_neighbor() method.

Returns:
the neighbor variable.
template<class A >
Element * BGPVarRW< A >::single_read ( const Id &  id) [virtual]

Read of a variable.

The VarRW needs to read a particular element. This may return NULL indicating ElemNull---i.e. variable not present in THIS route.

Returns:
variable requested.
Parameters:
idthe id of the variable.

Implements SingleVarRW.

template<class A >
void BGPVarRW< A >::single_write ( const Id &  id,
const Element e 
) [virtual]

Write of a variable.

The write MUST be performed now, as the element pointer may become invalid after this call. Also, a single write will be called for each modified element.

Parameters:
ididentifier of variable to be written to.
evalue of variable.

Implements SingleVarRW.


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