mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 00:28:21 +00:00
New BiF record_field_vals() that returns the fields of a record in a
table with meta-information. Example: type r: record { a: count; b: string &default="Foo"; c: double &optional; d: string &log; }; event bro_init() { local x: r = [$a=42, $d="Bar"]; print record_fields(x); } This prints: { [a] = [type_name=record, log=F, value=42, default_val=<uninitialized>] [b] = [type_name=record, log=F, value=<uninitialized>, default_val=Foo], [c] = [type_name=record, log=F, value=<uninitialized>, default_val=<uninitialized>], [d] = [type_name=record, log=T, value=Bar, default_val=<uninitialized>], } This is one more step in Seth's quest for full inspection support. :-)
This commit is contained in:
parent
cdd8827cc4
commit
8bacb6eb3d
9 changed files with 99 additions and 9 deletions
|
@ -183,6 +183,17 @@ type script_id: record {
|
|||
value: any &optional;
|
||||
};
|
||||
|
||||
type id_table: table[string] of script_id;
|
||||
|
||||
type record_field: record {
|
||||
type_name: string;
|
||||
log: bool;
|
||||
value: any &optional;
|
||||
default_val: any &optional;
|
||||
};
|
||||
|
||||
type record_field_table: table[string] of record_field;
|
||||
|
||||
# The following two variables are defined here until the core is not
|
||||
# dependent on the names remaining as they are now.
|
||||
## This is the list of capture filters indexed by some user-definable ID.
|
||||
|
@ -190,8 +201,6 @@ global capture_filters: table[string] of string &redef;
|
|||
## This is the list of restriction filters indexed by some user-definable ID.
|
||||
global restrict_filters: table[string] of string &redef;
|
||||
|
||||
type id_table: table[string] of script_id;
|
||||
|
||||
# {precompile,install}_pcap_filter identify the filter by IDs
|
||||
type PcapFilterID: enum { None };
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue