• 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

75.0
/src/host-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_HOST_QUEUE_H
25
#define SURICATA_HOST_QUEUE_H
26

27
#include "suricata-common.h"
28
#include "host.h"
29

30
/** Spinlocks or Mutex for the host queues. */
31
//#define HQLOCK_SPIN
32
#define HQLOCK_MUTEX
33

34
#ifdef HQLOCK_SPIN
35
    #ifdef HQLOCK_MUTEX
36
        #error Cannot enable both HQLOCK_SPIN and HQLOCK_MUTEX
37
    #endif
38
#endif
39

40
/* Define a queue for storing hosts */
41
typedef struct HostQueue_
42
{
43
    Host *top;
44
    Host *bot;
45
    uint32_t len;
46
#ifdef DBG_PERF
47
    uint32_t dbg_maxlen;
48
#endif /* DBG_PERF */
49
#ifdef HQLOCK_MUTEX
50
    SCMutex m;
51
#elif defined HQLOCK_SPIN
52
    SCSpinlock s;
53
#else
54
    #error Enable HQLOCK_SPIN or HQLOCK_MUTEX
55
#endif
56
} HostQueue;
57

58
#ifdef HQLOCK_SPIN
59
    #define HQLOCK_INIT(q) SCSpinInit(&(q)->s, 0)
60
    #define HQLOCK_DESTROY(q) SCSpinDestroy(&(q)->s)
61
    #define HQLOCK_LOCK(q) SCSpinLock(&(q)->s)
62
    #define HQLOCK_TRYLOCK(q) SCSpinTrylock(&(q)->s)
63
    #define HQLOCK_UNLOCK(q) SCSpinUnlock(&(q)->s)
64
#elif defined HQLOCK_MUTEX
65
    #define HQLOCK_INIT(q) SCMutexInit(&(q)->m, NULL)
2✔
UNCOV
66
    #define HQLOCK_DESTROY(q) SCMutexDestroy(&(q)->m)
×
67
    #define HQLOCK_LOCK(q) SCMutexLock(&(q)->m)
2,049✔
68
    #define HQLOCK_TRYLOCK(q) SCMutexTrylock(&(q)->m)
69
    #define HQLOCK_UNLOCK(q) SCMutexUnlock(&(q)->m)
2,049✔
70
#else
71
    #error Enable HQLOCK_SPIN or HQLOCK_MUTEX
72
#endif
73

74
/* prototypes */
75
HostQueue *HostQueueNew(void);
76
HostQueue *HostQueueInit(HostQueue *);
77
void HostQueueDestroy (HostQueue *);
78

79
void HostEnqueue (HostQueue *, Host *);
80
Host *HostDequeue(HostQueue *);
81

82
#endif /* SURICATA_HOST_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