30 #ifndef TINS_IP_REASSEMBLER_H 31 #define TINS_IP_REASSEMBLER_H 36 #include <tins/macros.h> 37 #include <tins/ip_address.h> 50 IPv4Fragment() : offset_() { }
53 IPv4Fragment(T* pdu, uint16_t offset)
54 : payload_(pdu->serialize()), offset_(offset) {
58 const payload_type& payload()
const {
62 uint16_t offset()
const {
66 payload_type payload_;
70 class TINS_API IPv4Stream {
74 void add_fragment(IP* ip);
75 bool is_complete()
const;
76 PDU* allocate_pdu()
const;
77 const IP& first_fragment()
const;
79 typedef std::vector<IPv4Fragment> fragments_type;
81 uint16_t extract_offset(
const IP* ip);
82 bool extract_more_frag(
const IP* ip);
84 fragments_type fragments_;
85 size_t received_size_;
173 void clear_streams();
187 typedef std::pair<IPv4Address, IPv4Address> address_pair;
188 typedef std::pair<uint16_t, address_pair> key_type;
189 typedef std::map<key_type, Internals::IPv4Stream> streams_type;
191 key_type make_key(
const IP* ip)
const;
194 streams_type streams_;
201 template<
typename Functor>
225 return functor_(pdu);
242 template<
typename Functor>
249 #endif // TINS_IP_REASSEMBLER_H Class that represents an IP PDU.
Definition: ip.h:63
OverlappingTechnique
Definition: ip_reassembler.h:137
PacketStatus
Definition: ip_reassembler.h:125
IPv4ReassemblerProxy(Functor func)
Definition: ip_reassembler.h:209
bool operator()(PDU &pdu)
Tries to reassemble the packet and forwards it to the functor.
Definition: ip_reassembler.h:222
Definition: ip_reassembler.h:202
The Tins namespace.
Definition: address_range.h:38
IPv4ReassemblerProxy< Functor > make_ipv4_reassembler_proxy(Functor func)
Definition: ip_reassembler.h:243
The given packet is not fragmented.
Definition: ip_reassembler.h:126
Abstraction of an IPv4 address.
Definition: ip_address.h:45
byte_array serialization_type
Definition: pdu.h:112
The given packet is fragmented and can't be reassembled yet.
Definition: ip_reassembler.h:127
Base class for protocol data units.
Definition: pdu.h:107
Reassembles fragmented IP packets.
Definition: ip_reassembler.h:120