xorp

SourceMatchCodeGenerator Class Reference

Code generator for source match filters. More...

#include <source_match_code_generator.hh>

Inheritance diagram for SourceMatchCodeGenerator:
NONCOPYABLE CodeGenerator Visitor

List of all members.

Classes

class  NoProtoSpec
 Exception thrown if no protocol was specified in source block. More...
class  ProtoRedefined
 Exception thrown if protocol was re-defined in source block. More...

Public Types

typedef pair< bool, uint32_t > Taginfo
typedef vector< Taginfo > Tags

Public Member Functions

 SourceMatchCodeGenerator (uint32_t tagstart, const VarMap &varmap, PolicyMap &pmap, map< string, set< uint32_t > > &ptags)
const Elementvisit_policy (PolicyStatement &policy)
const Elementvisit_term (Term &term)
const Elementvisit_proto (NodeProto &node)
vector< Code * > & codes ()
 The targets of source match code may be multiple as different protocols may refer to different source terms.
const Tags & tags () const
 The source match code generator will map source blocks to tags.
uint32_t next_tag () const

Protected Member Functions

const string & protocol ()

Private Types

typedef map< string, Code * > CodeMap

Private Member Functions

void do_term (Term &term)
void addTerm ()
 Adds the the code of the current term being analyzed.

Private Attributes

uint32_t _currtag
string _protocol
CodeMap _codes
vector< Code * > _codes_vect
Tags _tags
map< string, set< uint32_t > > & _protocol_tags
bool _protocol_statement
string _policy

Detailed Description

Code generator for source match filters.

This is a specialized version of the import filter CodeGenerator.

It skips dest and action blocks in policies. The action block is replaced with the actual policy tagging.


Constructor & Destructor Documentation

SourceMatchCodeGenerator::SourceMatchCodeGenerator ( uint32_t  tagstart,
const VarMap varmap,
PolicyMap pmap,
map< string, set< uint32_t > > &  ptags 
)
Parameters:
tagstartthe first policy tag available.
varmapthe varmap.

Member Function Documentation

vector< Code * > & SourceMatchCodeGenerator::codes ( )

The targets of source match code may be multiple as different protocols may refer to different source terms.

Thus many different code fragments may be generated.

Returns:
seturn all the code fragments generated.
uint32_t SourceMatchCodeGenerator::next_tag ( ) const
Returns:
The next available policy tag.
const SourceMatchCodeGenerator::Tags & SourceMatchCodeGenerator::tags ( ) const

The source match code generator will map source blocks to tags.

If a source block is empty, a tag will not be used.

Returns:
information about tags used.

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