mirror of
https://github.com/zeek/zeek.git
synced 2025-10-11 11:08:20 +00:00
Support namespaces / modules in bif. Checkpoint.
(now actually commiting all the files) This change is actually two-fold: a) bif's now accept module XYZ; statements and module::ID for function, const, event, enum, etc. declartation b) Added C++-namespaces to variables, functions, etc. that are declared in bif but accessed from C++ This required some (lightweight) re-factoring of the C++ codes. Note, event's don't have their own C++ namespace yet, since this would require a rather huge re-factoring. Compiles and passes test suite. New namespace feature not tested yet. Documentation to follow.
This commit is contained in:
parent
86fdd1dcf3
commit
f79ea244fa
31 changed files with 332 additions and 228 deletions
|
@ -85,7 +85,7 @@ UUID::UUID(const char* str)
|
|||
internal_error("invalid UUID string: %s", str);
|
||||
}
|
||||
|
||||
typedef map<UUID, BroEnum::dce_rpc_if_id> uuid_map_t;
|
||||
typedef map<UUID, BifEnum::dce_rpc_if_id> uuid_map_t;
|
||||
|
||||
static uuid_map_t& well_known_uuid_map()
|
||||
{
|
||||
|
@ -95,7 +95,7 @@ static uuid_map_t& well_known_uuid_map()
|
|||
if ( initialized )
|
||||
return the_map;
|
||||
|
||||
using namespace BroEnum;
|
||||
using namespace BifEnum;
|
||||
|
||||
the_map[UUID("e1af8308-5d1f-11c9-91a4-08002b14a0fa")] = DCE_RPC_epmapper;
|
||||
|
||||
|
@ -186,14 +186,14 @@ DCE_RPC_Header::DCE_RPC_Header(Analyzer* a, const u_char* b)
|
|||
else
|
||||
fragmented = 0;
|
||||
|
||||
ptype = (BroEnum::dce_rpc_ptype) bytes[2];
|
||||
ptype = (BifEnum::dce_rpc_ptype) bytes[2];
|
||||
frag_len = extract_uint16(LittleEndian(), bytes + 8);
|
||||
}
|
||||
|
||||
DCE_RPC_Session::DCE_RPC_Session(Analyzer* a)
|
||||
: analyzer(a),
|
||||
if_uuid("00000000-0000-0000-0000-000000000000"),
|
||||
if_id(BroEnum::DCE_RPC_unknown_if)
|
||||
if_id(BifEnum::DCE_RPC_unknown_if)
|
||||
{
|
||||
opnum = -1;
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ void DCE_RPC_Session::DeliverPDU(int is_orig, int len, const u_char* data)
|
|||
val_list* vl = new val_list;
|
||||
vl->append(analyzer->BuildConnVal());
|
||||
vl->append(new Val(is_orig, TYPE_BOOL));
|
||||
vl->append(new EnumVal(data[2], BroTypePtr::Enum::dce_rpc_ptype));
|
||||
vl->append(new EnumVal(data[2], BifTypePtr::Enum::dce_rpc_ptype));
|
||||
vl->append(new StringVal(len, (const char*) data));
|
||||
|
||||
analyzer->ConnectionEvent(dce_rpc_message, vl);
|
||||
|
@ -286,7 +286,7 @@ void DCE_RPC_Session::DeliverBind(const binpac::DCE_RPC_Simple::DCE_RPC_PDU* pdu
|
|||
// conn->Weird(fmt("Unknown DCE_RPC interface %s",
|
||||
// if_uuid.to_string()));
|
||||
#endif
|
||||
if_id = BroEnum::DCE_RPC_unknown_if;
|
||||
if_id = BifEnum::DCE_RPC_unknown_if;
|
||||
}
|
||||
else
|
||||
if_id = uuid_it->second;
|
||||
|
@ -296,7 +296,7 @@ void DCE_RPC_Session::DeliverBind(const binpac::DCE_RPC_Simple::DCE_RPC_PDU* pdu
|
|||
val_list* vl = new val_list;
|
||||
vl->append(analyzer->BuildConnVal());
|
||||
vl->append(new StringVal(if_uuid.to_string()));
|
||||
// vl->append(new EnumVal(if_id, BroTypePtr::Enum::dce_rpc_if_id));
|
||||
// vl->append(new EnumVal(if_id, BifTypePtr::Enum::dce_rpc_if_id));
|
||||
|
||||
analyzer->ConnectionEvent(dce_rpc_bind, vl);
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ void DCE_RPC_Session::DeliverRequest(const binpac::DCE_RPC_Simple::DCE_RPC_PDU*
|
|||
}
|
||||
|
||||
switch ( if_id ) {
|
||||
case BroEnum::DCE_RPC_epmapper:
|
||||
case BifEnum::DCE_RPC_epmapper:
|
||||
DeliverEpmapperRequest(pdu, req);
|
||||
break;
|
||||
|
||||
|
@ -345,7 +345,7 @@ void DCE_RPC_Session::DeliverResponse(const binpac::DCE_RPC_Simple::DCE_RPC_PDU*
|
|||
}
|
||||
|
||||
switch ( if_id ) {
|
||||
case BroEnum::DCE_RPC_epmapper:
|
||||
case BifEnum::DCE_RPC_epmapper:
|
||||
DeliverEpmapperResponse(pdu, resp);
|
||||
break;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue