30 #ifndef TINS_TCP_IP_FLOW_H 31 #define TINS_TCP_IP_FLOW_H 33 #include <tins/config.h> 35 #ifdef TINS_HAVE_TCPIP 40 #include <tins/macros.h> 41 #include <tins/tcp_ip/ack_tracker.h> 42 #include <tins/tcp_ip/data_tracker.h> 87 typedef DataTracker::payload_type payload_type;
92 typedef DataTracker::buffered_payload_type buffered_payload_type;
97 typedef std::function<void(Flow&)> data_available_callback_type;
105 typedef std::function<void(Flow&,
107 const payload_type&)> flow_packet_callback_type;
116 Flow(
const IPv4Address& dst_address, uint16_t dst_port,
117 uint32_t sequence_number);
126 Flow(
const IPv6Address& dst_address, uint16_t dst_port,
127 uint32_t sequence_number);
137 void data_callback(
const data_available_callback_type& callback);
147 void out_of_order_callback(
const flow_packet_callback_type& callback);
163 void process_packet(PDU& pdu);
181 void advance_sequence(uint32_t seq);
194 bool is_finished()
const;
204 bool packet_belongs(
const PDU& packet)
const;
211 IPv4Address dst_addr_v4()
const;
218 IPv6Address dst_addr_v6()
const;
223 uint16_t dport()
const;
228 const payload_type& payload()
const;
233 payload_type& payload();
243 uint32_t sequence_number()
const;
248 const buffered_payload_type& buffered_payload()
const;
253 buffered_payload_type& buffered_payload();
258 uint32_t total_buffered_bytes()
const;
265 void state(State new_state);
273 void ignore_data_packets();
285 bool sack_permitted()
const;
294 void enable_ack_tracking();
299 bool ack_tracking_enabled()
const;
301 #ifdef TINS_HAVE_ACK_TRACKER 305 const AckTracker& ack_tracker()
const;
310 AckTracker& ack_tracker();
311 #endif // TINS_HAVE_ACK_TRACKER 315 flags() : is_v6(0), ignore_data_packets(0), sack_permitted(0), ack_tracking(0) {
320 ignore_data_packets:1,
325 void update_state(
const TCP& tcp);
328 DataTracker data_tracker_;
329 std::array<uint8_t, 16> dest_address_;
331 data_available_callback_type on_data_callback_;
332 flow_packet_callback_type on_out_of_order_callback_;
336 #ifdef TINS_HAVE_ACK_TRACKER 337 AckTracker ack_tracker_;
338 #endif // TINS_HAVE_ACK_TRACKER 344 #endif // TINS_HAVE_TCPIP 345 #endif // TINS_TCP_IP_FLOW_H The Tins namespace.
Definition: address_range.h:38