suricata
util-device.h
Go to the documentation of this file.
1/* Copyright (C) 2011-2025 Open Information Security Foundation
2 *
3 * You can copy, redistribute or modify this Program under the terms of
4 * the GNU General Public License version 2 as published by the Free
5 * Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * version 2 along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15 * 02110-1301, USA.
16 */
17
18#ifndef SURICATA_UTIL_DEVICE_H
19#define SURICATA_UTIL_DEVICE_H
20
21#ifdef __cplusplus
22extern "C"
23{
24#endif
25
26#define OFFLOAD_FLAG_SG (1<<0)
27#define OFFLOAD_FLAG_TSO (1<<1)
28#define OFFLOAD_FLAG_GSO (1<<2)
29#define OFFLOAD_FLAG_GRO (1<<3)
30#define OFFLOAD_FLAG_LRO (1<<4)
31#define OFFLOAD_FLAG_RXCSUM (1<<5)
32#define OFFLOAD_FLAG_TXCSUM (1<<6)
33#define OFFLOAD_FLAG_TOE (1<<7)
34
35void LiveSetOffloadDisable(void);
36void LiveSetOffloadWarn(void);
37int LiveGetOffload(void);
38
39/**
40 * \brief Public definition of LiveDevice.
41 *
42 * The private definition can be found in util-device-private.h.
43 */
44typedef struct LiveDevice_ LiveDevice;
45
47
48int LiveRegisterDeviceName(const char *dev);
49int LiveRegisterDevice(const char *dev);
51void LiveDevAddBypassStats(LiveDevice *dev, uint64_t cnt, int family);
52void LiveDevSubBypassStats(LiveDevice *dev, uint64_t cnt, int family);
53void LiveDevAddBypassFail(LiveDevice *dev, uint64_t cnt, int family);
54void LiveDevAddBypassSuccess(LiveDevice *dev, uint64_t cnt, int family);
56int LiveGetDeviceCount(void);
57const char *LiveGetDeviceName(int number);
58LiveDevice *LiveGetDevice(const char *dev);
59const char *LiveGetShortName(const char *dev);
60int LiveBuildDeviceList(const char *base);
61void LiveDeviceHasNoStats(void);
62int LiveDeviceListClean(void);
63int LiveBuildDeviceListCustom(const char *base, const char *itemname);
64
66
67void LiveDeviceFinalize(void);
68
69#ifdef BUILD_UNIX_SOCKET
70TmEcode LiveDeviceIfaceStat(json_t *cmd, json_t *server_msg, void *data);
71TmEcode LiveDeviceIfaceList(json_t *cmd, json_t *server_msg, void *data);
72TmEcode LiveDeviceGetBypassedStats(json_t *cmd, json_t *answer, void *data);
73#endif
74
77void LiveDevicePktsAdd(LiveDevice *dev, uint64_t n);
78void LiveDeviceDropAdd(LiveDevice *dev, uint64_t n);
79void LiveDeviceBypassedAdd(LiveDevice *dev, uint64_t n);
81
82#ifdef __cplusplus
83}
84#endif
85
86#endif /* SURICATA_UTIL_DEVICE_H */
void LiveDeviceHasNoStats(void)
void LiveDevSubBypassStats(LiveDevice *dev, uint64_t cnt, int family)
void LiveDeviceFinalize(void)
uint64_t LiveDevicePktsGet(LiveDevice *dev)
uint64_t LiveDeviceInvalidChecksumsGet(LiveDevice *dev)
void LiveDevicePktsAdd(LiveDevice *dev, uint64_t n)
const char * LiveGetShortName(const char *dev)
LiveDevice * LiveDeviceForEach(LiveDevice **ldev, LiveDevice **ndev)
void LiveDevAddBypassStats(LiveDevice *dev, uint64_t cnt, int family)
int LiveGetDeviceCount(void)
Get the number of registered devices.
LiveDevice * LiveGetDevice(const char *dev)
Get a pointer to the device at idx.
int LiveGetOffload(void)
Definition util-device.c:87
int LiveDevUseBypass(LiveDevice *dev)
int LiveRegisterDevice(const char *dev)
Add a pcap device for monitoring and create structure.
int LiveGetDeviceCountWithoutAssignedThreading(void)
void LiveDeviceBypassedAdd(LiveDevice *dev, uint64_t n)
void LiveSetOffloadDisable(void)
Definition util-device.c:77
int LiveBuildDeviceListCustom(const char *base, const char *itemname)
void LiveDevRegisterExtension(void)
void LiveSetOffloadWarn(void)
Definition util-device.c:82
int LiveRegisterDeviceName(const char *dev)
Add a device for monitoring.
void LiveDevAddBypassSuccess(LiveDevice *dev, uint64_t cnt, int family)
void LiveDevAddBypassFail(LiveDevice *dev, uint64_t cnt, int family)
void LiveDevicePktsIncr(LiveDevice *dev)
int LiveDeviceListClean(void)
const char * LiveGetDeviceName(int number)
Get a pointer to the device name at idx.
int LiveBuildDeviceList(const char *base)
void LiveDeviceDropAdd(LiveDevice *dev, uint64_t n)