diff --git a/src/stream-tcp-reassemble.c b/src/stream-tcp-reassemble.c index f8c177ba4e..ad2e30310d 100644 --- a/src/stream-tcp-reassemble.c +++ b/src/stream-tcp-reassemble.c @@ -331,6 +331,20 @@ static inline uint64_t GetAbsLastAck(const TcpStream *stream) } } +uint64_t StreamTcpGetAcked(const TcpStream *stream) +{ + return GetAbsLastAck(stream); +} + +uint64_t StreamTcpGetUsable(const TcpStream *stream, const bool eof) +{ + uint64_t right_edge = STREAM_BASE_OFFSET(stream) + stream->sb.buf_offset; + if (!eof && StreamTcpInlineMode() == FALSE) { + right_edge = MIN(GetAbsLastAck(stream), right_edge); + } + return right_edge; +} + #ifdef UNITTESTS /** \internal * \brief check if segments falls before stream 'offset' */ diff --git a/src/stream-tcp.h b/src/stream-tcp.h index 04e3b78edc..3b4f4fc8a4 100644 --- a/src/stream-tcp.h +++ b/src/stream-tcp.h @@ -198,5 +198,8 @@ int TcpSessionPacketSsnReuse(const Packet *p, const Flow *f, const void *tcp_ssn void StreamTcpUpdateAppLayerProgress(TcpSession *ssn, char direction, const uint32_t progress); +uint64_t StreamTcpGetAcked(const TcpStream *stream); +uint64_t StreamTcpGetUsable(const TcpStream *stream, const bool eof); + #endif /* __STREAM_TCP_H__ */