Move IP Addr/Prefix/Header classes into namespaces

This commit is contained in:
Tim Wojtulewicz 2020-07-16 16:26:22 -07:00
parent 35c61697d9
commit 25c0fc7ab2
100 changed files with 495 additions and 460 deletions

View file

@ -19,6 +19,9 @@ namespace analyzer { class ExpectedConn; }
typedef in_addr in4_addr;
namespace zeek {
namespace detail {
struct ConnIDKey {
in6_addr ip1;
in6_addr ip2;
@ -43,6 +46,13 @@ struct ConnIDKey {
}
};
/**
* Returns a map key for a given ConnID.
*/
ConnIDKey BuildConnIDKey(const ConnID& id);
} // namespace detail
/**
* Class storing both IPv4 and IPv6 addresses.
*/
@ -382,7 +392,7 @@ public:
*/
void ConvertToThreadingValue(threading::Value::addr_t* v) const;
friend ConnIDKey BuildConnIDKey(const ConnID& id);
friend detail::ConnIDKey detail::BuildConnIDKey(const ConnID& id);
unsigned int MemoryAllocation() const { return padded_sizeof(*this); }
@ -514,11 +524,6 @@ inline void IPAddr::ConvertToThreadingValue(threading::Value::addr_t* v) const
}
}
/**
* Returns a map key for a given ConnID.
*/
ConnIDKey BuildConnIDKey(const ConnID& id);
/**
* Class storing both IPv4 and IPv6 prefixes
* (i.e., \c 192.168.1.1/16 and \c FD00::/8.
@ -721,3 +726,11 @@ private:
IPAddr prefix; // We store it as an address with the non-prefix bits masked out via Mask().
uint8_t length = 0; // The bit length of the prefix relative to full IPv6 addr.
};
} // namespace zeek
using ConnIDKey [[deprecated("Remove in v4.1. Use zeek::detail::ConnIDKey.")]] = zeek::detail::ConnIDKey;
using IPAddr [[deprecated("Remove in v4.1. Use zeek::IPAddr.")]] = zeek::IPAddr;
using IPPrefix [[deprecated("Remove in v4.1. Use zeek::IPPrefix.")]] = zeek::IPPrefix;
constexpr auto BuildConnIDKey [[deprecated("Remove in v4.1. Use zeek::detail::BuildConnIDKey.")]] = zeek::detail::BuildConnIDKey;