• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

OISF / suricata / 23374838686

21 Mar 2026 07:29AM UTC coverage: 59.341% (-20.0%) from 79.315%
23374838686

Pull #15075

github

web-flow
Merge 90b4e834f into 6587e363a
Pull Request #15075: Stack 8001 v16.4

38 of 70 new or added lines in 10 files covered. (54.29%)

34165 existing lines in 563 files now uncovered.

119621 of 201584 relevant lines covered (59.34%)

650666.92 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

14.29
/src/flow-queue.h
1
/* Copyright (C) 2007-2012 Open Information Security Foundation
2
 *
3
 * You can copy, redistribute or modify this Program under the terms of
4
 * the GNU General Public License version 2 as published by the Free
5
 * Software Foundation.
6
 *
7
 * This program is distributed in the hope that it will be useful,
8
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
 * GNU General Public License for more details.
11
 *
12
 * You should have received a copy of the GNU General Public License
13
 * version 2 along with this program; if not, write to the Free Software
14
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15
 * 02110-1301, USA.
16
 */
17

18
/**
19
 * \file
20
 *
21
 * \author Victor Julien <victor@inliniac.net>
22
 */
23

24
#ifndef SURICATA_FLOW_QUEUE_H
25
#define SURICATA_FLOW_QUEUE_H
26

27
#include "suricata-common.h"
28

29
/** Spinlocks or Mutex for the flow queues. */
30
//#define FQLOCK_SPIN
31
#define FQLOCK_MUTEX
32

33
#ifdef FQLOCK_SPIN
34
    #ifdef FQLOCK_MUTEX
35
        #error Cannot enable both FQLOCK_SPIN and FQLOCK_MUTEX
36
    #endif
37
#endif
38

39
typedef struct FlowQueuePrivate_
40
{
41
    Flow *top;
42
    Flow *bot;
43
    uint32_t len;
44
} FlowQueuePrivate;
45

46
/* Define a queue for storing flows */
47
typedef struct FlowQueue_
48
{
49
    FlowQueuePrivate priv;
50
    SC_ATOMIC_DECLARE(bool,non_empty);
51
#ifdef FQLOCK_MUTEX
52
    SCMutex m;
53
#elif defined FQLOCK_SPIN
54
    SCSpinlock s;
55
#else
56
    #error Enable FQLOCK_SPIN or FQLOCK_MUTEX
57
#endif
58
} FlowQueue;
UNCOV
59
#define qtop priv.top
×
UNCOV
60
#define qbot priv.bot
×
UNCOV
61
#define qlen priv.len
×
62

63
#ifdef FQLOCK_SPIN
64
    #define FQLOCK_INIT(q) SCSpinInit(&(q)->s, 0)
65
    #define FQLOCK_DESTROY(q) SCSpinDestroy(&(q)->s)
66
    #define FQLOCK_LOCK(q) SCSpinLock(&(q)->s)
67
    #define FQLOCK_TRYLOCK(q) SCSpinTrylock(&(q)->s)
68
    #define FQLOCK_UNLOCK(q) SCSpinUnlock(&(q)->s)
69
#elif defined FQLOCK_MUTEX
70
    #define FQLOCK_INIT(q) SCMutexInit(&(q)->m, NULL)
3✔
UNCOV
71
    #define FQLOCK_DESTROY(q) SCMutexDestroy(&(q)->m)
×
UNCOV
72
    #define FQLOCK_LOCK(q) SCMutexLock(&(q)->m)
×
73
    #define FQLOCK_TRYLOCK(q) SCMutexTrylock(&(q)->m)
UNCOV
74
    #define FQLOCK_UNLOCK(q) SCMutexUnlock(&(q)->m)
×
75
#else
76
    #error Enable FQLOCK_SPIN or FQLOCK_MUTEX
77
#endif
78

79
/* prototypes */
80
FlowQueue *FlowQueueNew(void);
81
FlowQueue *FlowQueueInit(FlowQueue *);
82
void FlowQueueDestroy (FlowQueue *);
83

84
void FlowEnqueue (FlowQueue *, Flow *);
85
Flow *FlowDequeue (FlowQueue *);
86
void FlowQueueRemove(FlowQueue *fq, Flow *f);
87

88
void FlowQueuePrivateAppendFlow(FlowQueuePrivate *fqc, Flow *f);
89
void FlowQueuePrivatePrependFlow(FlowQueuePrivate *fqc, Flow *f);
90

91
void FlowQueueAppendPrivate(FlowQueue *fq, FlowQueuePrivate *fqp);
92
void FlowQueuePrivateAppendPrivate(FlowQueuePrivate *dest, FlowQueuePrivate *src);
93
FlowQueuePrivate FlowQueueExtractPrivate(FlowQueue *fq);
94
Flow *FlowQueuePrivateGetFromTop(FlowQueuePrivate *fqp);
95

96
#endif /* SURICATA_FLOW_QUEUE_H */
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc