suricata
tm-queuehandlers.c
Go to the documentation of this file.
1/* Copyright (C) 2007-2010 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 * Master Queue Handler
24 */
25
26#include "suricata-common.h"
27#include "packet-queue.h"
28#include "decode.h"
29#include "threads.h"
30#include "threadvars.h"
31
32#include "tm-queuehandlers.h"
33#include "tmqh-simple.h"
34#include "tmqh-packetpool.h"
35#include "tmqh-flow.h"
36
38
39void TmqhSetup (void)
40{
41 memset(&tmqh_table, 0, sizeof(tmqh_table));
42
46}
47
48/** \brief Clean up registration time allocs */
49void TmqhCleanup(void)
50{
51}
52
53int TmqhNameToID(const char *name)
54{
55 for (int i = 0; i < TMQH_SIZE; i++) {
56 if (tmqh_table[i].name != NULL) {
57 if (strcmp(name, tmqh_table[i].name) == 0)
58 return i;
59 }
60 }
61
62 return -1;
63}
64
66{
67 for (int i = 0; i < TMQH_SIZE; i++) {
68 if (tmqh_table[i].name != NULL) {
69 if (strcmp(name, tmqh_table[i].name) == 0)
70 return &tmqh_table[i];
71 }
72 }
73
74 return NULL;
75}
76
78{
79 if (id <= 0 || id >= TMQH_SIZE)
80 return NULL;
81
82 return &tmqh_table[id];
83}
uint32_t id
Tmqh * TmqhGetQueueHandlerByName(const char *name)
int TmqhNameToID(const char *name)
void TmqhSetup(void)
Tmqh tmqh_table[TMQH_SIZE]
void TmqhCleanup(void)
Clean up registration time allocs.
Tmqh * TmqhGetQueueHandlerByID(const int id)
@ TMQH_SIZE
const char * name
void TmqhFlowRegister(void)
Definition tmqh-flow.c:51
void TmqhPacketpoolRegister(void)
TmqhPacketpoolRegister \initonly.
void TmqhSimpleRegister(void)
Definition tmqh-simple.c:39