Rename ConnID and ConnIDKey

This commit is contained in:
Tim Wojtulewicz 2021-04-29 10:23:53 -07:00
parent 0b7ca5e7bc
commit 9684624a52
8 changed files with 39 additions and 35 deletions

View file

@ -10,7 +10,7 @@ namespace zeek::session::detail {
/**
* This type is used as the key for the map in SessionManager. It represents a
* raw block of memory that points to a key of some type for a session, such as
* a ConnIDKey for a Connection. This allows us to do type-independent
* a ConnKey for a Connection. This allows us to do type-independent
* comparison of the keys in the map. By default, this type does not maintain
* the lifetime of the data pointed to by the Key. It only holds a
* pointer. When a Key object is inserted into the SessionManager's map,

View file

@ -129,7 +129,7 @@ void Manager::ProcessTransportLayer(double t, const Packet* pkt, size_t remainin
const u_char* data = ip_hdr->Payload();
ConnID id;
ConnTuple id;
id.src_addr = ip_hdr->SrcAddr();
id.dst_addr = ip_hdr->DstAddr();
BifEnum::Tunnel::Type tunnel_type = BifEnum::Tunnel::IP;
@ -188,7 +188,7 @@ void Manager::ProcessTransportLayer(double t, const Packet* pkt, size_t remainin
return;
}
zeek::detail::ConnIDKey conn_key(id);
zeek::detail::ConnKey conn_key(id);
detail::Key key(&conn_key, sizeof(conn_key), false);
Connection* conn = nullptr;
@ -375,7 +375,7 @@ Connection* Manager::FindConnection(Val* v)
auto orig_portv = vl->GetFieldAs<PortVal>(orig_p);
auto resp_portv = vl->GetFieldAs<PortVal>(resp_p);
zeek::detail::ConnIDKey conn_key(orig_addr, resp_addr,
zeek::detail::ConnKey conn_key(orig_addr, resp_addr,
htons((unsigned short) orig_portv->Port()),
htons((unsigned short) resp_portv->Port()),
orig_portv->PortType(), false);
@ -482,7 +482,7 @@ void Manager::GetStats(Stats& s)
s.num_packets = packet_mgr->PacketsProcessed();
}
Connection* Manager::NewConn(const zeek::detail::ConnIDKey& k, double t, const ConnID* id,
Connection* Manager::NewConn(const zeek::detail::ConnKey& k, double t, const ConnTuple* id,
const u_char* data, int proto, uint32_t flow_label,
const Packet* pkt)
{

View file

@ -20,7 +20,7 @@ namespace detail { class PacketFilter; }
class EncapsulationStack;
class Packet;
class Connection;
struct ConnID;
struct ConnTuple;
class StatBlocks;
namespace session {
@ -64,7 +64,7 @@ public:
* @param proto The transport protocol for the connection.
* @return The connection, or nullptr if one doesn't exist.
*/
Connection* FindConnection(const zeek::detail::ConnIDKey& key, TransportProto proto);
Connection* FindConnection(const zeek::detail::ConnKey& key, TransportProto proto);
void Remove(Session* s);
void Insert(Session* c);
@ -148,7 +148,7 @@ private:
using SessionMap = std::map<detail::Key, Session*>;
Connection* NewConn(const zeek::detail::ConnIDKey& k, double t, const ConnID* id,
Connection* NewConn(const zeek::detail::ConnKey& k, double t, const ConnTuple* id,
const u_char* data, int proto, uint32_t flow_label,
const Packet* pkt);