Go to the documentation of this file.
32 #include <fuzz_pcap.h>
37 static int initialized = 0;
51 filepath = dirname(strdup((*argv)[0]));
59 struct pcap_pkthdr header;
64 if (initialized == 0) {
66 setenv(
"SC_LOG_OP_IFACE",
"file", 0);
67 setenv(
"SC_LOG_FILE",
"/dev/null", 0);
91 memset(&
tv, 0,
sizeof(
tv));
111 if (size < FPC0_HEADER_LEN) {
115 if (FPC_init(&pkts, data, size) < 0) {
120 r = FPC_next(&pkts, &header, &pkt);
122 if (p == NULL || r <= 0 || header.ts.tv_sec >= INT_MAX - 3600) {
136 while (extra_p != NULL) {
142 while (extra_p != NULL) {
147 r = FPC_next(&pkts, &header, &pkt);
148 if (r <= 0 || header.ts.tv_sec >= INT_MAX - 3600) {
struct FlowQueue_ * flow_queue
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
int SCRunmodeGet(void)
Get the current run mode.
void PacketFreeOrRelease(Packet *p)
Return a packet to where it was allocated.
int PacketCopyData(Packet *p, const uint8_t *pktdata, uint32_t pktlen)
Copy data to Packet payload and set packet length.
#define SC_ATOMIC_SET(name, val)
Set the value for the atomic variable.
void PacketRecycle(Packet *p)
void SCRunmodeSet(int run_mode)
Set the current run mode.
int StatsSetupPrivate(ThreadVars *tv)
void GlobalsInitPreConfig(void)
void PacketPoolInit(void)
void DecodeRegisterPerfCounters(DecodeThreadVars *dtv, ThreadVars *tv)
void PreRunPostPrivsDropInit(const int runmode)
Packet * PacketDequeueNoLock(PacketQueueNoLock *qnl)
Per thread variable structure.
#define SCTIME_FROM_TIMEVAL(tv)
TmEcode(* Func)(ThreadVars *, Packet *, void *)
void PacketFree(Packet *p)
Return a malloced packet.
FlowQueue * FlowQueueNew(void)
int ConfYamlLoadString(const char *string, size_t len)
Load configuration from a YAML string.
int PostConfLoadedSetup(SCInstance *suri)
void PostConfLoadedDetectSetup(SCInstance *suri)
TmModule tmm_modules[TMM_SIZE]
void setenv(const char *name, const char *value, int overwrite)
uint32_t max_pending_packets
SC_ATOMIC_EXTERN(unsigned int, engine_stage)
TmEcode(* ThreadInit)(ThreadVars *, const void *, void **)
int LLVMFuzzerInitialize(const int *argc, char ***argv)
TmEcode ConfigSetLogDirectory(const char *name)
Packet * PacketGetFromAlloc(void)
Get a malloced packet.
Structure to hold thread specific data for all decode modules.
DecodeThreadVars * DecodeThreadVarsAlloc(ThreadVars *tv)
Alloc and setup DecodeThreadVars.
PacketQueueNoLock decode_pq
int DetectEngineReload(const SCInstance *suri)
Reload the detection engine.
int InitGlobal(void)
Global initialization common to all runmodes.
const char * configNoChecksum