mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-31 13:40:11 +01:00
core/dbus: merge branch 'th/dbus'
https://github.com/NetworkManager/NetworkManager/pull/74
This commit is contained in:
commit
1e535789cf
97 changed files with 5600 additions and 4111 deletions
22
Makefile.am
22
Makefile.am
|
|
@ -366,8 +366,6 @@ CLEANFILES += $(DBUS_INTERFACE_DOCS)
|
|||
$(dispatcher_libnm_dispatcher_core_la_OBJECTS): $(introspection_sources)
|
||||
$(dispatcher_nm_dispatcher_OBJECTS): $(introspection_sources)
|
||||
$(libnm_libnm_la_OBJECTS): $(introspection_sources)
|
||||
$(src_libNetworkManager_la_OBJECTS): $(introspection_sources)
|
||||
$(src_libNetworkManagerBase_la_OBJECTS): $(introspection_sources)
|
||||
|
||||
EXTRA_DIST += \
|
||||
$(dbusinterfaces_DATA) \
|
||||
|
|
@ -1423,8 +1421,10 @@ src_libNetworkManagerBase_la_SOURCES = \
|
|||
src/ndisc/nm-ndisc.h \
|
||||
src/ndisc/nm-ndisc-private.h \
|
||||
\
|
||||
src/nm-exported-object.c \
|
||||
src/nm-exported-object.h \
|
||||
src/nm-dbus-utils.c \
|
||||
src/nm-dbus-utils.h \
|
||||
src/nm-dbus-object.c \
|
||||
src/nm-dbus-object.h \
|
||||
src/nm-ip4-config.c \
|
||||
src/nm-ip4-config.h \
|
||||
src/nm-ip6-config.c \
|
||||
|
|
@ -1452,7 +1452,6 @@ endif
|
|||
|
||||
src_libNetworkManagerBase_la_LIBADD = \
|
||||
libnm-core/libnm-core.la \
|
||||
introspection/libnmdbus.la \
|
||||
$(GLIB_LIBS) \
|
||||
$(SYSTEMD_JOURNAL_LIBS) \
|
||||
$(LIBUDEV_LIBS) \
|
||||
|
|
@ -1589,8 +1588,8 @@ src_libNetworkManager_la_SOURCES = \
|
|||
src/nm-active-connection.h \
|
||||
src/nm-audit-manager.c \
|
||||
src/nm-audit-manager.h \
|
||||
src/nm-bus-manager.c \
|
||||
src/nm-bus-manager.h \
|
||||
src/nm-dbus-manager.c \
|
||||
src/nm-dbus-manager.h \
|
||||
src/nm-config.c \
|
||||
src/nm-config.h \
|
||||
src/nm-config-data.c \
|
||||
|
|
@ -1860,7 +1859,6 @@ src_ppp_libnm_ppp_plugin_la_LDFLAGS = \
|
|||
-Wl,--version-script="$(srcdir)/src/ppp/nm-ppp-plugin.ver"
|
||||
|
||||
src_ppp_libnm_ppp_plugin_la_LIBADD = \
|
||||
introspection/libnmdbus.la \
|
||||
$(GLIB_LIBS)
|
||||
|
||||
$(src_ppp_libnm_ppp_plugin_la_OBJECTS): $(libnm_core_lib_h_pub_mkenums)
|
||||
|
|
@ -2515,7 +2513,6 @@ src_devices_adsl_libnm_device_plugin_adsl_la_LDFLAGS = \
|
|||
-Wl,--version-script="$(srcdir)/linker-script-devices.ver"
|
||||
|
||||
src_devices_adsl_libnm_device_plugin_adsl_la_LIBADD = \
|
||||
introspection/libnmdbus.la \
|
||||
$(LIBUDEV_LIBS)
|
||||
|
||||
check-local-devices-adsl: src/devices/adsl/libnm-device-plugin-adsl.la
|
||||
|
|
@ -2591,7 +2588,6 @@ src_devices_wwan_libnm_device_plugin_wwan_la_LDFLAGS = \
|
|||
-Wl,--version-script="$(srcdir)/linker-script-devices.ver"
|
||||
|
||||
src_devices_wwan_libnm_device_plugin_wwan_la_LIBADD = \
|
||||
introspection/libnmdbus.la \
|
||||
src/devices/wwan/libnm-wwan.la \
|
||||
$(GLIB_LIBS)
|
||||
|
||||
|
|
@ -2649,7 +2645,6 @@ src_devices_bluetooth_libnm_device_plugin_bluetooth_la_LDFLAGS = \
|
|||
-Wl,--version-script="$(srcdir)/linker-script-devices.ver"
|
||||
|
||||
src_devices_bluetooth_libnm_device_plugin_bluetooth_la_LIBADD = \
|
||||
introspection/libnmdbus.la \
|
||||
src/devices/wwan/libnm-wwan.la \
|
||||
$(GLIB_LIBS)
|
||||
|
||||
|
|
@ -2690,6 +2685,8 @@ src_devices_wifi_libnm_device_plugin_wifi_la_SOURCES = \
|
|||
src/devices/wifi/nm-wifi-ap.h \
|
||||
src/devices/wifi/nm-wifi-utils.c \
|
||||
src/devices/wifi/nm-wifi-utils.h \
|
||||
src/devices/wifi/nm-wifi-common.c \
|
||||
src/devices/wifi/nm-wifi-common.h \
|
||||
src/devices/wifi/nm-device-olpc-mesh.c \
|
||||
src/devices/wifi/nm-device-olpc-mesh.h
|
||||
|
||||
|
|
@ -2716,7 +2713,6 @@ src_devices_wifi_libnm_device_plugin_wifi_la_LDFLAGS = \
|
|||
-Wl,--version-script="$(srcdir)/linker-script-devices.ver"
|
||||
|
||||
src_devices_wifi_libnm_device_plugin_wifi_la_LIBADD = \
|
||||
introspection/libnmdbus.la \
|
||||
$(GLIB_LIBS)
|
||||
|
||||
check-local-devices-wifi: src/devices/wifi/libnm-device-plugin-wifi.la
|
||||
|
|
@ -2786,7 +2782,6 @@ src_devices_team_libnm_device_plugin_team_la_LDFLAGS = \
|
|||
-Wl,--version-script="$(srcdir)/linker-script-devices.ver"
|
||||
|
||||
src_devices_team_libnm_device_plugin_team_la_LIBADD = \
|
||||
introspection/libnmdbus.la \
|
||||
$(LIBTEAMDCTL_LIBS) \
|
||||
$(JANSSON_LIBS) \
|
||||
$(GLIB_LIBS)
|
||||
|
|
@ -2848,7 +2843,6 @@ src_devices_ovs_libnm_device_plugin_ovs_la_LDFLAGS = \
|
|||
-Wl,--version-script="$(srcdir)/linker-script-devices.ver"
|
||||
|
||||
src_devices_ovs_libnm_device_plugin_ovs_la_LIBADD = \
|
||||
introspection/libnmdbus.la \
|
||||
$(JANSSON_LIBS) \
|
||||
$(GLIB_LIBS)
|
||||
|
||||
|
|
|
|||
|
|
@ -176,11 +176,13 @@ _nm_dbus_signal_connect_data (GDBusProxy *proxy,
|
|||
|
||||
|
||||
static void
|
||||
typecheck_response (GVariant **response,
|
||||
const GVariantType *reply_type,
|
||||
GError **error)
|
||||
typecheck_response (GVariant **response,
|
||||
const GVariantType *reply_type,
|
||||
GError **error)
|
||||
{
|
||||
if (*response && reply_type && !g_variant_is_of_type (*response, reply_type)) {
|
||||
if ( *response
|
||||
&& reply_type
|
||||
&& !g_variant_is_of_type (*response, reply_type)) {
|
||||
/* This is the same error code that g_dbus_connection_call() returns if
|
||||
* @reply_type doesn't match.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -174,6 +174,35 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#if NM_MORE_ASSERTS == 0
|
||||
#ifndef G_DISABLE_CAST_CHECKS
|
||||
/* Unless compiling with G_DISABLE_CAST_CHECKS, glib performs type checking
|
||||
* during G_VARIANT_TYPE() via g_variant_type_checked_(). This is not necesary
|
||||
* because commonly this cast is needed during something like
|
||||
*
|
||||
* g_variant_builder_init (&props, G_VARIANT_TYPE ("a{sv}"));
|
||||
*
|
||||
* Note that in if the variant type would be invalid, the check still
|
||||
* wouldn't make the buggy code magically work. Instead of passing a
|
||||
* bogus type string (bad), it would pass %NULL to g_variant_builder_init()
|
||||
* (also bad).
|
||||
*
|
||||
* Also, a function like g_variant_builder_init() already validates
|
||||
* the input type via something like
|
||||
*
|
||||
* g_return_if_fail (g_variant_type_is_container (type));
|
||||
*
|
||||
* So, by having G_VARIANT_TYPE() also validate the type, we validate
|
||||
* twice, whereas the first validation is rather pointless because it
|
||||
* doesn't prevent the function to be called with invalid arguments.
|
||||
*
|
||||
* Just patch G_VARIANT_TYPE() to perform no check.
|
||||
*/
|
||||
#undef G_VARIANT_TYPE
|
||||
#define G_VARIANT_TYPE(type_string) ((const GVariantType *) (type_string))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
|
|
@ -421,6 +421,23 @@ char *nm_utils_str_utf8safe_unescape_cp (const char *str);
|
|||
|
||||
char *nm_utils_str_utf8safe_escape_take (char *str, NMUtilsStrUtf8SafeFlags flags);
|
||||
|
||||
static inline void
|
||||
nm_g_variant_unref_floating (GVariant *var)
|
||||
{
|
||||
/* often a function wants to keep a reference to an input variant.
|
||||
* It uses g_variant_ref_sink() to either increase the ref-count,
|
||||
* or take ownership of a possibly floating reference.
|
||||
*
|
||||
* If the function doesn't actually want to do anything with the
|
||||
* input variant, it still must make sure that a passed in floating
|
||||
* reference is consumed. Hence, this helper which:
|
||||
*
|
||||
* - does nothing if @var is not floating
|
||||
* - unrefs (consumes) @var if it is floating. */
|
||||
if (g_variant_is_floating (var))
|
||||
g_variant_unref (var);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
|
|
@ -469,36 +486,89 @@ int nm_utils_fd_read_loop_exact (int fd, void *buf, size_t nbytes, bool do_poll)
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
#define NM_DEFINE_GDBUS_ARG_INFO(a_name, ...) \
|
||||
#define NM_DEFINE_GDBUS_ARG_INFO_FULL(name_, ...) \
|
||||
((GDBusArgInfo *) (&((const GDBusArgInfo) { \
|
||||
.ref_count = -1, \
|
||||
.name = a_name, \
|
||||
.name = name_, \
|
||||
__VA_ARGS__ \
|
||||
})))
|
||||
|
||||
#define NM_DEFINE_GDBUS_ARG_INFO(name_, a_signature) \
|
||||
NM_DEFINE_GDBUS_ARG_INFO_FULL ( \
|
||||
name_, \
|
||||
.signature = a_signature, \
|
||||
)
|
||||
|
||||
#define NM_DEFINE_GDBUS_ARG_INFOS(...) \
|
||||
((GDBusArgInfo **) ((const GDBusArgInfo *[]) { \
|
||||
__VA_ARGS__ \
|
||||
NULL, \
|
||||
}))
|
||||
|
||||
#define NM_DEFINE_GDBUS_METHOD_INFO(m_name, ...) \
|
||||
((GDBusMethodInfo *) (&((const GDBusMethodInfo) { \
|
||||
#define NM_DEFINE_GDBUS_PROPERTY_INFO(name_, ...) \
|
||||
((GDBusPropertyInfo *) (&((const GDBusPropertyInfo) { \
|
||||
.ref_count = -1, \
|
||||
.name = m_name, \
|
||||
.name = name_, \
|
||||
__VA_ARGS__ \
|
||||
})))
|
||||
|
||||
#define NM_DEFINE_GDBUS_PROPERTY_INFO_READABLE(name_, m_signature) \
|
||||
NM_DEFINE_GDBUS_PROPERTY_INFO ( \
|
||||
name_, \
|
||||
.signature = m_signature, \
|
||||
.flags = G_DBUS_PROPERTY_INFO_FLAGS_READABLE, \
|
||||
)
|
||||
|
||||
#define NM_DEFINE_GDBUS_PROPERTY_INFOS(...) \
|
||||
((GDBusPropertyInfo **) ((const GDBusPropertyInfo *[]) { \
|
||||
__VA_ARGS__ \
|
||||
NULL, \
|
||||
}))
|
||||
|
||||
#define NM_DEFINE_GDBUS_SIGNAL_INFO_INIT(name_, ...) \
|
||||
{ \
|
||||
.ref_count = -1, \
|
||||
.name = name_, \
|
||||
__VA_ARGS__ \
|
||||
}
|
||||
|
||||
#define NM_DEFINE_GDBUS_SIGNAL_INFO(name_, ...) \
|
||||
((GDBusSignalInfo *) (&((const GDBusSignalInfo) NM_DEFINE_GDBUS_SIGNAL_INFO_INIT (name_, __VA_ARGS__))))
|
||||
|
||||
#define NM_DEFINE_GDBUS_SIGNAL_INFOS(...) \
|
||||
((GDBusSignalInfo **) ((const GDBusSignalInfo *[]) { \
|
||||
__VA_ARGS__ \
|
||||
NULL, \
|
||||
}))
|
||||
|
||||
#define NM_DEFINE_GDBUS_METHOD_INFO_INIT(name_, ...) \
|
||||
{ \
|
||||
.ref_count = -1, \
|
||||
.name = name_, \
|
||||
__VA_ARGS__ \
|
||||
}
|
||||
|
||||
#define NM_DEFINE_GDBUS_METHOD_INFO(name_, ...) \
|
||||
((GDBusMethodInfo *) (&((const GDBusMethodInfo) NM_DEFINE_GDBUS_METHOD_INFO_INIT (name_, __VA_ARGS__))))
|
||||
|
||||
#define NM_DEFINE_GDBUS_METHOD_INFOS(...) \
|
||||
((GDBusMethodInfo **) ((const GDBusMethodInfo *[]) { \
|
||||
__VA_ARGS__ \
|
||||
NULL, \
|
||||
}))
|
||||
|
||||
#define NM_DEFINE_GDBUS_INTERFACE_INFO(variable, i_name, ...) \
|
||||
static GDBusInterfaceInfo *const variable = ((GDBusInterfaceInfo *) (&((const GDBusInterfaceInfo) { \
|
||||
#define NM_DEFINE_GDBUS_INTERFACE_INFO_INIT(name_, ...) \
|
||||
{ \
|
||||
.ref_count = -1, \
|
||||
.name = i_name, \
|
||||
.name = name_, \
|
||||
__VA_ARGS__ \
|
||||
}
|
||||
|
||||
#define NM_DEFINE_GDBUS_INTERFACE_INFO(name_, ...) \
|
||||
((GDBusInterfaceInfo *) (&((const GDBusInterfaceInfo) NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (name_, __VA_ARGS__))))
|
||||
|
||||
#define NM_DEFINE_GDBUS_INTERFACE_VTABLE(...) \
|
||||
((GDBusInterfaceVTable *) (&((const GDBusInterfaceVTable) { \
|
||||
__VA_ARGS__ \
|
||||
})))
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@
|
|||
#include "nm-core-internal.h"
|
||||
|
||||
#include "platform/nm-platform.h"
|
||||
#include "nm-exported-object.h"
|
||||
#include "nm-auth-utils.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
@ -880,62 +879,6 @@ nm_utils_match_connection (NMConnection *const*connections,
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* nm_utils_g_value_set_object_path:
|
||||
* @value: a #GValue, initialized to store an object path
|
||||
* @object: (allow-none): an #NMExportedObject
|
||||
*
|
||||
* Sets @value to @object's object path. If @object is %NULL, or not
|
||||
* exported, @value is set to "/".
|
||||
*/
|
||||
void
|
||||
nm_utils_g_value_set_object_path (GValue *value, gpointer object)
|
||||
{
|
||||
g_return_if_fail (!object || NM_IS_EXPORTED_OBJECT (object));
|
||||
|
||||
if (object && nm_exported_object_is_exported (object))
|
||||
g_value_set_string (value, nm_exported_object_get_path (object));
|
||||
else
|
||||
g_value_set_string (value, "/");
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_utils_g_value_set_object_path_array:
|
||||
* @value: a #GValue, initialized to store an object path
|
||||
* @objects: a #GSList of #NMExportedObjects
|
||||
* @filter_func: (allow-none): function to call on each object in @objects
|
||||
* @user_data: data to pass to @filter_func
|
||||
*
|
||||
* Sets @value to an array of object paths of the objects in @objects.
|
||||
*/
|
||||
void
|
||||
nm_utils_g_value_set_object_path_array (GValue *value,
|
||||
GSList *objects,
|
||||
NMUtilsObjectFunc filter_func,
|
||||
gpointer user_data)
|
||||
{
|
||||
char **paths;
|
||||
guint i;
|
||||
GSList *iter;
|
||||
|
||||
paths = g_new (char *, g_slist_length (objects) + 1);
|
||||
for (i = 0, iter = objects; iter; iter = iter->next) {
|
||||
NMExportedObject *object = iter->data;
|
||||
const char *path;
|
||||
|
||||
path = nm_exported_object_get_path (object);
|
||||
if (!path)
|
||||
continue;
|
||||
if (filter_func && !filter_func ((GObject *) object, user_data))
|
||||
continue;
|
||||
paths[i++] = g_strdup (path);
|
||||
}
|
||||
paths[i] = NULL;
|
||||
g_value_take_boxed (value, paths);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
int
|
||||
nm_match_spec_device_by_pllink (const NMPlatformLink *pllink,
|
||||
const char *match_device_type,
|
||||
|
|
|
|||
|
|
@ -48,22 +48,6 @@ NMConnection *nm_utils_match_connection (NMConnection *const*connections,
|
|||
NMUtilsMatchFilterFunc match_filter_func,
|
||||
gpointer match_filter_data);
|
||||
|
||||
void nm_utils_g_value_set_object_path (GValue *value, gpointer object);
|
||||
|
||||
/**
|
||||
* NMUtilsObjectFunc:
|
||||
* @object: the object to filter on
|
||||
* @user_data: data passed to the function from the caller
|
||||
*
|
||||
* Returns: %TRUE if the object should be used, %FALSE if not
|
||||
*/
|
||||
typedef gboolean (*NMUtilsObjectFunc) (GObject *object, gpointer user_data);
|
||||
|
||||
void nm_utils_g_value_set_object_path_array (GValue *value,
|
||||
GSList *objects,
|
||||
NMUtilsObjectFunc filter_func,
|
||||
gpointer user_data);
|
||||
|
||||
int nm_match_spec_device_by_pllink (const NMPlatformLink *pllink,
|
||||
const char *match_device_type,
|
||||
const GSList *specs,
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ sources = files(
|
|||
)
|
||||
|
||||
deps = [
|
||||
libnmdbus_dep,
|
||||
libudev_dep,
|
||||
nm_dep
|
||||
]
|
||||
|
|
|
|||
|
|
@ -39,8 +39,6 @@
|
|||
#include "nm-setting-adsl.h"
|
||||
#include "nm-utils.h"
|
||||
|
||||
#include "introspection/org.freedesktop.NetworkManager.Device.Adsl.h"
|
||||
|
||||
#include "devices/nm-device-logging.h"
|
||||
_LOG_DECLARE_SELF (NMDeviceAdsl);
|
||||
|
||||
|
|
@ -655,10 +653,24 @@ dispose (GObject *object)
|
|||
G_OBJECT_CLASS (nm_device_adsl_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static const NMDBusInterfaceInfoExtended interface_info_device_adsl = {
|
||||
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
|
||||
NM_DBUS_INTERFACE_DEVICE_ADSL,
|
||||
.signals = NM_DEFINE_GDBUS_SIGNAL_INFOS (
|
||||
&nm_signal_info_property_changed_legacy,
|
||||
),
|
||||
.properties = NM_DEFINE_GDBUS_PROPERTY_INFOS (
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Carrier", "b", NM_DEVICE_CARRIER),
|
||||
),
|
||||
),
|
||||
.legacy_property_changed = TRUE,
|
||||
};
|
||||
|
||||
static void
|
||||
nm_device_adsl_class_init (NMDeviceAdslClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass);
|
||||
NMDeviceClass *parent_class = NM_DEVICE_CLASS (klass);
|
||||
|
||||
object_class->constructed = constructed;
|
||||
|
|
@ -666,6 +678,8 @@ nm_device_adsl_class_init (NMDeviceAdslClass *klass)
|
|||
object_class->get_property = get_property;
|
||||
object_class->set_property = set_property;
|
||||
|
||||
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_adsl);
|
||||
|
||||
parent_class->get_generic_capabilities = get_generic_capabilities;
|
||||
|
||||
parent_class->check_connection_compatible = check_connection_compatible;
|
||||
|
|
@ -682,8 +696,4 @@ nm_device_adsl_class_init (NMDeviceAdslClass *klass)
|
|||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
||||
|
||||
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass),
|
||||
NMDBUS_TYPE_DEVICE_ADSL_SKELETON,
|
||||
NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ sources = files(
|
|||
)
|
||||
|
||||
deps = [
|
||||
libnmdbus_dep,
|
||||
libnm_wwan_dep,
|
||||
nm_dep
|
||||
]
|
||||
|
|
|
|||
|
|
@ -43,8 +43,6 @@
|
|||
#include "devices/wwan/nm-modem-manager.h"
|
||||
#include "devices/wwan/nm-modem.h"
|
||||
|
||||
#include "introspection/org.freedesktop.NetworkManager.Device.Bluetooth.h"
|
||||
|
||||
#include "devices/nm-device-logging.h"
|
||||
_LOG_DECLARE_SELF(NMDeviceBt);
|
||||
|
||||
|
|
@ -1152,10 +1150,26 @@ finalize (GObject *object)
|
|||
G_OBJECT_CLASS (nm_device_bt_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static const NMDBusInterfaceInfoExtended interface_info_device_bluetooth = {
|
||||
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
|
||||
NM_DBUS_INTERFACE_DEVICE_BLUETOOTH,
|
||||
.signals = NM_DEFINE_GDBUS_SIGNAL_INFOS (
|
||||
&nm_signal_info_property_changed_legacy,
|
||||
),
|
||||
.properties = NM_DEFINE_GDBUS_PROPERTY_INFOS (
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("HwAddress", "s", NM_DEVICE_HW_ADDRESS),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Name", "s", NM_DEVICE_BT_NAME),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("BtCapabilities", "u", NM_DEVICE_BT_CAPABILITIES),
|
||||
),
|
||||
),
|
||||
.legacy_property_changed = TRUE,
|
||||
};
|
||||
|
||||
static void
|
||||
nm_device_bt_class_init (NMDeviceBtClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass);
|
||||
NMDeviceClass *device_class = NM_DEVICE_CLASS (klass);
|
||||
|
||||
object_class->constructed = constructed;
|
||||
|
|
@ -1164,6 +1178,8 @@ nm_device_bt_class_init (NMDeviceBtClass *klass)
|
|||
object_class->dispose = dispose;
|
||||
object_class->finalize = finalize;
|
||||
|
||||
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_bluetooth);
|
||||
|
||||
device_class->get_generic_capabilities = get_generic_capabilities;
|
||||
device_class->can_auto_connect = can_auto_connect;
|
||||
device_class->deactivate = deactivate;
|
||||
|
|
@ -1207,8 +1223,4 @@ nm_device_bt_class_init (NMDeviceBtClass *klass)
|
|||
G_TYPE_NONE, 2,
|
||||
G_TYPE_UINT /*guint32 in_bytes*/,
|
||||
G_TYPE_UINT /*guint32 out_bytes*/);
|
||||
|
||||
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass),
|
||||
NMDBUS_TYPE_DEVICE_BLUETOOTH_SKELETON,
|
||||
NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,8 +32,6 @@
|
|||
#include "nm-core-internal.h"
|
||||
#include "nm-ip4-config.h"
|
||||
|
||||
#include "introspection/org.freedesktop.NetworkManager.Device.Bond.h"
|
||||
|
||||
#include "nm-device-logging.h"
|
||||
_LOG_DECLARE_SELF(NMDeviceBond);
|
||||
|
||||
|
|
@ -607,13 +605,31 @@ nm_device_bond_init (NMDeviceBond * self)
|
|||
nm_assert (nm_device_is_master (NM_DEVICE (self)));
|
||||
}
|
||||
|
||||
static const NMDBusInterfaceInfoExtended interface_info_device_bond = {
|
||||
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
|
||||
NM_DBUS_INTERFACE_DEVICE_BOND,
|
||||
.signals = NM_DEFINE_GDBUS_SIGNAL_INFOS (
|
||||
&nm_signal_info_property_changed_legacy,
|
||||
),
|
||||
.properties = NM_DEFINE_GDBUS_PROPERTY_INFOS (
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("HwAddress", "s", NM_DEVICE_HW_ADDRESS),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Carrier", "b", NM_DEVICE_CARRIER),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Slaves", "ao", NM_DEVICE_SLAVES),
|
||||
),
|
||||
),
|
||||
.legacy_property_changed = TRUE,
|
||||
};
|
||||
|
||||
static void
|
||||
nm_device_bond_class_init (NMDeviceBondClass *klass)
|
||||
{
|
||||
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass);
|
||||
NMDeviceClass *parent_class = NM_DEVICE_CLASS (klass);
|
||||
|
||||
NM_DEVICE_CLASS_DECLARE_TYPES (klass, NM_SETTING_BOND_SETTING_NAME, NM_LINK_TYPE_BOND)
|
||||
|
||||
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_bond);
|
||||
|
||||
parent_class->is_master = TRUE;
|
||||
parent_class->get_generic_capabilities = get_generic_capabilities;
|
||||
parent_class->check_connection_compatible = check_connection_compatible;
|
||||
|
|
@ -629,10 +645,6 @@ nm_device_bond_class_init (NMDeviceBondClass *klass)
|
|||
parent_class->release_slave = release_slave;
|
||||
parent_class->can_reapply_change = can_reapply_change;
|
||||
parent_class->reapply_connection = reapply_connection;
|
||||
|
||||
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass),
|
||||
NMDBUS_TYPE_DEVICE_BOND_SKELETON,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
|
|
@ -30,8 +30,6 @@
|
|||
#include "nm-device-factory.h"
|
||||
#include "nm-core-internal.h"
|
||||
|
||||
#include "introspection/org.freedesktop.NetworkManager.Device.Bridge.h"
|
||||
|
||||
#include "nm-device-logging.h"
|
||||
_LOG_DECLARE_SELF(NMDeviceBridge);
|
||||
|
||||
|
|
@ -488,13 +486,31 @@ nm_device_bridge_init (NMDeviceBridge * self)
|
|||
nm_assert (nm_device_is_master (NM_DEVICE (self)));
|
||||
}
|
||||
|
||||
static const NMDBusInterfaceInfoExtended interface_info_device_bridge = {
|
||||
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
|
||||
NM_DBUS_INTERFACE_DEVICE_BRIDGE,
|
||||
.signals = NM_DEFINE_GDBUS_SIGNAL_INFOS (
|
||||
&nm_signal_info_property_changed_legacy,
|
||||
),
|
||||
.properties = NM_DEFINE_GDBUS_PROPERTY_INFOS (
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("HwAddress", "s", NM_DEVICE_HW_ADDRESS),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Carrier", "b", NM_DEVICE_CARRIER),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Slaves", "ao", NM_DEVICE_SLAVES),
|
||||
),
|
||||
),
|
||||
.legacy_property_changed = TRUE,
|
||||
};
|
||||
|
||||
static void
|
||||
nm_device_bridge_class_init (NMDeviceBridgeClass *klass)
|
||||
{
|
||||
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass);
|
||||
NMDeviceClass *parent_class = NM_DEVICE_CLASS (klass);
|
||||
|
||||
NM_DEVICE_CLASS_DECLARE_TYPES (klass, NM_SETTING_BRIDGE_SETTING_NAME, NM_LINK_TYPE_BRIDGE)
|
||||
|
||||
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_bridge);
|
||||
|
||||
parent_class->is_master = TRUE;
|
||||
parent_class->get_generic_capabilities = get_generic_capabilities;
|
||||
parent_class->check_connection_compatible = check_connection_compatible;
|
||||
|
|
@ -511,10 +527,6 @@ nm_device_bridge_class_init (NMDeviceBridgeClass *klass)
|
|||
parent_class->enslave_slave = enslave_slave;
|
||||
parent_class->release_slave = release_slave;
|
||||
parent_class->get_configured_mtu = nm_device_get_configured_mtu_for_wired;
|
||||
|
||||
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass),
|
||||
NMDBUS_TYPE_DEVICE_BRIDGE_SKELETON,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
|
|
@ -28,8 +28,6 @@
|
|||
#include "nm-setting-dummy.h"
|
||||
#include "nm-core-internal.h"
|
||||
|
||||
#include "introspection/org.freedesktop.NetworkManager.Device.Dummy.h"
|
||||
|
||||
#include "nm-device-logging.h"
|
||||
_LOG_DECLARE_SELF(NMDeviceDummy);
|
||||
|
||||
|
|
@ -156,13 +154,29 @@ nm_device_dummy_init (NMDeviceDummy *self)
|
|||
{
|
||||
}
|
||||
|
||||
static const NMDBusInterfaceInfoExtended interface_info_device_dummy = {
|
||||
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
|
||||
NM_DBUS_INTERFACE_DEVICE_DUMMY,
|
||||
.signals = NM_DEFINE_GDBUS_SIGNAL_INFOS (
|
||||
&nm_signal_info_property_changed_legacy,
|
||||
),
|
||||
.properties = NM_DEFINE_GDBUS_PROPERTY_INFOS (
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("HwAddress", "s", NM_DEVICE_HW_ADDRESS),
|
||||
),
|
||||
),
|
||||
.legacy_property_changed = TRUE,
|
||||
};
|
||||
|
||||
static void
|
||||
nm_device_dummy_class_init (NMDeviceDummyClass *klass)
|
||||
{
|
||||
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass);
|
||||
NMDeviceClass *device_class = NM_DEVICE_CLASS (klass);
|
||||
|
||||
NM_DEVICE_CLASS_DECLARE_TYPES (klass, NULL, NM_LINK_TYPE_DUMMY)
|
||||
|
||||
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_dummy);
|
||||
|
||||
device_class->connection_type = NM_SETTING_DUMMY_SETTING_NAME;
|
||||
device_class->complete_connection = complete_connection;
|
||||
device_class->check_connection_compatible = check_connection_compatible;
|
||||
|
|
@ -171,10 +185,6 @@ nm_device_dummy_class_init (NMDeviceDummyClass *klass)
|
|||
device_class->update_connection = update_connection;
|
||||
device_class->act_stage1_prepare = act_stage1_prepare;
|
||||
device_class->get_configured_mtu = nm_device_get_configured_mtu_for_wired;
|
||||
|
||||
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass),
|
||||
NMDBUS_TYPE_DEVICE_DUMMY_SKELETON,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@
|
|||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <libudev.h>
|
||||
|
||||
#include "nm-device-private.h"
|
||||
|
|
@ -52,8 +51,6 @@
|
|||
#include "nm-core-internal.h"
|
||||
#include "NetworkManagerUtils.h"
|
||||
|
||||
#include "introspection/org.freedesktop.NetworkManager.Device.Wired.h"
|
||||
|
||||
#include "nm-device-logging.h"
|
||||
_LOG_DECLARE_SELF(NMDeviceEthernet);
|
||||
|
||||
|
|
@ -1714,10 +1711,28 @@ set_property (GObject *object, guint prop_id,
|
|||
}
|
||||
}
|
||||
|
||||
static const NMDBusInterfaceInfoExtended interface_info_device_wired = {
|
||||
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
|
||||
NM_DBUS_INTERFACE_DEVICE_WIRED,
|
||||
.signals = NM_DEFINE_GDBUS_SIGNAL_INFOS (
|
||||
&nm_signal_info_property_changed_legacy,
|
||||
),
|
||||
.properties = NM_DEFINE_GDBUS_PROPERTY_INFOS (
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("HwAddress", "s", NM_DEVICE_HW_ADDRESS),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("PermHwAddress", "s", NM_DEVICE_PERM_HW_ADDRESS),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Speed", "u", NM_DEVICE_ETHERNET_SPEED),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("S390Subchannels", "as", NM_DEVICE_ETHERNET_S390_SUBCHANNELS),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Carrier", "b", NM_DEVICE_CARRIER),
|
||||
),
|
||||
),
|
||||
.legacy_property_changed = TRUE,
|
||||
};
|
||||
|
||||
static void
|
||||
nm_device_ethernet_class_init (NMDeviceEthernetClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass);
|
||||
NMDeviceClass *parent_class = NM_DEVICE_CLASS (klass);
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (NMDeviceEthernetPrivate));
|
||||
|
|
@ -1729,6 +1744,8 @@ nm_device_ethernet_class_init (NMDeviceEthernetClass *klass)
|
|||
object_class->get_property = get_property;
|
||||
object_class->set_property = set_property;
|
||||
|
||||
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_wired);
|
||||
|
||||
parent_class->get_generic_capabilities = get_generic_capabilities;
|
||||
parent_class->check_connection_compatible = check_connection_compatible;
|
||||
parent_class->complete_connection = complete_connection;
|
||||
|
|
@ -1762,10 +1779,6 @@ nm_device_ethernet_class_init (NMDeviceEthernetClass *klass)
|
|||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
||||
|
||||
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass),
|
||||
NMDBUS_TYPE_DEVICE_ETHERNET_SKELETON,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
|
|
@ -26,8 +26,6 @@
|
|||
#include "platform/nm-platform.h"
|
||||
#include "nm-core-internal.h"
|
||||
|
||||
#include "introspection/org.freedesktop.NetworkManager.Device.Generic.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
NM_GOBJECT_PROPERTIES_DEFINE_BASE (
|
||||
|
|
@ -203,10 +201,25 @@ dispose (GObject *object)
|
|||
G_OBJECT_CLASS (nm_device_generic_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static const NMDBusInterfaceInfoExtended interface_info_device_generic = {
|
||||
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
|
||||
NM_DBUS_INTERFACE_DEVICE_GENERIC,
|
||||
.signals = NM_DEFINE_GDBUS_SIGNAL_INFOS (
|
||||
&nm_signal_info_property_changed_legacy,
|
||||
),
|
||||
.properties = NM_DEFINE_GDBUS_PROPERTY_INFOS (
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("HwAddress", "s", NM_DEVICE_HW_ADDRESS),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("TypeDescription", "s", NM_DEVICE_GENERIC_TYPE_DESCRIPTION),
|
||||
),
|
||||
),
|
||||
.legacy_property_changed = TRUE,
|
||||
};
|
||||
|
||||
static void
|
||||
nm_device_generic_class_init (NMDeviceGenericClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass);
|
||||
NMDeviceClass *parent_class = NM_DEVICE_CLASS (klass);
|
||||
|
||||
NM_DEVICE_CLASS_DECLARE_TYPES (klass, NM_SETTING_GENERIC_SETTING_NAME, NM_LINK_TYPE_ANY)
|
||||
|
|
@ -216,6 +229,8 @@ nm_device_generic_class_init (NMDeviceGenericClass *klass)
|
|||
object_class->get_property = get_property;
|
||||
object_class->set_property = set_property;
|
||||
|
||||
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_generic);
|
||||
|
||||
parent_class->realize_start_notify = realize_start_notify;
|
||||
parent_class->get_generic_capabilities = get_generic_capabilities;
|
||||
parent_class->get_type_description = get_type_description;
|
||||
|
|
@ -229,8 +244,4 @@ nm_device_generic_class_init (NMDeviceGenericClass *klass)
|
|||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
||||
|
||||
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass),
|
||||
NMDBUS_TYPE_DEVICE_GENERIC_SKELETON,
|
||||
NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,8 +32,6 @@
|
|||
#include "nm-device-factory.h"
|
||||
#include "nm-core-internal.h"
|
||||
|
||||
#include "introspection/org.freedesktop.NetworkManager.Device.Infiniband.h"
|
||||
|
||||
#define NM_DEVICE_INFINIBAND_IS_PARTITION "is-partition"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
@ -368,10 +366,25 @@ nm_device_infiniband_init (NMDeviceInfiniband * self)
|
|||
{
|
||||
}
|
||||
|
||||
static const NMDBusInterfaceInfoExtended interface_info_device_infiniband = {
|
||||
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
|
||||
NM_DBUS_INTERFACE_DEVICE_INFINIBAND,
|
||||
.signals = NM_DEFINE_GDBUS_SIGNAL_INFOS (
|
||||
&nm_signal_info_property_changed_legacy,
|
||||
),
|
||||
.properties = NM_DEFINE_GDBUS_PROPERTY_INFOS (
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("HwAddress", "s", NM_DEVICE_HW_ADDRESS),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Carrier", "b", NM_DEVICE_CARRIER),
|
||||
),
|
||||
),
|
||||
.legacy_property_changed = TRUE,
|
||||
};
|
||||
|
||||
static void
|
||||
nm_device_infiniband_class_init (NMDeviceInfinibandClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass);
|
||||
NMDeviceClass *parent_class = NM_DEVICE_CLASS (klass);
|
||||
|
||||
NM_DEVICE_CLASS_DECLARE_TYPES (klass, NM_SETTING_INFINIBAND_SETTING_NAME, NM_LINK_TYPE_INFINIBAND)
|
||||
|
|
@ -379,6 +392,8 @@ nm_device_infiniband_class_init (NMDeviceInfinibandClass *klass)
|
|||
object_class->get_property = get_property;
|
||||
object_class->set_property = set_property;
|
||||
|
||||
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_infiniband);
|
||||
|
||||
parent_class->create_and_realize = create_and_realize;
|
||||
parent_class->unrealize = unrealize;
|
||||
parent_class->get_generic_capabilities = get_generic_capabilities;
|
||||
|
|
@ -396,10 +411,6 @@ nm_device_infiniband_class_init (NMDeviceInfinibandClass *klass)
|
|||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
||||
|
||||
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass),
|
||||
NMDBUS_TYPE_DEVICE_INFINIBAND_SKELETON,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
|
|
@ -37,8 +37,6 @@
|
|||
#include "nm-act-request.h"
|
||||
#include "nm-ip4-config.h"
|
||||
|
||||
#include "introspection/org.freedesktop.NetworkManager.Device.IPTunnel.h"
|
||||
|
||||
#include "nm-device-logging.h"
|
||||
_LOG_DECLARE_SELF(NMDeviceIPTunnel);
|
||||
|
||||
|
|
@ -907,10 +905,35 @@ dispose (GObject *object)
|
|||
G_OBJECT_CLASS (nm_device_ip_tunnel_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static const NMDBusInterfaceInfoExtended interface_info_device_ip_tunnel = {
|
||||
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
|
||||
NM_DBUS_INTERFACE_DEVICE_IP_TUNNEL,
|
||||
.signals = NM_DEFINE_GDBUS_SIGNAL_INFOS (
|
||||
&nm_signal_info_property_changed_legacy,
|
||||
),
|
||||
.properties = NM_DEFINE_GDBUS_PROPERTY_INFOS (
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Mode", "u", NM_DEVICE_IP_TUNNEL_MODE),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Parent", "o", NM_DEVICE_PARENT),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Local", "s", NM_DEVICE_IP_TUNNEL_LOCAL),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Remote", "s", NM_DEVICE_IP_TUNNEL_REMOTE),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Ttl", "y", NM_DEVICE_IP_TUNNEL_TTL),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Tos", "y", NM_DEVICE_IP_TUNNEL_TOS),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("PathMtuDiscovery", "b", NM_DEVICE_IP_TUNNEL_PATH_MTU_DISCOVERY),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("InputKey", "s", NM_DEVICE_IP_TUNNEL_INPUT_KEY),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("OutputKey", "s", NM_DEVICE_IP_TUNNEL_OUTPUT_KEY),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("EncapsulationLimit", "y", NM_DEVICE_IP_TUNNEL_ENCAPSULATION_LIMIT),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("FlowLabel", "u", NM_DEVICE_IP_TUNNEL_FLOW_LABEL),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Flags", "u", NM_DEVICE_IP_TUNNEL_FLAGS),
|
||||
),
|
||||
),
|
||||
.legacy_property_changed = TRUE,
|
||||
};
|
||||
|
||||
static void
|
||||
nm_device_ip_tunnel_class_init (NMDeviceIPTunnelClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass);
|
||||
NMDeviceClass *device_class = NM_DEVICE_CLASS (klass);
|
||||
|
||||
object_class->constructed = constructed;
|
||||
|
|
@ -918,6 +941,8 @@ nm_device_ip_tunnel_class_init (NMDeviceIPTunnelClass *klass)
|
|||
object_class->get_property = get_property;
|
||||
object_class->set_property = set_property;
|
||||
|
||||
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_ip_tunnel);
|
||||
|
||||
device_class->link_changed = link_changed;
|
||||
device_class->can_reapply_change = can_reapply_change;
|
||||
device_class->complete_connection = complete_connection;
|
||||
|
|
@ -1003,10 +1028,6 @@ nm_device_ip_tunnel_class_init (NMDeviceIPTunnelClass *klass)
|
|||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
||||
|
||||
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass),
|
||||
NMDBUS_TYPE_DEVICE_IPTUNNEL_SKELETON,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
|
|
@ -43,9 +43,6 @@
|
|||
#define NM_DEVICE_IP_TUNNEL_FLOW_LABEL "flow-label"
|
||||
#define NM_DEVICE_IP_TUNNEL_FLAGS "flags"
|
||||
|
||||
/* defined in the parent class, but exposed on D-Bus by the subclass. */
|
||||
#define NM_DEVICE_IP_TUNNEL_PARENT NM_DEVICE_PARENT
|
||||
|
||||
typedef struct _NMDeviceIPTunnel NMDeviceIPTunnel;
|
||||
typedef struct _NMDeviceIPTunnelClass NMDeviceIPTunnelClass;
|
||||
|
||||
|
|
|
|||
|
|
@ -33,8 +33,6 @@
|
|||
#include "supplicant/nm-supplicant-interface.h"
|
||||
#include "supplicant/nm-supplicant-config.h"
|
||||
|
||||
#include "introspection/org.freedesktop.NetworkManager.Device.Macsec.h"
|
||||
|
||||
#include "nm-device-logging.h"
|
||||
_LOG_DECLARE_SELF(NMDeviceMacsec);
|
||||
|
||||
|
|
@ -186,8 +184,12 @@ update_properties (NMDevice *device)
|
|||
nm_device_parent_set_ifindex (device, props->parent_ifindex);
|
||||
|
||||
#define CHECK_PROPERTY_CHANGED(field, prop) \
|
||||
if (props->field != priv->props.field) \
|
||||
_notify (self, prop)
|
||||
G_STMT_START { \
|
||||
if (priv->props.field != props->field) { \
|
||||
priv->props.field = props->field; \
|
||||
_notify (self, prop); \
|
||||
} \
|
||||
} G_STMT_END
|
||||
|
||||
CHECK_PROPERTY_CHANGED (sci, PROP_SCI);
|
||||
CHECK_PROPERTY_CHANGED (cipher_suite, PROP_CIPHER_SUITE);
|
||||
|
|
@ -202,7 +204,6 @@ update_properties (NMDevice *device)
|
|||
CHECK_PROPERTY_CHANGED (scb, PROP_SCB);
|
||||
CHECK_PROPERTY_CHANGED (replay_protect, PROP_REPLAY_PROTECT);
|
||||
|
||||
priv->props = *props;
|
||||
g_object_thaw_notify ((GObject *) device);
|
||||
}
|
||||
|
||||
|
|
@ -809,10 +810,36 @@ dispose (GObject *object)
|
|||
G_OBJECT_CLASS (nm_device_macsec_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static const NMDBusInterfaceInfoExtended interface_info_device_macsec = {
|
||||
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
|
||||
NM_DBUS_INTERFACE_DEVICE_MACSEC,
|
||||
.signals = NM_DEFINE_GDBUS_SIGNAL_INFOS (
|
||||
&nm_signal_info_property_changed_legacy,
|
||||
),
|
||||
.properties = NM_DEFINE_GDBUS_PROPERTY_INFOS (
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Parent", "o", NM_DEVICE_PARENT),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Sci", "t", NM_DEVICE_MACSEC_SCI),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("IcvLength", "y", NM_DEVICE_MACSEC_ICV_LENGTH),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("CipherSuite", "t", NM_DEVICE_MACSEC_CIPHER_SUITE),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Window", "u", NM_DEVICE_MACSEC_WINDOW),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("EncodingSa", "y", NM_DEVICE_MACSEC_ENCODING_SA),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Validation", "s", NM_DEVICE_MACSEC_VALIDATION),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Encrypt", "b", NM_DEVICE_MACSEC_ENCRYPT),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Protect", "b", NM_DEVICE_MACSEC_PROTECT),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("IncludeSci", "b", NM_DEVICE_MACSEC_INCLUDE_SCI),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Es", "b", NM_DEVICE_MACSEC_ES),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Scb", "b", NM_DEVICE_MACSEC_SCB),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("ReplayProtect", "b", NM_DEVICE_MACSEC_REPLAY_PROTECT),
|
||||
),
|
||||
),
|
||||
.legacy_property_changed = TRUE,
|
||||
};
|
||||
|
||||
static void
|
||||
nm_device_macsec_class_init (NMDeviceMacsecClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass);
|
||||
NMDeviceClass *parent_class = NM_DEVICE_CLASS (klass);
|
||||
|
||||
NM_DEVICE_CLASS_DECLARE_TYPES (klass, NULL, NM_LINK_TYPE_MACSEC)
|
||||
|
|
@ -820,6 +847,8 @@ nm_device_macsec_class_init (NMDeviceMacsecClass *klass)
|
|||
object_class->get_property = get_property;
|
||||
object_class->dispose = dispose;
|
||||
|
||||
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_macsec);
|
||||
|
||||
parent_class->act_stage2_config = act_stage2_config;
|
||||
parent_class->check_connection_compatible = check_connection_compatible;
|
||||
parent_class->create_and_realize = create_and_realize;
|
||||
|
|
@ -883,10 +912,6 @@ nm_device_macsec_class_init (NMDeviceMacsecClass *klass)
|
|||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
||||
|
||||
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass),
|
||||
NMDBUS_TYPE_DEVICE_MACSEC_SKELETON,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/*************************************************************/
|
||||
|
|
|
|||
|
|
@ -43,9 +43,6 @@
|
|||
#define NM_DEVICE_MACSEC_SCB "scb"
|
||||
#define NM_DEVICE_MACSEC_REPLAY_PROTECT "replay-protect"
|
||||
|
||||
/* defined in the parent class, but exposed on D-Bus by the subclass. */
|
||||
#define NM_DEVICE_MACSEC_PARENT NM_DEVICE_PARENT
|
||||
|
||||
typedef struct _NMDeviceMacsec NMDeviceMacsec;
|
||||
typedef struct _NMDeviceMacsecClass NMDeviceMacsecClass;
|
||||
|
||||
|
|
|
|||
|
|
@ -36,8 +36,6 @@
|
|||
#include "nm-ip4-config.h"
|
||||
#include "nm-utils.h"
|
||||
|
||||
#include "introspection/org.freedesktop.NetworkManager.Device.Macvlan.h"
|
||||
|
||||
#include "nm-device-logging.h"
|
||||
_LOG_DECLARE_SELF(NMDeviceMacvlan);
|
||||
|
||||
|
|
@ -197,12 +195,17 @@ update_properties (NMDevice *device)
|
|||
g_object_freeze_notify (object);
|
||||
|
||||
nm_device_parent_set_ifindex (device, plink->parent);
|
||||
if (priv->props.mode != props->mode)
|
||||
_notify (self, PROP_MODE);
|
||||
if (priv->props.no_promisc != props->no_promisc)
|
||||
_notify (self, PROP_NO_PROMISC);
|
||||
|
||||
priv->props = *props;
|
||||
#define CHECK_PROPERTY_CHANGED(field, prop) \
|
||||
G_STMT_START { \
|
||||
if (priv->props.field != props->field) { \
|
||||
priv->props.field = props->field; \
|
||||
_notify (self, prop); \
|
||||
} \
|
||||
} G_STMT_END
|
||||
|
||||
CHECK_PROPERTY_CHANGED (mode, PROP_MODE);
|
||||
CHECK_PROPERTY_CHANGED (no_promisc, PROP_NO_PROMISC);
|
||||
|
||||
g_object_thaw_notify (object);
|
||||
}
|
||||
|
|
@ -470,10 +473,27 @@ nm_device_macvlan_init (NMDeviceMacvlan *self)
|
|||
{
|
||||
}
|
||||
|
||||
static const NMDBusInterfaceInfoExtended interface_info_device_macvlan = {
|
||||
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
|
||||
NM_DBUS_INTERFACE_DEVICE_MACVLAN,
|
||||
.signals = NM_DEFINE_GDBUS_SIGNAL_INFOS (
|
||||
&nm_signal_info_property_changed_legacy,
|
||||
),
|
||||
.properties = NM_DEFINE_GDBUS_PROPERTY_INFOS (
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Parent", "o", NM_DEVICE_PARENT),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Mode", "s", NM_DEVICE_MACVLAN_MODE),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("NoPromisc", "b", NM_DEVICE_MACVLAN_NO_PROMISC),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Tab", "b", NM_DEVICE_MACVLAN_TAP),
|
||||
),
|
||||
),
|
||||
.legacy_property_changed = TRUE,
|
||||
};
|
||||
|
||||
static void
|
||||
nm_device_macvlan_class_init (NMDeviceMacvlanClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass);
|
||||
NMDeviceClass *device_class = NM_DEVICE_CLASS (klass);
|
||||
|
||||
NM_DEVICE_CLASS_DECLARE_TYPES (klass, NULL, NM_LINK_TYPE_MACVLAN, NM_LINK_TYPE_MACVTAP)
|
||||
|
|
@ -481,6 +501,8 @@ nm_device_macvlan_class_init (NMDeviceMacvlanClass *klass)
|
|||
object_class->get_property = get_property;
|
||||
object_class->set_property = set_property;
|
||||
|
||||
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_macvlan);
|
||||
|
||||
device_class->act_stage1_prepare = act_stage1_prepare;
|
||||
device_class->check_connection_compatible = check_connection_compatible;
|
||||
device_class->complete_connection = complete_connection;
|
||||
|
|
@ -513,10 +535,6 @@ nm_device_macvlan_class_init (NMDeviceMacvlanClass *klass)
|
|||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
||||
|
||||
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass),
|
||||
NMDBUS_TYPE_DEVICE_MACVLAN_SKELETON,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
|
|
@ -34,9 +34,6 @@
|
|||
#define NM_DEVICE_MACVLAN_NO_PROMISC "no-promisc"
|
||||
#define NM_DEVICE_MACVLAN_TAP "tap"
|
||||
|
||||
/* defined in the parent class, but exposed on D-Bus by the subclass. */
|
||||
#define NM_DEVICE_MACVLAN_PARENT NM_DEVICE_PARENT
|
||||
|
||||
typedef struct _NMDeviceMacvlan NMDeviceMacvlan;
|
||||
typedef struct _NMDeviceMacvlanClass NMDeviceMacvlanClass;
|
||||
|
||||
|
|
|
|||
|
|
@ -26,8 +26,6 @@
|
|||
#include "ppp/nm-ppp-manager-call.h"
|
||||
#include "ppp/nm-ppp-status.h"
|
||||
|
||||
#include "introspection/org.freedesktop.NetworkManager.Device.Ppp.h"
|
||||
|
||||
#include "nm-device-logging.h"
|
||||
_LOG_DECLARE_SELF(NMDevicePpp);
|
||||
|
||||
|
|
@ -262,26 +260,35 @@ dispose (GObject *object)
|
|||
G_OBJECT_CLASS (nm_device_ppp_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static const NMDBusInterfaceInfoExtended interface_info_device_ppp = {
|
||||
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
|
||||
NM_DBUS_INTERFACE_DEVICE_PPP,
|
||||
.signals = NM_DEFINE_GDBUS_SIGNAL_INFOS (
|
||||
&nm_signal_info_property_changed_legacy,
|
||||
),
|
||||
),
|
||||
.legacy_property_changed = TRUE,
|
||||
};
|
||||
|
||||
static void
|
||||
nm_device_ppp_class_init (NMDevicePppClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass);
|
||||
NMDeviceClass *parent_class = NM_DEVICE_CLASS (klass);
|
||||
|
||||
NM_DEVICE_CLASS_DECLARE_TYPES (klass, NM_SETTING_PPPOE_SETTING_NAME, NM_LINK_TYPE_PPP)
|
||||
|
||||
object_class->dispose = dispose;
|
||||
|
||||
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_ppp);
|
||||
|
||||
parent_class->act_stage2_config = act_stage2_config;
|
||||
parent_class->act_stage3_ip4_config_start = act_stage3_ip4_config_start;
|
||||
parent_class->check_connection_compatible = check_connection_compatible;
|
||||
parent_class->create_and_realize = create_and_realize;
|
||||
parent_class->deactivate = deactivate;
|
||||
parent_class->get_generic_capabilities = get_generic_capabilities;
|
||||
|
||||
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass),
|
||||
NMDBUS_TYPE_DEVICE_PPP_SKELETON,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
|
|
@ -34,8 +34,6 @@
|
|||
#include "nm-setting-tun.h"
|
||||
#include "nm-core-internal.h"
|
||||
|
||||
#include "introspection/org.freedesktop.NetworkManager.Device.Tun.h"
|
||||
|
||||
#include "nm-device-logging.h"
|
||||
_LOG_DECLARE_SELF(NMDeviceTun);
|
||||
|
||||
|
|
@ -99,18 +97,19 @@ update_properties (NMDeviceTun *self)
|
|||
|
||||
g_object_freeze_notify (object);
|
||||
|
||||
if (priv->props.owner != props.owner)
|
||||
_notify (self, PROP_OWNER);
|
||||
if (priv->props.group != props.group)
|
||||
_notify (self, PROP_GROUP);
|
||||
if (priv->props.no_pi != props.no_pi)
|
||||
_notify (self, PROP_NO_PI);
|
||||
if (priv->props.vnet_hdr != props.vnet_hdr)
|
||||
_notify (self, PROP_VNET_HDR);
|
||||
if (priv->props.multi_queue != props.multi_queue)
|
||||
_notify (self, PROP_MULTI_QUEUE);
|
||||
#define CHECK_PROPERTY_CHANGED(field, prop) \
|
||||
G_STMT_START { \
|
||||
if (priv->props.field != props.field) { \
|
||||
priv->props.field = props.field; \
|
||||
_notify (self, prop); \
|
||||
} \
|
||||
} G_STMT_END
|
||||
|
||||
memcpy (&priv->props, &props, sizeof (NMPlatformTunProperties));
|
||||
CHECK_PROPERTY_CHANGED (owner, PROP_OWNER);
|
||||
CHECK_PROPERTY_CHANGED (group, PROP_GROUP);
|
||||
CHECK_PROPERTY_CHANGED (no_pi, PROP_NO_PI);
|
||||
CHECK_PROPERTY_CHANGED (vnet_hdr, PROP_VNET_HDR);
|
||||
CHECK_PROPERTY_CHANGED (multi_queue, PROP_MULTI_QUEUE);
|
||||
|
||||
g_object_thaw_notify (object);
|
||||
}
|
||||
|
|
@ -394,10 +393,30 @@ nm_device_tun_init (NMDeviceTun *self)
|
|||
{
|
||||
}
|
||||
|
||||
static const NMDBusInterfaceInfoExtended interface_info_device_tun = {
|
||||
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
|
||||
NM_DBUS_INTERFACE_DEVICE_TUN,
|
||||
.signals = NM_DEFINE_GDBUS_SIGNAL_INFOS (
|
||||
&nm_signal_info_property_changed_legacy,
|
||||
),
|
||||
.properties = NM_DEFINE_GDBUS_PROPERTY_INFOS (
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Owner", "x", NM_DEVICE_TUN_OWNER),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Group", "x", NM_DEVICE_TUN_GROUP),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Mode", "s", NM_DEVICE_TUN_MODE),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("NoPi", "b", NM_DEVICE_TUN_NO_PI),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("VnetHdr", "b", NM_DEVICE_TUN_VNET_HDR),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("MultiQueue", "b", NM_DEVICE_TUN_MULTI_QUEUE),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("HwAddress", "s", NM_DEVICE_HW_ADDRESS),
|
||||
),
|
||||
),
|
||||
.legacy_property_changed = TRUE,
|
||||
};
|
||||
|
||||
static void
|
||||
nm_device_tun_class_init (NMDeviceTunClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass);
|
||||
NMDeviceClass *device_class = NM_DEVICE_CLASS (klass);
|
||||
|
||||
NM_DEVICE_CLASS_DECLARE_TYPES (klass, NULL, NM_LINK_TYPE_TUN, NM_LINK_TYPE_TAP)
|
||||
|
|
@ -405,6 +424,8 @@ nm_device_tun_class_init (NMDeviceTunClass *klass)
|
|||
object_class->get_property = get_property;
|
||||
object_class->set_property = set_property;
|
||||
|
||||
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_tun);
|
||||
|
||||
device_class->connection_type = NM_SETTING_TUN_SETTING_NAME;
|
||||
device_class->link_changed = link_changed;
|
||||
device_class->complete_connection = complete_connection;
|
||||
|
|
@ -448,10 +469,6 @@ nm_device_tun_class_init (NMDeviceTunClass *klass)
|
|||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
||||
|
||||
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass),
|
||||
NMDBUS_TYPE_DEVICE_TUN_SKELETON,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -30,8 +30,6 @@
|
|||
#include "platform/nm-platform.h"
|
||||
#include "nm-device-factory.h"
|
||||
|
||||
#include "introspection/org.freedesktop.NetworkManager.Device.Veth.h"
|
||||
|
||||
#include "nm-device-logging.h"
|
||||
_LOG_DECLARE_SELF(NMDeviceVeth);
|
||||
|
||||
|
|
@ -101,11 +99,18 @@ nm_device_veth_init (NMDeviceVeth *self)
|
|||
}
|
||||
|
||||
static void
|
||||
notify (GObject *object, GParamSpec *pspec)
|
||||
parent_changed_notify (NMDevice *device,
|
||||
int old_ifindex,
|
||||
NMDevice *old_parent,
|
||||
int new_ifindex,
|
||||
NMDevice *new_parent)
|
||||
{
|
||||
if (nm_streq (pspec->name, NM_DEVICE_PARENT))
|
||||
_notify (NM_DEVICE_VETH (object), PROP_PEER);
|
||||
G_OBJECT_CLASS (nm_device_veth_parent_class)->notify (object, pspec);
|
||||
NM_DEVICE_CLASS (nm_device_veth_parent_class)->parent_changed_notify (device,
|
||||
old_ifindex,
|
||||
old_parent,
|
||||
new_ifindex,
|
||||
new_parent);
|
||||
_notify (NM_DEVICE_VETH (device), PROP_PEER);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -120,7 +125,7 @@ get_property (GObject *object, guint prop_id,
|
|||
peer = nm_device_parent_get_device (NM_DEVICE (self));
|
||||
if (peer && !NM_IS_DEVICE_VETH (peer))
|
||||
peer = NULL;
|
||||
nm_utils_g_value_set_object_path (value, peer);
|
||||
nm_dbus_utils_g_value_set_object_path (value, peer);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
|
|
@ -128,19 +133,35 @@ get_property (GObject *object, guint prop_id,
|
|||
}
|
||||
}
|
||||
|
||||
static const NMDBusInterfaceInfoExtended interface_info_device_veth = {
|
||||
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
|
||||
NM_DBUS_INTERFACE_DEVICE_VETH,
|
||||
.signals = NM_DEFINE_GDBUS_SIGNAL_INFOS (
|
||||
&nm_signal_info_property_changed_legacy,
|
||||
),
|
||||
.properties = NM_DEFINE_GDBUS_PROPERTY_INFOS (
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Peer", "o", NM_DEVICE_VETH_PEER),
|
||||
),
|
||||
),
|
||||
.legacy_property_changed = TRUE,
|
||||
};
|
||||
|
||||
static void
|
||||
nm_device_veth_class_init (NMDeviceVethClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass);
|
||||
NMDeviceClass *device_class = NM_DEVICE_CLASS (klass);
|
||||
|
||||
NM_DEVICE_CLASS_DECLARE_TYPES (klass, NULL, NM_LINK_TYPE_VETH)
|
||||
|
||||
object_class->get_property = get_property;
|
||||
object_class->notify = notify;
|
||||
|
||||
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_veth);
|
||||
|
||||
device_class->can_unmanaged_external_down = can_unmanaged_external_down;
|
||||
device_class->link_changed = link_changed;
|
||||
device_class->parent_changed_notify = parent_changed_notify;
|
||||
|
||||
obj_properties[PROP_PEER] =
|
||||
g_param_spec_string (NM_DEVICE_VETH_PEER, "", "",
|
||||
|
|
@ -149,10 +170,6 @@ nm_device_veth_class_init (NMDeviceVethClass *klass)
|
|||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
||||
|
||||
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass),
|
||||
NMDBUS_TYPE_DEVICE_VETH_SKELETON,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
|
|
@ -37,8 +37,6 @@
|
|||
#include "nm-core-internal.h"
|
||||
#include "platform/nmp-object.h"
|
||||
|
||||
#include "introspection/org.freedesktop.NetworkManager.Device.Vlan.h"
|
||||
|
||||
#include "nm-device-logging.h"
|
||||
_LOG_DECLARE_SELF(NMDeviceVlan);
|
||||
|
||||
|
|
@ -577,16 +575,35 @@ nm_device_vlan_init (NMDeviceVlan * self)
|
|||
{
|
||||
}
|
||||
|
||||
static const NMDBusInterfaceInfoExtended interface_info_device_vlan = {
|
||||
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
|
||||
NM_DBUS_INTERFACE_DEVICE_VLAN,
|
||||
.signals = NM_DEFINE_GDBUS_SIGNAL_INFOS (
|
||||
&nm_signal_info_property_changed_legacy,
|
||||
),
|
||||
.properties = NM_DEFINE_GDBUS_PROPERTY_INFOS (
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("HwAddress", "s", NM_DEVICE_HW_ADDRESS),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Carrier", "b", NM_DEVICE_CARRIER),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Parent", "o", NM_DEVICE_PARENT),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("VlanId", "u", NM_DEVICE_VLAN_ID),
|
||||
),
|
||||
),
|
||||
.legacy_property_changed = TRUE,
|
||||
};
|
||||
|
||||
static void
|
||||
nm_device_vlan_class_init (NMDeviceVlanClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass);
|
||||
NMDeviceClass *parent_class = NM_DEVICE_CLASS (klass);
|
||||
|
||||
NM_DEVICE_CLASS_DECLARE_TYPES (klass, NM_SETTING_VLAN_SETTING_NAME, NM_LINK_TYPE_VLAN)
|
||||
|
||||
object_class->get_property = get_property;
|
||||
|
||||
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_vlan);
|
||||
|
||||
parent_class->create_and_realize = create_and_realize;
|
||||
parent_class->link_changed = link_changed;
|
||||
parent_class->unrealize_notify = unrealize_notify;
|
||||
|
|
@ -608,10 +625,6 @@ nm_device_vlan_class_init (NMDeviceVlanClass *klass)
|
|||
| G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
||||
|
||||
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass),
|
||||
NMDBUS_TYPE_DEVICE_VLAN_SKELETON,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
|
|
@ -36,12 +36,8 @@ typedef enum {
|
|||
NM_VLAN_ERROR_CONNECTION_INCOMPATIBLE, /*< nick=ConnectionIncompatible >*/
|
||||
} NMVlanError;
|
||||
|
||||
/* D-Bus exported properties */
|
||||
#define NM_DEVICE_VLAN_ID "vlan-id"
|
||||
|
||||
/* defined in the parent class, but exposed on D-Bus by the subclass. */
|
||||
#define NM_DEVICE_VLAN_PARENT NM_DEVICE_PARENT
|
||||
|
||||
typedef struct _NMDeviceVlan NMDeviceVlan;
|
||||
typedef struct _NMDeviceVlanClass NMDeviceVlanClass;
|
||||
|
||||
|
|
|
|||
|
|
@ -35,8 +35,6 @@
|
|||
#include "nm-act-request.h"
|
||||
#include "nm-ip4-config.h"
|
||||
|
||||
#include "introspection/org.freedesktop.NetworkManager.Device.Vxlan.h"
|
||||
|
||||
#include "nm-device-logging.h"
|
||||
_LOG_DECLARE_SELF(NMDeviceVxlan);
|
||||
|
||||
|
|
@ -97,42 +95,40 @@ update_properties (NMDevice *device)
|
|||
|
||||
if (priv->props.parent_ifindex != props->parent_ifindex)
|
||||
nm_device_parent_set_ifindex (device, props->parent_ifindex);
|
||||
if (priv->props.id != props->id)
|
||||
_notify (self, PROP_ID);
|
||||
if (priv->props.local != props->local)
|
||||
_notify (self, PROP_LOCAL);
|
||||
if (memcmp (&priv->props.local6, &props->local6, sizeof (props->local6)) != 0)
|
||||
_notify (self, PROP_LOCAL);
|
||||
if (priv->props.group != props->group)
|
||||
_notify (self, PROP_GROUP);
|
||||
if (memcmp (&priv->props.group6, &props->group6, sizeof (props->group6)) != 0)
|
||||
_notify (self, PROP_GROUP);
|
||||
if (priv->props.tos != props->tos)
|
||||
_notify (self, PROP_TOS);
|
||||
if (priv->props.ttl != props->ttl)
|
||||
_notify (self, PROP_TTL);
|
||||
if (priv->props.learning != props->learning)
|
||||
_notify (self, PROP_LEARNING);
|
||||
if (priv->props.ageing != props->ageing)
|
||||
_notify (self, PROP_AGEING);
|
||||
if (priv->props.limit != props->limit)
|
||||
_notify (self, PROP_LIMIT);
|
||||
if (priv->props.src_port_min != props->src_port_min)
|
||||
_notify (self, PROP_SRC_PORT_MIN);
|
||||
if (priv->props.src_port_max != props->src_port_max)
|
||||
_notify (self, PROP_SRC_PORT_MAX);
|
||||
if (priv->props.dst_port != props->dst_port)
|
||||
_notify (self, PROP_DST_PORT);
|
||||
if (priv->props.proxy != props->proxy)
|
||||
_notify (self, PROP_PROXY);
|
||||
if (priv->props.rsc != props->rsc)
|
||||
_notify (self, PROP_RSC);
|
||||
if (priv->props.l2miss != props->l2miss)
|
||||
_notify (self, PROP_L2MISS);
|
||||
if (priv->props.l3miss != props->l3miss)
|
||||
_notify (self, PROP_L3MISS);
|
||||
|
||||
priv->props = *props;
|
||||
#define CHECK_PROPERTY_CHANGED(field, prop) \
|
||||
G_STMT_START { \
|
||||
if (priv->props.field != props->field) { \
|
||||
priv->props.field = props->field; \
|
||||
_notify (self, prop); \
|
||||
} \
|
||||
} G_STMT_END
|
||||
|
||||
#define CHECK_PROPERTY_CHANGED_IN6ADDR(field, prop) \
|
||||
G_STMT_START { \
|
||||
if (memcmp (&priv->props.field, &props->field, sizeof (props->field)) != 0) { \
|
||||
priv->props.field = props->field; \
|
||||
_notify (self, prop); \
|
||||
} \
|
||||
} G_STMT_END
|
||||
|
||||
CHECK_PROPERTY_CHANGED (id, PROP_ID);
|
||||
CHECK_PROPERTY_CHANGED (local, PROP_LOCAL);
|
||||
CHECK_PROPERTY_CHANGED_IN6ADDR (local6, PROP_LOCAL);
|
||||
CHECK_PROPERTY_CHANGED (group, PROP_GROUP);
|
||||
CHECK_PROPERTY_CHANGED_IN6ADDR (group6, PROP_GROUP);
|
||||
CHECK_PROPERTY_CHANGED (tos, PROP_TOS);
|
||||
CHECK_PROPERTY_CHANGED (ttl, PROP_TTL);
|
||||
CHECK_PROPERTY_CHANGED (learning, PROP_LEARNING);
|
||||
CHECK_PROPERTY_CHANGED (ageing, PROP_AGEING);
|
||||
CHECK_PROPERTY_CHANGED (limit, PROP_LIMIT);
|
||||
CHECK_PROPERTY_CHANGED (src_port_min, PROP_SRC_PORT_MIN);
|
||||
CHECK_PROPERTY_CHANGED (src_port_max, PROP_SRC_PORT_MAX);
|
||||
CHECK_PROPERTY_CHANGED (dst_port, PROP_DST_PORT);
|
||||
CHECK_PROPERTY_CHANGED (proxy, PROP_PROXY);
|
||||
CHECK_PROPERTY_CHANGED (rsc, PROP_RSC);
|
||||
CHECK_PROPERTY_CHANGED (l2miss, PROP_L2MISS);
|
||||
CHECK_PROPERTY_CHANGED (l3miss, PROP_L3MISS);
|
||||
|
||||
g_object_thaw_notify (object);
|
||||
}
|
||||
|
|
@ -545,16 +541,48 @@ nm_device_vxlan_init (NMDeviceVxlan *self)
|
|||
{
|
||||
}
|
||||
|
||||
static const NMDBusInterfaceInfoExtended interface_info_device_vxlan = {
|
||||
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
|
||||
NM_DBUS_INTERFACE_DEVICE_VXLAN,
|
||||
.signals = NM_DEFINE_GDBUS_SIGNAL_INFOS (
|
||||
&nm_signal_info_property_changed_legacy,
|
||||
),
|
||||
.properties = NM_DEFINE_GDBUS_PROPERTY_INFOS (
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Parent", "o", NM_DEVICE_PARENT),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("HwAddress", "s", NM_DEVICE_HW_ADDRESS),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Id", "u", NM_DEVICE_VXLAN_ID),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Group", "s", NM_DEVICE_VXLAN_GROUP),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Local", "s", NM_DEVICE_VXLAN_LOCAL),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Tos", "y", NM_DEVICE_VXLAN_TOS),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Ttl", "y", NM_DEVICE_VXLAN_TTL),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Learning", "b", NM_DEVICE_VXLAN_LEARNING),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Ageing", "u", NM_DEVICE_VXLAN_AGEING),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Limit", "u", NM_DEVICE_VXLAN_LIMIT),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("DstPort", "q", NM_DEVICE_VXLAN_DST_PORT),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("SrcPortMin", "q", NM_DEVICE_VXLAN_SRC_PORT_MIN),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("SrcPortMax", "q", NM_DEVICE_VXLAN_SRC_PORT_MAX),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Proxy", "b", NM_DEVICE_VXLAN_PROXY),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Rsc", "b", NM_DEVICE_VXLAN_RSC),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("L2miss", "b", NM_DEVICE_VXLAN_L2MISS),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("L3miss", "b", NM_DEVICE_VXLAN_L3MISS),
|
||||
),
|
||||
),
|
||||
.legacy_property_changed = TRUE,
|
||||
};
|
||||
|
||||
static void
|
||||
nm_device_vxlan_class_init (NMDeviceVxlanClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass);
|
||||
NMDeviceClass *device_class = NM_DEVICE_CLASS (klass);
|
||||
|
||||
NM_DEVICE_CLASS_DECLARE_TYPES (klass, NULL, NM_LINK_TYPE_VXLAN)
|
||||
|
||||
object_class->get_property = get_property;
|
||||
|
||||
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_vxlan);
|
||||
|
||||
device_class->link_changed = link_changed;
|
||||
device_class->unrealize_notify = unrealize_notify;
|
||||
device_class->connection_type = NM_SETTING_VXLAN_SETTING_NAME;
|
||||
|
|
@ -657,10 +685,6 @@ nm_device_vxlan_class_init (NMDeviceVxlanClass *klass)
|
|||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
||||
|
||||
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass),
|
||||
NMDBUS_TYPE_DEVICE_VXLAN_SKELETON,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
|
|
@ -46,9 +46,6 @@
|
|||
#define NM_DEVICE_VXLAN_L2MISS "l2miss"
|
||||
#define NM_DEVICE_VXLAN_L3MISS "l3miss"
|
||||
|
||||
/* defined in the parent class, but exposed on D-Bus by the subclass. */
|
||||
#define NM_DEVICE_VXLAN_PARENT NM_DEVICE_PARENT
|
||||
|
||||
typedef struct _NMDeviceVxlan NMDeviceVxlan;
|
||||
typedef struct _NMDeviceVxlanClass NMDeviceVxlanClass;
|
||||
|
||||
|
|
|
|||
|
|
@ -80,9 +80,6 @@
|
|||
#include "nm-device-logging.h"
|
||||
_LOG_DECLARE_SELF (NMDevice);
|
||||
|
||||
#include "introspection/org.freedesktop.NetworkManager.Device.h"
|
||||
#include "introspection/org.freedesktop.NetworkManager.Device.Statistics.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#define DHCP_RESTART_TIMEOUT 120
|
||||
|
|
@ -506,12 +503,15 @@ typedef struct _NMDevicePrivate {
|
|||
|
||||
} NMDevicePrivate;
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE (NMDevice, nm_device, NM_TYPE_EXPORTED_OBJECT)
|
||||
G_DEFINE_ABSTRACT_TYPE (NMDevice, nm_device, NM_TYPE_DBUS_OBJECT)
|
||||
|
||||
#define NM_DEVICE_GET_PRIVATE(self) _NM_GET_PRIVATE_PTR(self, NMDevice, NM_IS_DEVICE)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static const NMDBusInterfaceInfoExtended interface_info_device;
|
||||
static const GDBusSignalInfo signal_info_state_changed;
|
||||
|
||||
static void nm_device_set_proxy_config (NMDevice *self, const char *pac_url);
|
||||
|
||||
static gboolean update_ext_ip_config (NMDevice *self, int addr_family, gboolean initial, gboolean intersect_configs);
|
||||
|
|
@ -6067,7 +6067,7 @@ dhcp4_cleanup (NMDevice *self, CleanupType cleanup_type, gboolean release)
|
|||
}
|
||||
|
||||
if (priv->dhcp4.config) {
|
||||
nm_exported_object_clear_and_unexport (&priv->dhcp4.config);
|
||||
nm_dbus_object_clear_and_unexport (&priv->dhcp4.config);
|
||||
_notify (self, PROP_DHCP4_CONFIG);
|
||||
}
|
||||
}
|
||||
|
|
@ -6493,7 +6493,7 @@ dhcp4_start (NMDevice *self)
|
|||
s_ip4 = nm_connection_get_setting_ip4_config (connection);
|
||||
|
||||
/* Clear old exported DHCP options */
|
||||
nm_exported_object_clear_and_unexport (&priv->dhcp4.config);
|
||||
nm_dbus_object_clear_and_unexport (&priv->dhcp4.config);
|
||||
priv->dhcp4.config = nm_dhcp4_config_new ();
|
||||
|
||||
hwaddr = nm_platform_link_get_address_as_bytes (nm_device_get_platform (self),
|
||||
|
|
@ -6831,7 +6831,7 @@ dhcp6_cleanup (NMDevice *self, CleanupType cleanup_type, gboolean release)
|
|||
nm_device_remove_pending_action (self, NM_PENDING_ACTION_DHCP6, FALSE);
|
||||
|
||||
if (priv->dhcp6.config) {
|
||||
nm_exported_object_clear_and_unexport (&priv->dhcp6.config);
|
||||
nm_dbus_object_clear_and_unexport (&priv->dhcp6.config);
|
||||
_notify (self, PROP_DHCP6_CONFIG);
|
||||
}
|
||||
}
|
||||
|
|
@ -7281,7 +7281,7 @@ dhcp6_start (NMDevice *self, gboolean wait_for_ll)
|
|||
NMConnection *connection;
|
||||
NMSettingIPConfig *s_ip6;
|
||||
|
||||
nm_exported_object_clear_and_unexport (&priv->dhcp6.config);
|
||||
nm_dbus_object_clear_and_unexport (&priv->dhcp6.config);
|
||||
priv->dhcp6.config = nm_dhcp6_config_new ();
|
||||
|
||||
nm_assert (!applied_config_get_current (&priv->dhcp6.ip6_config));
|
||||
|
|
@ -9256,7 +9256,7 @@ act_request_set (NMDevice *self, NMActRequest *act_request)
|
|||
|
||||
if (act_request) {
|
||||
priv->act_request_id = g_signal_connect (act_request,
|
||||
"notify::"NM_EXPORTED_OBJECT_PATH,
|
||||
"notify::"NM_DBUS_OBJECT_PATH,
|
||||
G_CALLBACK (act_request_set_cb),
|
||||
self);
|
||||
|
||||
|
|
@ -9887,25 +9887,33 @@ reapply_cb (NMDevice *self,
|
|||
}
|
||||
|
||||
static void
|
||||
impl_device_reapply (NMDevice *self,
|
||||
GDBusMethodInvocation *context,
|
||||
GVariant *settings,
|
||||
guint64 version_id,
|
||||
guint32 flags)
|
||||
impl_device_reapply (NMDBusObject *obj,
|
||||
const NMDBusInterfaceInfoExtended *interface_info,
|
||||
const NMDBusMethodInfoExtended *method_info,
|
||||
GDBusConnection *dbus_connection,
|
||||
const char *sender,
|
||||
GDBusMethodInvocation *invocation,
|
||||
GVariant *parameters)
|
||||
{
|
||||
NMDevice *self = NM_DEVICE (obj);
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
||||
NMSettingsConnection *settings_connection;
|
||||
NMConnection *connection = NULL;
|
||||
GError *error = NULL;
|
||||
ReapplyData *reapply_data;
|
||||
gs_unref_variant GVariant *settings = NULL;
|
||||
guint64 version_id;
|
||||
guint32 flags;
|
||||
|
||||
g_variant_get (parameters, "(@a{sa{sv}}tu)", &settings, &version_id, &flags);
|
||||
|
||||
/* No flags supported as of now. */
|
||||
if (flags != 0) {
|
||||
error = g_error_new_literal (NM_DEVICE_ERROR,
|
||||
NM_DEVICE_ERROR_FAILED,
|
||||
"Invalid flags specified");
|
||||
nm_audit_log_device_op (NM_AUDIT_OP_DEVICE_REAPPLY, self, FALSE, NULL, context, error->message);
|
||||
g_dbus_method_invocation_take_error (context, error);
|
||||
nm_audit_log_device_op (NM_AUDIT_OP_DEVICE_REAPPLY, self, FALSE, NULL, invocation, error->message);
|
||||
g_dbus_method_invocation_take_error (invocation, error);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -9913,8 +9921,8 @@ impl_device_reapply (NMDevice *self,
|
|||
error = g_error_new_literal (NM_DEVICE_ERROR,
|
||||
NM_DEVICE_ERROR_NOT_ACTIVE,
|
||||
"Device is not activated");
|
||||
nm_audit_log_device_op (NM_AUDIT_OP_DEVICE_REAPPLY, self, FALSE, NULL, context, error->message);
|
||||
g_dbus_method_invocation_take_error (context, error);
|
||||
nm_audit_log_device_op (NM_AUDIT_OP_DEVICE_REAPPLY, self, FALSE, NULL, invocation, error->message);
|
||||
g_dbus_method_invocation_take_error (invocation, error);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -9929,8 +9937,8 @@ impl_device_reapply (NMDevice *self,
|
|||
&error);
|
||||
if (!connection) {
|
||||
g_prefix_error (&error, "The settings specified are invalid: ");
|
||||
nm_audit_log_device_op (NM_AUDIT_OP_DEVICE_REAPPLY, self, FALSE, NULL, context, error->message);
|
||||
g_dbus_method_invocation_take_error (context, error);
|
||||
nm_audit_log_device_op (NM_AUDIT_OP_DEVICE_REAPPLY, self, FALSE, NULL, invocation, error->message);
|
||||
g_dbus_method_invocation_take_error (invocation, error);
|
||||
return;
|
||||
}
|
||||
nm_connection_clear_secrets (connection);
|
||||
|
|
@ -9943,9 +9951,8 @@ impl_device_reapply (NMDevice *self,
|
|||
} else
|
||||
reapply_data = NULL;
|
||||
|
||||
/* Ask the manager to authenticate this request for us */
|
||||
g_signal_emit (self, signals[AUTH_REQUEST], 0,
|
||||
context,
|
||||
invocation,
|
||||
nm_device_get_applied_connection (self),
|
||||
NM_AUTH_PERMISSION_NETWORK_CONTROL,
|
||||
TRUE,
|
||||
|
|
@ -10008,36 +10015,40 @@ get_applied_connection_cb (NMDevice *self,
|
|||
}
|
||||
|
||||
static void
|
||||
impl_device_get_applied_connection (NMDevice *self,
|
||||
GDBusMethodInvocation *context,
|
||||
guint32 flags)
|
||||
impl_device_get_applied_connection (NMDBusObject *obj,
|
||||
const NMDBusInterfaceInfoExtended *interface_info,
|
||||
const NMDBusMethodInfoExtended *method_info,
|
||||
GDBusConnection *connection,
|
||||
const char *sender,
|
||||
GDBusMethodInvocation *invocation,
|
||||
GVariant *parameters)
|
||||
{
|
||||
NMDevice *self = NM_DEVICE (obj);
|
||||
NMConnection *applied_connection;
|
||||
GError *error = NULL;
|
||||
guint32 flags;
|
||||
|
||||
g_return_if_fail (NM_IS_DEVICE (self));
|
||||
g_variant_get (parameters, "(u)", &flags);
|
||||
|
||||
/* No flags supported as of now. */
|
||||
if (flags != 0) {
|
||||
error = g_error_new_literal (NM_DEVICE_ERROR,
|
||||
NM_DEVICE_ERROR_FAILED,
|
||||
"Invalid flags specified");
|
||||
g_dbus_method_invocation_take_error (context, error);
|
||||
g_dbus_method_invocation_return_error_literal (invocation,
|
||||
NM_DEVICE_ERROR,
|
||||
NM_DEVICE_ERROR_FAILED,
|
||||
"Invalid flags specified");
|
||||
return;
|
||||
}
|
||||
|
||||
applied_connection = nm_device_get_applied_connection (self);
|
||||
if (!applied_connection) {
|
||||
error = g_error_new_literal (NM_DEVICE_ERROR,
|
||||
NM_DEVICE_ERROR_NOT_ACTIVE,
|
||||
"Device is not activated");
|
||||
g_dbus_method_invocation_take_error (context, error);
|
||||
g_dbus_method_invocation_return_error_literal (invocation,
|
||||
NM_DEVICE_ERROR,
|
||||
NM_DEVICE_ERROR_NOT_ACTIVE,
|
||||
"Device is not activated");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Ask the manager to authenticate this request for us */
|
||||
g_signal_emit (self, signals[AUTH_REQUEST], 0,
|
||||
context,
|
||||
invocation,
|
||||
applied_connection,
|
||||
NM_AUTH_PERMISSION_NETWORK_CONTROL,
|
||||
TRUE,
|
||||
|
|
@ -10186,25 +10197,31 @@ _clear_queued_act_request (NMDevicePrivate *priv)
|
|||
}
|
||||
|
||||
static void
|
||||
impl_device_disconnect (NMDevice *self, GDBusMethodInvocation *context)
|
||||
impl_device_disconnect (NMDBusObject *obj,
|
||||
const NMDBusInterfaceInfoExtended *interface_info,
|
||||
const NMDBusMethodInfoExtended *method_info,
|
||||
GDBusConnection *dbus_connection,
|
||||
const char *sender,
|
||||
GDBusMethodInvocation *invocation,
|
||||
GVariant *parameters)
|
||||
{
|
||||
NMDevice *self = NM_DEVICE (obj);
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
||||
NMConnection *connection;
|
||||
GError *error = NULL;
|
||||
|
||||
if (NM_DEVICE_GET_PRIVATE (self)->act_request == NULL) {
|
||||
error = g_error_new_literal (NM_DEVICE_ERROR,
|
||||
NM_DEVICE_ERROR_NOT_ACTIVE,
|
||||
"This device is not active");
|
||||
g_dbus_method_invocation_take_error (context, error);
|
||||
if (!priv->act_request) {
|
||||
g_dbus_method_invocation_return_error_literal (invocation,
|
||||
NM_DEVICE_ERROR,
|
||||
NM_DEVICE_ERROR_NOT_ACTIVE,
|
||||
"This device is not active");
|
||||
return;
|
||||
}
|
||||
|
||||
connection = nm_device_get_applied_connection (self);
|
||||
g_assert (connection);
|
||||
nm_assert (connection);
|
||||
|
||||
/* Ask the manager to authenticate this request for us */
|
||||
g_signal_emit (self, signals[AUTH_REQUEST], 0,
|
||||
context,
|
||||
invocation,
|
||||
connection,
|
||||
NM_AUTH_PERMISSION_NETWORK_CONTROL,
|
||||
TRUE,
|
||||
|
|
@ -10236,21 +10253,27 @@ delete_cb (NMDevice *self,
|
|||
}
|
||||
|
||||
static void
|
||||
impl_device_delete (NMDevice *self, GDBusMethodInvocation *context)
|
||||
impl_device_delete (NMDBusObject *obj,
|
||||
const NMDBusInterfaceInfoExtended *interface_info,
|
||||
const NMDBusMethodInfoExtended *method_info,
|
||||
GDBusConnection *connection,
|
||||
const char *sender,
|
||||
GDBusMethodInvocation *invocation,
|
||||
GVariant *parameters)
|
||||
{
|
||||
GError *error = NULL;
|
||||
NMDevice *self = NM_DEVICE (obj);
|
||||
|
||||
if (!nm_device_is_software (self) || !nm_device_is_real (self)) {
|
||||
error = g_error_new_literal (NM_DEVICE_ERROR,
|
||||
NM_DEVICE_ERROR_NOT_SOFTWARE,
|
||||
"This device is not a software device or is not realized");
|
||||
g_dbus_method_invocation_take_error (context, error);
|
||||
if ( !nm_device_is_software (self)
|
||||
|| !nm_device_is_real (self)) {
|
||||
g_dbus_method_invocation_return_error_literal (invocation,
|
||||
NM_DEVICE_ERROR,
|
||||
NM_DEVICE_ERROR_NOT_SOFTWARE,
|
||||
"This device is not a software device or is not realized");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Ask the manager to authenticate this request for us */
|
||||
g_signal_emit (self, signals[AUTH_REQUEST], 0,
|
||||
context,
|
||||
invocation,
|
||||
NULL,
|
||||
NM_AUTH_PERMISSION_NETWORK_CONTROL,
|
||||
TRUE,
|
||||
|
|
@ -10544,23 +10567,23 @@ nm_device_set_ip4_config (NMDevice *self,
|
|||
nm_ip4_config_replace (old_config, new_config, &has_changes);
|
||||
if (has_changes) {
|
||||
_LOGD (LOGD_IP4, "ip4-config: update IP4Config instance (%s)",
|
||||
nm_exported_object_get_path (NM_EXPORTED_OBJECT (old_config)));
|
||||
nm_dbus_object_get_path (NM_DBUS_OBJECT (old_config)));
|
||||
}
|
||||
} else {
|
||||
has_changes = TRUE;
|
||||
priv->ip4_config = g_object_ref (new_config);
|
||||
|
||||
if (success && !nm_exported_object_is_exported (NM_EXPORTED_OBJECT (new_config)))
|
||||
nm_exported_object_export (NM_EXPORTED_OBJECT (new_config));
|
||||
if (success && !nm_dbus_object_is_exported (NM_DBUS_OBJECT (new_config)))
|
||||
nm_dbus_object_export (NM_DBUS_OBJECT (new_config));
|
||||
|
||||
_LOGD (LOGD_IP4, "ip4-config: set IP4Config instance (%s)",
|
||||
nm_exported_object_get_path (NM_EXPORTED_OBJECT (new_config)));
|
||||
nm_dbus_object_get_path (NM_DBUS_OBJECT (new_config)));
|
||||
}
|
||||
} else if (old_config) {
|
||||
has_changes = TRUE;
|
||||
priv->ip4_config = NULL;
|
||||
_LOGD (LOGD_IP4, "ip4-config: clear IP4Config instance (%s)",
|
||||
nm_exported_object_get_path (NM_EXPORTED_OBJECT (old_config)));
|
||||
nm_dbus_object_get_path (NM_DBUS_OBJECT (old_config)));
|
||||
/* Device config is invalid if combined config is invalid */
|
||||
applied_config_clear (&priv->dev_ip4_config);
|
||||
}
|
||||
|
|
@ -10580,7 +10603,7 @@ nm_device_set_ip4_config (NMDevice *self,
|
|||
g_signal_emit (self, signals[IP4_CONFIG_CHANGED], 0, priv->ip4_config, old_config);
|
||||
|
||||
if (old_config != priv->ip4_config)
|
||||
nm_exported_object_clear_and_unexport (&old_config);
|
||||
nm_dbus_object_clear_and_unexport (&old_config);
|
||||
|
||||
if ( nm_device_sys_iface_state_is_external (self)
|
||||
&& (settings_connection = nm_device_get_settings_connection (self))
|
||||
|
|
@ -10717,24 +10740,24 @@ nm_device_set_ip6_config (NMDevice *self,
|
|||
nm_ip6_config_replace (old_config, new_config, &has_changes);
|
||||
if (has_changes) {
|
||||
_LOGD (LOGD_IP6, "ip6-config: update IP6Config instance (%s)",
|
||||
nm_exported_object_get_path (NM_EXPORTED_OBJECT (old_config)));
|
||||
nm_dbus_object_get_path (NM_DBUS_OBJECT (old_config)));
|
||||
}
|
||||
} else {
|
||||
has_changes = TRUE;
|
||||
priv->ip6_config = g_object_ref (new_config);
|
||||
|
||||
if (success && !nm_exported_object_is_exported (NM_EXPORTED_OBJECT (new_config)))
|
||||
nm_exported_object_export (NM_EXPORTED_OBJECT (new_config));
|
||||
if (success && !nm_dbus_object_is_exported (NM_DBUS_OBJECT (new_config)))
|
||||
nm_dbus_object_export (NM_DBUS_OBJECT (new_config));
|
||||
|
||||
_LOGD (LOGD_IP6, "ip6-config: set IP6Config instance (%s)",
|
||||
nm_exported_object_get_path (NM_EXPORTED_OBJECT (new_config)));
|
||||
nm_dbus_object_get_path (NM_DBUS_OBJECT (new_config)));
|
||||
}
|
||||
} else if (old_config) {
|
||||
has_changes = TRUE;
|
||||
priv->ip6_config = NULL;
|
||||
priv->needs_ip6_subnet = FALSE;
|
||||
_LOGD (LOGD_IP6, "ip6-config: clear IP6Config instance (%s)",
|
||||
nm_exported_object_get_path (NM_EXPORTED_OBJECT (old_config)));
|
||||
nm_dbus_object_get_path (NM_DBUS_OBJECT (old_config)));
|
||||
}
|
||||
|
||||
if (has_changes) {
|
||||
|
|
@ -10745,7 +10768,7 @@ nm_device_set_ip6_config (NMDevice *self,
|
|||
g_signal_emit (self, signals[IP6_CONFIG_CHANGED], 0, priv->ip6_config, old_config);
|
||||
|
||||
if (old_config != priv->ip6_config)
|
||||
nm_exported_object_clear_and_unexport (&old_config);
|
||||
nm_dbus_object_clear_and_unexport (&old_config);
|
||||
|
||||
if ( nm_device_sys_iface_state_is_external (self)
|
||||
&& (settings_connection = nm_device_get_settings_connection (self))
|
||||
|
|
@ -13484,6 +13507,13 @@ _set_state_full (NMDevice *self,
|
|||
|
||||
_notify (self, PROP_STATE);
|
||||
_notify (self, PROP_STATE_REASON);
|
||||
nm_dbus_object_emit_signal (NM_DBUS_OBJECT (self),
|
||||
&interface_info_device,
|
||||
&signal_info_state_changed,
|
||||
"(uuu)",
|
||||
(guint32) state,
|
||||
(guint32) old_state,
|
||||
(guint32) reason);
|
||||
g_signal_emit (self, signals[STATE_CHANGED], 0, (guint) state, (guint) old_state, (guint) reason);
|
||||
|
||||
/* Post-process the event after internal notification */
|
||||
|
|
@ -14997,16 +15027,16 @@ get_property (GObject *object, guint prop_id,
|
|||
g_value_set_uint (value, priv->mtu);
|
||||
break;
|
||||
case PROP_IP4_CONFIG:
|
||||
nm_utils_g_value_set_object_path (value, ip_config_valid (priv->state) ? priv->ip4_config : NULL);
|
||||
nm_dbus_utils_g_value_set_object_path (value, ip_config_valid (priv->state) ? priv->ip4_config : NULL);
|
||||
break;
|
||||
case PROP_DHCP4_CONFIG:
|
||||
nm_utils_g_value_set_object_path (value, ip_config_valid (priv->state) ? priv->dhcp4.config : NULL);
|
||||
nm_dbus_utils_g_value_set_object_path (value, ip_config_valid (priv->state) ? priv->dhcp4.config : NULL);
|
||||
break;
|
||||
case PROP_IP6_CONFIG:
|
||||
nm_utils_g_value_set_object_path (value, ip_config_valid (priv->state) ? priv->ip6_config : NULL);
|
||||
nm_dbus_utils_g_value_set_object_path (value, ip_config_valid (priv->state) ? priv->ip6_config : NULL);
|
||||
break;
|
||||
case PROP_DHCP6_CONFIG:
|
||||
nm_utils_g_value_set_object_path (value, ip_config_valid (priv->state) ? priv->dhcp6.config : NULL);
|
||||
nm_dbus_utils_g_value_set_object_path (value, ip_config_valid (priv->state) ? priv->dhcp6.config : NULL);
|
||||
break;
|
||||
case PROP_STATE:
|
||||
g_value_set_uint (value, priv->state);
|
||||
|
|
@ -15016,7 +15046,7 @@ get_property (GObject *object, guint prop_id,
|
|||
g_variant_new ("(uu)", priv->state, priv->state_reason));
|
||||
break;
|
||||
case PROP_ACTIVE_CONNECTION:
|
||||
nm_utils_g_value_set_object_path (value, priv->act_request_public ? priv->act_request : NULL);
|
||||
nm_dbus_utils_g_value_set_object_path (value, priv->act_request_public ? priv->act_request : NULL);
|
||||
break;
|
||||
case PROP_DEVICE_TYPE:
|
||||
g_value_set_uint (value, priv->type);
|
||||
|
|
@ -15061,7 +15091,7 @@ get_property (GObject *object, guint prop_id,
|
|||
g_value_set_object (value, nm_device_get_master (self));
|
||||
break;
|
||||
case PROP_PARENT:
|
||||
nm_utils_g_value_set_object_path (value, priv->parent_device);
|
||||
nm_dbus_utils_g_value_set_object_path (value, priv->parent_device);
|
||||
break;
|
||||
case PROP_HW_ADDRESS:
|
||||
g_value_set_string (value, priv->hw_addr);
|
||||
|
|
@ -15106,7 +15136,7 @@ get_property (GObject *object, guint prop_id,
|
|||
|
||||
if (!NM_DEVICE_GET_PRIVATE (info->slave)->is_enslaved)
|
||||
continue;
|
||||
path = nm_exported_object_get_path ((NMExportedObject *) info->slave);
|
||||
path = nm_dbus_object_get_path (NM_DBUS_OBJECT (info->slave));
|
||||
if (path)
|
||||
slave_list[i++] = g_strdup (path);
|
||||
}
|
||||
|
|
@ -15133,15 +15163,115 @@ get_property (GObject *object, guint prop_id,
|
|||
}
|
||||
}
|
||||
|
||||
static const GDBusSignalInfo signal_info_state_changed = NM_DEFINE_GDBUS_SIGNAL_INFO_INIT (
|
||||
"StateChanged",
|
||||
.args = NM_DEFINE_GDBUS_ARG_INFOS (
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("new_state", "u"),
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("old_state", "u"),
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("reason", "u"),
|
||||
),
|
||||
);
|
||||
|
||||
static const NMDBusInterfaceInfoExtended interface_info_device = {
|
||||
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
|
||||
NM_DBUS_INTERFACE_DEVICE,
|
||||
.methods = NM_DEFINE_GDBUS_METHOD_INFOS (
|
||||
NM_DEFINE_DBUS_METHOD_INFO_EXTENDED (
|
||||
NM_DEFINE_GDBUS_METHOD_INFO_INIT (
|
||||
"Reapply",
|
||||
.in_args = NM_DEFINE_GDBUS_ARG_INFOS (
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("connection", "a{sa{sv}}"),
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("version_id", "t"),
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("flags", "u"),
|
||||
),
|
||||
),
|
||||
.handle = impl_device_reapply,
|
||||
),
|
||||
NM_DEFINE_DBUS_METHOD_INFO_EXTENDED (
|
||||
NM_DEFINE_GDBUS_METHOD_INFO_INIT (
|
||||
"GetAppliedConnection",
|
||||
.in_args = NM_DEFINE_GDBUS_ARG_INFOS (
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("flags", "u"),
|
||||
),
|
||||
.out_args = NM_DEFINE_GDBUS_ARG_INFOS (
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("connection", "a{sa{sv}}"),
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("version_id", "t"),
|
||||
),
|
||||
),
|
||||
.handle = impl_device_get_applied_connection,
|
||||
),
|
||||
NM_DEFINE_DBUS_METHOD_INFO_EXTENDED (
|
||||
NM_DEFINE_GDBUS_METHOD_INFO_INIT (
|
||||
"Disconnect",
|
||||
),
|
||||
.handle = impl_device_disconnect,
|
||||
),
|
||||
NM_DEFINE_DBUS_METHOD_INFO_EXTENDED (
|
||||
NM_DEFINE_GDBUS_METHOD_INFO_INIT (
|
||||
"Delete",
|
||||
),
|
||||
.handle = impl_device_delete,
|
||||
),
|
||||
),
|
||||
.signals = NM_DEFINE_GDBUS_SIGNAL_INFOS (
|
||||
&signal_info_state_changed,
|
||||
),
|
||||
.properties = NM_DEFINE_GDBUS_PROPERTY_INFOS (
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Udi", "s", NM_DEVICE_UDI),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Interface", "s", NM_DEVICE_IFACE),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("IpInterface", "s", NM_DEVICE_IP_IFACE),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Driver", "s", NM_DEVICE_DRIVER),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("DriverVersion", "s", NM_DEVICE_DRIVER_VERSION),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("FirmwareVersion", "s", NM_DEVICE_FIRMWARE_VERSION),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Capabilities", "u", NM_DEVICE_CAPABILITIES),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Ip4Address", "u", NM_DEVICE_IP4_ADDRESS),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("State", "u", NM_DEVICE_STATE),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("StateReason", "(uu)", NM_DEVICE_STATE_REASON),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("ActiveConnection", "o", NM_DEVICE_ACTIVE_CONNECTION),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Ip4Config", "o", NM_DEVICE_IP4_CONFIG),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Dhcp4Config", "o", NM_DEVICE_DHCP4_CONFIG),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Ip6Config", "o", NM_DEVICE_IP6_CONFIG),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Dhcp6Config", "o", NM_DEVICE_DHCP6_CONFIG),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READWRITABLE_L ("Managed", "b", NM_DEVICE_MANAGED, NM_AUTH_PERMISSION_NETWORK_CONTROL, NM_AUDIT_OP_DEVICE_MANAGED),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READWRITABLE_L ("Autoconnect", "b", NM_DEVICE_AUTOCONNECT, NM_AUTH_PERMISSION_NETWORK_CONTROL, NM_AUDIT_OP_DEVICE_AUTOCONNECT),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("FirmwareMissing", "b", NM_DEVICE_FIRMWARE_MISSING),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("NmPluginMissing", "b", NM_DEVICE_NM_PLUGIN_MISSING),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("DeviceType", "u", NM_DEVICE_DEVICE_TYPE),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("AvailableConnections", "ao", NM_DEVICE_AVAILABLE_CONNECTIONS),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("PhysicalPortId", "s", NM_DEVICE_PHYSICAL_PORT_ID),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Mtu", "u", NM_DEVICE_MTU),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Metered", "u", NM_DEVICE_METERED),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("LldpNeighbors", "aa{sv}", NM_DEVICE_LLDP_NEIGHBORS),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Real", "b", NM_DEVICE_REAL),
|
||||
),
|
||||
),
|
||||
};
|
||||
|
||||
const NMDBusInterfaceInfoExtended nm_interface_info_device_statistics = {
|
||||
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
|
||||
NM_DBUS_INTERFACE_DEVICE_STATISTICS,
|
||||
.signals = NM_DEFINE_GDBUS_SIGNAL_INFOS (
|
||||
&nm_signal_info_property_changed_legacy,
|
||||
),
|
||||
.properties = NM_DEFINE_GDBUS_PROPERTY_INFOS (
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READWRITABLE ("RefreshRateMs", "u", NM_DEVICE_STATISTICS_REFRESH_RATE_MS, NM_AUTH_PERMISSION_ENABLE_DISABLE_STATISTICS, NM_AUDIT_OP_STATISTICS),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE ("TxBytes", "t", NM_DEVICE_STATISTICS_TX_BYTES),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE ("RxBytes", "t", NM_DEVICE_STATISTICS_RX_BYTES),
|
||||
),
|
||||
),
|
||||
};
|
||||
|
||||
static void
|
||||
nm_device_class_init (NMDeviceClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
NMExportedObjectClass *exported_object_class = NM_EXPORTED_OBJECT_CLASS (klass);
|
||||
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass);
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (NMDevicePrivate));
|
||||
|
||||
exported_object_class->export_path = NM_EXPORT_PATH_NUMBERED (NM_DBUS_PATH"/Devices");
|
||||
dbus_object_class->export_path = NM_EXPORT_PATH_NUMBERED (NM_DBUS_PATH"/Devices");
|
||||
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device,
|
||||
&nm_interface_info_device_statistics);
|
||||
|
||||
object_class->dispose = dispose;
|
||||
object_class->finalize = finalize;
|
||||
|
|
@ -15373,7 +15503,6 @@ nm_device_class_init (NMDeviceClass *klass)
|
|||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/* Statistics */
|
||||
obj_properties[PROP_REFRESH_RATE_MS] =
|
||||
g_param_spec_uint (NM_DEVICE_STATISTICS_REFRESH_RATE_MS, "", "",
|
||||
0, UINT32_MAX, 0,
|
||||
|
|
@ -15390,7 +15519,6 @@ nm_device_class_init (NMDeviceClass *klass)
|
|||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/* Connectivity */
|
||||
obj_properties[PROP_CONNECTIVITY] =
|
||||
g_param_spec_uint (NM_DEVICE_CONNECTIVITY, "", "",
|
||||
NM_CONNECTIVITY_UNKNOWN, NM_CONNECTIVITY_FULL, NM_CONNECTIVITY_UNKNOWN,
|
||||
|
|
@ -15472,16 +15600,4 @@ nm_device_class_init (NMDeviceClass *klass)
|
|||
G_SIGNAL_RUN_FIRST,
|
||||
0, NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass),
|
||||
NMDBUS_TYPE_DEVICE_SKELETON,
|
||||
"Reapply", impl_device_reapply,
|
||||
"GetAppliedConnection", impl_device_get_applied_connection,
|
||||
"Disconnect", impl_device_disconnect,
|
||||
"Delete", impl_device_delete,
|
||||
NULL);
|
||||
|
||||
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass),
|
||||
NMDBUS_TYPE_DEVICE_STATISTICS_SKELETON,
|
||||
NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
#include <netinet/in.h>
|
||||
|
||||
#include "nm-setting-connection.h"
|
||||
#include "nm-exported-object.h"
|
||||
#include "nm-dbus-object.h"
|
||||
#include "nm-dbus-interface.h"
|
||||
#include "nm-connection.h"
|
||||
#include "nm-rfkill-manager.h"
|
||||
|
|
@ -114,8 +114,7 @@ nm_device_state_reason_check (NMDeviceStateReason reason)
|
|||
#define NM_DEVICE_PARENT "parent"
|
||||
|
||||
/* the "slaves" property is internal in the parent class, but exposed
|
||||
* by the derived classes NMDeviceBond, NMDeviceBridge and NMDeviceTeam.
|
||||
* It is thus important that the property name matches. */
|
||||
* by the derived classes NMDeviceBond, NMDeviceBridge and NMDeviceTeam. */
|
||||
#define NM_DEVICE_SLAVES "slaves" /* partially internal */
|
||||
|
||||
#define NM_DEVICE_TYPE_DESC "type-desc" /* Internal only */
|
||||
|
|
@ -173,9 +172,7 @@ typedef enum { /*< skip >*/
|
|||
struct _NMDevicePrivate;
|
||||
|
||||
struct _NMDevice {
|
||||
NMExportedObject parent;
|
||||
|
||||
/* private */
|
||||
NMDBusObject parent;
|
||||
struct _NMDevicePrivate *_priv;
|
||||
};
|
||||
|
||||
|
|
@ -191,7 +188,7 @@ typedef enum { /*< skip >*/
|
|||
} NMDeviceCheckDevAvailableFlags;
|
||||
|
||||
typedef struct {
|
||||
NMExportedObjectClass parent;
|
||||
NMDBusObjectClass parent;
|
||||
|
||||
const char *default_type_description;
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ sources = files(
|
|||
|
||||
deps = [
|
||||
jansson_dep,
|
||||
libnmdbus_dep,
|
||||
nm_dep
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -28,10 +28,8 @@
|
|||
#include "nm-setting-connection.h"
|
||||
#include "nm-setting-ovs-bridge.h"
|
||||
|
||||
#include "introspection/org.freedesktop.NetworkManager.Device.OvsBridge.h"
|
||||
|
||||
#include "devices/nm-device-logging.h"
|
||||
_LOG_DECLARE_SELF(NMDeviceOvsBridge);
|
||||
_LOG_DECLARE_SELF (NMDeviceOvsBridge);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
|
@ -133,11 +131,24 @@ nm_device_ovs_bridge_init (NMDeviceOvsBridge *self)
|
|||
{
|
||||
}
|
||||
|
||||
static const NMDBusInterfaceInfoExtended interface_info_device_ovs_bridge = {
|
||||
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
|
||||
NM_DBUS_INTERFACE_DEVICE_OVS_BRIDGE,
|
||||
.signals = NM_DEFINE_GDBUS_SIGNAL_INFOS (
|
||||
&nm_signal_info_property_changed_legacy,
|
||||
),
|
||||
),
|
||||
.legacy_property_changed = TRUE,
|
||||
};
|
||||
|
||||
static void
|
||||
nm_device_ovs_bridge_class_init (NMDeviceOvsBridgeClass *klass)
|
||||
{
|
||||
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass);
|
||||
NMDeviceClass *device_class = NM_DEVICE_CLASS (klass);
|
||||
|
||||
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_ovs_bridge);
|
||||
|
||||
device_class->connection_type = NM_SETTING_OVS_BRIDGE_SETTING_NAME;
|
||||
device_class->is_master = TRUE;
|
||||
device_class->get_type_description = get_type_description;
|
||||
|
|
@ -149,8 +160,4 @@ nm_device_ovs_bridge_class_init (NMDeviceOvsBridgeClass *klass)
|
|||
device_class->act_stage3_ip6_config_start = act_stage3_ip6_config_start;
|
||||
device_class->enslave_slave = enslave_slave;
|
||||
device_class->release_slave = release_slave;
|
||||
|
||||
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass),
|
||||
NMDBUS_TYPE_DEVICE_OVS_BRIDGE_SKELETON,
|
||||
NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,8 +28,6 @@
|
|||
#include "nm-setting-ovs-interface.h"
|
||||
#include "nm-setting-ovs-port.h"
|
||||
|
||||
#include "introspection/org.freedesktop.NetworkManager.Device.OvsInterface.h"
|
||||
|
||||
#include "devices/nm-device-logging.h"
|
||||
_LOG_DECLARE_SELF(NMDeviceOvsInterface);
|
||||
|
||||
|
|
@ -185,13 +183,26 @@ nm_device_ovs_interface_init (NMDeviceOvsInterface *self)
|
|||
{
|
||||
}
|
||||
|
||||
static const NMDBusInterfaceInfoExtended interface_info_device_ovs_interface = {
|
||||
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
|
||||
NM_DBUS_INTERFACE_DEVICE_OVS_INTERFACE,
|
||||
.signals = NM_DEFINE_GDBUS_SIGNAL_INFOS (
|
||||
&nm_signal_info_property_changed_legacy,
|
||||
),
|
||||
),
|
||||
.legacy_property_changed = TRUE,
|
||||
};
|
||||
|
||||
static void
|
||||
nm_device_ovs_interface_class_init (NMDeviceOvsInterfaceClass *klass)
|
||||
{
|
||||
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass);
|
||||
NMDeviceClass *device_class = NM_DEVICE_CLASS (klass);
|
||||
|
||||
NM_DEVICE_CLASS_DECLARE_TYPES (klass, NULL, NM_LINK_TYPE_OPENVSWITCH);
|
||||
|
||||
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_ovs_interface);
|
||||
|
||||
device_class->connection_type = NM_SETTING_OVS_INTERFACE_SETTING_NAME;
|
||||
device_class->get_type_description = get_type_description;
|
||||
device_class->create_and_realize = create_and_realize;
|
||||
|
|
@ -202,8 +213,4 @@ nm_device_ovs_interface_class_init (NMDeviceOvsInterfaceClass *klass)
|
|||
device_class->act_stage3_ip4_config_start = act_stage3_ip4_config_start;
|
||||
device_class->act_stage3_ip6_config_start = act_stage3_ip6_config_start;
|
||||
device_class->can_unmanaged_external_down = can_unmanaged_external_down;
|
||||
|
||||
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass),
|
||||
NMDBUS_TYPE_DEVICE_OVS_INTERFACE_SKELETON,
|
||||
NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,10 +28,8 @@
|
|||
#include "nm-setting-ovs-port.h"
|
||||
#include "nm-setting-ovs-port.h"
|
||||
|
||||
#include "introspection/org.freedesktop.NetworkManager.Device.OvsPort.h"
|
||||
|
||||
#include "devices/nm-device-logging.h"
|
||||
_LOG_DECLARE_SELF(NMDeviceOvsPort);
|
||||
_LOG_DECLARE_SELF (NMDeviceOvsPort);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
|
@ -180,11 +178,24 @@ nm_device_ovs_port_init (NMDeviceOvsPort *self)
|
|||
{
|
||||
}
|
||||
|
||||
static const NMDBusInterfaceInfoExtended interface_info_device_ovs_port = {
|
||||
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
|
||||
NM_DBUS_INTERFACE_DEVICE_OVS_PORT,
|
||||
.signals = NM_DEFINE_GDBUS_SIGNAL_INFOS (
|
||||
&nm_signal_info_property_changed_legacy,
|
||||
),
|
||||
),
|
||||
.legacy_property_changed = TRUE,
|
||||
};
|
||||
|
||||
static void
|
||||
nm_device_ovs_port_class_init (NMDeviceOvsPortClass *klass)
|
||||
{
|
||||
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass);
|
||||
NMDeviceClass *device_class = NM_DEVICE_CLASS (klass);
|
||||
|
||||
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_ovs_port);
|
||||
|
||||
device_class->connection_type = NM_SETTING_OVS_PORT_SETTING_NAME;
|
||||
device_class->is_master = TRUE;
|
||||
device_class->get_type_description = get_type_description;
|
||||
|
|
@ -195,8 +206,4 @@ nm_device_ovs_port_class_init (NMDeviceOvsPortClass *klass)
|
|||
device_class->act_stage3_ip6_config_start = act_stage3_ip6_config_start;
|
||||
device_class->enslave_slave = enslave_slave;
|
||||
device_class->release_slave = release_slave;
|
||||
|
||||
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass),
|
||||
NMDBUS_TYPE_DEVICE_OVS_PORT_SKELETON,
|
||||
NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ sources = files(
|
|||
|
||||
deps = [
|
||||
jansson_dep,
|
||||
libnmdbus_dep,
|
||||
libteamdctl_dep,
|
||||
nm_dep
|
||||
]
|
||||
|
|
|
|||
|
|
@ -37,8 +37,6 @@
|
|||
#include "nm-ip4-config.h"
|
||||
#include "nm-dbus-compat.h"
|
||||
|
||||
#include "introspection/org.freedesktop.NetworkManager.Device.Team.h"
|
||||
|
||||
#include "devices/nm-device-logging.h"
|
||||
_LOG_DECLARE_SELF(NMDeviceTeam);
|
||||
|
||||
|
|
@ -891,10 +889,27 @@ dispose (GObject *object)
|
|||
G_OBJECT_CLASS (nm_device_team_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static const NMDBusInterfaceInfoExtended interface_info_device_team = {
|
||||
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
|
||||
NM_DBUS_INTERFACE_DEVICE_TEAM,
|
||||
.signals = NM_DEFINE_GDBUS_SIGNAL_INFOS (
|
||||
&nm_signal_info_property_changed_legacy,
|
||||
),
|
||||
.properties = NM_DEFINE_GDBUS_PROPERTY_INFOS (
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("HwAddress", "s", NM_DEVICE_HW_ADDRESS),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Carrier", "b", NM_DEVICE_CARRIER),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Slaves", "ao", NM_DEVICE_SLAVES),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Config", "s", NM_DEVICE_TEAM_CONFIG),
|
||||
),
|
||||
),
|
||||
.legacy_property_changed = TRUE,
|
||||
};
|
||||
|
||||
static void
|
||||
nm_device_team_class_init (NMDeviceTeamClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass);
|
||||
NMDeviceClass *parent_class = NM_DEVICE_CLASS (klass);
|
||||
|
||||
NM_DEVICE_CLASS_DECLARE_TYPES (klass, NM_SETTING_TEAM_SETTING_NAME, NM_LINK_TYPE_TEAM)
|
||||
|
|
@ -903,6 +918,8 @@ nm_device_team_class_init (NMDeviceTeamClass *klass)
|
|||
object_class->dispose = dispose;
|
||||
object_class->get_property = get_property;
|
||||
|
||||
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_team);
|
||||
|
||||
parent_class->is_master = TRUE;
|
||||
parent_class->create_and_realize = create_and_realize;
|
||||
parent_class->get_generic_capabilities = get_generic_capabilities;
|
||||
|
|
@ -924,8 +941,4 @@ nm_device_team_class_init (NMDeviceTeamClass *klass)
|
|||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
||||
|
||||
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass),
|
||||
NMDBUS_TYPE_DEVICE_TEAM_SKELETON,
|
||||
NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ common_sources = files(
|
|||
|
||||
sources = common_sources + files(
|
||||
'nm-wifi-factory.c',
|
||||
'nm-wifi-common.c',
|
||||
'nm-device-wifi.c',
|
||||
'nm-device-olpc-mesh.c'
|
||||
)
|
||||
|
|
@ -17,7 +18,6 @@ if enable_iwd
|
|||
endif
|
||||
|
||||
deps = [
|
||||
libnmdbus_dep,
|
||||
nm_dep
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -36,12 +36,11 @@
|
|||
#include "settings/nm-settings-connection.h"
|
||||
#include "settings/nm-settings.h"
|
||||
#include "nm-wifi-utils.h"
|
||||
#include "nm-wifi-common.h"
|
||||
#include "nm-core-internal.h"
|
||||
#include "nm-config.h"
|
||||
#include "nm-iwd-manager.h"
|
||||
|
||||
#include "introspection/org.freedesktop.NetworkManager.Device.Wireless.h"
|
||||
|
||||
#include "devices/nm-device-logging.h"
|
||||
_LOG_DECLARE_SELF(NMDeviceIwd);
|
||||
|
||||
|
|
@ -57,8 +56,6 @@ NM_GOBJECT_PROPERTIES_DEFINE (NMDeviceIwd,
|
|||
);
|
||||
|
||||
enum {
|
||||
ACCESS_POINT_ADDED,
|
||||
ACCESS_POINT_REMOVED,
|
||||
SCANNING_PROHIBITED,
|
||||
|
||||
LAST_SIGNAL
|
||||
|
|
@ -122,30 +119,42 @@ _ap_dump (NMDeviceIwd *self,
|
|||
nm_wifi_ap_to_string (ap, buf, sizeof (buf), now_s));
|
||||
}
|
||||
|
||||
static void
|
||||
_emit_access_point_added_removed (NMDeviceIwd *self,
|
||||
NMWifiAP *ap,
|
||||
gboolean is_added /* or else is removed */)
|
||||
{
|
||||
nm_dbus_object_emit_signal (NM_DBUS_OBJECT (self),
|
||||
&nm_interface_info_device_wireless,
|
||||
is_added
|
||||
? &nm_signal_info_wireless_access_point_added
|
||||
: &nm_signal_info_wireless_access_point_removed,
|
||||
"(o)",
|
||||
nm_dbus_object_get_path (NM_DBUS_OBJECT (ap)));
|
||||
}
|
||||
|
||||
/* Callers ensure we're not removing current_ap */
|
||||
static void
|
||||
ap_add_remove (NMDeviceIwd *self,
|
||||
guint signum,
|
||||
gboolean is_adding, /* or else is removing */
|
||||
NMWifiAP *ap,
|
||||
gboolean recheck_available_connections)
|
||||
{
|
||||
NMDeviceIwdPrivate *priv = NM_DEVICE_IWD_GET_PRIVATE (self);
|
||||
|
||||
nm_assert (NM_IN_SET (signum, ACCESS_POINT_ADDED, ACCESS_POINT_REMOVED));
|
||||
|
||||
if (signum == ACCESS_POINT_ADDED) {
|
||||
if (is_adding) {
|
||||
g_hash_table_insert (priv->aps,
|
||||
(gpointer) nm_exported_object_export ((NMExportedObject *) ap),
|
||||
(gpointer) nm_dbus_object_export (NM_DBUS_OBJECT (ap)),
|
||||
g_object_ref (ap));
|
||||
_ap_dump (self, LOGL_DEBUG, ap, "added", 0);
|
||||
} else
|
||||
_ap_dump (self, LOGL_DEBUG, ap, "removed", 0);
|
||||
|
||||
g_signal_emit (self, signals[signum], 0, ap);
|
||||
_emit_access_point_added_removed (self, ap, is_adding);
|
||||
|
||||
if (signum == ACCESS_POINT_REMOVED) {
|
||||
g_hash_table_remove (priv->aps, nm_exported_object_get_path ((NMExportedObject *) ap));
|
||||
nm_exported_object_unexport ((NMExportedObject *) ap);
|
||||
if (!is_adding) {
|
||||
g_hash_table_remove (priv->aps, nm_dbus_object_get_path (NM_DBUS_OBJECT (ap)));
|
||||
nm_dbus_object_unexport (NM_DBUS_OBJECT (ap));
|
||||
g_object_unref (ap);
|
||||
}
|
||||
|
||||
|
|
@ -177,7 +186,7 @@ set_current_ap (NMDeviceIwd *self, NMWifiAP *new_ap, gboolean recheck_available_
|
|||
|
||||
if (old_ap) {
|
||||
if (nm_wifi_ap_get_fake (old_ap))
|
||||
ap_add_remove (self, ACCESS_POINT_REMOVED, old_ap, recheck_available_connections);
|
||||
ap_add_remove (self, FALSE, old_ap, recheck_available_connections);
|
||||
g_object_unref (old_ap);
|
||||
}
|
||||
|
||||
|
|
@ -217,9 +226,9 @@ update_ap_func (gpointer key, gpointer value, gpointer user_data)
|
|||
|
||||
_ap_dump (self, LOGL_DEBUG, ap, "removed", 0);
|
||||
|
||||
g_signal_emit (self, signals[ACCESS_POINT_REMOVED], 0, ap);
|
||||
_emit_access_point_added_removed (self, ap, FALSE);
|
||||
|
||||
nm_exported_object_unexport ((NMExportedObject *) ap);
|
||||
nm_dbus_object_unexport (NM_DBUS_OBJECT (ap));
|
||||
g_object_unref (ap);
|
||||
|
||||
return TRUE;
|
||||
|
|
@ -351,7 +360,7 @@ get_ordered_networks_cb (GObject *source, GAsyncResult *res, gpointer user_data)
|
|||
|
||||
g_hash_table_iter_init (&ap_iter, priv->new_aps);
|
||||
while (g_hash_table_iter_next (&ap_iter, NULL, (gpointer) &ap)) {
|
||||
ap_add_remove (self, ACCESS_POINT_ADDED, ap, FALSE);
|
||||
ap_add_remove (self, TRUE, ap, FALSE);
|
||||
changed = TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -853,37 +862,17 @@ can_auto_connect (NMDevice *device,
|
|||
ap = nm_wifi_aps_find_first_compatible (priv->aps, connection, FALSE);
|
||||
if (ap) {
|
||||
/* All good; connection is usable */
|
||||
NM_SET_OUT (specific_object, g_strdup (nm_exported_object_get_path (NM_EXPORTED_OBJECT (ap))));
|
||||
NM_SET_OUT (specific_object, g_strdup (nm_dbus_object_get_path (NM_DBUS_OBJECT (ap))));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
impl_device_iwd_get_access_points (NMDeviceIwd *self,
|
||||
GDBusMethodInvocation *context)
|
||||
GHashTable *
|
||||
_nm_device_iwd_get_aps (NMDeviceIwd *self)
|
||||
{
|
||||
NMDeviceIwdPrivate *priv = NM_DEVICE_IWD_GET_PRIVATE (self);
|
||||
gs_free const char **list = NULL;
|
||||
GVariant *v;
|
||||
|
||||
list = nm_wifi_aps_get_sorted_paths (priv->aps, FALSE);
|
||||
v = g_variant_new_objv (list, -1);
|
||||
g_dbus_method_invocation_return_value (context, g_variant_new_tuple (&v, 1));
|
||||
}
|
||||
|
||||
static void
|
||||
impl_device_iwd_get_all_access_points (NMDeviceIwd *self,
|
||||
GDBusMethodInvocation *context)
|
||||
{
|
||||
NMDeviceIwdPrivate *priv = NM_DEVICE_IWD_GET_PRIVATE (self);
|
||||
gs_free const char **list = NULL;
|
||||
GVariant *v;
|
||||
|
||||
list = nm_wifi_aps_get_sorted_paths (priv->aps, TRUE);
|
||||
v = g_variant_new_objv (list, -1);
|
||||
g_dbus_method_invocation_return_value (context, g_variant_new_tuple (&v, 1));
|
||||
return NM_DEVICE_IWD_GET_PRIVATE (self)->aps;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
@ -982,10 +971,10 @@ dbus_request_scan_cb (NMDevice *device,
|
|||
g_dbus_method_invocation_return_value (context, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_device_iwd_request_scan (NMDeviceIwd *self,
|
||||
GDBusMethodInvocation *context,
|
||||
GVariant *options)
|
||||
void
|
||||
_nm_device_iwd_request_scan (NMDeviceIwd *self,
|
||||
GVariant *options,
|
||||
GDBusMethodInvocation *invocation)
|
||||
{
|
||||
NMDeviceIwdPrivate *priv = NM_DEVICE_IWD_GET_PRIVATE (self);
|
||||
NMDevice *device = NM_DEVICE (self);
|
||||
|
|
@ -994,17 +983,16 @@ impl_device_iwd_request_scan (NMDeviceIwd *self,
|
|||
|| !priv->dbus_obj
|
||||
|| nm_device_get_state (device) < NM_DEVICE_STATE_DISCONNECTED
|
||||
|| nm_device_is_activating (device)) {
|
||||
g_dbus_method_invocation_return_error_literal (context,
|
||||
g_dbus_method_invocation_return_error_literal (invocation,
|
||||
NM_DEVICE_ERROR,
|
||||
NM_DEVICE_ERROR_NOT_ALLOWED,
|
||||
"Scanning not allowed while unavailable");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Ask the manager to authenticate this request for us */
|
||||
g_signal_emit_by_name (device,
|
||||
NM_DEVICE_AUTH_REQUEST,
|
||||
context,
|
||||
invocation,
|
||||
NULL,
|
||||
NM_AUTH_PERMISSION_NETWORK_CONTROL,
|
||||
TRUE,
|
||||
|
|
@ -1270,7 +1258,7 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason)
|
|||
*/
|
||||
|
||||
nm_active_connection_set_specific_object (NM_ACTIVE_CONNECTION (req),
|
||||
nm_exported_object_get_path (NM_EXPORTED_OBJECT (ap)));
|
||||
nm_dbus_object_get_path (NM_DBUS_OBJECT (ap)));
|
||||
}
|
||||
|
||||
set_current_ap (self, ap, FALSE);
|
||||
|
|
@ -1575,7 +1563,7 @@ get_property (GObject *object, guint prop_id,
|
|||
g_value_take_boxed (value, list);
|
||||
break;
|
||||
case PROP_ACTIVE_ACCESS_POINT:
|
||||
nm_utils_g_value_set_object_path (value, priv->current_ap);
|
||||
nm_dbus_utils_g_value_set_object_path (value, priv->current_ap);
|
||||
break;
|
||||
case PROP_SCANNING:
|
||||
g_value_set_boolean (value, priv->scanning);
|
||||
|
|
@ -1898,6 +1886,7 @@ static void
|
|||
nm_device_iwd_class_init (NMDeviceIwdClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass);
|
||||
NMDeviceClass *parent_class = NM_DEVICE_CLASS (klass);
|
||||
|
||||
NM_DEVICE_CLASS_DECLARE_TYPES (klass, NM_SETTING_WIRELESS_SETTING_NAME, NM_LINK_TYPE_WIFI)
|
||||
|
|
@ -1907,6 +1896,8 @@ nm_device_iwd_class_init (NMDeviceIwdClass *klass)
|
|||
object_class->dispose = dispose;
|
||||
object_class->finalize = finalize;
|
||||
|
||||
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&nm_interface_info_device_wireless);
|
||||
|
||||
parent_class->can_auto_connect = can_auto_connect;
|
||||
parent_class->is_available = is_available;
|
||||
parent_class->get_autoconnect_allowed = get_autoconnect_allowed;
|
||||
|
|
@ -1970,24 +1961,6 @@ nm_device_iwd_class_init (NMDeviceIwdClass *klass)
|
|||
|
||||
g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
||||
|
||||
signals[ACCESS_POINT_ADDED] =
|
||||
g_signal_new (NM_DEVICE_IWD_ACCESS_POINT_ADDED,
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
0,
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1,
|
||||
NM_TYPE_WIFI_AP);
|
||||
|
||||
signals[ACCESS_POINT_REMOVED] =
|
||||
g_signal_new (NM_DEVICE_IWD_ACCESS_POINT_REMOVED,
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
0,
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1,
|
||||
NM_TYPE_WIFI_AP);
|
||||
|
||||
signals[SCANNING_PROHIBITED] =
|
||||
g_signal_new (NM_DEVICE_IWD_SCANNING_PROHIBITED,
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
|
|
@ -1995,11 +1968,4 @@ nm_device_iwd_class_init (NMDeviceIwdClass *klass)
|
|||
G_STRUCT_OFFSET (NMDeviceIwdClass, scanning_prohibited),
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_BOOLEAN, 1, G_TYPE_BOOLEAN);
|
||||
|
||||
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass),
|
||||
NMDBUS_TYPE_DEVICE_WIFI_SKELETON,
|
||||
"GetAccessPoints", impl_device_iwd_get_access_points,
|
||||
"GetAllAccessPoints", impl_device_iwd_get_all_access_points,
|
||||
"RequestScan", impl_device_iwd_request_scan,
|
||||
NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,11 +39,6 @@
|
|||
#define NM_DEVICE_IWD_CAPABILITIES NM_DEVICE_WIFI_CAPABILITIES
|
||||
#define NM_DEVICE_IWD_SCANNING NM_DEVICE_WIFI_SCANNING
|
||||
|
||||
/* signals */
|
||||
#define NM_DEVICE_IWD_ACCESS_POINT_ADDED NM_DEVICE_WIFI_ACCESS_POINT_ADDED
|
||||
#define NM_DEVICE_IWD_ACCESS_POINT_REMOVED NM_DEVICE_WIFI_ACCESS_POINT_REMOVED
|
||||
|
||||
/* internal signals */
|
||||
#define NM_DEVICE_IWD_SCANNING_PROHIBITED NM_DEVICE_WIFI_SCANNING_PROHIBITED
|
||||
|
||||
typedef struct _NMDeviceIwd NMDeviceIwd;
|
||||
|
|
@ -58,4 +53,10 @@ void nm_device_iwd_set_dbus_object (NMDeviceIwd *device, GDBusObject *object);
|
|||
gboolean nm_device_iwd_agent_psk_query (NMDeviceIwd *device,
|
||||
GDBusMethodInvocation *invocation);
|
||||
|
||||
GHashTable *_nm_device_iwd_get_aps (NMDeviceIwd *self);
|
||||
|
||||
void _nm_device_iwd_request_scan (NMDeviceIwd *self,
|
||||
GVariant *options,
|
||||
GDBusMethodInvocation *invocation);
|
||||
|
||||
#endif /* __NETWORKMANAGER_DEVICE_IWD_H__ */
|
||||
|
|
|
|||
|
|
@ -48,11 +48,6 @@
|
|||
#include "nm-manager.h"
|
||||
#include "platform/nm-platform.h"
|
||||
|
||||
/* This is a bug; but we can't really change API now... */
|
||||
#include "nm-vpn-dbus-interface.h"
|
||||
|
||||
#include "introspection/org.freedesktop.NetworkManager.Device.OlpcMesh.h"
|
||||
|
||||
#include "devices/nm-device-logging.h"
|
||||
_LOG_DECLARE_SELF(NMDeviceOlpcMesh);
|
||||
|
||||
|
|
@ -440,7 +435,7 @@ get_property (GObject *object, guint prop_id,
|
|||
|
||||
switch (prop_id) {
|
||||
case PROP_COMPANION:
|
||||
nm_utils_g_value_set_object_path (value, priv->companion);
|
||||
nm_dbus_utils_g_value_set_object_path (value, priv->companion);
|
||||
break;
|
||||
case PROP_ACTIVE_CHANNEL:
|
||||
g_value_set_uint (value, nm_platform_mesh_get_channel (nm_device_get_platform (device), nm_device_get_ifindex (device)));
|
||||
|
|
@ -500,10 +495,26 @@ dispose (GObject *object)
|
|||
G_OBJECT_CLASS (nm_device_olpc_mesh_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static const NMDBusInterfaceInfoExtended interface_info_device_olpc_mesh = {
|
||||
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
|
||||
NM_DBUS_INTERFACE_DEVICE_OLPC_MESH,
|
||||
.signals = NM_DEFINE_GDBUS_SIGNAL_INFOS (
|
||||
&nm_signal_info_property_changed_legacy,
|
||||
),
|
||||
.properties = NM_DEFINE_GDBUS_PROPERTY_INFOS (
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("HwAddress", "s", NM_DEVICE_HW_ADDRESS),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Companion", "o", NM_DEVICE_OLPC_MESH_COMPANION),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("ActiveChannel", "u", NM_DEVICE_OLPC_MESH_ACTIVE_CHANNEL),
|
||||
),
|
||||
),
|
||||
.legacy_property_changed = TRUE,
|
||||
};
|
||||
|
||||
static void
|
||||
nm_device_olpc_mesh_class_init (NMDeviceOlpcMeshClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass);
|
||||
NMDeviceClass *parent_class = NM_DEVICE_CLASS (klass);
|
||||
|
||||
NM_DEVICE_CLASS_DECLARE_TYPES (klass, NM_SETTING_OLPC_MESH_SETTING_NAME, NM_LINK_TYPE_OLPC_MESH)
|
||||
|
|
@ -512,6 +523,8 @@ nm_device_olpc_mesh_class_init (NMDeviceOlpcMeshClass *klass)
|
|||
object_class->get_property = get_property;
|
||||
object_class->dispose = dispose;
|
||||
|
||||
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_olpc_mesh);
|
||||
|
||||
parent_class->check_connection_compatible = check_connection_compatible;
|
||||
parent_class->get_autoconnect_allowed = get_autoconnect_allowed;
|
||||
parent_class->complete_connection = complete_connection;
|
||||
|
|
@ -534,9 +547,5 @@ nm_device_olpc_mesh_class_init (NMDeviceOlpcMeshClass *klass)
|
|||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
||||
|
||||
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass),
|
||||
NMDBUS_TYPE_DEVICE_OLPC_MESH_SKELETON,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "nm-wifi-ap.h"
|
||||
#include "nm-common-macros.h"
|
||||
#include "devices/nm-device.h"
|
||||
#include "devices/nm-device-private.h"
|
||||
|
|
@ -49,11 +50,10 @@
|
|||
#include "settings/nm-settings-connection.h"
|
||||
#include "settings/nm-settings.h"
|
||||
#include "nm-wifi-utils.h"
|
||||
#include "nm-wifi-common.h"
|
||||
#include "nm-core-internal.h"
|
||||
#include "nm-config.h"
|
||||
|
||||
#include "introspection/org.freedesktop.NetworkManager.Device.Wireless.h"
|
||||
|
||||
#include "devices/nm-device-logging.h"
|
||||
_LOG_DECLARE_SELF(NMDeviceWifi);
|
||||
|
||||
|
|
@ -76,8 +76,6 @@ NM_GOBJECT_PROPERTIES_DEFINE (NMDeviceWifi,
|
|||
);
|
||||
|
||||
enum {
|
||||
ACCESS_POINT_ADDED,
|
||||
ACCESS_POINT_REMOVED,
|
||||
SCANNING_PROHIBITED,
|
||||
|
||||
LAST_SIGNAL
|
||||
|
|
@ -188,7 +186,7 @@ static void request_wireless_scan (NMDeviceWifi *self,
|
|||
const GPtrArray *ssids);
|
||||
|
||||
static void ap_add_remove (NMDeviceWifi *self,
|
||||
guint signum,
|
||||
gboolean is_adding,
|
||||
NMWifiAP *ap,
|
||||
gboolean recheck_available_connections);
|
||||
|
||||
|
|
@ -416,7 +414,7 @@ set_current_ap (NMDeviceWifi *self, NMWifiAP *new_ap, gboolean recheck_available
|
|||
|
||||
/* Remove any AP from the internal list if it was created by NM or isn't known to the supplicant */
|
||||
if (mode == NM_802_11_MODE_ADHOC || mode == NM_802_11_MODE_AP || nm_wifi_ap_get_fake (old_ap))
|
||||
ap_add_remove (self, ACCESS_POINT_REMOVED, old_ap, recheck_available_connections);
|
||||
ap_add_remove (self, FALSE, old_ap, recheck_available_connections);
|
||||
g_object_unref (old_ap);
|
||||
}
|
||||
|
||||
|
|
@ -483,28 +481,31 @@ periodic_update_cb (gpointer user_data)
|
|||
|
||||
static void
|
||||
ap_add_remove (NMDeviceWifi *self,
|
||||
guint signum,
|
||||
gboolean is_adding, /* or else removing */
|
||||
NMWifiAP *ap,
|
||||
gboolean recheck_available_connections)
|
||||
{
|
||||
NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
|
||||
|
||||
nm_assert (NM_IN_SET (signum, ACCESS_POINT_ADDED, ACCESS_POINT_REMOVED));
|
||||
|
||||
if (signum == ACCESS_POINT_ADDED) {
|
||||
if (is_adding) {
|
||||
g_hash_table_insert (priv->aps,
|
||||
(gpointer) nm_exported_object_export ((NMExportedObject *) ap),
|
||||
(gpointer) nm_dbus_object_export (NM_DBUS_OBJECT (ap)),
|
||||
g_object_ref (ap));
|
||||
_ap_dump (self, LOGL_DEBUG, ap, "added", 0);
|
||||
} else
|
||||
_ap_dump (self, LOGL_DEBUG, ap, "removed", 0);
|
||||
|
||||
g_signal_emit (self, signals[signum], 0, ap);
|
||||
nm_dbus_object_emit_signal (NM_DBUS_OBJECT (self),
|
||||
&nm_interface_info_device_wireless,
|
||||
is_adding
|
||||
? &nm_signal_info_wireless_access_point_added
|
||||
: &nm_signal_info_wireless_access_point_removed,
|
||||
"(o)",
|
||||
nm_dbus_object_get_path (NM_DBUS_OBJECT (ap)));
|
||||
|
||||
if (signum == ACCESS_POINT_REMOVED) {
|
||||
g_hash_table_remove (priv->aps, nm_exported_object_get_path ((NMExportedObject *) ap));
|
||||
nm_exported_object_unexport ((NMExportedObject *) ap);
|
||||
g_object_unref (ap);
|
||||
if (!is_adding) {
|
||||
g_hash_table_remove (priv->aps, nm_dbus_object_get_path (NM_DBUS_OBJECT (ap)));
|
||||
nm_dbus_object_clear_and_unexport (&ap);
|
||||
}
|
||||
|
||||
_notify (self, PROP_ACCESS_POINTS);
|
||||
|
|
@ -529,7 +530,7 @@ remove_all_aps (NMDeviceWifi *self)
|
|||
again:
|
||||
g_hash_table_iter_init (&iter, priv->aps);
|
||||
if (g_hash_table_iter_next (&iter, NULL, (gpointer) &ap)) {
|
||||
ap_add_remove (self, ACCESS_POINT_REMOVED, ap, FALSE);
|
||||
ap_add_remove (self, FALSE, ap, FALSE);
|
||||
goto again;
|
||||
}
|
||||
|
||||
|
|
@ -990,37 +991,17 @@ can_auto_connect (NMDevice *device,
|
|||
ap = nm_wifi_aps_find_first_compatible (priv->aps, connection, FALSE);
|
||||
if (ap) {
|
||||
/* All good; connection is usable */
|
||||
NM_SET_OUT (specific_object, g_strdup (nm_exported_object_get_path (NM_EXPORTED_OBJECT (ap))));
|
||||
NM_SET_OUT (specific_object, g_strdup (nm_dbus_object_get_path (NM_DBUS_OBJECT (ap))));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
impl_device_wifi_get_access_points (NMDeviceWifi *self,
|
||||
GDBusMethodInvocation *context)
|
||||
GHashTable *
|
||||
_nm_device_wifi_get_aps (NMDeviceWifi *self)
|
||||
{
|
||||
NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
|
||||
gs_free const char **list = NULL;
|
||||
GVariant *v;
|
||||
|
||||
list = nm_wifi_aps_get_sorted_paths (priv->aps, FALSE);
|
||||
v = g_variant_new_objv (list, -1);
|
||||
g_dbus_method_invocation_return_value (context, g_variant_new_tuple (&v, 1));
|
||||
}
|
||||
|
||||
static void
|
||||
impl_device_wifi_get_all_access_points (NMDeviceWifi *self,
|
||||
GDBusMethodInvocation *context)
|
||||
{
|
||||
NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
|
||||
gs_free const char **list = NULL;
|
||||
GVariant *v;
|
||||
|
||||
list = nm_wifi_aps_get_sorted_paths (priv->aps, TRUE);
|
||||
v = g_variant_new_objv (list, -1);
|
||||
g_dbus_method_invocation_return_value (context, g_variant_new_tuple (&v, 1));
|
||||
return NM_DEVICE_WIFI_GET_PRIVATE (self)->aps;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -1168,10 +1149,10 @@ dbus_request_scan_cb (NMDevice *device,
|
|||
g_dbus_method_invocation_return_value (context, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_device_wifi_request_scan (NMDeviceWifi *self,
|
||||
GDBusMethodInvocation *context,
|
||||
GVariant *options)
|
||||
void
|
||||
_nm_device_wifi_request_scan (NMDeviceWifi *self,
|
||||
GVariant *options,
|
||||
GDBusMethodInvocation *invocation)
|
||||
{
|
||||
NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
|
||||
NMDevice *device = NM_DEVICE (self);
|
||||
|
|
@ -1181,7 +1162,7 @@ impl_device_wifi_request_scan (NMDeviceWifi *self,
|
|||
|| !priv->sup_iface
|
||||
|| nm_device_get_state (device) < NM_DEVICE_STATE_DISCONNECTED
|
||||
|| nm_device_is_activating (device)) {
|
||||
g_dbus_method_invocation_return_error_literal (context,
|
||||
g_dbus_method_invocation_return_error_literal (invocation,
|
||||
NM_DEVICE_ERROR,
|
||||
NM_DEVICE_ERROR_NOT_ALLOWED,
|
||||
"Scanning not allowed while unavailable or activating");
|
||||
|
|
@ -1189,7 +1170,7 @@ impl_device_wifi_request_scan (NMDeviceWifi *self,
|
|||
}
|
||||
|
||||
if (nm_supplicant_interface_get_scanning (priv->sup_iface)) {
|
||||
g_dbus_method_invocation_return_error_literal (context,
|
||||
g_dbus_method_invocation_return_error_literal (invocation,
|
||||
NM_DEVICE_ERROR,
|
||||
NM_DEVICE_ERROR_NOT_ALLOWED,
|
||||
"Scanning not allowed while already scanning");
|
||||
|
|
@ -1198,17 +1179,16 @@ impl_device_wifi_request_scan (NMDeviceWifi *self,
|
|||
|
||||
last_scan = nm_supplicant_interface_get_last_scan_time (priv->sup_iface);
|
||||
if (last_scan && (nm_utils_get_monotonic_timestamp_s () - last_scan) < 10) {
|
||||
g_dbus_method_invocation_return_error_literal (context,
|
||||
g_dbus_method_invocation_return_error_literal (invocation,
|
||||
NM_DEVICE_ERROR,
|
||||
NM_DEVICE_ERROR_NOT_ALLOWED,
|
||||
"Scanning not allowed immediately following previous scan");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Ask the manager to authenticate this request for us */
|
||||
g_signal_emit_by_name (device,
|
||||
NM_DEVICE_AUTH_REQUEST,
|
||||
context,
|
||||
invocation,
|
||||
NULL,
|
||||
NM_AUTH_PERMISSION_NETWORK_CONTROL,
|
||||
TRUE,
|
||||
|
|
@ -1605,7 +1585,7 @@ supplicant_iface_bss_updated_cb (NMSupplicantInterface *iface,
|
|||
}
|
||||
}
|
||||
|
||||
ap_add_remove (self, ACCESS_POINT_ADDED, ap, TRUE);
|
||||
ap_add_remove (self, TRUE, ap, TRUE);
|
||||
}
|
||||
|
||||
/* Update the current AP if the supplicant notified a current BSS change
|
||||
|
|
@ -1642,7 +1622,7 @@ supplicant_iface_bss_removed_cb (NMSupplicantInterface *iface,
|
|||
if (nm_wifi_ap_set_fake (ap, TRUE))
|
||||
_ap_dump (self, LOGL_DEBUG, ap, "updated", 0);
|
||||
} else {
|
||||
ap_add_remove (self, ACCESS_POINT_REMOVED, ap, TRUE);
|
||||
ap_add_remove (self, FALSE, ap, TRUE);
|
||||
schedule_ap_list_dump (self);
|
||||
}
|
||||
}
|
||||
|
|
@ -2543,7 +2523,7 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason)
|
|||
|
||||
if (ap) {
|
||||
nm_active_connection_set_specific_object (NM_ACTIVE_CONNECTION (req),
|
||||
nm_exported_object_get_path (NM_EXPORTED_OBJECT (ap)));
|
||||
nm_dbus_object_get_path (NM_DBUS_OBJECT (ap)));
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
|
@ -2560,11 +2540,11 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason)
|
|||
nm_wifi_ap_set_address (ap, nm_device_get_hw_address (device));
|
||||
|
||||
g_object_freeze_notify (G_OBJECT (self));
|
||||
ap_add_remove (self, ACCESS_POINT_ADDED, ap, TRUE);
|
||||
ap_add_remove (self, TRUE, ap, TRUE);
|
||||
g_object_thaw_notify (G_OBJECT (self));
|
||||
set_current_ap (self, ap, FALSE);
|
||||
nm_active_connection_set_specific_object (NM_ACTIVE_CONNECTION (req),
|
||||
nm_exported_object_get_path (NM_EXPORTED_OBJECT (ap)));
|
||||
nm_dbus_object_get_path (NM_DBUS_OBJECT (ap)));
|
||||
return NM_ACT_STAGE_RETURN_SUCCESS;
|
||||
|
||||
done:
|
||||
|
|
@ -2976,7 +2956,7 @@ activation_success_handler (NMDevice *device)
|
|||
}
|
||||
|
||||
nm_active_connection_set_specific_object (NM_ACTIVE_CONNECTION (req),
|
||||
nm_exported_object_get_path (NM_EXPORTED_OBJECT (priv->current_ap)));
|
||||
nm_dbus_object_get_path (NM_DBUS_OBJECT (priv->current_ap)));
|
||||
}
|
||||
|
||||
periodic_update (self);
|
||||
|
|
@ -3174,7 +3154,7 @@ get_property (GObject *object, guint prop_id,
|
|||
g_value_take_boxed (value, list);
|
||||
break;
|
||||
case PROP_ACTIVE_ACCESS_POINT:
|
||||
nm_utils_g_value_set_object_path (value, priv->current_ap);
|
||||
nm_dbus_utils_g_value_set_object_path (value, priv->current_ap);
|
||||
break;
|
||||
case PROP_SCANNING:
|
||||
g_value_set_boolean (value, priv->is_scanning);
|
||||
|
|
@ -3280,6 +3260,7 @@ static void
|
|||
nm_device_wifi_class_init (NMDeviceWifiClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass);
|
||||
NMDeviceClass *parent_class = NM_DEVICE_CLASS (klass);
|
||||
|
||||
NM_DEVICE_CLASS_DECLARE_TYPES (klass, NM_SETTING_WIRELESS_SETTING_NAME, NM_LINK_TYPE_WIFI)
|
||||
|
|
@ -3290,6 +3271,8 @@ nm_device_wifi_class_init (NMDeviceWifiClass *klass)
|
|||
object_class->dispose = dispose;
|
||||
object_class->finalize = finalize;
|
||||
|
||||
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&nm_interface_info_device_wireless);
|
||||
|
||||
parent_class->can_auto_connect = can_auto_connect;
|
||||
parent_class->get_autoconnect_allowed = get_autoconnect_allowed;
|
||||
parent_class->is_available = is_available;
|
||||
|
|
@ -3356,24 +3339,6 @@ nm_device_wifi_class_init (NMDeviceWifiClass *klass)
|
|||
|
||||
g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
||||
|
||||
signals[ACCESS_POINT_ADDED] =
|
||||
g_signal_new (NM_DEVICE_WIFI_ACCESS_POINT_ADDED,
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
0,
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1,
|
||||
NM_TYPE_WIFI_AP);
|
||||
|
||||
signals[ACCESS_POINT_REMOVED] =
|
||||
g_signal_new (NM_DEVICE_WIFI_ACCESS_POINT_REMOVED,
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
0,
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1,
|
||||
NM_TYPE_WIFI_AP);
|
||||
|
||||
signals[SCANNING_PROHIBITED] =
|
||||
g_signal_new (NM_DEVICE_WIFI_SCANNING_PROHIBITED,
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
|
|
@ -3381,13 +3346,4 @@ nm_device_wifi_class_init (NMDeviceWifiClass *klass)
|
|||
G_STRUCT_OFFSET (NMDeviceWifiClass, scanning_prohibited),
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_BOOLEAN, 1, G_TYPE_BOOLEAN);
|
||||
|
||||
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass),
|
||||
NMDBUS_TYPE_DEVICE_WIFI_SKELETON,
|
||||
"GetAccessPoints", impl_device_wifi_get_access_points,
|
||||
"GetAllAccessPoints", impl_device_wifi_get_all_access_points,
|
||||
"RequestScan", impl_device_wifi_request_scan,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@
|
|||
#define __NETWORKMANAGER_DEVICE_WIFI_H__
|
||||
|
||||
#include "devices/nm-device.h"
|
||||
#include "nm-wifi-ap.h"
|
||||
|
||||
#define NM_TYPE_DEVICE_WIFI (nm_device_wifi_get_type ())
|
||||
#define NM_DEVICE_WIFI(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DEVICE_WIFI, NMDeviceWifi))
|
||||
|
|
@ -39,11 +38,6 @@
|
|||
#define NM_DEVICE_WIFI_CAPABILITIES "wireless-capabilities"
|
||||
#define NM_DEVICE_WIFI_SCANNING "scanning"
|
||||
|
||||
/* signals */
|
||||
#define NM_DEVICE_WIFI_ACCESS_POINT_ADDED "access-point-added"
|
||||
#define NM_DEVICE_WIFI_ACCESS_POINT_REMOVED "access-point-removed"
|
||||
|
||||
/* internal signals */
|
||||
#define NM_DEVICE_WIFI_SCANNING_PROHIBITED "scanning-prohibited"
|
||||
|
||||
typedef struct _NMDeviceWifi NMDeviceWifi;
|
||||
|
|
@ -53,4 +47,10 @@ GType nm_device_wifi_get_type (void);
|
|||
|
||||
NMDevice * nm_device_wifi_new (const char *iface, NMDeviceWifiCapabilities capabilities);
|
||||
|
||||
GHashTable *_nm_device_wifi_get_aps (NMDeviceWifi *self);
|
||||
|
||||
void _nm_device_wifi_request_scan (NMDeviceWifi *self,
|
||||
GVariant *options,
|
||||
GDBusMethodInvocation *invocation);
|
||||
|
||||
#endif /* __NETWORKMANAGER_DEVICE_WIFI_H__ */
|
||||
|
|
|
|||
|
|
@ -21,20 +21,19 @@
|
|||
|
||||
#include "nm-default.h"
|
||||
|
||||
#include "nm-wifi-ap.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "nm-wifi-ap.h"
|
||||
#include "nm-setting-wireless.h"
|
||||
|
||||
#include "nm-wifi-utils.h"
|
||||
#include "NetworkManagerUtils.h"
|
||||
#include "nm-utils.h"
|
||||
#include "nm-core-internal.h"
|
||||
#include "platform/nm-platform.h"
|
||||
|
||||
#include "nm-setting-wireless.h"
|
||||
|
||||
#include "introspection/org.freedesktop.NetworkManager.AccessPoint.h"
|
||||
|
||||
#define PROTO_WPA "wpa"
|
||||
#define PROTO_RSN "rsn"
|
||||
|
||||
|
|
@ -75,15 +74,15 @@ typedef struct {
|
|||
} NMWifiAPPrivate;
|
||||
|
||||
struct _NMWifiAP {
|
||||
NMExportedObject parent;
|
||||
NMDBusObject parent;
|
||||
NMWifiAPPrivate _priv;
|
||||
};
|
||||
|
||||
struct _NMWifiAPClass {
|
||||
NMExportedObjectClass parent;
|
||||
NMDBusObjectClass parent;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (NMWifiAP, nm_wifi_ap, NM_TYPE_EXPORTED_OBJECT)
|
||||
G_DEFINE_TYPE (NMWifiAP, nm_wifi_ap, NM_TYPE_DBUS_OBJECT)
|
||||
|
||||
#define NM_WIFI_AP_GET_PRIVATE(self) _NM_GET_PRIVATE(self, NMWifiAP, NM_IS_WIFI_AP)
|
||||
|
||||
|
|
@ -105,7 +104,7 @@ nm_wifi_ap_get_id (NMWifiAP *ap)
|
|||
|
||||
g_return_val_if_fail (NM_IS_WIFI_AP (ap), 0);
|
||||
|
||||
path = nm_exported_object_get_path (NM_EXPORTED_OBJECT (ap));
|
||||
path = nm_dbus_object_get_path (NM_DBUS_OBJECT (ap));
|
||||
g_return_val_if_fail (path, 0);
|
||||
|
||||
nm_assert (g_str_has_prefix (path, NM_DBUS_PATH_ACCESS_POINT"/"));
|
||||
|
|
@ -116,13 +115,26 @@ nm_wifi_ap_get_id (NMWifiAP *ap)
|
|||
return i;
|
||||
}
|
||||
|
||||
const GByteArray * nm_wifi_ap_get_ssid (const NMWifiAP *ap)
|
||||
const GByteArray *
|
||||
nm_wifi_ap_get_ssid (const NMWifiAP *ap)
|
||||
{
|
||||
g_return_val_if_fail (NM_IS_WIFI_AP (ap), NULL);
|
||||
|
||||
return NM_WIFI_AP_GET_PRIVATE (ap)->ssid;
|
||||
}
|
||||
|
||||
static GVariant *
|
||||
nm_wifi_ap_get_ssid_as_variant (const NMWifiAP *self)
|
||||
{
|
||||
const NMWifiAPPrivate *priv = NM_WIFI_AP_GET_PRIVATE (self);
|
||||
|
||||
if (priv->ssid) {
|
||||
return g_variant_new_fixed_array (G_VARIANT_TYPE_BYTE,
|
||||
priv->ssid->data, priv->ssid->len, 1);
|
||||
} else
|
||||
return g_variant_new_array (G_VARIANT_TYPE_BYTE, NULL, 0);
|
||||
}
|
||||
|
||||
gboolean
|
||||
nm_wifi_ap_set_ssid (NMWifiAP *ap, const guint8 *ssid, gsize len)
|
||||
{
|
||||
|
|
@ -330,7 +342,7 @@ guint32
|
|||
nm_wifi_ap_get_max_bitrate (NMWifiAP *ap)
|
||||
{
|
||||
g_return_val_if_fail (NM_IS_WIFI_AP (ap), 0);
|
||||
g_return_val_if_fail (nm_exported_object_is_exported (NM_EXPORTED_OBJECT (ap)), 0);
|
||||
g_return_val_if_fail (nm_dbus_object_is_exported (NM_DBUS_OBJECT (ap)), 0);
|
||||
|
||||
return NM_WIFI_AP_GET_PRIVATE (ap)->max_bitrate;
|
||||
}
|
||||
|
|
@ -978,7 +990,7 @@ nm_wifi_ap_to_string (const NMWifiAP *self,
|
|||
if (priv->supplicant_path)
|
||||
supplicant_id = strrchr (priv->supplicant_path, '/') ?: supplicant_id;
|
||||
|
||||
export_path = nm_exported_object_get_path (NM_EXPORTED_OBJECT (self));
|
||||
export_path = nm_dbus_object_get_path (NM_DBUS_OBJECT (self));
|
||||
if (export_path)
|
||||
export_path = strrchr (export_path, '/') ?: export_path;
|
||||
else
|
||||
|
|
@ -1120,8 +1132,8 @@ static void
|
|||
get_property (GObject *object, guint prop_id,
|
||||
GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
NMWifiAPPrivate *priv = NM_WIFI_AP_GET_PRIVATE ((NMWifiAP *) object);
|
||||
GVariant *ssid;
|
||||
NMWifiAP *self = NM_WIFI_AP (object);
|
||||
NMWifiAPPrivate *priv = NM_WIFI_AP_GET_PRIVATE (self);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_FLAGS:
|
||||
|
|
@ -1134,12 +1146,7 @@ get_property (GObject *object, guint prop_id,
|
|||
g_value_set_uint (value, priv->rsn_flags);
|
||||
break;
|
||||
case PROP_SSID:
|
||||
if (priv->ssid) {
|
||||
ssid = g_variant_new_fixed_array (G_VARIANT_TYPE_BYTE,
|
||||
priv->ssid->data, priv->ssid->len, 1);
|
||||
} else
|
||||
ssid = g_variant_new_array (G_VARIANT_TYPE_BYTE, NULL, 0);
|
||||
g_value_take_variant (value, ssid);
|
||||
g_value_take_variant (value, nm_wifi_ap_get_ssid_as_variant (self));
|
||||
break;
|
||||
case PROP_FREQUENCY:
|
||||
g_value_set_uint (value, priv->freq);
|
||||
|
|
@ -1343,6 +1350,28 @@ finalize (GObject *object)
|
|||
G_OBJECT_CLASS (nm_wifi_ap_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static const NMDBusInterfaceInfoExtended interface_info_access_point = {
|
||||
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
|
||||
NM_DBUS_INTERFACE_ACCESS_POINT,
|
||||
.signals = NM_DEFINE_GDBUS_SIGNAL_INFOS (
|
||||
&nm_signal_info_property_changed_legacy,
|
||||
),
|
||||
.properties = NM_DEFINE_GDBUS_PROPERTY_INFOS (
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Flags", "u", NM_WIFI_AP_FLAGS),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("WpaFlags", "u", NM_WIFI_AP_WPA_FLAGS),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("RsnFlags", "u", NM_WIFI_AP_RSN_FLAGS),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Ssid", "ay", NM_WIFI_AP_SSID),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Frequency", "u", NM_WIFI_AP_FREQUENCY),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("HwAddress", "s", NM_WIFI_AP_HW_ADDRESS),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Mode", "u", NM_WIFI_AP_MODE),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("MaxBitrate", "u", NM_WIFI_AP_MAX_BITRATE),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Strength", "y", NM_WIFI_AP_STRENGTH),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("LastSeen", "i", NM_WIFI_AP_LAST_SEEN),
|
||||
),
|
||||
),
|
||||
.legacy_property_changed = TRUE,
|
||||
};
|
||||
|
||||
static void
|
||||
nm_wifi_ap_class_init (NMWifiAPClass *ap_class)
|
||||
{
|
||||
|
|
@ -1360,9 +1389,10 @@ nm_wifi_ap_class_init (NMWifiAPClass *ap_class)
|
|||
| NM_802_11_AP_SEC_KEY_MGMT_802_1X )
|
||||
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (ap_class);
|
||||
NMExportedObjectClass *exported_object_class = NM_EXPORTED_OBJECT_CLASS (ap_class);
|
||||
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (ap_class);
|
||||
|
||||
exported_object_class->export_path = NM_EXPORT_PATH_NUMBERED (NM_DBUS_PATH_ACCESS_POINT);
|
||||
dbus_object_class->export_path = NM_EXPORT_PATH_NUMBERED (NM_DBUS_PATH_ACCESS_POINT);
|
||||
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_access_point);
|
||||
|
||||
object_class->get_property = get_property;
|
||||
object_class->finalize = finalize;
|
||||
|
|
@ -1425,10 +1455,6 @@ nm_wifi_ap_class_init (NMWifiAPClass *ap_class)
|
|||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
||||
|
||||
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (ap_class),
|
||||
NMDBUS_TYPE_ACCESS_POINT_SKELETON,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
@ -1487,7 +1513,7 @@ nm_wifi_aps_get_sorted_paths (GHashTable *aps, gboolean include_without_ssid)
|
|||
const char *path;
|
||||
|
||||
/* update @list inplace to hold instead the export-path. */
|
||||
path = nm_exported_object_get_path (NM_EXPORTED_OBJECT (ap));
|
||||
path = nm_dbus_object_get_path (NM_DBUS_OBJECT (ap));
|
||||
nm_assert (path);
|
||||
list[j++] = (gpointer) path;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
#ifndef __NM_WIFI_AP_H__
|
||||
#define __NM_WIFI_AP_H__
|
||||
|
||||
#include "nm-exported-object.h"
|
||||
#include "nm-dbus-object.h"
|
||||
#include "nm-dbus-interface.h"
|
||||
#include "nm-connection.h"
|
||||
|
||||
|
|
|
|||
188
src/devices/wifi/nm-wifi-common.c
Normal file
188
src/devices/wifi/nm-wifi-common.c
Normal file
|
|
@ -0,0 +1,188 @@
|
|||
/*-*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* (C) Copyright 2018 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#include "nm-default.h"
|
||||
|
||||
#include "nm-wifi-common.h"
|
||||
|
||||
#include "devices/nm-device.h"
|
||||
#include "nm-wifi-ap.h"
|
||||
#include "nm-device-wifi.h"
|
||||
|
||||
#if WITH_IWD
|
||||
#include "nm-device-iwd.h"
|
||||
#endif
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static GHashTable *
|
||||
_dispatch_get_aps (NMDevice *device)
|
||||
{
|
||||
#if WITH_IWD
|
||||
if (NM_IS_DEVICE_IWD (device))
|
||||
return _nm_device_iwd_get_aps (NM_DEVICE_IWD (device));
|
||||
#endif
|
||||
return _nm_device_wifi_get_aps (NM_DEVICE_WIFI (device));
|
||||
}
|
||||
|
||||
static void
|
||||
_dispatch_request_scan (NMDevice *device,
|
||||
GVariant *options,
|
||||
GDBusMethodInvocation *invocation)
|
||||
{
|
||||
#if WITH_IWD
|
||||
if (NM_IS_DEVICE_IWD (device)) {
|
||||
_nm_device_iwd_request_scan (NM_DEVICE_IWD (device),
|
||||
options,
|
||||
invocation);
|
||||
}
|
||||
#endif
|
||||
_nm_device_wifi_request_scan (NM_DEVICE_WIFI (device),
|
||||
options,
|
||||
invocation);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_device_wifi_get_access_points (NMDBusObject *obj,
|
||||
const NMDBusInterfaceInfoExtended *interface_info,
|
||||
const NMDBusMethodInfoExtended *method_info,
|
||||
GDBusConnection *connection,
|
||||
const char *sender,
|
||||
GDBusMethodInvocation *invocation,
|
||||
GVariant *parameters)
|
||||
{
|
||||
gs_free const char **list = NULL;
|
||||
GVariant *v;
|
||||
GHashTable *aps;
|
||||
|
||||
/* NOTE: this handler is called both for NMDevicwWifi and NMDeviceIwd. */
|
||||
|
||||
aps = _dispatch_get_aps (NM_DEVICE (obj));
|
||||
list = nm_wifi_aps_get_sorted_paths (aps, FALSE);
|
||||
v = g_variant_new_objv (list, -1);
|
||||
g_dbus_method_invocation_return_value (invocation,
|
||||
g_variant_new_tuple (&v, 1));
|
||||
}
|
||||
|
||||
static void
|
||||
impl_device_wifi_get_all_access_points (NMDBusObject *obj,
|
||||
const NMDBusInterfaceInfoExtended *interface_info,
|
||||
const NMDBusMethodInfoExtended *method_info,
|
||||
GDBusConnection *connection,
|
||||
const char *sender,
|
||||
GDBusMethodInvocation *invocation,
|
||||
GVariant *parameters)
|
||||
{
|
||||
gs_free const char **list = NULL;
|
||||
GVariant *v;
|
||||
GHashTable *aps;
|
||||
|
||||
/* NOTE: this handler is called both for NMDevicwWifi and NMDeviceIwd. */
|
||||
|
||||
aps = _dispatch_get_aps (NM_DEVICE (obj));
|
||||
list = nm_wifi_aps_get_sorted_paths (aps, TRUE);
|
||||
v = g_variant_new_objv (list, -1);
|
||||
g_dbus_method_invocation_return_value (invocation,
|
||||
g_variant_new_tuple (&v, 1));
|
||||
}
|
||||
|
||||
static void
|
||||
impl_device_wifi_request_scan (NMDBusObject *obj,
|
||||
const NMDBusInterfaceInfoExtended *interface_info,
|
||||
const NMDBusMethodInfoExtended *method_info,
|
||||
GDBusConnection *connection,
|
||||
const char *sender,
|
||||
GDBusMethodInvocation *invocation,
|
||||
GVariant *parameters)
|
||||
{
|
||||
gs_unref_variant GVariant *options = NULL;
|
||||
|
||||
/* NOTE: this handler is called both for NMDevicwWifi and NMDeviceIwd. */
|
||||
|
||||
g_variant_get (parameters, "(@a{sv})", &options);
|
||||
|
||||
_dispatch_request_scan (NM_DEVICE (obj),
|
||||
options,
|
||||
invocation);
|
||||
}
|
||||
|
||||
const GDBusSignalInfo nm_signal_info_wireless_access_point_added = NM_DEFINE_GDBUS_SIGNAL_INFO_INIT (
|
||||
"AccessPointAdded",
|
||||
.args = NM_DEFINE_GDBUS_ARG_INFOS (
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("access_point", "o"),
|
||||
),
|
||||
);
|
||||
|
||||
const GDBusSignalInfo nm_signal_info_wireless_access_point_removed = NM_DEFINE_GDBUS_SIGNAL_INFO_INIT (
|
||||
"AccessPointRemoved",
|
||||
.args = NM_DEFINE_GDBUS_ARG_INFOS (
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("access_point", "o"),
|
||||
),
|
||||
);
|
||||
|
||||
const NMDBusInterfaceInfoExtended nm_interface_info_device_wireless = {
|
||||
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
|
||||
NM_DBUS_INTERFACE_DEVICE_WIRELESS,
|
||||
.methods = NM_DEFINE_GDBUS_METHOD_INFOS (
|
||||
NM_DEFINE_DBUS_METHOD_INFO_EXTENDED (
|
||||
NM_DEFINE_GDBUS_METHOD_INFO_INIT (
|
||||
"GetAccessPoints",
|
||||
.out_args = NM_DEFINE_GDBUS_ARG_INFOS (
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("access_points", "ao"),
|
||||
),
|
||||
),
|
||||
.handle = impl_device_wifi_get_access_points,
|
||||
),
|
||||
NM_DEFINE_DBUS_METHOD_INFO_EXTENDED (
|
||||
NM_DEFINE_GDBUS_METHOD_INFO_INIT (
|
||||
"GetAllAccessPoints",
|
||||
.out_args = NM_DEFINE_GDBUS_ARG_INFOS (
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("access_points", "ao"),
|
||||
),
|
||||
),
|
||||
.handle = impl_device_wifi_get_all_access_points,
|
||||
),
|
||||
NM_DEFINE_DBUS_METHOD_INFO_EXTENDED (
|
||||
NM_DEFINE_GDBUS_METHOD_INFO_INIT (
|
||||
"RequestScan",
|
||||
.in_args = NM_DEFINE_GDBUS_ARG_INFOS (
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("options", "a{sv}"),
|
||||
),
|
||||
),
|
||||
.handle = impl_device_wifi_request_scan,
|
||||
),
|
||||
),
|
||||
.signals = NM_DEFINE_GDBUS_SIGNAL_INFOS (
|
||||
&nm_signal_info_property_changed_legacy,
|
||||
&nm_signal_info_wireless_access_point_added,
|
||||
&nm_signal_info_wireless_access_point_removed,
|
||||
),
|
||||
.properties = NM_DEFINE_GDBUS_PROPERTY_INFOS (
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("HwAddress", "s", NM_DEVICE_HW_ADDRESS),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("PermHwAddress", "s", NM_DEVICE_PERM_HW_ADDRESS),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Mode", "u", NM_DEVICE_WIFI_MODE),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("BitRate", "u", NM_DEVICE_WIFI_BITRATE),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("AccessPoints", "ao", NM_DEVICE_WIFI_ACCESS_POINTS),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("ActiveAccessPoint", "o", NM_DEVICE_WIFI_ACTIVE_ACCESS_POINT),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("WirelessCapabilities", "u", NM_DEVICE_WIFI_CAPABILITIES),
|
||||
),
|
||||
),
|
||||
.legacy_property_changed = TRUE,
|
||||
};
|
||||
32
src/devices/wifi/nm-wifi-common.h
Normal file
32
src/devices/wifi/nm-wifi-common.h
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* (C) Copyright 2018 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#ifndef __NM_WIFI_COMMON_H__
|
||||
#define __NM_WIFI_COMMON_H__
|
||||
|
||||
#include "nm-dbus-utils.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
extern const NMDBusInterfaceInfoExtended nm_interface_info_device_wireless;
|
||||
extern const GDBusSignalInfo nm_signal_info_wireless_access_point_added;
|
||||
extern const GDBusSignalInfo nm_signal_info_wireless_access_point_removed;
|
||||
|
||||
#endif /* __NM_WIFI_COMMON_H__ */
|
||||
|
|
@ -46,8 +46,6 @@ sources = files(
|
|||
'nm-wwan-factory.c'
|
||||
)
|
||||
|
||||
deps += libnmdbus_dep
|
||||
|
||||
libnm_device_plugin_wwan = shared_module(
|
||||
'nm-device-plugin-wwan',
|
||||
sources: sources,
|
||||
|
|
|
|||
|
|
@ -32,8 +32,6 @@
|
|||
#include "NetworkManagerUtils.h"
|
||||
#include "nm-core-internal.h"
|
||||
|
||||
#include "introspection/org.freedesktop.NetworkManager.Device.Modem.h"
|
||||
|
||||
#include "devices/nm-device-logging.h"
|
||||
_LOG_DECLARE_SELF(NMDeviceModem);
|
||||
|
||||
|
|
@ -741,16 +739,33 @@ dispose (GObject *object)
|
|||
G_OBJECT_CLASS (nm_device_modem_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static const NMDBusInterfaceInfoExtended interface_info_device_modem = {
|
||||
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
|
||||
NM_DBUS_INTERFACE_DEVICE_MODEM,
|
||||
.signals = NM_DEFINE_GDBUS_SIGNAL_INFOS (
|
||||
&nm_signal_info_property_changed_legacy,
|
||||
),
|
||||
.properties = NM_DEFINE_GDBUS_PROPERTY_INFOS (
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("ModemCapabilities", "u", NM_DEVICE_MODEM_CAPABILITIES),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("CurrentCapabilities", "u", NM_DEVICE_MODEM_CURRENT_CAPABILITIES),
|
||||
),
|
||||
),
|
||||
.legacy_property_changed = TRUE,
|
||||
};
|
||||
|
||||
static void
|
||||
nm_device_modem_class_init (NMDeviceModemClass *mclass)
|
||||
nm_device_modem_class_init (NMDeviceModemClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (mclass);
|
||||
NMDeviceClass *device_class = NM_DEVICE_CLASS (mclass);
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass);
|
||||
NMDeviceClass *device_class = NM_DEVICE_CLASS (klass);
|
||||
|
||||
object_class->dispose = dispose;
|
||||
object_class->get_property = get_property;
|
||||
object_class->set_property = set_property;
|
||||
|
||||
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_modem);
|
||||
|
||||
device_class->get_generic_capabilities = get_generic_capabilities;
|
||||
device_class->get_type_description = get_type_description;
|
||||
device_class->check_connection_compatible = check_connection_compatible;
|
||||
|
|
@ -793,8 +808,4 @@ nm_device_modem_class_init (NMDeviceModemClass *mclass)
|
|||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
||||
|
||||
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (mclass),
|
||||
NMDBUS_TYPE_DEVICE_MODEM_SKELETON,
|
||||
NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
#include "nm-dhcp-client.h"
|
||||
#include "nm-dhcp-manager.h"
|
||||
#include "nm-core-internal.h"
|
||||
#include "nm-bus-manager.h"
|
||||
#include "nm-dbus-manager.h"
|
||||
#include "NetworkManagerUtils.h"
|
||||
|
||||
#define PRIV_SOCK_PATH NMRUNDIR "/private-dhcp"
|
||||
|
|
@ -60,7 +60,7 @@ const NMDhcpClientFactory *const _nm_dhcp_manager_factories[4] = {
|
|||
/*****************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
NMBusManager * dbus_mgr;
|
||||
NMDBusManager * dbus_mgr;
|
||||
gulong new_conn_id;
|
||||
gulong dis_conn_id;
|
||||
GHashTable * connections;
|
||||
|
|
@ -192,29 +192,27 @@ _method_call (GDBusConnection *connection,
|
|||
{
|
||||
NMDhcpListener *self = NM_DHCP_LISTENER (user_data);
|
||||
|
||||
if (!nm_streq0 (interface_name, NM_DHCP_HELPER_SERVER_INTERFACE_NAME))
|
||||
g_return_if_reached ();
|
||||
if (!nm_streq0 (method_name, NM_DHCP_HELPER_SERVER_METHOD_NOTIFY))
|
||||
g_return_if_reached ();
|
||||
if (!g_variant_is_of_type (parameters, G_VARIANT_TYPE ("(a{sv})")))
|
||||
g_return_if_reached ();
|
||||
if ( !nm_streq (interface_name, NM_DHCP_HELPER_SERVER_INTERFACE_NAME)
|
||||
|| !nm_streq (method_name, NM_DHCP_HELPER_SERVER_METHOD_NOTIFY)) {
|
||||
g_dbus_method_invocation_return_error (invocation,
|
||||
G_DBUS_ERROR,
|
||||
G_DBUS_ERROR_UNKNOWN_METHOD,
|
||||
"Unknown method %s",
|
||||
method_name);
|
||||
return;
|
||||
}
|
||||
|
||||
_method_call_handle (self, parameters);
|
||||
|
||||
g_dbus_method_invocation_return_value (invocation, NULL);
|
||||
}
|
||||
|
||||
NM_DEFINE_GDBUS_INTERFACE_INFO (
|
||||
interface_info,
|
||||
static GDBusInterfaceInfo *const interface_info = NM_DEFINE_GDBUS_INTERFACE_INFO (
|
||||
NM_DHCP_HELPER_SERVER_INTERFACE_NAME,
|
||||
.methods = NM_DEFINE_GDBUS_METHOD_INFOS (
|
||||
NM_DEFINE_GDBUS_METHOD_INFO (
|
||||
NM_DHCP_HELPER_SERVER_METHOD_NOTIFY,
|
||||
.in_args = NM_DEFINE_GDBUS_ARG_INFOS (
|
||||
NM_DEFINE_GDBUS_ARG_INFO (
|
||||
"data",
|
||||
.signature = "a{sv}",
|
||||
),
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("data", "a{sv}"),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
@ -239,7 +237,7 @@ _dbus_connection_register_object (NMDhcpListener *self,
|
|||
}
|
||||
|
||||
static void
|
||||
new_connection_cb (NMBusManager *mgr,
|
||||
new_connection_cb (NMDBusManager *mgr,
|
||||
GDBusConnection *connection,
|
||||
GDBusObjectManager *manager,
|
||||
NMDhcpListener *self)
|
||||
|
|
@ -262,7 +260,7 @@ new_connection_cb (NMBusManager *mgr,
|
|||
}
|
||||
|
||||
static void
|
||||
dis_connection_cb (NMBusManager *mgr,
|
||||
dis_connection_cb (NMDBusManager *mgr,
|
||||
GDBusConnection *connection,
|
||||
NMDhcpListener *self)
|
||||
{
|
||||
|
|
@ -286,16 +284,16 @@ nm_dhcp_listener_init (NMDhcpListener *self)
|
|||
/* Maps GDBusConnection :: signal-id */
|
||||
priv->connections = g_hash_table_new (nm_direct_hash, NULL);
|
||||
|
||||
priv->dbus_mgr = nm_bus_manager_get ();
|
||||
priv->dbus_mgr = nm_dbus_manager_get ();
|
||||
|
||||
/* Register the socket our DHCP clients will return lease info on */
|
||||
nm_bus_manager_private_server_register (priv->dbus_mgr, PRIV_SOCK_PATH, PRIV_SOCK_TAG);
|
||||
nm_dbus_manager_private_server_register (priv->dbus_mgr, PRIV_SOCK_PATH, PRIV_SOCK_TAG);
|
||||
priv->new_conn_id = g_signal_connect (priv->dbus_mgr,
|
||||
NM_BUS_MANAGER_PRIVATE_CONNECTION_NEW "::" PRIV_SOCK_TAG,
|
||||
NM_DBUS_MANAGER_PRIVATE_CONNECTION_NEW "::" PRIV_SOCK_TAG,
|
||||
G_CALLBACK (new_connection_cb),
|
||||
self);
|
||||
priv->dis_conn_id = g_signal_connect (priv->dbus_mgr,
|
||||
NM_BUS_MANAGER_PRIVATE_CONNECTION_DISCONNECTED "::" PRIV_SOCK_TAG,
|
||||
NM_DBUS_MANAGER_PRIVATE_CONNECTION_DISCONNECTED "::" PRIV_SOCK_TAG,
|
||||
G_CALLBACK (dis_connection_cb),
|
||||
self);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
#include "nm-utils.h"
|
||||
#include "nm-ip4-config.h"
|
||||
#include "nm-ip6-config.h"
|
||||
#include "nm-bus-manager.h"
|
||||
#include "nm-dbus-manager.h"
|
||||
#include "NetworkManagerUtils.h"
|
||||
|
||||
#define PIDFILE NMRUNDIR "/dnsmasq.pid"
|
||||
|
|
@ -408,7 +408,7 @@ start_dnsmasq (NMDnsDnsmasq *self)
|
|||
const char *argv[15];
|
||||
GPid pid = 0;
|
||||
guint idx = 0;
|
||||
NMBusManager *dbus_mgr;
|
||||
NMDBusManager *dbus_mgr;
|
||||
GDBusConnection *connection;
|
||||
|
||||
if (priv->running) {
|
||||
|
|
@ -460,10 +460,10 @@ start_dnsmasq (NMDnsDnsmasq *self)
|
|||
return;
|
||||
}
|
||||
|
||||
dbus_mgr = nm_bus_manager_get ();
|
||||
dbus_mgr = nm_dbus_manager_get ();
|
||||
g_return_if_fail (dbus_mgr);
|
||||
|
||||
connection = nm_bus_manager_get_connection (dbus_mgr);
|
||||
connection = nm_dbus_manager_get_connection (dbus_mgr);
|
||||
g_return_if_fail (connection);
|
||||
|
||||
priv->dnsmasq_cancellable = g_cancellable_new ();
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@
|
|||
#include "nm-ip6-config.h"
|
||||
#include "NetworkManagerUtils.h"
|
||||
#include "nm-config.h"
|
||||
#include "nm-dbus-object.h"
|
||||
#include "devices/nm-device.h"
|
||||
#include "nm-manager.h"
|
||||
|
||||
|
|
@ -54,8 +55,6 @@
|
|||
#include "nm-dns-systemd-resolved.h"
|
||||
#include "nm-dns-unbound.h"
|
||||
|
||||
#include "introspection/org.freedesktop.NetworkManager.DnsManager.h"
|
||||
|
||||
#define HASH_LEN 20
|
||||
|
||||
#ifndef RESOLVCONF_PATH
|
||||
|
|
@ -135,15 +134,15 @@ typedef struct {
|
|||
} NMDnsManagerPrivate;
|
||||
|
||||
struct _NMDnsManager {
|
||||
NMExportedObject parent;
|
||||
NMDBusObject parent;
|
||||
NMDnsManagerPrivate _priv;
|
||||
};
|
||||
|
||||
struct _NMDnsManagerClass {
|
||||
NMExportedObjectClass parent;
|
||||
NMDBusObjectClass parent;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (NMDnsManager, nm_dns_manager, NM_TYPE_EXPORTED_OBJECT)
|
||||
G_DEFINE_TYPE (NMDnsManager, nm_dns_manager, NM_TYPE_DBUS_OBJECT)
|
||||
|
||||
#define NM_DNS_MANAGER_GET_PRIVATE(self) _NM_GET_PRIVATE(self, NMDnsManager, NM_IS_DNS_MANAGER)
|
||||
|
||||
|
|
@ -2091,6 +2090,8 @@ dispose (GObject *object)
|
|||
g_clear_object (&priv->config);
|
||||
|
||||
G_OBJECT_CLASS (nm_dns_manager_parent_class)->dispose (object);
|
||||
|
||||
g_clear_pointer (&priv->config_variant, g_variant_unref);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -2105,18 +2106,30 @@ finalize (GObject *object)
|
|||
G_OBJECT_CLASS (nm_dns_manager_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static const NMDBusInterfaceInfoExtended interface_info_dns_manager = {
|
||||
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
|
||||
NM_DBUS_INTERFACE_DNS_MANAGER,
|
||||
.properties = NM_DEFINE_GDBUS_PROPERTY_INFOS (
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Mode", "s", NM_DNS_MANAGER_MODE),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("RcManager", "s", NM_DNS_MANAGER_RC_MANAGER),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Configuration", "aa{sv}", NM_DNS_MANAGER_CONFIGURATION),
|
||||
),
|
||||
),
|
||||
};
|
||||
|
||||
static void
|
||||
nm_dns_manager_class_init (NMDnsManagerClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
NMExportedObjectClass *exported_object_class = NM_EXPORTED_OBJECT_CLASS (klass);
|
||||
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->dispose = dispose;
|
||||
object_class->finalize = finalize;
|
||||
object_class->get_property = get_property;
|
||||
|
||||
exported_object_class->export_path = NM_DBUS_PATH "/DnsManager";
|
||||
exported_object_class->export_on_construction = TRUE;
|
||||
dbus_object_class->export_path = NM_DBUS_PATH "/DnsManager";
|
||||
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_dns_manager);
|
||||
dbus_object_class->export_on_construction = TRUE;
|
||||
|
||||
obj_properties[PROP_MODE] =
|
||||
g_param_spec_string (NM_DNS_MANAGER_MODE, "", "",
|
||||
|
|
@ -2146,8 +2159,4 @@ nm_dns_manager_class_init (NMDnsManagerClass *klass)
|
|||
0, NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass),
|
||||
NMDBUS_TYPE_DNS_MANAGER_SKELETON,
|
||||
NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
#include "nm-utils.h"
|
||||
#include "nm-ip4-config.h"
|
||||
#include "nm-ip6-config.h"
|
||||
#include "nm-bus-manager.h"
|
||||
#include "nm-dbus-manager.h"
|
||||
#include "nm-manager.h"
|
||||
#include "nm-setting-connection.h"
|
||||
#include "devices/nm-device.h"
|
||||
|
|
@ -396,15 +396,15 @@ static void
|
|||
nm_dns_systemd_resolved_init (NMDnsSystemdResolved *self)
|
||||
{
|
||||
NMDnsSystemdResolvedPrivate *priv = NM_DNS_SYSTEMD_RESOLVED_GET_PRIVATE (self);
|
||||
NMBusManager *dbus_mgr;
|
||||
NMDBusManager *dbus_mgr;
|
||||
GDBusConnection *connection;
|
||||
|
||||
c_list_init (&priv->request_queue_lst_head);
|
||||
|
||||
dbus_mgr = nm_bus_manager_get ();
|
||||
dbus_mgr = nm_dbus_manager_get ();
|
||||
g_return_if_fail (dbus_mgr);
|
||||
|
||||
connection = nm_bus_manager_get_connection (dbus_mgr);
|
||||
connection = nm_dbus_manager_get_connection (dbus_mgr);
|
||||
g_return_if_fail (connection);
|
||||
|
||||
priv->init_cancellable = g_cancellable_new ();
|
||||
|
|
|
|||
37
src/main.c
37
src/main.c
|
|
@ -39,7 +39,7 @@
|
|||
#include "NetworkManagerUtils.h"
|
||||
#include "nm-manager.h"
|
||||
#include "platform/nm-linux-platform.h"
|
||||
#include "nm-bus-manager.h"
|
||||
#include "nm-dbus-manager.h"
|
||||
#include "devices/nm-device.h"
|
||||
#include "dhcp/nm-dhcp-manager.h"
|
||||
#include "nm-config.h"
|
||||
|
|
@ -48,7 +48,7 @@
|
|||
#include "settings/nm-settings.h"
|
||||
#include "nm-auth-manager.h"
|
||||
#include "nm-core-internal.h"
|
||||
#include "nm-exported-object.h"
|
||||
#include "nm-dbus-object.h"
|
||||
#include "nm-connectivity.h"
|
||||
#include "dns/nm-dns-manager.h"
|
||||
#include "systemd/nm-sd.h"
|
||||
|
|
@ -225,6 +225,7 @@ int
|
|||
main (int argc, char *argv[])
|
||||
{
|
||||
gboolean success = FALSE;
|
||||
NMManager *manager;
|
||||
NMConfig *config;
|
||||
GError *error = NULL;
|
||||
gboolean wrote_pidfile = FALSE;
|
||||
|
|
@ -236,7 +237,7 @@ main (int argc, char *argv[])
|
|||
* https://bugzilla.gnome.org/show_bug.cgi?id=674885 */
|
||||
g_type_ensure (G_TYPE_SOCKET);
|
||||
g_type_ensure (G_TYPE_DBUS_CONNECTION);
|
||||
g_type_ensure (NM_TYPE_BUS_MANAGER);
|
||||
g_type_ensure (NM_TYPE_DBUS_MANAGER);
|
||||
|
||||
_nm_utils_is_manager_process = TRUE;
|
||||
|
||||
|
|
@ -394,27 +395,22 @@ main (int argc, char *argv[])
|
|||
NM_CONFIG_KEYFILE_KEY_MAIN_AUTH_POLKIT,
|
||||
NM_CONFIG_DEFAULT_MAIN_AUTH_POLKIT_BOOL));
|
||||
|
||||
nm_manager_setup ();
|
||||
manager = nm_manager_setup ();
|
||||
|
||||
if (!nm_bus_manager_get_connection (nm_bus_manager_get ())) {
|
||||
nm_log_warn (LOGD_CORE, "Failed to connect to D-Bus; only private bus is available");
|
||||
} else {
|
||||
/* Start our DBus service */
|
||||
if (!nm_bus_manager_start_service (nm_bus_manager_get ())) {
|
||||
nm_log_err (LOGD_CORE, "failed to start the dbus service.");
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
if (!nm_dbus_manager_start (nm_dbus_manager_get (),
|
||||
nm_manager_dbus_set_property_handle,
|
||||
manager))
|
||||
goto done;
|
||||
|
||||
#if WITH_CONCHECK
|
||||
NM_UTILS_KEEP_ALIVE (nm_manager_get (), nm_connectivity_get (), "NMManager-depends-on-NMConnectivity");
|
||||
NM_UTILS_KEEP_ALIVE (manager, nm_connectivity_get (), "NMManager-depends-on-NMConnectivity");
|
||||
#endif
|
||||
|
||||
nm_dispatcher_init ();
|
||||
|
||||
g_signal_connect (nm_manager_get (), NM_MANAGER_CONFIGURE_QUIT, G_CALLBACK (manager_configure_quit), config);
|
||||
g_signal_connect (manager, NM_MANAGER_CONFIGURE_QUIT, G_CALLBACK (manager_configure_quit), config);
|
||||
|
||||
if (!nm_manager_start (nm_manager_get (), &error)) {
|
||||
if (!nm_manager_start (manager, &error)) {
|
||||
nm_log_err (LOGD_CORE, "failed to initialize: %s", error->message);
|
||||
goto done;
|
||||
}
|
||||
|
|
@ -448,11 +444,14 @@ done:
|
|||
* state here. We don't bother updating the state as devices
|
||||
* change during regular operation. If NM is killed with SIGKILL,
|
||||
* it misses to update the state. */
|
||||
nm_manager_write_device_state (nm_manager_get ());
|
||||
nm_manager_write_device_state (manager);
|
||||
|
||||
nm_exported_object_class_set_quitting ();
|
||||
/* FIXME: we don't properly shut down on exit. That is a bug.
|
||||
* NMDBusObject have an assertion that they get unexported before disposing.
|
||||
* We need this workaround and disable the assertion during our leaky shutdown. */
|
||||
nm_dbus_object_set_quitting ();
|
||||
|
||||
nm_manager_stop (nm_manager_get ());
|
||||
nm_manager_stop (manager);
|
||||
|
||||
nm_config_state_set (config, TRUE, TRUE);
|
||||
|
||||
|
|
|
|||
|
|
@ -65,14 +65,14 @@ sources = files(
|
|||
'main-utils.c',
|
||||
'NetworkManagerUtils.c',
|
||||
'nm-core-utils.c',
|
||||
'nm-exported-object.c',
|
||||
'nm-dbus-object.c',
|
||||
'nm-dbus-utils.c',
|
||||
'nm-ip4-config.c',
|
||||
'nm-ip6-config.c',
|
||||
'nm-logging.c'
|
||||
)
|
||||
|
||||
deps = [
|
||||
libnmdbus_dep,
|
||||
libsystemd_dep,
|
||||
libudev_dep,
|
||||
nm_core_dep
|
||||
|
|
@ -145,7 +145,7 @@ sources = files(
|
|||
'nm-auth-manager.c',
|
||||
'nm-auth-subject.c',
|
||||
'nm-auth-utils.c',
|
||||
'nm-bus-manager.c',
|
||||
'nm-dbus-manager.c',
|
||||
'nm-checkpoint.c',
|
||||
'nm-checkpoint-manager.c',
|
||||
'nm-config.c',
|
||||
|
|
|
|||
|
|
@ -32,8 +32,6 @@
|
|||
#include "NetworkManagerUtils.h"
|
||||
#include "nm-core-internal.h"
|
||||
|
||||
#include "introspection/org.freedesktop.NetworkManager.Connection.Active.h"
|
||||
|
||||
typedef struct _NMActiveConnectionPrivate {
|
||||
NMSettingsConnection *settings_connection;
|
||||
NMConnection *applied_connection;
|
||||
|
|
@ -103,12 +101,15 @@ enum {
|
|||
};
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE (NMActiveConnection, nm_active_connection, NM_TYPE_EXPORTED_OBJECT)
|
||||
G_DEFINE_ABSTRACT_TYPE (NMActiveConnection, nm_active_connection, NM_TYPE_DBUS_OBJECT)
|
||||
|
||||
#define NM_ACTIVE_CONNECTION_GET_PRIVATE(self) _NM_GET_PRIVATE_PTR(self, NMActiveConnection, NM_IS_ACTIVE_CONNECTION)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static const NMDBusInterfaceInfoExtended interface_info_active_connection;
|
||||
static const GDBusSignalInfo signal_info_state_changed;
|
||||
|
||||
static void check_master_ready (NMActiveConnection *self);
|
||||
static void _device_cleanup (NMActiveConnection *self);
|
||||
static void _settings_connection_notify_flags (NMSettingsConnection *settings_connection,
|
||||
|
|
@ -191,8 +192,8 @@ _settings_connection_removed (NMSettingsConnection *connection,
|
|||
* re-link; in that case we'd just clean the references to the old connection here).
|
||||
* Let's remove ourselves from the bus so that we're not exposed with a dangling
|
||||
* reference to the setting connection once it's gone. */
|
||||
if (nm_exported_object_is_exported (NM_EXPORTED_OBJECT (self)))
|
||||
nm_exported_object_unexport (NM_EXPORTED_OBJECT (self));
|
||||
if (nm_dbus_object_is_exported (NM_DBUS_OBJECT (self)))
|
||||
nm_dbus_object_unexport (NM_DBUS_OBJECT (self));
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -223,6 +224,18 @@ nm_active_connection_get_state (NMActiveConnection *self)
|
|||
return NM_ACTIVE_CONNECTION_GET_PRIVATE (self)->state;
|
||||
}
|
||||
|
||||
static void
|
||||
emit_state_changed (NMActiveConnection *self, guint state, guint reason)
|
||||
{
|
||||
nm_dbus_object_emit_signal (NM_DBUS_OBJECT (self),
|
||||
&interface_info_active_connection,
|
||||
&signal_info_state_changed,
|
||||
"(uu)",
|
||||
(guint32) state,
|
||||
(guint32) reason);
|
||||
g_signal_emit (self, signals[STATE_CHANGED], 0, state, reason);
|
||||
}
|
||||
|
||||
void
|
||||
nm_active_connection_set_state (NMActiveConnection *self,
|
||||
NMActiveConnectionState new_state,
|
||||
|
|
@ -253,7 +266,7 @@ nm_active_connection_set_state (NMActiveConnection *self,
|
|||
old_state = priv->state;
|
||||
priv->state = new_state;
|
||||
priv->state_set = TRUE;
|
||||
g_signal_emit (self, signals[STATE_CHANGED], 0, (guint) new_state, (guint) reason);
|
||||
emit_state_changed (self, new_state, reason);
|
||||
_notify (self, PROP_STATE);
|
||||
|
||||
check_master_ready (self);
|
||||
|
|
@ -451,7 +464,7 @@ nm_active_connection_set_settings_connection (NMActiveConnection *self,
|
|||
* never changes (once it's set). That has effects for NMVpnConnection and
|
||||
* NMActivationRequest.
|
||||
* For example, we'd have to cancel all pending seret requests. */
|
||||
g_return_if_fail (!nm_exported_object_is_exported (NM_EXPORTED_OBJECT (self)));
|
||||
g_return_if_fail (!nm_dbus_object_is_exported (NM_DBUS_OBJECT (self)));
|
||||
|
||||
_set_settings_connection (self, connection);
|
||||
|
||||
|
|
@ -810,7 +823,7 @@ nm_active_connection_set_master (NMActiveConnection *self, NMActiveConnection *m
|
|||
|
||||
/* Master is write-once, and must be set before exporting the object */
|
||||
g_return_if_fail (priv->master == NULL);
|
||||
g_return_if_fail (!nm_exported_object_is_exported (NM_EXPORTED_OBJECT (self)));
|
||||
g_return_if_fail (!nm_dbus_object_is_exported (NM_DBUS_OBJECT (self)));
|
||||
if (priv->device) {
|
||||
/* Note, the master ActiveConnection may not yet have a device */
|
||||
g_return_if_fail (priv->device != nm_active_connection_get_device (master));
|
||||
|
|
@ -1171,7 +1184,7 @@ get_property (GObject *object, guint prop_id,
|
|||
case PROP_DEVICES:
|
||||
devices = g_ptr_array_sized_new (2);
|
||||
if (priv->device && priv->state < NM_ACTIVE_CONNECTION_STATE_DEACTIVATED)
|
||||
g_ptr_array_add (devices, g_strdup (nm_exported_object_get_path (NM_EXPORTED_OBJECT (priv->device))));
|
||||
g_ptr_array_add (devices, g_strdup (nm_dbus_object_get_path (NM_DBUS_OBJECT (priv->device))));
|
||||
g_ptr_array_add (devices, NULL);
|
||||
g_value_take_boxed (value, (char **) g_ptr_array_free (devices, FALSE));
|
||||
break;
|
||||
|
|
@ -1213,7 +1226,7 @@ get_property (GObject *object, guint prop_id,
|
|||
case PROP_MASTER:
|
||||
if (priv->master)
|
||||
master_device = nm_active_connection_get_device (priv->master);
|
||||
nm_utils_g_value_set_object_path (value, master_device);
|
||||
nm_dbus_utils_g_value_set_object_path (value, master_device);
|
||||
break;
|
||||
case PROP_INT_SUBJECT:
|
||||
g_value_set_object (value, priv->subject);
|
||||
|
|
@ -1389,22 +1402,59 @@ dispose (GObject *object)
|
|||
G_OBJECT_CLASS (nm_active_connection_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static const GDBusSignalInfo signal_info_state_changed = NM_DEFINE_GDBUS_SIGNAL_INFO_INIT (
|
||||
"StateChanged",
|
||||
.args = NM_DEFINE_GDBUS_ARG_INFOS (
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("state", "u"),
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("reason", "u"),
|
||||
),
|
||||
);
|
||||
|
||||
static const NMDBusInterfaceInfoExtended interface_info_active_connection = {
|
||||
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
|
||||
NM_DBUS_INTERFACE_ACTIVE_CONNECTION,
|
||||
.signals = NM_DEFINE_GDBUS_SIGNAL_INFOS (
|
||||
&nm_signal_info_property_changed_legacy,
|
||||
&signal_info_state_changed,
|
||||
),
|
||||
.properties = NM_DEFINE_GDBUS_PROPERTY_INFOS (
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Connection", "o", NM_ACTIVE_CONNECTION_CONNECTION),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("SpecificObject", "o", NM_ACTIVE_CONNECTION_SPECIFIC_OBJECT),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Id", "s", NM_ACTIVE_CONNECTION_ID),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Uuid", "s", NM_ACTIVE_CONNECTION_UUID),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Type", "s", NM_ACTIVE_CONNECTION_TYPE),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Devices", "ao", NM_ACTIVE_CONNECTION_DEVICES),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("State", "u", NM_ACTIVE_CONNECTION_STATE),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("StateFlags", "u", NM_ACTIVE_CONNECTION_STATE_FLAGS),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Default", "b", NM_ACTIVE_CONNECTION_DEFAULT),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Ip4Config", "o", NM_ACTIVE_CONNECTION_IP4_CONFIG),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Dhcp4Config", "o", NM_ACTIVE_CONNECTION_DHCP4_CONFIG),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Default6", "b", NM_ACTIVE_CONNECTION_DEFAULT6),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Ip6Config", "o", NM_ACTIVE_CONNECTION_IP6_CONFIG),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Dhcp6Config", "o", NM_ACTIVE_CONNECTION_DHCP6_CONFIG),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Vpn", "b", NM_ACTIVE_CONNECTION_VPN),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Master", "o", NM_ACTIVE_CONNECTION_MASTER),
|
||||
),
|
||||
),
|
||||
.legacy_property_changed = TRUE,
|
||||
};
|
||||
|
||||
static void
|
||||
nm_active_connection_class_init (NMActiveConnectionClass *ac_class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (ac_class);
|
||||
NMExportedObjectClass *exported_object_class = NM_EXPORTED_OBJECT_CLASS (ac_class);
|
||||
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (ac_class);
|
||||
|
||||
g_type_class_add_private (ac_class, sizeof (NMActiveConnectionPrivate));
|
||||
|
||||
exported_object_class->export_path = NM_EXPORT_PATH_NUMBERED (NM_DBUS_PATH"/ActiveConnection");
|
||||
dbus_object_class->export_path = NM_EXPORT_PATH_NUMBERED (NM_DBUS_PATH"/ActiveConnection");
|
||||
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_active_connection);
|
||||
|
||||
object_class->get_property = get_property;
|
||||
object_class->set_property = set_property;
|
||||
object_class->constructed = constructed;
|
||||
object_class->dispose = dispose;
|
||||
|
||||
/* D-Bus exported properties */
|
||||
obj_properties[PROP_CONNECTION] =
|
||||
g_param_spec_string (NM_ACTIVE_CONNECTION_CONNECTION, "", "",
|
||||
NULL,
|
||||
|
|
@ -1580,9 +1630,4 @@ nm_active_connection_class_init (NMActiveConnectionClass *ac_class)
|
|||
G_SIGNAL_RUN_FIRST,
|
||||
0, NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_UINT);
|
||||
|
||||
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (ac_class),
|
||||
NMDBUS_TYPE_ACTIVE_CONNECTION_SKELETON,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,10 +21,9 @@
|
|||
#ifndef __NETWORKMANAGER_ACTIVE_CONNECTION_H__
|
||||
#define __NETWORKMANAGER_ACTIVE_CONNECTION_H__
|
||||
|
||||
#include "nm-exported-object.h"
|
||||
#include "nm-connection.h"
|
||||
|
||||
#include "nm-utils/c-list.h"
|
||||
#include "nm-connection.h"
|
||||
#include "nm-dbus-object.h"
|
||||
|
||||
#define NM_TYPE_ACTIVE_CONNECTION (nm_active_connection_get_type ())
|
||||
#define NM_ACTIVE_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_ACTIVE_CONNECTION, NMActiveConnection))
|
||||
|
|
@ -71,7 +70,7 @@
|
|||
struct _NMActiveConnectionPrivate;
|
||||
|
||||
struct _NMActiveConnection {
|
||||
NMExportedObject parent;
|
||||
NMDBusObject parent;
|
||||
struct _NMActiveConnectionPrivate *_priv;
|
||||
|
||||
/* active connection can be tracked in a list by NMManager. This is
|
||||
|
|
@ -80,7 +79,7 @@ struct _NMActiveConnection {
|
|||
};
|
||||
|
||||
typedef struct {
|
||||
NMExportedObjectClass parent;
|
||||
NMDBusObjectClass parent;
|
||||
|
||||
/* re-emits device state changes as a convenience for subclasses for
|
||||
* device states >= DISCONNECTED.
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "nm-bus-manager.h"
|
||||
#include "nm-dbus-manager.h"
|
||||
#include "NetworkManagerUtils.h"
|
||||
|
||||
enum {
|
||||
|
|
@ -186,18 +186,18 @@ _new_unix_process (GDBusMethodInvocation *context,
|
|||
g_return_val_if_fail (context || (connection && message), NULL);
|
||||
|
||||
if (context) {
|
||||
success = nm_bus_manager_get_caller_info (nm_bus_manager_get (),
|
||||
context,
|
||||
&dbus_sender,
|
||||
&uid,
|
||||
&pid);
|
||||
success = nm_dbus_manager_get_caller_info (nm_dbus_manager_get (),
|
||||
context,
|
||||
&dbus_sender,
|
||||
&uid,
|
||||
&pid);
|
||||
} else if (message) {
|
||||
success = nm_bus_manager_get_caller_info_from_message (nm_bus_manager_get (),
|
||||
connection,
|
||||
message,
|
||||
&dbus_sender,
|
||||
&uid,
|
||||
&pid);
|
||||
success = nm_dbus_manager_get_caller_info_from_message (nm_dbus_manager_get (),
|
||||
connection,
|
||||
message,
|
||||
&dbus_sender,
|
||||
&uid,
|
||||
&pid);
|
||||
} else
|
||||
g_assert_not_reached ();
|
||||
|
||||
|
|
|
|||
1030
src/nm-bus-manager.c
1030
src/nm-bus-manager.c
File diff suppressed because it is too large
Load diff
|
|
@ -1,93 +0,0 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
||||
/* NetworkManager -- Network link manager
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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 along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright (C) 2006 - 2008 Red Hat, Inc.
|
||||
* Copyright (C) 2006 - 2008 Novell, Inc.
|
||||
*/
|
||||
|
||||
#ifndef __NM_BUS_MANAGER_H__
|
||||
#define __NM_BUS_MANAGER_H__
|
||||
|
||||
#define NM_TYPE_BUS_MANAGER (nm_bus_manager_get_type ())
|
||||
#define NM_BUS_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), NM_TYPE_BUS_MANAGER, NMBusManager))
|
||||
#define NM_BUS_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), NM_TYPE_BUS_MANAGER, NMBusManagerClass))
|
||||
#define NM_IS_BUS_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), NM_TYPE_BUS_MANAGER))
|
||||
#define NM_IS_BUS_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), NM_TYPE_BUS_MANAGER))
|
||||
#define NM_BUS_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), NM_TYPE_BUS_MANAGER, NMBusManagerClass))
|
||||
|
||||
#define NM_BUS_MANAGER_DBUS_CONNECTION_CHANGED "dbus-connection-changed"
|
||||
#define NM_BUS_MANAGER_PRIVATE_CONNECTION_NEW "private-connection-new"
|
||||
#define NM_BUS_MANAGER_PRIVATE_CONNECTION_DISCONNECTED "private-connection-disconnected"
|
||||
|
||||
typedef struct _NMBusManagerClass NMBusManagerClass;
|
||||
|
||||
GType nm_bus_manager_get_type (void);
|
||||
|
||||
NMBusManager * nm_bus_manager_get (void);
|
||||
void nm_bus_manager_setup (NMBusManager *instance);
|
||||
|
||||
gboolean nm_bus_manager_start_service (NMBusManager *self);
|
||||
|
||||
GDBusConnection * nm_bus_manager_get_connection (NMBusManager *self);
|
||||
|
||||
gboolean nm_bus_manager_get_caller_info (NMBusManager *self,
|
||||
GDBusMethodInvocation *context,
|
||||
char **out_sender,
|
||||
gulong *out_uid,
|
||||
gulong *out_pid);
|
||||
|
||||
gboolean nm_bus_manager_ensure_uid (NMBusManager *self,
|
||||
GDBusMethodInvocation *context,
|
||||
gulong uid,
|
||||
GQuark error_domain,
|
||||
int error_code);
|
||||
|
||||
const char *nm_bus_manager_connection_get_private_name (NMBusManager *self,
|
||||
GDBusConnection *connection);
|
||||
|
||||
gboolean nm_bus_manager_get_unix_user (NMBusManager *self,
|
||||
const char *sender,
|
||||
gulong *out_uid);
|
||||
|
||||
gboolean nm_bus_manager_get_caller_info_from_message (NMBusManager *self,
|
||||
GDBusConnection *connection,
|
||||
GDBusMessage *message,
|
||||
char **out_sender,
|
||||
gulong *out_uid,
|
||||
gulong *out_pid);
|
||||
|
||||
void nm_bus_manager_register_object (NMBusManager *self,
|
||||
GDBusObjectSkeleton *object);
|
||||
|
||||
void nm_bus_manager_unregister_object (NMBusManager *self,
|
||||
GDBusObjectSkeleton *object);
|
||||
|
||||
GDBusObjectSkeleton *nm_bus_manager_get_registered_object (NMBusManager *self,
|
||||
const char *path);
|
||||
|
||||
void nm_bus_manager_private_server_register (NMBusManager *self,
|
||||
const char *path,
|
||||
const char *tag);
|
||||
|
||||
GDBusProxy *nm_bus_manager_new_proxy (NMBusManager *self,
|
||||
GDBusConnection *connection,
|
||||
GType proxy_type,
|
||||
const char *name,
|
||||
const char *path,
|
||||
const char *iface);
|
||||
|
||||
#endif /* __NM_BUS_MANAGER_H__ */
|
||||
|
|
@ -26,7 +26,6 @@
|
|||
#include "nm-connection.h"
|
||||
#include "nm-core-utils.h"
|
||||
#include "devices/nm-device.h"
|
||||
#include "nm-exported-object.h"
|
||||
#include "nm-manager.h"
|
||||
#include "nm-utils.h"
|
||||
#include "nm-utils/c-list.h"
|
||||
|
|
@ -78,7 +77,7 @@ item_destroy (gpointer data)
|
|||
CheckpointItem *item = data;
|
||||
|
||||
c_list_unlink_stale (&item->list);
|
||||
nm_exported_object_unexport (NM_EXPORTED_OBJECT (item->checkpoint));
|
||||
nm_dbus_object_unexport (NM_DBUS_OBJECT (item->checkpoint));
|
||||
g_object_unref (G_OBJECT (item->checkpoint));
|
||||
g_slice_free (CheckpointItem, item);
|
||||
}
|
||||
|
|
@ -100,7 +99,7 @@ rollback_timeout_cb (NMCheckpointManager *self)
|
|||
result = nm_checkpoint_rollback (item->checkpoint);
|
||||
if (result)
|
||||
g_variant_unref (result);
|
||||
path = nm_exported_object_get_path (NM_EXPORTED_OBJECT (item->checkpoint));
|
||||
path = nm_dbus_object_get_path (NM_DBUS_OBJECT (item->checkpoint));
|
||||
if (!g_hash_table_remove (self->checkpoints, path))
|
||||
nm_assert_not_reached();
|
||||
removed = TRUE;
|
||||
|
|
@ -185,7 +184,7 @@ nm_checkpoint_manager_create (NMCheckpointManager *self,
|
|||
device = NM_DEVICE (iter->data);
|
||||
if (!nm_device_is_real (device))
|
||||
continue;
|
||||
device_path = nm_exported_object_get_path (NM_EXPORTED_OBJECT (device));
|
||||
device_path = nm_dbus_object_get_path (NM_DBUS_OBJECT (device));
|
||||
if (device_path)
|
||||
g_ptr_array_add (paths, (gpointer) device_path);
|
||||
}
|
||||
|
|
@ -217,7 +216,7 @@ nm_checkpoint_manager_create (NMCheckpointManager *self,
|
|||
g_set_error (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_INVALID_ARGUMENTS,
|
||||
"device '%s' is already included in checkpoint %s",
|
||||
nm_device_get_iface (device),
|
||||
nm_exported_object_get_path (NM_EXPORTED_OBJECT (checkpoint)));
|
||||
nm_dbus_object_get_path (NM_DBUS_OBJECT (checkpoint)));
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
|
@ -230,8 +229,7 @@ nm_checkpoint_manager_create (NMCheckpointManager *self,
|
|||
if (NM_FLAGS_HAS (flags, NM_CHECKPOINT_CREATE_FLAG_DESTROY_ALL))
|
||||
g_hash_table_remove_all (self->checkpoints);
|
||||
|
||||
nm_exported_object_export (NM_EXPORTED_OBJECT (checkpoint));
|
||||
checkpoint_path = nm_exported_object_get_path (NM_EXPORTED_OBJECT (checkpoint));
|
||||
checkpoint_path = nm_dbus_object_export (NM_DBUS_OBJECT (checkpoint));
|
||||
|
||||
item = g_slice_new0 (CheckpointItem);
|
||||
item->checkpoint = checkpoint;
|
||||
|
|
@ -326,7 +324,7 @@ nm_checkpoint_manager_get_checkpoint_paths (NMCheckpointManager *self)
|
|||
|
||||
strv = g_new (char *, num + 1);
|
||||
c_list_for_each_entry (item, &self->list, list)
|
||||
strv[i++] = g_strdup (nm_exported_object_get_path (NM_EXPORTED_OBJECT (item->checkpoint)));
|
||||
strv[i++] = g_strdup (nm_dbus_object_get_path (NM_DBUS_OBJECT (item->checkpoint)));
|
||||
nm_assert (i == num);
|
||||
strv[i] = NULL;
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@
|
|||
#include "settings/nm-settings-connection.h"
|
||||
#include "nm-simple-connection.h"
|
||||
#include "nm-utils.h"
|
||||
#include "introspection/org.freedesktop.NetworkManager.Checkpoint.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
|
@ -68,15 +67,15 @@ typedef struct {
|
|||
} NMCheckpointPrivate;
|
||||
|
||||
struct _NMCheckpoint {
|
||||
NMExportedObject parent;
|
||||
NMDBusObject parent;
|
||||
NMCheckpointPrivate _priv;
|
||||
};
|
||||
|
||||
struct _NMCheckpointClass {
|
||||
NMExportedObjectClass parent;
|
||||
NMDBusObjectClass parent;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (NMCheckpoint, nm_checkpoint, NM_TYPE_EXPORTED_OBJECT)
|
||||
G_DEFINE_TYPE (NMCheckpoint, nm_checkpoint, NM_TYPE_DBUS_OBJECT)
|
||||
|
||||
#define NM_CHECKPOINT_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMCheckpoint, NM_IS_CHECKPOINT)
|
||||
|
||||
|
|
@ -183,7 +182,7 @@ nm_checkpoint_rollback (NMCheckpoint *self)
|
|||
GError *local_error = NULL;
|
||||
GVariantBuilder builder;
|
||||
|
||||
_LOGI ("rollback of %s", nm_exported_object_get_path ((NMExportedObject *) self));
|
||||
_LOGI ("rollback of %s", nm_dbus_object_get_path (NM_DBUS_OBJECT (self)));
|
||||
g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{su}"));
|
||||
|
||||
/* Start rolling-back each device */
|
||||
|
|
@ -382,7 +381,7 @@ device_checkpoint_create (NMDevice *device,
|
|||
const char *path;
|
||||
NMActRequest *act_request;
|
||||
|
||||
path = nm_exported_object_get_path (NM_EXPORTED_OBJECT (device));
|
||||
path = nm_dbus_object_get_path (NM_DBUS_OBJECT (device));
|
||||
|
||||
dev_checkpoint = g_slice_new0 (DeviceCheckpoint);
|
||||
dev_checkpoint->device = g_object_ref (device);
|
||||
|
|
@ -392,7 +391,7 @@ device_checkpoint_create (NMDevice *device,
|
|||
|
||||
if (nm_device_get_unmanaged_mask (device, NM_UNMANAGED_USER_EXPLICIT)) {
|
||||
dev_checkpoint->unmanaged_explicit =
|
||||
!!nm_device_get_unmanaged_flags (device, NM_UNMANAGED_USER_EXPLICIT);
|
||||
!!nm_device_get_unmanaged_flags (device, NM_UNMANAGED_USER_EXPLICIT);
|
||||
} else
|
||||
dev_checkpoint->unmanaged_explicit = NM_UNMAN_FLAG_OP_FORGET;
|
||||
|
||||
|
|
@ -445,7 +444,7 @@ get_property (GObject *object, guint prop_id,
|
|||
g_hash_table_iter_init (&iter, priv->devices);
|
||||
while (g_hash_table_iter_next (&iter, (gpointer *) &device, NULL))
|
||||
devices = g_slist_append (devices, device);
|
||||
nm_utils_g_value_set_object_path_array (value, devices, NULL, NULL);
|
||||
nm_dbus_utils_g_value_set_object_path_array (value, devices, NULL, NULL);
|
||||
break;
|
||||
case PROP_CREATED:
|
||||
g_value_set_int64 (value, priv->created);
|
||||
|
|
@ -538,14 +537,29 @@ dispose (GObject *object)
|
|||
G_OBJECT_CLASS (nm_checkpoint_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static const NMDBusInterfaceInfoExtended interface_info_checkpoint = {
|
||||
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
|
||||
NM_DBUS_INTERFACE_CHECKPOINT,
|
||||
.signals = NM_DEFINE_GDBUS_SIGNAL_INFOS (
|
||||
&nm_signal_info_property_changed_legacy,
|
||||
),
|
||||
.properties = NM_DEFINE_GDBUS_PROPERTY_INFOS (
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Devices", "ao", NM_CHECKPOINT_DEVICES),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Created", "x", NM_CHECKPOINT_CREATED),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("RollbackTimeout", "u", NM_CHECKPOINT_ROLLBACK_TIMEOUT),
|
||||
),
|
||||
),
|
||||
.legacy_property_changed = TRUE,
|
||||
};
|
||||
|
||||
static void
|
||||
nm_checkpoint_class_init (NMCheckpointClass *checkpoint_class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (checkpoint_class);
|
||||
NMExportedObjectClass *exported_object_class = NM_EXPORTED_OBJECT_CLASS (checkpoint_class);
|
||||
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (checkpoint_class);
|
||||
|
||||
exported_object_class->export_path = NM_EXPORT_PATH_NUMBERED (NM_DBUS_PATH"/Checkpoint");
|
||||
exported_object_class->export_on_construction = FALSE;
|
||||
dbus_object_class->export_path = NM_EXPORT_PATH_NUMBERED (NM_DBUS_PATH"/Checkpoint");
|
||||
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_checkpoint);
|
||||
|
||||
object_class->dispose = dispose;
|
||||
object_class->get_property = get_property;
|
||||
|
|
@ -569,8 +583,4 @@ nm_checkpoint_class_init (NMCheckpointClass *checkpoint_class)
|
|||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
||||
|
||||
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (checkpoint_class),
|
||||
NMDBUS_TYPE_CHECKPOINT_SKELETON,
|
||||
NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#ifndef __NETWORKMANAGER_CHECKPOINT_H__
|
||||
#define __NETWORKMANAGER_CHECKPOINT_H__
|
||||
|
||||
#include "nm-exported-object.h"
|
||||
#include "nm-dbus-object.h"
|
||||
#include "nm-dbus-interface.h"
|
||||
|
||||
#define NM_TYPE_CHECKPOINT (nm_checkpoint_get_type ())
|
||||
|
|
|
|||
1593
src/nm-dbus-manager.c
Normal file
1593
src/nm-dbus-manager.c
Normal file
File diff suppressed because it is too large
Load diff
107
src/nm-dbus-manager.h
Normal file
107
src/nm-dbus-manager.h
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
||||
/* NetworkManager -- Network link manager
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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 along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright (C) 2006 - 2008 Red Hat, Inc.
|
||||
* Copyright (C) 2006 - 2008 Novell, Inc.
|
||||
*/
|
||||
|
||||
#ifndef __NM_DBUS_MANAGER_H__
|
||||
#define __NM_DBUS_MANAGER_H__
|
||||
|
||||
#include "nm-dbus-utils.h"
|
||||
|
||||
#define NM_TYPE_DBUS_MANAGER (nm_dbus_manager_get_type ())
|
||||
#define NM_DBUS_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), NM_TYPE_DBUS_MANAGER, NMDBusManager))
|
||||
#define NM_DBUS_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), NM_TYPE_DBUS_MANAGER, NMDBusManagerClass))
|
||||
#define NM_IS_DBUS_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), NM_TYPE_DBUS_MANAGER))
|
||||
#define NM_IS_DBUS_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), NM_TYPE_DBUS_MANAGER))
|
||||
#define NM_DBUS_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), NM_TYPE_DBUS_MANAGER, NMDBusManagerClass))
|
||||
|
||||
#define NM_DBUS_MANAGER_PRIVATE_CONNECTION_NEW "private-connection-new"
|
||||
#define NM_DBUS_MANAGER_PRIVATE_CONNECTION_DISCONNECTED "private-connection-disconnected"
|
||||
|
||||
typedef struct _NMDBusManagerClass NMDBusManagerClass;
|
||||
|
||||
GType nm_dbus_manager_get_type (void);
|
||||
|
||||
NMDBusManager *nm_dbus_manager_get (void);
|
||||
|
||||
typedef void (*NMDBusManagerSetPropertyHandler) (NMDBusObject *obj,
|
||||
const NMDBusInterfaceInfoExtended *interface_info,
|
||||
const NMDBusPropertyInfoExtended *property_info,
|
||||
GDBusConnection *connection,
|
||||
const char *sender,
|
||||
GDBusMethodInvocation *invocation,
|
||||
GVariant *value,
|
||||
gpointer user_data);
|
||||
|
||||
gboolean nm_dbus_manager_start (NMDBusManager *self,
|
||||
NMDBusManagerSetPropertyHandler handler,
|
||||
gpointer handler_data);
|
||||
|
||||
GDBusConnection *nm_dbus_manager_get_connection (NMDBusManager *self);
|
||||
|
||||
NMDBusObject *nm_dbus_manager_lookup_object (NMDBusManager *self, const char *path);
|
||||
|
||||
void _nm_dbus_manager_obj_export (NMDBusObject *obj);
|
||||
void _nm_dbus_manager_obj_unexport (NMDBusObject *obj);
|
||||
void _nm_dbus_manager_obj_notify (NMDBusObject *obj,
|
||||
guint n_pspecs,
|
||||
const GParamSpec *const*pspecs);
|
||||
void _nm_dbus_manager_obj_emit_signal (NMDBusObject *obj,
|
||||
const NMDBusInterfaceInfoExtended *interface_info,
|
||||
const GDBusSignalInfo *signal_info,
|
||||
GVariant *args);
|
||||
|
||||
gboolean nm_dbus_manager_get_caller_info (NMDBusManager *self,
|
||||
GDBusMethodInvocation *context,
|
||||
char **out_sender,
|
||||
gulong *out_uid,
|
||||
gulong *out_pid);
|
||||
|
||||
gboolean nm_dbus_manager_ensure_uid (NMDBusManager *self,
|
||||
GDBusMethodInvocation *context,
|
||||
gulong uid,
|
||||
GQuark error_domain,
|
||||
int error_code);
|
||||
|
||||
const char *nm_dbus_manager_connection_get_private_name (NMDBusManager *self,
|
||||
GDBusConnection *connection);
|
||||
|
||||
gboolean nm_dbus_manager_get_unix_user (NMDBusManager *self,
|
||||
const char *sender,
|
||||
gulong *out_uid);
|
||||
|
||||
gboolean nm_dbus_manager_get_caller_info_from_message (NMDBusManager *self,
|
||||
GDBusConnection *connection,
|
||||
GDBusMessage *message,
|
||||
char **out_sender,
|
||||
gulong *out_uid,
|
||||
gulong *out_pid);
|
||||
|
||||
void nm_dbus_manager_private_server_register (NMDBusManager *self,
|
||||
const char *path,
|
||||
const char *tag);
|
||||
|
||||
GDBusProxy *nm_dbus_manager_new_proxy (NMDBusManager *self,
|
||||
GDBusConnection *connection,
|
||||
GType proxy_type,
|
||||
const char *name,
|
||||
const char *path,
|
||||
const char *iface);
|
||||
|
||||
#endif /* __NM_DBUS_MANAGER_H__ */
|
||||
319
src/nm-dbus-object.c
Normal file
319
src/nm-dbus-object.c
Normal file
|
|
@ -0,0 +1,319 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
||||
/* NetworkManager -- Network link manager
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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 along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright 2018 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#include "nm-default.h"
|
||||
|
||||
#include "nm-dbus-object.h"
|
||||
|
||||
#include "nm-dbus-manager.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static gboolean quitting = FALSE;
|
||||
|
||||
void
|
||||
nm_dbus_object_set_quitting (void)
|
||||
{
|
||||
nm_assert (!quitting);
|
||||
quitting = TRUE;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
NM_GOBJECT_PROPERTIES_DEFINE (NMDBusObject,
|
||||
PROP_PATH,
|
||||
);
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE (NMDBusObject, nm_dbus_object, G_TYPE_OBJECT);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#define _NMLOG_DOMAIN LOGD_CORE
|
||||
#define _NMLOG(level, ...) __NMLOG_DEFAULT_WITH_ADDR (level, _NMLOG_DOMAIN, "dbus-object", __VA_ARGS__)
|
||||
|
||||
#define _NMLOG2_DOMAIN LOGD_DBUS_PROPS
|
||||
#define _NMLOG2(level, ...) __NMLOG_DEFAULT_WITH_ADDR (level, _NMLOG2_DOMAIN, "properties-changed", __VA_ARGS__)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static char *
|
||||
_create_export_path (NMDBusObjectClass *klass)
|
||||
{
|
||||
const char *class_export_path, *p;
|
||||
static GHashTable *prefix_counters;
|
||||
guint64 *counter;
|
||||
|
||||
class_export_path = klass->export_path;
|
||||
|
||||
nm_assert (class_export_path);
|
||||
|
||||
p = strchr (class_export_path, '%');
|
||||
if (p) {
|
||||
if (G_UNLIKELY (!prefix_counters))
|
||||
prefix_counters = g_hash_table_new (nm_str_hash, g_str_equal);
|
||||
|
||||
nm_assert (p[1] == 'l');
|
||||
nm_assert (p[2] == 'l');
|
||||
nm_assert (p[3] == 'u');
|
||||
nm_assert (p[4] == '\0');
|
||||
|
||||
counter = g_hash_table_lookup (prefix_counters, class_export_path);
|
||||
if (!counter) {
|
||||
counter = g_slice_new0 (guint64);
|
||||
g_hash_table_insert (prefix_counters, (char *) class_export_path, counter);
|
||||
}
|
||||
|
||||
NM_PRAGMA_WARNING_DISABLE("-Wformat-nonliteral")
|
||||
return g_strdup_printf (class_export_path, (unsigned long long) (++(*counter)));
|
||||
NM_PRAGMA_WARNING_REENABLE
|
||||
}
|
||||
|
||||
return g_strdup (class_export_path);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_dbus_object_export:
|
||||
* @self: an #NMDBusObject
|
||||
*
|
||||
* Exports @self on all active and future D-Bus connections.
|
||||
*
|
||||
* The path to export @self on is taken from its #NMObjectClass's %export_path
|
||||
* member. If the %export_path contains "%u", then it will be replaced with a
|
||||
* monotonically increasing integer ID (with each distinct %export_path having
|
||||
* its own counter). Otherwise, %export_path will be used literally (implying
|
||||
* that @self must be a singleton).
|
||||
*
|
||||
* Returns: the path @self was exported under
|
||||
*/
|
||||
const char *
|
||||
nm_dbus_object_export (NMDBusObject *self)
|
||||
{
|
||||
static guint64 id_counter = 0;
|
||||
|
||||
g_return_val_if_fail (NM_IS_DBUS_OBJECT (self), NULL);
|
||||
|
||||
g_return_val_if_fail (!self->internal.path, self->internal.path);
|
||||
|
||||
self->internal.path = _create_export_path (NM_DBUS_OBJECT_GET_CLASS (self));
|
||||
|
||||
self->internal.export_version_id = ++id_counter;
|
||||
|
||||
_LOGT ("export: \"%s\"", self->internal.path);
|
||||
|
||||
_nm_dbus_manager_obj_export (self);
|
||||
|
||||
_notify (self, PROP_PATH);
|
||||
return self->internal.path;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_dbus_object_unexport:
|
||||
* @self: an #NMDBusObject
|
||||
*
|
||||
* Unexports @self on all active D-Bus connections (and prevents it from being
|
||||
* auto-exported on future connections).
|
||||
*/
|
||||
void
|
||||
nm_dbus_object_unexport (NMDBusObject *self)
|
||||
{
|
||||
g_return_if_fail (NM_IS_DBUS_OBJECT (self));
|
||||
|
||||
g_return_if_fail (self->internal.path);
|
||||
|
||||
_LOGT ("unexport: \"%s\"", self->internal.path);
|
||||
|
||||
_nm_dbus_manager_obj_unexport (self);
|
||||
|
||||
g_clear_pointer (&self->internal.path, g_free);
|
||||
self->internal.export_version_id = 0;
|
||||
|
||||
_notify (self, PROP_PATH);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
void
|
||||
_nm_dbus_object_clear_and_unexport (NMDBusObject **location)
|
||||
{
|
||||
NMDBusObject *self;
|
||||
|
||||
g_return_if_fail (location);
|
||||
if (!*location)
|
||||
return;
|
||||
|
||||
self = g_steal_pointer (location);
|
||||
|
||||
g_return_if_fail (NM_IS_DBUS_OBJECT (self));
|
||||
|
||||
if (self->internal.path)
|
||||
nm_dbus_object_unexport (self);
|
||||
|
||||
g_object_unref (self);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
void
|
||||
nm_dbus_object_emit_signal_variant (NMDBusObject *self,
|
||||
const NMDBusInterfaceInfoExtended *interface_info,
|
||||
const GDBusSignalInfo *signal_info,
|
||||
GVariant *args)
|
||||
{
|
||||
if (!self->internal.path) {
|
||||
nm_g_variant_unref_floating (args);
|
||||
return;
|
||||
}
|
||||
_nm_dbus_manager_obj_emit_signal (self, interface_info, signal_info, args);
|
||||
}
|
||||
|
||||
void
|
||||
nm_dbus_object_emit_signal (NMDBusObject *self,
|
||||
const NMDBusInterfaceInfoExtended *interface_info,
|
||||
const GDBusSignalInfo *signal_info,
|
||||
const char *format,
|
||||
...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
nm_assert (NM_IS_DBUS_OBJECT (self));
|
||||
nm_assert (format);
|
||||
|
||||
if (!self->internal.path)
|
||||
return;
|
||||
|
||||
va_start (ap, format);
|
||||
_nm_dbus_manager_obj_emit_signal (self,
|
||||
interface_info,
|
||||
signal_info,
|
||||
g_variant_new_va (format, NULL, &ap));
|
||||
va_end (ap);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
get_property (GObject *object, guint prop_id,
|
||||
GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
NMDBusObject *self = NM_DBUS_OBJECT (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_PATH:
|
||||
g_value_set_string (value, self->internal.path);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
dispatch_properties_changed (GObject *object,
|
||||
guint n_pspecs,
|
||||
GParamSpec **pspecs)
|
||||
{
|
||||
NMDBusObject *self = NM_DBUS_OBJECT (object);
|
||||
|
||||
if (self->internal.path)
|
||||
_nm_dbus_manager_obj_notify (self, n_pspecs, (const GParamSpec *const*) pspecs);
|
||||
|
||||
G_OBJECT_CLASS (nm_dbus_object_parent_class)->dispatch_properties_changed (object, n_pspecs, pspecs);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
nm_dbus_object_init (NMDBusObject *self)
|
||||
{
|
||||
c_list_init (&self->internal.objects_lst);
|
||||
c_list_init (&self->internal.registration_lst_head);
|
||||
self->internal.bus_manager = nm_g_object_ref (nm_dbus_manager_get ());
|
||||
}
|
||||
|
||||
static void
|
||||
constructed (GObject *object)
|
||||
{
|
||||
NMDBusObjectClass *klass;
|
||||
|
||||
G_OBJECT_CLASS (nm_dbus_object_parent_class)->constructed (object);
|
||||
|
||||
klass = NM_DBUS_OBJECT_GET_CLASS (object);
|
||||
|
||||
if (klass->export_on_construction)
|
||||
nm_dbus_object_export ((NMDBusObject *) object);
|
||||
|
||||
/* NMDBusObject types should be very careful when overwriting notify().
|
||||
* It is possible to do, but this is a reminder that it's probably not
|
||||
* a good idea.
|
||||
*
|
||||
* It's not a good idea, because NMDBusObject uses dispatch_properties_changed()
|
||||
* to emit signals about a bunch of property changes. So, we want to make
|
||||
* use of g_object_freeze_notify() / g_object_thaw_notify() to combine multiple
|
||||
* property changes in one signal on D-Bus. Note that notify() is not invoked
|
||||
* while the signal is frozen, that means, whatever you do inside notify()
|
||||
* will not make it into the same batch of PropertiesChanged signal. That is
|
||||
* confusing, and probably not what you want.
|
||||
*
|
||||
* Simple solution: don't overwrite notify(). */
|
||||
nm_assert (!G_OBJECT_CLASS (klass)->notify);
|
||||
}
|
||||
|
||||
static void
|
||||
dispose (GObject *object)
|
||||
{
|
||||
NMDBusObject *self = NM_DBUS_OBJECT (object);
|
||||
|
||||
/* Objects should have already been unexported by their owner, unless
|
||||
* we are quitting, where many objects stick around until exit.
|
||||
*/
|
||||
if (!quitting) {
|
||||
if (self->internal.path) {
|
||||
g_warn_if_reached ();
|
||||
nm_dbus_object_unexport (self);
|
||||
}
|
||||
} else if (nm_clear_g_free (&self->internal.path)) {
|
||||
/* FIXME: do a proper, coordinate shutdown, so that no objects stay
|
||||
* alive nor exported. */
|
||||
_notify (self, PROP_PATH);
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (nm_dbus_object_parent_class)->dispose (object);
|
||||
|
||||
g_clear_object (&self->internal.bus_manager);
|
||||
}
|
||||
|
||||
static void
|
||||
nm_dbus_object_class_init (NMDBusObjectClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->constructed = constructed;
|
||||
object_class->dispose = dispose;
|
||||
object_class->get_property = get_property;
|
||||
object_class->dispatch_properties_changed = dispatch_properties_changed;
|
||||
|
||||
obj_properties[PROP_PATH] =
|
||||
g_param_spec_string (NM_DBUS_OBJECT_PATH, "", "",
|
||||
NULL,
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
||||
}
|
||||
157
src/nm-dbus-object.h
Normal file
157
src/nm-dbus-object.h
Normal file
|
|
@ -0,0 +1,157 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
||||
/* NetworkManager -- Network link manager
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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 along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright 2018 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#ifndef __NM_DBUS_OBJECT_H__
|
||||
#define __NM_DBUS_OBJECT_H__
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#include "nm-utils/c-list.h"
|
||||
#include "nm-dbus-utils.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
void nm_dbus_object_set_quitting (void);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/* "org.freedesktop.NetworkManager.Device.Statistics" is a special interface,
|
||||
* because although it has a legacy PropertiesChanged signal, it only notifies
|
||||
* about properties that actually exist on that interface. That is, because it
|
||||
* was added with 1.4.0 release, and thus didn't have the broken behavior like
|
||||
* other legacy interfaces. Those notify about *all* properties, even if they
|
||||
* are not part of that D-Bus interface. See also "include_in_legacy_property_changed"
|
||||
* and "legacy_property_changed". */
|
||||
extern const NMDBusInterfaceInfoExtended nm_interface_info_device_statistics;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#define NM_TYPE_DBUS_OBJECT (nm_dbus_object_get_type ())
|
||||
#define NM_DBUS_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DBUS_OBJECT, NMDBusObject))
|
||||
#define NM_DBUS_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DBUS_OBJECT, NMDBusObjectClass))
|
||||
#define NM_IS_DBUS_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DBUS_OBJECT))
|
||||
#define NM_IS_DBUS_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DBUS_OBJECT))
|
||||
#define NM_DBUS_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DBUS_OBJECT, NMDBusObjectClass))
|
||||
|
||||
#define NM_DBUS_OBJECT_PATH "path"
|
||||
|
||||
/* NMDBusObject and NMDBusManager cooperate strongly. Hence, there is an
|
||||
* internal data structure attached to the NMDBusObject accessible to both of them. */
|
||||
struct _NMDBusObjectInternal {
|
||||
char *path;
|
||||
NMDBusManager *bus_manager;
|
||||
CList objects_lst;
|
||||
CList registration_lst_head;
|
||||
|
||||
/* we perform asynchronous operation on exported objects. For example, we receive
|
||||
* a Set property call, and asynchronously validate the operation. We must make
|
||||
* sure that when the authentication is complete, that we are still looking at
|
||||
* the same (exported) object. In the meantime, the object could have been
|
||||
* unexported, or even re-exported afterwards. If that happens, we want
|
||||
* to fail the request. For that, we keep track of a version id. */
|
||||
guint64 export_version_id;
|
||||
};
|
||||
|
||||
struct _NMDBusObject {
|
||||
GObject parent;
|
||||
struct _NMDBusObjectInternal internal;
|
||||
};
|
||||
|
||||
#define NM_DEFINE_DBUS_INTERFACE_INFO(...) \
|
||||
((NMDBusInterfaceInfo *) (&((const NMDBusInterfaceInfo) { \
|
||||
__VA_ARGS__ \
|
||||
})))
|
||||
|
||||
typedef struct {
|
||||
GObjectClass parent;
|
||||
|
||||
const char *export_path;
|
||||
|
||||
const NMDBusInterfaceInfoExtended *const*interface_infos;
|
||||
|
||||
bool export_on_construction;
|
||||
} NMDBusObjectClass;
|
||||
|
||||
GType nm_dbus_object_get_type (void);
|
||||
|
||||
static inline NMDBusManager *
|
||||
nm_dbus_object_get_manager (NMDBusObject *obj)
|
||||
{
|
||||
nm_assert (NM_IS_DBUS_OBJECT (obj));
|
||||
|
||||
return obj->internal.bus_manager;
|
||||
}
|
||||
|
||||
static inline guint64
|
||||
nm_dbus_object_get_export_version_id (NMDBusObject *obj)
|
||||
{
|
||||
nm_assert (NM_IS_DBUS_OBJECT (obj));
|
||||
|
||||
return obj->internal.export_version_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_dbus_object_get_path:
|
||||
* @self: an #NMDBusObject
|
||||
*
|
||||
* Gets @self's D-Bus path.
|
||||
*
|
||||
* Returns: @self's D-Bus path, or %NULL if @self is not exported.
|
||||
*/
|
||||
static inline const char *
|
||||
nm_dbus_object_get_path (NMDBusObject *self)
|
||||
{
|
||||
g_return_val_if_fail (NM_IS_DBUS_OBJECT (self), NULL);
|
||||
|
||||
return self->internal.path;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_dbus_object_is_exported:
|
||||
* @self: an #NMDBusObject
|
||||
*
|
||||
* Checks if @self is exported
|
||||
*
|
||||
* Returns: %TRUE if @self is exported
|
||||
*/
|
||||
static inline gboolean
|
||||
nm_dbus_object_is_exported (NMDBusObject *self)
|
||||
{
|
||||
return !!nm_dbus_object_get_path (self);
|
||||
}
|
||||
|
||||
const char *nm_dbus_object_export (NMDBusObject *self);
|
||||
void nm_dbus_object_unexport (NMDBusObject *self);
|
||||
|
||||
void _nm_dbus_object_clear_and_unexport (NMDBusObject **location);
|
||||
#define nm_dbus_object_clear_and_unexport(location) _nm_dbus_object_clear_and_unexport ((NMDBusObject **) (location))
|
||||
|
||||
void nm_dbus_object_emit_signal_variant (NMDBusObject *self,
|
||||
const NMDBusInterfaceInfoExtended *interface_info,
|
||||
const GDBusSignalInfo *signal_info,
|
||||
GVariant *args);
|
||||
|
||||
void nm_dbus_object_emit_signal (NMDBusObject *self,
|
||||
const NMDBusInterfaceInfoExtended *interface_info,
|
||||
const GDBusSignalInfo *signal_info,
|
||||
const char *format,
|
||||
...);
|
||||
|
||||
#endif /* __NM_DBUS_OBJECT_H__ */
|
||||
149
src/nm-dbus-utils.c
Normal file
149
src/nm-dbus-utils.c
Normal file
|
|
@ -0,0 +1,149 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
||||
/* NetworkManager -- Network link manager
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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 along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright 2018 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#include "nm-default.h"
|
||||
|
||||
#include "nm-dbus-utils.h"
|
||||
|
||||
#include "nm-dbus-object.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
const GDBusSignalInfo nm_signal_info_property_changed_legacy = NM_DEFINE_GDBUS_SIGNAL_INFO_INIT (
|
||||
"PropertiesChanged",
|
||||
.args = NM_DEFINE_GDBUS_ARG_INFOS (
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("properties", "a{sv}"),
|
||||
),
|
||||
);
|
||||
|
||||
GDBusPropertyInfo *
|
||||
nm_dbus_utils_interface_info_lookup_property (const GDBusInterfaceInfo *interface_info,
|
||||
const char *property_name)
|
||||
{
|
||||
guint i;
|
||||
|
||||
nm_assert (interface_info);
|
||||
nm_assert (property_name);
|
||||
|
||||
/* there is also g_dbus_interface_info_lookup_property(), however that makes use
|
||||
* of a global cache. */
|
||||
if (interface_info->properties) {
|
||||
for (i = 0; interface_info->properties[i]; i++) {
|
||||
GDBusPropertyInfo *info = interface_info->properties[i];
|
||||
|
||||
if (nm_streq (info->name, property_name))
|
||||
return info;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GDBusMethodInfo *
|
||||
nm_dbus_utils_interface_info_lookup_method (const GDBusInterfaceInfo *interface_info,
|
||||
const char *method_name)
|
||||
{
|
||||
guint i;
|
||||
|
||||
nm_assert (interface_info);
|
||||
nm_assert (method_name);
|
||||
|
||||
/* there is also g_dbus_interface_info_lookup_property(), however that makes use
|
||||
* of a global cache. */
|
||||
if (interface_info->methods) {
|
||||
for (i = 0; interface_info->methods[i]; i++) {
|
||||
GDBusMethodInfo *info = interface_info->methods[i];
|
||||
|
||||
if (nm_streq (info->name, method_name))
|
||||
return info;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GVariant *
|
||||
nm_dbus_utils_get_property (GObject *obj,
|
||||
const char *signature,
|
||||
const char *property_name)
|
||||
{
|
||||
GParamSpec *pspec;
|
||||
nm_auto_unset_gvalue GValue value = G_VALUE_INIT;
|
||||
|
||||
nm_assert (G_IS_OBJECT (obj));
|
||||
nm_assert (g_variant_type_string_is_valid (signature));
|
||||
nm_assert (property_name && property_name[0]);
|
||||
|
||||
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (obj), property_name);
|
||||
if (!pspec)
|
||||
g_return_val_if_reached (NULL);
|
||||
|
||||
g_value_init (&value, pspec->value_type);
|
||||
g_object_get_property (obj, property_name, &value);
|
||||
/* returns never-floating variant */
|
||||
return g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (signature));
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
void
|
||||
nm_dbus_utils_g_value_set_object_path (GValue *value, gpointer object)
|
||||
{
|
||||
const char *path;
|
||||
|
||||
g_return_if_fail (!object || NM_IS_DBUS_OBJECT (object));
|
||||
|
||||
if ( object
|
||||
&& (path = nm_dbus_object_get_path (object)))
|
||||
g_value_set_string (value, path);
|
||||
else
|
||||
g_value_set_string (value, "/");
|
||||
}
|
||||
|
||||
void
|
||||
nm_dbus_utils_g_value_set_object_path_array (GValue *value,
|
||||
GSList *objects,
|
||||
gboolean (*filter_func) (GObject *object, gpointer user_data),
|
||||
gpointer user_data)
|
||||
{
|
||||
char **paths;
|
||||
guint i;
|
||||
GSList *iter;
|
||||
|
||||
paths = g_new (char *, g_slist_length (objects) + 1);
|
||||
for (i = 0, iter = objects; iter; iter = iter->next) {
|
||||
NMDBusObject *object = iter->data;
|
||||
const char *path;
|
||||
|
||||
path = nm_dbus_object_get_path (object);
|
||||
if (!path)
|
||||
continue;
|
||||
if ( filter_func
|
||||
&& !filter_func ((GObject *) object, user_data))
|
||||
continue;
|
||||
paths[i++] = g_strdup (path);
|
||||
}
|
||||
paths[i] = NULL;
|
||||
g_value_take_boxed (value, paths);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
177
src/nm-dbus-utils.h
Normal file
177
src/nm-dbus-utils.h
Normal file
|
|
@ -0,0 +1,177 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
||||
/* NetworkManager -- Network link manager
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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 along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright 2018 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#ifndef __NM_DBUS_UTILS_H__
|
||||
#define __NM_DBUS_UTILS_H__
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#define NM_EXPORT_PATH_NUMBERED(basepath) ""basepath"/%llu"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
struct _NMDBusInterfaceInfoExtended;
|
||||
struct _NMDBusMethodInfoExtended;
|
||||
|
||||
struct _NMDBusPropertyInfoExtendedBase {
|
||||
GDBusPropertyInfo _parent;
|
||||
const char *property_name;
|
||||
|
||||
/* Whether the properties needs to be notified on the legacy
|
||||
* PropertyChanged signal. This is only to preserve API, new
|
||||
* properties should not use this. */
|
||||
bool include_in_legacy_property_changed;
|
||||
};
|
||||
|
||||
struct _NMDBusPropertyInfoExtendedReadWritable {
|
||||
struct _NMDBusPropertyInfoExtendedBase _base;
|
||||
|
||||
/* this is the polkit permission type for authenticating setting
|
||||
* the property. */
|
||||
const char *permission;
|
||||
|
||||
/* this is the audit operation type for writing the property. */
|
||||
const char *audit_op;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
union {
|
||||
|
||||
GDBusPropertyInfo _parent;
|
||||
struct _NMDBusPropertyInfoExtendedBase _base;
|
||||
struct _NMDBusPropertyInfoExtendedReadWritable writable;
|
||||
|
||||
/* duplicate the base structure in the union, so that the common fields
|
||||
* are accessible directly in the parent struct. */
|
||||
struct {
|
||||
GDBusPropertyInfo parent;
|
||||
const char *property_name;
|
||||
|
||||
/* Whether the properties needs to be notified on the legacy
|
||||
* PropertyChanged signal. This is only to preserve API, new
|
||||
* properties should not use this. */
|
||||
bool include_in_legacy_property_changed;
|
||||
};
|
||||
};
|
||||
} NMDBusPropertyInfoExtended;
|
||||
|
||||
G_STATIC_ASSERT (G_STRUCT_OFFSET (NMDBusPropertyInfoExtended, property_name) == G_STRUCT_OFFSET (struct _NMDBusPropertyInfoExtendedBase, property_name));
|
||||
G_STATIC_ASSERT (G_STRUCT_OFFSET (NMDBusPropertyInfoExtended, include_in_legacy_property_changed) == G_STRUCT_OFFSET (struct _NMDBusPropertyInfoExtendedBase, include_in_legacy_property_changed));
|
||||
|
||||
#define NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_FULL(m_name, m_signature, m_property_name, m_include_in_legacy_property_changed) \
|
||||
((GDBusPropertyInfo *) &((const struct _NMDBusPropertyInfoExtendedBase) { \
|
||||
._parent = { \
|
||||
.ref_count = -1, \
|
||||
.name = m_name, \
|
||||
.signature = m_signature, \
|
||||
.flags = G_DBUS_PROPERTY_INFO_FLAGS_READABLE, \
|
||||
}, \
|
||||
.property_name = m_property_name, \
|
||||
.include_in_legacy_property_changed = m_include_in_legacy_property_changed, \
|
||||
}))
|
||||
|
||||
#define NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE(m_name, m_signature, m_property_name) \
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_FULL (m_name, m_signature, m_property_name, FALSE)
|
||||
|
||||
/* define a legacy property. Do not use for new code. */
|
||||
#define NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L(m_name, m_signature, m_property_name) \
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_FULL (m_name, m_signature, m_property_name, TRUE)
|
||||
|
||||
#define NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READWRITABLE_FULL(m_name, m_signature, m_property_name, m_permission, m_audit_op, m_include_in_legacy_property_changed) \
|
||||
((GDBusPropertyInfo *) &((const struct _NMDBusPropertyInfoExtendedReadWritable) { \
|
||||
._base = { \
|
||||
._parent = { \
|
||||
.ref_count = -1, \
|
||||
.name = m_name, \
|
||||
.signature = m_signature, \
|
||||
.flags = G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, \
|
||||
}, \
|
||||
.property_name = m_property_name, \
|
||||
.include_in_legacy_property_changed = m_include_in_legacy_property_changed, \
|
||||
}, \
|
||||
.permission = m_permission, \
|
||||
.audit_op = m_audit_op, \
|
||||
}))
|
||||
|
||||
#define NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READWRITABLE(m_name, m_signature, m_property_name, m_permission, m_audit_op) \
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READWRITABLE_FULL (m_name, m_signature, m_property_name, m_permission, m_audit_op, FALSE)
|
||||
|
||||
/* define a legacy property. Do not use for new code. */
|
||||
#define NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READWRITABLE_L(m_name, m_signature, m_property_name, m_permission, m_audit_op) \
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READWRITABLE_FULL (m_name, m_signature, m_property_name, m_permission, m_audit_op, TRUE)
|
||||
|
||||
typedef struct _NMDBusMethodInfoExtended {
|
||||
GDBusMethodInfo parent;
|
||||
void (*handle) (NMDBusObject *obj,
|
||||
const struct _NMDBusInterfaceInfoExtended *interface_info,
|
||||
const struct _NMDBusMethodInfoExtended *method_info,
|
||||
GDBusConnection *connection,
|
||||
const char *sender,
|
||||
GDBusMethodInvocation *invocation,
|
||||
GVariant *parameters);
|
||||
} NMDBusMethodInfoExtended;
|
||||
|
||||
#define NM_DEFINE_DBUS_METHOD_INFO_EXTENDED(parent_, ...) \
|
||||
((GDBusMethodInfo *) (&((const NMDBusMethodInfoExtended) { \
|
||||
.parent = parent_, \
|
||||
__VA_ARGS__ \
|
||||
})))
|
||||
|
||||
typedef struct _NMDBusInterfaceInfoExtended {
|
||||
GDBusInterfaceInfo parent;
|
||||
|
||||
/* Whether the interface has a legacy property changed signal (@nm_signal_info_property_changed_legacy).
|
||||
* New interfaces should not use this. */
|
||||
bool legacy_property_changed:1;
|
||||
} NMDBusInterfaceInfoExtended;
|
||||
|
||||
extern const GDBusSignalInfo nm_signal_info_property_changed_legacy;
|
||||
|
||||
#define NM_DBUS_INTERFACE_INFOS(...) \
|
||||
({ \
|
||||
static const NMDBusInterfaceInfoExtended *const _interface_infos[] = { \
|
||||
__VA_ARGS__, \
|
||||
NULL, \
|
||||
}; \
|
||||
_interface_infos; \
|
||||
});
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
GDBusPropertyInfo *nm_dbus_utils_interface_info_lookup_property (const GDBusInterfaceInfo *interface_info,
|
||||
const char *property_name);
|
||||
|
||||
GDBusMethodInfo *nm_dbus_utils_interface_info_lookup_method (const GDBusInterfaceInfo *interface_info,
|
||||
const char *method_name);
|
||||
|
||||
GVariant *nm_dbus_utils_get_property (GObject *obj,
|
||||
const char *signature,
|
||||
const char *property_name);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
void nm_dbus_utils_g_value_set_object_path (GValue *value, gpointer object);
|
||||
|
||||
void nm_dbus_utils_g_value_set_object_path_array (GValue *value,
|
||||
GSList *objects,
|
||||
gboolean (*filter_func) (GObject *object, gpointer user_data),
|
||||
gpointer user_data);
|
||||
|
||||
#endif /* __NM_DBUS_UTILS_H__ */
|
||||
|
|
@ -26,9 +26,7 @@
|
|||
|
||||
#include "nm-dbus-interface.h"
|
||||
#include "nm-utils.h"
|
||||
#include "nm-exported-object.h"
|
||||
|
||||
#include "introspection/org.freedesktop.NetworkManager.DHCP4Config.h"
|
||||
#include "nm-dbus-object.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
|
@ -41,15 +39,15 @@ typedef struct {
|
|||
} NMDhcp4ConfigPrivate;
|
||||
|
||||
struct _NMDhcp4Config {
|
||||
NMExportedObject parent;
|
||||
NMDBusObject parent;
|
||||
NMDhcp4ConfigPrivate _priv;
|
||||
};
|
||||
|
||||
struct _NMDhcp4ConfigClass {
|
||||
NMExportedObjectClass parent;
|
||||
NMDBusObjectClass parent;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (NMDhcp4Config, nm_dhcp4_config, NM_TYPE_EXPORTED_OBJECT)
|
||||
G_DEFINE_TYPE (NMDhcp4Config, nm_dhcp4_config, NM_TYPE_DBUS_OBJECT)
|
||||
|
||||
#define NM_DHCP4_CONFIG_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMDhcp4Config, NM_IS_DHCP4_CONFIG)
|
||||
|
||||
|
|
@ -147,17 +145,31 @@ finalize (GObject *object)
|
|||
G_OBJECT_CLASS (nm_dhcp4_config_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static const NMDBusInterfaceInfoExtended interface_info_dhcp4_config = {
|
||||
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
|
||||
NM_DBUS_INTERFACE_DHCP4_CONFIG,
|
||||
.signals = NM_DEFINE_GDBUS_SIGNAL_INFOS (
|
||||
&nm_signal_info_property_changed_legacy,
|
||||
),
|
||||
.properties = NM_DEFINE_GDBUS_PROPERTY_INFOS (
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Options", "a{sv}", NM_DHCP4_CONFIG_OPTIONS),
|
||||
),
|
||||
),
|
||||
.legacy_property_changed = TRUE,
|
||||
};
|
||||
|
||||
static void
|
||||
nm_dhcp4_config_class_init (NMDhcp4ConfigClass *config_class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (config_class);
|
||||
NMExportedObjectClass *exported_object_class = NM_EXPORTED_OBJECT_CLASS (config_class);
|
||||
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (config_class);
|
||||
|
||||
object_class->get_property = get_property;
|
||||
object_class->finalize = finalize;
|
||||
|
||||
exported_object_class->export_path = NM_EXPORT_PATH_NUMBERED (NM_DBUS_PATH"/DHCP4Config");
|
||||
exported_object_class->export_on_construction = TRUE;
|
||||
dbus_object_class->export_path = NM_EXPORT_PATH_NUMBERED (NM_DBUS_PATH"/DHCP4Config");
|
||||
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_dhcp4_config);
|
||||
dbus_object_class->export_on_construction = TRUE;
|
||||
|
||||
obj_properties[PROP_OPTIONS] =
|
||||
g_param_spec_variant (NM_DHCP4_CONFIG_OPTIONS, "", "",
|
||||
|
|
@ -167,8 +179,4 @@ nm_dhcp4_config_class_init (NMDhcp4ConfigClass *config_class)
|
|||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
||||
|
||||
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (config_class),
|
||||
NMDBUS_TYPE_DHCP4_CONFIG_SKELETON,
|
||||
NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,9 +26,7 @@
|
|||
|
||||
#include "nm-dbus-interface.h"
|
||||
#include "nm-utils.h"
|
||||
#include "nm-exported-object.h"
|
||||
|
||||
#include "introspection/org.freedesktop.NetworkManager.DHCP6Config.h"
|
||||
#include "nm-dbus-object.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
|
@ -41,15 +39,15 @@ typedef struct {
|
|||
} NMDhcp6ConfigPrivate;
|
||||
|
||||
struct _NMDhcp6Config {
|
||||
NMExportedObject parent;
|
||||
NMDBusObject parent;
|
||||
NMDhcp6ConfigPrivate _priv;
|
||||
};
|
||||
|
||||
struct _NMDhcp6ConfigClass {
|
||||
NMExportedObjectClass parent;
|
||||
NMDBusObjectClass parent;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (NMDhcp6Config, nm_dhcp6_config, NM_TYPE_EXPORTED_OBJECT)
|
||||
G_DEFINE_TYPE (NMDhcp6Config, nm_dhcp6_config, NM_TYPE_DBUS_OBJECT)
|
||||
|
||||
#define NM_DHCP6_CONFIG_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMDhcp6Config, NM_IS_DHCP6_CONFIG)
|
||||
|
||||
|
|
@ -145,17 +143,31 @@ finalize (GObject *object)
|
|||
G_OBJECT_CLASS (nm_dhcp6_config_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static const NMDBusInterfaceInfoExtended interface_info_dhcp6_config = {
|
||||
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
|
||||
NM_DBUS_INTERFACE_DHCP6_CONFIG,
|
||||
.signals = NM_DEFINE_GDBUS_SIGNAL_INFOS (
|
||||
&nm_signal_info_property_changed_legacy,
|
||||
),
|
||||
.properties = NM_DEFINE_GDBUS_PROPERTY_INFOS (
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Options", "a{sv}", NM_DHCP6_CONFIG_OPTIONS),
|
||||
),
|
||||
),
|
||||
.legacy_property_changed = TRUE,
|
||||
};
|
||||
|
||||
static void
|
||||
nm_dhcp6_config_class_init (NMDhcp6ConfigClass *config_class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (config_class);
|
||||
NMExportedObjectClass *exported_object_class = NM_EXPORTED_OBJECT_CLASS (config_class);
|
||||
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (config_class);
|
||||
|
||||
object_class->get_property = get_property;
|
||||
object_class->finalize = finalize;
|
||||
|
||||
exported_object_class->export_path = NM_EXPORT_PATH_NUMBERED (NM_DBUS_PATH"/DHCP6Config");
|
||||
exported_object_class->export_on_construction = TRUE;
|
||||
dbus_object_class->export_path = NM_EXPORT_PATH_NUMBERED (NM_DBUS_PATH"/DHCP6Config");
|
||||
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_dhcp6_config);
|
||||
dbus_object_class->export_on_construction = TRUE;
|
||||
|
||||
obj_properties[PROP_OPTIONS] =
|
||||
g_param_spec_variant (NM_DHCP6_CONFIG_OPTIONS, "", "",
|
||||
|
|
@ -165,8 +177,4 @@ nm_dhcp6_config_class_init (NMDhcp6ConfigClass *config_class)
|
|||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
||||
|
||||
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (config_class),
|
||||
NMDBUS_TYPE_DHCP6_CONFIG_SKELETON,
|
||||
NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -284,9 +284,10 @@ fill_device_props (NMDevice *device,
|
|||
g_variant_new_uint32 (nm_device_get_device_type (device)));
|
||||
g_variant_builder_add (dev_builder, "{sv}", NMD_DEVICE_PROPS_STATE,
|
||||
g_variant_new_uint32 (nm_device_get_state (device)));
|
||||
if (nm_exported_object_is_exported (NM_EXPORTED_OBJECT (device)))
|
||||
if (nm_dbus_object_is_exported (NM_DBUS_OBJECT (device))) {
|
||||
g_variant_builder_add (dev_builder, "{sv}", NMD_DEVICE_PROPS_PATH,
|
||||
g_variant_new_object_path (nm_exported_object_get_path (NM_EXPORTED_OBJECT (device))));
|
||||
g_variant_new_object_path (nm_dbus_object_get_path (NM_DBUS_OBJECT (device))));
|
||||
}
|
||||
|
||||
proxy_config = nm_device_get_proxy_config (device);
|
||||
if (proxy_config)
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,85 +0,0 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
||||
/* NetworkManager -- Network link manager
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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 along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright 2014 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#ifndef NM_EXPORTED_OBJECT_H
|
||||
#define NM_EXPORTED_OBJECT_H
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#define NM_EXPORT_PATH_NUMBERED(basepath) ""basepath"/%llu"
|
||||
|
||||
char *nm_exported_object_skeletonify_method_name (const char *dbus_method_name);
|
||||
|
||||
typedef struct {
|
||||
GType dbus_skeleton_type;
|
||||
char *method_name;
|
||||
GCallback impl;
|
||||
} NMExportedObjectDBusMethodImpl;
|
||||
|
||||
GDBusInterfaceSkeleton *nm_exported_object_skeleton_create (GType dbus_skeleton_type,
|
||||
GObjectClass *object_class,
|
||||
const NMExportedObjectDBusMethodImpl *methods,
|
||||
guint methods_len,
|
||||
GObject *target);
|
||||
void nm_exported_object_skeleton_release (GDBusInterfaceSkeleton *interface);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#define NM_TYPE_EXPORTED_OBJECT (nm_exported_object_get_type ())
|
||||
#define NM_EXPORTED_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_EXPORTED_OBJECT, NMExportedObject))
|
||||
#define NM_EXPORTED_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_EXPORTED_OBJECT, NMExportedObjectClass))
|
||||
#define NM_IS_EXPORTED_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_EXPORTED_OBJECT))
|
||||
#define NM_IS_EXPORTED_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_EXPORTED_OBJECT))
|
||||
#define NM_EXPORTED_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_EXPORTED_OBJECT, NMExportedObjectClass))
|
||||
|
||||
#define NM_EXPORTED_OBJECT_PATH "path"
|
||||
|
||||
struct _NMExportedObjectPrivate;
|
||||
|
||||
struct _NMExportedObject {
|
||||
GDBusObjectSkeleton parent;
|
||||
struct _NMExportedObjectPrivate *_priv;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
GDBusObjectSkeletonClass parent;
|
||||
|
||||
const char *export_path;
|
||||
char export_on_construction;
|
||||
} NMExportedObjectClass;
|
||||
|
||||
GType nm_exported_object_get_type (void);
|
||||
|
||||
void nm_exported_object_class_set_quitting (void);
|
||||
|
||||
void nm_exported_object_class_add_interface (NMExportedObjectClass *object_class,
|
||||
GType dbus_skeleton_type,
|
||||
...) G_GNUC_NULL_TERMINATED;
|
||||
|
||||
const char *nm_exported_object_export (NMExportedObject *self);
|
||||
const char *nm_exported_object_get_path (NMExportedObject *self);
|
||||
gboolean nm_exported_object_is_exported (NMExportedObject *self);
|
||||
void nm_exported_object_unexport (NMExportedObject *self);
|
||||
GDBusInterfaceSkeleton *nm_exported_object_get_interface_by_type (NMExportedObject *self, GType interface_type);
|
||||
|
||||
void _nm_exported_object_clear_and_unexport (NMExportedObject **location);
|
||||
#define nm_exported_object_clear_and_unexport(location) _nm_exported_object_clear_and_unexport ((NMExportedObject **) (location))
|
||||
|
||||
#endif /* NM_EXPORTED_OBJECT_H */
|
||||
|
|
@ -597,7 +597,7 @@ const NMDhcpClientFactory *const _nm_dhcp_manager_factories[4] = {
|
|||
#include "nm-config.h"
|
||||
#include "devices/nm-device.h"
|
||||
#include "nm-active-connection.h"
|
||||
#include "nm-bus-manager.h"
|
||||
#include "nm-dbus-manager.h"
|
||||
|
||||
void
|
||||
nm_main_config_reload (int signal)
|
||||
|
|
@ -629,21 +629,34 @@ nm_config_get_configure_and_quit (NMConfig *config)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
NMBusManager *
|
||||
nm_bus_manager_get (void)
|
||||
NMDBusManager *
|
||||
nm_dbus_manager_get (void)
|
||||
{
|
||||
return GUINT_TO_POINTER (1);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
nm_bus_manager_register_object (NMBusManager *bus_manager,
|
||||
GDBusObjectSkeleton *object)
|
||||
_nm_dbus_manager_obj_export (NMDBusObject *obj)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
nm_bus_manager_unregister_object (NMBusManager *bus_manager,
|
||||
GDBusObjectSkeleton *object)
|
||||
_nm_dbus_manager_obj_unexport (NMDBusObject *obj)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
_nm_dbus_manager_obj_notify (NMDBusObject *obj,
|
||||
guint n_pspecs,
|
||||
const GParamSpec *const*pspecs)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
_nm_dbus_manager_obj_emit_signal (NMDBusObject *obj,
|
||||
const NMDBusInterfaceInfoExtended *interface_info,
|
||||
const GDBusSignalInfo *signal_info,
|
||||
GVariant *args)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,8 +36,7 @@
|
|||
#include "platform/nm-platform-utils.h"
|
||||
#include "NetworkManagerUtils.h"
|
||||
#include "nm-core-internal.h"
|
||||
|
||||
#include "introspection/org.freedesktop.NetworkManager.IP4Config.h"
|
||||
#include "nm-dbus-object.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
|
@ -318,15 +317,15 @@ typedef struct {
|
|||
} NMIP4ConfigPrivate;
|
||||
|
||||
struct _NMIP4Config {
|
||||
NMExportedObject parent;
|
||||
NMDBusObject parent;
|
||||
NMIP4ConfigPrivate _priv;
|
||||
};
|
||||
|
||||
struct _NMIP4ConfigClass {
|
||||
NMExportedObjectClass parent;
|
||||
NMDBusObjectClass parent;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (NMIP4Config, nm_ip4_config, NM_TYPE_EXPORTED_OBJECT)
|
||||
G_DEFINE_TYPE (NMIP4Config, nm_ip4_config, NM_TYPE_DBUS_OBJECT)
|
||||
|
||||
#define NM_IP4_CONFIG_GET_PRIVATE(self) _NM_GET_PRIVATE(self, NMIP4Config, NM_IS_IP4_CONFIG)
|
||||
|
||||
|
|
@ -1954,7 +1953,7 @@ nm_ip4_config_dump (const NMIP4Config *self, const char *detail)
|
|||
return;
|
||||
}
|
||||
|
||||
str = nm_exported_object_get_path (NM_EXPORTED_OBJECT (self));
|
||||
str = nm_dbus_object_get_path (NM_DBUS_OBJECT (self));
|
||||
if (str)
|
||||
g_message (" path: %s", str);
|
||||
|
||||
|
|
@ -3212,13 +3211,37 @@ finalize (GObject *object)
|
|||
nm_dedup_multi_index_unref (priv->multi_idx);
|
||||
}
|
||||
|
||||
static const NMDBusInterfaceInfoExtended interface_info_ip4_config = {
|
||||
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
|
||||
NM_DBUS_INTERFACE_IP4_CONFIG,
|
||||
.signals = NM_DEFINE_GDBUS_SIGNAL_INFOS (
|
||||
&nm_signal_info_property_changed_legacy,
|
||||
),
|
||||
.properties = NM_DEFINE_GDBUS_PROPERTY_INFOS (
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Addresses", "aau", NM_IP4_CONFIG_ADDRESSES),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("AddressData", "aa{sv}", NM_IP4_CONFIG_ADDRESS_DATA),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Gateway", "s", NM_IP4_CONFIG_GATEWAY),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Routes", "aau", NM_IP4_CONFIG_ROUTES),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("RouteData", "aa{sv}", NM_IP4_CONFIG_ROUTE_DATA),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Nameservers", "au", NM_IP4_CONFIG_NAMESERVERS),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Domains", "as", NM_IP4_CONFIG_DOMAINS),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Searches", "as", NM_IP4_CONFIG_SEARCHES),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("DnsOptions", "as", NM_IP4_CONFIG_DNS_OPTIONS),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("DnsPriority", "i", NM_IP4_CONFIG_DNS_PRIORITY),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("WinsServers", "au", NM_IP4_CONFIG_WINS_SERVERS),
|
||||
),
|
||||
),
|
||||
.legacy_property_changed = TRUE,
|
||||
};
|
||||
|
||||
static void
|
||||
nm_ip4_config_class_init (NMIP4ConfigClass *config_class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (config_class);
|
||||
NMExportedObjectClass *exported_object_class = NM_EXPORTED_OBJECT_CLASS (config_class);
|
||||
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (config_class);
|
||||
|
||||
exported_object_class->export_path = NM_EXPORT_PATH_NUMBERED (NM_DBUS_PATH"/IP4Config");
|
||||
dbus_object_class->export_path = NM_EXPORT_PATH_NUMBERED (NM_DBUS_PATH"/IP4Config");
|
||||
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_ip4_config);
|
||||
|
||||
object_class->get_property = get_property;
|
||||
object_class->set_property = set_property;
|
||||
|
|
@ -3298,8 +3321,4 @@ nm_ip4_config_class_init (NMIP4ConfigClass *config_class)
|
|||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
||||
|
||||
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (config_class),
|
||||
NMDBUS_TYPE_IP4_CONFIG_SKELETON,
|
||||
NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
#include "nm-setting-connection.h"
|
||||
|
||||
#include "nm-exported-object.h"
|
||||
#include "nm-setting-ip4-config.h"
|
||||
|
||||
#include "nm-utils/nm-dedup-multi.h"
|
||||
|
|
|
|||
|
|
@ -38,8 +38,7 @@
|
|||
#include "NetworkManagerUtils.h"
|
||||
#include "nm-ip4-config.h"
|
||||
#include "ndisc/nm-ndisc.h"
|
||||
|
||||
#include "introspection/org.freedesktop.NetworkManager.IP6Config.h"
|
||||
#include "nm-dbus-object.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
|
@ -82,15 +81,15 @@ typedef struct {
|
|||
} NMIP6ConfigPrivate;
|
||||
|
||||
struct _NMIP6Config {
|
||||
NMExportedObject parent;
|
||||
NMDBusObject parent;
|
||||
NMIP6ConfigPrivate _priv;
|
||||
};
|
||||
|
||||
struct _NMIP6ConfigClass {
|
||||
NMExportedObjectClass parent;
|
||||
NMDBusObjectClass parent;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (NMIP6Config, nm_ip6_config, NM_TYPE_EXPORTED_OBJECT)
|
||||
G_DEFINE_TYPE (NMIP6Config, nm_ip6_config, NM_TYPE_DBUS_OBJECT)
|
||||
|
||||
#define NM_IP6_CONFIG_GET_PRIVATE(self) _NM_GET_PRIVATE(self, NMIP6Config, NM_IS_IP6_CONFIG)
|
||||
|
||||
|
|
@ -1486,7 +1485,7 @@ nm_ip6_config_dump (const NMIP6Config *self, const char *detail)
|
|||
|
||||
g_message ("--------- NMIP6Config %p (%s)", self, detail);
|
||||
|
||||
str = nm_exported_object_get_path (NM_EXPORTED_OBJECT (self));
|
||||
str = nm_dbus_object_get_path (NM_DBUS_OBJECT (self));
|
||||
if (str)
|
||||
g_message (" path: %s", str);
|
||||
|
||||
|
|
@ -2773,13 +2772,36 @@ finalize (GObject *object)
|
|||
nm_dedup_multi_index_unref (priv->multi_idx);
|
||||
}
|
||||
|
||||
static const NMDBusInterfaceInfoExtended interface_info_ip6_config = {
|
||||
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
|
||||
NM_DBUS_INTERFACE_IP6_CONFIG,
|
||||
.signals = NM_DEFINE_GDBUS_SIGNAL_INFOS (
|
||||
&nm_signal_info_property_changed_legacy,
|
||||
),
|
||||
.properties = NM_DEFINE_GDBUS_PROPERTY_INFOS (
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Addresses", "a(ayuay)", NM_IP6_CONFIG_ADDRESSES),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("AddressData", "aa{sv}", NM_IP6_CONFIG_ADDRESS_DATA),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Gateway", "s", NM_IP6_CONFIG_GATEWAY),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Routes", "a(ayuayu)", NM_IP6_CONFIG_ROUTES),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("RouteData", "aa{sv}", NM_IP6_CONFIG_ROUTE_DATA),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Nameservers", "aay", NM_IP6_CONFIG_NAMESERVERS),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Domains", "as", NM_IP6_CONFIG_DOMAINS),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Searches", "as", NM_IP6_CONFIG_SEARCHES),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("DnsOptions", "as", NM_IP6_CONFIG_DNS_OPTIONS),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("DnsPriority", "i", NM_IP6_CONFIG_DNS_PRIORITY),
|
||||
),
|
||||
),
|
||||
.legacy_property_changed = TRUE,
|
||||
};
|
||||
|
||||
static void
|
||||
nm_ip6_config_class_init (NMIP6ConfigClass *config_class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (config_class);
|
||||
NMExportedObjectClass *exported_object_class = NM_EXPORTED_OBJECT_CLASS (config_class);
|
||||
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (config_class);
|
||||
|
||||
exported_object_class->export_path = NM_EXPORT_PATH_NUMBERED (NM_DBUS_PATH"/IP6Config");
|
||||
dbus_object_class->export_path = NM_EXPORT_PATH_NUMBERED (NM_DBUS_PATH"/IP6Config");
|
||||
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_ip6_config);
|
||||
|
||||
object_class->get_property = get_property;
|
||||
object_class->set_property = set_property;
|
||||
|
|
@ -2853,8 +2875,4 @@ nm_ip6_config_class_init (NMIP6ConfigClass *config_class)
|
|||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
||||
|
||||
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (config_class),
|
||||
NMDBUS_TYPE_IP6_CONFIG_SKELETON,
|
||||
NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include "nm-exported-object.h"
|
||||
#include "nm-setting-ip6-config.h"
|
||||
|
||||
#include "nm-utils/nm-dedup-multi.h"
|
||||
|
|
|
|||
1217
src/nm-manager.c
1217
src/nm-manager.c
File diff suppressed because it is too large
Load diff
|
|
@ -22,9 +22,9 @@
|
|||
#ifndef __NETWORKMANAGER_MANAGER_H__
|
||||
#define __NETWORKMANAGER_MANAGER_H__
|
||||
|
||||
#include "nm-exported-object.h"
|
||||
#include "settings/nm-settings-connection.h"
|
||||
#include "nm-utils/c-list.h"
|
||||
#include "nm-dbus-manager.h"
|
||||
|
||||
#define NM_TYPE_MANAGER (nm_manager_get_type ())
|
||||
#define NM_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_MANAGER, NMManager))
|
||||
|
|
@ -60,14 +60,11 @@
|
|||
/* Not exported */
|
||||
#define NM_MANAGER_SLEEPING "sleeping"
|
||||
|
||||
/* signals */
|
||||
#define NM_MANAGER_CHECK_PERMISSIONS "check-permissions"
|
||||
/* Signals */
|
||||
#define NM_MANAGER_DEVICE_ADDED "device-added"
|
||||
#define NM_MANAGER_DEVICE_REMOVED "device-removed"
|
||||
#define NM_MANAGER_STATE_CHANGED "state-changed"
|
||||
#define NM_MANAGER_USER_PERMISSIONS_CHANGED "user-permissions-changed"
|
||||
|
||||
/* Internal signals */
|
||||
#define NM_MANAGER_ACTIVE_CONNECTION_ADDED "active-connection-added"
|
||||
#define NM_MANAGER_ACTIVE_CONNECTION_REMOVED "active-connection-removed"
|
||||
#define NM_MANAGER_CONFIGURE_QUIT "configure-quit"
|
||||
|
|
@ -153,4 +150,13 @@ gboolean nm_manager_remove_device (NMManager *self,
|
|||
const char *ifname,
|
||||
NMDeviceType device_type);
|
||||
|
||||
void nm_manager_dbus_set_property_handle (NMDBusObject *obj,
|
||||
const NMDBusInterfaceInfoExtended *interface_info,
|
||||
const NMDBusPropertyInfoExtended *property_info,
|
||||
GDBusConnection *connection,
|
||||
const char *sender,
|
||||
GDBusMethodInvocation *invocation,
|
||||
GVariant *value,
|
||||
gpointer user_data);
|
||||
|
||||
#endif /* __NETWORKMANAGER_MANAGER_H__ */
|
||||
|
|
|
|||
|
|
@ -1358,7 +1358,7 @@ process_secondaries (NMPolicy *self,
|
|||
if (connected) {
|
||||
_LOGD (LOGD_DEVICE, "secondary connection '%s' succeeded; active path '%s'",
|
||||
nm_active_connection_get_settings_connection_id (active),
|
||||
nm_exported_object_get_path (NM_EXPORTED_OBJECT (active)));
|
||||
nm_dbus_object_get_path (NM_DBUS_OBJECT (active)));
|
||||
|
||||
/* Secondary connection activated */
|
||||
secondary_data->secondaries = g_slist_remove (secondary_data->secondaries, secondary_active);
|
||||
|
|
@ -1374,7 +1374,7 @@ process_secondaries (NMPolicy *self,
|
|||
} else {
|
||||
_LOGD (LOGD_DEVICE, "secondary connection '%s' failed; active path '%s'",
|
||||
nm_active_connection_get_settings_connection_id (active),
|
||||
nm_exported_object_get_path (NM_EXPORTED_OBJECT (active)));
|
||||
nm_dbus_object_get_path (NM_DBUS_OBJECT (active)));
|
||||
|
||||
/* Secondary connection failed -> do not watch other connections */
|
||||
priv->pending_secondaries = g_slist_remove (priv->pending_secondaries, secondary_data);
|
||||
|
|
@ -1670,7 +1670,7 @@ activate_secondary_connections (NMPolicy *self,
|
|||
ac = nm_manager_activate_connection (priv->manager,
|
||||
settings_con,
|
||||
NULL,
|
||||
nm_exported_object_get_path (NM_EXPORTED_OBJECT (req)),
|
||||
nm_dbus_object_get_path (NM_DBUS_OBJECT (req)),
|
||||
device,
|
||||
nm_active_connection_get_subject (NM_ACTIVE_CONNECTION (req)),
|
||||
NM_ACTIVATION_TYPE_MANAGED,
|
||||
|
|
|
|||
|
|
@ -28,13 +28,14 @@
|
|||
#define _NM_SD_MAX_CLIENT_ID_LEN (sizeof (guint32) + 128)
|
||||
|
||||
/* core */
|
||||
typedef struct _NMDBusObject NMDBusObject;
|
||||
typedef struct _NMExportedObject NMExportedObject;
|
||||
typedef struct _NMActiveConnection NMActiveConnection;
|
||||
typedef struct _NMAuditManager NMAuditManager;
|
||||
typedef struct _NMVpnConnection NMVpnConnection;
|
||||
typedef struct _NMActRequest NMActRequest;
|
||||
typedef struct _NMAuthSubject NMAuthSubject;
|
||||
typedef struct _NMBusManager NMBusManager;
|
||||
typedef struct _NMDBusManager NMDBusManager;
|
||||
typedef struct _NMConfig NMConfig;
|
||||
typedef struct _NMConfigData NMConfigData;
|
||||
typedef struct _NMArpingManager NMArpingManager;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ nm_pppd_plugin = shared_module(
|
|||
name = 'nm-ppp-plugin'
|
||||
|
||||
deps = [
|
||||
libnmdbus_dep,
|
||||
nm_dep
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -50,13 +50,12 @@
|
|||
#include "nm-act-request.h"
|
||||
#include "nm-ip4-config.h"
|
||||
#include "nm-ip6-config.h"
|
||||
#include "nm-dbus-object.h"
|
||||
|
||||
#include "nm-pppd-plugin.h"
|
||||
#include "nm-ppp-plugin-api.h"
|
||||
#include "nm-ppp-status.h"
|
||||
|
||||
#include "introspection/org.freedesktop.NetworkManager.PPP.h"
|
||||
|
||||
#define NM_PPPD_PLUGIN PPPD_PLUGIN_DIR "/nm-pppd-plugin.so"
|
||||
|
||||
static NM_CACHED_QUARK_FCN ("ppp-manager-secret-tries", ppp_manager_secret_tries_quark)
|
||||
|
|
@ -116,17 +115,17 @@ typedef struct {
|
|||
} NMPPPManagerPrivate;
|
||||
|
||||
struct _NMPPPManager {
|
||||
NMExportedObject parent;
|
||||
NMDBusObject parent;
|
||||
NMPPPManagerPrivate _priv;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
NMExportedObjectClass parent;
|
||||
NMDBusObjectClass parent;
|
||||
} NMPPPManagerClass;
|
||||
|
||||
G_DEFINE_TYPE (NMPPPManager, nm_ppp_manager, NM_TYPE_EXPORTED_OBJECT)
|
||||
G_DEFINE_TYPE (NMPPPManager, nm_ppp_manager, NM_TYPE_DBUS_OBJECT)
|
||||
|
||||
#define NM_PPP_MANAGER_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMPPPManager, NM_IS_PPP_MANAGER)
|
||||
#define NM_PPP_MANAGER_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMPPPManager, NM_IS_PPP_MANAGER, NMDBusObject)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
|
@ -332,20 +331,27 @@ ppp_secrets_cb (NMActRequest *req,
|
|||
* against libnm just to parse this. So instead, let's just send what
|
||||
* it needs.
|
||||
*/
|
||||
g_dbus_method_invocation_return_value (
|
||||
priv->pending_secrets_context,
|
||||
g_variant_new ("(ss)", username ? username : "", password ? password : ""));
|
||||
g_dbus_method_invocation_return_value (priv->pending_secrets_context,
|
||||
g_variant_new ("(ss)",
|
||||
username ?: "",
|
||||
password ?: ""));
|
||||
|
||||
out:
|
||||
out:
|
||||
priv->pending_secrets_context = NULL;
|
||||
priv->secrets_id = NULL;
|
||||
priv->secrets_setting_name = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
impl_ppp_manager_need_secrets (NMPPPManager *manager,
|
||||
GDBusMethodInvocation *context)
|
||||
impl_ppp_manager_need_secrets (NMDBusObject *obj,
|
||||
const NMDBusInterfaceInfoExtended *interface_info,
|
||||
const NMDBusMethodInfoExtended *method_info,
|
||||
GDBusConnection *connection,
|
||||
const char *sender,
|
||||
GDBusMethodInvocation *invocation,
|
||||
GVariant *parameters)
|
||||
{
|
||||
NMPPPManager *manager = NM_PPP_MANAGER (obj);
|
||||
NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (manager);
|
||||
NMConnection *applied_connection;
|
||||
const char *username = NULL;
|
||||
|
|
@ -364,7 +370,7 @@ impl_ppp_manager_need_secrets (NMPPPManager *manager,
|
|||
/* Use existing secrets from the connection */
|
||||
if (extract_details_from_connection (applied_connection, NULL, &username, &password, &error)) {
|
||||
/* Send existing secrets to the PPP plugin */
|
||||
priv->pending_secrets_context = context;
|
||||
priv->pending_secrets_context = invocation;
|
||||
ppp_secrets_cb (priv->act_req, priv->secrets_id, NULL, NULL, manager);
|
||||
} else {
|
||||
_LOGW ("%s", error->message);
|
||||
|
|
@ -389,30 +395,45 @@ impl_ppp_manager_need_secrets (NMPPPManager *manager,
|
|||
ppp_secrets_cb,
|
||||
manager);
|
||||
g_object_set_qdata (G_OBJECT (applied_connection), ppp_manager_secret_tries_quark (), GUINT_TO_POINTER (++tries));
|
||||
priv->pending_secrets_context = context;
|
||||
priv->pending_secrets_context = invocation;
|
||||
|
||||
if (hints)
|
||||
g_ptr_array_free (hints, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_ppp_manager_set_state (NMPPPManager *manager,
|
||||
GDBusMethodInvocation *context,
|
||||
guint32 state)
|
||||
impl_ppp_manager_set_state (NMDBusObject *obj,
|
||||
const NMDBusInterfaceInfoExtended *interface_info,
|
||||
const NMDBusMethodInfoExtended *method_info,
|
||||
GDBusConnection *connection,
|
||||
const char *sender,
|
||||
GDBusMethodInvocation *invocation,
|
||||
GVariant *parameters)
|
||||
{
|
||||
g_signal_emit (manager, signals[STATE_CHANGED], 0, (guint) state);
|
||||
NMPPPManager *manager = NM_PPP_MANAGER (obj);
|
||||
guint32 state;
|
||||
|
||||
g_dbus_method_invocation_return_value (context, NULL);
|
||||
g_variant_get (parameters, "(u)", &state);
|
||||
g_signal_emit (manager, signals[STATE_CHANGED], 0, (guint) state);
|
||||
g_dbus_method_invocation_return_value (invocation, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_ppp_manager_set_ifindex (NMPPPManager *manager,
|
||||
GDBusMethodInvocation *context,
|
||||
gint32 ifindex)
|
||||
impl_ppp_manager_set_ifindex (NMDBusObject *obj,
|
||||
const NMDBusInterfaceInfoExtended *interface_info,
|
||||
const NMDBusMethodInfoExtended *method_info,
|
||||
GDBusConnection *connection,
|
||||
const char *sender,
|
||||
GDBusMethodInvocation *invocation,
|
||||
GVariant *parameters)
|
||||
{
|
||||
NMPPPManager *manager = NM_PPP_MANAGER (obj);
|
||||
NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (manager);
|
||||
const NMPlatformLink *plink = NULL;
|
||||
nm_auto_nmpobj const NMPObject *obj_keep_alive = NULL;
|
||||
gint32 ifindex;
|
||||
|
||||
g_variant_get (parameters, "(i)", &ifindex);
|
||||
|
||||
_LOGD ("set-ifindex %d", (int) ifindex);
|
||||
|
||||
|
|
@ -439,7 +460,7 @@ impl_ppp_manager_set_ifindex (NMPPPManager *manager,
|
|||
obj_keep_alive = nmp_object_ref (NMP_OBJECT_UP_CAST (plink));
|
||||
|
||||
g_signal_emit (manager, signals[IFINDEX_SET], 0, ifindex, plink->name);
|
||||
g_dbus_method_invocation_return_value (context, NULL);
|
||||
g_dbus_method_invocation_return_value (invocation, NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
@ -469,18 +490,26 @@ set_ip_config_common (NMPPPManager *self,
|
|||
}
|
||||
|
||||
static void
|
||||
impl_ppp_manager_set_ip4_config (NMPPPManager *manager,
|
||||
GDBusMethodInvocation *context,
|
||||
GVariant *config_dict)
|
||||
impl_ppp_manager_set_ip4_config (NMDBusObject *obj,
|
||||
const NMDBusInterfaceInfoExtended *interface_info,
|
||||
const NMDBusMethodInfoExtended *method_info,
|
||||
GDBusConnection *connection,
|
||||
const char *sender,
|
||||
GDBusMethodInvocation *invocation,
|
||||
GVariant *parameters)
|
||||
{
|
||||
NMPPPManager *manager = NM_PPP_MANAGER (obj);
|
||||
NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (manager);
|
||||
gs_unref_object NMIP4Config *config = NULL;
|
||||
NMPlatformIP4Address address;
|
||||
guint32 u32, mtu;
|
||||
GVariantIter *iter;
|
||||
gs_unref_variant GVariant *config_dict = NULL;
|
||||
|
||||
_LOGI ("(IPv4 Config Get) reply received.");
|
||||
|
||||
g_variant_get (parameters, "(@a{sv})", &config_dict);
|
||||
|
||||
nm_clear_g_source (&priv->ppp_timeout_handler);
|
||||
|
||||
if (!set_ip_config_common (manager, config_dict, &mtu))
|
||||
|
|
@ -538,7 +567,7 @@ impl_ppp_manager_set_ip4_config (NMPPPManager *manager,
|
|||
g_signal_emit (manager, signals[IP4_CONFIG], 0, config);
|
||||
|
||||
out:
|
||||
g_dbus_method_invocation_return_value (context, NULL);
|
||||
g_dbus_method_invocation_return_value (invocation, NULL);
|
||||
}
|
||||
|
||||
/* Converts the named Interface Identifier item to an IPv6 LL address and
|
||||
|
|
@ -571,19 +600,27 @@ iid_value_to_ll6_addr (GVariant *dict,
|
|||
}
|
||||
|
||||
static void
|
||||
impl_ppp_manager_set_ip6_config (NMPPPManager *manager,
|
||||
GDBusMethodInvocation *context,
|
||||
GVariant *config_dict)
|
||||
impl_ppp_manager_set_ip6_config (NMDBusObject *obj,
|
||||
const NMDBusInterfaceInfoExtended *interface_info,
|
||||
const NMDBusMethodInfoExtended *method_info,
|
||||
GDBusConnection *connection,
|
||||
const char *sender,
|
||||
GDBusMethodInvocation *invocation,
|
||||
GVariant *parameters)
|
||||
{
|
||||
NMPPPManager *manager = NM_PPP_MANAGER (obj);
|
||||
NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (manager);
|
||||
gs_unref_object NMIP6Config *config = NULL;
|
||||
NMPlatformIP6Address addr;
|
||||
struct in6_addr a;
|
||||
NMUtilsIPv6IfaceId iid = NM_UTILS_IPV6_IFACE_ID_INIT;
|
||||
gboolean has_peer = FALSE;
|
||||
gs_unref_variant GVariant *config_dict = NULL;
|
||||
|
||||
_LOGI ("(IPv6 Config Get) reply received.");
|
||||
|
||||
g_variant_get (parameters, "(@a{sv})", &config_dict);
|
||||
|
||||
nm_clear_g_source (&priv->ppp_timeout_handler);
|
||||
|
||||
if (!set_ip_config_common (manager, config_dict, NULL))
|
||||
|
|
@ -619,7 +656,7 @@ impl_ppp_manager_set_ip6_config (NMPPPManager *manager,
|
|||
_LOGE ("invalid IPv6 address received!");
|
||||
|
||||
out:
|
||||
g_dbus_method_invocation_return_value (context, NULL);
|
||||
g_dbus_method_invocation_return_value (invocation, NULL);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
@ -926,7 +963,7 @@ create_pppd_cmd_line (NMPPPManager *self,
|
|||
nm_cmd_line_add_int (cmd, 0);
|
||||
|
||||
nm_cmd_line_add_string (cmd, "ipparam");
|
||||
nm_cmd_line_add_string (cmd, nm_exported_object_get_path (NM_EXPORTED_OBJECT (self)));
|
||||
nm_cmd_line_add_string (cmd, nm_dbus_object_get_path (NM_DBUS_OBJECT (self)));
|
||||
|
||||
nm_cmd_line_add_string (cmd, "plugin");
|
||||
nm_cmd_line_add_string (cmd, NM_PPPD_PLUGIN);
|
||||
|
|
@ -1005,7 +1042,7 @@ _ppp_manager_start (NMPPPManager *manager,
|
|||
return FALSE;
|
||||
#endif
|
||||
|
||||
nm_exported_object_export (NM_EXPORTED_OBJECT (manager));
|
||||
nm_dbus_object_export (NM_DBUS_OBJECT (manager));
|
||||
|
||||
priv->pid = 0;
|
||||
|
||||
|
|
@ -1079,7 +1116,7 @@ out:
|
|||
nm_cmd_line_destroy (ppp_cmd);
|
||||
|
||||
if (priv->pid <= 0)
|
||||
nm_exported_object_unexport (NM_EXPORTED_OBJECT (manager));
|
||||
nm_dbus_object_unexport (NM_DBUS_OBJECT (manager));
|
||||
|
||||
return priv->pid > 0;
|
||||
}
|
||||
|
|
@ -1183,7 +1220,7 @@ _ppp_manager_stop_async (NMPPPManager *manager,
|
|||
NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (manager);
|
||||
StopContext *ctx;
|
||||
|
||||
nm_exported_object_unexport (NM_EXPORTED_OBJECT (manager));
|
||||
nm_dbus_object_unexport (NM_DBUS_OBJECT (manager));
|
||||
|
||||
ctx = g_slice_new0 (StopContext);
|
||||
ctx->manager = g_object_ref (manager);
|
||||
|
|
@ -1220,10 +1257,10 @@ _ppp_manager_stop_async (NMPPPManager *manager,
|
|||
static void
|
||||
_ppp_manager_stop_sync (NMPPPManager *manager)
|
||||
{
|
||||
NMExportedObject *exported = NM_EXPORTED_OBJECT (manager);
|
||||
NMDBusObject *dbus = NM_DBUS_OBJECT (manager);
|
||||
|
||||
if (nm_exported_object_is_exported (exported))
|
||||
nm_exported_object_unexport (exported);
|
||||
if (nm_dbus_object_is_exported (dbus))
|
||||
nm_dbus_object_unexport (dbus);
|
||||
|
||||
_ppp_cleanup (manager);
|
||||
_ppp_kill (manager);
|
||||
|
|
@ -1293,11 +1330,11 @@ static void
|
|||
dispose (GObject *object)
|
||||
{
|
||||
NMPPPManager *self = (NMPPPManager *) object;
|
||||
NMExportedObject *exported = NM_EXPORTED_OBJECT (self);
|
||||
NMDBusObject *dbus = NM_DBUS_OBJECT (self);
|
||||
NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (self);
|
||||
|
||||
if (nm_exported_object_is_exported (exported))
|
||||
nm_exported_object_unexport (exported);
|
||||
if (nm_dbus_object_is_exported (dbus))
|
||||
nm_dbus_object_unexport (dbus);
|
||||
|
||||
_ppp_cleanup (self);
|
||||
_ppp_kill (self);
|
||||
|
|
@ -1317,18 +1354,73 @@ finalize (GObject *object)
|
|||
G_OBJECT_CLASS (nm_ppp_manager_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static const NMDBusInterfaceInfoExtended interface_info_ppp = {
|
||||
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
|
||||
NM_DBUS_INTERFACE_PPP,
|
||||
.methods = NM_DEFINE_GDBUS_METHOD_INFOS (
|
||||
NM_DEFINE_DBUS_METHOD_INFO_EXTENDED (
|
||||
NM_DEFINE_GDBUS_METHOD_INFO_INIT (
|
||||
"NeedSecrets",
|
||||
.out_args = NM_DEFINE_GDBUS_ARG_INFOS (
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("username", "s"),
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("password", "s"),
|
||||
),
|
||||
),
|
||||
.handle = impl_ppp_manager_need_secrets,
|
||||
),
|
||||
NM_DEFINE_DBUS_METHOD_INFO_EXTENDED (
|
||||
NM_DEFINE_GDBUS_METHOD_INFO_INIT (
|
||||
"SetIp4Config",
|
||||
.in_args = NM_DEFINE_GDBUS_ARG_INFOS (
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("config", "a{sv}"),
|
||||
),
|
||||
),
|
||||
.handle = impl_ppp_manager_set_ip4_config,
|
||||
),
|
||||
NM_DEFINE_DBUS_METHOD_INFO_EXTENDED (
|
||||
NM_DEFINE_GDBUS_METHOD_INFO_INIT (
|
||||
"SetIp6Config",
|
||||
.in_args = NM_DEFINE_GDBUS_ARG_INFOS (
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("config", "a{sv}"),
|
||||
),
|
||||
),
|
||||
.handle = impl_ppp_manager_set_ip6_config,
|
||||
),
|
||||
NM_DEFINE_DBUS_METHOD_INFO_EXTENDED (
|
||||
NM_DEFINE_GDBUS_METHOD_INFO_INIT (
|
||||
"SetState",
|
||||
.in_args = NM_DEFINE_GDBUS_ARG_INFOS (
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("state", "u"),
|
||||
),
|
||||
),
|
||||
.handle = impl_ppp_manager_set_state,
|
||||
),
|
||||
NM_DEFINE_DBUS_METHOD_INFO_EXTENDED (
|
||||
NM_DEFINE_GDBUS_METHOD_INFO_INIT (
|
||||
"SetIfindex",
|
||||
.in_args = NM_DEFINE_GDBUS_ARG_INFOS (
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("ifindex", "i"),
|
||||
),
|
||||
),
|
||||
.handle = impl_ppp_manager_set_ifindex,
|
||||
),
|
||||
),
|
||||
),
|
||||
};
|
||||
|
||||
static void
|
||||
nm_ppp_manager_class_init (NMPPPManagerClass *manager_class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (manager_class);
|
||||
NMExportedObjectClass *exported_object_class = NM_EXPORTED_OBJECT_CLASS (manager_class);
|
||||
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (manager_class);
|
||||
|
||||
object_class->dispose = dispose;
|
||||
object_class->finalize = finalize;
|
||||
object_class->get_property = get_property;
|
||||
object_class->set_property = set_property;
|
||||
|
||||
exported_object_class->export_path = NM_EXPORT_PATH_NUMBERED (NM_DBUS_PATH"/PPP");
|
||||
dbus_object_class->export_path = NM_EXPORT_PATH_NUMBERED (NM_DBUS_PATH"/PPP");
|
||||
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_ppp);
|
||||
|
||||
obj_properties[PROP_PARENT_IFACE] =
|
||||
g_param_spec_string (NM_PPP_MANAGER_PARENT_IFACE, "", "",
|
||||
|
|
@ -1385,15 +1477,6 @@ nm_ppp_manager_class_init (NMPPPManagerClass *manager_class)
|
|||
G_TYPE_NONE, 2,
|
||||
G_TYPE_UINT /*guint32 in_bytes*/,
|
||||
G_TYPE_UINT /*guint32 out_bytes*/);
|
||||
|
||||
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (manager_class),
|
||||
NMDBUS_TYPE_PPP_MANAGER_SKELETON,
|
||||
"NeedSecrets", impl_ppp_manager_need_secrets,
|
||||
"SetIp4Config", impl_ppp_manager_set_ip4_config,
|
||||
"SetIp6Config", impl_ppp_manager_set_ip6_config,
|
||||
"SetState", impl_ppp_manager_set_state,
|
||||
"SetIfindex", impl_ppp_manager_set_ifindex,
|
||||
NULL);
|
||||
}
|
||||
|
||||
NMPPPOps ppp_ops = {
|
||||
|
|
|
|||
|
|
@ -31,15 +31,13 @@
|
|||
#include "nm-auth-utils.h"
|
||||
#include "nm-setting-vpn.h"
|
||||
#include "nm-auth-manager.h"
|
||||
#include "nm-bus-manager.h"
|
||||
#include "nm-dbus-manager.h"
|
||||
#include "nm-session-monitor.h"
|
||||
#include "nm-simple-connection.h"
|
||||
#include "NetworkManagerUtils.h"
|
||||
#include "nm-core-internal.h"
|
||||
#include "nm-utils/c-list.h"
|
||||
|
||||
#include "introspection/org.freedesktop.NetworkManager.AgentManager.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
enum {
|
||||
|
|
@ -67,15 +65,15 @@ typedef struct {
|
|||
} NMAgentManagerPrivate;
|
||||
|
||||
struct _NMAgentManager {
|
||||
NMExportedObject parent;
|
||||
NMDBusObject parent;
|
||||
NMAgentManagerPrivate _priv;
|
||||
};
|
||||
|
||||
struct _NMAgentManagerClass {
|
||||
NMExportedObjectClass parent;
|
||||
NMDBusObjectClass parent;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (NMAgentManager, nm_agent_manager, NM_TYPE_EXPORTED_OBJECT)
|
||||
G_DEFINE_TYPE (NMAgentManager, nm_agent_manager, NM_TYPE_DBUS_OBJECT)
|
||||
|
||||
#define NM_AGENT_MANAGER_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMAgentManager, NM_IS_AGENT_MANAGER)
|
||||
|
||||
|
|
@ -392,10 +390,10 @@ agent_disconnected_cb (NMSecretAgent *agent, gpointer user_data)
|
|||
}
|
||||
|
||||
static void
|
||||
impl_agent_manager_register_with_capabilities (NMAgentManager *self,
|
||||
GDBusMethodInvocation *context,
|
||||
const char *identifier,
|
||||
guint32 capabilities)
|
||||
agent_manager_register_with_capabilities (NMAgentManager *self,
|
||||
GDBusMethodInvocation *context,
|
||||
const char *identifier,
|
||||
guint32 capabilities)
|
||||
{
|
||||
NMAgentManagerPrivate *priv = NM_AGENT_MANAGER_GET_PRIVATE (self);
|
||||
NMAuthSubject *subject;
|
||||
|
|
@ -460,45 +458,56 @@ done:
|
|||
}
|
||||
|
||||
static void
|
||||
impl_agent_manager_register (NMAgentManager *self,
|
||||
GDBusMethodInvocation *context,
|
||||
const char *identifier)
|
||||
impl_agent_manager_register (NMDBusObject *obj,
|
||||
const NMDBusInterfaceInfoExtended *interface_info,
|
||||
const NMDBusMethodInfoExtended *method_info,
|
||||
GDBusConnection *connection,
|
||||
const char *sender,
|
||||
GDBusMethodInvocation *invocation,
|
||||
GVariant *parameters)
|
||||
{
|
||||
impl_agent_manager_register_with_capabilities (self, context, identifier, 0);
|
||||
const char *identifier;
|
||||
|
||||
g_variant_get (parameters, "(&s)", &identifier);
|
||||
agent_manager_register_with_capabilities (NM_AGENT_MANAGER (obj), invocation, identifier, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_agent_manager_unregister (NMAgentManager *self,
|
||||
GDBusMethodInvocation *context)
|
||||
impl_agent_manager_register_with_capabilities (NMDBusObject *obj,
|
||||
const NMDBusInterfaceInfoExtended *interface_info,
|
||||
const NMDBusMethodInfoExtended *method_info,
|
||||
GDBusConnection *connection,
|
||||
const char *sender,
|
||||
GDBusMethodInvocation *invocation,
|
||||
GVariant *parameters)
|
||||
{
|
||||
GError *error = NULL;
|
||||
char *sender = NULL;
|
||||
const char *identifier;
|
||||
guint32 capabilities;
|
||||
|
||||
if (!nm_bus_manager_get_caller_info (nm_bus_manager_get (),
|
||||
context,
|
||||
&sender,
|
||||
NULL,
|
||||
NULL)) {
|
||||
error = g_error_new_literal (NM_AGENT_MANAGER_ERROR,
|
||||
NM_AGENT_MANAGER_ERROR_PERMISSION_DENIED,
|
||||
"Unable to determine request sender.");
|
||||
goto done;
|
||||
}
|
||||
g_variant_get (parameters, "(&su)", &identifier, &capabilities);
|
||||
agent_manager_register_with_capabilities (NM_AGENT_MANAGER (obj), invocation, identifier, capabilities);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_agent_manager_unregister (NMDBusObject *obj,
|
||||
const NMDBusInterfaceInfoExtended *interface_info,
|
||||
const NMDBusMethodInfoExtended *method_info,
|
||||
GDBusConnection *connection,
|
||||
const char *sender,
|
||||
GDBusMethodInvocation *invocation,
|
||||
GVariant *parameters)
|
||||
{
|
||||
NMAgentManager *self = NM_AGENT_MANAGER (obj);
|
||||
|
||||
/* Found the agent, unregister and remove it */
|
||||
if (!remove_agent (self, sender)) {
|
||||
error = g_error_new_literal (NM_AGENT_MANAGER_ERROR,
|
||||
NM_AGENT_MANAGER_ERROR_NOT_REGISTERED,
|
||||
"Caller is not registered as an Agent");
|
||||
goto done;
|
||||
g_dbus_method_invocation_return_error_literal (invocation,
|
||||
NM_AGENT_MANAGER_ERROR,
|
||||
NM_AGENT_MANAGER_ERROR_NOT_REGISTERED,
|
||||
"Caller is not registered as an Agent");
|
||||
return;
|
||||
}
|
||||
|
||||
g_dbus_method_invocation_return_value (context, NULL);
|
||||
|
||||
done:
|
||||
if (error)
|
||||
g_dbus_method_invocation_take_error (context, error);
|
||||
g_free (sender);
|
||||
g_dbus_method_invocation_return_value (invocation, NULL);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
@ -1586,7 +1595,7 @@ constructed (GObject *object)
|
|||
priv->auth_mgr = g_object_ref (nm_auth_manager_get ());
|
||||
priv->session_monitor = g_object_ref (nm_session_monitor_get ());
|
||||
|
||||
nm_exported_object_export (NM_EXPORTED_OBJECT (object));
|
||||
nm_dbus_object_export (NM_DBUS_OBJECT (object));
|
||||
|
||||
g_signal_connect (priv->auth_mgr,
|
||||
NM_AUTH_MANAGER_SIGNAL_CHANGED,
|
||||
|
|
@ -1622,20 +1631,64 @@ cancel_more:
|
|||
g_clear_object (&priv->auth_mgr);
|
||||
}
|
||||
|
||||
nm_exported_object_unexport (NM_EXPORTED_OBJECT (object));
|
||||
nm_dbus_object_unexport (NM_DBUS_OBJECT (object));
|
||||
|
||||
g_clear_object (&priv->session_monitor);
|
||||
|
||||
G_OBJECT_CLASS (nm_agent_manager_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static const NMDBusInterfaceInfoExtended interface_info_agent_manager = {
|
||||
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
|
||||
NM_DBUS_INTERFACE_AGENT_MANAGER,
|
||||
.methods = NM_DEFINE_GDBUS_METHOD_INFOS (
|
||||
NM_DEFINE_DBUS_METHOD_INFO_EXTENDED (
|
||||
NM_DEFINE_GDBUS_METHOD_INFO_INIT (
|
||||
"Register",
|
||||
.in_args = NM_DEFINE_GDBUS_ARG_INFOS (
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("identifier", "s"),
|
||||
),
|
||||
),
|
||||
.handle = impl_agent_manager_register,
|
||||
),
|
||||
NM_DEFINE_DBUS_METHOD_INFO_EXTENDED (
|
||||
NM_DEFINE_GDBUS_METHOD_INFO_INIT (
|
||||
"RegisterWithCapabilities",
|
||||
.in_args = NM_DEFINE_GDBUS_ARG_INFOS (
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("identifier", "s"),
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("capabilities", "u"),
|
||||
),
|
||||
),
|
||||
.handle = impl_agent_manager_register_with_capabilities,
|
||||
),
|
||||
NM_DEFINE_DBUS_METHOD_INFO_EXTENDED (
|
||||
NM_DEFINE_GDBUS_METHOD_INFO_INIT (
|
||||
"RegisterWithCapabilities",
|
||||
.in_args = NM_DEFINE_GDBUS_ARG_INFOS (
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("identifier", "s"),
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("capabilities", "u"),
|
||||
),
|
||||
),
|
||||
.handle = impl_agent_manager_register_with_capabilities,
|
||||
),
|
||||
NM_DEFINE_DBUS_METHOD_INFO_EXTENDED (
|
||||
NM_DEFINE_GDBUS_METHOD_INFO_INIT (
|
||||
"Unregister",
|
||||
),
|
||||
.handle = impl_agent_manager_unregister,
|
||||
),
|
||||
),
|
||||
),
|
||||
};
|
||||
|
||||
static void
|
||||
nm_agent_manager_class_init (NMAgentManagerClass *agent_manager_class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (agent_manager_class);
|
||||
NMExportedObjectClass *exported_object_class = NM_EXPORTED_OBJECT_CLASS (agent_manager_class);
|
||||
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (agent_manager_class);
|
||||
|
||||
exported_object_class->export_path = NM_DBUS_PATH_AGENT_MANAGER;
|
||||
dbus_object_class->export_path = NM_DBUS_PATH_AGENT_MANAGER;
|
||||
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_agent_manager);
|
||||
|
||||
object_class->constructed = constructed;
|
||||
object_class->dispose = dispose;
|
||||
|
|
@ -1649,11 +1702,4 @@ nm_agent_manager_class_init (NMAgentManagerClass *agent_manager_class)
|
|||
g_cclosure_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE, 1,
|
||||
G_TYPE_OBJECT);
|
||||
|
||||
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (agent_manager_class),
|
||||
NMDBUS_TYPE_AGENT_MANAGER_SKELETON,
|
||||
"Register", impl_agent_manager_register,
|
||||
"RegisterWithCapabilities", impl_agent_manager_register_with_capabilities,
|
||||
"Unregister", impl_agent_manager_unregister,
|
||||
NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include "nm-connection.h"
|
||||
|
||||
#include "nm-exported-object.h"
|
||||
#include "nm-dbus-object.h"
|
||||
#include "nm-secret-agent.h"
|
||||
|
||||
#define NM_TYPE_AGENT_MANAGER (nm_agent_manager_get_type ())
|
||||
|
|
|
|||
|
|
@ -26,14 +26,13 @@
|
|||
#include <pwd.h>
|
||||
|
||||
#include "nm-dbus-interface.h"
|
||||
#include "nm-bus-manager.h"
|
||||
#include "nm-dbus-manager.h"
|
||||
#include "nm-core-internal.h"
|
||||
#include "nm-auth-subject.h"
|
||||
#include "nm-simple-connection.h"
|
||||
#include "NetworkManagerUtils.h"
|
||||
#include "nm-utils/c-list.h"
|
||||
|
||||
#include "introspection/org.freedesktop.NetworkManager.SecretAgent.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
enum {
|
||||
|
|
@ -51,8 +50,8 @@ typedef struct {
|
|||
char *dbus_owner;
|
||||
NMSecretAgentCapabilities capabilities;
|
||||
GSList *permissions;
|
||||
NMDBusSecretAgent *proxy;
|
||||
NMBusManager *bus_mgr;
|
||||
GDBusProxy *proxy;
|
||||
NMDBusManager *bus_mgr;
|
||||
GDBusConnection *connection;
|
||||
CList requests;
|
||||
gulong on_disconnected_id;
|
||||
|
|
@ -336,11 +335,17 @@ get_callback (GObject *proxy,
|
|||
if (request_check_return (r)) {
|
||||
NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE (r->agent);
|
||||
gs_free_error GError *error = NULL;
|
||||
gs_unref_variant GVariant *ret = NULL;
|
||||
gs_unref_variant GVariant *secrets = NULL;
|
||||
|
||||
nmdbus_secret_agent_call_get_secrets_finish (priv->proxy, &secrets, result, &error);
|
||||
if (error)
|
||||
ret = _nm_dbus_proxy_call_finish (priv->proxy, result, G_VARIANT_TYPE ("(a{sa{sv}})"), &error);
|
||||
if (!ret)
|
||||
g_dbus_error_strip_remote_error (error);
|
||||
else {
|
||||
g_variant_get (ret,
|
||||
"(@a{sa{sv}})",
|
||||
&secrets);
|
||||
}
|
||||
r->callback (r->agent, r, secrets, error, r->callback_data);
|
||||
}
|
||||
|
||||
|
|
@ -358,7 +363,6 @@ nm_secret_agent_get_secrets (NMSecretAgent *self,
|
|||
gpointer callback_data)
|
||||
{
|
||||
NMSecretAgentPrivate *priv;
|
||||
static const char *no_hints[] = { NULL };
|
||||
GVariant *dict;
|
||||
NMSecretAgentCallId *r;
|
||||
|
||||
|
|
@ -379,16 +383,20 @@ nm_secret_agent_get_secrets (NMSecretAgent *self,
|
|||
r = request_new (self, "GetSecrets", path, setting_name, callback, callback_data);
|
||||
r->is_get_secrets = TRUE;
|
||||
|
||||
/* Increase the timeout only for this call */
|
||||
g_dbus_proxy_set_default_timeout (G_DBUS_PROXY (priv->proxy), 120000);
|
||||
nmdbus_secret_agent_call_get_secrets (priv->proxy,
|
||||
dict,
|
||||
path,
|
||||
setting_name,
|
||||
hints ? hints : no_hints,
|
||||
flags,
|
||||
r->cancellable,
|
||||
get_callback, r);
|
||||
g_dbus_proxy_call (priv->proxy,
|
||||
"GetSecrets",
|
||||
g_variant_new ("(@a{sa{sv}}os^asu)",
|
||||
dict,
|
||||
path,
|
||||
setting_name,
|
||||
hints ?: NM_PTRARRAY_EMPTY (const char *),
|
||||
(guint32) flags),
|
||||
G_DBUS_CALL_FLAGS_NONE,
|
||||
120000,
|
||||
r->cancellable,
|
||||
get_callback,
|
||||
r);
|
||||
|
||||
g_dbus_proxy_set_default_timeout (G_DBUS_PROXY (priv->proxy), -1);
|
||||
|
||||
return r;
|
||||
|
|
@ -399,17 +407,16 @@ nm_secret_agent_get_secrets (NMSecretAgent *self,
|
|||
static void
|
||||
cancel_done (GObject *proxy, GAsyncResult *result, gpointer user_data)
|
||||
{
|
||||
char *description = user_data;
|
||||
GError *error = NULL;
|
||||
gs_free char *description = user_data;
|
||||
gs_free_error GError *error = NULL;
|
||||
gs_unref_variant GVariant *ret = NULL;
|
||||
|
||||
if (!nmdbus_secret_agent_call_cancel_get_secrets_finish (NMDBUS_SECRET_AGENT (proxy), result, &error)) {
|
||||
ret = _nm_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), result, G_VARIANT_TYPE ("()"), &error);
|
||||
if (!ret) {
|
||||
nm_log_dbg (LOGD_AGENTS, "%s%s%s: agent failed to cancel secrets: %s",
|
||||
NM_PRINT_FMT_QUOTED (description, "(", description, ")", "???"),
|
||||
error->message);
|
||||
g_clear_error (&error);
|
||||
}
|
||||
|
||||
g_free (description);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -426,11 +433,16 @@ do_cancel_secrets (NMSecretAgent *self, NMSecretAgentCallId *r, gboolean disposi
|
|||
if ( r->is_get_secrets
|
||||
&& priv->proxy) {
|
||||
/* for GetSecrets call, we must cancel the request. */
|
||||
nmdbus_secret_agent_call_cancel_get_secrets (priv->proxy,
|
||||
r->path, r->setting_name,
|
||||
NULL,
|
||||
cancel_done,
|
||||
g_strdup (nm_secret_agent_get_description (self)));
|
||||
g_dbus_proxy_call (G_DBUS_PROXY (priv->proxy),
|
||||
"CancelGetSecrets",
|
||||
g_variant_new ("(os)",
|
||||
r->path,
|
||||
r->setting_name),
|
||||
G_DBUS_CALL_FLAGS_NONE,
|
||||
-1,
|
||||
NULL,
|
||||
cancel_done,
|
||||
g_strdup (nm_secret_agent_get_description (self)));
|
||||
}
|
||||
|
||||
cancellable = r->cancellable;
|
||||
|
|
@ -494,11 +506,11 @@ agent_save_cb (GObject *proxy,
|
|||
NMSecretAgentCallId *r = user_data;
|
||||
|
||||
if (request_check_return (r)) {
|
||||
NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE (r->agent);
|
||||
gs_free_error GError *error = NULL;
|
||||
gs_unref_variant GVariant *ret = NULL;
|
||||
|
||||
nmdbus_secret_agent_call_save_secrets_finish (priv->proxy, result, &error);
|
||||
if (error)
|
||||
ret = _nm_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), result, G_VARIANT_TYPE ("()"), &error);
|
||||
if (!ret)
|
||||
g_dbus_error_strip_remote_error (error);
|
||||
r->callback (r->agent, r, NULL, error, r->callback_data);
|
||||
}
|
||||
|
|
@ -527,11 +539,16 @@ nm_secret_agent_save_secrets (NMSecretAgent *self,
|
|||
dict = nm_connection_to_dbus (connection, NM_CONNECTION_SERIALIZE_ALL);
|
||||
|
||||
r = request_new (self, "SaveSecrets", path, NULL, callback, callback_data);
|
||||
nmdbus_secret_agent_call_save_secrets (priv->proxy,
|
||||
dict,
|
||||
path,
|
||||
NULL, /* cancelling the request does *not* cancel the D-Bus call. */
|
||||
agent_save_cb, r);
|
||||
g_dbus_proxy_call (priv->proxy,
|
||||
"SaveSecrets",
|
||||
g_variant_new ("(@a{sa{sv}}o)",
|
||||
dict,
|
||||
path),
|
||||
G_DBUS_CALL_FLAGS_NONE,
|
||||
-1,
|
||||
NULL, /* cancelling the request does *not* cancel the D-Bus call. */
|
||||
agent_save_cb,
|
||||
r);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
|
@ -546,11 +563,11 @@ agent_delete_cb (GObject *proxy,
|
|||
NMSecretAgentCallId *r = user_data;
|
||||
|
||||
if (request_check_return (r)) {
|
||||
NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE (r->agent);
|
||||
gs_free_error GError *error = NULL;
|
||||
gs_unref_variant GVariant *ret = NULL;
|
||||
|
||||
nmdbus_secret_agent_call_delete_secrets_finish (priv->proxy, result, &error);
|
||||
if (error)
|
||||
ret = _nm_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), result, G_VARIANT_TYPE ("()"), &error);
|
||||
if (!ret)
|
||||
g_dbus_error_strip_remote_error (error);
|
||||
r->callback (r->agent, r, NULL, error, r->callback_data);
|
||||
}
|
||||
|
|
@ -579,12 +596,16 @@ nm_secret_agent_delete_secrets (NMSecretAgent *self,
|
|||
dict = nm_connection_to_dbus (connection, NM_CONNECTION_SERIALIZE_NO_SECRETS);
|
||||
|
||||
r = request_new (self, "DeleteSecrets", path, NULL, callback, callback_data);
|
||||
nmdbus_secret_agent_call_delete_secrets (priv->proxy,
|
||||
dict,
|
||||
path,
|
||||
NULL, /* cancelling the request does *not* cancel the D-Bus call. */
|
||||
agent_delete_cb, r);
|
||||
|
||||
g_dbus_proxy_call (priv->proxy,
|
||||
"DeleteSecrets",
|
||||
g_variant_new ("(@a{sa{sv}}o)",
|
||||
dict,
|
||||
path),
|
||||
G_DBUS_CALL_FLAGS_NONE,
|
||||
-1,
|
||||
NULL, /* cancelling the request does *not* cancel the D-Bus call. */
|
||||
agent_delete_cb,
|
||||
r);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
@ -610,7 +631,7 @@ _on_disconnected_cleanup (NMSecretAgentPrivate *priv)
|
|||
}
|
||||
|
||||
static void
|
||||
_on_disconnected_private_connection (NMBusManager *mgr,
|
||||
_on_disconnected_private_connection (NMDBusManager *mgr,
|
||||
GDBusConnection *connection,
|
||||
NMSecretAgent *self)
|
||||
{
|
||||
|
|
@ -666,7 +687,6 @@ nm_secret_agent_new (GDBusMethodInvocation *context,
|
|||
NMSecretAgentPrivate *priv;
|
||||
const char *dbus_owner;
|
||||
struct passwd *pw;
|
||||
GDBusProxy *proxy;
|
||||
char *owner_username = NULL;
|
||||
char *description = NULL;
|
||||
char buf_subject[64];
|
||||
|
|
@ -695,9 +715,9 @@ nm_secret_agent_new (GDBusMethodInvocation *context,
|
|||
|
||||
priv = NM_SECRET_AGENT_GET_PRIVATE (self);
|
||||
|
||||
priv->bus_mgr = g_object_ref (nm_bus_manager_get ());
|
||||
priv->bus_mgr = g_object_ref (nm_dbus_manager_get ());
|
||||
priv->connection = g_object_ref (connection);
|
||||
priv->connection_is_private = !!nm_bus_manager_connection_get_private_name (priv->bus_mgr, connection);
|
||||
priv->connection_is_private = !!nm_dbus_manager_connection_get_private_name (priv->bus_mgr, connection);
|
||||
|
||||
_LOGt ("constructed: %s, owner=%s%s%s (%s), private-connection=%d, unique-name=%s%s%s, capabilities=%s",
|
||||
(description = _create_description (dbus_owner, identifier, uid)),
|
||||
|
|
@ -714,20 +734,18 @@ nm_secret_agent_new (GDBusMethodInvocation *context,
|
|||
priv->capabilities = capabilities;
|
||||
priv->subject = g_object_ref (subject);
|
||||
|
||||
proxy = nm_bus_manager_new_proxy (priv->bus_mgr,
|
||||
priv->connection,
|
||||
NMDBUS_TYPE_SECRET_AGENT_PROXY,
|
||||
priv->dbus_owner,
|
||||
NM_DBUS_PATH_SECRET_AGENT,
|
||||
NM_DBUS_INTERFACE_SECRET_AGENT);
|
||||
g_assert (proxy);
|
||||
priv->proxy = NMDBUS_SECRET_AGENT (proxy);
|
||||
priv->proxy = nm_dbus_manager_new_proxy (priv->bus_mgr,
|
||||
priv->connection,
|
||||
G_TYPE_DBUS_PROXY,
|
||||
priv->dbus_owner,
|
||||
NM_DBUS_PATH_SECRET_AGENT,
|
||||
NM_DBUS_INTERFACE_SECRET_AGENT);
|
||||
|
||||
/* we cannot subscribe to notify::g-name-owner because that doesn't work
|
||||
* for unique names and it doesn't work for private connections. */
|
||||
if (priv->connection_is_private) {
|
||||
priv->on_disconnected_id = g_signal_connect (priv->bus_mgr,
|
||||
NM_BUS_MANAGER_PRIVATE_CONNECTION_DISCONNECTED,
|
||||
NM_DBUS_MANAGER_PRIVATE_CONNECTION_DISCONNECTED,
|
||||
G_CALLBACK (_on_disconnected_private_connection),
|
||||
self);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -39,8 +39,6 @@
|
|||
#include "nm-core-internal.h"
|
||||
#include "nm-audit-manager.h"
|
||||
|
||||
#include "introspection/org.freedesktop.NetworkManager.Settings.Connection.h"
|
||||
|
||||
#define SETTINGS_TIMESTAMPS_FILE NMSTATEDIR "/timestamps"
|
||||
#define SETTINGS_SEEN_BSSIDS_FILE NMSTATEDIR "/seen-bssids"
|
||||
|
||||
|
|
@ -60,7 +58,6 @@ NM_GOBJECT_PROPERTIES_DEFINE (NMSettingsConnection,
|
|||
);
|
||||
|
||||
enum {
|
||||
UPDATED,
|
||||
REMOVED,
|
||||
UPDATED_INTERNAL,
|
||||
LAST_SIGNAL
|
||||
|
|
@ -115,7 +112,7 @@ typedef struct _NMSettingsConnectionPrivate {
|
|||
|
||||
} NMSettingsConnectionPrivate;
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (NMSettingsConnection, nm_settings_connection, NM_TYPE_EXPORTED_OBJECT,
|
||||
G_DEFINE_TYPE_WITH_CODE (NMSettingsConnection, nm_settings_connection, NM_TYPE_DBUS_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (NM_TYPE_CONNECTION, nm_settings_connection_connection_interface_init)
|
||||
)
|
||||
|
||||
|
|
@ -146,12 +143,9 @@ G_DEFINE_TYPE_WITH_CODE (NMSettingsConnection, nm_settings_connection, NM_TYPE_E
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
_emit_updated (NMSettingsConnection *self, gboolean by_user)
|
||||
{
|
||||
g_signal_emit (self, signals[UPDATED], 0);
|
||||
g_signal_emit (self, signals[UPDATED_INTERNAL], 0, by_user);
|
||||
}
|
||||
static const GDBusSignalInfo signal_info_updated;
|
||||
static const GDBusSignalInfo signal_info_removed;
|
||||
static const NMDBusInterfaceInfoExtended interface_info_settings_connection;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
|
@ -525,6 +519,16 @@ set_persist_mode (NMSettingsConnection *self, NMSettingsConnectionPersistMode pe
|
|||
nm_settings_connection_set_flags_full (self, ALL, flags);
|
||||
}
|
||||
|
||||
static void
|
||||
_emit_updated (NMSettingsConnection *self, gboolean by_user)
|
||||
{
|
||||
nm_dbus_object_emit_signal (NM_DBUS_OBJECT (self),
|
||||
&interface_info_settings_connection,
|
||||
&signal_info_updated,
|
||||
"()");
|
||||
g_signal_emit (self, signals[UPDATED_INTERNAL], 0, by_user);
|
||||
}
|
||||
|
||||
static void
|
||||
connection_changed_cb (NMSettingsConnection *self, gpointer unused)
|
||||
{
|
||||
|
|
@ -1573,18 +1577,25 @@ get_settings_auth_cb (NMSettingsConnection *self,
|
|||
}
|
||||
|
||||
static void
|
||||
impl_settings_connection_get_settings (NMSettingsConnection *self,
|
||||
GDBusMethodInvocation *context)
|
||||
impl_settings_connection_get_settings (NMDBusObject *obj,
|
||||
const NMDBusInterfaceInfoExtended *interface_info,
|
||||
const NMDBusMethodInfoExtended *method_info,
|
||||
GDBusConnection *connection,
|
||||
const char *sender,
|
||||
GDBusMethodInvocation *invocation,
|
||||
GVariant *parameters)
|
||||
{
|
||||
NMAuthSubject *subject;
|
||||
NMSettingsConnection *self = NM_SETTINGS_CONNECTION (obj);
|
||||
gs_unref_object NMAuthSubject *subject = NULL;
|
||||
GError *error = NULL;
|
||||
|
||||
subject = _new_auth_subject (context, &error);
|
||||
if (subject) {
|
||||
auth_start (self, context, subject, NULL, get_settings_auth_cb, NULL);
|
||||
g_object_unref (subject);
|
||||
} else
|
||||
g_dbus_method_invocation_take_error (context, error);
|
||||
subject = _new_auth_subject (invocation, &error);
|
||||
if (!subject) {
|
||||
g_dbus_method_invocation_take_error (invocation, error);
|
||||
return;
|
||||
}
|
||||
|
||||
auth_start (self, invocation, subject, NULL, get_settings_auth_cb, NULL);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
|
|
@ -1897,54 +1908,87 @@ error:
|
|||
}
|
||||
|
||||
static void
|
||||
impl_settings_connection_update (NMSettingsConnection *self,
|
||||
GDBusMethodInvocation *context,
|
||||
GVariant *new_settings)
|
||||
impl_settings_connection_update (NMDBusObject *obj,
|
||||
const NMDBusInterfaceInfoExtended *interface_info,
|
||||
const NMDBusMethodInfoExtended *method_info,
|
||||
GDBusConnection *connection,
|
||||
const char *sender,
|
||||
GDBusMethodInvocation *invocation,
|
||||
GVariant *parameters)
|
||||
{
|
||||
settings_connection_update (self, FALSE, context, new_settings, NM_SETTINGS_UPDATE2_FLAG_TO_DISK);
|
||||
NMSettingsConnection *self = NM_SETTINGS_CONNECTION (obj);
|
||||
gs_unref_variant GVariant *settings = NULL;
|
||||
|
||||
g_variant_get (parameters, "(@a{sa{sv}})", &settings);
|
||||
settings_connection_update (self, FALSE, invocation, settings, NM_SETTINGS_UPDATE2_FLAG_TO_DISK);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_settings_connection_update_unsaved (NMSettingsConnection *self,
|
||||
GDBusMethodInvocation *context,
|
||||
GVariant *new_settings)
|
||||
impl_settings_connection_update_unsaved (NMDBusObject *obj,
|
||||
const NMDBusInterfaceInfoExtended *interface_info,
|
||||
const NMDBusMethodInfoExtended *method_info,
|
||||
GDBusConnection *connection,
|
||||
const char *sender,
|
||||
GDBusMethodInvocation *invocation,
|
||||
GVariant *parameters)
|
||||
{
|
||||
settings_connection_update (self, FALSE, context, new_settings, NM_SETTINGS_UPDATE2_FLAG_IN_MEMORY);
|
||||
NMSettingsConnection *self = NM_SETTINGS_CONNECTION (obj);
|
||||
gs_unref_variant GVariant *settings = NULL;
|
||||
|
||||
g_variant_get (parameters, "(@a{sa{sv}})", &settings);
|
||||
settings_connection_update (self, FALSE, invocation, settings, NM_SETTINGS_UPDATE2_FLAG_IN_MEMORY);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_settings_connection_save (NMSettingsConnection *self,
|
||||
GDBusMethodInvocation *context)
|
||||
impl_settings_connection_save (NMDBusObject *obj,
|
||||
const NMDBusInterfaceInfoExtended *interface_info,
|
||||
const NMDBusMethodInfoExtended *method_info,
|
||||
GDBusConnection *connection,
|
||||
const char *sender,
|
||||
GDBusMethodInvocation *invocation,
|
||||
GVariant *parameters)
|
||||
{
|
||||
settings_connection_update (self, FALSE, context, NULL, NM_SETTINGS_UPDATE2_FLAG_TO_DISK);
|
||||
NMSettingsConnection *self = NM_SETTINGS_CONNECTION (obj);
|
||||
|
||||
settings_connection_update (self, FALSE, invocation, NULL, NM_SETTINGS_UPDATE2_FLAG_TO_DISK);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_settings_connection_update2 (NMSettingsConnection *self,
|
||||
GDBusMethodInvocation *context,
|
||||
GVariant *settings,
|
||||
guint32 flags_u,
|
||||
GVariant *args)
|
||||
impl_settings_connection_update2 (NMDBusObject *obj,
|
||||
const NMDBusInterfaceInfoExtended *interface_info,
|
||||
const NMDBusMethodInfoExtended *method_info,
|
||||
GDBusConnection *connection,
|
||||
const char *sender,
|
||||
GDBusMethodInvocation *invocation,
|
||||
GVariant *parameters)
|
||||
{
|
||||
NMSettingsConnection *self = NM_SETTINGS_CONNECTION (obj);
|
||||
gs_unref_variant GVariant *settings = NULL;
|
||||
gs_unref_variant GVariant *args = NULL;
|
||||
guint32 flags_u;
|
||||
GError *error = NULL;
|
||||
GVariantIter iter;
|
||||
const char *args_name;
|
||||
const NMSettingsUpdate2Flags flags = (NMSettingsUpdate2Flags) flags_u;
|
||||
NMSettingsUpdate2Flags flags;
|
||||
const NMSettingsUpdate2Flags ALL_PERSIST_MODES = NM_SETTINGS_UPDATE2_FLAG_TO_DISK
|
||||
| NM_SETTINGS_UPDATE2_FLAG_IN_MEMORY
|
||||
| NM_SETTINGS_UPDATE2_FLAG_IN_MEMORY_DETACHED
|
||||
| NM_SETTINGS_UPDATE2_FLAG_IN_MEMORY_ONLY;
|
||||
|
||||
g_variant_get (parameters, "(@a{sa{sv}}u@a{sv})", &settings, &flags_u, &args);
|
||||
|
||||
if (NM_FLAGS_ANY (flags_u, ~((guint32) (ALL_PERSIST_MODES |
|
||||
NM_SETTINGS_UPDATE2_FLAG_VOLATILE |
|
||||
NM_SETTINGS_UPDATE2_FLAG_BLOCK_AUTOCONNECT)))) {
|
||||
error = g_error_new_literal (NM_SETTINGS_ERROR,
|
||||
NM_SETTINGS_ERROR_INVALID_ARGUMENTS,
|
||||
"Unknown flags");
|
||||
g_dbus_method_invocation_take_error (context, error);
|
||||
g_dbus_method_invocation_take_error (invocation, error);
|
||||
return;
|
||||
}
|
||||
|
||||
flags = (NMSettingsUpdate2Flags) flags_u;
|
||||
|
||||
if ( ( NM_FLAGS_ANY (flags, ALL_PERSIST_MODES)
|
||||
&& !nm_utils_is_power_of_two (flags & ALL_PERSIST_MODES))
|
||||
|| ( NM_FLAGS_HAS (flags, NM_SETTINGS_UPDATE2_FLAG_VOLATILE)
|
||||
|
|
@ -1953,7 +1997,7 @@ impl_settings_connection_update2 (NMSettingsConnection *self,
|
|||
error = g_error_new_literal (NM_SETTINGS_ERROR,
|
||||
NM_SETTINGS_ERROR_INVALID_ARGUMENTS,
|
||||
"Conflicting flags");
|
||||
g_dbus_method_invocation_take_error (context, error);
|
||||
g_dbus_method_invocation_take_error (invocation, error);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1961,7 +2005,7 @@ impl_settings_connection_update2 (NMSettingsConnection *self,
|
|||
error = g_error_new_literal (NM_SETTINGS_ERROR,
|
||||
NM_SETTINGS_ERROR_INVALID_ARGUMENTS,
|
||||
"args is of invalid type");
|
||||
g_dbus_method_invocation_take_error (context, error);
|
||||
g_dbus_method_invocation_take_error (invocation, error);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1970,13 +2014,13 @@ impl_settings_connection_update2 (NMSettingsConnection *self,
|
|||
error = g_error_new (NM_SETTINGS_ERROR,
|
||||
NM_SETTINGS_ERROR_INVALID_ARGUMENTS,
|
||||
"Unsupported argument '%s'", args_name);
|
||||
g_dbus_method_invocation_take_error (context, error);
|
||||
g_dbus_method_invocation_take_error (invocation, error);
|
||||
return;
|
||||
}
|
||||
|
||||
settings_connection_update (self,
|
||||
TRUE,
|
||||
context,
|
||||
invocation,
|
||||
settings,
|
||||
flags);
|
||||
}
|
||||
|
|
@ -2029,26 +2073,30 @@ get_modify_permission_basic (NMSettingsConnection *self)
|
|||
}
|
||||
|
||||
static void
|
||||
impl_settings_connection_delete (NMSettingsConnection *self,
|
||||
GDBusMethodInvocation *context)
|
||||
impl_settings_connection_delete (NMDBusObject *obj,
|
||||
const NMDBusInterfaceInfoExtended *interface_info,
|
||||
const NMDBusMethodInfoExtended *method_info,
|
||||
GDBusConnection *connection,
|
||||
const char *sender,
|
||||
GDBusMethodInvocation *invocation,
|
||||
GVariant *parameters)
|
||||
{
|
||||
NMAuthSubject *subject = NULL;
|
||||
NMSettingsConnection *self = NM_SETTINGS_CONNECTION (obj);
|
||||
gs_unref_object NMAuthSubject *subject = NULL;
|
||||
GError *error = NULL;
|
||||
|
||||
if (!check_writable (NM_CONNECTION (self), &error))
|
||||
goto out_err;
|
||||
goto err;
|
||||
|
||||
subject = _new_auth_subject (context, &error);
|
||||
if (subject) {
|
||||
auth_start (self, context, subject, get_modify_permission_basic (self), delete_auth_cb, NULL);
|
||||
g_object_unref (subject);
|
||||
} else
|
||||
goto out_err;
|
||||
subject = _new_auth_subject (invocation, &error);
|
||||
if (!subject)
|
||||
goto err;
|
||||
|
||||
auth_start (self, invocation, subject, get_modify_permission_basic (self), delete_auth_cb, NULL);
|
||||
return;
|
||||
out_err:
|
||||
err:
|
||||
nm_audit_log_connection_op (NM_AUDIT_OP_CONN_DELETE, self, FALSE, NULL, subject, error->message);
|
||||
g_dbus_method_invocation_take_error (context, error);
|
||||
g_dbus_method_invocation_take_error (invocation, error);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
@ -2107,24 +2155,33 @@ dbus_get_secrets_auth_cb (NMSettingsConnection *self,
|
|||
}
|
||||
|
||||
static void
|
||||
impl_settings_connection_get_secrets (NMSettingsConnection *self,
|
||||
GDBusMethodInvocation *context,
|
||||
const gchar *setting_name)
|
||||
impl_settings_connection_get_secrets (NMDBusObject *obj,
|
||||
const NMDBusInterfaceInfoExtended *interface_info,
|
||||
const NMDBusMethodInfoExtended *method_info,
|
||||
GDBusConnection *connection,
|
||||
const char *sender,
|
||||
GDBusMethodInvocation *invocation,
|
||||
GVariant *parameters)
|
||||
{
|
||||
NMAuthSubject *subject;
|
||||
NMSettingsConnection *self = NM_SETTINGS_CONNECTION (obj);
|
||||
gs_unref_object NMAuthSubject *subject = NULL;
|
||||
GError *error = NULL;
|
||||
const char *setting_name;
|
||||
|
||||
subject = _new_auth_subject (context, &error);
|
||||
if (subject) {
|
||||
auth_start (self,
|
||||
context,
|
||||
subject,
|
||||
get_modify_permission_basic (self),
|
||||
dbus_get_secrets_auth_cb,
|
||||
g_strdup (setting_name));
|
||||
g_object_unref (subject);
|
||||
} else
|
||||
g_dbus_method_invocation_take_error (context, error);
|
||||
subject = _new_auth_subject (invocation, &error);
|
||||
if (!subject) {
|
||||
g_dbus_method_invocation_take_error (invocation, error);
|
||||
return;
|
||||
}
|
||||
|
||||
g_variant_get (parameters, "(&s)", &setting_name);
|
||||
|
||||
auth_start (self,
|
||||
invocation,
|
||||
subject,
|
||||
get_modify_permission_basic (self),
|
||||
dbus_get_secrets_auth_cb,
|
||||
g_strdup (setting_name));
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -2173,26 +2230,31 @@ dbus_clear_secrets_auth_cb (NMSettingsConnection *self,
|
|||
}
|
||||
|
||||
static void
|
||||
impl_settings_connection_clear_secrets (NMSettingsConnection *self,
|
||||
GDBusMethodInvocation *context)
|
||||
impl_settings_connection_clear_secrets (NMDBusObject *obj,
|
||||
const NMDBusInterfaceInfoExtended *interface_info,
|
||||
const NMDBusMethodInfoExtended *method_info,
|
||||
GDBusConnection *connection,
|
||||
const char *sender,
|
||||
GDBusMethodInvocation *invocation,
|
||||
GVariant *parameters)
|
||||
{
|
||||
NMAuthSubject *subject;
|
||||
NMSettingsConnection *self = NM_SETTINGS_CONNECTION (obj);
|
||||
gs_unref_object NMAuthSubject *subject = NULL;
|
||||
GError *error = NULL;
|
||||
|
||||
subject = _new_auth_subject (context, &error);
|
||||
if (subject) {
|
||||
auth_start (self,
|
||||
context,
|
||||
subject,
|
||||
get_modify_permission_basic (self),
|
||||
dbus_clear_secrets_auth_cb,
|
||||
NULL);
|
||||
g_object_unref (subject);
|
||||
} else {
|
||||
subject = _new_auth_subject (invocation, &error);
|
||||
if (!subject) {
|
||||
nm_audit_log_connection_op (NM_AUDIT_OP_CONN_CLEAR_SECRETS, self,
|
||||
FALSE, NULL, NULL, error->message);
|
||||
g_dbus_method_invocation_take_error (context, error);
|
||||
g_dbus_method_invocation_take_error (invocation, error);
|
||||
return;
|
||||
}
|
||||
auth_start (self,
|
||||
invocation,
|
||||
subject,
|
||||
get_modify_permission_basic (self),
|
||||
dbus_clear_secrets_auth_cb,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
@ -2216,7 +2278,12 @@ nm_settings_connection_signal_remove (NMSettingsConnection *self)
|
|||
if (priv->removed)
|
||||
return;
|
||||
priv->removed = TRUE;
|
||||
g_signal_emit_by_name (self, NM_SETTINGS_CONNECTION_REMOVED);
|
||||
|
||||
nm_dbus_object_emit_signal (NM_DBUS_OBJECT (self),
|
||||
&interface_info_settings_connection,
|
||||
&signal_info_removed,
|
||||
"()");
|
||||
g_signal_emit (self, signals[REMOVED], 0);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
|
@ -3010,22 +3077,119 @@ set_property (GObject *object, guint prop_id,
|
|||
}
|
||||
}
|
||||
|
||||
static const GDBusSignalInfo signal_info_updated = NM_DEFINE_GDBUS_SIGNAL_INFO_INIT (
|
||||
"Updated",
|
||||
);
|
||||
|
||||
static const GDBusSignalInfo signal_info_removed = NM_DEFINE_GDBUS_SIGNAL_INFO_INIT (
|
||||
"Removed",
|
||||
);
|
||||
|
||||
static const NMDBusInterfaceInfoExtended interface_info_settings_connection = {
|
||||
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
|
||||
NM_DBUS_INTERFACE_SETTINGS_CONNECTION,
|
||||
.methods = NM_DEFINE_GDBUS_METHOD_INFOS (
|
||||
NM_DEFINE_DBUS_METHOD_INFO_EXTENDED (
|
||||
NM_DEFINE_GDBUS_METHOD_INFO_INIT (
|
||||
"Update",
|
||||
.in_args = NM_DEFINE_GDBUS_ARG_INFOS (
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("properties", "a{sa{sv}}"),
|
||||
),
|
||||
),
|
||||
.handle = impl_settings_connection_update,
|
||||
),
|
||||
NM_DEFINE_DBUS_METHOD_INFO_EXTENDED (
|
||||
NM_DEFINE_GDBUS_METHOD_INFO_INIT (
|
||||
"UpdateUnsaved",
|
||||
.in_args = NM_DEFINE_GDBUS_ARG_INFOS (
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("properties", "a{sa{sv}}"),
|
||||
),
|
||||
),
|
||||
.handle = impl_settings_connection_update_unsaved,
|
||||
),
|
||||
NM_DEFINE_DBUS_METHOD_INFO_EXTENDED (
|
||||
NM_DEFINE_GDBUS_METHOD_INFO_INIT (
|
||||
"Delete",
|
||||
),
|
||||
.handle = impl_settings_connection_delete,
|
||||
),
|
||||
NM_DEFINE_DBUS_METHOD_INFO_EXTENDED (
|
||||
NM_DEFINE_GDBUS_METHOD_INFO_INIT (
|
||||
"GetSettings",
|
||||
.out_args = NM_DEFINE_GDBUS_ARG_INFOS (
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("settings", "a{sa{sv}}"),
|
||||
),
|
||||
),
|
||||
.handle = impl_settings_connection_get_settings,
|
||||
),
|
||||
NM_DEFINE_DBUS_METHOD_INFO_EXTENDED (
|
||||
NM_DEFINE_GDBUS_METHOD_INFO_INIT (
|
||||
"GetSecrets",
|
||||
.in_args = NM_DEFINE_GDBUS_ARG_INFOS (
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("setting_name", "s"),
|
||||
),
|
||||
.out_args = NM_DEFINE_GDBUS_ARG_INFOS (
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("secrets", "a{sa{sv}}"),
|
||||
),
|
||||
),
|
||||
.handle = impl_settings_connection_get_secrets,
|
||||
),
|
||||
NM_DEFINE_DBUS_METHOD_INFO_EXTENDED (
|
||||
NM_DEFINE_GDBUS_METHOD_INFO_INIT (
|
||||
"ClearSecrets",
|
||||
),
|
||||
.handle = impl_settings_connection_clear_secrets,
|
||||
),
|
||||
NM_DEFINE_DBUS_METHOD_INFO_EXTENDED (
|
||||
NM_DEFINE_GDBUS_METHOD_INFO_INIT (
|
||||
"Save",
|
||||
),
|
||||
.handle = impl_settings_connection_save,
|
||||
),
|
||||
NM_DEFINE_DBUS_METHOD_INFO_EXTENDED (
|
||||
NM_DEFINE_GDBUS_METHOD_INFO_INIT (
|
||||
"Update2",
|
||||
.in_args = NM_DEFINE_GDBUS_ARG_INFOS (
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("settings", "a{sa{sv}}"),
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("flags", "u"),
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("args", "a{sv}"),
|
||||
),
|
||||
.out_args = NM_DEFINE_GDBUS_ARG_INFOS (
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("result", "a{sv}"),
|
||||
),
|
||||
),
|
||||
.handle = impl_settings_connection_update2,
|
||||
),
|
||||
),
|
||||
.signals = NM_DEFINE_GDBUS_SIGNAL_INFOS (
|
||||
&nm_signal_info_property_changed_legacy,
|
||||
&signal_info_updated,
|
||||
&signal_info_removed,
|
||||
),
|
||||
.properties = NM_DEFINE_GDBUS_PROPERTY_INFOS (
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Unsaved", "b", NM_SETTINGS_CONNECTION_UNSAVED),
|
||||
),
|
||||
),
|
||||
.legacy_property_changed = TRUE,
|
||||
};
|
||||
|
||||
static void
|
||||
nm_settings_connection_class_init (NMSettingsConnectionClass *class)
|
||||
nm_settings_connection_class_init (NMSettingsConnectionClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
NMExportedObjectClass *exported_object_class = NM_EXPORTED_OBJECT_CLASS (class);
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass);
|
||||
|
||||
g_type_class_add_private (class, sizeof (NMSettingsConnectionPrivate));
|
||||
g_type_class_add_private (klass, sizeof (NMSettingsConnectionPrivate));
|
||||
|
||||
exported_object_class->export_path = NM_EXPORT_PATH_NUMBERED (NM_DBUS_PATH_SETTINGS);
|
||||
dbus_object_class->export_path = NM_EXPORT_PATH_NUMBERED (NM_DBUS_PATH_SETTINGS);
|
||||
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_settings_connection);
|
||||
|
||||
object_class->constructed = constructed;
|
||||
object_class->dispose = dispose;
|
||||
object_class->get_property = get_property;
|
||||
object_class->set_property = set_property;
|
||||
|
||||
class->supports_secrets = supports_secrets;
|
||||
klass->supports_secrets = supports_secrets;
|
||||
|
||||
obj_properties[PROP_UNSAVED] =
|
||||
g_param_spec_boolean (NM_SETTINGS_CONNECTION_UNSAVED, "", "",
|
||||
|
|
@ -3056,20 +3220,10 @@ nm_settings_connection_class_init (NMSettingsConnectionClass *class)
|
|||
|
||||
g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
||||
|
||||
|
||||
signals[UPDATED] =
|
||||
g_signal_new (NM_SETTINGS_CONNECTION_UPDATED,
|
||||
G_TYPE_FROM_CLASS (class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
0,
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
/* internal signal, with an argument (gboolean by_user). */
|
||||
signals[UPDATED_INTERNAL] =
|
||||
g_signal_new (NM_SETTINGS_CONNECTION_UPDATED_INTERNAL,
|
||||
G_TYPE_FROM_CLASS (class),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
0, NULL, NULL,
|
||||
g_cclosure_marshal_VOID__BOOLEAN,
|
||||
|
|
@ -3077,24 +3231,12 @@ nm_settings_connection_class_init (NMSettingsConnectionClass *class)
|
|||
|
||||
signals[REMOVED] =
|
||||
g_signal_new (NM_SETTINGS_CONNECTION_REMOVED,
|
||||
G_TYPE_FROM_CLASS (class),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
0,
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (class),
|
||||
NMDBUS_TYPE_SETTINGS_CONNECTION_SKELETON,
|
||||
"Update", impl_settings_connection_update,
|
||||
"UpdateUnsaved", impl_settings_connection_update_unsaved,
|
||||
"Delete", impl_settings_connection_delete,
|
||||
"GetSettings", impl_settings_connection_get_settings,
|
||||
"GetSecrets", impl_settings_connection_get_secrets,
|
||||
"ClearSecrets", impl_settings_connection_clear_secrets,
|
||||
"Save", impl_settings_connection_save,
|
||||
"Update2", impl_settings_connection_update2,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include <net/ethernet.h>
|
||||
|
||||
#include "nm-exported-object.h"
|
||||
#include "nm-dbus-object.h"
|
||||
#include "nm-connection.h"
|
||||
|
||||
#define NM_TYPE_SETTINGS_CONNECTION (nm_settings_connection_get_type ())
|
||||
|
|
@ -34,13 +34,9 @@
|
|||
#define NM_IS_SETTINGS_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SETTINGS_CONNECTION))
|
||||
#define NM_SETTINGS_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SETTINGS_CONNECTION, NMSettingsConnectionClass))
|
||||
|
||||
/* Signals */
|
||||
#define NM_SETTINGS_CONNECTION_UPDATED "updated"
|
||||
#define NM_SETTINGS_CONNECTION_REMOVED "removed"
|
||||
#define NM_SETTINGS_CONNECTION_GET_SECRETS "get-secrets"
|
||||
#define NM_SETTINGS_CONNECTION_CANCEL_SECRETS "cancel-secrets"
|
||||
|
||||
/* Internal signals */
|
||||
#define NM_SETTINGS_CONNECTION_UPDATED_INTERNAL "updated-internal"
|
||||
|
||||
/* Properties */
|
||||
|
|
@ -106,12 +102,12 @@ typedef struct _NMSettingsConnectionClass NMSettingsConnectionClass;
|
|||
struct _NMSettingsConnectionPrivate;
|
||||
|
||||
struct _NMSettingsConnection {
|
||||
NMExportedObject parent;
|
||||
NMDBusObject parent;
|
||||
struct _NMSettingsConnectionPrivate *_priv;
|
||||
};
|
||||
|
||||
struct _NMSettingsConnectionClass {
|
||||
NMExportedObjectClass parent;
|
||||
NMDBusObjectClass parent;
|
||||
|
||||
gboolean (*commit_changes) (NMSettingsConnection *self,
|
||||
NMConnection *new_connection,
|
||||
|
|
|
|||
|
|
@ -62,10 +62,11 @@
|
|||
#include "nm-utils.h"
|
||||
#include "nm-core-internal.h"
|
||||
|
||||
#include "nm-dbus-object.h"
|
||||
#include "devices/nm-device-ethernet.h"
|
||||
#include "nm-settings-connection.h"
|
||||
#include "nm-settings-plugin.h"
|
||||
#include "nm-bus-manager.h"
|
||||
#include "nm-dbus-manager.h"
|
||||
#include "nm-auth-utils.h"
|
||||
#include "nm-auth-subject.h"
|
||||
#include "nm-session-monitor.h"
|
||||
|
|
@ -77,8 +78,6 @@
|
|||
#include "nm-dispatcher.h"
|
||||
#include "nm-hostname-manager.h"
|
||||
|
||||
#include "introspection/org.freedesktop.NetworkManager.Settings.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#define EXPORT(sym) void * __export_##sym = &sym;
|
||||
|
|
@ -107,7 +106,6 @@ enum {
|
|||
CONNECTION_UPDATED,
|
||||
CONNECTION_REMOVED,
|
||||
CONNECTION_FLAGS_CHANGED,
|
||||
NEW_CONNECTION, /* exported, not used internally */
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
|
|
@ -135,15 +133,15 @@ typedef struct {
|
|||
} NMSettingsPrivate;
|
||||
|
||||
struct _NMSettings {
|
||||
NMExportedObject parent;
|
||||
NMDBusObject parent;
|
||||
NMSettingsPrivate _priv;
|
||||
};
|
||||
|
||||
struct _NMSettingsClass {
|
||||
NMExportedObjectClass parent;
|
||||
NMDBusObjectClass parent;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (NMSettings, nm_settings, NM_TYPE_EXPORTED_OBJECT);
|
||||
G_DEFINE_TYPE (NMSettings, nm_settings, NM_TYPE_DBUS_OBJECT);
|
||||
|
||||
#define NM_SETTINGS_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMSettings, NM_IS_SETTINGS)
|
||||
|
||||
|
|
@ -154,6 +152,10 @@ G_DEFINE_TYPE (NMSettings, nm_settings, NM_TYPE_EXPORTED_OBJECT);
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
static const NMDBusInterfaceInfoExtended interface_info_settings;
|
||||
static const GDBusSignalInfo signal_info_new_connection;
|
||||
static const GDBusSignalInfo signal_info_connection_removed;
|
||||
|
||||
static void claim_connection (NMSettings *self,
|
||||
NMSettingsConnection *connection);
|
||||
|
||||
|
|
@ -267,11 +269,17 @@ nm_settings_for_each_connection (NMSettings *self,
|
|||
}
|
||||
|
||||
static void
|
||||
impl_settings_list_connections (NMSettings *self,
|
||||
GDBusMethodInvocation *context)
|
||||
impl_settings_list_connections (NMDBusObject *obj,
|
||||
const NMDBusInterfaceInfoExtended *interface_info,
|
||||
const NMDBusMethodInfoExtended *method_info,
|
||||
GDBusConnection *connection,
|
||||
const char *sender,
|
||||
GDBusMethodInvocation *invocation,
|
||||
GVariant *parameters)
|
||||
{
|
||||
NMSettings *self = NM_SETTINGS (obj);
|
||||
NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self);
|
||||
GPtrArray *connections;
|
||||
gs_unref_ptrarray GPtrArray *connections = NULL;
|
||||
GHashTableIter iter;
|
||||
gpointer key;
|
||||
|
||||
|
|
@ -281,9 +289,8 @@ impl_settings_list_connections (NMSettings *self,
|
|||
g_ptr_array_add (connections, key);
|
||||
g_ptr_array_add (connections, NULL);
|
||||
|
||||
g_dbus_method_invocation_return_value (context,
|
||||
g_dbus_method_invocation_return_value (invocation,
|
||||
g_variant_new ("(^ao)", connections->pdata));
|
||||
g_ptr_array_unref (connections);
|
||||
}
|
||||
|
||||
NMSettingsConnection *
|
||||
|
|
@ -308,14 +315,22 @@ nm_settings_get_connection_by_uuid (NMSettings *self, const char *uuid)
|
|||
}
|
||||
|
||||
static void
|
||||
impl_settings_get_connection_by_uuid (NMSettings *self,
|
||||
GDBusMethodInvocation *context,
|
||||
const char *uuid)
|
||||
impl_settings_get_connection_by_uuid (NMDBusObject *obj,
|
||||
const NMDBusInterfaceInfoExtended *interface_info,
|
||||
const NMDBusMethodInfoExtended *method_info,
|
||||
GDBusConnection *dbus_connection,
|
||||
const char *sender,
|
||||
GDBusMethodInvocation *invocation,
|
||||
GVariant *parameters)
|
||||
{
|
||||
NMSettings *self = NM_SETTINGS (obj);
|
||||
NMSettingsConnection *connection = NULL;
|
||||
NMAuthSubject *subject = NULL;
|
||||
gs_unref_object NMAuthSubject *subject = NULL;
|
||||
GError *error = NULL;
|
||||
char *error_desc = NULL;
|
||||
const char *uuid;
|
||||
|
||||
g_variant_get (parameters, "(&s)", &uuid);
|
||||
|
||||
connection = nm_settings_get_connection_by_uuid (self, uuid);
|
||||
if (!connection) {
|
||||
|
|
@ -325,7 +340,7 @@ impl_settings_get_connection_by_uuid (NMSettings *self,
|
|||
goto error;
|
||||
}
|
||||
|
||||
subject = nm_auth_subject_new_unix_process_from_context (context);
|
||||
subject = nm_auth_subject_new_unix_process_from_context (invocation);
|
||||
if (!subject) {
|
||||
error = g_error_new_literal (NM_SETTINGS_ERROR,
|
||||
NM_SETTINGS_ERROR_PERMISSION_DENIED,
|
||||
|
|
@ -343,16 +358,13 @@ impl_settings_get_connection_by_uuid (NMSettings *self,
|
|||
goto error;
|
||||
}
|
||||
|
||||
g_clear_object (&subject);
|
||||
g_dbus_method_invocation_return_value (
|
||||
context,
|
||||
g_variant_new ("(o)", nm_connection_get_path (NM_CONNECTION (connection))));
|
||||
g_dbus_method_invocation_return_value (invocation,
|
||||
g_variant_new ("(o)",
|
||||
nm_connection_get_path (NM_CONNECTION (connection))));
|
||||
return;
|
||||
|
||||
error:
|
||||
g_assert (error);
|
||||
g_dbus_method_invocation_take_error (context, error);
|
||||
g_clear_object (&subject);
|
||||
g_dbus_method_invocation_take_error (invocation, error);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -500,7 +512,7 @@ nm_settings_get_unmanaged_specs (NMSettings *self)
|
|||
}
|
||||
|
||||
static NMSettingsPlugin *
|
||||
get_plugin (NMSettings *self, guint32 capability)
|
||||
get_plugin (NMSettings *self, NMSettingsPluginCapabilities capability)
|
||||
{
|
||||
NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self);
|
||||
GSList *iter;
|
||||
|
|
@ -815,6 +827,19 @@ connection_flags_changed (NMSettingsConnection *connection,
|
|||
connection);
|
||||
}
|
||||
|
||||
static void
|
||||
_emit_connection_removed (NMSettings *self,
|
||||
NMSettingsConnection *connection)
|
||||
{
|
||||
nm_dbus_object_emit_signal (NM_DBUS_OBJECT (self),
|
||||
&interface_info_settings,
|
||||
&signal_info_connection_removed,
|
||||
"(o)",
|
||||
nm_connection_get_path (NM_CONNECTION (connection)));
|
||||
|
||||
g_signal_emit (self, signals[CONNECTION_REMOVED], 0, connection);
|
||||
}
|
||||
|
||||
static void
|
||||
connection_removed (NMSettingsConnection *connection, gpointer user_data)
|
||||
{
|
||||
|
|
@ -842,13 +867,12 @@ connection_removed (NMSettingsConnection *connection, gpointer user_data)
|
|||
g_hash_table_remove (priv->connections, (gpointer) cpath);
|
||||
g_clear_pointer (&priv->connections_cached_list, g_free);
|
||||
|
||||
/* Notify D-Bus */
|
||||
g_signal_emit (self, signals[CONNECTION_REMOVED], 0, connection);
|
||||
_emit_connection_removed (self, connection);
|
||||
|
||||
/* Re-emit for listeners like NMPolicy */
|
||||
_notify (self, PROP_CONNECTIONS);
|
||||
if (nm_exported_object_is_exported (NM_EXPORTED_OBJECT (connection)))
|
||||
nm_exported_object_unexport (NM_EXPORTED_OBJECT (connection));
|
||||
if (nm_dbus_object_is_exported (NM_DBUS_OBJECT (connection)))
|
||||
nm_dbus_object_unexport (NM_DBUS_OBJECT (connection));
|
||||
|
||||
check_startup_complete (self);
|
||||
|
||||
|
|
@ -968,7 +992,7 @@ claim_connection (NMSettings *self, NMSettingsConnection *connection)
|
|||
|
||||
/* Export the connection over D-Bus */
|
||||
g_warn_if_fail (nm_connection_get_path (NM_CONNECTION (connection)) == NULL);
|
||||
path = nm_exported_object_export (NM_EXPORTED_OBJECT (connection));
|
||||
path = nm_dbus_object_export (NM_DBUS_OBJECT (connection));
|
||||
nm_connection_set_path (NM_CONNECTION (connection), path);
|
||||
|
||||
g_hash_table_insert (priv->connections,
|
||||
|
|
@ -982,12 +1006,14 @@ claim_connection (NMSettings *self, NMSettingsConnection *connection)
|
|||
* have been initially loaded.
|
||||
*/
|
||||
if (priv->connections_loaded) {
|
||||
/* Internal added signal */
|
||||
nm_dbus_object_emit_signal (NM_DBUS_OBJECT (self),
|
||||
&interface_info_settings,
|
||||
&signal_info_new_connection,
|
||||
"(o)",
|
||||
nm_connection_get_path (NM_CONNECTION (connection)));
|
||||
|
||||
g_signal_emit (self, signals[CONNECTION_ADDED], 0, connection);
|
||||
_notify (self, PROP_CONNECTIONS);
|
||||
|
||||
/* Exported D-Bus signal */
|
||||
g_signal_emit (self, signals[NEW_CONNECTION], 0, connection);
|
||||
}
|
||||
|
||||
nm_settings_connection_added (connection);
|
||||
|
|
@ -1312,12 +1338,12 @@ done:
|
|||
}
|
||||
|
||||
static void
|
||||
impl_settings_add_connection_add_cb (NMSettings *self,
|
||||
NMSettingsConnection *connection,
|
||||
GError *error,
|
||||
GDBusMethodInvocation *context,
|
||||
NMAuthSubject *subject,
|
||||
gpointer user_data)
|
||||
settings_add_connection_add_cb (NMSettings *self,
|
||||
NMSettingsConnection *connection,
|
||||
GError *error,
|
||||
GDBusMethodInvocation *context,
|
||||
NMAuthSubject *subject,
|
||||
gpointer user_data)
|
||||
{
|
||||
if (error) {
|
||||
g_dbus_method_invocation_return_gerror (context, error);
|
||||
|
|
@ -1332,10 +1358,10 @@ impl_settings_add_connection_add_cb (NMSettings *self,
|
|||
}
|
||||
|
||||
static void
|
||||
impl_settings_add_connection_helper (NMSettings *self,
|
||||
GDBusMethodInvocation *context,
|
||||
GVariant *settings,
|
||||
gboolean save_to_disk)
|
||||
settings_add_connection_helper (NMSettings *self,
|
||||
GDBusMethodInvocation *context,
|
||||
GVariant *settings,
|
||||
gboolean save_to_disk)
|
||||
{
|
||||
gs_unref_object NMConnection *connection = NULL;
|
||||
GError *error = NULL;
|
||||
|
|
@ -1355,77 +1381,111 @@ impl_settings_add_connection_helper (NMSettings *self,
|
|||
connection,
|
||||
save_to_disk,
|
||||
context,
|
||||
impl_settings_add_connection_add_cb,
|
||||
settings_add_connection_add_cb,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_settings_add_connection (NMSettings *self,
|
||||
GDBusMethodInvocation *context,
|
||||
GVariant *settings)
|
||||
impl_settings_add_connection (NMDBusObject *obj,
|
||||
const NMDBusInterfaceInfoExtended *interface_info,
|
||||
const NMDBusMethodInfoExtended *method_info,
|
||||
GDBusConnection *connection,
|
||||
const char *sender,
|
||||
GDBusMethodInvocation *invocation,
|
||||
GVariant *parameters)
|
||||
{
|
||||
impl_settings_add_connection_helper (self, context, settings, TRUE);
|
||||
NMSettings *self = NM_SETTINGS (obj);
|
||||
gs_unref_variant GVariant *settings = NULL;
|
||||
|
||||
g_variant_get (parameters, "(@a{sa{sv}})", &settings);
|
||||
settings_add_connection_helper (self, invocation, settings, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_settings_add_connection_unsaved (NMSettings *self,
|
||||
GDBusMethodInvocation *context,
|
||||
GVariant *settings)
|
||||
impl_settings_add_connection_unsaved (NMDBusObject *obj,
|
||||
const NMDBusInterfaceInfoExtended *interface_info,
|
||||
const NMDBusMethodInfoExtended *method_info,
|
||||
GDBusConnection *connection,
|
||||
const char *sender,
|
||||
GDBusMethodInvocation *invocation,
|
||||
GVariant *parameters)
|
||||
{
|
||||
impl_settings_add_connection_helper (self, context, settings, FALSE);
|
||||
NMSettings *self = NM_SETTINGS (obj);
|
||||
gs_unref_variant GVariant *settings = NULL;
|
||||
|
||||
g_variant_get (parameters, "(@a{sa{sv}})", &settings);
|
||||
settings_add_connection_helper (self, invocation, settings, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
impl_settings_load_connections (NMSettings *self,
|
||||
GDBusMethodInvocation *context,
|
||||
char **filenames)
|
||||
impl_settings_load_connections (NMDBusObject *obj,
|
||||
const NMDBusInterfaceInfoExtended *interface_info,
|
||||
const NMDBusMethodInfoExtended *method_info,
|
||||
GDBusConnection *connection,
|
||||
const char *sender,
|
||||
GDBusMethodInvocation *invocation,
|
||||
GVariant *parameters)
|
||||
{
|
||||
NMSettings *self = NM_SETTINGS (obj);
|
||||
NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self);
|
||||
GPtrArray *failures;
|
||||
gs_unref_ptrarray GPtrArray *failures = NULL;
|
||||
GSList *iter;
|
||||
int i;
|
||||
guint i;
|
||||
gs_free const char **filenames = NULL;
|
||||
|
||||
g_variant_get (parameters, "(^a&s)", &filenames);
|
||||
|
||||
/* The permission is already enforced by the D-Bus daemon, but we ensure
|
||||
* that the caller is still alive so that clients are forced to wait and
|
||||
* we'll be able to switch to polkit without breaking behavior.
|
||||
*/
|
||||
if (!nm_bus_manager_ensure_uid (nm_bus_manager_get (),
|
||||
context,
|
||||
G_MAXULONG,
|
||||
NM_SETTINGS_ERROR,
|
||||
NM_SETTINGS_ERROR_PERMISSION_DENIED))
|
||||
if (!nm_dbus_manager_ensure_uid (nm_dbus_object_get_manager (obj),
|
||||
invocation,
|
||||
G_MAXULONG,
|
||||
NM_SETTINGS_ERROR,
|
||||
NM_SETTINGS_ERROR_PERMISSION_DENIED))
|
||||
return;
|
||||
|
||||
failures = g_ptr_array_new ();
|
||||
if (filenames) {
|
||||
for (i = 0; filenames[i]; i++) {
|
||||
for (iter = priv->plugins; iter; iter = g_slist_next (iter)) {
|
||||
NMSettingsPlugin *plugin = NM_SETTINGS_PLUGIN (iter->data);
|
||||
|
||||
for (i = 0; filenames[i]; i++) {
|
||||
for (iter = priv->plugins; iter; iter = g_slist_next (iter)) {
|
||||
NMSettingsPlugin *plugin = NM_SETTINGS_PLUGIN (iter->data);
|
||||
if (nm_settings_plugin_load_connection (plugin, filenames[i]))
|
||||
break;
|
||||
}
|
||||
|
||||
if (nm_settings_plugin_load_connection (plugin, filenames[i]))
|
||||
break;
|
||||
}
|
||||
|
||||
if (!iter) {
|
||||
if (!g_path_is_absolute (filenames[i]))
|
||||
_LOGW ("connection filename '%s' is not an absolute path", filenames[i]);
|
||||
g_ptr_array_add (failures, (char *) filenames[i]);
|
||||
if (!iter) {
|
||||
if (!g_path_is_absolute (filenames[i]))
|
||||
_LOGW ("connection filename '%s' is not an absolute path", filenames[i]);
|
||||
if (!failures)
|
||||
failures = g_ptr_array_new ();
|
||||
g_ptr_array_add (failures, (char *) filenames[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
g_ptr_array_add (failures, NULL);
|
||||
g_dbus_method_invocation_return_value (
|
||||
context,
|
||||
g_variant_new ("(b^as)",
|
||||
failures->len == 1,
|
||||
failures->pdata));
|
||||
g_ptr_array_unref (failures);
|
||||
if (failures)
|
||||
g_ptr_array_add (failures, NULL);
|
||||
|
||||
g_dbus_method_invocation_return_value (invocation,
|
||||
g_variant_new ("(b^as)",
|
||||
(gboolean) (!!failures),
|
||||
failures
|
||||
? (const char **) failures->pdata
|
||||
: NM_PTRARRAY_EMPTY (const char *)));
|
||||
}
|
||||
|
||||
static void
|
||||
impl_settings_reload_connections (NMSettings *self,
|
||||
GDBusMethodInvocation *context)
|
||||
impl_settings_reload_connections (NMDBusObject *obj,
|
||||
const NMDBusInterfaceInfoExtended *interface_info,
|
||||
const NMDBusMethodInfoExtended *method_info,
|
||||
GDBusConnection *connection,
|
||||
const char *sender,
|
||||
GDBusMethodInvocation *invocation,
|
||||
GVariant *parameters)
|
||||
{
|
||||
NMSettings *self = NM_SETTINGS (obj);
|
||||
NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self);
|
||||
GSList *iter;
|
||||
|
||||
|
|
@ -1433,11 +1493,11 @@ impl_settings_reload_connections (NMSettings *self,
|
|||
* that the caller is still alive so that clients are forced to wait and
|
||||
* we'll be able to switch to polkit without breaking behavior.
|
||||
*/
|
||||
if (!nm_bus_manager_ensure_uid (nm_bus_manager_get (),
|
||||
context,
|
||||
G_MAXULONG,
|
||||
NM_SETTINGS_ERROR,
|
||||
NM_SETTINGS_ERROR_PERMISSION_DENIED))
|
||||
if (!nm_dbus_manager_ensure_uid (nm_dbus_object_get_manager (obj),
|
||||
invocation,
|
||||
G_MAXULONG,
|
||||
NM_SETTINGS_ERROR,
|
||||
NM_SETTINGS_ERROR_PERMISSION_DENIED))
|
||||
return;
|
||||
|
||||
for (iter = priv->plugins; iter; iter = g_slist_next (iter)) {
|
||||
|
|
@ -1446,7 +1506,7 @@ impl_settings_reload_connections (NMSettings *self,
|
|||
nm_settings_plugin_reload_connections (plugin);
|
||||
}
|
||||
|
||||
g_dbus_method_invocation_return_value (context, g_variant_new ("(b)", TRUE));
|
||||
g_dbus_method_invocation_return_value (invocation, g_variant_new ("(b)", TRUE));
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
@ -1498,37 +1558,42 @@ pk_hostname_cb (NMAuthChain *chain,
|
|||
}
|
||||
|
||||
static void
|
||||
impl_settings_save_hostname (NMSettings *self,
|
||||
GDBusMethodInvocation *context,
|
||||
const char *hostname)
|
||||
impl_settings_save_hostname (NMDBusObject *obj,
|
||||
const NMDBusInterfaceInfoExtended *interface_info,
|
||||
const NMDBusMethodInfoExtended *method_info,
|
||||
GDBusConnection *connection,
|
||||
const char *sender,
|
||||
GDBusMethodInvocation *invocation,
|
||||
GVariant *parameters)
|
||||
{
|
||||
NMSettings *self = NM_SETTINGS (obj);
|
||||
NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self);
|
||||
NMAuthChain *chain;
|
||||
GError *error = NULL;
|
||||
const char *hostname;
|
||||
|
||||
g_variant_get (parameters, "(&s)", &hostname);
|
||||
|
||||
/* Minimal validation of the hostname */
|
||||
if (!nm_hostname_manager_validate_hostname (hostname)) {
|
||||
error = g_error_new_literal (NM_SETTINGS_ERROR,
|
||||
NM_SETTINGS_ERROR_INVALID_HOSTNAME,
|
||||
"The hostname was too long or contained invalid characters.");
|
||||
goto done;
|
||||
g_dbus_method_invocation_return_error_literal (invocation,
|
||||
NM_SETTINGS_ERROR,
|
||||
NM_SETTINGS_ERROR_INVALID_HOSTNAME,
|
||||
"The hostname was too long or contained invalid characters.");
|
||||
return;
|
||||
}
|
||||
|
||||
chain = nm_auth_chain_new_context (context, pk_hostname_cb, self);
|
||||
chain = nm_auth_chain_new_context (invocation, pk_hostname_cb, self);
|
||||
if (!chain) {
|
||||
error = g_error_new_literal (NM_SETTINGS_ERROR,
|
||||
NM_SETTINGS_ERROR_PERMISSION_DENIED,
|
||||
"Unable to authenticate the request.");
|
||||
goto done;
|
||||
g_dbus_method_invocation_return_error_literal (invocation,
|
||||
NM_SETTINGS_ERROR,
|
||||
NM_SETTINGS_ERROR_PERMISSION_DENIED,
|
||||
"Unable to authenticate the request.");
|
||||
return;
|
||||
}
|
||||
|
||||
priv->auths = g_slist_append (priv->auths, chain);
|
||||
nm_auth_chain_add_call (chain, NM_AUTH_PERMISSION_SETTINGS_MODIFY_HOSTNAME, TRUE);
|
||||
nm_auth_chain_set_data (chain, "hostname", g_strdup (hostname), g_free);
|
||||
|
||||
done:
|
||||
if (error)
|
||||
g_dbus_method_invocation_take_error (context, error);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
@ -1900,13 +1965,123 @@ finalize (GObject *object)
|
|||
G_OBJECT_CLASS (nm_settings_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static const GDBusSignalInfo signal_info_new_connection = NM_DEFINE_GDBUS_SIGNAL_INFO_INIT (
|
||||
"NewConnection",
|
||||
.args = NM_DEFINE_GDBUS_ARG_INFOS (
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("connection", "o"),
|
||||
),
|
||||
);
|
||||
|
||||
static const GDBusSignalInfo signal_info_connection_removed = NM_DEFINE_GDBUS_SIGNAL_INFO_INIT (
|
||||
"ConnectionRemoved",
|
||||
.args = NM_DEFINE_GDBUS_ARG_INFOS (
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("connection", "o"),
|
||||
),
|
||||
);
|
||||
|
||||
static const NMDBusInterfaceInfoExtended interface_info_settings = {
|
||||
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
|
||||
NM_DBUS_INTERFACE_SETTINGS,
|
||||
.methods = NM_DEFINE_GDBUS_METHOD_INFOS (
|
||||
NM_DEFINE_DBUS_METHOD_INFO_EXTENDED (
|
||||
NM_DEFINE_GDBUS_METHOD_INFO_INIT (
|
||||
"ListConnections",
|
||||
.out_args = NM_DEFINE_GDBUS_ARG_INFOS (
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("connections", "ao"),
|
||||
),
|
||||
),
|
||||
.handle = impl_settings_list_connections,
|
||||
),
|
||||
NM_DEFINE_DBUS_METHOD_INFO_EXTENDED (
|
||||
NM_DEFINE_GDBUS_METHOD_INFO_INIT (
|
||||
"GetConnectionByUuid",
|
||||
.in_args = NM_DEFINE_GDBUS_ARG_INFOS (
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("uuid", "s"),
|
||||
),
|
||||
.out_args = NM_DEFINE_GDBUS_ARG_INFOS (
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("connection", "o"),
|
||||
),
|
||||
),
|
||||
.handle = impl_settings_get_connection_by_uuid,
|
||||
),
|
||||
NM_DEFINE_DBUS_METHOD_INFO_EXTENDED (
|
||||
NM_DEFINE_GDBUS_METHOD_INFO_INIT (
|
||||
"AddConnection",
|
||||
.in_args = NM_DEFINE_GDBUS_ARG_INFOS (
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("connection", "a{sa{sv}}"),
|
||||
),
|
||||
.out_args = NM_DEFINE_GDBUS_ARG_INFOS (
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("path", "o"),
|
||||
),
|
||||
),
|
||||
.handle = impl_settings_add_connection,
|
||||
),
|
||||
NM_DEFINE_DBUS_METHOD_INFO_EXTENDED (
|
||||
NM_DEFINE_GDBUS_METHOD_INFO_INIT (
|
||||
"AddConnectionUnsaved",
|
||||
.in_args = NM_DEFINE_GDBUS_ARG_INFOS (
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("connection", "a{sa{sv}}"),
|
||||
),
|
||||
.out_args = NM_DEFINE_GDBUS_ARG_INFOS (
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("path", "o"),
|
||||
),
|
||||
),
|
||||
.handle = impl_settings_add_connection_unsaved,
|
||||
),
|
||||
NM_DEFINE_DBUS_METHOD_INFO_EXTENDED (
|
||||
NM_DEFINE_GDBUS_METHOD_INFO_INIT (
|
||||
"LoadConnections",
|
||||
.in_args = NM_DEFINE_GDBUS_ARG_INFOS (
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("filenames", "as"),
|
||||
),
|
||||
.out_args = NM_DEFINE_GDBUS_ARG_INFOS (
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("status", "b"),
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("failures", "as"),
|
||||
),
|
||||
),
|
||||
.handle = impl_settings_load_connections,
|
||||
),
|
||||
NM_DEFINE_DBUS_METHOD_INFO_EXTENDED (
|
||||
NM_DEFINE_GDBUS_METHOD_INFO_INIT (
|
||||
"ReloadConnections",
|
||||
.out_args = NM_DEFINE_GDBUS_ARG_INFOS (
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("status", "b"),
|
||||
),
|
||||
),
|
||||
.handle = impl_settings_reload_connections,
|
||||
),
|
||||
NM_DEFINE_DBUS_METHOD_INFO_EXTENDED (
|
||||
NM_DEFINE_GDBUS_METHOD_INFO_INIT (
|
||||
"SaveHostname",
|
||||
.in_args = NM_DEFINE_GDBUS_ARG_INFOS (
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("hostname", "s"),
|
||||
),
|
||||
),
|
||||
.handle = impl_settings_save_hostname,
|
||||
),
|
||||
),
|
||||
.signals = NM_DEFINE_GDBUS_SIGNAL_INFOS (
|
||||
&nm_signal_info_property_changed_legacy,
|
||||
&signal_info_new_connection,
|
||||
&signal_info_connection_removed,
|
||||
),
|
||||
.properties = NM_DEFINE_GDBUS_PROPERTY_INFOS (
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Connections", "ao", NM_SETTINGS_CONNECTIONS),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Hostname", "s", NM_SETTINGS_HOSTNAME),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("CanModify", "b", NM_SETTINGS_CAN_MODIFY),
|
||||
),
|
||||
),
|
||||
.legacy_property_changed = TRUE,
|
||||
};
|
||||
|
||||
static void
|
||||
nm_settings_class_init (NMSettingsClass *class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
NMExportedObjectClass *exported_object_class = NM_EXPORTED_OBJECT_CLASS (class);
|
||||
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (class);
|
||||
|
||||
exported_object_class->export_path = NM_DBUS_PATH_SETTINGS;
|
||||
dbus_object_class->export_path = NM_DBUS_PATH_SETTINGS;
|
||||
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_settings);
|
||||
|
||||
object_class->get_property = get_property;
|
||||
object_class->dispose = dispose;
|
||||
|
|
@ -1975,23 +2150,4 @@ nm_settings_class_init (NMSettingsClass *class)
|
|||
0, NULL, NULL,
|
||||
g_cclosure_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE, 1, NM_TYPE_SETTINGS_CONNECTION);
|
||||
|
||||
signals[NEW_CONNECTION] =
|
||||
g_signal_new ("new-connection",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_FIRST, 0, NULL, NULL,
|
||||
g_cclosure_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE, 1, NM_TYPE_SETTINGS_CONNECTION);
|
||||
|
||||
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (class),
|
||||
NMDBUS_TYPE_SETTINGS_SKELETON,
|
||||
"ListConnections", impl_settings_list_connections,
|
||||
"GetConnectionByUuid", impl_settings_get_connection_by_uuid,
|
||||
"AddConnection", impl_settings_add_connection,
|
||||
"AddConnectionUnsaved", impl_settings_add_connection_unsaved,
|
||||
"LoadConnections", impl_settings_load_connections,
|
||||
"ReloadConnections", impl_settings_reload_connections,
|
||||
"SaveHostname", impl_settings_save_hostname,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,8 +28,6 @@
|
|||
|
||||
#include "nm-connection.h"
|
||||
|
||||
#include "nm-exported-object.h"
|
||||
|
||||
#define NM_TYPE_SETTINGS (nm_settings_get_type ())
|
||||
#define NM_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SETTINGS, NMSettings))
|
||||
#define NM_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SETTINGS, NMSettingsClass))
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ libnm_settings_plugin_ifcfg_rh = shared_module(
|
|||
sources: sources,
|
||||
dependencies: deps,
|
||||
c_args: cflags,
|
||||
link_with: [libnmdbus_ifcfg_rh, libnms_ifcfg_rh_core],
|
||||
link_with: [libnms_ifcfg_rh_core],
|
||||
link_args: ldflags_linker_script_settings,
|
||||
link_depends: linker_script_settings,
|
||||
install: true,
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@
|
|||
#include "settings/nm-settings-plugin.h"
|
||||
#include "nm-config.h"
|
||||
#include "NetworkManagerUtils.h"
|
||||
#include "nm-exported-object.h"
|
||||
|
||||
#include "nms-ifcfg-rh-connection.h"
|
||||
#include "nms-ifcfg-rh-common.h"
|
||||
|
|
@ -807,41 +806,31 @@ _method_call (GDBusConnection *connection,
|
|||
SettingsPluginIfcfg *self = SETTINGS_PLUGIN_IFCFG (user_data);
|
||||
const char *ifcfg;
|
||||
|
||||
if (nm_streq0 (interface_name, IFCFGRH1_IFACE1_NAME)) {
|
||||
if (nm_streq0 (method_name, IFCFGRH1_IFACE1_METHOD_GET_IFCFG_DETAILS)) {
|
||||
if (!g_variant_is_of_type (parameters, G_VARIANT_TYPE ("(s)")))
|
||||
g_return_if_reached ();
|
||||
|
||||
g_variant_get (parameters, "(&s)", &ifcfg);
|
||||
impl_ifcfgrh_get_ifcfg_details (self, invocation, ifcfg);
|
||||
return;
|
||||
}
|
||||
if ( !nm_streq (interface_name, IFCFGRH1_IFACE1_NAME)
|
||||
|| !nm_streq (method_name, IFCFGRH1_IFACE1_METHOD_GET_IFCFG_DETAILS)) {
|
||||
g_dbus_method_invocation_return_error (invocation,
|
||||
G_DBUS_ERROR,
|
||||
G_DBUS_ERROR_UNKNOWN_METHOD,
|
||||
"Unknown method %s",
|
||||
method_name);
|
||||
return;
|
||||
}
|
||||
|
||||
g_return_if_reached ();
|
||||
g_variant_get (parameters, "(&s)", &ifcfg);
|
||||
impl_ifcfgrh_get_ifcfg_details (self, invocation, ifcfg);
|
||||
}
|
||||
|
||||
NM_DEFINE_GDBUS_INTERFACE_INFO (
|
||||
interface_info,
|
||||
static GDBusInterfaceInfo *const interface_info = NM_DEFINE_GDBUS_INTERFACE_INFO (
|
||||
IFCFGRH1_BUS_NAME,
|
||||
.methods = NM_DEFINE_GDBUS_METHOD_INFOS (
|
||||
NM_DEFINE_GDBUS_METHOD_INFO (
|
||||
IFCFGRH1_IFACE1_METHOD_GET_IFCFG_DETAILS,
|
||||
.in_args = NM_DEFINE_GDBUS_ARG_INFOS (
|
||||
NM_DEFINE_GDBUS_ARG_INFO (
|
||||
"ifcfg",
|
||||
.signature = "s",
|
||||
),
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("ifcfg", "s"),
|
||||
),
|
||||
.out_args = NM_DEFINE_GDBUS_ARG_INFOS (
|
||||
NM_DEFINE_GDBUS_ARG_INFO (
|
||||
"uuid",
|
||||
.signature = "s",
|
||||
),
|
||||
NM_DEFINE_GDBUS_ARG_INFO (
|
||||
"path",
|
||||
.signature = "o",
|
||||
),
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("uuid", "s"),
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("path", "o"),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
#include "nm-config.h"
|
||||
#include "nm-test-device.h"
|
||||
#include "platform/nm-fake-platform.h"
|
||||
#include "nm-bus-manager.h"
|
||||
#include "nm-dbus-manager.h"
|
||||
#include "nm-connectivity.h"
|
||||
|
||||
#include "nm-test-utils-core.h"
|
||||
|
|
@ -1037,13 +1037,6 @@ main (int argc, char **argv)
|
|||
{
|
||||
nmtst_init_assert_logging (&argc, &argv, "INFO", "DEFAULT");
|
||||
|
||||
/* Initialize the DBus manager singleton explicitly, because it is accessed by
|
||||
* the class initializer of NMDevice (used by the NMTestDevice stub).
|
||||
* This way, we skip calling nm_bus_manager_init_bus() which would
|
||||
* either fail and/or cause unexpected actions in the test.
|
||||
* */
|
||||
nm_bus_manager_setup (g_object_new (NM_TYPE_BUS_MANAGER, NULL));
|
||||
|
||||
nm_fake_platform_setup ();
|
||||
|
||||
g_test_add_func ("/config/simple", test_config_simple);
|
||||
|
|
|
|||
|
|
@ -51,8 +51,6 @@
|
|||
#include "nm-vpn-manager.h"
|
||||
#include "dns/nm-dns-manager.h"
|
||||
|
||||
#include "introspection/org.freedesktop.NetworkManager.VPN.Connection.h"
|
||||
|
||||
typedef enum {
|
||||
/* Only system secrets */
|
||||
SECRETS_REQ_SYSTEM = 0,
|
||||
|
|
@ -82,7 +80,6 @@ typedef enum {
|
|||
} VpnState;
|
||||
|
||||
enum {
|
||||
VPN_STATE_CHANGED,
|
||||
INTERNAL_STATE_CHANGED,
|
||||
INTERNAL_RETRY_AFTER_FAILURE,
|
||||
|
||||
|
|
@ -159,19 +156,6 @@ struct _NMVpnConnection {
|
|||
|
||||
struct _NMVpnConnectionClass {
|
||||
NMActiveConnectionClass parent;
|
||||
|
||||
/* Signals */
|
||||
void (*vpn_state_changed) (NMVpnConnection *self,
|
||||
NMVpnConnectionState new_state,
|
||||
NMActiveConnectionStateReason reason);
|
||||
|
||||
/* not exported over D-Bus */
|
||||
void (*internal_state_changed) (NMVpnConnection *self,
|
||||
NMVpnConnectionState new_state,
|
||||
NMVpnConnectionState old_state,
|
||||
NMActiveConnectionStateReason reason);
|
||||
|
||||
void (*internal_failed_retry) (NMVpnConnection *self);
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (NMVpnConnection, nm_vpn_connection, NM_TYPE_ACTIVE_CONNECTION)
|
||||
|
|
@ -180,6 +164,9 @@ G_DEFINE_TYPE (NMVpnConnection, nm_vpn_connection, NM_TYPE_ACTIVE_CONNECTION)
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
static const NMDBusInterfaceInfoExtended interface_info_vpn_connection;
|
||||
static const GDBusSignalInfo signal_info_vpn_state_changed;
|
||||
|
||||
static NMSettingsConnection *_get_settings_connection (NMVpnConnection *self,
|
||||
gboolean allow_missing);
|
||||
|
||||
|
|
@ -511,7 +498,12 @@ _set_vpn_state (NMVpnConnection *self,
|
|||
old_external_state = _state_to_nm_vpn_state (old_vpn_state);
|
||||
new_external_state = _state_to_nm_vpn_state (priv->vpn_state);
|
||||
if (new_external_state != old_external_state) {
|
||||
g_signal_emit (self, signals[VPN_STATE_CHANGED], 0, new_external_state, reason);
|
||||
nm_dbus_object_emit_signal (NM_DBUS_OBJECT (self),
|
||||
&interface_info_vpn_connection,
|
||||
&signal_info_vpn_state_changed,
|
||||
"(uu)",
|
||||
(guint32) new_external_state,
|
||||
(guint32) reason);
|
||||
g_signal_emit (self, signals[INTERNAL_STATE_CHANGED], 0,
|
||||
new_external_state,
|
||||
old_external_state,
|
||||
|
|
@ -1176,8 +1168,8 @@ _cleanup_failed_config (NMVpnConnection *self)
|
|||
{
|
||||
NMVpnConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (self);
|
||||
|
||||
nm_exported_object_clear_and_unexport (&priv->ip4_config);
|
||||
nm_exported_object_clear_and_unexport (&priv->ip6_config);
|
||||
nm_dbus_object_clear_and_unexport (&priv->ip4_config);
|
||||
nm_dbus_object_clear_and_unexport (&priv->ip6_config);
|
||||
|
||||
_LOGW ("VPN connection: did not receive valid IP config information");
|
||||
_set_vpn_state (self, STATE_FAILED, NM_ACTIVE_CONNECTION_STATE_REASON_IP_CONFIG_INVALID, FALSE);
|
||||
|
|
@ -1394,12 +1386,12 @@ nm_vpn_connection_config_get (NMVpnConnection *self, GVariant *dict)
|
|||
priv->has_ip4 = FALSE;
|
||||
if (g_variant_lookup (dict, NM_VPN_PLUGIN_CONFIG_HAS_IP4, "b", &b))
|
||||
priv->has_ip4 = b;
|
||||
nm_exported_object_clear_and_unexport (&priv->ip4_config);
|
||||
nm_dbus_object_clear_and_unexport (&priv->ip4_config);
|
||||
|
||||
priv->has_ip6 = FALSE;
|
||||
if (g_variant_lookup (dict, NM_VPN_PLUGIN_CONFIG_HAS_IP6, "b", &b))
|
||||
priv->has_ip6 = b;
|
||||
nm_exported_object_clear_and_unexport (&priv->ip6_config);
|
||||
nm_dbus_object_clear_and_unexport (&priv->ip6_config);
|
||||
|
||||
nm_vpn_connection_config_maybe_complete (self, TRUE);
|
||||
}
|
||||
|
|
@ -1653,7 +1645,7 @@ nm_vpn_connection_ip4_config_get (NMVpnConnection *self, GVariant *dict)
|
|||
g_object_unref (config);
|
||||
} else {
|
||||
priv->ip4_config = config;
|
||||
nm_exported_object_export (NM_EXPORTED_OBJECT (config));
|
||||
nm_dbus_object_export (NM_DBUS_OBJECT (config));
|
||||
g_object_notify ((GObject *) self, NM_ACTIVE_CONNECTION_IP4_CONFIG);
|
||||
}
|
||||
|
||||
|
|
@ -1842,7 +1834,7 @@ next:
|
|||
g_object_unref (config);
|
||||
} else {
|
||||
priv->ip6_config = config;
|
||||
nm_exported_object_export (NM_EXPORTED_OBJECT (config));
|
||||
nm_dbus_object_export (NM_DBUS_OBJECT (config));
|
||||
g_object_notify ((GObject *) self, NM_ACTIVE_CONNECTION_IP6_CONFIG);
|
||||
}
|
||||
|
||||
|
|
@ -2329,7 +2321,7 @@ nm_vpn_connection_activate (NMVpnConnection *self,
|
|||
if (nm_vpn_plugin_info_supports_multiple (plugin_info)) {
|
||||
const char *path;
|
||||
|
||||
path = nm_exported_object_get_path (NM_EXPORTED_OBJECT (self));
|
||||
path = nm_dbus_object_get_path (NM_DBUS_OBJECT (self));
|
||||
if (path)
|
||||
path = strrchr (path, '/');
|
||||
g_return_if_fail (path);
|
||||
|
|
@ -2779,8 +2771,8 @@ dispose (GObject *object)
|
|||
nm_clear_g_cancellable (&priv->cancellable);
|
||||
|
||||
g_clear_object (&priv->proxy_config);
|
||||
nm_exported_object_clear_and_unexport (&priv->ip4_config);
|
||||
nm_exported_object_clear_and_unexport (&priv->ip6_config);
|
||||
nm_dbus_object_clear_and_unexport (&priv->ip4_config);
|
||||
nm_dbus_object_clear_and_unexport (&priv->ip6_config);
|
||||
g_clear_object (&priv->proxy);
|
||||
g_clear_object (&priv->plugin_info);
|
||||
|
||||
|
|
@ -2830,14 +2822,14 @@ get_property (GObject *object, guint prop_id,
|
|||
g_value_set_string (value, priv->banner ? priv->banner : "");
|
||||
break;
|
||||
case PROP_IP4_CONFIG:
|
||||
nm_utils_g_value_set_object_path (value, ip_config_valid (priv->vpn_state) ? priv->ip4_config : NULL);
|
||||
nm_dbus_utils_g_value_set_object_path (value, ip_config_valid (priv->vpn_state) ? priv->ip4_config : NULL);
|
||||
break;
|
||||
case PROP_IP6_CONFIG:
|
||||
nm_utils_g_value_set_object_path (value, ip_config_valid (priv->vpn_state) ? priv->ip6_config : NULL);
|
||||
nm_dbus_utils_g_value_set_object_path (value, ip_config_valid (priv->vpn_state) ? priv->ip6_config : NULL);
|
||||
break;
|
||||
case PROP_MASTER:
|
||||
parent_dev = nm_active_connection_get_device (NM_ACTIVE_CONNECTION (object));
|
||||
nm_utils_g_value_set_object_path (value, parent_dev);
|
||||
nm_dbus_utils_g_value_set_object_path (value, parent_dev);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
|
|
@ -2845,16 +2837,42 @@ get_property (GObject *object, guint prop_id,
|
|||
}
|
||||
}
|
||||
|
||||
static const GDBusSignalInfo signal_info_vpn_state_changed = NM_DEFINE_GDBUS_SIGNAL_INFO_INIT (
|
||||
"VpnStateChanged",
|
||||
.args = NM_DEFINE_GDBUS_ARG_INFOS (
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("state", "u"),
|
||||
NM_DEFINE_GDBUS_ARG_INFO ("reason", "u"),
|
||||
),
|
||||
);
|
||||
|
||||
static const NMDBusInterfaceInfoExtended interface_info_vpn_connection = {
|
||||
.parent = NM_DEFINE_GDBUS_INTERFACE_INFO_INIT (
|
||||
NM_DBUS_INTERFACE_VPN_CONNECTION,
|
||||
.signals = NM_DEFINE_GDBUS_SIGNAL_INFOS (
|
||||
&nm_signal_info_property_changed_legacy,
|
||||
&signal_info_vpn_state_changed,
|
||||
),
|
||||
.properties = NM_DEFINE_GDBUS_PROPERTY_INFOS (
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("VpnState", "u", NM_VPN_CONNECTION_VPN_STATE),
|
||||
NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE_L ("Banner", "s", NM_VPN_CONNECTION_BANNER),
|
||||
),
|
||||
),
|
||||
.legacy_property_changed = TRUE,
|
||||
};
|
||||
|
||||
static void
|
||||
nm_vpn_connection_class_init (NMVpnConnectionClass *connection_class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (connection_class);
|
||||
NMActiveConnectionClass *active_class = NM_ACTIVE_CONNECTION_CLASS (connection_class);
|
||||
NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (connection_class);
|
||||
|
||||
dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_vpn_connection);
|
||||
|
||||
/* virtual methods */
|
||||
object_class->get_property = get_property;
|
||||
object_class->dispose = dispose;
|
||||
object_class->finalize = finalize;
|
||||
|
||||
active_class->device_state_changed = device_state_changed;
|
||||
active_class->device_changed = device_changed;
|
||||
|
||||
|
|
@ -2881,13 +2899,6 @@ nm_vpn_connection_class_init (NMVpnConnectionClass *connection_class)
|
|||
g_object_class_override_property (object_class, PROP_IP6_CONFIG,
|
||||
NM_ACTIVE_CONNECTION_IP6_CONFIG);
|
||||
|
||||
signals[VPN_STATE_CHANGED] =
|
||||
g_signal_new ("vpn-state-changed",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
0, NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_UINT);
|
||||
|
||||
signals[INTERNAL_STATE_CHANGED] =
|
||||
g_signal_new (NM_VPN_CONNECTION_INTERNAL_STATE_CHANGED,
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
|
|
@ -2901,8 +2912,4 @@ nm_vpn_connection_class_init (NMVpnConnectionClass *connection_class)
|
|||
G_SIGNAL_RUN_FIRST,
|
||||
0, NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (connection_class),
|
||||
NMDBUS_TYPE_VPN_CONNECTION_SKELETON,
|
||||
NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@
|
|||
#define NM_VPN_CONNECTION_BANNER "banner"
|
||||
|
||||
/* Signals */
|
||||
/* not exported: includes old reason code */
|
||||
#define NM_VPN_CONNECTION_INTERNAL_STATE_CHANGED "internal-state-changed"
|
||||
#define NM_VPN_CONNECTION_INTERNAL_RETRY_AFTER_FAILURE "internal-retry-after-failure"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue