From 17da10d76e2cc1536e2859ac5ab688dc3ba3e02c Mon Sep 17 00:00:00 2001 From: Matias Fontanini Date: Sat, 20 Feb 2016 22:19:12 -0800 Subject: [PATCH] Add extract_metadata to main PDU classes --- include/tins/arp.h | 8 +++++++ include/tins/bootp.h | 3 ++- include/tins/dhcp.h | 8 +++++++ include/tins/dhcpv6.h | 8 +++++++ include/tins/dns.h | 8 +++++++ include/tins/dot1q.h | 14 +++++++++--- include/tins/dot3.h | 10 ++++++++- include/tins/eapol.h | 8 +++++++ include/tins/ethernetII.h | 8 +++++++ include/tins/icmp.h | 8 +++++++ include/tins/internals.h | 2 ++ include/tins/ip.h | 8 +++++++ include/tins/ipv6.h | 8 +++++++ include/tins/pdu.h | 32 ++++++++++++++++++++++++++++ include/tins/tcp.h | 8 +++++++ include/tins/tins.h | 1 + include/tins/udp.h | 8 +++++++ src/arp.cpp | 7 ++++++ src/dhcp.cpp | 7 ++++++ src/dhcpv6.cpp | 7 ++++++ src/dns.cpp | 7 ++++++ src/dot1q.cpp | 13 ++++++++--- src/dot3.cpp | 7 ++++++ src/eapol.cpp | 11 +++++++++- src/ethernetII.cpp | 12 ++++++++++- src/icmp.cpp | 7 ++++++ src/internals.cpp | 45 ++++++++++++++++++++++++++++++++++++++- src/ip.cpp | 10 +++++++++ src/ipv6.cpp | 20 ++++++++++++++++- src/pdu.cpp | 12 +++++++++++ src/tcp.cpp | 8 +++++++ src/udp.cpp | 7 ++++++ 32 files changed, 318 insertions(+), 12 deletions(-) diff --git a/include/tins/arp.h b/include/tins/arp.h index 9ed65a4..1fbba86 100644 --- a/include/tins/arp.h +++ b/include/tins/arp.h @@ -72,6 +72,14 @@ public: REPLY = 0x0002 }; + /** + * \brief Extracts metadata for this protocol based on the buffer provided + * + * \param buffer Pointer to a buffer + * \param total_sz Size of the buffer pointed by buffer + */ + static metadata extract_metadata(const uint8_t *buffer, uint32_t total_sz); + /** * \brief Constructs an ARP object using the provided addresses. * diff --git a/include/tins/bootp.h b/include/tins/bootp.h index c6e9294..7d27175 100644 --- a/include/tins/bootp.h +++ b/include/tins/bootp.h @@ -333,7 +333,7 @@ protected: vend_type& vend() { return vend_; } void write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU* parent); -private: + /** * Struct that represents the Bootp datagram. */ @@ -355,6 +355,7 @@ private: uint8_t file[128]; } TINS_END_PACK; +private: bootp_header bootp_; vend_type vend_; }; diff --git a/include/tins/dhcp.h b/include/tins/dhcp.h index 8db8d65..ea8aec5 100644 --- a/include/tins/dhcp.h +++ b/include/tins/dhcp.h @@ -172,6 +172,14 @@ public: */ typedef std::list