suricata
util-device.h File Reference
#include "queue.h"
#include "unix-manager.h"
Include dependency graph for util-device.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  LiveDevice_
 
struct  LiveDeviceName_
 

Macros

#define OFFLOAD_FLAG_SG   (1<<0)
 
#define OFFLOAD_FLAG_TSO   (1<<1)
 
#define OFFLOAD_FLAG_GSO   (1<<2)
 
#define OFFLOAD_FLAG_GRO   (1<<3)
 
#define OFFLOAD_FLAG_LRO   (1<<4)
 
#define OFFLOAD_FLAG_RXCSUM   (1<<5)
 
#define OFFLOAD_FLAG_TXCSUM   (1<<6)
 
#define OFFLOAD_FLAG_TOE   (1<<7)
 
#define MAX_DEVNAME   10
 

Typedefs

typedef struct LiveDevice_ LiveDevice
 
typedef struct LiveDeviceName_ LiveDeviceName
 

Functions

void LiveSetOffloadDisable (void)
 
void LiveSetOffloadWarn (void)
 
int LiveGetOffload (void)
 
int LiveRegisterDeviceName (const char *dev)
 Add a device for monitoring. More...
 
int LiveRegisterDevice (const char *dev)
 Add a pcap device for monitoring and create structure. More...
 
int LiveGetDeviceCount (void)
 Get the number of registered devices. More...
 
const char * LiveGetDeviceName (int number)
 Get a pointer to the device name at idx. More...
 
LiveDeviceLiveGetDevice (const char *dev)
 Get a pointer to the device at idx. More...
 
const char * LiveGetShortName (const char *dev)
 
int LiveBuildDeviceList (const char *base)
 
void LiveDeviceHasNoStats (void)
 
int LiveDeviceListClean (void)
 
int LiveBuildDeviceListCustom (const char *base, const char *itemname)
 
LiveDeviceLiveDeviceForEach (LiveDevice **ldev, LiveDevice **ndev)
 
void LiveDeviceFinalize (void)
 

Macro Definition Documentation

#define MAX_DEVNAME   10

Definition at line 37 of file util-device.h.

#define OFFLOAD_FLAG_GRO   (1<<3)

Definition at line 27 of file util-device.h.

Referenced by GetIfaceMaxPacketSize().

#define OFFLOAD_FLAG_GSO   (1<<2)

Definition at line 26 of file util-device.h.

Referenced by GetIfaceMaxPacketSize().

#define OFFLOAD_FLAG_LRO   (1<<4)

Definition at line 28 of file util-device.h.

Referenced by GetIfaceMaxPacketSize().

#define OFFLOAD_FLAG_RXCSUM   (1<<5)

Definition at line 29 of file util-device.h.

Referenced by GetIfaceMaxPacketSize().

#define OFFLOAD_FLAG_SG   (1<<0)

Definition at line 24 of file util-device.h.

Referenced by GetIfaceMaxPacketSize().

#define OFFLOAD_FLAG_TOE   (1<<7)

Definition at line 31 of file util-device.h.

Referenced by GetIfaceMaxPacketSize().

#define OFFLOAD_FLAG_TSO   (1<<1)

Definition at line 25 of file util-device.h.

Referenced by GetIfaceMaxPacketSize().

#define OFFLOAD_FLAG_TXCSUM   (1<<6)

Definition at line 30 of file util-device.h.

Referenced by GetIfaceMaxPacketSize().

Typedef Documentation

typedef struct LiveDevice_ LiveDevice

storage for live device names

Function Documentation

int LiveBuildDeviceList ( const char *  base)

Definition at line 277 of file util-device.c.

References LiveBuildDeviceListCustom().

Referenced by RegisterAllModules().

Here is the call graph for this function:

Here is the caller graph for this function:

int LiveBuildDeviceListCustom ( const char *  base,
const char *  itemname 
)

Definition at line 282 of file util-device.c.

References ConfGetNode(), LiveRegisterDeviceName(), ConfNode_::name, next, TAILQ_FOREACH, and ConfNode_::val.

Referenced by LiveBuildDeviceList(), and RegisterAllModules().

Here is the call graph for this function:

Here is the caller graph for this function:

void LiveDeviceFinalize ( void  )

Create registered devices

This function creates all needed LiveDevice from the LiveDeviceName list created via LiveRegisterDevice()

Definition at line 442 of file util-device.c.

References LiveDeviceName_::dev, LiveRegisterDevice(), next, SCFree, SCLogDebug, and TAILQ_FOREACH_SAFE.

Referenced by PostRunDeinit().

Here is the call graph for this function:

Here is the caller graph for this function:

LiveDevice* LiveDeviceForEach ( LiveDevice **  ldev,
LiveDevice **  ndev 
)

Definition at line 420 of file util-device.c.

References next, TAILQ_FIRST, and TAILQ_NEXT.

void LiveDeviceHasNoStats ( void  )

Call this function to disable stat on live devices

This can be useful in the case, this is not a real interface.

Definition at line 312 of file util-device.c.

Referenced by RunModeIpsIPFWAutoFp(), RunModeIpsIPFWWorker(), RunModeIpsNFQAutoFp(), RunModeIpsNFQWorker(), RunModeIpsWinDivertAutoFp(), and RunModeNapatechRegister().

Here is the caller graph for this function:

int LiveDeviceListClean ( void  )

Definition at line 317 of file util-device.c.

References MimeDecParseState::data, LiveDevice_::dev, LiveDevFreeStorage(), next, RestoreIfaceOffloading(), SC_ATOMIC_DESTROY, SC_ATOMIC_GET, SCEnter, SCFree, SCLogNotice, SCReturnInt, TAILQ_FOREACH, TAILQ_FOREACH_SAFE, TM_ECODE_FAILED, and TM_ECODE_OK.

Referenced by GlobalsInitPreConfig().

Here is the call graph for this function:

Here is the caller graph for this function:

LiveDevice* LiveGetDevice ( const char *  name)

Get a pointer to the device at idx.

Parameters
numberidx of the device in our list
Return values
ptrpointer to the string containing the device
NULLon error

Definition at line 248 of file util-device.c.

References LiveDevice_::dev, next, SC_ERR_INVALID_VALUE, SCLogWarning, and TAILQ_FOREACH.

Referenced by DetectEngineReloadTenantBlocking(), LiveGetShortName(), NFQRegisterQueue(), NoNFLOGSupportExit(), ReceiveAFPThreadInit(), ReceiveErfDagThreadInit(), ReceivePcapThreadInit(), ReceivePfringThreadInit(), RunModeIdsAFPRegister(), RunModeIdsNetmapRegister(), RunModeIdsPfringRegister(), and TmModuleDecodeNetmapRegister().

Here is the caller graph for this function:

int LiveGetDeviceCount ( void  )

Get the number of registered devices.

Return values
cntthe number of registered devices

Definition at line 148 of file util-device.c.

References next, and TAILQ_FOREACH.

Referenced by AFPRunModeIsIPS(), LiveRegisterDevice(), PostRunDeinit(), RunModeIdsNetmapRegister(), RunModeSetIPSAutoFp(), RunModeSetIPSWorker(), RunModeSetLiveCaptureAutoFp(), RunModeSetLiveCaptureSingle(), RunModeSetLiveCaptureWorkers(), and RunModeTileMpipeRegister().

Here is the caller graph for this function:

const char* LiveGetDeviceName ( int  number)

Get a pointer to the device name at idx.

Parameters
numberidx of the device in our list
Return values
ptrpointer to the string containing the device
NULLon error

Definition at line 168 of file util-device.c.

References LiveDevice_::dev, length, MAX_DEVNAME, next, SCLogInfo, strlcat(), strlcpy(), and TAILQ_FOREACH.

Referenced by AFPRunModeIsIPS(), PostRunDeinit(), RunModeIdsNetmapRegister(), RunModeSetIPSAutoFp(), RunModeSetIPSWorker(), RunModeSetLiveCaptureAutoFp(), RunModeSetLiveCaptureSingle(), and RunModeSetLiveCaptureWorkers().

Here is the call graph for this function:

Here is the caller graph for this function:

int LiveGetOffload ( void  )

Definition at line 66 of file util-device.c.

Referenced by NoWinDivertSupportExit(), ReceivePcapThreadInit(), RunModeIdsAFPRegister(), RunModeIdsNetmapRegister(), and RunModeIdsPfringRegister().

Here is the caller graph for this function:

const char* LiveGetShortName ( const char *  dev)

Definition at line 269 of file util-device.c.

References LiveDevice_::dev_short, and LiveGetDevice().

Referenced by RunModeSetLiveCaptureAutoFp().

Here is the call graph for this function:

Here is the caller graph for this function:

int LiveRegisterDevice ( const char *  dev)

Add a pcap device for monitoring and create structure.

Parameters
devstring with the device name
Return values
0on success.
-1on failure.

Definition at line 111 of file util-device.c.

References LiveDevice_::dev, LiveDevice_::dev_short, LiveDevice_::id, LiveDevice_::ignore_checksum, LiveDevStorageSize(), LiveGetDeviceCount(), MAX_DEVNAME, next, SC_ATOMIC_INIT, SCCalloc, SCFree, SCLogDebug, SCStrdup, strlcpy(), TAILQ_INSERT_TAIL, and unlikely.

Referenced by LiveDeviceFinalize(), NFQRegisterQueue(), NoWinDivertSupportExit(), RunModeIdsPfringRegister(), and RunModeNapatechRegister().

Here is the call graph for this function:

Here is the caller graph for this function:

int LiveRegisterDeviceName ( const char *  dev)

Add a device for monitoring.

To be used during option parsing. When a device has to be created during runmode init, use LiveRegisterDevice()

Parameters
devstring with the device name
Return values
0on success.
-1on failure.

Definition at line 82 of file util-device.c.

References LiveDeviceName_::dev, next, SCCalloc, SCFree, SCLogDebug, SCStrdup, TAILQ_INSERT_TAIL, and unlikely.

Referenced by IPFWRegisterQueue(), LiveBuildDeviceListCustom(), and RegisterAllModules().

Here is the caller graph for this function:

void LiveSetOffloadDisable ( void  )

Referenced by PostRunDeinit().

Here is the caller graph for this function:

void LiveSetOffloadWarn ( void  )

Definition at line 61 of file util-device.c.

Referenced by PostRunDeinit().

Here is the caller graph for this function: