Deprecate global Val pointers in NetVar.h

All of these have fairly niche uses, so better maintained as
lookup/static closer to the usage site.
This commit is contained in:
Jon Siwek 2020-05-12 00:01:40 -07:00
parent c0986f0739
commit d34b24e776
13 changed files with 83 additions and 49 deletions

View file

@ -42,9 +42,11 @@ TCP_Reassembler::TCP_Reassembler(analyzer::Analyzer* arg_dst_analyzer,
if ( ::tcp_contents )
{
static auto tcp_content_delivery_ports_orig = zeek::lookup_val<TableVal>("tcp_content_delivery_ports_orig");
static auto tcp_content_delivery_ports_resp = zeek::lookup_val<TableVal>("tcp_content_delivery_ports_resp");
const auto& dst_port_val = val_mgr->Port(ntohs(tcp_analyzer->Conn()->RespPort()),
TRANSPORT_TCP);
TableVal* ports = IsOrig() ?
const auto& ports = IsOrig() ?
tcp_content_delivery_ports_orig :
tcp_content_delivery_ports_resp;
auto result = ports->Lookup(dst_port_val.get());