mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 18:48:20 +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
|
@ -448,6 +448,7 @@ public:
|
|||
int HasField(const char* field) const;
|
||||
BroType* FieldType(const char* field) const;
|
||||
BroType* FieldType(int field) const;
|
||||
Val* FieldDefault(int field) const; // Ref's the returned value; 0 if none.
|
||||
|
||||
// A field's offset is its position in the type_decl_list,
|
||||
// starting at 0. Returns negative if the field doesn't exist.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue