mirror of
https://github.com/zeek/zeek.git
synced 2025-10-07 00:58:19 +00:00
Various tweaks/refactor of new IPAddr class usages or IPv6 related code.
- non-binpac DNS analyzer now also generates dns_a6_reply event - ExpectedConn class refactored to use IPAddr's - BinaryExpr::AddrFold simplified - IP_Hdr src/dst address accessor methods changed to construct IPAddr objects on the fly from ip4/ip6 members. Addresses #770.
This commit is contained in:
parent
808f3915e5
commit
93fa116738
5 changed files with 76 additions and 60 deletions
20
src/IP.h
20
src/IP.h
|
@ -10,26 +10,22 @@
|
|||
class IP_Hdr {
|
||||
public:
|
||||
IP_Hdr(struct ip* arg_ip4)
|
||||
: ip4(arg_ip4), ip6(0),
|
||||
src_addr(arg_ip4->ip_src), dst_addr(arg_ip4->ip_dst), del(1)
|
||||
: ip4(arg_ip4), ip6(0), del(1)
|
||||
{
|
||||
}
|
||||
|
||||
IP_Hdr(const struct ip* arg_ip4)
|
||||
: ip4(arg_ip4), ip6(0),
|
||||
src_addr(arg_ip4->ip_src), dst_addr(arg_ip4->ip_dst), del(0)
|
||||
: ip4(arg_ip4), ip6(0), del(0)
|
||||
{
|
||||
}
|
||||
|
||||
IP_Hdr(struct ip6_hdr* arg_ip6)
|
||||
: ip4(0), ip6(arg_ip6),
|
||||
src_addr(arg_ip6->ip6_src), dst_addr(arg_ip6->ip6_dst), del(1)
|
||||
: ip4(0), ip6(arg_ip6), del(1)
|
||||
{
|
||||
}
|
||||
|
||||
IP_Hdr(const struct ip6_hdr* arg_ip6)
|
||||
: ip4(0), ip6(arg_ip6),
|
||||
src_addr(arg_ip6->ip6_src), dst_addr(arg_ip6->ip6_dst), del(0)
|
||||
: ip4(0), ip6(arg_ip6), del(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -47,8 +43,10 @@ public:
|
|||
const struct ip* IP4_Hdr() const { return ip4; }
|
||||
const struct ip6_hdr* IP6_Hdr() const { return ip6; }
|
||||
|
||||
const IPAddr& SrcAddr() const { return src_addr; }
|
||||
const IPAddr& DstAddr() const { return dst_addr; }
|
||||
IPAddr SrcAddr() const
|
||||
{ return ip4 ? IPAddr(ip4->ip_src) : IPAddr(ip6->ip6_src); }
|
||||
IPAddr DstAddr() const
|
||||
{ return ip4 ? IPAddr(ip4->ip_dst) : IPAddr(ip6->ip6_dst); }
|
||||
|
||||
//TODO: needs adapting/replacement for IPv6 support
|
||||
uint16 ID4() const { return ip4 ? ip4->ip_id : 0; }
|
||||
|
@ -92,8 +90,6 @@ public:
|
|||
private:
|
||||
const struct ip* ip4;
|
||||
const struct ip6_hdr* ip6;
|
||||
IPAddr src_addr;
|
||||
IPAddr dst_addr;
|
||||
int del;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue