diff --git a/src/DFA.h b/src/DFA.h index 1b58774da0..7e17f9a1a8 100644 --- a/src/DFA.h +++ b/src/DFA.h @@ -105,10 +105,8 @@ private: int hits; // Statistics int misses; - declare(PDict,CacheEntry); - // Hash indexed by NFA states (MD5s of them, actually). - PDict(CacheEntry) states; + PDict states; }; class DFA_Machine : public BroObj { diff --git a/src/DNS_Mgr.h b/src/DNS_Mgr.h index 7ef84eb848..96e73779e8 100644 --- a/src/DNS_Mgr.h +++ b/src/DNS_Mgr.h @@ -28,8 +28,6 @@ typedef PList DNS_mgr_request_list; struct nb_dns_info; struct nb_dns_result; -declare(PDict,ListVal); - class DNS_Mapping; enum DNS_MgrMode { @@ -143,7 +141,7 @@ protected: DNS_MgrMode mode; - PDict(ListVal) services; + PDict services; HostMap host_mappings; AddrMap addr_mappings; diff --git a/src/Debug.cc b/src/Debug.cc index bf23ff105b..1c0ac13174 100644 --- a/src/Debug.cc +++ b/src/Debug.cc @@ -27,7 +27,7 @@ using namespace std; bool g_policy_debug = false; DebuggerState g_debugger_state; TraceState g_trace_state; -PDict(Filemap) g_dbgfilemaps; +PDict g_dbgfilemaps; // 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 diff --git a/src/Debug.h b/src/Debug.h index 89884cfb0b..1ad462f166 100644 --- a/src/Debug.h +++ b/src/Debug.h @@ -31,7 +31,6 @@ struct ParseLocationRec { class StmtLocMapping; declare(PQueue,StmtLocMapping); typedef PQueue(StmtLocMapping) Filemap; // mapping for a single file -declare(PDict,Filemap); class DbgBreakpoint; 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 PDict(Filemap) g_dbgfilemaps; // filename => filemap +extern PDict g_dbgfilemaps; // filename => filemap // Perhaps add a code/priority argument to do selective output. int debug_msg(const char* fmt, ...) __attribute__ ((format (printf, 1, 2))); diff --git a/src/DebugCmds.cc b/src/DebugCmds.cc index d11efb0390..863a35a2f8 100644 --- a/src/DebugCmds.cc +++ b/src/DebugCmds.cc @@ -51,7 +51,7 @@ void lookup_global_symbols_regex(const string& orig_regex, vector& matches, } Scope* global = global_scope(); - PDict(ID)* syms = global->Vars(); + PDict* syms = global->Vars(); ID* nextid; IterCookie* cookie = syms->InitForIteration(); diff --git a/src/EventRegistry.h b/src/EventRegistry.h index d1bb650beb..2a570dd8bc 100644 --- a/src/EventRegistry.h +++ b/src/EventRegistry.h @@ -37,8 +37,7 @@ public: void PrintDebug(); private: - declare(PDict, EventHandler); - typedef PDict(EventHandler) handler_map; + typedef PDict handler_map; handler_map handlers; }; diff --git a/src/RE.h b/src/RE.h index 8799bd8c36..3ea84636b4 100644 --- a/src/RE.h +++ b/src/RE.h @@ -22,9 +22,6 @@ class Specific_RE_Matcher; class RE_Matcher; class DFA_State; -declare(PDict,char); -declare(PDict,CCL); - extern int case_insensitive; extern CCL* curr_ccl; extern NFA_Machine* nfa; @@ -122,8 +119,8 @@ protected: int multiline; char* pattern_text; - PDict(char) defs; - PDict(CCL) ccl_dict; + PDict defs; + PDict ccl_dict; PList ccl_list; EquivClass equiv_class; int* ecs; diff --git a/src/Rule.h b/src/Rule.h index 1d1416c933..0ac29d07fc 100644 --- a/src/Rule.h +++ b/src/Rule.h @@ -15,9 +15,7 @@ class RuleHdrTest; class Rule; typedef PList rule_list; - -declare(PDict, Rule); -typedef PDict(Rule) rule_dict; +typedef PDict rule_dict; class Rule { public: diff --git a/src/Scope.cc b/src/Scope.cc index fa0f467e71..c02b4c2b24 100644 --- a/src/Scope.cc +++ b/src/Scope.cc @@ -19,7 +19,7 @@ Scope::Scope(ID* id, attr_list* al) attrs = al; return_type = 0; - local = new PDict(ID)(ORDERED); + local = new PDict(ORDERED); inits = new id_list; if ( id ) @@ -108,7 +108,7 @@ void Scope::Describe(ODesc* d) const TraversalCode Scope::Traverse(TraversalCallback* cb) const { - PDict(ID)* ids = GetIDs(); + PDict* ids = GetIDs(); IterCookie* iter = ids->InitForIteration(); HashKey* key; diff --git a/src/Scope.h b/src/Scope.h index 5fcd31fd8b..4dfb9bb0e5 100644 --- a/src/Scope.h +++ b/src/Scope.h @@ -15,8 +15,6 @@ class ID; class BroType; class ListVal; -declare(PDict,ID); - class Scope : public BroObj { public: explicit Scope(ID* id, attr_list* al); @@ -35,11 +33,11 @@ public: BroType* ReturnType() const { return return_type; } int Length() const { return local->Length(); } - PDict(ID)* Vars() const { return local; } + PDict* Vars() const { return local; } ID* GenerateTemporary(const char* name); - PDict(ID)* GetIDs() const { return local; } + PDict* GetIDs() const { return local; } // Returns the list of variables needing initialization, and // removes it from this Scope. @@ -56,7 +54,7 @@ protected: ID* scope_id; attr_list* attrs; BroType* return_type; - PDict(ID)* local; + PDict* local; id_list* inits; }; diff --git a/src/Sessions.h b/src/Sessions.h index 27b0ab474c..74a4d2c992 100644 --- a/src/Sessions.h +++ b/src/Sessions.h @@ -20,9 +20,6 @@ class Connection; class ConnCompressor; struct ConnID; -declare(PDict,Connection); -declare(PDict,FragReassembler); - class Discarder; class PacketFilter; @@ -216,10 +213,10 @@ protected: const Packet *pkt, const EncapsulationStack* encap); CompositeHash* ch; - PDict(Connection) tcp_conns; - PDict(Connection) udp_conns; - PDict(Connection) icmp_conns; - PDict(FragReassembler) fragments; + PDict tcp_conns; + PDict udp_conns; + PDict icmp_conns; + PDict fragments; typedef pair IPPair; typedef pair TunnelActivity; diff --git a/src/Stats.cc b/src/Stats.cc index 9489f12f93..674c2fb50c 100644 --- a/src/Stats.cc +++ b/src/Stats.cc @@ -239,7 +239,7 @@ void ProfileLogger::Log() // Script-level state. unsigned int size, mem = 0; - PDict(ID)* globals = global_scope()->Vars(); + PDict* globals = global_scope()->Vars(); if ( expensive ) { diff --git a/src/Stmt.cc b/src/Stmt.cc index 913fe31573..a3c95b4a90 100644 --- a/src/Stmt.cc +++ b/src/Stmt.cc @@ -1147,7 +1147,7 @@ Val* ForStmt::DoExec(Frame* f, Val* v, stmt_flow_type& flow) const if ( v->Type()->Tag() == TYPE_TABLE ) { TableVal* tv = v->AsTableVal(); - const PDict(TableEntryVal)* loop_vals = tv->AsTable(); + const PDict* loop_vals = tv->AsTable(); if ( ! loop_vals->Length() ) return 0; diff --git a/src/Stmt.h b/src/Stmt.h index 2042c008b5..0fc6b437c1 100644 --- a/src/Stmt.h +++ b/src/Stmt.h @@ -17,8 +17,6 @@ class StmtList; class ForStmt; -declare(PDict, int); - class Stmt : public BroObj { public: BroStmtTag Tag() const { return tag; } @@ -237,7 +235,7 @@ protected: case_list* cases; int default_case_idx; CompositeHash* comp_hash; - PDict(int) case_label_value_map; + PDict case_label_value_map; std::vector> case_label_type_list; }; diff --git a/src/Val.cc b/src/Val.cc index 32d64c5cdd..c7281a781f 100644 --- a/src/Val.cc +++ b/src/Val.cc @@ -956,7 +956,7 @@ void TableVal::Init(TableType* t) subnets = 0; table_hash = new CompositeHash(table_type->Indices()); - val.table_val = new PDict(TableEntryVal); + val.table_val = new PDict; val.table_val->SetDeleteFunc(table_entry_val_delete_func); } @@ -979,7 +979,7 @@ void TableVal::RemoveAll() { // Here we take the brute force approach. delete AsTable(); - val.table_val = new PDict(TableEntryVal); + val.table_val = new PDict; val.table_val->SetDeleteFunc(table_entry_val_delete_func); } @@ -992,7 +992,7 @@ int TableVal::RecursiveSize() const != TYPE_TABLE ) return n; - PDict(TableEntryVal)* v = val.table_val; + PDict* v = val.table_val; IterCookie* c = v->InitForIteration(); TableEntryVal* tv; @@ -1130,7 +1130,7 @@ int TableVal::AddTo(Val* val, int is_first_init, bool propagate_ops) const return 0; } - const PDict(TableEntryVal)* tbl = AsTable(); + const PDict* tbl = AsTable(); IterCookie* c = tbl->InitForIteration(); HashKey* k; @@ -1178,7 +1178,7 @@ int TableVal::RemoveFrom(Val* val) const return 0; } - const PDict(TableEntryVal)* tbl = AsTable(); + const PDict* tbl = AsTable(); IterCookie* c = tbl->InitForIteration(); HashKey* k; @@ -1200,14 +1200,14 @@ TableVal* TableVal::Intersect(const TableVal* tv) const { TableVal* result = new TableVal(table_type); - const PDict(TableEntryVal)* t0 = AsTable(); - const PDict(TableEntryVal)* t1 = tv->AsTable(); - PDict(TableEntryVal)* t2 = result->AsNonConstTable(); + const PDict* t0 = AsTable(); + const PDict* t1 = tv->AsTable(); + PDict* t2 = result->AsNonConstTable(); // Figure out which is smaller; assign it to t1. if ( t1->Length() > t0->Length() ) { // Swap. - const PDict(TableEntryVal)* tmp = t1; + const PDict* tmp = t1; t1 = t0; t0 = tmp; } @@ -1229,8 +1229,8 @@ TableVal* TableVal::Intersect(const TableVal* tv) const bool TableVal::EqualTo(const TableVal* tv) const { - const PDict(TableEntryVal)* t0 = AsTable(); - const PDict(TableEntryVal)* t1 = tv->AsTable(); + const PDict* t0 = AsTable(); + const PDict* t1 = tv->AsTable(); if ( t0->Length() != t1->Length() ) return false; @@ -1256,8 +1256,8 @@ bool TableVal::EqualTo(const TableVal* tv) const bool TableVal::IsSubsetOf(const TableVal* tv) const { - const PDict(TableEntryVal)* t0 = AsTable(); - const PDict(TableEntryVal)* t1 = tv->AsTable(); + const PDict* t0 = AsTable(); + const PDict* t1 = tv->AsTable(); if ( t0->Length() > t1->Length() ) return false; @@ -1437,7 +1437,7 @@ Val* TableVal::Lookup(Val* index, bool use_default_val) return def; } - const PDict(TableEntryVal)* tbl = AsTable(); + const PDict* tbl = AsTable(); if ( tbl->Length() > 0 ) { @@ -1582,7 +1582,7 @@ ListVal* TableVal::ConvertToList(TypeTag t) const { ListVal* l = new ListVal(t); - const PDict(TableEntryVal)* tbl = AsTable(); + const PDict* tbl = AsTable(); IterCookie* c = tbl->InitForIteration(); HashKey* k; @@ -1623,7 +1623,7 @@ ListVal* TableVal::ConvertToPureList() const void TableVal::Describe(ODesc* d) const { - const PDict(TableEntryVal)* tbl = AsTable(); + const PDict* tbl = AsTable(); int n = tbl->Length(); if ( d->IsBinary() || d->IsPortable() ) @@ -1767,7 +1767,7 @@ void TableVal::DoExpire(double t) if ( ! type ) return; // FIX ME ### - PDict(TableEntryVal)* tbl = AsNonConstTable(); + PDict* tbl = AsNonConstTable(); double timeout = GetExpireTime(); @@ -1952,7 +1952,7 @@ Val* TableVal::DoClone(CloneState* state) auto tv = new TableVal(table_type); state->NewClone(this, tv); - const PDict(TableEntryVal)* tbl = AsTable(); + const PDict* tbl = AsTable(); IterCookie* cookie = tbl->InitForIteration(); HashKey* key; @@ -2001,7 +2001,7 @@ unsigned int TableVal::MemoryAllocation() const { unsigned int size = 0; - PDict(TableEntryVal)* v = val.table_val; + PDict* v = val.table_val; IterCookie* c = v->InitForIteration(); TableEntryVal* tv; diff --git a/src/Val.h b/src/Val.h index 2ce61100b5..9074dc0e7a 100644 --- a/src/Val.h +++ b/src/Val.h @@ -55,7 +55,6 @@ class StateAccess; class VectorVal; class TableEntryVal; -declare(PDict,TableEntryVal); typedef union { // Used for bool, int, enum. @@ -77,7 +76,7 @@ typedef union { Func* func_val; BroFile* file_val; RE_Matcher* re_val; - PDict(TableEntryVal)* table_val; + PDict* table_val; val_list* val_list_val; vector* vector_val; @@ -228,7 +227,7 @@ public: CONST_ACCESSOR2(TYPE_ENUM, int, int_val, AsEnum) CONST_ACCESSOR(TYPE_STRING, BroString*, string_val, AsString) CONST_ACCESSOR(TYPE_FUNC, Func*, func_val, AsFunc) - CONST_ACCESSOR(TYPE_TABLE, PDict(TableEntryVal)*, table_val, AsTable) + CONST_ACCESSOR(TYPE_TABLE, PDict*, table_val, AsTable) CONST_ACCESSOR(TYPE_RECORD, val_list*, val_list_val, AsRecord) CONST_ACCESSOR(TYPE_FILE, BroFile*, file_val, AsFile) CONST_ACCESSOR(TYPE_PATTERN, RE_Matcher*, re_val, AsPattern) @@ -396,7 +395,7 @@ protected: #endif } - ACCESSOR(TYPE_TABLE, PDict(TableEntryVal)*, table_val, AsNonConstTable) + ACCESSOR(TYPE_TABLE, PDict*, table_val, AsNonConstTable) ACCESSOR(TYPE_RECORD, val_list*, val_list_val, AsNonConstRecord) // For internal use by the Val::Clone() methods. diff --git a/src/analyzer/protocol/rpc/RPC.h b/src/analyzer/protocol/rpc/RPC.h index 40c65a00d4..225c2c8cd4 100644 --- a/src/analyzer/protocol/rpc/RPC.h +++ b/src/analyzer/protocol/rpc/RPC.h @@ -99,8 +99,6 @@ protected: Val* v; // single (perhaps compound) value corresponding to call }; -declare(PDict,RPC_CallInfo); - class RPC_Interpreter { public: explicit RPC_Interpreter(analyzer::Analyzer* analyzer); @@ -125,7 +123,7 @@ protected: void Weird(const char* name, const char* addl = ""); - PDict(RPC_CallInfo) calls; + PDict calls; analyzer::Analyzer* analyzer; }; diff --git a/src/analyzer/protocol/stepping-stone/SteppingStone.h b/src/analyzer/protocol/stepping-stone/SteppingStone.h index b9ebd1ff8b..d4ced61551 100644 --- a/src/analyzer/protocol/stepping-stone/SteppingStone.h +++ b/src/analyzer/protocol/stepping-stone/SteppingStone.h @@ -14,7 +14,6 @@ class SteppingStoneEndpoint; class SteppingStoneManager; declare(PQueue,SteppingStoneEndpoint); -declare(PDict,SteppingStoneEndpoint); class SteppingStoneEndpoint : public BroObj { public: @@ -41,8 +40,8 @@ protected: // no LOOP in Bro language. int stp_id; HashKey* stp_key; - PDict(SteppingStoneEndpoint) stp_inbound_endps; - PDict(SteppingStoneEndpoint) stp_outbound_endps; + PDict stp_inbound_endps; + PDict stp_outbound_endps; }; class SteppingStone_Analyzer : public tcp::TCP_ApplicationAnalyzer { diff --git a/src/broker/messaging.bif b/src/broker/messaging.bif index 6c873c863a..06eae5068b 100644 --- a/src/broker/messaging.bif +++ b/src/broker/messaging.bif @@ -28,7 +28,7 @@ std::set val_to_topic_set(Val* val) rval.emplace(val->AsString()->CheckString()); else { - const PDict(TableEntryVal)* tbl = val->AsTable(); + const PDict* tbl = val->AsTable(); if ( tbl->Length() == 0 ) return rval; diff --git a/src/file_analysis/AnalyzerSet.h b/src/file_analysis/AnalyzerSet.h index 3cbe5b1898..032257f29e 100644 --- a/src/file_analysis/AnalyzerSet.h +++ b/src/file_analysis/AnalyzerSet.h @@ -14,7 +14,6 @@ namespace file_analysis { class File; -declare(PDict,Analyzer); /** * 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 */ CompositeHash* analyzer_hash; /**< AnalyzerArgs hashes. */ - PDict(file_analysis::Analyzer) analyzer_map; /**< Indexed by AnalyzerArgs. */ + PDict analyzer_map; /**< Indexed by AnalyzerArgs. */ /** * Abstract base class for analyzer set modifications. diff --git a/src/file_analysis/Manager.h b/src/file_analysis/Manager.h index fe3328b679..67f84134ec 100644 --- a/src/file_analysis/Manager.h +++ b/src/file_analysis/Manager.h @@ -26,9 +26,6 @@ namespace file_analysis { -declare(PDict,bool); -declare(PDict,File); - /** * Main entry point for interacting with file analysis. */ @@ -339,8 +336,8 @@ public: protected: friend class FileTimer; - typedef PDict(bool) IDSet; - typedef PDict(File) IDMap; + typedef PDict IDSet; + typedef PDict IDMap; /** * 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); - PDict(File) id_map; /**< Map file ID to file_analysis::File records. */ - PDict(bool) ignored; /**< Ignored files. Will be finally removed on EOF. */ + PDict id_map; /**< Map file ID to file_analysis::File records. */ + PDict ignored; /**< Ignored files. Will be finally removed on EOF. */ string current_file_id; /**< Hash of what get_file_handle event sets. */ RuleFileMagicState* magic_state; /**< File magic signature match state. */ MIMEMap mime_types;/**< Mapping of MIME types to analyzers. */ diff --git a/src/input/Manager.cc b/src/input/Manager.cc index 34e8960193..c946e4ff10 100644 --- a/src/input/Manager.cc +++ b/src/input/Manager.cc @@ -52,8 +52,6 @@ static void input_hash_delete_func(void* val) delete h; } -declare(PDict, InputHash); - /** * Base stuff that every stream can do. */ @@ -109,8 +107,8 @@ public: RecordType* rtype; RecordType* itype; - PDict(InputHash)* currDict; - PDict(InputHash)* lastDict; + PDict* currDict; + PDict* lastDict; Func* pred; @@ -703,9 +701,9 @@ bool Manager::CreateTableStream(RecordVal* fval) stream->itype = idx->AsRecordType(); stream->event = event ? event_registry->Lookup(event->Name()) : 0; stream->error_event = error_event ? event_registry->Lookup(error_event->Name()) : nullptr; - stream->currDict = new PDict(InputHash); + stream->currDict = new PDict; stream->currDict->SetDeleteFunc(input_hash_delete_func); - stream->lastDict = new PDict(InputHash); + stream->lastDict = new PDict; stream->lastDict->SetDeleteFunc(input_hash_delete_func); stream->want_record = ( want_record->InternalInt() == 1 ); @@ -1425,7 +1423,7 @@ void Manager::EndCurrentSend(ReaderFrontend* reader) delete(stream->lastDict); stream->lastDict = stream->currDict; - stream->currDict = new PDict(InputHash); + stream->currDict = new PDict; stream->currDict->SetDeleteFunc(input_hash_delete_func); #ifdef DEBUG diff --git a/src/iosource/PktSrc.h b/src/iosource/PktSrc.h index 7efecfb0bf..927ff3be90 100644 --- a/src/iosource/PktSrc.h +++ b/src/iosource/PktSrc.h @@ -10,8 +10,6 @@ #include "Dict.h" #include "Packet.h" -declare(PDict,BPF_Program); - namespace iosource { /** diff --git a/src/probabilistic/Topk.cc b/src/probabilistic/Topk.cc index 8ff158e10d..e43d27a70f 100644 --- a/src/probabilistic/Topk.cc +++ b/src/probabilistic/Topk.cc @@ -40,7 +40,7 @@ HashKey* TopkVal::GetHash(Val* v) const TopkVal::TopkVal(uint64 arg_size) : OpaqueVal(topk_type) { - elementDict = new PDict(Element); + elementDict = new PDict; elementDict->SetDeleteFunc(topk_element_hash_delete_func); size = arg_size; type = 0; @@ -51,7 +51,7 @@ TopkVal::TopkVal(uint64 arg_size) : OpaqueVal(topk_type) TopkVal::TopkVal() : OpaqueVal(topk_type) { - elementDict = new PDict(Element); + elementDict = new PDict; elementDict->SetDeleteFunc(topk_element_hash_delete_func); size = 0; type = 0; diff --git a/src/probabilistic/Topk.h b/src/probabilistic/Topk.h index 24d05e12af..cf79b6292c 100644 --- a/src/probabilistic/Topk.h +++ b/src/probabilistic/Topk.h @@ -33,8 +33,6 @@ struct Element { ~Element(); }; -declare(PDict, Element); - class TopkVal : public OpaqueVal { public: @@ -168,7 +166,7 @@ private: BroType* type; CompositeHash* hash; std::list buckets; - PDict(Element)* elementDict; + PDict* elementDict; uint64 size; // how many elements are we tracking? uint64 numElements; // how many elements do we have at the moment bool pruned; // was this data structure pruned? diff --git a/src/zeek.bif b/src/zeek.bif index da11a18681..55d41948cd 100644 --- a/src/zeek.bif +++ b/src/zeek.bif @@ -1898,7 +1898,7 @@ function reading_traces%(%): bool function global_sizes%(%): var_sizes %{ TableVal* sizes = new TableVal(var_sizes); - PDict(ID)* globals = global_scope()->Vars(); + PDict* globals = global_scope()->Vars(); IterCookie* c = globals->InitForIteration(); ID* id; @@ -1925,7 +1925,7 @@ function global_sizes%(%): var_sizes function global_ids%(%): id_table %{ TableVal* ids = new TableVal(id_table); - PDict(ID)* globals = global_scope()->Vars(); + PDict* globals = global_scope()->Vars(); IterCookie* c = globals->InitForIteration(); ID* id;