suricata
source-pcap.c File Reference
#include "suricata-common.h"
#include "suricata.h"
#include "decode.h"
#include "packet-queue.h"
#include "threads.h"
#include "threadvars.h"
#include "tm-queuehandlers.h"
#include "tm-threads.h"
#include "source-pcap.h"
#include "conf.h"
#include "util-bpf.h"
#include "util-debug.h"
#include "util-error.h"
#include "util-privs.h"
#include "util-datalink.h"
#include "util-device.h"
#include "util-optimize.h"
#include "util-checksum.h"
#include "util-ioctl.h"
#include "util-time.h"
#include "tmqh-packetpool.h"
#include "tests/source-pcap.c"
Include dependency graph for source-pcap.c:

Go to the source code of this file.

Data Structures

struct  PcapStats64_
 64bit pcap stats counters. More...
 
struct  PcapThreadVars_
 Structure to hold thread specific variables. More...
 

Macros

#define PCAP_STATE_DOWN   0
 
#define PCAP_STATE_UP   1
 
#define PCAP_RECONNECT_TIMEOUT   500000
 
#define PCAP_ERROR_BREAK   -2
 

Typedefs

typedef struct PcapStats64_ PcapStats64
 64bit pcap stats counters. More...
 
typedef struct PcapThreadVars_ PcapThreadVars
 Structure to hold thread specific variables. More...
 

Functions

void TmModuleReceivePcapRegister (void)
 Registration Function for ReceivePcap. More...
 
void TmModuleDecodePcapRegister (void)
 Registration Function for DecodePcap. More...
 
void PcapTranslateIPToDevice (char *pcap_dev, size_t len)
 

Detailed Description

Author
Victor Julien victo.nosp@m.r@in.nosp@m.linia.nosp@m.c.ne.nosp@m.t

Live pcap packet acquisition support

Definition in file source-pcap.c.

Macro Definition Documentation

◆ PCAP_ERROR_BREAK

#define PCAP_ERROR_BREAK   -2

Definition at line 385 of file source-pcap.c.

◆ PCAP_RECONNECT_TIMEOUT

#define PCAP_RECONNECT_TIMEOUT   500000

Definition at line 52 of file source-pcap.c.

◆ PCAP_STATE_DOWN

#define PCAP_STATE_DOWN   0

Definition at line 49 of file source-pcap.c.

◆ PCAP_STATE_UP

#define PCAP_STATE_UP   1

Definition at line 50 of file source-pcap.c.

Typedef Documentation

◆ PcapStats64

typedef struct PcapStats64_ PcapStats64

64bit pcap stats counters.

libpcap only supports 32bit counters. They will eventually wrap around.

Keep track of libpcap counters as 64bit counters to keep on counting even if libpcap's 32bit counters wrap around. Requires pcap_stats() to be called before 32bit stats wrap around twice, which we do.

◆ PcapThreadVars

Structure to hold thread specific variables.

Function Documentation

◆ PcapTranslateIPToDevice()

void PcapTranslateIPToDevice ( char *  pcap_dev,
size_t  len 
)

Definition at line 656 of file source-pcap.c.

References len, and strlcpy().

Here is the call graph for this function:

◆ TmModuleDecodePcapRegister()

void TmModuleDecodePcapRegister ( void  )

Registration Function for DecodePcap.

Definition at line 153 of file source-pcap.c.

References TmModule_::name, TmModule_::ThreadInit, TMM_DECODEPCAP, and tmm_modules.

Referenced by RegisterAllModules().

Here is the caller graph for this function:

◆ TmModuleReceivePcapRegister()

void TmModuleReceivePcapRegister ( void  )

Registration Function for ReceivePcap.

Definition at line 135 of file source-pcap.c.

References TmModule_::name, TmModule_::ThreadInit, tmm_modules, and TMM_RECEIVEPCAP.

Referenced by RegisterAllModules().

Here is the caller graph for this function: