suricata
|
#include "suricata-common.h"
#include "suricata.h"
#include "threadvars.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 <nt.h>
Go to the source code of this file.
Data Structures | |
struct | NapatechThreadVars_ |
Macros | |
#define | MAX_STREAMS 256 |
Typedefs | |
typedef struct NapatechThreadVars_ | NapatechThreadVars |
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 | NapatechPacketLoopZC (ThreadVars *tv, void *data, void *slot) |
TmEcode | NapatechDecodeThreadInit (ThreadVars *, const void *, void **) |
TmEcode | NapatechDecodeThreadDeinit (ThreadVars *tv, void *data) |
TmEcode | NapatechDecode (ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, PacketQueue *postpq) |
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) | |
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 | |
int | max_pending_packets |
Definition in file source-napatech.c.
#define MAX_STREAMS 256 |
Definition at line 77 of file source-napatech.c.
Referenced by NapatechStreamThreadInit().
typedef struct NapatechThreadVars_ NapatechThreadVars |
TmEcode NapatechDecode | ( | ThreadVars * | tv, |
Packet * | p, | ||
void * | data, | ||
PacketQueue * | pq, | ||
PacketQueue * | postpq | ||
) |
This function passes off to link type decoders.
Decode Napatech NapatechDecode reads packets from the PacketQueue 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 |
pq | pointer to the current PacketQueue |
Definition at line 406 of file source-napatech.c.
References Packet_::datalink, DecodeEthernet(), DecodeUpdatePacketCounters(), Packet_::flags, GET_PKT_DATA, GET_PKT_LEN, LINKTYPE_ETHERNET, PacketDecodeFinalize(), PKT_PSEUDO_STREAM_END, SC_ERR_DATALINK_UNIMPLEMENTED, SCEnter, SCLogError, SCReturnInt, and TM_ECODE_OK.
Referenced by TmModuleNapatechDecodeRegister().
TmEcode NapatechDecodeThreadDeinit | ( | ThreadVars * | tv, |
void * | data | ||
) |
Definition at line 449 of file source-napatech.c.
References DecodeThreadVarsFree(), SCReturnInt, and TM_ECODE_OK.
Referenced by TmModuleNapatechDecodeRegister().
TmEcode NapatechDecodeThreadInit | ( | ThreadVars * | tv, |
const void * | initdata, | ||
void ** | data | ||
) |
Definition at line 436 of file source-napatech.c.
References DecodeRegisterPerfCounters(), DecodeThreadVarsAlloc(), SCEnter, SCReturnInt, TM_ECODE_FAILED, and TM_ECODE_OK.
Referenced by TmModuleNapatechDecodeRegister().
TmEcode NapatechPacketLoopZC | ( | ThreadVars * | tv, |
void * | data, | ||
void * | slot | ||
) |
Definition at line 195 of file source-napatech.c.
References Packet_::datalink, NapatechThreadVars_::hba, LINKTYPE_ETHERNET, NapatechGetNumaNode(), NapatechPacketVars_::nt_packet_buf, Packet_::ntpv, PacketDequeue(), PacketGetFromQueueOrAlloc(), PacketPoolWait(), PacketSetData(), Packet_::ReleasePacket, NapatechThreadVars_::rx_stream, SC_ERR_MEM_ALLOC, SC_ERR_NAPATECH_OPEN_FAILED, SC_ERR_NAPATECH_TIMESTAMP_TYPE_NOT_SUPPORTED, SCCalloc, SCFree, SCLogDebug, SCLogError, SCLogInfo, SCReturnInt, NapatechThreadVars_::slot, TmSlot_::slot_next, StatsRegisterCounter(), StatsSetUI64(), StatsSetupPrivate(), StatsSyncCountersIfSignalled, NapatechPacketVars_::stream_id, NapatechThreadVars_::stream_id, suricata_ctl_flags, SURICATA_STOP, TM_ECODE_FAILED, TM_ECODE_OK, TmqhOutputPacketpool(), Packet_::ts, NapatechThreadVars_::tv, and unlikely.
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 384 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 350 of file source-napatech.c.
References NapatechCurrentStats_::current_bytes, NapatechCurrentStats_::current_drops, NapatechCurrentStats_::current_packets, GetNumConfiguredStreams(), NapatechGetCurrentStats(), 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 164 of file source-napatech.c.
References NapatechStreamDevConf::hba, NapatechThreadVars_::hba, MAX_STREAMS, Packet_::ntpv, PacketEnqueue(), PacketFreeOrRelease(), SC_ERR_MEM_ALLOC, SCCalloc, SCEnter, SCLogDebug, SCLogError, SCReturnInt, NapatechPacketVars_::stream_id, NapatechStreamDevConf::stream_id, NapatechThreadVars_::stream_id, TM_ECODE_OK, NapatechThreadVars_::tv, and unlikely.
Referenced by TmModuleNapatechStreamRegister().
SC_ATOMIC_DECLARE | ( | uint64_t | , |
total_packets | |||
) |
SC_ATOMIC_DECLARE | ( | uint64_t | , |
total_drops | |||
) |
SC_ATOMIC_DECLARE | ( | uint16_t | , |
total_tallied | |||
) |
void TmModuleNapatechDecodeRegister | ( | void | ) |
Register the Napatech decoder module.
Definition at line 129 of file source-napatech.c.
References TmModule_::cap_flags, TmModule_::flags, TmModule_::Func, TmModule_::name, NapatechDecode(), NapatechDecodeThreadDeinit(), NapatechDecodeThreadInit(), TmModule_::RegisterTests, 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 108 of file source-napatech.c.
References TmModule_::cap_flags, TmModule_::flags, TmModule_::Func, TmModule_::name, NapatechPacketLoopZC(), NapatechStreamThreadDeinit(), NapatechStreamThreadExitStats(), NapatechStreamThreadInit(), TmModule_::PktAcqBreakLoop, TmModule_::PktAcqLoop, TmModule_::RegisterTests, SC_ATOMIC_INIT, SC_CAP_NET_RAW, TmModule_::ThreadDeinit, TmModule_::ThreadExitPrintStats, TmModule_::ThreadInit, TM_FLAG_RECEIVE_TM, tmm_modules, and TMM_RECEIVENAPATECH.
Referenced by RegisterAllModules().