30 #ifndef TINS_TCP_IP_STREAM_FOLLOWER_H 31 #define TINS_TCP_IP_STREAM_FOLLOWER_H 33 #include <tins/config.h> 35 #ifdef TINS_HAVE_TCPIP 38 #include <tins/tcp_ip/stream.h> 39 #include <tins/tcp_ip/stream_identifier.h> 78 class TINS_API StreamFollower {
83 typedef Stream::stream_callback_type stream_callback_type;
88 typedef StreamIdentifier stream_id;
93 enum TerminationReason {
104 typedef std::function<void(Stream&, TerminationReason)> stream_termination_callback_type;
120 void process_packet(PDU& packet);
131 void process_packet(Packet& packet);
141 void new_stream_callback(
const stream_callback_type& callback);
154 void stream_termination_callback(
const stream_termination_callback_type& callback);
162 template <
typename Rep,
typename Period>
163 void stream_keep_alive(
const std::chrono::duration<Rep, Period>& keep_alive) {
164 stream_keep_alive_ = keep_alive;
175 Stream& find_stream(
const IPv4Address& client_addr, uint16_t client_port,
176 const IPv4Address& server_addr, uint16_t server_port);
186 Stream& find_stream(
const IPv6Address& client_addr, uint16_t client_port,
187 const IPv6Address& server_addr, uint16_t server_port);
207 void follow_partial_streams(
bool value);
209 typedef Stream::timestamp_type timestamp_type;
211 static const size_t DEFAULT_MAX_BUFFERED_CHUNKS;
212 static const size_t DEFAULT_MAX_SACKED_INTERVALS;
213 static const uint32_t DEFAULT_MAX_BUFFERED_BYTES;
214 static const timestamp_type DEFAULT_KEEP_ALIVE;
216 typedef std::map<stream_id, Stream> streams_type;
218 Stream& find_stream(
const stream_id&
id);
219 void process_packet(PDU& packet,
const timestamp_type& ts);
220 void cleanup_streams(
const timestamp_type& now);
222 streams_type streams_;
223 stream_callback_type on_new_connection_;
224 stream_termination_callback_type on_stream_termination_;
225 size_t max_buffered_chunks_;
226 uint32_t max_buffered_bytes_;
227 timestamp_type last_cleanup_;
228 timestamp_type stream_keep_alive_;
229 bool attach_to_flows_;
235 #endif // TINS_HAVE_TCPIP 237 #endif // TINS_TCP_IP_STREAM_FOLLOWER_H The Tins namespace.
Definition: address_range.h:38