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 Nick Rogness <nick@rogness.net>
22  * \author Eric Leblond <eric@regit.org>
23  */
24 
25 #ifndef __SOURCE_IPFW_H__
26 #define __SOURCE_IPFW_H__
27 
28 #define IPFW_MAX_QUEUE 16
29 
30 /* per packet IPFW vars (Not used) */
31 typedef struct IPFWPacketVars_
32 {
33     int ipfw_index;
34 } IPFWPacketVars;
35 
36 typedef struct IPFWQueueVars_
37 {
38     int fd;
39     SCMutex socket_lock;
40     uint8_t use_mutex;
41     /* this one should be not changing after init */
42     uint16_t port_num;
43     /* position into the ipfw queue var array */
44     uint16_t ipfw_index;
45     struct sockaddr_in ipfw_sin;
46     socklen_t ipfw_sinlen;
47 
48 #ifdef DBG_PERF
49     int dbg_maxreadsize;
50 #endif /* DBG_PERF */
51 
52     /* counters */
53     uint32_t pkts;
54     uint64_t bytes;
55     uint32_t errs;
56     uint32_t accepted;
57     uint32_t dropped;
58     uint32_t replaced;
59 
60 } IPFWQueueVars;
61 
62 void *IPFWGetThread(int number);
63 int IPFWRegisterQueue(char *queue);
64 
65 void TmModuleReceiveIPFWRegister (void);
66 void TmModuleVerdictIPFWRegister (void);
67 void TmModuleDecodeIPFWRegister (void);
68 
69 
70 #endif /* __SOURCE_IPFW_H__ */
71