]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
stream: list management cleanups
authorVictor Julien <victor@inliniac.net>
Wed, 8 Mar 2017 22:20:44 +0000 (23:20 +0100)
committerVictor Julien <victor@inliniac.net>
Thu, 20 Apr 2017 15:41:11 +0000 (17:41 +0200)
src/stream-tcp-list.c

index 2a739c25c16c0d25a074b1fda051e10b31e9e401..abcd4fea56bac2d34640def202841bb5426f48e3 100644 (file)
@@ -583,36 +583,36 @@ int StreamTcpReassembleInsertSegment(ThreadVars *tv, TcpReassemblyThreadCtx *ra_
  */
 
 
-static inline int SegmentInUse(TcpSession *ssn, TcpStream *stream, TcpSegment *seg)
+static inline bool SegmentInUse(const TcpStream *stream, const TcpSegment *seg)
 {
     /* if proto detect isn't done, we're not returning */
     if (!(stream->flags & (STREAMTCP_STREAM_FLAG_GAP|STREAMTCP_STREAM_FLAG_NOREASSEMBLY))) {
         if (!(StreamTcpIsSetStreamFlagAppProtoDetectionCompleted(stream))) {
-            SCReturnInt(1);
+            SCReturnInt(true);
         }
     }
 
-    SCReturnInt(0);
+    SCReturnInt(false);
 }
 
 
 /** \internal
  *  \brief check if we can remove a segment from our segment list
  *
- *  \retval 1 yes
- *  \retval 0 no
+ *  \retval true
+ *  \retval false
  */
-static inline int StreamTcpReturnSegmentCheck(const Flow *f, TcpSession *ssn, TcpStream *stream, TcpSegment *seg)
+static inline bool StreamTcpReturnSegmentCheck(const TcpStream *stream, const TcpSegment *seg)
 {
-    if (SegmentInUse(ssn, stream, seg)) {
-        SCReturnInt(0);
+    if (SegmentInUse(stream, seg)) {
+        SCReturnInt(false);
     }
 
     if (!(StreamingBufferSegmentIsBeforeWindow(&stream->sb, &seg->sbseg))) {
-        SCReturnInt(0);
+        SCReturnInt(false);
     }
 
-    SCReturnInt(1);
+    SCReturnInt(true);
 }
 
 static inline uint64_t GetLeftEdge(TcpSession *ssn, TcpStream *stream)
@@ -689,7 +689,7 @@ static inline uint64_t GetLeftEdge(TcpSession *ssn, TcpStream *stream)
                 break;
             }
 
-            if (SegmentInUse(ssn, stream, seg)) {
+            if (SegmentInUse(stream, seg)) {
                 left_edge = TCP_SEG_OFFSET(seg);
                 SCLogDebug("in-use seg before left_edge, adjust to %"PRIu64" and bail", left_edge);
                 break;
@@ -798,7 +798,7 @@ void StreamTcpPruneSession(Flow *f, uint8_t flags)
                 seg, seg->seq, TCP_SEG_LEN(seg),
                 (uint32_t)(seg->seq + TCP_SEG_LEN(seg)), seg->flags);
 
-        if (StreamTcpReturnSegmentCheck(f, ssn, stream, seg) == 0) {
+        if (StreamTcpReturnSegmentCheck(stream, seg) == 0) {
             SCLogDebug("not removing segment");
             break;
         }