mirror of https://github.com/OISF/suricata
util-device: break into public and private definitions
util-device.h exposes some details that are particularly problematic for C++, even when wrapped in 'extern "C"'. To address this, break the header into public and private parts. The public part exposes LiveDevice as an opaque data structure, while the private header has the actual definition. The idea is that only Suricata C source files should include the private header, it should not be re-included in any other header file. And this is the header library users should use, however we don't enforce it with tecnical means, a library user could still include the private header, but the clue there is in the name.pull/13125/head
parent
12fdd6b802
commit
9d5158594f
@ -0,0 +1,56 @@
|
||||
/* Copyright (C) 2011-2025 Open Information Security Foundation
|
||||
*
|
||||
* You can copy, redistribute or modify this Program under the terms of
|
||||
* the GNU General Public License version 2 as published by the Free
|
||||
* Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* version 2 along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/* Suricata private header, should only be included by Suricata source
|
||||
* files. */
|
||||
|
||||
#ifndef SURICATA_UTIL_DEVICE_PRIVATE_H
|
||||
#define SURICATA_UTIL_DEVICE_PRIVATE_H
|
||||
|
||||
#include "util-device.h"
|
||||
#include "queue.h"
|
||||
#include "util-storage.h"
|
||||
#include "util-dpdk-common.h"
|
||||
|
||||
#define MAX_DEVNAME 10
|
||||
|
||||
/** storage for live device names */
|
||||
typedef struct LiveDevice_ {
|
||||
char *dev; /**< the device (e.g. "eth0") */
|
||||
char dev_short[MAX_DEVNAME + 1];
|
||||
int mtu; /* MTU of the device */
|
||||
bool tenant_id_set;
|
||||
|
||||
uint16_t id;
|
||||
|
||||
SC_ATOMIC_DECLARE(uint64_t, pkts);
|
||||
SC_ATOMIC_DECLARE(uint64_t, drop);
|
||||
SC_ATOMIC_DECLARE(uint64_t, bypassed);
|
||||
SC_ATOMIC_DECLARE(uint64_t, invalid_checksums);
|
||||
TAILQ_ENTRY(LiveDevice_) next;
|
||||
|
||||
uint32_t tenant_id; /**< tenant id in multi-tenancy */
|
||||
uint32_t offload_orig; /**< original offload settings to restore @exit */
|
||||
#ifdef HAVE_DPDK
|
||||
// DPDK resources that needs to be cleaned after workers are stopped and devices closed
|
||||
DPDKDeviceResources *dpdk_vars;
|
||||
#endif
|
||||
/** storage handle as a flex array member */
|
||||
Storage storage[];
|
||||
} LiveDevice;
|
||||
|
||||
#endif /* SURICATA_UTIL_DEVICE_PRIVATE_H */
|
||||
Loading…
Reference in New Issue