mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Deprecate the old Connection constructor and detail::ConnKey class.
The new key-based Connection constructor replaces the former, and the new ConnKey class tree replaces the latter.
This commit is contained in:
parent
52d6228b06
commit
7548dc9e96
4 changed files with 18 additions and 5 deletions
|
@ -42,6 +42,8 @@ Connection::Connection(zeek::IPBasedConnKeyPtr k, const zeek::ConnTuple& ct, dou
|
||||||
Init(flow, pkt);
|
Init(flow, pkt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
Connection::Connection(const detail::ConnKey& k, double t, const ConnTuple* id, uint32_t flow, const Packet* pkt)
|
Connection::Connection(const detail::ConnKey& k, double t, const ConnTuple* id, uint32_t flow, const Packet* pkt)
|
||||||
: Session(t, connection_timeout, connection_status_update, detail::connection_status_update_interval) {
|
: Session(t, connection_timeout, connection_status_update, detail::connection_status_update_interval) {
|
||||||
orig_addr = id->src_addr;
|
orig_addr = id->src_addr;
|
||||||
|
@ -63,6 +65,7 @@ Connection::Connection(const detail::ConnKey& k, double t, const ConnTuple* id,
|
||||||
|
|
||||||
Init(flow, pkt);
|
Init(flow, pkt);
|
||||||
}
|
}
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
Connection::~Connection() {
|
Connection::~Connection() {
|
||||||
if ( ! finished )
|
if ( ! finished )
|
||||||
|
|
|
@ -69,7 +69,10 @@ static inline int addr_port_canon_lt(const IPAddr& addr1, uint32_t p1, const IPA
|
||||||
class Connection final : public session::Session {
|
class Connection final : public session::Session {
|
||||||
public:
|
public:
|
||||||
Connection(zeek::IPBasedConnKeyPtr k, const zeek::ConnTuple& ct, double t, uint32_t flow, const Packet* pkt);
|
Connection(zeek::IPBasedConnKeyPtr k, const zeek::ConnTuple& ct, double t, uint32_t flow, const Packet* pkt);
|
||||||
|
|
||||||
|
[[deprecated("Remove in v8.1. Switch to ConnKey factories and the new zeek::ConnKey tree.")]]
|
||||||
Connection(const detail::ConnKey& k, double t, const ConnTuple* id, uint32_t flow, const Packet* pkt);
|
Connection(const detail::ConnKey& k, double t, const ConnTuple* id, uint32_t flow, const Packet* pkt);
|
||||||
|
|
||||||
~Connection() override;
|
~Connection() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -201,7 +204,8 @@ public:
|
||||||
bool IsFinished() { return finished; }
|
bool IsFinished() { return finished; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Common initialization for the constructors.
|
// Common initialization for the constructors. This can move back into the
|
||||||
|
// (sole) constructor when we remove the deprecated one in 8.1.
|
||||||
void Init(uint32_t flow, const Packet* pkt);
|
void Init(uint32_t flow, const Packet* pkt);
|
||||||
|
|
||||||
friend class session::detail::Timer;
|
friend class session::detail::Timer;
|
||||||
|
|
|
@ -27,6 +27,8 @@ ConnKey::ConnKey(const ConnTuple& id) {
|
||||||
Init(id.src_addr, id.dst_addr, id.src_port, id.dst_port, id.proto, id.is_one_way);
|
Init(id.src_addr, id.dst_addr, id.src_port, id.dst_port, id.proto, id.is_one_way);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
ConnKey& ConnKey::operator=(const ConnKey& rhs) {
|
ConnKey& ConnKey::operator=(const ConnKey& rhs) {
|
||||||
if ( this == &rhs )
|
if ( this == &rhs )
|
||||||
return *this;
|
return *this;
|
||||||
|
@ -45,6 +47,7 @@ ConnKey& ConnKey::operator=(const ConnKey& rhs) {
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
ConnKey::ConnKey(Val* v) {
|
ConnKey::ConnKey(Val* v) {
|
||||||
const auto& vt = v->GetType();
|
const auto& vt = v->GetType();
|
||||||
|
|
11
src/IPAddr.h
11
src/IPAddr.h
|
@ -25,6 +25,7 @@ constexpr uint16_t INVALID_CONN_KEY_IP_PROTO = 65534;
|
||||||
|
|
||||||
class HashKey;
|
class HashKey;
|
||||||
|
|
||||||
|
// Deprecated: Remove the whole class in v8.1. Switch usage to the conntuple factories and the new zeek::ConnKey tree.
|
||||||
class ConnKey {
|
class ConnKey {
|
||||||
public:
|
public:
|
||||||
in6_addr ip1;
|
in6_addr ip1;
|
||||||
|
@ -33,10 +34,12 @@ public:
|
||||||
uint16_t port2 = 0;
|
uint16_t port2 = 0;
|
||||||
uint16_t transport = INVALID_CONN_KEY_IP_PROTO;
|
uint16_t transport = INVALID_CONN_KEY_IP_PROTO;
|
||||||
|
|
||||||
ConnKey(const IPAddr& src, const IPAddr& dst, uint16_t src_port, uint16_t dst_port, uint16_t proto, bool one_way);
|
[[deprecated("Remove in v8.1: Switch to new conn_key framework")]] ConnKey(const IPAddr& src, const IPAddr& dst,
|
||||||
ConnKey(const ConnTuple& conn);
|
uint16_t src_port, uint16_t dst_port,
|
||||||
ConnKey(const ConnKey& rhs) { *this = rhs; }
|
uint16_t proto, bool one_way);
|
||||||
ConnKey(Val* v);
|
[[deprecated("Remove in v8.1: Switch to new conn_key framework")]] ConnKey(const ConnTuple& conn);
|
||||||
|
[[deprecated("Remove in v8.1: Switch to new conn_key framework")]] ConnKey(const ConnKey& rhs) { *this = rhs; }
|
||||||
|
[[deprecated("Remove in v8.1: Switch to new conn_key framework")]] ConnKey(Val* v);
|
||||||
|
|
||||||
// FIXME: This is getting reworked as part of the connection tuple changes. Suppress
|
// FIXME: This is getting reworked as part of the connection tuple changes. Suppress
|
||||||
// the clang-tidy warning for the time being.
|
// the clang-tidy warning for the time being.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue