suricata
util-napatech.h
Go to the documentation of this file.
1 /* Copyright (C) 2017 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 Phil Young <py@napatech.com>
22  *
23  */
24 
25 #ifndef __UTIL_NAPATECH_H__
26 #define __UTIL_NAPATECH_H__
27 
28 #ifdef HAVE_NAPATECH
29 #include <nt.h>
30 
31 typedef struct NapatechPacketVars_ {
32  uint64_t stream_id;
33  NtNetBuf_t nt_packet_buf;
36 
37 typedef struct NapatechStreamConfig_ {
38  uint16_t stream_id;
39  bool is_active;
42 
43 typedef struct NapatechCurrentStats_ {
44  uint64_t current_packets;
45  uint64_t current_drops;
46  uint64_t current_bytes;
48 
49 #define MAX_STREAMS 256
50 
51 extern void NapatechStartStats(void);
52 
53 
54 #define NAPATECH_ERROR(err_type, status) { \
55  char errorBuffer[1024]; \
56  NT_ExplainError((status), errorBuffer, sizeof (errorBuffer) - 1); \
57  SCLogError((err_type), "Napatech Error: %s", errorBuffer); \
58  }
59 
60 #define NAPATECH_NTPL_ERROR(ntpl_cmd, ntpl_info, status) { \
61  char errorBuffer[1024]; \
62  NT_ExplainError(status, errorBuffer, sizeof (errorBuffer) - 1); \
63  SCLogError(SC_ERR_NAPATECH_STREAMS_REGISTER_FAILED, \
64  " NTPL failed: %s", errorBuffer); \
65  SCLogError(SC_ERR_NAPATECH_STREAMS_REGISTER_FAILED, \
66  " cmd: %s", ntpl_cmd); \
67  if (strncmp(ntpl_info.u.errorData.errBuffer[0], "", 256) != 0) \
68  SCLogError(SC_ERR_NAPATECH_STREAMS_REGISTER_FAILED, \
69  " %s", ntpl_info.u.errorData.errBuffer[0]); \
70  if (strncmp(ntpl_info.u.errorData.errBuffer[1], "", 256) != 0) \
71  SCLogError(SC_ERR_NAPATECH_STREAMS_REGISTER_FAILED, \
72  " %s", ntpl_info.u.errorData.errBuffer[1]); \
73  if (strncmp(ntpl_info.u.errorData.errBuffer[2], "", 256) != 0) \
74  SCLogError(SC_ERR_NAPATECH_STREAMS_REGISTER_FAILED, \
75  " %s", ntpl_info.u.errorData.errBuffer[2]); \
76 }
77 
78 
81 bool NapatechSetupNuma(uint32_t stream, uint32_t numa);
82 uint32_t NapatechSetupTraffic(uint32_t first_stream, uint32_t last_stream, uint32_t *filter_id, uint32_t *hash_id);
83 bool NapatechDeleteFilter(uint32_t filter_id);
84 #endif //HAVE_NAPATECH
85 #endif /* __UTIL_NAPATECH_H__ */
struct NapatechPacketVars_ NapatechPacketVars
bool NapatechDeleteFilter(uint32_t filter_id)
bool NapatechSetupNuma(uint32_t stream, uint32_t numa)
TcpStreamCnf stream_config
Definition: stream-tcp.h:106
void NapatechStartStats(void)
struct NapatechCurrentStats_ NapatechCurrentStats
int NapatechGetStreamConfig(NapatechStreamConfig stream_config[])
NtNetBuf_t nt_packet_buf
Definition: util-napatech.h:33
struct NapatechStreamConfig_ NapatechStreamConfig
NapatechCurrentStats NapatechGetCurrentStats(uint16_t id)
Definition: util-napatech.c:50
Per thread variable structure.
Definition: threadvars.h:57
uint32_t NapatechSetupTraffic(uint32_t first_stream, uint32_t last_stream, uint32_t *filter_id, uint32_t *hash_id)