/src/suricata7/src/runmode-ipfw.c
Line | Count | Source |
1 | | /* Copyright (C) 2007-2011 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 Anoop Saldanha <anoopsaldanha@gmail.com> |
22 | | * \author Eric Leblond <eric@regit.org> |
23 | | * |
24 | | * Handling of ipfw runmodes. |
25 | | */ |
26 | | |
27 | | |
28 | | |
29 | | #include "suricata-common.h" |
30 | | #include "tm-threads.h" |
31 | | #include "conf.h" |
32 | | #include "runmodes.h" |
33 | | #include "runmode-ipfw.h" |
34 | | #include "output.h" |
35 | | |
36 | | #include "util-debug.h" |
37 | | #include "util-time.h" |
38 | | #include "util-cpu.h" |
39 | | #include "util-affinity.h" |
40 | | #include "util-runmodes.h" |
41 | | #include "source-ipfw.h" |
42 | | #include "util-device.h" |
43 | | |
44 | | const char *RunModeIpsIPFWGetDefaultMode(void) |
45 | 0 | { |
46 | 0 | return "autofp"; |
47 | 0 | } |
48 | | |
49 | | void RunModeIpsIPFWRegister(void) |
50 | 37 | { |
51 | 37 | RunModeRegisterNewRunMode(RUNMODE_IPFW, "autofp", |
52 | 37 | "Multi threaded IPFW IPS mode with respect to flow", RunModeIpsIPFWAutoFp, NULL); |
53 | | |
54 | 37 | RunModeRegisterNewRunMode(RUNMODE_IPFW, "workers", |
55 | 37 | "Multi queue IPFW IPS mode with one thread per queue", RunModeIpsIPFWWorker, NULL); |
56 | | |
57 | 37 | return; |
58 | 37 | } |
59 | | |
60 | | int RunModeIpsIPFWAutoFp(void) |
61 | 0 | { |
62 | 0 | SCEnter(); |
63 | 0 | int ret = 0; |
64 | | #ifdef IPFW |
65 | | |
66 | | TimeModeSetLive(); |
67 | | |
68 | | LiveDeviceHasNoStats(); |
69 | | |
70 | | ret = RunModeSetIPSAutoFp(IPFWGetThread, |
71 | | "ReceiveIPFW", |
72 | | "VerdictIPFW", |
73 | | "DecodeIPFW"); |
74 | | #endif /* IPFW */ |
75 | 0 | return ret; |
76 | 0 | } |
77 | | |
78 | | int RunModeIpsIPFWWorker(void) |
79 | 0 | { |
80 | 0 | SCEnter(); |
81 | 0 | int ret = 0; |
82 | | #ifdef IPFW |
83 | | |
84 | | TimeModeSetLive(); |
85 | | |
86 | | LiveDeviceHasNoStats(); |
87 | | |
88 | | ret = RunModeSetIPSWorker(IPFWGetThread, |
89 | | "ReceiveIPFW", |
90 | | "VerdictIPFW", |
91 | | "DecodeIPFW"); |
92 | | #endif /* IPFW */ |
93 | 0 | return ret; |
94 | 0 | } |