suricata
|
#include "suricata-common.h"
#include "action-globals.h"
#include "decode.h"
#include "packet.h"
#include "suricata.h"
#include "threadvars.h"
#include "util-datalink.h"
#include "util-optimize.h"
#include "tm-queuehandlers.h"
#include "tm-threads.h"
#include "tm-modules.h"
#include "util-privs.h"
#include "tmqh-packetpool.h"
#include "util-napatech.h"
#include "source-napatech.h"
#include "runmode-napatech.h"
#include <numa.h>
#include <nt.h>
Go to the source code of this file.
Data Structures | |
struct | NapatechThreadVars_ |
struct | NapatechNumaDetect_ |
Typedefs | |
typedef struct NapatechThreadVars_ | NapatechThreadVars |
typedef struct NapatechNumaDetect_ | NapatechNumaDetect |
Functions | |
TmEcode | NapatechStreamThreadInit (ThreadVars *tv, const void *initdata, void **data) |
Initialize the Napatech receiver thread, generate a single NapatechThreadVar structure for each thread, this will contain a NtNetStreamRx_t stream handle which is used when the thread executes to acquire the packets. More... | |
void | NapatechStreamThreadExitStats (ThreadVars *tv, void *data) |
Print some stats to the log at program exit. More... | |
TmEcode | NapatechPacketLoop (ThreadVars *tv, void *data, void *slot) |
Main Napatechpacket processing loop. More... | |
TmEcode | NapatechDecodeThreadInit (ThreadVars *tv, const void *initdata, void **data) |
Initialization of Napatech Thread. More... | |
TmEcode | NapatechDecodeThreadDeinit (ThreadVars *tv, void *data) |
Deinitialization of Napatech Thread. More... | |
TmEcode | NapatechDecode (ThreadVars *tv, Packet *p, void *data) |
This function passes off to link type decoders. More... | |
SC_ATOMIC_DECLARE (uint64_t, total_packets) | |
SC_ATOMIC_DECLARE (uint64_t, total_drops) | |
SC_ATOMIC_DECLARE (uint16_t, total_tallied) | |
SC_ATOMIC_DECLARE (uint16_t, stream_count) | |
SC_ATOMIC_DECLARE (uint64_t, flow_callback_cnt) | |
SC_ATOMIC_DECLARE (uint64_t, flow_callback_handled_pkts) | |
SC_ATOMIC_DECLARE (uint64_t, flow_callback_udp_pkts) | |
SC_ATOMIC_DECLARE (uint64_t, flow_callback_tcp_pkts) | |
SC_ATOMIC_DECLARE (uint64_t, flow_callback_unhandled_pkts) | |
void | TmModuleNapatechStreamRegister (void) |
Register the Napatech receiver (reader) module. More... | |
void | TmModuleNapatechDecodeRegister (void) |
Register the Napatech decoder module. More... | |
TmEcode | NapatechStreamThreadDeinit (ThreadVars *tv, void *data) |
Deinitializes the NAPATECH card. More... | |
Variables | |
uint32_t | max_pending_packets |
NapatechNumaDetect * | numa_detect = NULL |
Definition in file source-napatech.c.
typedef struct NapatechNumaDetect_ NapatechNumaDetect |
typedef struct NapatechThreadVars_ NapatechThreadVars |
TmEcode NapatechDecode | ( | ThreadVars * | tv, |
Packet * | p, | ||
void * | data | ||
) |
This function passes off to link type decoders.
NapatechDecode decodes packets from Napatech and passes them off to the proper link type decoder.
t | pointer to ThreadVars |
p | pointer to the current packet |
data | pointer that gets cast into PcapThreadVars for ptv |
Definition at line 1064 of file source-napatech.c.
References BUG_ON, Packet_::datalink, DecodeEthernet(), DecodeUpdatePacketCounters(), dtv, GET_PKT_DATA, GET_PKT_LEN, LINKTYPE_ETHERNET, PacketDecodeFinalize(), PKT_IS_PSEUDOPKT, SCEnter, SCLogError, SCReturnInt, TM_ECODE_OK, and tv.
Referenced by TmModuleNapatechDecodeRegister().
TmEcode NapatechDecodeThreadDeinit | ( | ThreadVars * | tv, |
void * | data | ||
) |
Deinitialization of Napatech Thread.
tv | pointer to ThreadVars |
data | pointer that gets cast into DecoderThreadVars |
Definition at line 1116 of file source-napatech.c.
References DecodeThreadVarsFree(), SCReturnInt, TM_ECODE_OK, and tv.
Referenced by TmModuleNapatechDecodeRegister().
TmEcode NapatechDecodeThreadInit | ( | ThreadVars * | tv, |
const void * | initdata, | ||
void ** | data | ||
) |
Initialization of Napatech Thread.
t | pointer to ThreadVars |
initdata | - unused. |
data | pointer that gets cast into DecoderThreadVars |
Definition at line 1096 of file source-napatech.c.
References DecodeRegisterPerfCounters(), DecodeThreadVarsAlloc(), dtv, SCEnter, SCReturnInt, TM_ECODE_FAILED, TM_ECODE_OK, and tv.
Referenced by TmModuleNapatechDecodeRegister().
TmEcode NapatechPacketLoop | ( | ThreadVars * | tv, |
void * | data, | ||
void * | slot | ||
) |
Main Napatechpacket processing loop.
tv | Thread variable to ThreadVars |
data | Pointer to NapatechThreadVars with data specific to Napatech |
slot | TMSlot where this instance is running. |
Definition at line 794 of file source-napatech.c.
References ConfGetBool(), MAX_ADAPTERS, NapatechUseHWBypass(), and NapatechThreadVars_::stream_id.
Referenced by TmModuleNapatechStreamRegister().
TmEcode NapatechStreamThreadDeinit | ( | ThreadVars * | tv, |
void * | data | ||
) |
Deinitializes the NAPATECH card.
tv | pointer to ThreadVars |
data | pointer that gets cast into PcapThreadVars for ptv |
Definition at line 1043 of file source-napatech.c.
References NapatechThreadVars_::rx_stream, SCEnter, SCLogDebug, SCReturnInt, NapatechThreadVars_::stream_id, and TM_ECODE_OK.
Referenced by TmModuleNapatechStreamRegister().
void NapatechStreamThreadExitStats | ( | ThreadVars * | tv, |
void * | data | ||
) |
Print some stats to the log at program exit.
tv | Pointer to ThreadVars. |
data | Pointer to data, ErfFileThreadVars. |
Definition at line 1001 of file source-napatech.c.
References NapatechCurrentStats_::current_bytes, NapatechCurrentStats_::current_drop_packets, NapatechCurrentStats_::current_packets, NapatechGetCurrentStats(), NapatechGetNumConfiguredStreams(), SC_ATOMIC_ADD, SC_ATOMIC_GET, SCLogInfo, and NapatechThreadVars_::stream_id.
Referenced by TmModuleNapatechStreamRegister().
TmEcode NapatechStreamThreadInit | ( | ThreadVars * | tv, |
const void * | initdata, | ||
void ** | data | ||
) |
Initialize the Napatech receiver thread, generate a single NapatechThreadVar structure for each thread, this will contain a NtNetStreamRx_t stream handle which is used when the thread executes to acquire the packets.
tv | Thread variable to ThreadVars |
initdata | Initial data to the adapter passed from the user, this is processed by the user. |
For now, we assume that we have only a single name for the NAPATECH adapter.
data | data pointer gets populated with |
Definition at line 672 of file source-napatech.c.
References DatalinkSetGlobalType(), FatalError, LINKTYPE_ETHERNET, SCCalloc, SCEnter, SCLogDebug, SCReturnInt, NapatechStreamDevConf::stream_id, NapatechThreadVars_::stream_id, TM_ECODE_OK, tv, NapatechThreadVars_::tv, and unlikely.
Referenced by TmModuleNapatechStreamRegister().
SC_ATOMIC_DECLARE | ( | uint16_t | , |
stream_count | |||
) |
SC_ATOMIC_DECLARE | ( | uint16_t | , |
total_tallied | |||
) |
SC_ATOMIC_DECLARE | ( | uint64_t | , |
flow_callback_cnt | |||
) |
SC_ATOMIC_DECLARE | ( | uint64_t | , |
flow_callback_handled_pkts | |||
) |
SC_ATOMIC_DECLARE | ( | uint64_t | , |
flow_callback_tcp_pkts | |||
) |
SC_ATOMIC_DECLARE | ( | uint64_t | , |
flow_callback_udp_pkts | |||
) |
SC_ATOMIC_DECLARE | ( | uint64_t | , |
flow_callback_unhandled_pkts | |||
) |
SC_ATOMIC_DECLARE | ( | uint64_t | , |
total_drops | |||
) |
SC_ATOMIC_DECLARE | ( | uint64_t | , |
total_packets | |||
) |
void TmModuleNapatechDecodeRegister | ( | void | ) |
Register the Napatech decoder module.
Definition at line 192 of file source-napatech.c.
References TmModule_::cap_flags, TmModule_::flags, TmModule_::Func, TmModule_::name, NapatechDecode(), NapatechDecodeThreadDeinit(), NapatechDecodeThreadInit(), TmModule_::ThreadDeinit, TmModule_::ThreadExitPrintStats, TmModule_::ThreadInit, TM_FLAG_DECODE_TM, TMM_DECODENAPATECH, and tmm_modules.
Referenced by RegisterAllModules().
void TmModuleNapatechStreamRegister | ( | void | ) |
Register the Napatech receiver (reader) module.
Definition at line 174 of file source-napatech.c.
References TmModule_::cap_flags, TmModule_::flags, TmModule_::Func, TmModule_::Init, TmModule_::name, NapatechPacketLoop(), NapatechStreamThreadDeinit(), NapatechStreamThreadExitStats(), NapatechStreamThreadInit(), TmModule_::PktAcqBreakLoop, TmModule_::PktAcqLoop, SC_CAP_NET_RAW, TmModule_::ThreadDeinit, TmModule_::ThreadExitPrintStats, TmModule_::ThreadInit, TM_FLAG_RECEIVE_TM, tmm_modules, and TMM_RECEIVENAPATECH.
Referenced by RegisterAllModules().
NapatechNumaDetect* numa_detect = NULL |
Definition at line 121 of file source-napatech.c.