mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Replace uses of the old Dict generation code with new template versions
This commit is contained in:
parent
e2feec52be
commit
50943a580c
26 changed files with 62 additions and 94 deletions
|
@ -105,10 +105,8 @@ private:
|
||||||
int hits; // Statistics
|
int hits; // Statistics
|
||||||
int misses;
|
int misses;
|
||||||
|
|
||||||
declare(PDict,CacheEntry);
|
|
||||||
|
|
||||||
// Hash indexed by NFA states (MD5s of them, actually).
|
// Hash indexed by NFA states (MD5s of them, actually).
|
||||||
PDict(CacheEntry) states;
|
PDict<CacheEntry> states;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DFA_Machine : public BroObj {
|
class DFA_Machine : public BroObj {
|
||||||
|
|
|
@ -28,8 +28,6 @@ typedef PList<DNS_Mgr_Request> DNS_mgr_request_list;
|
||||||
struct nb_dns_info;
|
struct nb_dns_info;
|
||||||
struct nb_dns_result;
|
struct nb_dns_result;
|
||||||
|
|
||||||
declare(PDict,ListVal);
|
|
||||||
|
|
||||||
class DNS_Mapping;
|
class DNS_Mapping;
|
||||||
|
|
||||||
enum DNS_MgrMode {
|
enum DNS_MgrMode {
|
||||||
|
@ -143,7 +141,7 @@ protected:
|
||||||
|
|
||||||
DNS_MgrMode mode;
|
DNS_MgrMode mode;
|
||||||
|
|
||||||
PDict(ListVal) services;
|
PDict<ListVal> services;
|
||||||
|
|
||||||
HostMap host_mappings;
|
HostMap host_mappings;
|
||||||
AddrMap addr_mappings;
|
AddrMap addr_mappings;
|
||||||
|
|
|
@ -27,7 +27,7 @@ using namespace std;
|
||||||
bool g_policy_debug = false;
|
bool g_policy_debug = false;
|
||||||
DebuggerState g_debugger_state;
|
DebuggerState g_debugger_state;
|
||||||
TraceState g_trace_state;
|
TraceState g_trace_state;
|
||||||
PDict(Filemap) g_dbgfilemaps;
|
PDict<Filemap> g_dbgfilemaps;
|
||||||
|
|
||||||
// These variables are used only to decide whether or not to print the
|
// These variables are used only to decide whether or not to print the
|
||||||
// current context; you don't want to do it after a step or next
|
// current context; you don't want to do it after a step or next
|
||||||
|
|
|
@ -31,7 +31,6 @@ struct ParseLocationRec {
|
||||||
class StmtLocMapping;
|
class StmtLocMapping;
|
||||||
declare(PQueue,StmtLocMapping);
|
declare(PQueue,StmtLocMapping);
|
||||||
typedef PQueue(StmtLocMapping) Filemap; // mapping for a single file
|
typedef PQueue(StmtLocMapping) Filemap; // mapping for a single file
|
||||||
declare(PDict,Filemap);
|
|
||||||
|
|
||||||
class DbgBreakpoint;
|
class DbgBreakpoint;
|
||||||
class DbgWatch;
|
class DbgWatch;
|
||||||
|
@ -178,7 +177,7 @@ string get_context_description(const Stmt* stmt, const Frame* frame);
|
||||||
|
|
||||||
extern Frame* g_dbg_locals; // variables created within debugger context
|
extern Frame* g_dbg_locals; // variables created within debugger context
|
||||||
|
|
||||||
extern PDict(Filemap) g_dbgfilemaps; // filename => filemap
|
extern PDict<Filemap> g_dbgfilemaps; // filename => filemap
|
||||||
|
|
||||||
// Perhaps add a code/priority argument to do selective output.
|
// Perhaps add a code/priority argument to do selective output.
|
||||||
int debug_msg(const char* fmt, ...) __attribute__ ((format (printf, 1, 2)));
|
int debug_msg(const char* fmt, ...) __attribute__ ((format (printf, 1, 2)));
|
||||||
|
|
|
@ -51,7 +51,7 @@ void lookup_global_symbols_regex(const string& orig_regex, vector<ID*>& matches,
|
||||||
}
|
}
|
||||||
|
|
||||||
Scope* global = global_scope();
|
Scope* global = global_scope();
|
||||||
PDict(ID)* syms = global->Vars();
|
PDict<ID>* syms = global->Vars();
|
||||||
|
|
||||||
ID* nextid;
|
ID* nextid;
|
||||||
IterCookie* cookie = syms->InitForIteration();
|
IterCookie* cookie = syms->InitForIteration();
|
||||||
|
|
|
@ -37,8 +37,7 @@ public:
|
||||||
void PrintDebug();
|
void PrintDebug();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
declare(PDict, EventHandler);
|
typedef PDict<EventHandler> handler_map;
|
||||||
typedef PDict(EventHandler) handler_map;
|
|
||||||
handler_map handlers;
|
handler_map handlers;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
7
src/RE.h
7
src/RE.h
|
@ -22,9 +22,6 @@ class Specific_RE_Matcher;
|
||||||
class RE_Matcher;
|
class RE_Matcher;
|
||||||
class DFA_State;
|
class DFA_State;
|
||||||
|
|
||||||
declare(PDict,char);
|
|
||||||
declare(PDict,CCL);
|
|
||||||
|
|
||||||
extern int case_insensitive;
|
extern int case_insensitive;
|
||||||
extern CCL* curr_ccl;
|
extern CCL* curr_ccl;
|
||||||
extern NFA_Machine* nfa;
|
extern NFA_Machine* nfa;
|
||||||
|
@ -122,8 +119,8 @@ protected:
|
||||||
int multiline;
|
int multiline;
|
||||||
char* pattern_text;
|
char* pattern_text;
|
||||||
|
|
||||||
PDict(char) defs;
|
PDict<char> defs;
|
||||||
PDict(CCL) ccl_dict;
|
PDict<CCL> ccl_dict;
|
||||||
PList<CCL> ccl_list;
|
PList<CCL> ccl_list;
|
||||||
EquivClass equiv_class;
|
EquivClass equiv_class;
|
||||||
int* ecs;
|
int* ecs;
|
||||||
|
|
|
@ -15,9 +15,7 @@ class RuleHdrTest;
|
||||||
class Rule;
|
class Rule;
|
||||||
|
|
||||||
typedef PList<Rule> rule_list;
|
typedef PList<Rule> rule_list;
|
||||||
|
typedef PDict<Rule> rule_dict;
|
||||||
declare(PDict, Rule);
|
|
||||||
typedef PDict(Rule) rule_dict;
|
|
||||||
|
|
||||||
class Rule {
|
class Rule {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -19,7 +19,7 @@ Scope::Scope(ID* id, attr_list* al)
|
||||||
attrs = al;
|
attrs = al;
|
||||||
return_type = 0;
|
return_type = 0;
|
||||||
|
|
||||||
local = new PDict(ID)(ORDERED);
|
local = new PDict<ID>(ORDERED);
|
||||||
inits = new id_list;
|
inits = new id_list;
|
||||||
|
|
||||||
if ( id )
|
if ( id )
|
||||||
|
@ -108,7 +108,7 @@ void Scope::Describe(ODesc* d) const
|
||||||
|
|
||||||
TraversalCode Scope::Traverse(TraversalCallback* cb) const
|
TraversalCode Scope::Traverse(TraversalCallback* cb) const
|
||||||
{
|
{
|
||||||
PDict(ID)* ids = GetIDs();
|
PDict<ID>* ids = GetIDs();
|
||||||
IterCookie* iter = ids->InitForIteration();
|
IterCookie* iter = ids->InitForIteration();
|
||||||
|
|
||||||
HashKey* key;
|
HashKey* key;
|
||||||
|
|
|
@ -15,8 +15,6 @@ class ID;
|
||||||
class BroType;
|
class BroType;
|
||||||
class ListVal;
|
class ListVal;
|
||||||
|
|
||||||
declare(PDict,ID);
|
|
||||||
|
|
||||||
class Scope : public BroObj {
|
class Scope : public BroObj {
|
||||||
public:
|
public:
|
||||||
explicit Scope(ID* id, attr_list* al);
|
explicit Scope(ID* id, attr_list* al);
|
||||||
|
@ -35,11 +33,11 @@ public:
|
||||||
BroType* ReturnType() const { return return_type; }
|
BroType* ReturnType() const { return return_type; }
|
||||||
|
|
||||||
int Length() const { return local->Length(); }
|
int Length() const { return local->Length(); }
|
||||||
PDict(ID)* Vars() const { return local; }
|
PDict<ID>* Vars() const { return local; }
|
||||||
|
|
||||||
ID* GenerateTemporary(const char* name);
|
ID* GenerateTemporary(const char* name);
|
||||||
|
|
||||||
PDict(ID)* GetIDs() const { return local; }
|
PDict<ID>* GetIDs() const { return local; }
|
||||||
|
|
||||||
// Returns the list of variables needing initialization, and
|
// Returns the list of variables needing initialization, and
|
||||||
// removes it from this Scope.
|
// removes it from this Scope.
|
||||||
|
@ -56,7 +54,7 @@ protected:
|
||||||
ID* scope_id;
|
ID* scope_id;
|
||||||
attr_list* attrs;
|
attr_list* attrs;
|
||||||
BroType* return_type;
|
BroType* return_type;
|
||||||
PDict(ID)* local;
|
PDict<ID>* local;
|
||||||
id_list* inits;
|
id_list* inits;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -20,9 +20,6 @@ class Connection;
|
||||||
class ConnCompressor;
|
class ConnCompressor;
|
||||||
struct ConnID;
|
struct ConnID;
|
||||||
|
|
||||||
declare(PDict,Connection);
|
|
||||||
declare(PDict,FragReassembler);
|
|
||||||
|
|
||||||
class Discarder;
|
class Discarder;
|
||||||
class PacketFilter;
|
class PacketFilter;
|
||||||
|
|
||||||
|
@ -216,10 +213,10 @@ protected:
|
||||||
const Packet *pkt, const EncapsulationStack* encap);
|
const Packet *pkt, const EncapsulationStack* encap);
|
||||||
|
|
||||||
CompositeHash* ch;
|
CompositeHash* ch;
|
||||||
PDict(Connection) tcp_conns;
|
PDict<Connection> tcp_conns;
|
||||||
PDict(Connection) udp_conns;
|
PDict<Connection> udp_conns;
|
||||||
PDict(Connection) icmp_conns;
|
PDict<Connection> icmp_conns;
|
||||||
PDict(FragReassembler) fragments;
|
PDict<FragReassembler> fragments;
|
||||||
|
|
||||||
typedef pair<IPAddr, IPAddr> IPPair;
|
typedef pair<IPAddr, IPAddr> IPPair;
|
||||||
typedef pair<EncapsulatingConn, double> TunnelActivity;
|
typedef pair<EncapsulatingConn, double> TunnelActivity;
|
||||||
|
|
|
@ -239,7 +239,7 @@ void ProfileLogger::Log()
|
||||||
|
|
||||||
// Script-level state.
|
// Script-level state.
|
||||||
unsigned int size, mem = 0;
|
unsigned int size, mem = 0;
|
||||||
PDict(ID)* globals = global_scope()->Vars();
|
PDict<ID>* globals = global_scope()->Vars();
|
||||||
|
|
||||||
if ( expensive )
|
if ( expensive )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1147,7 +1147,7 @@ Val* ForStmt::DoExec(Frame* f, Val* v, stmt_flow_type& flow) const
|
||||||
if ( v->Type()->Tag() == TYPE_TABLE )
|
if ( v->Type()->Tag() == TYPE_TABLE )
|
||||||
{
|
{
|
||||||
TableVal* tv = v->AsTableVal();
|
TableVal* tv = v->AsTableVal();
|
||||||
const PDict(TableEntryVal)* loop_vals = tv->AsTable();
|
const PDict<TableEntryVal>* loop_vals = tv->AsTable();
|
||||||
|
|
||||||
if ( ! loop_vals->Length() )
|
if ( ! loop_vals->Length() )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -17,8 +17,6 @@
|
||||||
class StmtList;
|
class StmtList;
|
||||||
class ForStmt;
|
class ForStmt;
|
||||||
|
|
||||||
declare(PDict, int);
|
|
||||||
|
|
||||||
class Stmt : public BroObj {
|
class Stmt : public BroObj {
|
||||||
public:
|
public:
|
||||||
BroStmtTag Tag() const { return tag; }
|
BroStmtTag Tag() const { return tag; }
|
||||||
|
@ -237,7 +235,7 @@ protected:
|
||||||
case_list* cases;
|
case_list* cases;
|
||||||
int default_case_idx;
|
int default_case_idx;
|
||||||
CompositeHash* comp_hash;
|
CompositeHash* comp_hash;
|
||||||
PDict(int) case_label_value_map;
|
PDict<int> case_label_value_map;
|
||||||
std::vector<std::pair<ID*, int>> case_label_type_list;
|
std::vector<std::pair<ID*, int>> case_label_type_list;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
38
src/Val.cc
38
src/Val.cc
|
@ -956,7 +956,7 @@ void TableVal::Init(TableType* t)
|
||||||
subnets = 0;
|
subnets = 0;
|
||||||
|
|
||||||
table_hash = new CompositeHash(table_type->Indices());
|
table_hash = new CompositeHash(table_type->Indices());
|
||||||
val.table_val = new PDict(TableEntryVal);
|
val.table_val = new PDict<TableEntryVal>;
|
||||||
val.table_val->SetDeleteFunc(table_entry_val_delete_func);
|
val.table_val->SetDeleteFunc(table_entry_val_delete_func);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -979,7 +979,7 @@ void TableVal::RemoveAll()
|
||||||
{
|
{
|
||||||
// Here we take the brute force approach.
|
// Here we take the brute force approach.
|
||||||
delete AsTable();
|
delete AsTable();
|
||||||
val.table_val = new PDict(TableEntryVal);
|
val.table_val = new PDict<TableEntryVal>;
|
||||||
val.table_val->SetDeleteFunc(table_entry_val_delete_func);
|
val.table_val->SetDeleteFunc(table_entry_val_delete_func);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -992,7 +992,7 @@ int TableVal::RecursiveSize() const
|
||||||
!= TYPE_TABLE )
|
!= TYPE_TABLE )
|
||||||
return n;
|
return n;
|
||||||
|
|
||||||
PDict(TableEntryVal)* v = val.table_val;
|
PDict<TableEntryVal>* v = val.table_val;
|
||||||
IterCookie* c = v->InitForIteration();
|
IterCookie* c = v->InitForIteration();
|
||||||
|
|
||||||
TableEntryVal* tv;
|
TableEntryVal* tv;
|
||||||
|
@ -1130,7 +1130,7 @@ int TableVal::AddTo(Val* val, int is_first_init, bool propagate_ops) const
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PDict(TableEntryVal)* tbl = AsTable();
|
const PDict<TableEntryVal>* tbl = AsTable();
|
||||||
IterCookie* c = tbl->InitForIteration();
|
IterCookie* c = tbl->InitForIteration();
|
||||||
|
|
||||||
HashKey* k;
|
HashKey* k;
|
||||||
|
@ -1178,7 +1178,7 @@ int TableVal::RemoveFrom(Val* val) const
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PDict(TableEntryVal)* tbl = AsTable();
|
const PDict<TableEntryVal>* tbl = AsTable();
|
||||||
IterCookie* c = tbl->InitForIteration();
|
IterCookie* c = tbl->InitForIteration();
|
||||||
|
|
||||||
HashKey* k;
|
HashKey* k;
|
||||||
|
@ -1200,14 +1200,14 @@ TableVal* TableVal::Intersect(const TableVal* tv) const
|
||||||
{
|
{
|
||||||
TableVal* result = new TableVal(table_type);
|
TableVal* result = new TableVal(table_type);
|
||||||
|
|
||||||
const PDict(TableEntryVal)* t0 = AsTable();
|
const PDict<TableEntryVal>* t0 = AsTable();
|
||||||
const PDict(TableEntryVal)* t1 = tv->AsTable();
|
const PDict<TableEntryVal>* t1 = tv->AsTable();
|
||||||
PDict(TableEntryVal)* t2 = result->AsNonConstTable();
|
PDict<TableEntryVal>* t2 = result->AsNonConstTable();
|
||||||
|
|
||||||
// Figure out which is smaller; assign it to t1.
|
// Figure out which is smaller; assign it to t1.
|
||||||
if ( t1->Length() > t0->Length() )
|
if ( t1->Length() > t0->Length() )
|
||||||
{ // Swap.
|
{ // Swap.
|
||||||
const PDict(TableEntryVal)* tmp = t1;
|
const PDict<TableEntryVal>* tmp = t1;
|
||||||
t1 = t0;
|
t1 = t0;
|
||||||
t0 = tmp;
|
t0 = tmp;
|
||||||
}
|
}
|
||||||
|
@ -1229,8 +1229,8 @@ TableVal* TableVal::Intersect(const TableVal* tv) const
|
||||||
|
|
||||||
bool TableVal::EqualTo(const TableVal* tv) const
|
bool TableVal::EqualTo(const TableVal* tv) const
|
||||||
{
|
{
|
||||||
const PDict(TableEntryVal)* t0 = AsTable();
|
const PDict<TableEntryVal>* t0 = AsTable();
|
||||||
const PDict(TableEntryVal)* t1 = tv->AsTable();
|
const PDict<TableEntryVal>* t1 = tv->AsTable();
|
||||||
|
|
||||||
if ( t0->Length() != t1->Length() )
|
if ( t0->Length() != t1->Length() )
|
||||||
return false;
|
return false;
|
||||||
|
@ -1256,8 +1256,8 @@ bool TableVal::EqualTo(const TableVal* tv) const
|
||||||
|
|
||||||
bool TableVal::IsSubsetOf(const TableVal* tv) const
|
bool TableVal::IsSubsetOf(const TableVal* tv) const
|
||||||
{
|
{
|
||||||
const PDict(TableEntryVal)* t0 = AsTable();
|
const PDict<TableEntryVal>* t0 = AsTable();
|
||||||
const PDict(TableEntryVal)* t1 = tv->AsTable();
|
const PDict<TableEntryVal>* t1 = tv->AsTable();
|
||||||
|
|
||||||
if ( t0->Length() > t1->Length() )
|
if ( t0->Length() > t1->Length() )
|
||||||
return false;
|
return false;
|
||||||
|
@ -1437,7 +1437,7 @@ Val* TableVal::Lookup(Val* index, bool use_default_val)
|
||||||
return def;
|
return def;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PDict(TableEntryVal)* tbl = AsTable();
|
const PDict<TableEntryVal>* tbl = AsTable();
|
||||||
|
|
||||||
if ( tbl->Length() > 0 )
|
if ( tbl->Length() > 0 )
|
||||||
{
|
{
|
||||||
|
@ -1582,7 +1582,7 @@ ListVal* TableVal::ConvertToList(TypeTag t) const
|
||||||
{
|
{
|
||||||
ListVal* l = new ListVal(t);
|
ListVal* l = new ListVal(t);
|
||||||
|
|
||||||
const PDict(TableEntryVal)* tbl = AsTable();
|
const PDict<TableEntryVal>* tbl = AsTable();
|
||||||
IterCookie* c = tbl->InitForIteration();
|
IterCookie* c = tbl->InitForIteration();
|
||||||
|
|
||||||
HashKey* k;
|
HashKey* k;
|
||||||
|
@ -1623,7 +1623,7 @@ ListVal* TableVal::ConvertToPureList() const
|
||||||
|
|
||||||
void TableVal::Describe(ODesc* d) const
|
void TableVal::Describe(ODesc* d) const
|
||||||
{
|
{
|
||||||
const PDict(TableEntryVal)* tbl = AsTable();
|
const PDict<TableEntryVal>* tbl = AsTable();
|
||||||
int n = tbl->Length();
|
int n = tbl->Length();
|
||||||
|
|
||||||
if ( d->IsBinary() || d->IsPortable() )
|
if ( d->IsBinary() || d->IsPortable() )
|
||||||
|
@ -1767,7 +1767,7 @@ void TableVal::DoExpire(double t)
|
||||||
if ( ! type )
|
if ( ! type )
|
||||||
return; // FIX ME ###
|
return; // FIX ME ###
|
||||||
|
|
||||||
PDict(TableEntryVal)* tbl = AsNonConstTable();
|
PDict<TableEntryVal>* tbl = AsNonConstTable();
|
||||||
|
|
||||||
double timeout = GetExpireTime();
|
double timeout = GetExpireTime();
|
||||||
|
|
||||||
|
@ -1952,7 +1952,7 @@ Val* TableVal::DoClone(CloneState* state)
|
||||||
auto tv = new TableVal(table_type);
|
auto tv = new TableVal(table_type);
|
||||||
state->NewClone(this, tv);
|
state->NewClone(this, tv);
|
||||||
|
|
||||||
const PDict(TableEntryVal)* tbl = AsTable();
|
const PDict<TableEntryVal>* tbl = AsTable();
|
||||||
IterCookie* cookie = tbl->InitForIteration();
|
IterCookie* cookie = tbl->InitForIteration();
|
||||||
|
|
||||||
HashKey* key;
|
HashKey* key;
|
||||||
|
@ -2001,7 +2001,7 @@ unsigned int TableVal::MemoryAllocation() const
|
||||||
{
|
{
|
||||||
unsigned int size = 0;
|
unsigned int size = 0;
|
||||||
|
|
||||||
PDict(TableEntryVal)* v = val.table_val;
|
PDict<TableEntryVal>* v = val.table_val;
|
||||||
IterCookie* c = v->InitForIteration();
|
IterCookie* c = v->InitForIteration();
|
||||||
|
|
||||||
TableEntryVal* tv;
|
TableEntryVal* tv;
|
||||||
|
|
|
@ -55,7 +55,6 @@ class StateAccess;
|
||||||
class VectorVal;
|
class VectorVal;
|
||||||
|
|
||||||
class TableEntryVal;
|
class TableEntryVal;
|
||||||
declare(PDict,TableEntryVal);
|
|
||||||
|
|
||||||
typedef union {
|
typedef union {
|
||||||
// Used for bool, int, enum.
|
// Used for bool, int, enum.
|
||||||
|
@ -77,7 +76,7 @@ typedef union {
|
||||||
Func* func_val;
|
Func* func_val;
|
||||||
BroFile* file_val;
|
BroFile* file_val;
|
||||||
RE_Matcher* re_val;
|
RE_Matcher* re_val;
|
||||||
PDict(TableEntryVal)* table_val;
|
PDict<TableEntryVal>* table_val;
|
||||||
val_list* val_list_val;
|
val_list* val_list_val;
|
||||||
|
|
||||||
vector<Val*>* vector_val;
|
vector<Val*>* vector_val;
|
||||||
|
@ -228,7 +227,7 @@ public:
|
||||||
CONST_ACCESSOR2(TYPE_ENUM, int, int_val, AsEnum)
|
CONST_ACCESSOR2(TYPE_ENUM, int, int_val, AsEnum)
|
||||||
CONST_ACCESSOR(TYPE_STRING, BroString*, string_val, AsString)
|
CONST_ACCESSOR(TYPE_STRING, BroString*, string_val, AsString)
|
||||||
CONST_ACCESSOR(TYPE_FUNC, Func*, func_val, AsFunc)
|
CONST_ACCESSOR(TYPE_FUNC, Func*, func_val, AsFunc)
|
||||||
CONST_ACCESSOR(TYPE_TABLE, PDict(TableEntryVal)*, table_val, AsTable)
|
CONST_ACCESSOR(TYPE_TABLE, PDict<TableEntryVal>*, table_val, AsTable)
|
||||||
CONST_ACCESSOR(TYPE_RECORD, val_list*, val_list_val, AsRecord)
|
CONST_ACCESSOR(TYPE_RECORD, val_list*, val_list_val, AsRecord)
|
||||||
CONST_ACCESSOR(TYPE_FILE, BroFile*, file_val, AsFile)
|
CONST_ACCESSOR(TYPE_FILE, BroFile*, file_val, AsFile)
|
||||||
CONST_ACCESSOR(TYPE_PATTERN, RE_Matcher*, re_val, AsPattern)
|
CONST_ACCESSOR(TYPE_PATTERN, RE_Matcher*, re_val, AsPattern)
|
||||||
|
@ -396,7 +395,7 @@ protected:
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
ACCESSOR(TYPE_TABLE, PDict(TableEntryVal)*, table_val, AsNonConstTable)
|
ACCESSOR(TYPE_TABLE, PDict<TableEntryVal>*, table_val, AsNonConstTable)
|
||||||
ACCESSOR(TYPE_RECORD, val_list*, val_list_val, AsNonConstRecord)
|
ACCESSOR(TYPE_RECORD, val_list*, val_list_val, AsNonConstRecord)
|
||||||
|
|
||||||
// For internal use by the Val::Clone() methods.
|
// For internal use by the Val::Clone() methods.
|
||||||
|
|
|
@ -99,8 +99,6 @@ protected:
|
||||||
Val* v; // single (perhaps compound) value corresponding to call
|
Val* v; // single (perhaps compound) value corresponding to call
|
||||||
};
|
};
|
||||||
|
|
||||||
declare(PDict,RPC_CallInfo);
|
|
||||||
|
|
||||||
class RPC_Interpreter {
|
class RPC_Interpreter {
|
||||||
public:
|
public:
|
||||||
explicit RPC_Interpreter(analyzer::Analyzer* analyzer);
|
explicit RPC_Interpreter(analyzer::Analyzer* analyzer);
|
||||||
|
@ -125,7 +123,7 @@ protected:
|
||||||
|
|
||||||
void Weird(const char* name, const char* addl = "");
|
void Weird(const char* name, const char* addl = "");
|
||||||
|
|
||||||
PDict(RPC_CallInfo) calls;
|
PDict<RPC_CallInfo> calls;
|
||||||
analyzer::Analyzer* analyzer;
|
analyzer::Analyzer* analyzer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@ class SteppingStoneEndpoint;
|
||||||
class SteppingStoneManager;
|
class SteppingStoneManager;
|
||||||
|
|
||||||
declare(PQueue,SteppingStoneEndpoint);
|
declare(PQueue,SteppingStoneEndpoint);
|
||||||
declare(PDict,SteppingStoneEndpoint);
|
|
||||||
|
|
||||||
class SteppingStoneEndpoint : public BroObj {
|
class SteppingStoneEndpoint : public BroObj {
|
||||||
public:
|
public:
|
||||||
|
@ -41,8 +40,8 @@ protected:
|
||||||
// no LOOP in Bro language.
|
// no LOOP in Bro language.
|
||||||
int stp_id;
|
int stp_id;
|
||||||
HashKey* stp_key;
|
HashKey* stp_key;
|
||||||
PDict(SteppingStoneEndpoint) stp_inbound_endps;
|
PDict<SteppingStoneEndpoint> stp_inbound_endps;
|
||||||
PDict(SteppingStoneEndpoint) stp_outbound_endps;
|
PDict<SteppingStoneEndpoint> stp_outbound_endps;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SteppingStone_Analyzer : public tcp::TCP_ApplicationAnalyzer {
|
class SteppingStone_Analyzer : public tcp::TCP_ApplicationAnalyzer {
|
||||||
|
|
|
@ -28,7 +28,7 @@ std::set<std::string> val_to_topic_set(Val* val)
|
||||||
rval.emplace(val->AsString()->CheckString());
|
rval.emplace(val->AsString()->CheckString());
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const PDict(TableEntryVal)* tbl = val->AsTable();
|
const PDict<TableEntryVal>* tbl = val->AsTable();
|
||||||
|
|
||||||
if ( tbl->Length() == 0 )
|
if ( tbl->Length() == 0 )
|
||||||
return rval;
|
return rval;
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
namespace file_analysis {
|
namespace file_analysis {
|
||||||
|
|
||||||
class File;
|
class File;
|
||||||
declare(PDict,Analyzer);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A set of file analysis analyzers indexed by an \c AnalyzerArgs (script-layer
|
* A set of file analysis analyzers indexed by an \c AnalyzerArgs (script-layer
|
||||||
|
@ -139,7 +138,7 @@ private:
|
||||||
|
|
||||||
File* file; /**< File which owns the set */
|
File* file; /**< File which owns the set */
|
||||||
CompositeHash* analyzer_hash; /**< AnalyzerArgs hashes. */
|
CompositeHash* analyzer_hash; /**< AnalyzerArgs hashes. */
|
||||||
PDict(file_analysis::Analyzer) analyzer_map; /**< Indexed by AnalyzerArgs. */
|
PDict<file_analysis::Analyzer> analyzer_map; /**< Indexed by AnalyzerArgs. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract base class for analyzer set modifications.
|
* Abstract base class for analyzer set modifications.
|
||||||
|
|
|
@ -26,9 +26,6 @@
|
||||||
|
|
||||||
namespace file_analysis {
|
namespace file_analysis {
|
||||||
|
|
||||||
declare(PDict,bool);
|
|
||||||
declare(PDict,File);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main entry point for interacting with file analysis.
|
* Main entry point for interacting with file analysis.
|
||||||
*/
|
*/
|
||||||
|
@ -339,8 +336,8 @@ public:
|
||||||
protected:
|
protected:
|
||||||
friend class FileTimer;
|
friend class FileTimer;
|
||||||
|
|
||||||
typedef PDict(bool) IDSet;
|
typedef PDict<bool> IDSet;
|
||||||
typedef PDict(File) IDMap;
|
typedef PDict<File> IDMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new file to be analyzed or retrieve an existing one.
|
* Create a new file to be analyzed or retrieve an existing one.
|
||||||
|
@ -410,8 +407,8 @@ private:
|
||||||
|
|
||||||
TagSet* LookupMIMEType(const string& mtype, bool add_if_not_found);
|
TagSet* LookupMIMEType(const string& mtype, bool add_if_not_found);
|
||||||
|
|
||||||
PDict(File) id_map; /**< Map file ID to file_analysis::File records. */
|
PDict<File> id_map; /**< Map file ID to file_analysis::File records. */
|
||||||
PDict(bool) ignored; /**< Ignored files. Will be finally removed on EOF. */
|
PDict<bool> ignored; /**< Ignored files. Will be finally removed on EOF. */
|
||||||
string current_file_id; /**< Hash of what get_file_handle event sets. */
|
string current_file_id; /**< Hash of what get_file_handle event sets. */
|
||||||
RuleFileMagicState* magic_state; /**< File magic signature match state. */
|
RuleFileMagicState* magic_state; /**< File magic signature match state. */
|
||||||
MIMEMap mime_types;/**< Mapping of MIME types to analyzers. */
|
MIMEMap mime_types;/**< Mapping of MIME types to analyzers. */
|
||||||
|
|
|
@ -52,8 +52,6 @@ static void input_hash_delete_func(void* val)
|
||||||
delete h;
|
delete h;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare(PDict, InputHash);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base stuff that every stream can do.
|
* Base stuff that every stream can do.
|
||||||
*/
|
*/
|
||||||
|
@ -109,8 +107,8 @@ public:
|
||||||
RecordType* rtype;
|
RecordType* rtype;
|
||||||
RecordType* itype;
|
RecordType* itype;
|
||||||
|
|
||||||
PDict(InputHash)* currDict;
|
PDict<InputHash>* currDict;
|
||||||
PDict(InputHash)* lastDict;
|
PDict<InputHash>* lastDict;
|
||||||
|
|
||||||
Func* pred;
|
Func* pred;
|
||||||
|
|
||||||
|
@ -703,9 +701,9 @@ bool Manager::CreateTableStream(RecordVal* fval)
|
||||||
stream->itype = idx->AsRecordType();
|
stream->itype = idx->AsRecordType();
|
||||||
stream->event = event ? event_registry->Lookup(event->Name()) : 0;
|
stream->event = event ? event_registry->Lookup(event->Name()) : 0;
|
||||||
stream->error_event = error_event ? event_registry->Lookup(error_event->Name()) : nullptr;
|
stream->error_event = error_event ? event_registry->Lookup(error_event->Name()) : nullptr;
|
||||||
stream->currDict = new PDict(InputHash);
|
stream->currDict = new PDict<InputHash>;
|
||||||
stream->currDict->SetDeleteFunc(input_hash_delete_func);
|
stream->currDict->SetDeleteFunc(input_hash_delete_func);
|
||||||
stream->lastDict = new PDict(InputHash);
|
stream->lastDict = new PDict<InputHash>;
|
||||||
stream->lastDict->SetDeleteFunc(input_hash_delete_func);
|
stream->lastDict->SetDeleteFunc(input_hash_delete_func);
|
||||||
stream->want_record = ( want_record->InternalInt() == 1 );
|
stream->want_record = ( want_record->InternalInt() == 1 );
|
||||||
|
|
||||||
|
@ -1425,7 +1423,7 @@ void Manager::EndCurrentSend(ReaderFrontend* reader)
|
||||||
delete(stream->lastDict);
|
delete(stream->lastDict);
|
||||||
|
|
||||||
stream->lastDict = stream->currDict;
|
stream->lastDict = stream->currDict;
|
||||||
stream->currDict = new PDict(InputHash);
|
stream->currDict = new PDict<InputHash>;
|
||||||
stream->currDict->SetDeleteFunc(input_hash_delete_func);
|
stream->currDict->SetDeleteFunc(input_hash_delete_func);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
#include "Dict.h"
|
#include "Dict.h"
|
||||||
#include "Packet.h"
|
#include "Packet.h"
|
||||||
|
|
||||||
declare(PDict,BPF_Program);
|
|
||||||
|
|
||||||
namespace iosource {
|
namespace iosource {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -40,7 +40,7 @@ HashKey* TopkVal::GetHash(Val* v) const
|
||||||
|
|
||||||
TopkVal::TopkVal(uint64 arg_size) : OpaqueVal(topk_type)
|
TopkVal::TopkVal(uint64 arg_size) : OpaqueVal(topk_type)
|
||||||
{
|
{
|
||||||
elementDict = new PDict(Element);
|
elementDict = new PDict<Element>;
|
||||||
elementDict->SetDeleteFunc(topk_element_hash_delete_func);
|
elementDict->SetDeleteFunc(topk_element_hash_delete_func);
|
||||||
size = arg_size;
|
size = arg_size;
|
||||||
type = 0;
|
type = 0;
|
||||||
|
@ -51,7 +51,7 @@ TopkVal::TopkVal(uint64 arg_size) : OpaqueVal(topk_type)
|
||||||
|
|
||||||
TopkVal::TopkVal() : OpaqueVal(topk_type)
|
TopkVal::TopkVal() : OpaqueVal(topk_type)
|
||||||
{
|
{
|
||||||
elementDict = new PDict(Element);
|
elementDict = new PDict<Element>;
|
||||||
elementDict->SetDeleteFunc(topk_element_hash_delete_func);
|
elementDict->SetDeleteFunc(topk_element_hash_delete_func);
|
||||||
size = 0;
|
size = 0;
|
||||||
type = 0;
|
type = 0;
|
||||||
|
|
|
@ -33,8 +33,6 @@ struct Element {
|
||||||
~Element();
|
~Element();
|
||||||
};
|
};
|
||||||
|
|
||||||
declare(PDict, Element);
|
|
||||||
|
|
||||||
class TopkVal : public OpaqueVal {
|
class TopkVal : public OpaqueVal {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -168,7 +166,7 @@ private:
|
||||||
BroType* type;
|
BroType* type;
|
||||||
CompositeHash* hash;
|
CompositeHash* hash;
|
||||||
std::list<Bucket*> buckets;
|
std::list<Bucket*> buckets;
|
||||||
PDict(Element)* elementDict;
|
PDict<Element>* elementDict;
|
||||||
uint64 size; // how many elements are we tracking?
|
uint64 size; // how many elements are we tracking?
|
||||||
uint64 numElements; // how many elements do we have at the moment
|
uint64 numElements; // how many elements do we have at the moment
|
||||||
bool pruned; // was this data structure pruned?
|
bool pruned; // was this data structure pruned?
|
||||||
|
|
|
@ -1898,7 +1898,7 @@ function reading_traces%(%): bool
|
||||||
function global_sizes%(%): var_sizes
|
function global_sizes%(%): var_sizes
|
||||||
%{
|
%{
|
||||||
TableVal* sizes = new TableVal(var_sizes);
|
TableVal* sizes = new TableVal(var_sizes);
|
||||||
PDict(ID)* globals = global_scope()->Vars();
|
PDict<ID>* globals = global_scope()->Vars();
|
||||||
IterCookie* c = globals->InitForIteration();
|
IterCookie* c = globals->InitForIteration();
|
||||||
|
|
||||||
ID* id;
|
ID* id;
|
||||||
|
@ -1925,7 +1925,7 @@ function global_sizes%(%): var_sizes
|
||||||
function global_ids%(%): id_table
|
function global_ids%(%): id_table
|
||||||
%{
|
%{
|
||||||
TableVal* ids = new TableVal(id_table);
|
TableVal* ids = new TableVal(id_table);
|
||||||
PDict(ID)* globals = global_scope()->Vars();
|
PDict<ID>* globals = global_scope()->Vars();
|
||||||
IterCookie* c = globals->InitForIteration();
|
IterCookie* c = globals->InitForIteration();
|
||||||
|
|
||||||
ID* id;
|
ID* id;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue