suricata
packet-queue.h
Go to the documentation of this file.
1 /* Copyright (C) 2007-2019 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_PACKET_QUEUE_H
25 #define SURICATA_PACKET_QUEUE_H
26 
27 #include "threads.h"
28 
29 /** \brief simple fifo queue for packets
30  *
31  * \note PacketQueueNoLock and PacketQueue need to keep identical
32  * layouts except for the mutex_q and cond_q fields.
33  */
34 typedef struct PacketQueueNoLock_ {
35  struct Packet_ *top;
36  struct Packet_ *bot;
37  uint32_t len;
38 #ifdef DBG_PERF
39  uint32_t dbg_maxlen;
40 #endif /* DBG_PERF */
42 
43 /** \brief simple fifo queue for packets with mutex and cond
44  * Calling the mutex or triggering the cond is responsibility of the caller
45  *
46  * \note PacketQueueNoLock and PacketQueue need to keep identical
47  * layouts except for the mutex_q and cond_q fields.
48  */
49 typedef struct PacketQueue_ {
50  struct Packet_ *top;
51  struct Packet_ *bot;
52  uint32_t len;
53 #ifdef DBG_PERF
54  uint32_t dbg_maxlen;
55 #endif /* DBG_PERF */
59 
60 
61 void PacketEnqueueNoLock(PacketQueueNoLock *qnl, struct Packet_ *p);
62 void PacketEnqueue (PacketQueue *, struct Packet_ *);
63 
66 
69 
70 #endif /* SURICATA_PACKET_QUEUE_H */
PacketEnqueueNoLock
void PacketEnqueueNoLock(PacketQueueNoLock *qnl, struct Packet_ *p)
Definition: packet-queue.c:168
PacketQueue_
simple fifo queue for packets with mutex and cond Calling the mutex or triggering the cond is respons...
Definition: packet-queue.h:49
threads.h
PacketEnqueue
void PacketEnqueue(PacketQueue *, struct Packet_ *)
Definition: packet-queue.c:175
SCCondT
#define SCCondT
Definition: threads-debug.h:137
PacketQueueNoLock_
simple fifo queue for packets
Definition: packet-queue.h:34
PacketQueue_::mutex_q
SCMutex mutex_q
Definition: packet-queue.h:56
PacketQueueAlloc
PacketQueue * PacketQueueAlloc(void)
Definition: packet-queue.c:221
PacketDequeue
struct Packet_ * PacketDequeue(PacketQueue *)
Definition: packet-queue.c:216
Packet_
Definition: decode.h:488
PacketQueue_::bot
struct Packet_ * bot
Definition: packet-queue.h:51
PacketQueueNoLock_::bot
struct Packet_ * bot
Definition: packet-queue.h:36
PacketQueue_::cond_q
SCCondT cond_q
Definition: packet-queue.h:57
PacketQueueNoLock_::top
struct Packet_ * top
Definition: packet-queue.h:35
PacketQueueNoLock
struct PacketQueueNoLock_ PacketQueueNoLock
simple fifo queue for packets
PacketQueue_::len
uint32_t len
Definition: packet-queue.h:52
PacketQueueNoLock_::len
uint32_t len
Definition: packet-queue.h:37
PacketQueue_::top
struct Packet_ * top
Definition: packet-queue.h:50
PacketQueue
struct PacketQueue_ PacketQueue
simple fifo queue for packets with mutex and cond Calling the mutex or triggering the cond is respons...
PacketQueueFree
void PacketQueueFree(PacketQueue *)
Definition: packet-queue.c:231
SCMutex
#define SCMutex
Definition: threads-debug.h:114
PacketDequeueNoLock
struct Packet_ * PacketDequeueNoLock(PacketQueueNoLock *qnl)
Definition: packet-queue.c:208