Go to the documentation of this file.
31 static int worker_id = 1;
54 static void ReleasePacket(
Packet *p)
69 static void *SimpleWorker(
void *arg)
86 assert(device != NULL);
88 int datalink = pcap_datalink(fp);
90 struct pcap_pkthdr pkthdr;
92 while ((packet = pcap_next(fp, &pkthdr)) != NULL) {
150 static uint8_t RateFilterCallback(
const Packet *p,
const uint32_t sid,
const uint32_t gid,
151 const uint32_t rev, uint8_t original_action, uint8_t new_action,
void *arg)
157 int main(
int argc,
char **argv)
167 bool end = strncmp(argv[0],
"--", 2) == 0;
175 fprintf(stderr,
"ERROR: No PCAP files provided\n");
214 fprintf(stderr,
"LiveRegisterDevice failed");
232 .pcap_filename = argv[argc - 1],
234 if (pthread_create(&worker, NULL, SimpleWorker, &args) != 0) {
bool PacketCheckAction(const Packet *p, const uint8_t a)
bool SCTmThreadsSlotPacketLoopFinish(ThreadVars *tv)
void SuricataMainLoop(void)
int LiveRegisterDevice(const char *dev)
Add a pcap device for monitoring and create structure.
void PacketFreeOrRelease(Packet *p)
Return a packet to where it was allocated.
void SCPacketSetLiveDevice(Packet *p, LiveDevice *device)
Set a packets live device.
void SuricataPostInit(void)
TmEcode SCParseCommandLine(int argc, char **argv)
void SuricataShutdown(void)
void TmqhOutputPacketpool(ThreadVars *t, Packet *p)
void SCPacketSetSource(Packet *p, enum PktSrcEnum source)
Set packet source.
void SCRunmodeSet(SCRunMode run_mode)
Set the current run mode.
int main(int argc, char **argv)
struct TmSlot_ * tm_slots
LiveDevice * LiveGetDevice(const char *name)
Get a pointer to the device at idx.
Per thread variable structure.
#define SCTIME_FROM_TIMEVAL(tv)
int SCRunModeLibSpawnWorker(void *td)
start the "fake" worker.
void SCDetectEngineRegisterRateFilterCallback(SCDetectRateFilterFunc fn, void *arg)
Register a callback when a rate_filter has been applied to an alert.
void SCPacketSetTime(Packet *p, SCTime_t ts)
Set the timestamp for a packet.
int SCConfSetFromString(const char *input, int final)
Set a configuration parameter from a string.
void TmThreadsInitThreadsTimestamp(const SCTime_t ts)
int SCStartInternalRunMode(int argc, char **argv)
void SCPacketSetReleasePacket(Packet *p, void(*ReleasePacket)(Packet *p))
Set a packet release function.
void EngineStop(void)
make sure threads can stop the engine by calling this function. Purpose: pcap file mode needs to be a...
TmEcode SCLoadYamlConfig(void)
ThreadVars * SCRunModeLibCreateThreadVars(int worker_id)
Create ThreadVars for use by a user provided thread.
int PacketSetData(Packet *p, const uint8_t *pktdata, uint32_t pktlen)
Set data for Packet and set length when zero copy is used.
void SCPacketSetDatalink(Packet *p, int datalink)
Set a packets data link type.
#define SCLogNotice(...)
Macro used to log NOTICE messages.
void SuricataPreInit(const char *progname)
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 SCFinalizeRunMode(void)
void GlobalsDestroy(void)
volatile uint8_t suricata_ctl_flags
void LiveDevicePktsIncr(LiveDevice *dev)