GH-1186: Remove Packet::hdr_size and uses of it.

This change also removes Packet::IP(), since Packet now contains an ip_hdr member
that points at the IP header if it exists.
This commit is contained in:
Tim Wojtulewicz 2020-10-27 15:50:24 -07:00
parent 8337b4cf2d
commit b3eb63c48a
10 changed files with 36 additions and 69 deletions

View file

@ -49,7 +49,6 @@ void Packet::Init(int arg_link_type, pkt_timeval *arg_ts, uint32_t arg_caplen,
dump_packet = false;
time = ts.tv_sec + double(ts.tv_usec) / 1e6;
hdr_size = 0;
eth_type = 0;
vlan = 0;
inner_vlan = 0;
@ -84,11 +83,6 @@ Packet::~Packet()
delete [] data;
}
const IP_Hdr Packet::IP() const
{
return IP_Hdr((struct ip *) (data + hdr_size), false);
}
void Packet::Weird(const char* name)
{
sessions->Weird(name, this);

View file

@ -114,12 +114,6 @@ public:
uint32_t len, const u_char *data, bool copy = false,
std::string tag = "");
/**
* Interprets the Layer 3 of the packet as IP and returns a
* corresponding object.
*/
const IP_Hdr IP() const;
/**
* Returns a \c raw_pkt_hdr RecordVal, which includes layer 2 and
* also everything in IP_Hdr (i.e., IP4/6 + TCP/UDP/ICMP).
@ -156,11 +150,6 @@ public:
// These are computed from Layer 2 data. These fields are only valid if
// l2_valid returns true.
/**
* Layer 2 header size. Valid iff l2_valid is true.
*/
uint32_t hdr_size;
/**
* Layer 3 protocol identified (if any). Valid iff l2_valid is true.
*/