Merge remote-tracking branch 'origin/topic/vern/event-trace'

* origin/topic/vern/event-trace:
  low-level style tweaks
  --event-trace / -E option to generate event trace
  hooks to support event tracing
  classes providing event-tracing/dumping functionality
  provide access to Val internals for event tracing purposes
  set_network_time() BiF in support of event replaying
  low-level naming tweaks / comments / const-ified accessor
This commit is contained in:
Tim Wojtulewicz 2022-03-25 15:31:21 -07:00
commit fe935a572f
15 changed files with 1646 additions and 19 deletions

View file

@ -47,6 +47,7 @@ class PrefixTable;
class CompositeHash;
class HashKey;
class ValTrace;
class ZBody;
} // namespace detail
@ -1380,6 +1381,7 @@ public:
static void DoneParsing();
protected:
friend class zeek::detail::ValTrace;
friend class zeek::detail::ZBody;
RecordValPtr DoCoerceTo(RecordTypePtr other, bool allow_orphaning) const;
@ -1401,9 +1403,9 @@ protected:
record_val->emplace_back(std::nullopt);
}
// For use by low-level ZAM instructions. Caller assumes
// responsibility for memory management. The first version
// allows manipulation of whether the field is present at all.
// For internal use by low-level ZAM instructions and event tracing.
// Caller assumes responsibility for memory management. The first
// version allows manipulation of whether the field is present at all.
// The second version ensures that the optional value is present.
std::optional<ZVal>& RawOptField(int field) { return (*record_val)[field]; }
@ -1614,10 +1616,13 @@ public:
}
const String* StringAt(unsigned int index) const { return StringValAt(index)->AsString(); }
// Only intended for low-level access by compiled code.
// Only intended for low-level access by internal or compiled code.
const auto& RawVec() const { return vector_val; }
auto& RawVec() { return vector_val; }
const auto& RawYieldType() const { return yield_type; }
const auto& RawYieldTypes() const { return yield_types; }
protected:
/**
* Returns the element at a given index or nullptr if it does not exist.