Go to the documentation of this file.
33 #define DAG_TYPE_ETH 2
55 typedef struct ErfFileThreadVars_ {
116 etv->slot = ((
TmSlot *)slot)->slot_next;
141 if (TmThreadsSlotProcessPkt(etv->tv, etv->slot, p) !=
TM_ECODE_OK) {
156 int r = fread(&dr,
sizeof(DagRecord), 1, etv->erf);
158 if (feof(etv->erf)) {
168 if (
rlen <
sizeof(DagRecord)) {
170 "record length less than size of header");
175 if (feof(etv->erf)) {
187 "DAG record type %d not implemented.", dr.type);
196 p->
ts.tv_sec =
ts >> 32;
197 ts = (
ts & 0xffffffffULL) * 1000000;
199 p->
ts.tv_usec =
ts >> 32;
200 if (p->
ts.tv_usec >= 1000000) {
201 p->
ts.tv_usec -= 1000000;
219 if (initdata == NULL) {
224 FILE *erf = fopen((
const char *)initdata,
"r");
237 memset(etv, 0,
sizeof(*etv));
242 SCLogInfo(
"Processing ERF file %s", (
char *)initdata);
251 DecodeErfFileThreadInit(
ThreadVars *
tv,
const void *initdata,
void **data)
309 SCLogInfo(
"Packets: %"PRIu32
"; Bytes: %"PRIu64, etv->pkts, etv->bytes);
#define PKT_IS_PSEUDOPKT(p)
return 1 if the packet is a pseudo packet
void ReceiveErfFileThreadExitStats(ThreadVars *, void *)
Print some stats to the log at program exit.
void TmModuleDecodeErfFileRegister(void)
Register the ERF file decoder module.
void PacketDecodeFinalize(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p)
Finalize decoding of a packet.
void TmqhOutputPacketpool(ThreadVars *t, Packet *p)
TmEcode(* PktAcqLoop)(ThreadVars *, void *, void *)
TmEcode(* ThreadDeinit)(ThreadVars *, void *)
#define PKT_SET_SRC(p, src_val)
void DecodeRegisterPerfCounters(DecodeThreadVars *dtv, ThreadVars *tv)
TmEcode(* PktAcqBreakLoop)(ThreadVars *, void *)
Per thread variable structure.
TmEcode(* Func)(ThreadVars *, Packet *, void *)
@ SC_ERR_INVALID_ARGUMENT
void PacketPoolWait(void)
#define TM_FLAG_DECODE_TM
TmModule tmm_modules[TMM_SIZE]
struct DagFlags_ DagFlags
#define SCLogInfo(...)
Macro used to log INFORMATIONAL messages.
#define TM_FLAG_RECEIVE_TM
void TmModuleReceiveErfFileRegister(void)
Register the ERF file receiver (reader) module.
TmEcode ReceiveErfFileThreadDeinit(ThreadVars *, void *)
struct DagRecord_ __attribute__((packed))
DNP3 application object header.
void DecodeThreadVarsFree(ThreadVars *tv, DecodeThreadVars *dtv)
#define SCLogError(err_code,...)
Macro used to log ERROR messages.
TmEcode(* ThreadInit)(ThreadVars *, const void *, void **)
void EngineStop(void)
make sure threads can stop the engine by calling this function. Purpose: pcap file mode needs to be a...
void(* ThreadExitPrintStats)(ThreadVars *, void *)
Structure to hold thread specific data for all decode modules.
DecodeThreadVars * DecodeThreadVarsAlloc(ThreadVars *tv)
Alloc and setup DecodeThreadVars.
TmEcode ReceiveErfFileThreadInit(ThreadVars *, const void *, void **)
Initialize the ERF receiver thread.
TmEcode ReceiveErfFileLoop(ThreadVars *, void *, void *)
ERF file reading loop.
Packet * PacketGetFromQueueOrAlloc(void)
Get a packet. We try to get a packet from the packetpool first, but if that is empty we alloc a packe...
int DecodeEthernet(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, const uint8_t *pkt, uint32_t len)
void DecodeUpdatePacketCounters(ThreadVars *tv, const DecodeThreadVars *dtv, const Packet *p)
#define LINKTYPE_ETHERNET
volatile uint8_t suricata_ctl_flags