xorp

PolicyList Class Reference

The list of policies associated with a protocol. More...

#include <policy_list.hh>

Inheritance diagram for PolicyList:
NONCOPYABLE

List of all members.

Public Types

enum  PolicyType { IMPORT, EXPORT }
typedef set< uint32_t > TagSet
typedef map< string, TagSet * > TagMap

Public Member Functions

 PolicyList (const string &p, PolicyType pt, PolicyMap &pmap, SetMap &smap, VarMap &vmap, string mod)
void push_back (const string &policyname)
 Append a policy to the list.
void compile_policy (PolicyStatement &ps, Code::TargetSet &mod, uint32_t &tagstart, map< string, set< uint32_t > > &ptags)
 Compiles a specific policy.
void compile (Code::TargetSet &mod, uint32_t &tagstart, map< string, set< uint32_t > > &ptags)
 Compile all policies which were not previously compiled.
string str ()
void link_code (Code &ret)
 Link the all the code avialable in this policy list with code supplied.
void get_targets (Code::TargetSet &targets)
 Return all targets in this policy list.
void get_redist_tags (const string &protocol, Code::TagSet &ts)
 Return the policy tags used by a specific protocol for route redistribution.

Private Types

typedef pair< string, CodeList * > PolicyCode
typedef list< PolicyCode > PolicyCodeList
typedef set< string > POLICIES

Private Member Functions

void semantic_check (PolicyStatement &ps, VisitorSemantic::PolicyType type)
 Semantically check the policy for this instantiation.
void compile_import (PolicyCodeList::iterator &iter, PolicyStatement &ps, Code::TargetSet &modified_targets)
 Compile an import policy.
void compile_export (PolicyCodeList::iterator &iter, PolicyStatement &ps, Code::TargetSet &modified_targets, uint32_t &tagstart, map< string, set< uint32_t > > &ptags)
 Compile an export policy.
Termcreate_mod (Term::BLOCKS block)
void add_policy_expression (const string &exp)

Private Attributes

string _protocol
PolicyType _type
PolicyCodeList _policies
PolicyMap_pmap
SetMap_smap
VarMap_varmap
string _mod
Term_mod_term
Term_mod_term_import
Term_mod_term_export
POLICIES _pe_policies

Static Private Attributes

static uint32_t _pe = 0

Detailed Description

The list of policies associated with a protocol.

This relates to the import/export directives of protocols.

Depending on what protocols support, they will normally have a single import/export policy list associated with them.

Each policy list is an instantiation of a policy, and thus it hold the specific code for this instantiation.


Constructor & Destructor Documentation

PolicyList::PolicyList ( const string &  p,
PolicyType  pt,
PolicyMap pmap,
SetMap smap,
VarMap vmap,
string  mod 
)
Parameters:
pprotocol for which this list applies.
ptthe type of policy list [import/export].
pmapthe container of all policies.
smapthe container of all sets.
vmapthe VarMap.

Member Function Documentation

void PolicyList::compile ( Code::TargetSet &  mod,
uint32_t &  tagstart,
map< string, set< uint32_t > > &  ptags 
)

Compile all policies which were not previously compiled.

Throws an exception on semantic / compile errors.

Parameters:
modset filled with targets which are modified by compilation.
tagstartfirst policy tag available.
void PolicyList::compile_export ( PolicyCodeList::iterator &  iter,
PolicyStatement ps,
Code::TargetSet &  modified_targets,
uint32_t &  tagstart,
map< string, set< uint32_t > > &  ptags 
) [private]

Compile an export policy.

Parameters:
iterposition in code list which needs to be replaced with code.
pspolicy to compile.
modified_targetsset filled with targets modified by compilation.
tagstartfirst policy tag available.
void PolicyList::compile_import ( PolicyCodeList::iterator &  iter,
PolicyStatement ps,
Code::TargetSet &  modified_targets 
) [private]

Compile an import policy.

Parameters:
iterposition in code list which needs to be replaced with code.
pspolicy to compile.
modified_targetsset filled with targets modified by compilation.
void PolicyList::compile_policy ( PolicyStatement ps,
Code::TargetSet &  mod,
uint32_t &  tagstart,
map< string, set< uint32_t > > &  ptags 
)

Compiles a specific policy.

Throws an exception on semantic / compile errors.

Parameters:
pspolicy to compile.
modset filled with targets which are modified by compilation.
tagstartfirst policy tag available.
void PolicyList::get_redist_tags ( const string &  protocol,
Code::TagSet &  ts 
)

Return the policy tags used by a specific protocol for route redistribution.

Parameters:
protocolprotocol for which tags are requested.
tsset filled with policy-tags used by the protocol.
void PolicyList::get_targets ( Code::TargetSet &  targets)

Return all targets in this policy list.

Parameters:
targetsset filled with all targets in this policy instantiation.
void PolicyList::link_code ( Code ret)

Link the all the code avialable in this policy list with code supplied.

The code supplied will normally contain a target, so only relevant code is linked.

Parameters:
retcode to link with.
void PolicyList::push_back ( const string &  policyname)

Append a policy to the list.

Parameters:
policynamethe name of the policy
void PolicyList::semantic_check ( PolicyStatement ps,
VisitorSemantic::PolicyType  type 
) [private]

Semantically check the policy for this instantiation.

Throws an exception on error.

Parameters:
pspolicy to check.
typetype of policy [import/export].
string PolicyList::str ( )
Returns:
string representation of list

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