diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9f641baa65..ebf801e617 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -287,7 +287,7 @@ set(MAIN_SRCS ScriptCoverageManager.cc SerializationFormat.cc Session.cc - Sessions.cc + SessionManager.cc SmithWaterman.cc Stats.cc Stmt.cc diff --git a/src/Conn.cc b/src/Conn.cc index 1755c9150c..3fd5e32f29 100644 --- a/src/Conn.cc +++ b/src/Conn.cc @@ -10,7 +10,7 @@ #include "zeek/RunState.h" #include "zeek/NetVar.h" #include "zeek/Event.h" -#include "zeek/Sessions.h" +#include "zeek/SessionManager.h" #include "zeek/Reporter.h" #include "zeek/Timer.h" #include "zeek/iosource/IOSource.h" @@ -25,12 +25,11 @@ namespace zeek { uint64_t Connection::total_connections = 0; uint64_t Connection::current_connections = 0; -Connection::Connection(NetSessions* s, const detail::ConnIDKey& k, double t, +Connection::Connection(const detail::ConnIDKey& k, double t, const ConnID* id, uint32_t flow, const Packet* pkt) : Session(t, connection_timeout, connection_status_update, detail::connection_status_update_interval) { - sessions = s; key = k; key_valid = true; @@ -137,7 +136,7 @@ void Connection::Done() analyzer::tcp::TCP_Endpoint* to = ta->Orig(); analyzer::tcp::TCP_Endpoint* tr = ta->Resp(); - sessions->tcp_stats.StateLeft(to->state, tr->state); + session_mgr->tcp_stats.StateLeft(to->state, tr->state); } finished = 1; diff --git a/src/Conn.h b/src/Conn.h index c8a8b287cd..6d3e422a81 100644 --- a/src/Conn.h +++ b/src/Conn.h @@ -25,7 +25,7 @@ namespace zeek { class Connection; -class NetSessions; +class SessionManager; class EncapsulationStack; class Val; class RecordVal; @@ -73,7 +73,7 @@ static inline int addr_port_canon_lt(const IPAddr& addr1, uint32_t p1, class Connection final : public Session { public: - Connection(NetSessions* s, const detail::ConnIDKey& k, double t, const ConnID* id, + Connection(const detail::ConnIDKey& k, double t, const ConnID* id, uint32_t flow, const Packet* pkt); ~Connection() override; @@ -247,8 +247,6 @@ protected: // Allow other classes to access pointers to these: friend class detail::SessionTimer; - NetSessions* sessions; - IPAddr orig_addr; IPAddr resp_addr; uint32_t orig_port, resp_port; // in network order diff --git a/src/Frag.cc b/src/Frag.cc index d7bd2e04d8..4484c791dc 100644 --- a/src/Frag.cc +++ b/src/Frag.cc @@ -6,7 +6,7 @@ #include "zeek/Hash.h" #include "zeek/IP.h" #include "zeek/NetVar.h" -#include "zeek/Sessions.h" +#include "zeek/SessionManager.h" #include "zeek/Reporter.h" #include "zeek/RunState.h" @@ -29,7 +29,7 @@ void FragTimer::Dispatch(double t, bool /* is_expire */) reporter->InternalWarning("fragment timer dispatched w/o reassembler"); } -FragReassembler::FragReassembler(NetSessions* arg_s, +FragReassembler::FragReassembler(SessionManager* arg_s, const std::unique_ptr& ip, const u_char* pkt, const FragReassemblerKey& k, double t) : Reassembler(0, REASSEM_FRAG) @@ -355,7 +355,7 @@ FragReassembler* FragmentManager::NextFragment(double t, const std::unique_ptr max_fragments ) max_fragments = fragments.size(); diff --git a/src/Frag.h b/src/Frag.h index 32ca8176ca..faafd468fe 100644 --- a/src/Frag.h +++ b/src/Frag.h @@ -12,7 +12,7 @@ namespace zeek { -class NetSessions; +class SessionManager; class IP_Hdr; namespace detail { @@ -24,7 +24,7 @@ using FragReassemblerKey = std::tuple; class FragReassembler : public Reassembler { public: - FragReassembler(NetSessions* s, const std::unique_ptr& ip, const u_char* pkt, + FragReassembler(SessionManager* s, const std::unique_ptr& ip, const u_char* pkt, const FragReassemblerKey& k, double t); ~FragReassembler() override; @@ -44,7 +44,7 @@ protected: u_char* proto_hdr; std::unique_ptr reassembled_pkt; - NetSessions* s; + SessionManager* s; uint64_t frag_size; // size of fully reassembled fragment FragReassemblerKey key; uint16_t next_proto; // first IPv6 fragment header's next proto field diff --git a/src/Func.cc b/src/Func.cc index a01362c05e..35dc80c4d4 100644 --- a/src/Func.cc +++ b/src/Func.cc @@ -45,7 +45,7 @@ #include "zeek/Frame.h" #include "zeek/Var.h" #include "zeek/analyzer/protocol/login/Login.h" -#include "zeek/Sessions.h" +#include "zeek/SessionManager.h" #include "zeek/RE.h" #include "zeek/Event.h" #include "zeek/Traverse.h" diff --git a/src/RunState.cc b/src/RunState.cc index 10e3ab2051..becbf10b7c 100644 --- a/src/RunState.cc +++ b/src/RunState.cc @@ -24,7 +24,7 @@ extern "C" { }; #include "zeek/NetVar.h" -#include "zeek/Sessions.h" +#include "zeek/SessionManager.h" #include "zeek/Event.h" #include "zeek/Timer.h" #include "zeek/ID.h" @@ -195,7 +195,7 @@ void init_run(const std::optional& interface, zeek::detail::init_ip_addr_anonymizers(); - sessions = new NetSessions(); + session_mgr = new SessionManager(); // Initialize the stepping stone manager. We intentionally throw away the result here. SteppingStoneManager::Get(); @@ -390,13 +390,13 @@ void finish_run(int drain_events) if ( drain_events ) { - if ( sessions ) - sessions->Drain(); + if ( session_mgr ) + session_mgr->Drain(); event_mgr.Drain(); - if ( sessions ) - sessions->Done(); + if ( session_mgr ) + session_mgr->Done(); } #ifdef DEBUG @@ -413,7 +413,7 @@ void delete_run() { util::detail::set_processing_status("TERMINATING", "delete_run"); - delete sessions; + delete session_mgr; delete SteppingStoneManager::Get(); for ( int i = 0; i < zeek::detail::NUM_ADDR_ANONYMIZATION_METHODS; ++i ) diff --git a/src/Session.cc b/src/Session.cc index 307877ded6..bfdcbbb5a4 100644 --- a/src/Session.cc +++ b/src/Session.cc @@ -7,7 +7,7 @@ #include "zeek/Val.h" #include "zeek/Event.h" #include "zeek/Desc.h" -#include "zeek/Sessions.h" +#include "zeek/SessionManager.h" #include "zeek/IP.h" namespace zeek { @@ -217,7 +217,7 @@ void Session::DeleteTimer(double /* t */) if ( is_active ) Event(session_timeout_event, nullptr); - sessions->Remove(this); + session_mgr->Remove(this); } void Session::AddTimer(timer_func timer, double t, bool do_expire, @@ -247,7 +247,7 @@ void Session::InactivityTimer(double t) if ( last_time + inactivity_timeout <= t ) { Event(session_timeout_event, nullptr); - sessions->Remove(this); + session_mgr->Remove(this); ++detail::killed_by_inactivity; } else @@ -267,7 +267,7 @@ void Session::StatusUpdateTimer(double t) void Session::RemoveConnectionTimer(double t) { RemovalEvent(); - sessions->Remove(this); + session_mgr->Remove(this); } } // namespace zeek diff --git a/src/Sessions.cc b/src/SessionManager.cc similarity index 89% rename from src/Sessions.cc rename to src/SessionManager.cc index 03fdc4e752..e6a1b0ed5a 100644 --- a/src/Sessions.cc +++ b/src/SessionManager.cc @@ -1,7 +1,7 @@ // See the file "COPYING" in the main distribution directory for copyright. #include "zeek/zeek-config.h" -#include "zeek/Sessions.h" +#include "zeek/SessionManager.h" #include #include @@ -31,27 +31,28 @@ #include "zeek/analyzer/protocol/stepping-stone/events.bif.h" -zeek::NetSessions* zeek::sessions; +zeek::SessionManager* zeek::session_mgr = nullptr; +zeek::SessionManager*& zeek::sessions = zeek::session_mgr; namespace zeek { -NetSessions::NetSessions() +SessionManager::SessionManager() : stats(telemetry_mgr->GaugeFamily("zeek", "session_stats", {"tcp", "udp", "icmp"}, "Zeek Session Stats", "1", false)) { } -NetSessions::~NetSessions() +SessionManager::~SessionManager() { Clear(); } -void NetSessions::Done() +void SessionManager::Done() { } -void NetSessions::ProcessTransportLayer(double t, const Packet* pkt, size_t remaining) +void SessionManager::ProcessTransportLayer(double t, const Packet* pkt, size_t remaining) { const std::unique_ptr& ip_hdr = pkt->ip_hdr; @@ -60,7 +61,7 @@ void NetSessions::ProcessTransportLayer(double t, const Packet* pkt, size_t rema if ( len < ip_hdr_len ) { - sessions->Weird("bogus_IP_header_lengths", pkt); + session_mgr->Weird("bogus_IP_header_lengths", pkt); return; } @@ -208,7 +209,7 @@ void NetSessions::ProcessTransportLayer(double t, const Packet* pkt, size_t rema } } -int NetSessions::ParseIPPacket(int caplen, const u_char* const pkt, int proto, +int SessionManager::ParseIPPacket(int caplen, const u_char* const pkt, int proto, IP_Hdr*& inner) { if ( proto == IPPROTO_IPV6 ) @@ -245,7 +246,7 @@ int NetSessions::ParseIPPacket(int caplen, const u_char* const pkt, int proto, return 0; } -bool NetSessions::CheckHeaderTrunc(int proto, uint32_t len, uint32_t caplen, +bool SessionManager::CheckHeaderTrunc(int proto, uint32_t len, uint32_t caplen, const Packet* p) { uint32_t min_hdr_len = 0; @@ -279,7 +280,7 @@ bool NetSessions::CheckHeaderTrunc(int proto, uint32_t len, uint32_t caplen, return false; } -Connection* NetSessions::FindConnection(Val* v) +Connection* SessionManager::FindConnection(Val* v) { const auto& vt = v->GetType(); if ( ! IsRecord(vt->Tag()) ) @@ -342,7 +343,7 @@ Connection* NetSessions::FindConnection(Val* v) return conn; } -void NetSessions::Remove(Session* s) +void SessionManager::Remove(Session* s) { Connection* c = static_cast(s); @@ -378,7 +379,7 @@ void NetSessions::Remove(Session* s) } } -void NetSessions::Insert(Session* s) +void SessionManager::Insert(Session* s) { assert(s->IsKeyValid()); @@ -402,7 +403,7 @@ void NetSessions::Insert(Session* s) } } -void NetSessions::Drain() +void SessionManager::Drain() { for ( const auto& entry : session_map ) { @@ -412,7 +413,7 @@ void NetSessions::Drain() } } -void NetSessions::Clear() +void SessionManager::Clear() { for ( const auto& entry : session_map ) Unref(entry.second); @@ -422,7 +423,7 @@ void NetSessions::Clear() detail::fragment_mgr->Clear(); } -void NetSessions::GetStats(SessionStats& s) +void SessionManager::GetStats(SessionStats& s) { s.max_TCP_conns = stats.GetOrAdd({{"tcp", "max_conns"}}).Value(); s.num_TCP_conns = stats.GetOrAdd({{"tcp", "num_conns"}}).Value(); @@ -441,9 +442,9 @@ void NetSessions::GetStats(SessionStats& s) s.num_packets = packet_mgr->PacketsProcessed(); } -Connection* NetSessions::NewConn(const detail::ConnIDKey& k, double t, const ConnID* id, - const u_char* data, int proto, uint32_t flow_label, - const Packet* pkt) +Connection* SessionManager::NewConn(const detail::ConnIDKey& k, double t, const ConnID* id, + const u_char* data, int proto, uint32_t flow_label, + const Packet* pkt) { // FIXME: This should be cleaned up a bit, it's too protocol-specific. // But I'm not yet sure what the right abstraction for these things is. @@ -482,7 +483,7 @@ Connection* NetSessions::NewConn(const detail::ConnIDKey& k, double t, const Con if ( ! WantConnection(src_h, dst_h, tproto, flags, flip) ) return nullptr; - Connection* conn = new Connection(this, k, t, id, flow_label, pkt); + Connection* conn = new Connection(k, t, id, flow_label, pkt); conn->SetTransport(tproto); if ( flip ) @@ -501,7 +502,7 @@ Connection* NetSessions::NewConn(const detail::ConnIDKey& k, double t, const Con return conn; } -bool NetSessions::IsLikelyServerPort(uint32_t port, TransportProto proto) const +bool SessionManager::IsLikelyServerPort(uint32_t port, TransportProto proto) const { // We keep a cached in-core version of the table to speed up the lookup. static std::set port_cache; @@ -528,7 +529,7 @@ bool NetSessions::IsLikelyServerPort(uint32_t port, TransportProto proto) const return port_cache.find(port) != port_cache.end(); } -bool NetSessions::WantConnection(uint16_t src_port, uint16_t dst_port, +bool SessionManager::WantConnection(uint16_t src_port, uint16_t dst_port, TransportProto transport_proto, uint8_t tcp_flags, bool& flip_roles) { @@ -575,7 +576,7 @@ bool NetSessions::WantConnection(uint16_t src_port, uint16_t dst_port, return true; } -void NetSessions::Weird(const char* name, const Packet* pkt, const char* addl, const char* source) +void SessionManager::Weird(const char* name, const Packet* pkt, const char* addl, const char* source) { const char* weird_name = name; @@ -596,12 +597,12 @@ void NetSessions::Weird(const char* name, const Packet* pkt, const char* addl, c reporter->Weird(weird_name, addl, source); } -void NetSessions::Weird(const char* name, const IP_Hdr* ip, const char* addl) +void SessionManager::Weird(const char* name, const IP_Hdr* ip, const char* addl) { reporter->Weird(ip->SrcAddr(), ip->DstAddr(), name, addl); } -unsigned int NetSessions::ConnectionMemoryUsage() +unsigned int SessionManager::ConnectionMemoryUsage() { unsigned int mem = 0; @@ -615,7 +616,7 @@ unsigned int NetSessions::ConnectionMemoryUsage() return mem; } -unsigned int NetSessions::ConnectionMemoryUsageConnVals() +unsigned int SessionManager::ConnectionMemoryUsageConnVals() { unsigned int mem = 0; @@ -629,7 +630,7 @@ unsigned int NetSessions::ConnectionMemoryUsageConnVals() return mem; } -unsigned int NetSessions::MemoryAllocation() +unsigned int SessionManager::MemoryAllocation() { if ( run_state::terminating ) // Connections have been flushed already. @@ -643,7 +644,7 @@ unsigned int NetSessions::MemoryAllocation() ; } -void NetSessions::InsertSession(detail::SessionKey key, Session* session) +void SessionManager::InsertSession(detail::SessionKey key, Session* session) { key.CopyData(); session_map.insert_or_assign(std::move(key), session); @@ -676,7 +677,7 @@ void NetSessions::InsertSession(detail::SessionKey key, Session* session) } } -detail::PacketFilter* NetSessions::GetPacketFilter(bool init) +detail::PacketFilter* SessionManager::GetPacketFilter(bool init) { return packet_mgr->GetPacketFilter(init); } diff --git a/src/Sessions.h b/src/SessionManager.h similarity index 95% rename from src/Sessions.h rename to src/SessionManager.h index 70070979c9..c53d1bdb5a 100644 --- a/src/Sessions.h +++ b/src/SessionManager.h @@ -40,10 +40,10 @@ struct SessionStats { uint64_t num_packets; }; -class NetSessions final { +class SessionManager final { public: - NetSessions(); - ~NetSessions(); + SessionManager(); + ~SessionManager(); void Done(); // call to drain events before destructing @@ -130,7 +130,7 @@ public: // TODO: should this move somewhere else? analyzer::tcp::TCPStateStats tcp_stats; // keeps statistics on TCP states -protected: +private: using SessionMap = std::map; @@ -172,6 +172,9 @@ protected: }; // Manager for the currently active sessions. -extern NetSessions* sessions; +extern SessionManager* session_mgr; +extern SessionManager*& sessions [[deprecated("Remove in v5.1. Use zeek::session_mgr.")]]; + +using NetSessions [[deprecated("Remove in v5.1. Use zeek::SessionManager.")]] = SessionManager; } // namespace zeek diff --git a/src/Stats.cc b/src/Stats.cc index 2479349093..294164c526 100644 --- a/src/Stats.cc +++ b/src/Stats.cc @@ -7,7 +7,7 @@ #include "zeek/RunState.h" #include "zeek/NetVar.h" #include "zeek/ID.h" -#include "zeek/Sessions.h" +#include "zeek/SessionManager.h" #include "zeek/Scope.h" #include "zeek/DNS_Mgr.h" #include "zeek/Trigger.h" @@ -126,25 +126,25 @@ void ProfileLogger::Log() run_state::network_time, (utime + stime) - (first_utime + first_stime), utime - first_utime, stime - first_stime, rtime - first_rtime)); - int conn_mem_use = expensive ? sessions->ConnectionMemoryUsage() : 0; + int conn_mem_use = expensive ? session_mgr->ConnectionMemoryUsage() : 0; double avg_conn_mem_use = 0; - if ( expensive && sessions->CurrentConnections() != 0 ) - avg_conn_mem_use = conn_mem_use / static_cast(sessions->CurrentConnections()); + if ( expensive && session_mgr->CurrentConnections() != 0 ) + avg_conn_mem_use = conn_mem_use / static_cast(session_mgr->CurrentConnections()); file->Write(util::fmt("%.06f Conns: total=%" PRIu64 " current=%" PRIu64 "/%" PRIi32 " mem=%" PRIi32 "K avg=%.1f table=%" PRIu32 "K connvals=%" PRIu32 "K\n", run_state::network_time, Connection::TotalConnections(), Connection::CurrentConnections(), - sessions->CurrentConnections(), + session_mgr->CurrentConnections(), conn_mem_use, avg_conn_mem_use, - expensive ? sessions->MemoryAllocation() / 1024 : 0, - expensive ? sessions->ConnectionMemoryUsageConnVals() / 1024 : 0 + expensive ? session_mgr->MemoryAllocation() / 1024 : 0, + expensive ? session_mgr->ConnectionMemoryUsageConnVals() / 1024 : 0 )); SessionStats s; - sessions->GetStats(s); + session_mgr->GetStats(s); file->Write(util::fmt("%.06f Conns: tcp=%zu/%zu udp=%zu/%zu icmp=%zu/%zu\n", run_state::network_time, @@ -153,22 +153,22 @@ void ProfileLogger::Log() s.num_ICMP_conns, s.max_ICMP_conns )); - sessions->tcp_stats.PrintStats(file, + session_mgr->tcp_stats.PrintStats(file, util::fmt("%.06f TCP-States:", run_state::network_time)); // Alternatively, if you prefer more compact output... /* file->Write(util::fmt("%.8f TCP-States: I=%d S=%d SA=%d SR=%d E=%d EF=%d ER=%d F=%d P=%d\n", run_state::network_time, - sessions->tcp_stats.StateInactive(), - sessions->tcp_stats.StateRequest(), - sessions->tcp_stats.StateSuccRequest(), - sessions->tcp_stats.StateRstRequest(), - sessions->tcp_stats.StateEstablished(), - sessions->tcp_stats.StateHalfClose(), - sessions->tcp_stats.StateHalfRst(), - sessions->tcp_stats.StateClosed(), - sessions->tcp_stats.StatePartial() + session_mgr->tcp_stats.StateInactive(), + session_mgr->tcp_stats.StateRequest(), + session_mgr->tcp_stats.StateSuccRequest(), + session_mgr->tcp_stats.StateRstRequest(), + session_mgr->tcp_stats.StateEstablished(), + session_mgr->tcp_stats.StateHalfClose(), + session_mgr->tcp_stats.StateHalfRst(), + session_mgr->tcp_stats.StateClosed(), + session_mgr->tcp_stats.StatePartial() )); */ diff --git a/src/analyzer/protocol/ayiya/AYIYA.cc b/src/analyzer/protocol/ayiya/AYIYA.cc index 58dec78f12..ff2867b99b 100644 --- a/src/analyzer/protocol/ayiya/AYIYA.cc +++ b/src/analyzer/protocol/ayiya/AYIYA.cc @@ -2,6 +2,7 @@ #include "zeek/analyzer/protocol/ayiya/AYIYA.h" +#include "zeek/SessionManager.h" #include "zeek/Func.h" #include "zeek/packet_analysis/protocol/iptunnel/IPTunnel.h" @@ -46,7 +47,7 @@ void AYIYA_Analyzer::DeliverPacket(int len, const u_char* data, bool orig, uint6 inner_packet_offset = -1; IP_Hdr* inner = nullptr; - int result = sessions->ParseIPPacket(len, data, next_header, inner); + int result = session_mgr->ParseIPPacket(len, data, next_header, inner); if ( result == 0 ) { diff --git a/src/analyzer/protocol/ayiya/ayiya-analyzer.pac b/src/analyzer/protocol/ayiya/ayiya-analyzer.pac index 427a08c510..dc68fd8934 100644 --- a/src/analyzer/protocol/ayiya/ayiya-analyzer.pac +++ b/src/analyzer/protocol/ayiya/ayiya-analyzer.pac @@ -1,5 +1,4 @@ %extern{ -#include "zeek/Sessions.h" #include "zeek/Conn.h" #include "zeek/analyzer/protocol/ayiya/AYIYA.h" %} diff --git a/src/analyzer/protocol/conn-size/functions.bif b/src/analyzer/protocol/conn-size/functions.bif index a60195ae9c..4e8fae5f46 100644 --- a/src/analyzer/protocol/conn-size/functions.bif +++ b/src/analyzer/protocol/conn-size/functions.bif @@ -1,11 +1,11 @@ %%{ #include "zeek/analyzer/protocol/conn-size/ConnSize.h" #include "zeek/Reporter.h" -#include "zeek/Sessions.h" +#include "zeek/SessionManager.h" static zeek::analyzer::Analyzer* GetConnsizeAnalyzer(zeek::Val* cid) { - zeek::Connection* c = zeek::sessions->FindConnection(cid); + zeek::Connection* c = zeek::session_mgr->FindConnection(cid); if ( ! c ) return nullptr; diff --git a/src/analyzer/protocol/dns/DNS.cc b/src/analyzer/protocol/dns/DNS.cc index fa30291201..1935fa2513 100644 --- a/src/analyzer/protocol/dns/DNS.cc +++ b/src/analyzer/protocol/dns/DNS.cc @@ -11,7 +11,7 @@ #include "zeek/ZeekString.h" #include "zeek/NetVar.h" -#include "zeek/Sessions.h" +#include "zeek/SessionManager.h" #include "zeek/Event.h" #include "zeek/RunState.h" @@ -346,7 +346,7 @@ bool DNS_Interpreter::ParseAnswer(detail::DNS_MsgInfo* msg, case detail::TYPE_DS: status = ParseRR_DS(msg, data, len, rdlength, msg_start); break; - + case detail::TYPE_BINDS: status = ParseRR_BINDS(msg, data, len, rdlength, msg_start); break; @@ -354,7 +354,7 @@ bool DNS_Interpreter::ParseAnswer(detail::DNS_MsgInfo* msg, case detail::TYPE_SSHFP: status = ParseRR_SSHFP(msg, data, len, rdlength, msg_start); break; - + case detail::TYPE_LOC: status = ParseRR_LOC(msg, data, len, rdlength, msg_start); break; @@ -2261,7 +2261,7 @@ void DNS_Analyzer::ExpireTimer(double t) if ( t - Conn()->LastTime() >= zeek::detail::dns_session_timeout - 1.0 || run_state::terminating ) { Event(connection_timeout); - sessions->Remove(Conn()); + session_mgr->Remove(Conn()); } else ADD_ANALYZER_TIMER(&DNS_Analyzer::ExpireTimer, diff --git a/src/analyzer/protocol/gtpv1/GTPv1.cc b/src/analyzer/protocol/gtpv1/GTPv1.cc index 47ce102aad..76a6a3de75 100644 --- a/src/analyzer/protocol/gtpv1/GTPv1.cc +++ b/src/analyzer/protocol/gtpv1/GTPv1.cc @@ -3,6 +3,7 @@ #include "zeek/analyzer/protocol/gtpv1/GTPv1.h" #include "zeek/packet_analysis/protocol/iptunnel/IPTunnel.h" +#include "zeek/SessionManager.h" #include "zeek/analyzer/protocol/gtpv1/events.bif.h" namespace zeek::analyzer::gtpv1 { @@ -47,7 +48,7 @@ void GTPv1_Analyzer::DeliverPacket(int len, const u_char* data, bool orig, uint6 inner_packet_offset = -1; IP_Hdr* inner = nullptr; - int result = sessions->ParseIPPacket(len, data, next_header, inner); + int result = session_mgr->ParseIPPacket(len, data, next_header, inner); if ( result == 0 ) { diff --git a/src/analyzer/protocol/gtpv1/gtpv1-analyzer.pac b/src/analyzer/protocol/gtpv1/gtpv1-analyzer.pac index eac96ba3a2..62f802d7f8 100644 --- a/src/analyzer/protocol/gtpv1/gtpv1-analyzer.pac +++ b/src/analyzer/protocol/gtpv1/gtpv1-analyzer.pac @@ -1,5 +1,4 @@ %extern{ -#include "zeek/Sessions.h" #include "zeek/ZeekString.h" #include "zeek/analyzer/protocol/gtpv1/GTPv1.h" %} diff --git a/src/analyzer/protocol/login/functions.bif b/src/analyzer/protocol/login/functions.bif index 117c5c9395..4cf84b330c 100644 --- a/src/analyzer/protocol/login/functions.bif +++ b/src/analyzer/protocol/login/functions.bif @@ -2,7 +2,7 @@ %%{ #include "zeek/analyzer/protocol/login/Login.h" #include "zeek/Reporter.h" -#include "zeek/Sessions.h" +#include "zeek/SessionManager.h" %%} ## Returns the state of the given login (Telnet or Rlogin) connection. @@ -26,7 +26,7 @@ ## .. zeek:see:: set_login_state function get_login_state%(cid: conn_id%): count %{ - zeek::Connection* c = sessions->FindConnection(cid); + zeek::Connection* c = session_mgr->FindConnection(cid); if ( ! c ) return zeek::val_mgr->False(); @@ -50,7 +50,7 @@ function get_login_state%(cid: conn_id%): count ## .. zeek:see:: get_login_state function set_login_state%(cid: conn_id, new_state: count%): bool %{ - zeek::Connection* c = sessions->FindConnection(cid); + zeek::Connection* c = session_mgr->FindConnection(cid); if ( ! c ) return zeek::val_mgr->False(); diff --git a/src/analyzer/protocol/ncp/NCP.cc b/src/analyzer/protocol/ncp/NCP.cc index d6b3f235bc..0e265527b3 100644 --- a/src/analyzer/protocol/ncp/NCP.cc +++ b/src/analyzer/protocol/ncp/NCP.cc @@ -7,8 +7,6 @@ #include #include -#include "zeek/Sessions.h" - #include "zeek/analyzer/protocol/ncp/events.bif.h" #include "zeek/analyzer/protocol/ncp/consts.bif.h" diff --git a/src/analyzer/protocol/netbios/NetbiosSSN.cc b/src/analyzer/protocol/netbios/NetbiosSSN.cc index a065000263..d92e4421cd 100644 --- a/src/analyzer/protocol/netbios/NetbiosSSN.cc +++ b/src/analyzer/protocol/netbios/NetbiosSSN.cc @@ -7,7 +7,7 @@ #include "zeek/ZeekString.h" #include "zeek/NetVar.h" -#include "zeek/Sessions.h" +#include "zeek/SessionManager.h" #include "zeek/Event.h" #include "zeek/RunState.h" @@ -531,7 +531,7 @@ void NetbiosSSN_Analyzer::ExpireTimer(double t) netbios_ssn_session_timeout - 1.0 ) { Event(connection_timeout); - sessions->Remove(Conn()); + session_mgr->Remove(Conn()); } else ADD_ANALYZER_TIMER(&NetbiosSSN_Analyzer::ExpireTimer, diff --git a/src/analyzer/protocol/rpc/RPC.cc b/src/analyzer/protocol/rpc/RPC.cc index 51f0529c63..ad15643cde 100644 --- a/src/analyzer/protocol/rpc/RPC.cc +++ b/src/analyzer/protocol/rpc/RPC.cc @@ -9,7 +9,7 @@ #include "zeek/NetVar.h" #include "zeek/analyzer/protocol/rpc/XDR.h" #include "zeek/Reporter.h" -#include "zeek/Sessions.h" +#include "zeek/SessionManager.h" #include "zeek/RunState.h" #include "zeek/analyzer/protocol/rpc/events.bif.h" @@ -766,7 +766,7 @@ void RPC_Analyzer::Done() void RPC_Analyzer::ExpireTimer(double /* t */) { Event(connection_timeout); - sessions->Remove(Conn()); + session_mgr->Remove(Conn()); } } // namespace zeek::analyzer::rpc diff --git a/src/analyzer/protocol/stepping-stone/SteppingStone.cc b/src/analyzer/protocol/stepping-stone/SteppingStone.cc index 27e56d3b43..2317e1518b 100644 --- a/src/analyzer/protocol/stepping-stone/SteppingStone.cc +++ b/src/analyzer/protocol/stepping-stone/SteppingStone.cc @@ -9,7 +9,6 @@ #include "zeek/RunState.h" #include "zeek/NetVar.h" #include "zeek/analyzer/protocol/tcp/TCP.h" -#include "zeek/Sessions.h" #include "zeek/util.h" #include "zeek/analyzer/protocol/stepping-stone/events.bif.h" diff --git a/src/analyzer/protocol/stepping-stone/SteppingStone.h b/src/analyzer/protocol/stepping-stone/SteppingStone.h index 8166900dc4..55cd890f89 100644 --- a/src/analyzer/protocol/stepping-stone/SteppingStone.h +++ b/src/analyzer/protocol/stepping-stone/SteppingStone.h @@ -8,8 +8,6 @@ namespace zeek { -class NetSessions; - namespace analyzer::stepping_stone { class SteppingStoneEndpoint; diff --git a/src/analyzer/protocol/syslog/Syslog.cc b/src/analyzer/protocol/syslog/Syslog.cc index 7c46ab0342..baae38f174 100644 --- a/src/analyzer/protocol/syslog/Syslog.cc +++ b/src/analyzer/protocol/syslog/Syslog.cc @@ -41,7 +41,7 @@ void Syslog_Analyzer::DeliverPacket(int len, const u_char* data, bool orig, uint // if ( t - Conn()->LastTime() >= Syslog_session_timeout - 1.0 || terminating ) // { // Event(connection_timeout); -// sessions->Remove(Conn()); +// session_mgr->Remove(Conn()); // } // else // ADD_ANALYZER_TIMER(&Syslog_Analyzer::ExpireTimer, diff --git a/src/analyzer/protocol/tcp/TCP.cc b/src/analyzer/protocol/tcp/TCP.cc index 26f4381e7d..d5f2d92574 100644 --- a/src/analyzer/protocol/tcp/TCP.cc +++ b/src/analyzer/protocol/tcp/TCP.cc @@ -13,7 +13,7 @@ #include "zeek/File.h" #include "zeek/Event.h" #include "zeek/Reporter.h" -#include "zeek/Sessions.h" +#include "zeek/SessionManager.h" #include "zeek/DebugLogger.h" #include "zeek/analyzer/protocol/tcp/events.bif.h" @@ -1272,7 +1272,7 @@ void TCP_Analyzer::FlipRoles() { Analyzer::FlipRoles(); - sessions->tcp_stats.FlipState(orig->state, resp->state); + session_mgr->tcp_stats.FlipState(orig->state, resp->state); TCP_Endpoint* tmp_ep = resp; resp = orig; orig = tmp_ep; @@ -1480,7 +1480,7 @@ void TCP_Analyzer::AttemptTimer(double /* t */) is_active = 0; // All done with this connection. - sessions->Remove(Conn()); + session_mgr->Remove(Conn()); } } @@ -1500,7 +1500,7 @@ void TCP_Analyzer::PartialCloseTimer(double /* t */) return; Event(connection_partial_close); - sessions->Remove(Conn()); + session_mgr->Remove(Conn()); } } @@ -1530,7 +1530,7 @@ void TCP_Analyzer::ExpireTimer(double t) // the session remove and Unref() us here. Event(connection_timeout); is_active = 0; - sessions->Remove(Conn()); + session_mgr->Remove(Conn()); return; } } @@ -1545,7 +1545,7 @@ void TCP_Analyzer::ExpireTimer(double t) // before setting up an attempt timer, // so we need to clean it up here. Event(connection_timeout); - sessions->Remove(Conn()); + session_mgr->Remove(Conn()); return; } } @@ -1566,12 +1566,12 @@ void TCP_Analyzer::ResetTimer(double /* t */) if ( ! BothClosed() ) ConnectionReset(); - sessions->Remove(Conn()); + session_mgr->Remove(Conn()); } void TCP_Analyzer::DeleteTimer(double /* t */) { - sessions->Remove(Conn()); + session_mgr->Remove(Conn()); } void TCP_Analyzer::ConnDeleteTimer(double t) @@ -1689,7 +1689,7 @@ void TCP_Analyzer::ConnectionClosed(TCP_Endpoint* endpoint, TCP_Endpoint* peer, // Note, even if tcp_close_delay is zero, we can't // simply do: // - // sessions->Remove(this); + // session_mgr->Remove(this); // // here, because that would cause the object to be // deleted out from under us. diff --git a/src/analyzer/protocol/tcp/TCP_Endpoint.cc b/src/analyzer/protocol/tcp/TCP_Endpoint.cc index 792a513132..09d56048a2 100644 --- a/src/analyzer/protocol/tcp/TCP_Endpoint.cc +++ b/src/analyzer/protocol/tcp/TCP_Endpoint.cc @@ -9,7 +9,7 @@ #include "zeek/analyzer/protocol/tcp/TCP.h" #include "zeek/analyzer/protocol/tcp/TCP_Reassembler.h" #include "zeek/Reporter.h" -#include "zeek/Sessions.h" +#include "zeek/SessionManager.h" #include "zeek/Event.h" #include "zeek/File.h" #include "zeek/Val.h" @@ -66,7 +66,7 @@ void TCP_Endpoint::SetPeer(TCP_Endpoint* p) peer = p; if ( IsOrig() ) // Only one Endpoint adds the initial state to the counter. - sessions->tcp_stats.StateEntered(state, peer->state); + session_mgr->tcp_stats.StateEntered(state, peer->state); } bool TCP_Endpoint::HadGap() const @@ -145,11 +145,11 @@ void TCP_Endpoint::SetState(EndpointState new_state) prev_state = state; state = new_state; if ( IsOrig() ) - sessions->tcp_stats.ChangeState(prev_state, state, - peer->state, peer->state); + session_mgr->tcp_stats.ChangeState(prev_state, state, + peer->state, peer->state); else - sessions->tcp_stats.ChangeState(peer->state, peer->state, - prev_state, state); + session_mgr->tcp_stats.ChangeState(peer->state, peer->state, + prev_state, state); } } diff --git a/src/analyzer/protocol/tcp/functions.bif b/src/analyzer/protocol/tcp/functions.bif index fe82b8c15b..0635234963 100644 --- a/src/analyzer/protocol/tcp/functions.bif +++ b/src/analyzer/protocol/tcp/functions.bif @@ -1,7 +1,7 @@ %%{ #include "zeek/File.h" -#include "zeek/Sessions.h" +#include "zeek/SessionManager.h" #include "zeek/Reporter.h" #include "zeek/analyzer/protocol/tcp/TCP.h" %%} @@ -18,7 +18,7 @@ ## .. zeek:see:: get_resp_seq function get_orig_seq%(cid: conn_id%): count %{ - zeek::Connection* c = zeek::sessions->FindConnection(cid); + zeek::Connection* c = zeek::session_mgr->FindConnection(cid); if ( ! c ) return zeek::val_mgr->Count(0); @@ -47,7 +47,7 @@ function get_orig_seq%(cid: conn_id%): count ## .. zeek:see:: get_orig_seq function get_resp_seq%(cid: conn_id%): count %{ - zeek::Connection* c = zeek::sessions->FindConnection(cid); + zeek::Connection* c = zeek::session_mgr->FindConnection(cid); if ( ! c ) return zeek::val_mgr->Count(0); @@ -97,7 +97,7 @@ function get_resp_seq%(cid: conn_id%): count ## .. zeek:see:: get_contents_file set_record_packets contents_file_write_failure function set_contents_file%(cid: conn_id, direction: count, f: file%): bool %{ - zeek::Connection* c = zeek::sessions->FindConnection(cid); + zeek::Connection* c = zeek::session_mgr->FindConnection(cid); if ( ! c ) return zeek::val_mgr->False(); @@ -120,7 +120,7 @@ function set_contents_file%(cid: conn_id, direction: count, f: file%): bool ## .. zeek:see:: set_contents_file set_record_packets contents_file_write_failure function get_contents_file%(cid: conn_id, direction: count%): file %{ - zeek::Connection* c = zeek::sessions->FindConnection(cid); + zeek::Connection* c = zeek::session_mgr->FindConnection(cid); if ( c ) { diff --git a/src/analyzer/protocol/teredo/Teredo.cc b/src/analyzer/protocol/teredo/Teredo.cc index 53c9458d14..e4e6f366c5 100644 --- a/src/analyzer/protocol/teredo/Teredo.cc +++ b/src/analyzer/protocol/teredo/Teredo.cc @@ -4,7 +4,7 @@ #include "zeek/Conn.h" #include "zeek/IP.h" #include "zeek/Reporter.h" -#include "zeek/Sessions.h" +#include "zeek/SessionManager.h" #include "zeek/ZeekString.h" #include "zeek/RunState.h" #include "zeek/packet_analysis/protocol/iptunnel/IPTunnel.h" @@ -165,7 +165,7 @@ void Teredo_Analyzer::DeliverPacket(int len, const u_char* data, bool orig, } IP_Hdr* inner = nullptr; - int rslt = sessions->ParseIPPacket(len, te.InnerIP(), IPPROTO_IPV6, inner); + int rslt = session_mgr->ParseIPPacket(len, te.InnerIP(), IPPROTO_IPV6, inner); if ( rslt > 0 ) { diff --git a/src/analyzer/protocol/vxlan/VXLAN.cc b/src/analyzer/protocol/vxlan/VXLAN.cc index dd103dd8c3..9498045791 100644 --- a/src/analyzer/protocol/vxlan/VXLAN.cc +++ b/src/analyzer/protocol/vxlan/VXLAN.cc @@ -10,7 +10,6 @@ extern "C" { #include "zeek/Conn.h" #include "zeek/IP.h" #include "zeek/RunState.h" -#include "zeek/Sessions.h" #include "zeek/Reporter.h" #include "zeek/packet_analysis/Manager.h" #include "zeek/packet_analysis/protocol/iptunnel/IPTunnel.h" diff --git a/src/fuzzers/fuzzer-setup.h b/src/fuzzers/fuzzer-setup.h index 7e90a1542d..468df57f3e 100644 --- a/src/fuzzers/fuzzer-setup.h +++ b/src/fuzzers/fuzzer-setup.h @@ -6,7 +6,7 @@ #include "zeek/zeek-setup.h" #include "zeek/Event.h" -#include "zeek/Sessions.h" +#include "zeek/SessionManager.h" #include "zeek/broker/Manager.h" #include "zeek/file_analysis/Manager.h" @@ -55,9 +55,9 @@ void fuzzer_cleanup_one_input() timer_mgr->Expire(); zeek::event_mgr.Drain(); - sessions->Drain(); + zeek::session_mgr->Drain(); zeek::event_mgr.Drain(); - sessions->Clear(); + zeek::session_mgr->Clear(); run_state::terminating = false; } diff --git a/src/fuzzers/pop3-fuzzer.cc b/src/fuzzers/pop3-fuzzer.cc index 1a7372841e..3354b4954c 100644 --- a/src/fuzzers/pop3-fuzzer.cc +++ b/src/fuzzers/pop3-fuzzer.cc @@ -2,7 +2,7 @@ #include "zeek/RunState.h" #include "zeek/Conn.h" -#include "zeek/Sessions.h" +#include "zeek/SessionManager.h" #include "zeek/analyzer/Analyzer.h" #include "zeek/analyzer/Manager.h" #include "zeek/analyzer/protocol/pia/PIA.h" @@ -27,10 +27,10 @@ static zeek::Connection* add_connection() conn_id.is_one_way = false; conn_id.proto = TRANSPORT_TCP; zeek::detail::ConnIDKey key = zeek::detail::BuildConnIDKey(conn_id); - zeek::Connection* conn = new zeek::Connection(zeek::sessions, key, network_time_start, + zeek::Connection* conn = new zeek::Connection(key, network_time_start, &conn_id, 1, &p); conn->SetTransport(TRANSPORT_TCP); - zeek::sessions->Insert(conn); + zeek::session_mgr->Insert(conn); return conn; } diff --git a/src/iosource/Packet.cc b/src/iosource/Packet.cc index 64febf5f29..49940b0758 100644 --- a/src/iosource/Packet.cc +++ b/src/iosource/Packet.cc @@ -14,7 +14,6 @@ extern "C" { #endif } -#include "zeek/Sessions.h" #include "zeek/Desc.h" #include "zeek/IP.h" #include "zeek/iosource/Manager.h" diff --git a/src/iosource/PktSrc.cc b/src/iosource/PktSrc.cc index 8e3cf40110..f054d8b80c 100644 --- a/src/iosource/PktSrc.cc +++ b/src/iosource/PktSrc.cc @@ -8,7 +8,7 @@ #include "zeek/util.h" #include "zeek/Hash.h" #include "zeek/RunState.h" -#include "zeek/Sessions.h" +#include "zeek/SessionManager.h" #include "zeek/broker/Manager.h" #include "zeek/iosource/Manager.h" #include "zeek/packet_analysis/Manager.h" @@ -125,7 +125,7 @@ void PktSrc::Info(const std::string& msg) void PktSrc::Weird(const std::string& msg, const Packet* p) { - sessions->Weird(msg.c_str(), p); + session_mgr->Weird(msg.c_str(), p); } void PktSrc::InternalError(const std::string& msg) diff --git a/src/packet_analysis/Analyzer.cc b/src/packet_analysis/Analyzer.cc index d0662c9a67..c371b216e8 100644 --- a/src/packet_analysis/Analyzer.cc +++ b/src/packet_analysis/Analyzer.cc @@ -5,7 +5,7 @@ #include "zeek/Dict.h" #include "zeek/DebugLogger.h" #include "zeek/RunState.h" -#include "zeek/Sessions.h" +#include "zeek/SessionManager.h" #include "zeek/util.h" namespace zeek::packet_analysis { @@ -121,7 +121,7 @@ void Analyzer::RegisterProtocol(uint32_t identifier, AnalyzerPtr child) void Analyzer::Weird(const char* name, Packet* packet, const char* addl) const { - sessions->Weird(name, packet, addl, GetAnalyzerName()); + session_mgr->Weird(name, packet, addl, GetAnalyzerName()); } } // namespace zeek::packet_analysis diff --git a/src/packet_analysis/Manager.cc b/src/packet_analysis/Manager.cc index 04ffc9e23d..0bf4252ec8 100644 --- a/src/packet_analysis/Manager.cc +++ b/src/packet_analysis/Manager.cc @@ -6,7 +6,6 @@ #include "zeek/packet_analysis/Dispatcher.h" #include "zeek/zeek-bif.h" #include "zeek/Stats.h" -#include "zeek/Sessions.h" #include "zeek/RunState.h" #include "zeek/iosource/PktDumper.h" diff --git a/src/packet_analysis/protocol/gre/GRE.cc b/src/packet_analysis/protocol/gre/GRE.cc index 1f47ecc92f..e1726524dc 100644 --- a/src/packet_analysis/protocol/gre/GRE.cc +++ b/src/packet_analysis/protocol/gre/GRE.cc @@ -4,7 +4,7 @@ #include // For DLT_ constants -#include "zeek/Sessions.h" +#include "zeek/SessionManager.h" #include "zeek/RunState.h" #include "zeek/IP.h" #include "zeek/Reporter.h" diff --git a/src/packet_analysis/protocol/ip/IP.cc b/src/packet_analysis/protocol/ip/IP.cc index 6e132c55a5..f229d6ba84 100644 --- a/src/packet_analysis/protocol/ip/IP.cc +++ b/src/packet_analysis/protocol/ip/IP.cc @@ -5,7 +5,7 @@ #include "zeek/IP.h" #include "zeek/Discard.h" #include "zeek/PacketFilter.h" -#include "zeek/Sessions.h" +#include "zeek/SessionManager.h" #include "zeek/RunState.h" #include "zeek/Frag.h" #include "zeek/Event.h" @@ -241,7 +241,7 @@ bool IPAnalyzer::AnalyzePacket(size_t len, const uint8_t* data, Packet* packet) case IPPROTO_ICMPV6: DBG_LOG(DBG_PACKET_ANALYSIS, "Analysis in %s succeeded, next layer identifier is %#x.", GetAnalyzerName(), proto); - sessions->ProcessTransportLayer(run_state::processing_start_time, packet, len); + session_mgr->ProcessTransportLayer(run_state::processing_start_time, packet, len); break; case IPPROTO_NONE: // If the packet is encapsulated in Teredo, then it was a bubble and diff --git a/src/packet_analysis/protocol/iptunnel/IPTunnel.cc b/src/packet_analysis/protocol/iptunnel/IPTunnel.cc index ca91c26a61..7cabd9565c 100644 --- a/src/packet_analysis/protocol/iptunnel/IPTunnel.cc +++ b/src/packet_analysis/protocol/iptunnel/IPTunnel.cc @@ -4,7 +4,7 @@ #include // For DLT_ constants -#include "zeek/Sessions.h" +#include "zeek/SessionManager.h" #include "zeek/RunState.h" #include "zeek/IP.h" #include "zeek/TunnelEncapsulation.h" @@ -50,7 +50,7 @@ bool IPTunnelAnalyzer::AnalyzePacket(size_t len, const uint8_t* data, Packet* pa if ( gre_version != 0 ) { // Check for a valid inner packet first. - int result = sessions->ParseIPPacket(len, data, proto, inner); + int result = session_mgr->ParseIPPacket(len, data, proto, inner); if ( result == -2 ) Weird("invalid_inner_IP_version", packet); else if ( result < 0 ) diff --git a/src/stats.bif b/src/stats.bif index 5363ba3493..7fad9830b6 100644 --- a/src/stats.bif +++ b/src/stats.bif @@ -88,14 +88,14 @@ function get_conn_stats%(%): ConnStats r->Assign(n++, Connection::TotalConnections()); r->Assign(n++, Connection::CurrentConnections()); - r->Assign(n++, sessions->CurrentConnections()); + r->Assign(n++, session_mgr->CurrentConnections()); SessionStats s; - if ( sessions ) - sessions->GetStats(s); + if ( session_mgr ) + session_mgr->GetStats(s); #define ADD_STAT(x) \ - r->Assign(n++, static_cast(sessions ? x : 0)); + r->Assign(n++, static_cast(session_mgr ? x : 0)); ADD_STAT(s.num_packets); ADD_STAT(s.num_fragments); diff --git a/src/zeek.bif b/src/zeek.bif index a8d24bf0c5..5fc0dc4302 100644 --- a/src/zeek.bif +++ b/src/zeek.bif @@ -3052,7 +3052,7 @@ function decode_base64%(s: string, a: string &default=""%): string ## .. zeek:see:: decode_base64 function decode_base64_conn%(cid: conn_id, s: string, a: string &default=""%): string %{ - Connection* conn = sessions->FindConnection(cid); + Connection* conn = session_mgr->FindConnection(cid); if ( ! conn ) { zeek::emit_builtin_error("connection ID not a known connection", cid); @@ -3353,7 +3353,7 @@ static zeek::EnumValPtr map_conn_type(TransportProto tp) ## get_orig_seq get_resp_seq function get_conn_transport_proto%(cid: conn_id%): transport_proto %{ - Connection* c = sessions->FindConnection(cid); + Connection* c = session_mgr->FindConnection(cid); if ( ! c ) { zeek::emit_builtin_error("unknown connection id in get_conn_transport_proto()", cid); @@ -3385,7 +3385,7 @@ function get_port_transport_proto%(p: port%): transport_proto ## .. zeek:see:: lookup_connection function connection_exists%(c: conn_id%): bool %{ - if ( sessions->FindConnection(c) ) + if ( session_mgr->FindConnection(c) ) return zeek::val_mgr->True(); else return zeek::val_mgr->False(); @@ -3402,7 +3402,7 @@ function connection_exists%(c: conn_id%): bool ## .. zeek:see:: connection_exists function lookup_connection%(cid: conn_id%): connection %{ - Connection* conn = sessions->FindConnection(cid); + Connection* conn = session_mgr->FindConnection(cid); if ( conn ) return conn->ConnVal(); @@ -4388,7 +4388,7 @@ function file_mode%(mode: count%): string ## .. zeek:see:: Analyzer::schedule_analyzer Analyzer::name function disable_analyzer%(cid: conn_id, aid: count, err_if_no_conn: bool &default=T, prevent: bool &default=F%) : bool %{ - Connection* c = sessions->FindConnection(cid); + Connection* c = session_mgr->FindConnection(cid); if ( ! c ) { zeek::reporter->Error("cannot find connection"); @@ -4426,7 +4426,7 @@ function disable_analyzer%(cid: conn_id, aid: count, err_if_no_conn: bool &defau ## :zeek:id:`connection_finished`. function skip_further_processing%(cid: conn_id%): bool %{ - Connection* c = sessions->FindConnection(cid); + Connection* c = session_mgr->FindConnection(cid); if ( ! c ) return zeek::val_mgr->False(); @@ -4456,7 +4456,7 @@ function skip_further_processing%(cid: conn_id%): bool ## .. zeek:see:: get_contents_file set_contents_file function set_record_packets%(cid: conn_id, do_record: bool%): bool %{ - Connection* c = sessions->FindConnection(cid); + Connection* c = session_mgr->FindConnection(cid); if ( ! c ) return zeek::val_mgr->False(); @@ -4474,7 +4474,7 @@ function set_record_packets%(cid: conn_id, do_record: bool%): bool ## Returns: The previous timeout interval. function set_inactivity_timeout%(cid: conn_id, t: interval%): interval %{ - Connection* c = sessions->FindConnection(cid); + Connection* c = session_mgr->FindConnection(cid); if ( ! c ) return zeek::make_intrusive(0.0); diff --git a/testing/btest/plugins/packet-protocol-plugin/src/LLCDemo.cc b/testing/btest/plugins/packet-protocol-plugin/src/LLCDemo.cc index 5ecb526505..26a2a4cc27 100644 --- a/testing/btest/plugins/packet-protocol-plugin/src/LLCDemo.cc +++ b/testing/btest/plugins/packet-protocol-plugin/src/LLCDemo.cc @@ -1,7 +1,7 @@ #include "LLCDemo.h" #include "zeek/Event.h" #include "zeek/Val.h" -#include "zeek/Sessions.h" +#include "zeek/SessionManager.h" #include "events.bif.h" using namespace zeek::packet_analysis::PacketDemo; diff --git a/testing/btest/plugins/packet-protocol-plugin/src/RawLayer.cc b/testing/btest/plugins/packet-protocol-plugin/src/RawLayer.cc index d1c3e348d0..fff1119328 100644 --- a/testing/btest/plugins/packet-protocol-plugin/src/RawLayer.cc +++ b/testing/btest/plugins/packet-protocol-plugin/src/RawLayer.cc @@ -1,7 +1,7 @@ #include "RawLayer.h" #include "zeek/Event.h" #include "zeek/Val.h" -#include "zeek/Sessions.h" +#include "zeek/SessionManager.h" #include "events.bif.h"