|
Packit Service |
87a54e |
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
|
Packit |
5756e2 |
/*
|
|
Packit |
5756e2 |
* Copyright (C) 2017, 2018 Red Hat, Inc.
|
|
Packit |
5756e2 |
*/
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
#ifndef __NM_LIBNM_UTILS_H__
|
|
Packit |
5756e2 |
#define __NM_LIBNM_UTILS_H__
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
#include "c-list/src/c-list.h"
|
|
Packit Service |
a1bd4f |
#include "nm-device.h"
|
|
Packit |
5756e2 |
#include "nm-glib-aux/nm-ref-string.h"
|
|
Packit |
5756e2 |
#include "nm-glib-aux/nm-logging-fwd.h"
|
|
Packit |
5756e2 |
#include "nm-types.h"
|
|
Packit |
5756e2 |
#include "nm-object.h"
|
|
Packit |
5756e2 |
#include "nm-client.h"
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/*****************************************************************************/
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
char *nm_utils_fixup_vendor_string(const char *desc);
|
|
Packit Service |
a1bd4f |
char *nm_utils_fixup_product_string(const char *desc);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
char *nm_utils_wincaps_to_dash(const char *caps);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
gboolean nm_utils_g_param_spec_is_default(const GParamSpec *pspec);
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/*****************************************************************************/
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
typedef enum {
|
|
Packit Service |
a1bd4f |
_NML_DBUS_LOG_LEVEL_NONE = 0x00,
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
_NML_DBUS_LOG_LEVEL_INITIALIZED = 0x01,
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
_NML_DBUS_LOG_LEVEL_TRACE = 0x02,
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
_NML_DBUS_LOG_LEVEL_DEBUG = 0x04,
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
/* the difference between a warning and a critical is that it results in
|
|
Packit Service |
a1bd4f |
* g_warning() vs. g_critical() messages. Note that we want to use "warnings"
|
|
Packit Service |
a1bd4f |
* for unknown D-Bus API that could just result because we run against a
|
|
Packit Service |
a1bd4f |
* newer NetworkManager version (such warnings are more graceful, because
|
|
Packit Service |
a1bd4f |
* we want that libnm can be forward compatible against newer servers).
|
|
Packit Service |
a1bd4f |
* Critical warnings should be emitted when NetworkManager exposes something
|
|
Packit Service |
a1bd4f |
* on D-Bus that breaks the current expectations. Usually NetworkManager
|
|
Packit Service |
a1bd4f |
* should not break API, hence such issues are more severe. */
|
|
Packit Service |
a1bd4f |
_NML_DBUS_LOG_LEVEL_WARN = 0x08,
|
|
Packit Service |
a1bd4f |
_NML_DBUS_LOG_LEVEL_ERROR = 0x10,
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
/* ANY is only relevant for nml_dbus_log_enabled() to check whether any of the
|
|
Packit Service |
a1bd4f |
* options is on. */
|
|
Packit Service |
a1bd4f |
NML_DBUS_LOG_LEVEL_ANY = _NML_DBUS_LOG_LEVEL_INITIALIZED,
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
NML_DBUS_LOG_LEVEL_TRACE = _NML_DBUS_LOG_LEVEL_TRACE,
|
|
Packit Service |
a1bd4f |
NML_DBUS_LOG_LEVEL_DEBUG = _NML_DBUS_LOG_LEVEL_DEBUG | NML_DBUS_LOG_LEVEL_TRACE,
|
|
Packit Service |
a1bd4f |
NML_DBUS_LOG_LEVEL_WARN = _NML_DBUS_LOG_LEVEL_WARN | NML_DBUS_LOG_LEVEL_DEBUG,
|
|
Packit Service |
a1bd4f |
NML_DBUS_LOG_LEVEL_ERROR = _NML_DBUS_LOG_LEVEL_ERROR | NML_DBUS_LOG_LEVEL_WARN,
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
NML_DBUS_LOG_STDOUT = 0x20,
|
|
Packit |
5756e2 |
} NMLDBusLogLevel;
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
#undef _LOGL_TRACE
|
|
Packit |
5756e2 |
#undef _LOGL_DEBUG
|
|
Packit |
5756e2 |
#undef _LOGL_INFO
|
|
Packit |
5756e2 |
#undef _LOGL_WARN
|
|
Packit |
5756e2 |
#undef _LOGL_ERR
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
#define _LOGL_TRACE NML_DBUS_LOG_LEVEL_TRACE
|
|
Packit |
5756e2 |
#define _LOGL_DEBUG NML_DBUS_LOG_LEVEL_DEBUG
|
|
Packit |
5756e2 |
#define _LOGL_INFO NML_DBUS_LOG_LEVEL_INFO
|
|
Packit |
5756e2 |
#define _LOGL_WARN NML_DBUS_LOG_LEVEL_WARN
|
|
Packit |
5756e2 |
#define _LOGL_ERR NML_DBUS_LOG_LEVEL_ERR
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
extern volatile int _nml_dbus_log_level;
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
int _nml_dbus_log_level_init(void);
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
static inline gboolean
|
|
Packit Service |
a1bd4f |
nml_dbus_log_enabled_full(NMLDBusLogLevel level, gboolean *out_use_stdout)
|
|
Packit |
5756e2 |
{
|
|
Packit Service |
a1bd4f |
int l;
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
nm_assert(NM_IN_SET(level,
|
|
Packit Service |
a1bd4f |
NML_DBUS_LOG_LEVEL_ANY,
|
|
Packit Service |
a1bd4f |
_NML_DBUS_LOG_LEVEL_NONE,
|
|
Packit Service |
a1bd4f |
NML_DBUS_LOG_LEVEL_TRACE,
|
|
Packit Service |
a1bd4f |
NML_DBUS_LOG_LEVEL_DEBUG,
|
|
Packit Service |
a1bd4f |
NML_DBUS_LOG_LEVEL_WARN,
|
|
Packit Service |
a1bd4f |
NML_DBUS_LOG_LEVEL_ERROR));
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
l = g_atomic_int_get(&_nml_dbus_log_level);
|
|
Packit Service |
a1bd4f |
if (G_UNLIKELY(l == 0))
|
|
Packit Service |
a1bd4f |
l = _nml_dbus_log_level_init();
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
nm_assert(l & _NML_DBUS_LOG_LEVEL_INITIALIZED);
|
|
Packit Service |
a1bd4f |
NM_SET_OUT(out_use_stdout, NM_FLAGS_HAS(l, NML_DBUS_LOG_STDOUT));
|
|
Packit Service |
a1bd4f |
if (level == NML_DBUS_LOG_LEVEL_ANY)
|
|
Packit Service |
a1bd4f |
return l != _NML_DBUS_LOG_LEVEL_INITIALIZED;
|
|
Packit Service |
a1bd4f |
return !!(((NMLDBusLogLevel) l) & level);
|
|
Packit |
5756e2 |
}
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
static inline gboolean
|
|
Packit Service |
a1bd4f |
nml_dbus_log_enabled(NMLDBusLogLevel level)
|
|
Packit |
5756e2 |
{
|
|
Packit Service |
a1bd4f |
return nml_dbus_log_enabled_full(level, NULL);
|
|
Packit |
5756e2 |
}
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
void _nml_dbus_log(NMLDBusLogLevel level, gboolean use_stdout, const char *fmt, ...)
|
|
Packit Service |
a1bd4f |
_nm_printf(3, 4);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
#define NML_DBUS_LOG(level, ...) \
|
|
Packit Service |
a1bd4f |
G_STMT_START \
|
|
Packit Service |
a1bd4f |
{ \
|
|
Packit Service |
a1bd4f |
gboolean _use_stdout; \
|
|
Packit Service |
a1bd4f |
\
|
|
Packit Service |
a1bd4f |
G_STATIC_ASSERT((level) == _NML_DBUS_LOG_LEVEL_NONE || (level) == NML_DBUS_LOG_LEVEL_TRACE \
|
|
Packit Service |
a1bd4f |
|| (level) == NML_DBUS_LOG_LEVEL_DEBUG \
|
|
Packit Service |
a1bd4f |
|| (level) == NML_DBUS_LOG_LEVEL_WARN \
|
|
Packit Service |
a1bd4f |
|| (level) == NML_DBUS_LOG_LEVEL_ERROR); \
|
|
Packit Service |
a1bd4f |
\
|
|
Packit Service |
a1bd4f |
if (nml_dbus_log_enabled_full(level, &_use_stdout)) { \
|
|
Packit Service |
a1bd4f |
_nml_dbus_log((level), _use_stdout, __VA_ARGS__); \
|
|
Packit Service |
a1bd4f |
} \
|
|
Packit Service |
a1bd4f |
} \
|
|
Packit Service |
a1bd4f |
G_STMT_END
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
#define NML_DBUS_LOG_T(...) NML_DBUS_LOG(NML_DBUS_LOG_LEVEL_TRACE, __VA_ARGS__)
|
|
Packit Service |
a1bd4f |
#define NML_DBUS_LOG_D(...) NML_DBUS_LOG(NML_DBUS_LOG_LEVEL_DEBUG, __VA_ARGS__)
|
|
Packit Service |
a1bd4f |
#define NML_DBUS_LOG_W(...) NML_DBUS_LOG(NML_DBUS_LOG_LEVEL_WARN, __VA_ARGS__)
|
|
Packit Service |
a1bd4f |
#define NML_DBUS_LOG_E(...) NML_DBUS_LOG(NML_DBUS_LOG_LEVEL_ERROR, __VA_ARGS__)
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/* _NML_NMCLIENT_LOG_LEVEL_COERCE is only for printf debugging. You can disable client logging by
|
|
Packit |
5756e2 |
* mapping the requested log level to a different one (or disable it altogether).
|
|
Packit |
5756e2 |
* That's useful for example if you are interested in *other* trace logging messages from
|
|
Packit |
5756e2 |
* libnm and don't want to get flooded by NMClient's trace messages. */
|
|
Packit Service |
a1bd4f |
#define _NML_NMCLIENT_LOG_LEVEL_COERCE(level) \
|
|
Packit Service |
a1bd4f |
/* for example, change condition below to suppress <trace> messages from NMClient. */ \
|
|
Packit Service |
a1bd4f |
((TRUE || ((level) != NML_DBUS_LOG_LEVEL_TRACE)) ? (level) : _NML_DBUS_LOG_LEVEL_NONE)
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
#define NML_NMCLIENT_LOG(level, self, ...) \
|
|
Packit Service |
a1bd4f |
NML_DBUS_LOG(_NML_NMCLIENT_LOG_LEVEL_COERCE(level), \
|
|
Packit Service |
a1bd4f |
"nmclient[" NM_HASH_OBFUSCATE_PTR_FMT "]: " _NM_UTILS_MACRO_FIRST(__VA_ARGS__), \
|
|
Packit Service |
a1bd4f |
NM_HASH_OBFUSCATE_PTR(self) _NM_UTILS_MACRO_REST(__VA_ARGS__))
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
#define NML_NMCLIENT_LOG_T(self, ...) NML_NMCLIENT_LOG(NML_DBUS_LOG_LEVEL_TRACE, self, __VA_ARGS__)
|
|
Packit Service |
a1bd4f |
#define NML_NMCLIENT_LOG_D(self, ...) NML_NMCLIENT_LOG(NML_DBUS_LOG_LEVEL_DEBUG, self, __VA_ARGS__)
|
|
Packit Service |
a1bd4f |
#define NML_NMCLIENT_LOG_W(self, ...) NML_NMCLIENT_LOG(NML_DBUS_LOG_LEVEL_WARN, self, __VA_ARGS__)
|
|
Packit Service |
a1bd4f |
#define NML_NMCLIENT_LOG_E(self, ...) NML_NMCLIENT_LOG(NML_DBUS_LOG_LEVEL_ERROR, self, __VA_ARGS__)
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/*****************************************************************************/
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
static inline const char *
|
|
Packit Service |
a1bd4f |
_nml_coerce_property_str_not_null(const char *str)
|
|
Packit |
5756e2 |
{
|
|
Packit Service |
a1bd4f |
return str ?: "";
|
|
Packit |
5756e2 |
}
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
static inline const char *
|
|
Packit Service |
a1bd4f |
_nml_coerce_property_str_not_empty(const char *str)
|
|
Packit |
5756e2 |
{
|
|
Packit Service |
a1bd4f |
return str && str[0] ? str : NULL;
|
|
Packit |
5756e2 |
}
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
static inline const char *
|
|
Packit Service |
a1bd4f |
_nml_coerce_property_object_path(NMRefString *path)
|
|
Packit |
5756e2 |
{
|
|
Packit Service |
a1bd4f |
if (!path)
|
|
Packit Service |
a1bd4f |
return NULL;
|
|
Packit Service |
a1bd4f |
return nm_dbus_path_not_empty(path->str);
|
|
Packit |
5756e2 |
}
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
static inline const char *const *
|
|
Packit Service |
a1bd4f |
_nml_coerce_property_strv_not_null(char **strv)
|
|
Packit |
5756e2 |
{
|
|
Packit Service |
a1bd4f |
return ((const char *const *) strv) ?: NM_PTRARRAY_EMPTY(const char *);
|
|
Packit |
5756e2 |
}
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/*****************************************************************************/
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
GQuark nm_context_busy_watcher_quark(void);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
void nm_context_busy_watcher_integrate_source(GMainContext *outer_context,
|
|
Packit Service |
a1bd4f |
GMainContext *inner_context,
|
|
Packit Service |
a1bd4f |
GObject * context_busy_watcher);
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/*****************************************************************************/
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
typedef struct {
|
|
Packit Service |
a1bd4f |
GCancellable *cancellable;
|
|
Packit Service |
a1bd4f |
GSource * cancel_on_idle_source;
|
|
Packit Service |
a1bd4f |
gulong cancelled_id;
|
|
Packit Service |
a1bd4f |
union {
|
|
Packit Service |
a1bd4f |
struct {
|
|
Packit Service |
a1bd4f |
GTask *task;
|
|
Packit Service |
a1bd4f |
} async;
|
|
Packit Service |
a1bd4f |
struct {
|
|
Packit Service |
a1bd4f |
GMainLoop *main_loop;
|
|
Packit Service |
a1bd4f |
GError ** error_location;
|
|
Packit Service |
a1bd4f |
} sync;
|
|
Packit Service |
a1bd4f |
} data;
|
|
Packit Service |
a1bd4f |
bool is_sync : 1;
|
|
Packit |
5756e2 |
} NMLInitData;
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
NMLInitData *
|
|
Packit Service |
a1bd4f |
nml_init_data_new_sync(GCancellable *cancellable, GMainLoop *main_loop, GError **error_location);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
NMLInitData *nml_init_data_new_async(GCancellable *cancellable, GTask *task_take);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
void nml_init_data_return(NMLInitData *init_data, GError *error_take);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
void nml_cleanup_context_busy_watcher_on_idle(GObject * context_busy_watcher_take,
|
|
Packit Service |
a1bd4f |
GMainContext *context);
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/*****************************************************************************/
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
typedef struct _NMLDBusObject NMLDBusObject;
|
|
Packit |
5756e2 |
typedef struct _NMLDBusObjWatcher NMLDBusObjWatcher;
|
|
Packit |
5756e2 |
typedef struct _NMLDBusMetaIface NMLDBusMetaIface;
|
|
Packit |
5756e2 |
typedef struct _NMLDBusPropertyO NMLDBusPropertyO;
|
|
Packit |
5756e2 |
typedef struct _NMLDBusPropertyAO NMLDBusPropertyAO;
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
typedef enum {
|
|
Packit Service |
a1bd4f |
/* See comments below for NMLDBusMetaIface.interface_prio.
|
|
Packit Service |
a1bd4f |
*
|
|
Packit Service |
a1bd4f |
* Higher numbers means more important to detect the GObject type. */
|
|
Packit Service |
a1bd4f |
NML_DBUS_META_INTERFACE_PRIO_NONE = 0,
|
|
Packit Service |
a1bd4f |
NML_DBUS_META_INTERFACE_PRIO_NMCLIENT = 1,
|
|
Packit Service |
a1bd4f |
NML_DBUS_META_INTERFACE_PRIO_PARENT_TYPE = 2,
|
|
Packit Service |
a1bd4f |
NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_10 = 3,
|
|
Packit Service |
a1bd4f |
NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_20 = 4,
|
|
Packit Service |
a1bd4f |
NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_30 = 5,
|
|
Packit |
5756e2 |
} NMLDBusMetaInteracePrio;
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/*****************************************************************************/
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
#define NM_CLIENT_INSTANCE_FLAGS_ALL ((NMClientInstanceFlags) 0x1)
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
typedef struct {
|
|
Packit Service |
a1bd4f |
GType (*get_o_type_fcn)(void);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
/* Ignore whether the referenced NMObject is ready or not. That means,
|
|
Packit Service |
a1bd4f |
* the property is always ready (and if the pointed object itself is
|
|
Packit Service |
a1bd4f |
* not yet ready, the property pretends to be %NULL for the moment. */
|
|
Packit Service |
a1bd4f |
bool is_always_ready : 1;
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
} NMLDBusPropertVTableO;
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
struct _NMLDBusPropertyO {
|
|
Packit Service |
a1bd4f |
NMLDBusObject * owner_dbobj;
|
|
Packit Service |
a1bd4f |
NMLDBusObjWatcher * obj_watcher;
|
|
Packit Service |
a1bd4f |
GObject * nmobj;
|
|
Packit Service |
a1bd4f |
const NMLDBusMetaIface *meta_iface;
|
|
Packit Service |
a1bd4f |
guint dbus_property_idx;
|
|
Packit Service |
a1bd4f |
bool is_ready : 1;
|
|
Packit Service |
a1bd4f |
bool is_changed : 1;
|
|
Packit Service |
a1bd4f |
bool block_is_changed : 1;
|
|
Packit |
5756e2 |
};
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
gpointer nml_dbus_property_o_get_obj(NMLDBusPropertyO *pr_o);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
gboolean nml_dbus_property_o_is_ready(const NMLDBusPropertyO *pr_o);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
gboolean nml_dbus_property_o_is_ready_fully(const NMLDBusPropertyO *pr_o);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
void nml_dbus_property_o_clear(NMLDBusPropertyO *pr_o, NMClient *client);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
void nml_dbus_property_o_clear_many(NMLDBusPropertyO *pr_o, guint len, NMClient *self);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
void nml_dbus_property_o_notify_changed_many(NMLDBusPropertyO *ptr, guint len, NMClient *self);
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/*****************************************************************************/
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
typedef struct {
|
|
Packit Service |
a1bd4f |
GType (*get_o_type_fcn)(void);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
void (*notify_changed_ao)(NMLDBusPropertyAO *pr_ao,
|
|
Packit Service |
a1bd4f |
NMClient * self,
|
|
Packit Service |
a1bd4f |
NMObject * nmobj,
|
|
Packit Service |
a1bd4f |
gboolean is_added /* or else removed */);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
gboolean (*check_nmobj_visible_fcn)(GObject *nmobj);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
/* Ignore whether the referenced NMObject is ready or not. That means,
|
|
Packit Service |
a1bd4f |
* the property is always ready (and if the pointed object itself is
|
|
Packit Service |
a1bd4f |
* not yet ready, the property pretends to be %NULL for the moment. */
|
|
Packit Service |
a1bd4f |
bool is_always_ready : 1;
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
} NMLDBusPropertVTableAO;
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
struct _NMLDBusPropertyAOData;
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
struct _NMLDBusPropertyAO {
|
|
Packit Service |
a1bd4f |
CList data_lst_head;
|
|
Packit Service |
a1bd4f |
GHashTable * hash;
|
|
Packit Service |
a1bd4f |
NMLDBusObject * owner_dbobj;
|
|
Packit Service |
a1bd4f |
const NMLDBusMetaIface * meta_iface;
|
|
Packit Service |
a1bd4f |
GPtrArray * arr;
|
|
Packit Service |
a1bd4f |
struct _NMLDBusPropertyAOData *changed_head;
|
|
Packit Service |
a1bd4f |
guint dbus_property_idx;
|
|
Packit Service |
a1bd4f |
guint n_not_ready;
|
|
Packit Service |
a1bd4f |
bool is_changed : 1;
|
|
Packit |
5756e2 |
};
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
const GPtrArray *nml_dbus_property_ao_get_objs_as_ptrarray(NMLDBusPropertyAO *pr_ao);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
gboolean nml_dbus_property_ao_is_ready(const NMLDBusPropertyAO *pr_ao);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
void nml_dbus_property_ao_clear(NMLDBusPropertyAO *pr_ao, NMClient *client);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
void nml_dbus_property_ao_clear_many(NMLDBusPropertyAO *pr_ao, guint len, NMClient *self);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
void nml_dbus_property_ao_notify_changed_many(NMLDBusPropertyAO *ptr, guint len, NMClient *self);
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/*****************************************************************************/
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
typedef enum {
|
|
Packit Service |
a1bd4f |
NML_DBUS_NOTIFY_UPDATE_PROP_FLAGS_NONE = 0,
|
|
Packit Service |
a1bd4f |
NML_DBUS_NOTIFY_UPDATE_PROP_FLAGS_NOTIFY = 0x1,
|
|
Packit |
5756e2 |
} NMLDBusNotifyUpdatePropFlags;
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
NMLDBusNotifyUpdatePropFlags _nml_dbus_notify_update_prop_ignore(NMClient * client,
|
|
Packit Service |
a1bd4f |
NMLDBusObject * dbobj,
|
|
Packit Service |
a1bd4f |
const NMLDBusMetaIface *meta_iface,
|
|
Packit Service |
a1bd4f |
guint dbus_property_idx,
|
|
Packit Service |
a1bd4f |
GVariant *value);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
NMLDBusNotifyUpdatePropFlags _nml_dbus_notify_update_prop_o(NMClient * client,
|
|
Packit Service |
a1bd4f |
NMLDBusObject * dbobj,
|
|
Packit Service |
a1bd4f |
const NMLDBusMetaIface *meta_iface,
|
|
Packit Service |
a1bd4f |
guint dbus_property_idx,
|
|
Packit Service |
a1bd4f |
GVariant *value);
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
typedef struct {
|
|
Packit Service |
a1bd4f |
const char * dbus_property_name;
|
|
Packit Service |
a1bd4f |
const GVariantType *dbus_type;
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
guint16 prop_struct_offset;
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
guint8 obj_properties_idx;
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
bool use_notify_update_prop : 1;
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
bool obj_property_no_reverse_idx : 1;
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
union {
|
|
Packit Service |
a1bd4f |
union {
|
|
Packit Service |
a1bd4f |
const NMLDBusPropertVTableO * property_vtable_o;
|
|
Packit Service |
a1bd4f |
const NMLDBusPropertVTableAO *property_vtable_ao;
|
|
Packit Service |
a1bd4f |
} extra;
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
NMLDBusNotifyUpdatePropFlags (*notify_update_prop)(NMClient * client,
|
|
Packit Service |
a1bd4f |
NMLDBusObject * dbobj,
|
|
Packit Service |
a1bd4f |
const NMLDBusMetaIface *meta_iface,
|
|
Packit Service |
a1bd4f |
guint dbus_property_idx,
|
|
Packit Service |
a1bd4f |
GVariant *value);
|
|
Packit Service |
a1bd4f |
};
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
} NMLDBusMetaProperty;
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
#define NML_DBUS_META_PROPERTY_INIT(v_dbus_property_name, v_dbus_type, v_obj_properties_idx, ...) \
|
|
Packit Service |
a1bd4f |
{ \
|
|
Packit Service |
a1bd4f |
.dbus_property_name = "" v_dbus_property_name "", \
|
|
Packit Service |
a1bd4f |
.dbus_type = NM_G_VARIANT_TYPE("" v_dbus_type ""), \
|
|
Packit Service |
a1bd4f |
.obj_properties_idx = v_obj_properties_idx, ##__VA_ARGS__ \
|
|
Packit Service |
a1bd4f |
}
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
#define _NML_DBUS_META_PROPERTY_INIT_DEFAULT(v_dbus_type, \
|
|
Packit Service |
a1bd4f |
v_exp_type, \
|
|
Packit |
5756e2 |
v_dbus_property_name, \
|
|
Packit |
5756e2 |
v_obj_properties_idx, \
|
|
Packit Service |
a1bd4f |
v_container, \
|
|
Packit Service |
a1bd4f |
v_field) \
|
|
Packit Service |
a1bd4f |
NML_DBUS_META_PROPERTY_INIT( \
|
|
Packit Service |
a1bd4f |
v_dbus_property_name, \
|
|
Packit Service |
a1bd4f |
v_dbus_type, \
|
|
Packit Service |
a1bd4f |
v_obj_properties_idx, \
|
|
Packit Service |
a1bd4f |
.prop_struct_offset = NM_STRUCT_OFFSET_ENSURE_TYPE(v_exp_type, v_container, v_field))
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
#define NML_DBUS_META_PROPERTY_INIT_B(...) \
|
|
Packit Service |
a1bd4f |
_NML_DBUS_META_PROPERTY_INIT_DEFAULT("b", bool, __VA_ARGS__)
|
|
Packit Service |
a1bd4f |
#define NML_DBUS_META_PROPERTY_INIT_Y(...) \
|
|
Packit Service |
a1bd4f |
_NML_DBUS_META_PROPERTY_INIT_DEFAULT("y", guint8, __VA_ARGS__)
|
|
Packit Service |
a1bd4f |
#define NML_DBUS_META_PROPERTY_INIT_Q(...) \
|
|
Packit Service |
a1bd4f |
_NML_DBUS_META_PROPERTY_INIT_DEFAULT("q", guint16, __VA_ARGS__)
|
|
Packit Service |
a1bd4f |
#define NML_DBUS_META_PROPERTY_INIT_I(...) \
|
|
Packit Service |
a1bd4f |
_NML_DBUS_META_PROPERTY_INIT_DEFAULT("i", gint32, __VA_ARGS__)
|
|
Packit Service |
a1bd4f |
#define NML_DBUS_META_PROPERTY_INIT_U(...) \
|
|
Packit Service |
a1bd4f |
_NML_DBUS_META_PROPERTY_INIT_DEFAULT("u", guint32, __VA_ARGS__)
|
|
Packit Service |
a1bd4f |
#define NML_DBUS_META_PROPERTY_INIT_X(...) \
|
|
Packit Service |
a1bd4f |
_NML_DBUS_META_PROPERTY_INIT_DEFAULT("x", gint64, __VA_ARGS__)
|
|
Packit Service |
a1bd4f |
#define NML_DBUS_META_PROPERTY_INIT_T(...) \
|
|
Packit Service |
a1bd4f |
_NML_DBUS_META_PROPERTY_INIT_DEFAULT("t", guint64, __VA_ARGS__)
|
|
Packit Service |
a1bd4f |
#define NML_DBUS_META_PROPERTY_INIT_S(...) \
|
|
Packit Service |
a1bd4f |
_NML_DBUS_META_PROPERTY_INIT_DEFAULT("s", char *, __VA_ARGS__)
|
|
Packit Service |
a1bd4f |
#define NML_DBUS_META_PROPERTY_INIT_AS(...) \
|
|
Packit Service |
a1bd4f |
_NML_DBUS_META_PROPERTY_INIT_DEFAULT("as", char **, __VA_ARGS__)
|
|
Packit Service |
a1bd4f |
#define NML_DBUS_META_PROPERTY_INIT_AY(...) \
|
|
Packit Service |
a1bd4f |
_NML_DBUS_META_PROPERTY_INIT_DEFAULT("ay", GBytes *, __VA_ARGS__)
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
#define NML_DBUS_META_PROPERTY_INIT_O(v_dbus_property_name, \
|
|
Packit Service |
a1bd4f |
v_obj_properties_idx, \
|
|
Packit Service |
a1bd4f |
v_container, \
|
|
Packit Service |
a1bd4f |
v_field) \
|
|
Packit Service |
a1bd4f |
NML_DBUS_META_PROPERTY_INIT( \
|
|
Packit Service |
a1bd4f |
v_dbus_property_name, \
|
|
Packit Service |
a1bd4f |
"o", \
|
|
Packit Service |
a1bd4f |
v_obj_properties_idx, \
|
|
Packit Service |
a1bd4f |
.prop_struct_offset = NM_STRUCT_OFFSET_ENSURE_TYPE(NMRefString *, v_container, v_field), \
|
|
Packit Service |
a1bd4f |
.use_notify_update_prop = TRUE, \
|
|
Packit Service |
a1bd4f |
.notify_update_prop = _nml_dbus_notify_update_prop_o)
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
#define NML_DBUS_META_PROPERTY_INIT_O_PROP(v_dbus_property_name, \
|
|
Packit Service |
a1bd4f |
v_obj_properties_idx, \
|
|
Packit Service |
a1bd4f |
v_container, \
|
|
Packit Service |
a1bd4f |
v_field, \
|
|
Packit Service |
a1bd4f |
v_get_o_type_fcn, \
|
|
Packit Service |
a1bd4f |
...) \
|
|
Packit Service |
a1bd4f |
NML_DBUS_META_PROPERTY_INIT( \
|
|
Packit Service |
a1bd4f |
v_dbus_property_name, \
|
|
Packit Service |
a1bd4f |
"o", \
|
|
Packit Service |
a1bd4f |
v_obj_properties_idx, \
|
|
Packit Service |
a1bd4f |
.prop_struct_offset = \
|
|
Packit Service |
a1bd4f |
NM_STRUCT_OFFSET_ENSURE_TYPE(NMLDBusPropertyO, v_container, v_field), \
|
|
Packit Service |
a1bd4f |
.extra.property_vtable_o = \
|
|
Packit Service |
a1bd4f |
&((const NMLDBusPropertVTableO){.get_o_type_fcn = (v_get_o_type_fcn), ##__VA_ARGS__}))
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
#define NML_DBUS_META_PROPERTY_INIT_AO_PROP(v_dbus_property_name, \
|
|
Packit Service |
a1bd4f |
v_obj_properties_idx, \
|
|
Packit Service |
a1bd4f |
v_container, \
|
|
Packit Service |
a1bd4f |
v_field, \
|
|
Packit Service |
a1bd4f |
v_get_o_type_fcn, \
|
|
Packit Service |
a1bd4f |
...) \
|
|
Packit Service |
a1bd4f |
NML_DBUS_META_PROPERTY_INIT( \
|
|
Packit Service |
a1bd4f |
v_dbus_property_name, \
|
|
Packit Service |
a1bd4f |
"ao", \
|
|
Packit Service |
a1bd4f |
v_obj_properties_idx, \
|
|
Packit Service |
a1bd4f |
.prop_struct_offset = \
|
|
Packit Service |
a1bd4f |
NM_STRUCT_OFFSET_ENSURE_TYPE(NMLDBusPropertyAO, v_container, v_field), \
|
|
Packit Service |
a1bd4f |
.extra.property_vtable_ao = &( \
|
|
Packit Service |
a1bd4f |
(const NMLDBusPropertVTableAO){.get_o_type_fcn = (v_get_o_type_fcn), ##__VA_ARGS__}))
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
#define NML_DBUS_META_PROPERTY_INIT_FCN(v_dbus_property_name, \
|
|
Packit Service |
a1bd4f |
v_obj_properties_idx, \
|
|
Packit Service |
a1bd4f |
v_dbus_type, \
|
|
Packit Service |
a1bd4f |
v_notify_update_prop, \
|
|
Packit Service |
a1bd4f |
...) \
|
|
Packit Service |
a1bd4f |
NML_DBUS_META_PROPERTY_INIT(v_dbus_property_name, \
|
|
Packit Service |
a1bd4f |
v_dbus_type, \
|
|
Packit Service |
a1bd4f |
v_obj_properties_idx, \
|
|
Packit Service |
a1bd4f |
.use_notify_update_prop = TRUE, \
|
|
Packit Service |
a1bd4f |
.notify_update_prop = (v_notify_update_prop), \
|
|
Packit Service |
a1bd4f |
##__VA_ARGS__)
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
#define NML_DBUS_META_PROPERTY_INIT_IGNORE(v_dbus_property_name, v_dbus_type) \
|
|
Packit Service |
a1bd4f |
NML_DBUS_META_PROPERTY_INIT(v_dbus_property_name, \
|
|
Packit Service |
a1bd4f |
v_dbus_type, \
|
|
Packit Service |
a1bd4f |
0, \
|
|
Packit Service |
a1bd4f |
.use_notify_update_prop = TRUE, \
|
|
Packit Service |
a1bd4f |
.notify_update_prop = _nml_dbus_notify_update_prop_ignore)
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/* "TODO" is like "IGNORE". The difference is that we don't plan to ever implement "IGNORE", but
|
|
Packit |
5756e2 |
* "TODO" is something we should add support for. */
|
|
Packit Service |
a1bd4f |
#define NML_DBUS_META_PROPERTY_INIT_TODO(...) NML_DBUS_META_PROPERTY_INIT_IGNORE(__VA_ARGS__)
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
struct _NMLDBusMetaIface {
|
|
Packit Service |
a1bd4f |
const char *dbus_iface_name;
|
|
Packit Service |
a1bd4f |
GType (*get_type_fcn)(void);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
/* Usually there is a one-to-one correspondence between the properties
|
|
Packit Service |
a1bd4f |
* on D-Bus (dbus_properties) and the GObject properties (obj_properties).
|
|
Packit Service |
a1bd4f |
*
|
|
Packit Service |
a1bd4f |
* With:
|
|
Packit Service |
a1bd4f |
* meta_iface->obj_properties[o_idx] (o_idx < n_obj_properties)
|
|
Packit Service |
a1bd4f |
* &meta_iface->dbus_properties[d_idx] (d_idx < n_dbus_properties)
|
|
Packit Service |
a1bd4f |
* it follows that
|
|
Packit Service |
a1bd4f |
* assert (meta_iface->obj_properties_reverse_idx[o_idx] == d_idx)
|
|
Packit Service |
a1bd4f |
* assert (meta_iface->dbus_properties[d_idx].obj_properties_idx == o_idx)
|
|
Packit Service |
a1bd4f |
* if (and only if) two properties correspond.
|
|
Packit Service |
a1bd4f |
*/
|
|
Packit Service |
a1bd4f |
const GParamSpec *const * obj_properties;
|
|
Packit Service |
a1bd4f |
const NMLDBusMetaProperty *dbus_properties;
|
|
Packit Service |
a1bd4f |
const guint8 * obj_properties_reverse_idx;
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
guint8 n_dbus_properties;
|
|
Packit Service |
a1bd4f |
guint8 n_obj_properties;
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
/* The offsets "prop_struct_offset" in NMLDBusMetaProperty are based on some base
|
|
Packit Service |
a1bd4f |
* struct. If "base_struct_offset" is 0, then the base struct is the GObject pointer
|
|
Packit Service |
a1bd4f |
* itself.
|
|
Packit Service |
a1bd4f |
* If this is non-null, then we expect at that location a pointer to the offset.
|
|
Packit Service |
a1bd4f |
* In this case we need to first find the base pointer via
|
|
Packit Service |
a1bd4f |
* *((gpointer *) ((char *) nmobj + meta_iface->base_struct_offset)).
|
|
Packit Service |
a1bd4f |
*
|
|
Packit Service |
a1bd4f |
* This covers NMDeviceBridge._priv vs. NMDevice._priv. In the second case,
|
|
Packit Service |
a1bd4f |
* _priv is a pointer that we first need to follow.
|
|
Packit Service |
a1bd4f |
*/
|
|
Packit Service |
a1bd4f |
guint8 base_struct_offset;
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
/* We create the appropriate NMObject GType based on the D-Bus interfaces that
|
|
Packit Service |
a1bd4f |
* are present. For example, if we see a "org.freedesktop.NetworkManager.Device.Bridge"
|
|
Packit Service |
a1bd4f |
* interface, we create a NMDeviceBridge. Basically, if it looks like a certain
|
|
Packit Service |
a1bd4f |
* object (based on the D-Bus interface), we assume it is.
|
|
Packit Service |
a1bd4f |
*
|
|
Packit Service |
a1bd4f |
* Some interfaces are purely additional ("org.freedesktop.NetworkManager.Device.Statistics")
|
|
Packit Service |
a1bd4f |
* and don't determine the NMObject type (%NML_DBUS_META_INTERFACE_PRIO_NONE).
|
|
Packit Service |
a1bd4f |
*
|
|
Packit Service |
a1bd4f |
* Some interfaces are of a parent type ("org.freedesktop.NetworkManager.Device" for
|
|
Packit Service |
a1bd4f |
* NMDevice), and don't determine the type either (%NML_DBUS_META_INTERFACE_PRIO_PARENT_TYPE).
|
|
Packit Service |
a1bd4f |
*
|
|
Packit Service |
a1bd4f |
* Some interfaces ("org.freedesktop.NetworkManager.AgentManager") belong to NMClient
|
|
Packit Service |
a1bd4f |
* itself. Those have priority %NML_DBUS_META_INTERFACE_PRIO_NMCLIENT.
|
|
Packit Service |
a1bd4f |
*
|
|
Packit Service |
a1bd4f |
* In most cases, each D-Bus object is expected to have only one D-Bus interface
|
|
Packit Service |
a1bd4f |
* to determine the type. While theoretically an object
|
|
Packit Service |
a1bd4f |
* "/org/freedesktop/NetworkManager/Devices/3" could have interfaces "org.freedesktop.NetworkManager.Device.Bridge"
|
|
Packit Service |
a1bd4f |
* and "org.freedesktop.NetworkManager.Device.Bond" at the same time, in practice it doesn't.
|
|
Packit Service |
a1bd4f |
* Note that we also assume that once a D-Bus object gets a NMObject, it cannot change (*).
|
|
Packit Service |
a1bd4f |
* NetworkManager's API does not add/remove interfaces after exporting the object the
|
|
Packit Service |
a1bd4f |
* first time, so in practice each D-Bus object is expected to have a suitable D-Bus
|
|
Packit Service |
a1bd4f |
* interface (and only determining interface, which doesn't change). Those interfaces have
|
|
Packit Service |
a1bd4f |
* priority %NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_30.
|
|
Packit Service |
a1bd4f |
*
|
|
Packit Service |
a1bd4f |
* (*) note that nothing bad would happen if a faulty NetworkManager would violate that.
|
|
Packit Service |
a1bd4f |
* Of course, something would not work correctly, but the D-Bus interface we find is unexpected
|
|
Packit Service |
a1bd4f |
* and wrong.
|
|
Packit Service |
a1bd4f |
*
|
|
Packit Service |
a1bd4f |
* One exception is "org.freedesktop.NetworkManager.Connection.Active". This can either
|
|
Packit Service |
a1bd4f |
* be a NMActiveConnection or a NMVpnConnection. Hence, this profile has priority
|
|
Packit Service |
a1bd4f |
* %NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_10, and depending on whether there is
|
|
Packit Service |
a1bd4f |
* a "org.freedesktop.NetworkManager.VPN.Connection" (with high priority), we create
|
|
Packit Service |
a1bd4f |
* one or the other type.
|
|
Packit Service |
d0b836 |
*
|
|
Packit Service |
d0b836 |
* Another exception is "org.freedesktop.NetworkManager.Device.Veth". It is a NMDeviceVeth
|
|
Packit Service |
d0b836 |
* and the parent is NMDeviceEthernet. Therefore it contains "org.freedesktop.NetworkManager.Device.Wired"
|
|
Packit Service |
d0b836 |
* as it should be registered as NMDeviceVeth, the profile has priority
|
|
Packit Service |
d0b836 |
* %NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_20.
|
|
Packit Service |
d0b836 |
*
|
|
Packit Service |
a1bd4f |
*/
|
|
Packit Service |
a1bd4f |
NMLDBusMetaInteracePrio interface_prio : 3;
|
|
Packit |
5756e2 |
};
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
#define NML_DBUS_META_IFACE_OBJ_PROPERTIES() \
|
|
Packit Service |
a1bd4f |
.obj_properties = (const GParamSpec *const *) (obj_properties), \
|
|
Packit Service |
a1bd4f |
.n_obj_properties = _PROPERTY_ENUMS_LAST, \
|
|
Packit Service |
a1bd4f |
.obj_properties_reverse_idx = ((guint8[_PROPERTY_ENUMS_LAST]){})
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
#define NML_DBUS_META_IFACE_DBUS_PROPERTIES(...) \
|
|
Packit Service |
a1bd4f |
.dbus_properties = ((const NMLDBusMetaProperty[]){__VA_ARGS__}), \
|
|
Packit Service |
a1bd4f |
.n_dbus_properties = \
|
|
Packit Service |
a1bd4f |
(sizeof((const NMLDBusMetaProperty[]){__VA_ARGS__}) / sizeof(NMLDBusMetaProperty))
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
#define NML_DBUS_META_IFACE_INIT(v_dbus_iface_name, v_get_type_fcn, v_interface_prio, ...) \
|
|
Packit Service |
a1bd4f |
{ \
|
|
Packit Service |
a1bd4f |
.dbus_iface_name = "" v_dbus_iface_name "", .get_type_fcn = v_get_type_fcn, \
|
|
Packit Service |
a1bd4f |
.interface_prio = v_interface_prio, ##__VA_ARGS__ \
|
|
Packit Service |
a1bd4f |
}
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
#define NML_DBUS_META_IFACE_INIT_PROP(v_dbus_iface_name, v_get_type_fcn, v_interface_prio, ...) \
|
|
Packit Service |
a1bd4f |
NML_DBUS_META_IFACE_INIT(v_dbus_iface_name, \
|
|
Packit Service |
a1bd4f |
v_get_type_fcn, \
|
|
Packit Service |
a1bd4f |
v_interface_prio, \
|
|
Packit Service |
a1bd4f |
NML_DBUS_META_IFACE_OBJ_PROPERTIES(), \
|
|
Packit Service |
a1bd4f |
##__VA_ARGS__)
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
extern const NMLDBusMetaIface *const _nml_dbus_meta_ifaces[44];
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm;
|
|
Packit |
5756e2 |
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_accesspoint;
|
|
Packit |
5756e2 |
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_agentmanager;
|
|
Packit |
5756e2 |
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_checkpoint;
|
|
Packit |
5756e2 |
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_connection_active;
|
|
Packit |
5756e2 |
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_device;
|
|
Packit |
5756e2 |
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_device_adsl;
|
|
Packit |
5756e2 |
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_device_bluetooth;
|
|
Packit |
5756e2 |
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_device_bond;
|
|
Packit |
5756e2 |
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_device_bridge;
|
|
Packit |
5756e2 |
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_device_dummy;
|
|
Packit |
5756e2 |
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_device_generic;
|
|
Packit |
5756e2 |
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_device_infiniband;
|
|
Packit |
5756e2 |
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_device_iptunnel;
|
|
Packit |
5756e2 |
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_device_lowpan;
|
|
Packit |
5756e2 |
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_device_macsec;
|
|
Packit |
5756e2 |
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_device_macvlan;
|
|
Packit |
5756e2 |
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_device_modem;
|
|
Packit |
5756e2 |
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_device_olpcmesh;
|
|
Packit |
5756e2 |
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_device_ovsbridge;
|
|
Packit |
5756e2 |
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_device_ovsinterface;
|
|
Packit |
5756e2 |
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_device_ovsport;
|
|
Packit |
5756e2 |
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_device_ppp;
|
|
Packit |
5756e2 |
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_device_statistics;
|
|
Packit |
5756e2 |
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_device_team;
|
|
Packit |
5756e2 |
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_device_tun;
|
|
Packit |
5756e2 |
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_device_veth;
|
|
Packit |
5756e2 |
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_device_vlan;
|
|
Packit |
5756e2 |
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_device_vrf;
|
|
Packit |
5756e2 |
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_device_vxlan;
|
|
Packit |
5756e2 |
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_device_wifip2p;
|
|
Packit |
5756e2 |
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_device_wired;
|
|
Packit |
5756e2 |
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_device_wireguard;
|
|
Packit |
5756e2 |
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_device_wireless;
|
|
Packit |
5756e2 |
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_device_wpan;
|
|
Packit |
5756e2 |
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_dhcp4config;
|
|
Packit |
5756e2 |
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_dhcp6config;
|
|
Packit |
5756e2 |
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_dnsmanager;
|
|
Packit |
5756e2 |
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_ip4config;
|
|
Packit |
5756e2 |
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_ip6config;
|
|
Packit |
5756e2 |
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_settings;
|
|
Packit |
5756e2 |
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_settings_connection;
|
|
Packit |
5756e2 |
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_vpn_connection;
|
|
Packit |
5756e2 |
extern const NMLDBusMetaIface _nml_dbus_meta_iface_nm_wifip2ppeer;
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
const NMLDBusMetaIface *nml_dbus_meta_iface_get(const char *dbus_iface_name);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
const NMLDBusMetaProperty *nml_dbus_meta_property_get(const NMLDBusMetaIface *meta_iface,
|
|
Packit Service |
a1bd4f |
const char * dbus_property_name,
|
|
Packit Service |
a1bd4f |
guint * out_idx);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
void _nml_dbus_meta_class_init_with_properties_impl(GObjectClass * object_class,
|
|
Packit Service |
a1bd4f |
const NMLDBusMetaIface *const *meta_iface);
|
|
Packit |
5756e2 |
#define _nml_dbus_meta_class_init_with_properties(object_class, ...) \
|
|
Packit Service |
a1bd4f |
_nml_dbus_meta_class_init_with_properties_impl( \
|
|
Packit Service |
a1bd4f |
(object_class), \
|
|
Packit Service |
a1bd4f |
((const NMLDBusMetaIface *const[]){__VA_ARGS__, NULL}))
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/*****************************************************************************/
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
typedef enum {
|
|
Packit Service |
a1bd4f |
NML_DBUS_OBJ_STATE_UNLINKED = 0,
|
|
Packit Service |
a1bd4f |
NML_DBUS_OBJ_STATE_WATCHED_ONLY,
|
|
Packit Service |
a1bd4f |
NML_DBUS_OBJ_STATE_ON_DBUS,
|
|
Packit Service |
a1bd4f |
NML_DBUS_OBJ_STATE_WITH_NMOBJ_NOT_READY,
|
|
Packit Service |
a1bd4f |
NML_DBUS_OBJ_STATE_WITH_NMOBJ_READY,
|
|
Packit |
5756e2 |
} NMLDBusObjState;
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
typedef enum {
|
|
Packit Service |
a1bd4f |
NML_DBUS_OBJ_CHANGED_TYPE_NONE = 0,
|
|
Packit Service |
a1bd4f |
NML_DBUS_OBJ_CHANGED_TYPE_DBUS = (1LL << 0),
|
|
Packit Service |
a1bd4f |
NML_DBUS_OBJ_CHANGED_TYPE_NMOBJ = (1LL << 1),
|
|
Packit |
5756e2 |
} NMLDBusObjChangedType;
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
struct _NMLDBusObject {
|
|
Packit Service |
a1bd4f |
NMRefString *dbus_path;
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
/* While the object is tracked by NMClient, it is linked with this list.
|
|
Packit Service |
a1bd4f |
* The lists are partitioned based on the NMLDBusObjState. */
|
|
Packit Service |
a1bd4f |
CList dbus_objects_lst;
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
/* The list of D-Bus interface NMLDBusObjIfaceData.
|
|
Packit Service |
a1bd4f |
*
|
|
Packit Service |
a1bd4f |
* Some may be about to be removed (iface_removed) or
|
|
Packit Service |
a1bd4f |
* unknown (!dbus_iface_is_wellknown). */
|
|
Packit Service |
a1bd4f |
CList iface_lst_head;
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
/* The list of registered NMLDBusObjWatcher. */
|
|
Packit Service |
a1bd4f |
CList watcher_lst_head;
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
/* When an object changes (e.g. because of new information on D-Bus), we often
|
|
Packit Service |
a1bd4f |
* don't process the changes right away, but enqueue the object in a changed
|
|
Packit Service |
a1bd4f |
* list. This list goes together with obj_changed_type property below, which
|
|
Packit Service |
a1bd4f |
* tracks what changed. */
|
|
Packit Service |
a1bd4f |
CList obj_changed_lst;
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
GObject *nmobj;
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
int ref_count;
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
NMLDBusObjState obj_state : 4;
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
NMLDBusObjChangedType obj_changed_type : 3;
|
|
Packit |
5756e2 |
};
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
static inline gboolean
|
|
Packit Service |
a1bd4f |
NML_IS_DBUS_OBJECT(NMLDBusObject *dbobj)
|
|
Packit |
5756e2 |
{
|
|
Packit Service |
a1bd4f |
nm_assert(!dbobj || (NM_IS_REF_STRING(dbobj->dbus_path) && dbobj->ref_count > 0));
|
|
Packit Service |
a1bd4f |
nm_assert(!dbobj || !dbobj->nmobj || NM_IS_OBJECT(dbobj->nmobj) || NM_IS_CLIENT(dbobj->nmobj));
|
|
Packit Service |
a1bd4f |
return !!dbobj;
|
|
Packit |
5756e2 |
}
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
NMLDBusObject *nml_dbus_object_ref(NMLDBusObject *dbobj);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
void nml_dbus_object_unref(NMLDBusObject *dbobj);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
NM_AUTO_DEFINE_FCN0(NMLDBusObject *, _nm_auto_unref_nml_dbusobj, nml_dbus_object_unref);
|
|
Packit Service |
a1bd4f |
#define nm_auto_unref_nml_dbusobj nm_auto(_nm_auto_unref_nml_dbusobj)
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
gpointer nml_dbus_object_get_property_location(NMLDBusObject * dbobj,
|
|
Packit Service |
a1bd4f |
const NMLDBusMetaIface * meta_iface,
|
|
Packit Service |
a1bd4f |
const NMLDBusMetaProperty *meta_property);
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/*****************************************************************************/
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/* NMClient is not an NMObject, but in some aspects we want to track it like
|
|
Packit |
5756e2 |
* an NMObject. For that, both NMClient and NMObject "implement" NMObjectBase,
|
|
Packit |
5756e2 |
* despite not actually implementing such a GObject type. */
|
|
Packit |
5756e2 |
typedef struct {
|
|
Packit Service |
a1bd4f |
GObject parent;
|
|
Packit Service |
a1bd4f |
CList queue_notify_lst;
|
|
Packit Service |
a1bd4f |
bool is_disposing : 1;
|
|
Packit |
5756e2 |
} NMObjectBase;
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
typedef struct {
|
|
Packit Service |
a1bd4f |
GObjectClass parent;
|
|
Packit |
5756e2 |
} NMObjectBaseClass;
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
struct _NMObjectPrivate;
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
struct _NMObject {
|
|
Packit Service |
a1bd4f |
union {
|
|
Packit Service |
a1bd4f |
GObject parent;
|
|
Packit Service |
a1bd4f |
NMObjectBase obj_base;
|
|
Packit Service |
a1bd4f |
};
|
|
Packit Service |
a1bd4f |
struct _NMObjectPrivate *_priv;
|
|
Packit |
5756e2 |
};
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
typedef struct _NMObjectClassFieldInfo {
|
|
Packit Service |
a1bd4f |
const struct _NMObjectClassFieldInfo *parent;
|
|
Packit Service |
a1bd4f |
NMObjectClass * klass;
|
|
Packit Service |
a1bd4f |
guint16 offset;
|
|
Packit Service |
a1bd4f |
guint16 num;
|
|
Packit |
5756e2 |
} _NMObjectClassFieldInfo;
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
struct _NMObjectClass {
|
|
Packit Service |
a1bd4f |
union {
|
|
Packit Service |
a1bd4f |
GObjectClass parent;
|
|
Packit Service |
a1bd4f |
NMObjectBaseClass obj_base;
|
|
Packit Service |
a1bd4f |
};
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
void (*register_client)(NMObject *self, NMClient *client, NMLDBusObject *dbobj);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
void (*unregister_client)(NMObject *self, NMClient *client, NMLDBusObject *dbobj);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
gboolean (*is_ready)(NMObject *self);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
void (*obj_changed_notify)(NMObject *self);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
const _NMObjectClassFieldInfo *property_o_info;
|
|
Packit Service |
a1bd4f |
const _NMObjectClassFieldInfo *property_ao_info;
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
guint16 priv_ptr_offset;
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
bool priv_ptr_indirect : 1;
|
|
Packit |
5756e2 |
};
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
#define _NM_OBJECT_CLASS_INIT_PRIV_PTR_DIRECT(nm_object_class, type_name) \
|
|
Packit Service |
a1bd4f |
G_STMT_START \
|
|
Packit Service |
a1bd4f |
{ \
|
|
Packit Service |
a1bd4f |
(nm_object_class)->priv_ptr_offset = \
|
|
Packit Service |
a1bd4f |
NM_STRUCT_OFFSET_ENSURE_TYPE(type_name##Private, type_name, _priv); \
|
|
Packit Service |
a1bd4f |
(nm_object_class)->priv_ptr_indirect = FALSE; \
|
|
Packit Service |
a1bd4f |
} \
|
|
Packit Service |
a1bd4f |
G_STMT_END
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
#define _NM_OBJECT_CLASS_INIT_PRIV_PTR_INDIRECT(nm_object_class, type_name) \
|
|
Packit Service |
a1bd4f |
G_STMT_START \
|
|
Packit Service |
a1bd4f |
{ \
|
|
Packit Service |
a1bd4f |
(nm_object_class)->priv_ptr_offset = \
|
|
Packit Service |
a1bd4f |
NM_STRUCT_OFFSET_ENSURE_TYPE(type_name##Private *, type_name, _priv); \
|
|
Packit Service |
a1bd4f |
(nm_object_class)->priv_ptr_indirect = TRUE; \
|
|
Packit Service |
a1bd4f |
} \
|
|
Packit Service |
a1bd4f |
G_STMT_END
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
#define _NM_OBJECT_CLASS_INIT_FIELD_INFO(_nm_object_class, _field_name, _offset, _num) \
|
|
Packit Service |
a1bd4f |
G_STMT_START \
|
|
Packit Service |
a1bd4f |
{ \
|
|
Packit Service |
a1bd4f |
(_nm_object_class)->_field_name = ({ \
|
|
Packit Service |
a1bd4f |
static _NMObjectClassFieldInfo _f; \
|
|
Packit Service |
a1bd4f |
\
|
|
Packit Service |
a1bd4f |
_f = (_NMObjectClassFieldInfo){ \
|
|
Packit Service |
a1bd4f |
.parent = (_nm_object_class)->_field_name, \
|
|
Packit Service |
a1bd4f |
.klass = (_nm_object_class), \
|
|
Packit Service |
a1bd4f |
.offset = _offset, \
|
|
Packit Service |
a1bd4f |
.num = _num, \
|
|
Packit Service |
a1bd4f |
}; \
|
|
Packit Service |
a1bd4f |
&_;; \
|
|
Packit Service |
a1bd4f |
}); \
|
|
Packit Service |
a1bd4f |
} \
|
|
Packit Service |
a1bd4f |
G_STMT_END
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
#define _NM_OBJECT_CLASS_INIT_PROPERTY_O_FIELDS_1(nm_object_class, type_name, field_name) \
|
|
Packit Service |
a1bd4f |
_NM_OBJECT_CLASS_INIT_FIELD_INFO( \
|
|
Packit Service |
a1bd4f |
nm_object_class, \
|
|
Packit Service |
a1bd4f |
property_o_info, \
|
|
Packit Service |
a1bd4f |
NM_STRUCT_OFFSET_ENSURE_TYPE(NMLDBusPropertyO, type_name, field_name), \
|
|
Packit Service |
a1bd4f |
1)
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
#define _NM_OBJECT_CLASS_INIT_PROPERTY_O_FIELDS_N(nm_object_class, type_name, field_name) \
|
|
Packit Service |
a1bd4f |
_NM_OBJECT_CLASS_INIT_FIELD_INFO( \
|
|
Packit Service |
a1bd4f |
nm_object_class, \
|
|
Packit Service |
a1bd4f |
property_o_info, \
|
|
Packit Service |
a1bd4f |
NM_STRUCT_OFFSET_ENSURE_TYPE(NMLDBusPropertyO *, type_name, field_name), \
|
|
Packit Service |
a1bd4f |
G_N_ELEMENTS(((type_name *) NULL)->field_name))
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
#define _NM_OBJECT_CLASS_INIT_PROPERTY_AO_FIELDS_1(nm_object_class, type_name, field_name) \
|
|
Packit Service |
a1bd4f |
_NM_OBJECT_CLASS_INIT_FIELD_INFO( \
|
|
Packit Service |
a1bd4f |
nm_object_class, \
|
|
Packit Service |
a1bd4f |
property_ao_info, \
|
|
Packit Service |
a1bd4f |
NM_STRUCT_OFFSET_ENSURE_TYPE(NMLDBusPropertyAO, type_name, field_name), \
|
|
Packit Service |
a1bd4f |
1)
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
#define _NM_OBJECT_CLASS_INIT_PROPERTY_AO_FIELDS_N(nm_object_class, type_name, field_name) \
|
|
Packit Service |
a1bd4f |
_NM_OBJECT_CLASS_INIT_FIELD_INFO( \
|
|
Packit Service |
a1bd4f |
nm_object_class, \
|
|
Packit Service |
a1bd4f |
property_ao_info, \
|
|
Packit Service |
a1bd4f |
NM_STRUCT_OFFSET_ENSURE_TYPE(NMLDBusPropertyAO *, type_name, field_name), \
|
|
Packit Service |
a1bd4f |
G_N_ELEMENTS(((type_name *) NULL)->field_name))
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/*****************************************************************************/
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
struct _NMDevicePrivate;
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
struct _NMDevice {
|
|
Packit Service |
a1bd4f |
NMObject parent;
|
|
Packit Service |
a1bd4f |
struct _NMDevicePrivate *_priv;
|
|
Packit |
5756e2 |
};
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
struct _NMDeviceClass {
|
|
Packit Service |
a1bd4f |
struct _NMObjectClass parent;
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
gboolean (*connection_compatible)(NMDevice *device, NMConnection *connection, GError **error);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
const char *(*get_type_description)(NMDevice *device);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
GType (*get_setting_type)(NMDevice *device);
|
|
Packit Service |
a1bd4f |
};
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
/*****************************************************************************/
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
struct _NMDeviceEthernetPrivate;
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
struct _NMDeviceEthernet {
|
|
Packit Service |
a1bd4f |
NMDevice parent;
|
|
Packit Service |
a1bd4f |
struct _NMDeviceEthernetPrivate *_priv;
|
|
Packit Service |
a1bd4f |
};
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
struct _NMDeviceEthernetClass {
|
|
Packit Service |
a1bd4f |
NMDeviceClass parent;
|
|
Packit |
5756e2 |
};
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/*****************************************************************************/
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
struct _NMActiveConnectionPrivate;
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
struct _NMActiveConnection {
|
|
Packit Service |
a1bd4f |
NMObject parent;
|
|
Packit Service |
a1bd4f |
struct _NMActiveConnectionPrivate *_priv;
|
|
Packit |
5756e2 |
};
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
struct _NMActiveConnectionClass {
|
|
Packit Service |
a1bd4f |
struct _NMObjectClass parent;
|
|
Packit |
5756e2 |
};
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/*****************************************************************************/
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
struct _NMDhcpConfigPrivate;
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
struct _NMDhcpConfig {
|
|
Packit Service |
a1bd4f |
NMObject parent;
|
|
Packit Service |
a1bd4f |
struct _NMDhcpConfigPrivate *_priv;
|
|
Packit |
5756e2 |
};
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
struct _NMDhcpConfigClass {
|
|
Packit Service |
a1bd4f |
struct _NMObjectClass parent;
|
|
Packit |
5756e2 |
};
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/*****************************************************************************/
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
struct _NMIPConfigPrivate;
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
struct _NMIPConfig {
|
|
Packit Service |
a1bd4f |
NMObject parent;
|
|
Packit Service |
a1bd4f |
struct _NMIPConfigPrivate *_priv;
|
|
Packit |
5756e2 |
};
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
struct _NMIPConfigClass {
|
|
Packit Service |
a1bd4f |
struct _NMObjectClass parent;
|
|
Packit |
5756e2 |
};
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/*****************************************************************************/
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
NMLDBusObject *_nm_object_get_dbobj(gpointer self);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
const char *_nm_object_get_path(gpointer self);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
NMClient *_nm_object_get_client(gpointer self);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
GDBusConnection *_nm_client_get_dbus_connection(NMClient *client);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
const char *_nm_client_get_dbus_name_owner(NMClient *client);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
GMainContext *_nm_client_get_context_main(NMClient *client);
|
|
Packit Service |
a1bd4f |
GMainContext *_nm_client_get_context_dbus(NMClient *client);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
void _nm_client_queue_notify_object(NMClient *client, gpointer nmobj, const GParamSpec *pspec);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
void _nm_client_notify_object_changed(NMClient *self, NMLDBusObject *dbobj);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
struct udev *_nm_client_get_udev(NMClient *self);
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/*****************************************************************************/
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
#define NM_CLIENT_NOTIFY_EVENT_PRIO_BEFORE (-100)
|
|
Packit Service |
a1bd4f |
#define NM_CLIENT_NOTIFY_EVENT_PRIO_GPROP 0
|
|
Packit Service |
a1bd4f |
#define NM_CLIENT_NOTIFY_EVENT_PRIO_AFTER 100
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
typedef struct _NMClientNotifyEvent NMClientNotifyEvent;
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
typedef void (*NMClientNotifyEventCb)(NMClient *self, gpointer notify_event);
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
struct _NMClientNotifyEvent {
|
|
Packit Service |
a1bd4f |
CList lst;
|
|
Packit Service |
a1bd4f |
NMClientNotifyEventCb callback;
|
|
Packit Service |
a1bd4f |
int priority;
|
|
Packit |
5756e2 |
};
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
gpointer _nm_client_notify_event_queue(NMClient * self,
|
|
Packit Service |
a1bd4f |
int priority,
|
|
Packit Service |
a1bd4f |
NMClientNotifyEventCb callback,
|
|
Packit Service |
a1bd4f |
gsize event_size);
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
typedef struct _NMClientNotifyEventWithPtr NMClientNotifyEventWithPtr;
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
typedef void (*NMClientNotifyEventWithPtrCb)(NMClient * self,
|
|
Packit Service |
a1bd4f |
NMClientNotifyEventWithPtr *notify_event);
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
struct _NMClientNotifyEventWithPtr {
|
|
Packit Service |
a1bd4f |
NMClientNotifyEvent parent;
|
|
Packit Service |
a1bd4f |
gpointer user_data;
|
|
Packit |
5756e2 |
};
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
NMClientNotifyEventWithPtr *
|
|
Packit Service |
a1bd4f |
_nm_client_notify_event_queue_with_ptr(NMClient * self,
|
|
Packit Service |
a1bd4f |
int priority,
|
|
Packit Service |
a1bd4f |
NMClientNotifyEventWithPtrCb callback,
|
|
Packit Service |
a1bd4f |
gpointer user_data);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
void _nm_client_notify_event_queue_emit_obj_signal(NMClient *self,
|
|
Packit Service |
a1bd4f |
GObject * source,
|
|
Packit Service |
a1bd4f |
NMObject *nmobj,
|
|
Packit Service |
a1bd4f |
gboolean is_added /* or else removed */,
|
|
Packit Service |
a1bd4f |
int prio_offset,
|
|
Packit Service |
a1bd4f |
guint signal_id);
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/*****************************************************************************/
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
GError *_nm_client_new_error_nm_not_running(void);
|
|
Packit Service |
a1bd4f |
GError *_nm_client_new_error_nm_not_cached(void);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
void _nm_client_dbus_call_simple(NMClient * self,
|
|
Packit Service |
a1bd4f |
GCancellable * cancellable,
|
|
Packit Service |
a1bd4f |
const char * object_path,
|
|
Packit Service |
a1bd4f |
const char * interface_name,
|
|
Packit Service |
a1bd4f |
const char * method_name,
|
|
Packit Service |
a1bd4f |
GVariant * parameters,
|
|
Packit Service |
a1bd4f |
const GVariantType *reply_type,
|
|
Packit Service |
a1bd4f |
GDBusCallFlags flags,
|
|
Packit Service |
a1bd4f |
int timeout_msec,
|
|
Packit Service |
a1bd4f |
GAsyncReadyCallback callback,
|
|
Packit Service |
a1bd4f |
gpointer user_data);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
void _nm_client_dbus_call(NMClient * self,
|
|
Packit Service |
a1bd4f |
gpointer source_obj,
|
|
Packit Service |
a1bd4f |
gpointer source_tag,
|
|
Packit Service |
a1bd4f |
GCancellable * cancellable,
|
|
Packit Service |
a1bd4f |
GAsyncReadyCallback user_callback,
|
|
Packit Service |
a1bd4f |
gpointer user_callback_data,
|
|
Packit Service |
a1bd4f |
const char * object_path,
|
|
Packit Service |
a1bd4f |
const char * interface_name,
|
|
Packit Service |
a1bd4f |
const char * method_name,
|
|
Packit Service |
a1bd4f |
GVariant * parameters,
|
|
Packit Service |
a1bd4f |
const GVariantType *reply_type,
|
|
Packit Service |
a1bd4f |
GDBusCallFlags flags,
|
|
Packit Service |
a1bd4f |
int timeout_msec,
|
|
Packit Service |
a1bd4f |
GAsyncReadyCallback internal_callback);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
GVariant *_nm_client_dbus_call_sync(NMClient * self,
|
|
Packit Service |
a1bd4f |
GCancellable * cancellable,
|
|
Packit Service |
a1bd4f |
const char * object_path,
|
|
Packit Service |
a1bd4f |
const char * interface_name,
|
|
Packit Service |
a1bd4f |
const char * method_name,
|
|
Packit Service |
a1bd4f |
GVariant * parameters,
|
|
Packit Service |
a1bd4f |
const GVariantType *reply_type,
|
|
Packit Service |
a1bd4f |
GDBusCallFlags flags,
|
|
Packit Service |
a1bd4f |
int timeout_msec,
|
|
Packit Service |
a1bd4f |
gboolean strip_dbus_error,
|
|
Packit Service |
a1bd4f |
GError ** error);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
gboolean _nm_client_dbus_call_sync_void(NMClient * self,
|
|
Packit Service |
a1bd4f |
GCancellable * cancellable,
|
|
Packit Service |
a1bd4f |
const char * object_path,
|
|
Packit Service |
a1bd4f |
const char * interface_name,
|
|
Packit Service |
a1bd4f |
const char * method_name,
|
|
Packit Service |
a1bd4f |
GVariant * parameters,
|
|
Packit Service |
a1bd4f |
GDBusCallFlags flags,
|
|
Packit Service |
a1bd4f |
int timeout_msec,
|
|
Packit Service |
a1bd4f |
gboolean strip_dbus_error,
|
|
Packit Service |
a1bd4f |
GError ** error);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
void _nm_client_set_property_sync_legacy(NMClient * self,
|
|
Packit |
5756e2 |
const char *object_path,
|
|
Packit Service |
a1bd4f |
const char *interface,
|
|
Packit Service |
a1bd4f |
const char *prop_name,
|
|
Packit Service |
a1bd4f |
const char *format_string,
|
|
Packit Service |
a1bd4f |
...);
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/*****************************************************************************/
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
void _nm_client_get_settings_call(NMClient *self, NMLDBusObject *dbobj);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
GCancellable *_nm_remote_settings_get_settings_prepare(NMRemoteConnection *self);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
void _nm_remote_settings_get_settings_commit(NMRemoteConnection *self, GVariant *settings);
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/*****************************************************************************/
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
void
|
|
Packit Service |
a1bd4f |
_nm_active_connection_state_changed_commit(NMActiveConnection *self, guint32 state, guint32 reason);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
void _nm_vpn_connection_state_changed_commit(NMVpnConnection *self, guint32 state, guint32 reason);
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/*****************************************************************************/
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
NMLDBusNotifyUpdatePropFlags
|
|
Packit Service |
a1bd4f |
_nm_device_notify_update_prop_hw_address(NMClient * client,
|
|
Packit Service |
a1bd4f |
NMLDBusObject * dbobj,
|
|
Packit Service |
a1bd4f |
const NMLDBusMetaIface *meta_iface,
|
|
Packit Service |
a1bd4f |
guint dbus_property_idx,
|
|
Packit Service |
a1bd4f |
GVariant * value);
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/*****************************************************************************/
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
#endif /* __NM_LIBNM_UTILS_H__ */
|