Refactoring L2 parsing code to reside in the Packet class.

That way it can be reused more easily. This also avoid having to
change the serialization structure for packets, which is a problem as
external sources of packets (via Broccoli) wouldn't have the new
attributes available to send.

Also moving Packet.{h,cc} and Layer2.{h,cc} into iosource/, and
removing header size from properties that packet sources have to
provide, as we can now compute that easily from the link type.

Plus some more cleanup.
This commit is contained in:
Robin Sommer 2015-07-20 11:45:28 -07:00
parent 64a478dbd5
commit c72d191ab5
17 changed files with 43 additions and 437 deletions

View file

@ -215,22 +215,6 @@ public:
*/
virtual void Statistics(Stats* stats) = 0;
/**
* Helper method to return the header size for a given link tyoe.
*
* @param link_type The link tyoe.
*
* @return The header size in bytes.
*/
static int GetLinkHeaderSize(int link_type);
/**
* Return the pcap link encapsulation type we started with.
*
* @return DLT_EN10MB (etc.)
*/
int GetLinkEncap(void);
protected:
friend class Manager;
@ -258,13 +242,6 @@ protected:
*/
int link_type;
/**
* The size of the link-layer header for packets from this
* source. \a GetLinkHeaderSize() may be used to derive this
* value.
*/
int hdr_size;
/**
* Returns the netmask associated with the source, or \c
* NETMASK_UNKNOWN if unknown.