suricata
source-napatech.c File Reference
#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 <numa.h>
#include <nt.h>
Include dependency graph for source-napatech.c:

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)
 
 SC_ATOMIC_DECLARE (uint16_t, stream_count)
 
 SC_ATOMIC_DECLARE (uint16_t, numa0_count)
 
 SC_ATOMIC_DECLARE (uint16_t, numa1_count)
 
 SC_ATOMIC_DECLARE (uint16_t, numa2_count)
 
 SC_ATOMIC_DECLARE (uint16_t, numa3_count)
 
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
 

Detailed Description

Definition in file source-napatech.c.

Macro Definition Documentation

#define MAX_STREAMS   256

Definition at line 81 of file source-napatech.c.

Referenced by NapatechStreamThreadInit().

Typedef Documentation

Function Documentation

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.

Parameters
tpointer to ThreadVars
ppointer to the current packet
datapointer that gets cast into PcapThreadVars for ptv
pqpointer to the current PacketQueue

Definition at line 545 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().

Here is the call graph for this function:

Here is the caller graph for this function:

TmEcode NapatechDecodeThreadDeinit ( ThreadVars tv,
void *  data 
)

Definition at line 588 of file source-napatech.c.

References DecodeThreadVarsFree(), SCReturnInt, and TM_ECODE_OK.

Referenced by TmModuleNapatechDecodeRegister().

Here is the call graph for this function:

Here is the caller graph for this function:

TmEcode NapatechDecodeThreadInit ( ThreadVars tv,
const void *  initdata,
void **  data 
)

Definition at line 575 of file source-napatech.c.

References DecodeRegisterPerfCounters(), DecodeThreadVarsAlloc(), SCEnter, SCReturnInt, TM_ECODE_FAILED, and TM_ECODE_OK.

Referenced by TmModuleNapatechDecodeRegister().

Here is the call graph for this function:

Here is the caller graph for this function:

TmEcode NapatechStreamThreadDeinit ( ThreadVars tv,
void *  data 
)

Deinitializes the NAPATECH card.

Parameters
tvpointer to ThreadVars
datapointer that gets cast into PcapThreadVars for ptv

Definition at line 523 of file source-napatech.c.

References NapatechThreadVars_::rx_stream, SCEnter, SCLogDebug, SCReturnInt, NapatechThreadVars_::stream_id, and TM_ECODE_OK.

Referenced by TmModuleNapatechStreamRegister().

Here is the caller graph for this function:

void NapatechStreamThreadExitStats ( ThreadVars tv,
void *  data 
)

Print some stats to the log at program exit.

Parameters
tvPointer to ThreadVars.
dataPointer to data, ErfFileThreadVars.

Definition at line 489 of file source-napatech.c.

References NapatechCurrentStats_::current_bytes, NapatechCurrentStats_::current_drops, NapatechCurrentStats_::current_packets, NapatechGetCurrentStats(), NapatechGetNumConfiguredStreams(), SC_ATOMIC_ADD, SC_ATOMIC_GET, SCLogInfo, and NapatechThreadVars_::stream_id.

Referenced by TmModuleNapatechStreamRegister().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
tvThread variable to ThreadVars
initdataInitial 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.

Parameters
datadata pointer gets populated with

Definition at line 176 of file source-napatech.c.

References ConfGetBool(), NapatechStreamDevConf::hba, NapatechThreadVars_::hba, MAX_STREAMS, Packet_::ntpv, PacketEnqueue(), PacketFreeOrRelease(), SC_ATOMIC_GET, SC_ERR_MEM_ALLOC, SC_ERR_NAPATECH_NOSUPPORT, SC_ERR_NAPATECH_STREAMS_REGISTER_FAILED, SC_LOG_ERROR, SCCalloc, SCEnter, SCLog, SCLogDebug, SCLogError, SCLogWarning, SCReturnInt, NapatechPacketVars_::stream_id, NapatechStreamDevConf::stream_id, NapatechThreadVars_::stream_id, TM_ECODE_OK, NapatechThreadVars_::tv, and unlikely.

Referenced by TmModuleNapatechStreamRegister().

Here is the call graph for this function:

Here is the caller graph for this function:

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 ( uint16_t  ,
numa0_count   
)
SC_ATOMIC_DECLARE ( uint16_t  ,
numa1_count   
)
SC_ATOMIC_DECLARE ( uint16_t  ,
numa2_count   
)
SC_ATOMIC_DECLARE ( uint16_t  ,
numa3_count   
)
void TmModuleNapatechDecodeRegister ( void  )

Register the Napatech decoder module.

Definition at line 148 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().

Here is the call graph for this function:

Here is the caller graph for this function: