mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Move old TCP analyzer into analyzer adapter in packet analysis tree
This commit is contained in:
parent
b171f94729
commit
f6e31107e1
25 changed files with 2243 additions and 2247 deletions
|
@ -2,18 +2,41 @@
|
|||
|
||||
#include "zeek/packet_analysis/protocol/tcp/TCP.h"
|
||||
#include "zeek/RunState.h"
|
||||
#include "zeek/analyzer/protocol/pia/PIA.h"
|
||||
#include "zeek/packet_analysis/protocol/tcp/TCPSessionAdapter.h"
|
||||
|
||||
using namespace zeek::packet_analysis::TCP;
|
||||
using namespace zeek::packet_analysis::IP;
|
||||
|
||||
TCPAnalyzer::TCPAnalyzer() : IPBasedAnalyzer("TCP", TRANSPORT_TCP, TCP_PORT_MASK, false)
|
||||
{
|
||||
new_plugin = true;
|
||||
}
|
||||
|
||||
TCPAnalyzer::~TCPAnalyzer()
|
||||
{
|
||||
}
|
||||
|
||||
void TCPAnalyzer::Initialize()
|
||||
{
|
||||
}
|
||||
|
||||
SessionAdapter* TCPAnalyzer::MakeSessionAdapter(Connection* conn)
|
||||
{
|
||||
auto* root = new TCPSessionAdapter(conn);
|
||||
root->SetParent(this);
|
||||
|
||||
conn->EnableStatusUpdateTimer();
|
||||
conn->SetInactivityTimeout(zeek::detail::udp_inactivity_timeout);
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
zeek::analyzer::pia::PIA* TCPAnalyzer::MakePIA(Connection* conn)
|
||||
{
|
||||
return new analyzer::pia::PIA_TCP(conn);
|
||||
}
|
||||
|
||||
bool TCPAnalyzer::BuildConnTuple(size_t len, const uint8_t* data, Packet* packet,
|
||||
ConnTuple& tuple)
|
||||
{
|
||||
|
@ -74,3 +97,13 @@ bool TCPAnalyzer::WantConnection(uint16_t src_port, uint16_t dst_port,
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
void TCPAnalyzer::DeliverPacket(Connection* c, double t, bool is_orig, int remaining, Packet* pkt)
|
||||
{
|
||||
auto* ta = static_cast<TCPSessionAdapter*>(c->GetSessionAdapter());
|
||||
|
||||
const u_char* data = pkt->ip_hdr->Payload();
|
||||
int len = pkt->ip_hdr->PayloadLen();
|
||||
|
||||
ta->DeliverPacket(len, data, is_orig, {}, pkt->ip_hdr.get(), remaining);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue