Rework Session/Connection tracking to use a std::map instead of PDict

This commit is contained in:
Tim Wojtulewicz 2019-07-29 11:14:58 -07:00
parent 8ab0650c1e
commit 57f29f3e7c
7 changed files with 183 additions and 147 deletions

View file

@ -14,14 +14,9 @@ const uint8_t IPAddr::v4_mapped_prefix[12] = { 0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0xff, 0xff };
HashKey* BuildConnIDHashKey(const ConnID& id)
ConnIDKey BuildConnIDKey(const ConnID& id)
{
struct {
in6_addr ip1;
in6_addr ip2;
uint16_t port1;
uint16_t port2;
} key;
ConnIDKey key;
// Lookup up connection based on canonical ordering, which is
// the smaller of <src addr, src port> and <dst addr, dst port>
@ -43,7 +38,7 @@ HashKey* BuildConnIDHashKey(const ConnID& id)
key.port2 = id.src_port;
}
return new HashKey(&key, sizeof(key));
return key;
}
static inline uint32_t bit_mask32(int bottom_bits)