mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
ID: Add conn_id_ctx
Seemed a bit unfortunate to use id::connection and id::conn_id, but then do something different for conn_id_ctx.
This commit is contained in:
parent
e231efac0b
commit
a2922cdde9
3 changed files with 7 additions and 6 deletions
|
@ -24,6 +24,7 @@
|
||||||
namespace zeek {
|
namespace zeek {
|
||||||
|
|
||||||
RecordTypePtr id::conn_id;
|
RecordTypePtr id::conn_id;
|
||||||
|
RecordTypePtr id::conn_id_ctx;
|
||||||
RecordTypePtr id::endpoint;
|
RecordTypePtr id::endpoint;
|
||||||
RecordTypePtr id::connection;
|
RecordTypePtr id::connection;
|
||||||
RecordTypePtr id::fa_file;
|
RecordTypePtr id::fa_file;
|
||||||
|
@ -81,6 +82,7 @@ FuncPtr id::find_func(std::string_view name) {
|
||||||
|
|
||||||
void id::detail::init_types() {
|
void id::detail::init_types() {
|
||||||
conn_id = id::find_type<RecordType>("conn_id");
|
conn_id = id::find_type<RecordType>("conn_id");
|
||||||
|
conn_id_ctx = id::find_type<RecordType>("conn_id_ctx");
|
||||||
endpoint = id::find_type<RecordType>("endpoint");
|
endpoint = id::find_type<RecordType>("endpoint");
|
||||||
connection = id::find_type<RecordType>("connection");
|
connection = id::find_type<RecordType>("connection");
|
||||||
fa_file = id::find_type<RecordType>("fa_file");
|
fa_file = id::find_type<RecordType>("fa_file");
|
||||||
|
|
1
src/ID.h
1
src/ID.h
|
@ -259,6 +259,7 @@ IntrusivePtr<T> find_const(std::string_view name) {
|
||||||
FuncPtr find_func(std::string_view name);
|
FuncPtr find_func(std::string_view name);
|
||||||
|
|
||||||
extern RecordTypePtr conn_id;
|
extern RecordTypePtr conn_id;
|
||||||
|
extern RecordTypePtr conn_id_ctx;
|
||||||
extern RecordTypePtr endpoint;
|
extern RecordTypePtr endpoint;
|
||||||
extern RecordTypePtr connection;
|
extern RecordTypePtr connection;
|
||||||
extern RecordTypePtr fa_file;
|
extern RecordTypePtr fa_file;
|
||||||
|
|
|
@ -54,18 +54,16 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
std::pair<int, int> GetConnCtxFieldOffsets() {
|
std::pair<int, int> GetConnCtxFieldOffsets() {
|
||||||
static const auto& conn_id_ctx = zeek::id::find_type<zeek::RecordType>("conn_id_ctx");
|
|
||||||
|
|
||||||
static int vlan_offset = -2;
|
static int vlan_offset = -2;
|
||||||
static int inner_vlan_offset = -2;
|
static int inner_vlan_offset = -2;
|
||||||
|
|
||||||
if ( vlan_offset == -2 && inner_vlan_offset == -2 ) {
|
if ( vlan_offset == -2 && inner_vlan_offset == -2 ) {
|
||||||
vlan_offset = conn_id_ctx->FieldOffset("vlan");
|
vlan_offset = id::conn_id_ctx->FieldOffset("vlan");
|
||||||
if ( vlan_offset < 0 || conn_id_ctx->GetFieldType(vlan_offset)->Tag() != TYPE_INT )
|
if ( vlan_offset < 0 || id::conn_id_ctx->GetFieldType(vlan_offset)->Tag() != TYPE_INT )
|
||||||
vlan_offset = -1;
|
vlan_offset = -1;
|
||||||
|
|
||||||
inner_vlan_offset = conn_id_ctx->FieldOffset("inner_vlan");
|
inner_vlan_offset = id::conn_id_ctx->FieldOffset("inner_vlan");
|
||||||
if ( inner_vlan_offset < 0 || conn_id_ctx->GetFieldType(inner_vlan_offset)->Tag() != TYPE_INT )
|
if ( inner_vlan_offset < 0 || id::conn_id_ctx->GetFieldType(inner_vlan_offset)->Tag() != TYPE_INT )
|
||||||
inner_vlan_offset = -1;
|
inner_vlan_offset = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue