suricata
util-device.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

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)
 

Typedefs

typedef struct LiveDevice_ LiveDevice
 Public definition of LiveDevice. More...
 

Functions

void LiveSetOffloadDisable (void)
 
void LiveSetOffloadWarn (void)
 
int LiveGetOffload (void)
 
void LiveDevRegisterExtension (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 LiveDevUseBypass (LiveDevice *dev)
 
void LiveDevAddBypassStats (LiveDevice *dev, uint64_t cnt, int family)
 
void LiveDevSubBypassStats (LiveDevice *dev, uint64_t cnt, int family)
 
void LiveDevAddBypassFail (LiveDevice *dev, uint64_t cnt, int family)
 
void LiveDevAddBypassSuccess (LiveDevice *dev, uint64_t cnt, int family)
 
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)
 
uint64_t LiveDevicePktsGet (LiveDevice *dev)
 
void LiveDevicePktsIncr (LiveDevice *dev)
 
void LiveDevicePktsAdd (LiveDevice *dev, uint64_t n)
 
void LiveDeviceDropAdd (LiveDevice *dev, uint64_t n)
 
void LiveDeviceBypassedAdd (LiveDevice *dev, uint64_t n)
 
uint64_t LiveDeviceInvalidChecksumsGet (LiveDevice *dev)
 

Macro Definition Documentation

◆ OFFLOAD_FLAG_GRO

#define OFFLOAD_FLAG_GRO   (1<<3)

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

◆ OFFLOAD_FLAG_GSO

#define OFFLOAD_FLAG_GSO   (1<<2)

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

◆ OFFLOAD_FLAG_LRO

#define OFFLOAD_FLAG_LRO   (1<<4)

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

◆ OFFLOAD_FLAG_RXCSUM

#define OFFLOAD_FLAG_RXCSUM   (1<<5)

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

◆ OFFLOAD_FLAG_SG

#define OFFLOAD_FLAG_SG   (1<<0)

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

◆ OFFLOAD_FLAG_TOE

#define OFFLOAD_FLAG_TOE   (1<<7)

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

◆ OFFLOAD_FLAG_TSO

#define OFFLOAD_FLAG_TSO   (1<<1)

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

◆ OFFLOAD_FLAG_TXCSUM

#define OFFLOAD_FLAG_TXCSUM   (1<<6)

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

Typedef Documentation

◆ LiveDevice

typedef struct LiveDevice_ LiveDevice

Public definition of LiveDevice.

The private definition can be found in util-device-private.h.

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

Function Documentation

◆ LiveBuildDeviceList()

int LiveBuildDeviceList ( const char *  base)

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

References LiveBuildDeviceListCustom().

Here is the call graph for this function:

◆ LiveBuildDeviceListCustom()

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

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

Referenced by LiveBuildDeviceList().

Here is the caller graph for this function:

◆ LiveDevAddBypassFail()

void LiveDevAddBypassFail ( LiveDevice dev,
uint64_t  cnt,
int  family 
)

Increase number of failed captured flows for a protocol family

Parameters
devpointer to LiveDevice to set stats for
cntnumber of flows to add
familyAF_INET to set IPv4 count or AF_INET6 to set IPv6 count

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

References BypassInfo, and LiveDevGetStorageById().

Here is the call graph for this function:

◆ LiveDevAddBypassStats()

void LiveDevAddBypassStats ( LiveDevice dev,
uint64_t  cnt,
int  family 
)

Increase number of currently bypassed flows for a protocol family

Parameters
devpointer to LiveDevice to set stats for
cntnumber of flows to add
familyAF_INET to set IPv4 count or AF_INET6 to set IPv6 count

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

References BypassInfo, and LiveDevGetStorageById().

Here is the call graph for this function:

◆ LiveDevAddBypassSuccess()

void LiveDevAddBypassSuccess ( LiveDevice dev,
uint64_t  cnt,
int  family 
)

Increase number of currently successfully bypassed flows for a protocol family

Parameters
devpointer to LiveDevice to set stats for
cntnumber of flows to add
familyAF_INET to set IPv4 count or AF_INET6 to set IPv6 count

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

References BypassInfo, and LiveDevGetStorageById().

Here is the call graph for this function:

◆ LiveDeviceBypassedAdd()

void LiveDeviceBypassedAdd ( LiveDevice dev,
uint64_t  n 
)

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

References SC_ATOMIC_ADD.

◆ LiveDeviceDropAdd()

void LiveDeviceDropAdd ( LiveDevice dev,
uint64_t  n 
)

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

References SC_ATOMIC_ADD.

◆ LiveDeviceFinalize()

void LiveDeviceFinalize ( void  )

Create registered devices

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

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

References LiveDeviceName, LiveRegisterDevice(), next, SCFree, SCLogDebug, and TAILQ_FOREACH_SAFE.

Referenced by PostConfLoadedSetup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ LiveDeviceForEach()

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

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

References next, TAILQ_FIRST, and TAILQ_NEXT.

◆ LiveDeviceHasNoStats()

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 314 of file util-device.c.

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

Here is the caller graph for this function:

◆ LiveDeviceInvalidChecksumsGet()

uint64_t LiveDeviceInvalidChecksumsGet ( LiveDevice dev)

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

References SC_ATOMIC_GET.

◆ LiveDeviceListClean()

int LiveDeviceListClean ( void  )

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

References DPDKCloseDevice(), next, SCEnter, TAILQ_FOREACH, and TAILQ_FOREACH_SAFE.

Referenced by GlobalsDestroy().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ LiveDevicePktsAdd()

void LiveDevicePktsAdd ( LiveDevice dev,
uint64_t  n 
)

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

References SC_ATOMIC_ADD.

◆ LiveDevicePktsGet()

uint64_t LiveDevicePktsGet ( LiveDevice dev)

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

References SC_ATOMIC_GET.

◆ LiveDevicePktsIncr()

void LiveDevicePktsIncr ( LiveDevice dev)

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

References SC_ATOMIC_ADD.

◆ LiveDevRegisterExtension()

void LiveDevRegisterExtension ( void  )

Register bypass stats storage

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

Referenced by PostConfLoadedSetup().

Here is the caller graph for this function:

◆ LiveDevSubBypassStats()

void LiveDevSubBypassStats ( LiveDevice dev,
uint64_t  cnt,
int  family 
)

Decrease number of currently bypassed flows for a protocol family

Parameters
devpointer to LiveDevice to set stats for
cntnumber of flows to remove
familyAF_INET to set IPv4 count or AF_INET6 to set IPv6 count

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

References BypassInfo, and LiveDevGetStorageById().

Here is the call graph for this function:

◆ LiveDevUseBypass()

int LiveDevUseBypass ( LiveDevice dev)

Prepare a LiveDevice so we can set bypass stats

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

References BypassInfo, LiveDevSetStorageById(), SC_ATOMIC_INIT, SCCalloc, and SCLogError.

Here is the call graph for this function:

◆ LiveGetDevice()

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 253 of file util-device.c.

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

Referenced by LiveGetShortName(), and ReceiveErfDagThreadInit().

Here is the caller graph for this function:

◆ LiveGetDeviceCount()

int LiveGetDeviceCount ( void  )

Get the number of registered devices.

Return values
cntthe number of registered devices

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

References next, and TAILQ_FOREACH.

Referenced by LiveRegisterDevice(), RunModeSetIPSAutoFp(), RunModeSetIPSWorker(), RunModeSetLiveCaptureAutoFp(), RunModeSetLiveCaptureSingle(), and RunModeSetLiveCaptureWorkers().

Here is the caller graph for this function:

◆ LiveGetDeviceName()

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 189 of file util-device.c.

References LiveDevice_::dev, next, and TAILQ_FOREACH.

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

Here is the caller graph for this function:

◆ LiveGetOffload()

int LiveGetOffload ( void  )

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

◆ LiveGetShortName()

const char* LiveGetShortName ( const char *  dev)

Definition at line 271 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:

◆ LiveRegisterDevice()

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 131 of file util-device.c.

References LiveDevice_::dev, LiveDevStorageSize(), LiveGetDeviceCount(), SCCalloc, SCFree, SCStrdup, and unlikely.

Referenced by LiveDeviceFinalize(), and main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ LiveRegisterDeviceName()

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 102 of file util-device.c.

References LiveDeviceName, next, SCCalloc, SCFree, SCLogDebug, SCStrdup, TAILQ_INSERT_TAIL, and unlikely.

Referenced by SCParseCommandLine().

Here is the caller graph for this function:

◆ LiveSetOffloadDisable()

void LiveSetOffloadDisable ( void  )

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

Referenced by PostConfLoadedSetup().

Here is the caller graph for this function:

◆ LiveSetOffloadWarn()

void LiveSetOffloadWarn ( void  )

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

Referenced by PostConfLoadedSetup().

Here is the caller graph for this function: