mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-30 05:00:10 +01:00
We use clang-format for automatic formatting of our source files. Since clang-format is actively maintained software, the actual formatting depends on the used version of clang-format. That is unfortunate and painful, but really unavoidable unless clang-format would be strictly bug-compatible. So the version that we must use is from the current Fedora release, which is also tested by our gitlab-ci. Previously, we were using Fedora 34 with clang-tools-extra-12.0.1-1.fc34.x86_64. As Fedora 35 comes along, we need to update our formatting as Fedora 35 comes with version "13.0.0~rc1-1.fc35". An alternative would be to freeze on version 12, but that has different problems (like, it's cumbersome to rebuild clang 12 on Fedora 35 and it would be cumbersome for our developers which are on Fedora 35 to use a clang that they cannot easily install). The (differently painful) solution is to reformat from time to time, as we switch to a new Fedora (and thus clang) version. Usually we would expect that such a reformatting brings minor changes. But this time, the changes are huge. That is mentioned in the release notes [1] as Makes PointerAligment: Right working with AlignConsecutiveDeclarations. (Fixes https://llvm.org/PR27353) [1] https://releases.llvm.org/13.0.0/tools/clang/docs/ReleaseNotes.html#clang-format
168 lines
10 KiB
C
168 lines
10 KiB
C
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
/*
|
|
* Copyright (C) 2015 Red Hat, Inc.
|
|
*/
|
|
|
|
#ifndef __NM_AUDIT_MANAGER_H__
|
|
#define __NM_AUDIT_MANAGER_H__
|
|
|
|
#include "nm-connection.h"
|
|
#include "devices/nm-device.h"
|
|
#include "nm-types.h"
|
|
|
|
#define NM_TYPE_AUDIT_MANAGER (nm_audit_manager_get_type())
|
|
#define NM_AUDIT_MANAGER(obj) \
|
|
(G_TYPE_CHECK_INSTANCE_CAST((obj), NM_TYPE_AUDIT_MANAGER, NMAuditManager))
|
|
#define NM_AUDIT_MANAGER_CLASS(klass) \
|
|
(G_TYPE_CHECK_CLASS_CAST((klass), NM_TYPE_AUDIT_MANAGER, NMAuditManagerClass))
|
|
#define NM_IS_AUDIT_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), NM_TYPE_AUDIT_MANAGER))
|
|
#define NM_IS_AUDIT_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), NM_TYPE_AUDIT_MANAGER))
|
|
#define NM_AUDIT_MANAGER_GET_CLASS(obj) \
|
|
(G_TYPE_INSTANCE_GET_CLASS((obj), NM_TYPE_AUDIT_MANAGER, NMAuditManagerClass))
|
|
|
|
typedef struct _NMAuditManagerClass NMAuditManagerClass;
|
|
|
|
#define NM_AUDIT_OP_CONN_ADD "connection-add"
|
|
#define NM_AUDIT_OP_CONN_DELETE "connection-delete"
|
|
#define NM_AUDIT_OP_CONN_UPDATE "connection-update"
|
|
#define NM_AUDIT_OP_CONN_ACTIVATE "connection-activate"
|
|
#define NM_AUDIT_OP_CONN_ADD_ACTIVATE "connection-add-activate"
|
|
#define NM_AUDIT_OP_CONN_DEACTIVATE "connection-deactivate"
|
|
#define NM_AUDIT_OP_CONN_CLEAR_SECRETS "connection-clear-secrets"
|
|
|
|
#define NM_AUDIT_OP_CONNS_RELOAD "connections-reload"
|
|
#define NM_AUDIT_OP_CONNS_LOAD "connections-load"
|
|
|
|
#define NM_AUDIT_OP_RELOAD "reload"
|
|
#define NM_AUDIT_OP_SLEEP_CONTROL "sleep-control"
|
|
#define NM_AUDIT_OP_NET_CONTROL "networking-control"
|
|
#define NM_AUDIT_OP_RADIO_CONTROL "radio-control"
|
|
#define NM_AUDIT_OP_STATISTICS "statistics"
|
|
#define NM_AUDIT_OP_HOSTNAME_SAVE "hostname-save"
|
|
|
|
#define NM_AUDIT_OP_DEVICE_AUTOCONNECT "device-autoconnect"
|
|
#define NM_AUDIT_OP_DEVICE_DISCONNECT "device-disconnect"
|
|
#define NM_AUDIT_OP_DEVICE_DELETE "device-delete"
|
|
#define NM_AUDIT_OP_DEVICE_MANAGED "device-managed"
|
|
#define NM_AUDIT_OP_DEVICE_REAPPLY "device-reapply"
|
|
|
|
#define NM_AUDIT_OP_CHECKPOINT_CREATE "checkpoint-create"
|
|
#define NM_AUDIT_OP_CHECKPOINT_ROLLBACK "checkpoint-rollback"
|
|
#define NM_AUDIT_OP_CHECKPOINT_DESTROY "checkpoint-destroy"
|
|
#define NM_AUDIT_OP_CHECKPOINT_ADJUST_ROLLBACK_TIMEOUT "checkpoint-adjust-rollback-timeout"
|
|
|
|
GType nm_audit_manager_get_type(void);
|
|
NMAuditManager *nm_audit_manager_get(void);
|
|
gboolean nm_audit_manager_audit_enabled(NMAuditManager *self);
|
|
|
|
#define nm_audit_log_connection_op(op, connection, result, args, subject_context, reason) \
|
|
G_STMT_START \
|
|
{ \
|
|
NMAuditManager *_audit = nm_audit_manager_get(); \
|
|
\
|
|
if (nm_audit_manager_audit_enabled(_audit)) { \
|
|
_nm_audit_manager_log_connection_op(_audit, \
|
|
__FILE__, \
|
|
__LINE__, \
|
|
G_STRFUNC, \
|
|
(op), \
|
|
(connection), \
|
|
(result), \
|
|
(args), \
|
|
(subject_context), \
|
|
(reason)); \
|
|
} \
|
|
} \
|
|
G_STMT_END
|
|
|
|
#define nm_audit_log_control_op(op, arg, result, subject_context, reason) \
|
|
G_STMT_START \
|
|
{ \
|
|
NMAuditManager *_audit = nm_audit_manager_get(); \
|
|
\
|
|
if (nm_audit_manager_audit_enabled(_audit)) { \
|
|
_nm_audit_manager_log_generic_op(_audit, \
|
|
__FILE__, \
|
|
__LINE__, \
|
|
G_STRFUNC, \
|
|
(op), \
|
|
(arg), \
|
|
(result), \
|
|
(subject_context), \
|
|
(reason)); \
|
|
} \
|
|
} \
|
|
G_STMT_END
|
|
|
|
#define nm_audit_log_device_op(op, device, result, args, subject_context, reason) \
|
|
G_STMT_START \
|
|
{ \
|
|
NMAuditManager *_audit = nm_audit_manager_get(); \
|
|
\
|
|
if (nm_audit_manager_audit_enabled(_audit)) { \
|
|
_nm_audit_manager_log_device_op(_audit, \
|
|
__FILE__, \
|
|
__LINE__, \
|
|
G_STRFUNC, \
|
|
(op), \
|
|
(device), \
|
|
(result), \
|
|
(args), \
|
|
(subject_context), \
|
|
(reason)); \
|
|
} \
|
|
} \
|
|
G_STMT_END
|
|
|
|
#define nm_audit_log_checkpoint_op(op, arg, result, subject_context, reason) \
|
|
G_STMT_START \
|
|
{ \
|
|
NMAuditManager *_audit = nm_audit_manager_get(); \
|
|
\
|
|
if (nm_audit_manager_audit_enabled(_audit)) { \
|
|
_nm_audit_manager_log_generic_op(_audit, \
|
|
__FILE__, \
|
|
__LINE__, \
|
|
G_STRFUNC, \
|
|
(op), \
|
|
(arg), \
|
|
(result), \
|
|
(subject_context), \
|
|
(reason)); \
|
|
} \
|
|
} \
|
|
G_STMT_END
|
|
|
|
void _nm_audit_manager_log_connection_op(NMAuditManager *self,
|
|
const char *file,
|
|
guint line,
|
|
const char *func,
|
|
const char *op,
|
|
NMSettingsConnection *connection,
|
|
gboolean result,
|
|
const char *args,
|
|
gpointer subject_context,
|
|
const char *reason);
|
|
|
|
void _nm_audit_manager_log_generic_op(NMAuditManager *self,
|
|
const char *file,
|
|
guint line,
|
|
const char *func,
|
|
const char *op,
|
|
const char *arg,
|
|
gboolean result,
|
|
gpointer subject_context,
|
|
const char *reason);
|
|
|
|
void _nm_audit_manager_log_device_op(NMAuditManager *self,
|
|
const char *file,
|
|
guint line,
|
|
const char *func,
|
|
const char *op,
|
|
NMDevice *device,
|
|
gboolean result,
|
|
const char *args,
|
|
gpointer subject_context,
|
|
const char *reason);
|
|
|
|
#endif /* __NM_AUDIT_MANAGER_H__ */
|