aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/suricata/src/data-queue.h
diff options
context:
space:
mode:
authorAshlee Young <ashlee@onosfw.com>2015-09-09 22:21:41 -0700
committerAshlee Young <ashlee@onosfw.com>2015-09-09 22:21:41 -0700
commit8879b125d26e8db1a5633de5a9c692eb2d1c4f83 (patch)
treec7259d85a991b83dfa85ab2e339360669fc1f58e /framework/src/suricata/src/data-queue.h
parent13d05bc8458758ee39cb829098241e89616717ee (diff)
suricata checkin based on commit id a4bce14770beee46a537eda3c3f6e8e8565d5d0a
Change-Id: I9a214fa0ee95e58fc640e50bd604dac7f42db48f
Diffstat (limited to 'framework/src/suricata/src/data-queue.h')
-rw-r--r--framework/src/suricata/src/data-queue.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/framework/src/suricata/src/data-queue.h b/framework/src/suricata/src/data-queue.h
new file mode 100644
index 00000000..f1f6bb38
--- /dev/null
+++ b/framework/src/suricata/src/data-queue.h
@@ -0,0 +1,64 @@
+/**
+ * Copyright (c) 2009, 2010 Open Information Security Foundation.
+ *
+ * \author Anoop Saldanha <anoopsaldanha@gmail.com>
+ *
+ * \file Generic queues. Any instance that wants to get itself on the generic
+ * queue, would have to implement the template struct SCDQGenericQData_
+ * defined below.
+ */
+
+#ifndef __DATA_QUEUE_H__
+#define __DATA_QUEUE_H__
+
+#include "threads.h"
+
+/**
+ * \brief Generic template for any data structure that wants to be on the
+ * queue. Any other data structure that wants to be on the queue
+ * needs to use this template and define its own members from
+ * <your_own_structure_members_from_here_on> onwards.
+ */
+typedef struct SCDQGenericQData_ {
+ /* this is needed when we want to supply a list of data items */
+ struct SCDQGenericQData_ *next;
+ struct SCDQGenericQData_ *prev;
+ /* if we want to consider this pointer as the head of a list, this var
+ * holds the no of elements in the list. Else it holds a <need_to_think>. */
+ //uint16_t len;
+ /* in case this data instance is the head of a list, we can refer the
+ * bottomost instance directly using this var */
+ //struct SCDQGenericaQData *bot;
+
+
+ /* any other data structure that wants to be on the queue can implement
+ * its own memebers from here on, in its structure definition. Just note
+ * that the first 2 members should always be next and prev in the same
+ * order */
+ // <your_own_structure_members_from_here_on>
+} SCDQGenericQData;
+
+/**
+ * \brief The data queue to hold instances that implement the template
+ * SCDQGenericQData.
+ */
+typedef struct SCDQDataQueue_ {
+ /* holds the item at the top of the queue */
+ SCDQGenericQData *top;
+ /* holds the item at the bottom of the queue */
+ SCDQGenericQData *bot;
+ /* no of items currently in the queue */
+ uint16_t len;
+#ifdef DBG_PERF
+ uint16_t dbg_maxlen;
+#endif /* DBG_PERF */
+
+ SCMutex mutex_q;
+ SCCondT cond_q;
+
+} __attribute__((aligned(CLS))) SCDQDataQueue;
+
+void SCDQDataEnqueue(SCDQDataQueue *, SCDQGenericQData *);
+SCDQGenericQData *SCDQDataDequeue(SCDQDataQueue *);
+
+#endif /* __DATA_QUEUE_H__ */