mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-09 05:58:01 +02:00
core: Add an AddAndActivateConnection2 routine with options parameter
This adds a new routine to be able to handle an arbitrary set of further options for AddAndActivateConnection. Note that no options are accepted for now.
This commit is contained in:
parent
37e8c53eee
commit
43c19d755a
2 changed files with 68 additions and 1 deletions
|
|
@ -100,6 +100,8 @@
|
||||||
(automatically filling in missing settings with the capabilities of the
|
(automatically filling in missing settings with the capabilities of the
|
||||||
given device and specific object), then activate the new connection.
|
given device and specific object), then activate the new connection.
|
||||||
Cannot be used for VPN connections at this time.
|
Cannot be used for VPN connections at this time.
|
||||||
|
|
||||||
|
See also AddAndActivateConnection2.
|
||||||
-->
|
-->
|
||||||
<method name="AddAndActivateConnection">
|
<method name="AddAndActivateConnection">
|
||||||
<arg name="connection" type="a{sa{sv}}" direction="in"/>
|
<arg name="connection" type="a{sa{sv}}" direction="in"/>
|
||||||
|
|
@ -109,6 +111,32 @@
|
||||||
<arg name="active_connection" type="o" direction="out"/>
|
<arg name="active_connection" type="o" direction="out"/>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
AddAndActivateConnection2:
|
||||||
|
@connection: Connection settings and properties; if incomplete missing settings will be automatically completed using the given device and specific object.
|
||||||
|
@device: The object path of device to be activated using the given connection.
|
||||||
|
@specific_object: The path of a connection-type-specific object this activation should use. This parameter is currently ignored for wired and mobile broadband connections, and the value of "/" should be used (ie, no specific object). For WiFi connections, pass the object path of a specific AP from the card's scan list, which will be used to complete the details of the newly added connection.
|
||||||
|
@options: Further options for the method call.
|
||||||
|
@path: Object path of the new connection that was just added.
|
||||||
|
@active_connection: The path of the active connection object representing this active connection.
|
||||||
|
|
||||||
|
Adds a new connection using the given details (if any) as a template
|
||||||
|
(automatically filling in missing settings with the capabilities of the
|
||||||
|
given device and specific object), then activate the new connection.
|
||||||
|
Cannot be used for VPN connections at this time.
|
||||||
|
|
||||||
|
This method extends AddAndActivateConnection to allow passing further
|
||||||
|
parameters. At this time no further options are supported.
|
||||||
|
-->
|
||||||
|
<method name="AddAndActivateConnection2">
|
||||||
|
<arg name="connection" type="a{sa{sv}}" direction="in"/>
|
||||||
|
<arg name="device" type="o" direction="in"/>
|
||||||
|
<arg name="specific_object" type="o" direction="in"/>
|
||||||
|
<arg name="options" type="a{sv}" direction="in"/>
|
||||||
|
<arg name="path" type="o" direction="out"/>
|
||||||
|
<arg name="active_connection" type="o" direction="out"/>
|
||||||
|
</method>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
DeactivateConnection:
|
DeactivateConnection:
|
||||||
@active_connection: The currently active connection to deactivate.
|
@active_connection: The currently active connection to deactivate.
|
||||||
|
|
|
||||||
|
|
@ -5220,11 +5220,34 @@ impl_manager_add_and_activate_connection (NMDBusObject *obj,
|
||||||
NMDevice *device = NULL;
|
NMDevice *device = NULL;
|
||||||
gboolean is_vpn = FALSE;
|
gboolean is_vpn = FALSE;
|
||||||
gs_unref_variant GVariant *settings = NULL;
|
gs_unref_variant GVariant *settings = NULL;
|
||||||
|
gs_unref_variant GVariant *options = NULL;
|
||||||
const char *device_path;
|
const char *device_path;
|
||||||
const char *specific_object_path;
|
const char *specific_object_path;
|
||||||
gs_free NMConnection **conns = NULL;
|
gs_free NMConnection **conns = NULL;
|
||||||
|
|
||||||
g_variant_get (parameters, "(@a{sa{sv}}&o&o)", &settings, &device_path, &specific_object_path);
|
if (g_strcmp0 (method_info->parent.name, "AddAndActivateConnection2") == 0)
|
||||||
|
g_variant_get (parameters, "(@a{sa{sv}}&o&o@a{sv})", &settings, &device_path, &specific_object_path, &options);
|
||||||
|
else
|
||||||
|
g_variant_get (parameters, "(@a{sa{sv}}&o&o)", &settings, &device_path, &specific_object_path);
|
||||||
|
|
||||||
|
if (options) {
|
||||||
|
GVariantIter iter;
|
||||||
|
const char *option_name;
|
||||||
|
GVariant *option_value;
|
||||||
|
|
||||||
|
/* Just a commit to prepare the support, error out if any option is passed. */
|
||||||
|
g_variant_iter_init (&iter, options);
|
||||||
|
while (g_variant_iter_next (&iter, "{&sv}", &option_name, &option_value)) {
|
||||||
|
gs_unref_variant GVariant *option_value_free = NULL;
|
||||||
|
|
||||||
|
option_value_free = option_value;
|
||||||
|
|
||||||
|
error = g_error_new_literal (NM_MANAGER_ERROR,
|
||||||
|
NM_MANAGER_ERROR_INVALID_ARGUMENTS,
|
||||||
|
"Unknown extra option passed.");
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
specific_object_path = nm_utils_dbus_normalize_object_path (specific_object_path);
|
specific_object_path = nm_utils_dbus_normalize_object_path (specific_object_path);
|
||||||
device_path = nm_utils_dbus_normalize_object_path (device_path);
|
device_path = nm_utils_dbus_normalize_object_path (device_path);
|
||||||
|
|
@ -7649,6 +7672,22 @@ static const NMDBusInterfaceInfoExtended interface_info_manager = {
|
||||||
),
|
),
|
||||||
.handle = impl_manager_add_and_activate_connection,
|
.handle = impl_manager_add_and_activate_connection,
|
||||||
),
|
),
|
||||||
|
NM_DEFINE_DBUS_METHOD_INFO_EXTENDED (
|
||||||
|
NM_DEFINE_GDBUS_METHOD_INFO_INIT (
|
||||||
|
"AddAndActivateConnection2",
|
||||||
|
.in_args = NM_DEFINE_GDBUS_ARG_INFOS (
|
||||||
|
NM_DEFINE_GDBUS_ARG_INFO ("connection", "a{sa{sv}}"),
|
||||||
|
NM_DEFINE_GDBUS_ARG_INFO ("device", "o"),
|
||||||
|
NM_DEFINE_GDBUS_ARG_INFO ("specific_object", "o"),
|
||||||
|
NM_DEFINE_GDBUS_ARG_INFO ("options", "a{sv}"),
|
||||||
|
),
|
||||||
|
.out_args = NM_DEFINE_GDBUS_ARG_INFOS (
|
||||||
|
NM_DEFINE_GDBUS_ARG_INFO ("path", "o"),
|
||||||
|
NM_DEFINE_GDBUS_ARG_INFO ("active_connection", "o"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
.handle = impl_manager_add_and_activate_connection,
|
||||||
|
),
|
||||||
NM_DEFINE_DBUS_METHOD_INFO_EXTENDED (
|
NM_DEFINE_DBUS_METHOD_INFO_EXTENDED (
|
||||||
NM_DEFINE_GDBUS_METHOD_INFO_INIT (
|
NM_DEFINE_GDBUS_METHOD_INFO_INIT (
|
||||||
"DeactivateConnection",
|
"DeactivateConnection",
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue