Commit graph

6667 commits

Author SHA1 Message Date
Jon Siwek
c0b8fc4d60 Change TableVal::ToMap() to return ValPtr-indexed maps 2021-04-03 10:08:02 -07:00
Jon Siwek
583310f6dd Add std::hash specialization for IntrusivePtr 2021-04-03 10:08:02 -07:00
Jon Siwek
cffc8fa13c Move IntrusivePtr relational operators to zeek namespace
Otherwise some cases relying on argument-dependent lookup (ADL) fail.
2021-04-03 09:46:22 -07:00
Tim Wojtulewicz
d6116b0141 GH-1487: Handle error from ValueToVal instead of ignoring it 2021-04-02 13:11:01 -07:00
Jon Siwek
d57848828e Avoid a redundant set operation in ProfileFuncs::MergeInProfile() 2021-04-02 11:55:22 -07:00
Jon Siwek
5ffe25fca8 Use std::move() where possible in parse.y build_local()/build_global() 2021-04-02 11:38:25 -07:00
Vern Paxson
0b45ff2179 optionally hash original, not extended, form of records for profiling
profile types associated with global initializations
incorporate type name, if present, into type hash
2021-04-01 20:20:12 -07:00
Vern Paxson
9557029cf2 method to add a fully-qualified enum name (module name included) 2021-04-01 18:45:42 -07:00
Vern Paxson
341c284de9 enum types track whether they've had values added via "redef" 2021-04-01 18:38:58 -07:00
Vern Paxson
45004872e8 tracking of original size of records (pre redef'ing) 2021-04-01 17:38:31 -07:00
Vern Paxson
6e8baafeb9 Added TableVal::ToMap to retrieve a table's entire contents as a unordered_map 2021-04-01 17:33:37 -07:00
Vern Paxson
4aa73f6f7d micro whitespace nit 2021-04-01 17:33:03 -07:00
Vern Paxson
c92af1e542 factoring out some replicated code in the parser 2021-04-01 17:32:22 -07:00
Vern Paxson
9cdb51e283 some micro-preening of parse.y; no semantic changes 2021-04-01 16:30:48 -07:00
Vern Paxson
e1eb233bbd for readability, removed explicit scoping in parse.y; no semantic changes 2021-04-01 16:27:08 -07:00
Jon Siwek
be21843859 Add missing errno include to ProfileFunc.cc 2021-03-31 15:14:27 -07:00
Jon Siwek
bdadbabf18 Adjust GetAttrs() usage in ProfileFunc::PreExpr() to const-reference 2021-03-31 14:52:01 -07:00
Jon Siwek
dc9e7f6d03 Fix whitespace in ProfileFunc::PreExpr() 2021-03-31 14:50:45 -07:00
Jon Siwek
ccd27a3dfa Avoid redundant map/set searches in various ProfileFunc methods 2021-03-31 14:48:02 -07:00
Jon Siwek
ab1f1f8360 Improve detail::script_specific_filename()
- To handle relative paths that don't start with a '.'
- To handle getcwd() failures
2021-03-31 14:18:36 -07:00
Jon Siwek
d3261238dd Use std::string_view in p_hash() to avoid string copies 2021-03-31 13:22:50 -07:00
Jon Siwek
fb33597372 Merge branch 'master' into topic/vern/cpp-prep-profiling 2021-03-31 12:02:17 -07:00
Jon Siwek
a15d726f95 Change a <sys/errno.h> include to <errno.h>
Some systems (e.g. Alpine) may warn that that the former is incorrect.
2021-03-30 16:03:14 -07:00
Andrew Benson
2ad482535e Fix incomplete-type for struct timeval 2021-03-29 22:41:31 -05:00
Jon Siwek
c033bd20aa Merge remote-tracking branch 'origin/topic/vern/global-stmts'
* origin/topic/vern/global-stmts:
  whitespace adjustment
  "balance" tests with multiple Zeek scripts to load the same elements
  put global statements into a quasi-function to support script optimization
2021-03-29 15:42:43 -07:00
Dominik Charousset
27a39941db Add new Timer class to the telemetry API 2021-03-29 12:02:13 +02:00
Dominik Charousset
6e6b83bd96 Fix build with latest VectorVal API 2021-03-29 11:18:38 +02:00
Dominik Charousset
e476911075 Prefix telemetry BIFs with __ 2021-03-29 10:47:32 +02:00
Dominik Charousset
2bac354e43 Expose telemetry API to scripting land 2021-03-29 10:47:32 +02:00
Dominik Charousset
d4466db5ce Add handle types for histogram metrics 2021-03-29 10:47:32 +02:00
Dominik Charousset
0b665ee130 Move duplicated code to detail header 2021-03-29 10:47:32 +02:00
Dominik Charousset
2a21f2903a Adhere to Zeek coding style 2021-03-29 10:47:32 +02:00
Dominik Charousset
7c5c36959f Apply suggestions from code review
Co-authored-by: Jon Siwek <jsiwek@corelight.com>
2021-03-29 10:47:32 +02:00
Dominik Charousset
443f7f0a18 Add telemetry Manager to Zeek setup / teardown 2021-03-29 10:47:32 +02:00
Dominik Charousset
83d7d2da4c Add missing whitespaces for Zeek coding style 2021-03-29 10:47:32 +02:00
Dominik Charousset
59d114005e Add gauge metric types 2021-03-29 10:47:32 +02:00
Dominik Charousset
617e4137c6 Add scaffold for new metrics API with counters 2021-03-29 10:47:32 +02:00
Jon Siwek
43d9bda007 Fix sign-compare compiler warning in coerce_to_record() 2021-03-26 21:59:30 -07:00
Jon Siwek
db975ac08e Fix maybe-uninitialized warning in ZVal::ToVal()
Some compilers warn that 'v' may be used uninitialized but shouldn't be
the case in practice since all cases are handled, making it impossible.
2021-03-26 19:10:36 -07:00
Jon Siwek
7047eb92d8 Change RecordVal::GetFieldAs() to use std::vector::operator[]
Since the method claims it's up to the user to ensure the field exists
before calling, the extra bounds-checking done by std::vector::at()
isn't needed.
2021-03-26 19:02:24 -07:00
Jon Siwek
2855df63ce Add RecordVal::AssignField() and use it in supervisor code
This is a convenience method to assign a known record field value by
field name.  May also be useful to reduce warnings from static analysis
(e.g. Coverity) about not checking for negative return values before
assigning since that now flows through a [[noreturn]] error path.
2021-03-26 18:57:42 -07:00
Jon Siwek
a0859276bf Merge remote-tracking branch 'origin/topic/timw/analyzer-crash'
* origin/topic/timw/analyzer-crash:
  Fix crash in Analyzer::ForwardPacket due to recursive analyzer calls.
2021-03-26 16:40:12 -07:00
Vern Paxson
297adf3486 function profiling rewritten - more detailed info, supports global profiling 2021-03-25 16:17:32 -07:00
Vern Paxson
bb3a69ebb3 track whether a given function/body should be included/skipped for optimization 2021-03-25 16:16:34 -07:00
Tim Wojtulewicz
4015beb732 Fix crash in Analyzer::ForwardPacket due to recursive analyzer calls.
The change in 44f558df7b that made analyzer_list
a std::vector instead of a std::list doesn't take into account that in some
cases an analyzer may chain back into itself, such as with UDP-in-UDP tunnels.
In these cases, the second call to ForwardPacket may cause iterator
invalidation, leading to a crash.
2021-03-25 08:45:38 -07:00
Vern Paxson
e5a0b2c04c whitespace adjustment 2021-03-24 21:52:20 -07:00
Vern Paxson
95b89be571 put global statements into a quasi-function to support script optimization 2021-03-24 21:22:03 -07:00
Vern Paxson
a2e7dd82c4 removal of vestigial #include's (breaking an include loop in the process) 2021-03-24 15:15:19 -07:00
Vern Paxson
3e07564fb9 better method name: HasCopySemantics() 2021-03-24 15:03:03 -07:00
Vern Paxson
a7fcc7a5d8 Use STL functionality to initialize coercion map 2021-03-24 15:03:03 -07:00