2014-07-24 08:53:33 -04:00
|
|
|
/* -*- 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.
|
|
|
|
|
*
|
|
|
|
|
* Copyright 2007 - 2008 Novell, Inc.
|
2014-10-01 11:02:16 +02:00
|
|
|
* Copyright 2007 - 2014 Red Hat, Inc.
|
2014-07-24 08:53:33 -04:00
|
|
|
*/
|
|
|
|
|
|
all: fix up multiple-include-guard defines
Previously, src/nm-ip4-config.h, libnm/nm-ip4-config.h, and
libnm-glib/nm-ip4-config.h all used "NM_IP4_CONFIG_H" as an include
guard, which meant that nm-test-utils.h could not tell which of them
was being included (and so, eg, if you tried to include
nm-ip4-config.h in a libnm test, it would fail to compile because
nm-test-utils.h was referring to symbols in src/nm-ip4-config.h).
Fix this by changing the include guards in the non-API-stable parts of
the tree:
- libnm-glib/nm-ip4-config.h remains NM_IP4_CONFIG_H
- libnm/nm-ip4-config.h now uses __NM_IP4_CONFIG_H__
- src/nm-ip4-config.h now uses __NETWORKMANAGER_IP4_CONFIG_H__
And likewise for all other headers.
The two non-"nm"-prefixed headers, libnm/NetworkManager.h and
src/NetworkManagerUtils.h are now __NETWORKMANAGER_H__ and
__NETWORKMANAGER_UTILS_H__ respectively, which, while not entirely
consistent with the general scheme, do still mostly make sense in
isolation.
2014-08-13 14:10:11 -04:00
|
|
|
#ifndef __NM_CLIENT_H__
|
|
|
|
|
#define __NM_CLIENT_H__
|
2014-07-24 08:53:33 -04:00
|
|
|
|
2014-07-06 16:53:02 -04:00
|
|
|
#if !defined (__NETWORKMANAGER_H_INSIDE__) && !defined (NETWORKMANAGER_COMPILATION)
|
|
|
|
|
#error "Only <NetworkManager.h> can be included directly."
|
|
|
|
|
#endif
|
|
|
|
|
|
2017-03-09 13:02:20 +01:00
|
|
|
#include "nm-types.h"
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
|
|
#define NM_TYPE_CLIENT (nm_client_get_type ())
|
|
|
|
|
#define NM_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_CLIENT, NMClient))
|
|
|
|
|
#define NM_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_CLIENT, NMClientClass))
|
|
|
|
|
#define NM_IS_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_CLIENT))
|
|
|
|
|
#define NM_IS_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_CLIENT))
|
|
|
|
|
#define NM_CLIENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_CLIENT, NMClientClass))
|
|
|
|
|
|
|
|
|
|
#define NM_CLIENT_VERSION "version"
|
|
|
|
|
#define NM_CLIENT_STATE "state"
|
|
|
|
|
#define NM_CLIENT_STARTUP "startup"
|
2014-08-05 10:05:26 -04:00
|
|
|
#define NM_CLIENT_NM_RUNNING "nm-running"
|
2014-07-24 08:53:33 -04:00
|
|
|
#define NM_CLIENT_NETWORKING_ENABLED "networking-enabled"
|
|
|
|
|
#define NM_CLIENT_WIRELESS_ENABLED "wireless-enabled"
|
|
|
|
|
#define NM_CLIENT_WIRELESS_HARDWARE_ENABLED "wireless-hardware-enabled"
|
|
|
|
|
#define NM_CLIENT_WWAN_ENABLED "wwan-enabled"
|
|
|
|
|
#define NM_CLIENT_WWAN_HARDWARE_ENABLED "wwan-hardware-enabled"
|
|
|
|
|
#define NM_CLIENT_WIMAX_ENABLED "wimax-enabled"
|
|
|
|
|
#define NM_CLIENT_WIMAX_HARDWARE_ENABLED "wimax-hardware-enabled"
|
|
|
|
|
#define NM_CLIENT_ACTIVE_CONNECTIONS "active-connections"
|
|
|
|
|
#define NM_CLIENT_CONNECTIVITY "connectivity"
|
2017-08-09 15:21:28 +08:00
|
|
|
#define NM_CLIENT_CONNECTIVITY_CHECK_AVAILABLE "connectivity-check-available"
|
|
|
|
|
#define NM_CLIENT_CONNECTIVITY_CHECK_ENABLED "connectivity-check-enabled"
|
2014-07-24 08:53:33 -04:00
|
|
|
#define NM_CLIENT_PRIMARY_CONNECTION "primary-connection"
|
|
|
|
|
#define NM_CLIENT_ACTIVATING_CONNECTION "activating-connection"
|
|
|
|
|
#define NM_CLIENT_DEVICES "devices"
|
2014-10-10 14:28:49 -05:00
|
|
|
#define NM_CLIENT_ALL_DEVICES "all-devices"
|
2014-09-29 10:58:16 -04:00
|
|
|
#define NM_CLIENT_CONNECTIONS "connections"
|
|
|
|
|
#define NM_CLIENT_HOSTNAME "hostname"
|
|
|
|
|
#define NM_CLIENT_CAN_MODIFY "can-modify"
|
2015-06-03 09:15:24 +02:00
|
|
|
#define NM_CLIENT_METERED "metered"
|
2016-10-25 11:11:12 +02:00
|
|
|
#define NM_CLIENT_DNS_MODE "dns-mode"
|
|
|
|
|
#define NM_CLIENT_DNS_RC_MANAGER "dns-rc-manager"
|
|
|
|
|
#define NM_CLIENT_DNS_CONFIGURATION "dns-configuration"
|
2014-09-29 10:58:16 -04:00
|
|
|
|
|
|
|
|
#define NM_CLIENT_DEVICE_ADDED "device-added"
|
|
|
|
|
#define NM_CLIENT_DEVICE_REMOVED "device-removed"
|
2014-10-10 14:28:49 -05:00
|
|
|
#define NM_CLIENT_ANY_DEVICE_ADDED "any-device-added"
|
|
|
|
|
#define NM_CLIENT_ANY_DEVICE_REMOVED "any-device-removed"
|
2014-09-29 10:58:16 -04:00
|
|
|
#define NM_CLIENT_PERMISSION_CHANGED "permission-changed"
|
|
|
|
|
#define NM_CLIENT_CONNECTION_ADDED "connection-added"
|
|
|
|
|
#define NM_CLIENT_CONNECTION_REMOVED "connection-removed"
|
2016-07-07 11:35:19 +02:00
|
|
|
#define NM_CLIENT_ACTIVE_CONNECTION_ADDED "active-connection-added"
|
|
|
|
|
#define NM_CLIENT_ACTIVE_CONNECTION_REMOVED "active-connection-removed"
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* NMClientPermission:
|
|
|
|
|
* @NM_CLIENT_PERMISSION_NONE: unknown or no permission
|
|
|
|
|
* @NM_CLIENT_PERMISSION_ENABLE_DISABLE_NETWORK: controls whether networking
|
|
|
|
|
* can be globally enabled or disabled
|
|
|
|
|
* @NM_CLIENT_PERMISSION_ENABLE_DISABLE_WIFI: controls whether Wi-Fi can be
|
|
|
|
|
* globally enabled or disabled
|
|
|
|
|
* @NM_CLIENT_PERMISSION_ENABLE_DISABLE_WWAN: controls whether WWAN (3G) can be
|
|
|
|
|
* globally enabled or disabled
|
|
|
|
|
* @NM_CLIENT_PERMISSION_ENABLE_DISABLE_WIMAX: controls whether WiMAX can be
|
|
|
|
|
* globally enabled or disabled
|
|
|
|
|
* @NM_CLIENT_PERMISSION_SLEEP_WAKE: controls whether the client can ask
|
|
|
|
|
* NetworkManager to sleep and wake
|
|
|
|
|
* @NM_CLIENT_PERMISSION_NETWORK_CONTROL: controls whether networking connections
|
|
|
|
|
* can be started, stopped, and changed
|
|
|
|
|
* @NM_CLIENT_PERMISSION_WIFI_SHARE_PROTECTED: controls whether a password
|
|
|
|
|
* protected Wi-Fi hotspot can be created
|
|
|
|
|
* @NM_CLIENT_PERMISSION_WIFI_SHARE_OPEN: controls whether an open Wi-Fi hotspot
|
|
|
|
|
* can be created
|
|
|
|
|
* @NM_CLIENT_PERMISSION_SETTINGS_MODIFY_SYSTEM: controls whether connections
|
|
|
|
|
* that are available to all users can be modified
|
|
|
|
|
* @NM_CLIENT_PERMISSION_SETTINGS_MODIFY_OWN: controls whether connections
|
|
|
|
|
* owned by the current user can be modified
|
|
|
|
|
* @NM_CLIENT_PERMISSION_SETTINGS_MODIFY_HOSTNAME: controls whether the
|
|
|
|
|
* persistent hostname can be changed
|
2016-06-01 12:54:05 +02:00
|
|
|
* @NM_CLIENT_PERMISSION_SETTINGS_MODIFY_GLOBAL_DNS: modify persistent global
|
|
|
|
|
* DNS configuration
|
2016-05-30 15:42:44 +02:00
|
|
|
* @NM_CLIENT_PERMISSION_RELOAD: controls access to Reload.
|
2016-08-17 15:34:55 +02:00
|
|
|
* @NM_CLIENT_PERMISSION_CHECKPOINT_ROLLBACK: permission to create checkpoints.
|
2016-08-10 11:54:32 +02:00
|
|
|
* @NM_CLIENT_PERMISSION_ENABLE_DISABLE_STATISTICS: controls whether device
|
|
|
|
|
* statistics can be globally enabled or disabled
|
2017-08-17 23:08:44 +02:00
|
|
|
* @NM_CLIENT_PERMISSION_ENABLE_DISABLE_CONNECTIVITY_CHECK: controls whether
|
|
|
|
|
* connectivity check can be enabled or disabled
|
2014-07-24 08:53:33 -04:00
|
|
|
* @NM_CLIENT_PERMISSION_LAST: a reserved boundary value
|
|
|
|
|
*
|
|
|
|
|
* #NMClientPermission values indicate various permissions that NetworkManager
|
|
|
|
|
* clients can obtain to perform certain tasks on behalf of the current user.
|
|
|
|
|
**/
|
|
|
|
|
typedef enum {
|
|
|
|
|
NM_CLIENT_PERMISSION_NONE = 0,
|
|
|
|
|
NM_CLIENT_PERMISSION_ENABLE_DISABLE_NETWORK = 1,
|
|
|
|
|
NM_CLIENT_PERMISSION_ENABLE_DISABLE_WIFI = 2,
|
|
|
|
|
NM_CLIENT_PERMISSION_ENABLE_DISABLE_WWAN = 3,
|
|
|
|
|
NM_CLIENT_PERMISSION_ENABLE_DISABLE_WIMAX = 4,
|
|
|
|
|
NM_CLIENT_PERMISSION_SLEEP_WAKE = 5,
|
|
|
|
|
NM_CLIENT_PERMISSION_NETWORK_CONTROL = 6,
|
|
|
|
|
NM_CLIENT_PERMISSION_WIFI_SHARE_PROTECTED = 7,
|
|
|
|
|
NM_CLIENT_PERMISSION_WIFI_SHARE_OPEN = 8,
|
|
|
|
|
NM_CLIENT_PERMISSION_SETTINGS_MODIFY_SYSTEM = 9,
|
|
|
|
|
NM_CLIENT_PERMISSION_SETTINGS_MODIFY_OWN = 10,
|
|
|
|
|
NM_CLIENT_PERMISSION_SETTINGS_MODIFY_HOSTNAME = 11,
|
2016-06-01 12:54:05 +02:00
|
|
|
NM_CLIENT_PERMISSION_SETTINGS_MODIFY_GLOBAL_DNS = 12,
|
2016-05-30 15:42:44 +02:00
|
|
|
NM_CLIENT_PERMISSION_RELOAD = 13,
|
2016-08-17 15:34:55 +02:00
|
|
|
NM_CLIENT_PERMISSION_CHECKPOINT_ROLLBACK = 14,
|
2016-08-10 11:54:32 +02:00
|
|
|
NM_CLIENT_PERMISSION_ENABLE_DISABLE_STATISTICS = 15,
|
2017-08-09 15:21:28 +08:00
|
|
|
NM_CLIENT_PERMISSION_ENABLE_DISABLE_CONNECTIVITY_CHECK = 16,
|
2014-07-24 08:53:33 -04:00
|
|
|
|
2017-08-09 15:21:28 +08:00
|
|
|
NM_CLIENT_PERMISSION_LAST = 16,
|
2014-07-24 08:53:33 -04:00
|
|
|
} NMClientPermission;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* NMClientPermissionResult:
|
|
|
|
|
* @NM_CLIENT_PERMISSION_RESULT_UNKNOWN: unknown or no authorization
|
|
|
|
|
* @NM_CLIENT_PERMISSION_RESULT_YES: the permission is available
|
|
|
|
|
* @NM_CLIENT_PERMISSION_RESULT_AUTH: authorization is necessary before the
|
|
|
|
|
* permission is available
|
|
|
|
|
* @NM_CLIENT_PERMISSION_RESULT_NO: permission to perform the operation is
|
|
|
|
|
* denied by system policy
|
|
|
|
|
*
|
|
|
|
|
* #NMClientPermissionResult values indicate what authorizations and permissions
|
|
|
|
|
* the user requires to obtain a given #NMClientPermission
|
|
|
|
|
**/
|
|
|
|
|
typedef enum {
|
|
|
|
|
NM_CLIENT_PERMISSION_RESULT_UNKNOWN = 0,
|
|
|
|
|
NM_CLIENT_PERMISSION_RESULT_YES,
|
|
|
|
|
NM_CLIENT_PERMISSION_RESULT_AUTH,
|
|
|
|
|
NM_CLIENT_PERMISSION_RESULT_NO
|
|
|
|
|
} NMClientPermissionResult;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* NMClientError:
|
2014-10-20 14:03:30 -04:00
|
|
|
* @NM_CLIENT_ERROR_FAILED: unknown or unclassified error
|
2014-07-24 08:53:33 -04:00
|
|
|
* @NM_CLIENT_ERROR_MANAGER_NOT_RUNNING: an operation that requires NetworkManager
|
|
|
|
|
* failed because NetworkManager is not running
|
2014-10-20 14:03:30 -04:00
|
|
|
* @NM_CLIENT_ERROR_OBJECT_CREATION_FAILED: NetworkManager claimed that an
|
|
|
|
|
* operation succeeded, but the object that was allegedly created (eg,
|
|
|
|
|
* #NMRemoteConnection, #NMActiveConnection) was apparently destroyed before
|
|
|
|
|
* #NMClient could create a representation of it.
|
2014-07-24 08:53:33 -04:00
|
|
|
*
|
|
|
|
|
* Describes errors that may result from operations involving a #NMClient.
|
2014-10-20 14:03:30 -04:00
|
|
|
*
|
|
|
|
|
* D-Bus operations may also return errors from other domains, including
|
|
|
|
|
* #NMManagerError, #NMSettingsError, #NMAgentManagerError, and #NMConnectionError.
|
2014-07-24 08:53:33 -04:00
|
|
|
**/
|
|
|
|
|
typedef enum {
|
2014-10-20 14:03:30 -04:00
|
|
|
NM_CLIENT_ERROR_FAILED = 0,
|
|
|
|
|
NM_CLIENT_ERROR_MANAGER_NOT_RUNNING,
|
|
|
|
|
NM_CLIENT_ERROR_OBJECT_CREATION_FAILED,
|
2014-07-24 08:53:33 -04:00
|
|
|
} NMClientError;
|
|
|
|
|
|
|
|
|
|
#define NM_CLIENT_ERROR nm_client_error_quark ()
|
|
|
|
|
GQuark nm_client_error_quark (void);
|
|
|
|
|
|
2016-10-25 11:11:12 +02:00
|
|
|
/* DNS stuff */
|
|
|
|
|
|
|
|
|
|
typedef struct NMDnsEntry NMDnsEntry;
|
|
|
|
|
|
|
|
|
|
NM_AVAILABLE_IN_1_6
|
|
|
|
|
GType nm_dns_entry_get_type (void);
|
|
|
|
|
NM_AVAILABLE_IN_1_6
|
|
|
|
|
void nm_dns_entry_unref (NMDnsEntry *entry);
|
|
|
|
|
NM_AVAILABLE_IN_1_6
|
|
|
|
|
const char * nm_dns_entry_get_interface (NMDnsEntry *entry);
|
|
|
|
|
NM_AVAILABLE_IN_1_6
|
|
|
|
|
const char * const *nm_dns_entry_get_nameservers (NMDnsEntry *entry);
|
|
|
|
|
NM_AVAILABLE_IN_1_6
|
|
|
|
|
const char * const *nm_dns_entry_get_domains (NMDnsEntry *entry);
|
|
|
|
|
NM_AVAILABLE_IN_1_6
|
|
|
|
|
int nm_dns_entry_get_priority (NMDnsEntry *entry);
|
|
|
|
|
NM_AVAILABLE_IN_1_6
|
|
|
|
|
gboolean nm_dns_entry_get_vpn (NMDnsEntry *entry);
|
|
|
|
|
|
2016-05-05 09:36:32 +02:00
|
|
|
/**
|
|
|
|
|
* NMClient:
|
|
|
|
|
*/
|
2014-10-09 09:12:42 -04:00
|
|
|
struct _NMClient {
|
2014-09-24 13:14:48 -04:00
|
|
|
GObject parent;
|
2014-10-09 09:12:42 -04:00
|
|
|
};
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
typedef struct {
|
2014-09-24 13:14:48 -04:00
|
|
|
GObjectClass parent;
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
/* Signals */
|
|
|
|
|
void (*device_added) (NMClient *client, NMDevice *device);
|
|
|
|
|
void (*device_removed) (NMClient *client, NMDevice *device);
|
2014-10-10 14:28:49 -05:00
|
|
|
void (*any_device_added) (NMClient *client, NMDevice *device);
|
|
|
|
|
void (*any_device_removed) (NMClient *client, NMDevice *device);
|
2014-07-24 08:53:33 -04:00
|
|
|
void (*permission_changed) (NMClient *client,
|
|
|
|
|
NMClientPermission permission,
|
|
|
|
|
NMClientPermissionResult result);
|
2014-09-29 10:58:16 -04:00
|
|
|
void (*connection_added) (NMClient *client, NMRemoteConnection *connection);
|
|
|
|
|
void (*connection_removed) (NMClient *client, NMRemoteConnection *connection);
|
2014-07-24 08:53:33 -04:00
|
|
|
|
2014-05-15 09:55:18 -04:00
|
|
|
/*< private >*/
|
2014-10-10 14:28:49 -05:00
|
|
|
gpointer padding[6];
|
2014-07-24 08:53:33 -04:00
|
|
|
} NMClientClass;
|
|
|
|
|
|
|
|
|
|
GType nm_client_get_type (void);
|
|
|
|
|
|
2014-05-15 14:25:07 -04:00
|
|
|
NMClient *nm_client_new (GCancellable *cancellable,
|
|
|
|
|
GError **error);
|
2014-07-24 08:53:33 -04:00
|
|
|
|
|
|
|
|
void nm_client_new_async (GCancellable *cancellable,
|
|
|
|
|
GAsyncReadyCallback callback,
|
|
|
|
|
gpointer user_data);
|
|
|
|
|
NMClient *nm_client_new_finish (GAsyncResult *result,
|
|
|
|
|
GError **error);
|
|
|
|
|
|
2014-09-18 16:11:00 -04:00
|
|
|
const char *nm_client_get_version (NMClient *client);
|
|
|
|
|
NMState nm_client_get_state (NMClient *client);
|
|
|
|
|
gboolean nm_client_get_startup (NMClient *client);
|
|
|
|
|
gboolean nm_client_get_nm_running (NMClient *client);
|
|
|
|
|
|
|
|
|
|
gboolean nm_client_networking_get_enabled (NMClient *client);
|
|
|
|
|
gboolean nm_client_networking_set_enabled (NMClient *client,
|
|
|
|
|
gboolean enabled,
|
|
|
|
|
GError **error);
|
|
|
|
|
|
|
|
|
|
gboolean nm_client_wireless_get_enabled (NMClient *client);
|
|
|
|
|
void nm_client_wireless_set_enabled (NMClient *client, gboolean enabled);
|
|
|
|
|
gboolean nm_client_wireless_hardware_get_enabled (NMClient *client);
|
|
|
|
|
|
|
|
|
|
gboolean nm_client_wwan_get_enabled (NMClient *client);
|
|
|
|
|
void nm_client_wwan_set_enabled (NMClient *client, gboolean enabled);
|
|
|
|
|
gboolean nm_client_wwan_hardware_get_enabled (NMClient *client);
|
|
|
|
|
|
|
|
|
|
gboolean nm_client_wimax_get_enabled (NMClient *client);
|
|
|
|
|
void nm_client_wimax_set_enabled (NMClient *client, gboolean enabled);
|
|
|
|
|
gboolean nm_client_wimax_hardware_get_enabled (NMClient *client);
|
|
|
|
|
|
2017-08-17 23:08:44 +02:00
|
|
|
NM_AVAILABLE_IN_1_10
|
2017-08-09 15:21:28 +08:00
|
|
|
gboolean nm_client_connectivity_check_get_available (NMClient *client);
|
2017-08-17 23:08:44 +02:00
|
|
|
|
|
|
|
|
NM_AVAILABLE_IN_1_10
|
2017-08-09 15:21:28 +08:00
|
|
|
gboolean nm_client_connectivity_check_get_enabled (NMClient *client);
|
2017-08-17 23:08:44 +02:00
|
|
|
|
|
|
|
|
NM_AVAILABLE_IN_1_10
|
2017-08-09 15:21:28 +08:00
|
|
|
void nm_client_connectivity_check_set_enabled (NMClient *client,
|
|
|
|
|
gboolean enabled);
|
|
|
|
|
|
2014-09-18 16:11:00 -04:00
|
|
|
gboolean nm_client_get_logging (NMClient *client,
|
|
|
|
|
char **level,
|
|
|
|
|
char **domains,
|
|
|
|
|
GError **error);
|
|
|
|
|
gboolean nm_client_set_logging (NMClient *client,
|
|
|
|
|
const char *level,
|
|
|
|
|
const char *domains,
|
|
|
|
|
GError **error);
|
|
|
|
|
|
|
|
|
|
NMClientPermissionResult nm_client_get_permission_result (NMClient *client,
|
|
|
|
|
NMClientPermission permission);
|
|
|
|
|
|
|
|
|
|
NMConnectivityState nm_client_get_connectivity (NMClient *client);
|
|
|
|
|
|
|
|
|
|
NMConnectivityState nm_client_check_connectivity (NMClient *client,
|
|
|
|
|
GCancellable *cancellable,
|
|
|
|
|
GError **error);
|
|
|
|
|
void nm_client_check_connectivity_async (NMClient *client,
|
|
|
|
|
GCancellable *cancellable,
|
|
|
|
|
GAsyncReadyCallback callback,
|
|
|
|
|
gpointer user_data);
|
|
|
|
|
NMConnectivityState nm_client_check_connectivity_finish (NMClient *client,
|
|
|
|
|
GAsyncResult *result,
|
|
|
|
|
GError **error);
|
|
|
|
|
|
2014-09-29 10:58:16 -04:00
|
|
|
gboolean nm_client_save_hostname (NMClient *client,
|
|
|
|
|
const char *hostname,
|
|
|
|
|
GCancellable *cancellable,
|
|
|
|
|
GError **error);
|
|
|
|
|
void nm_client_save_hostname_async (NMClient *client,
|
|
|
|
|
const char *hostname,
|
|
|
|
|
GCancellable *cancellable,
|
|
|
|
|
GAsyncReadyCallback callback,
|
|
|
|
|
gpointer user_data);
|
|
|
|
|
gboolean nm_client_save_hostname_finish (NMClient *client,
|
|
|
|
|
GAsyncResult *result,
|
|
|
|
|
GError **error);
|
|
|
|
|
|
2014-09-18 16:11:00 -04:00
|
|
|
/* Devices */
|
|
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
const GPtrArray *nm_client_get_devices (NMClient *client);
|
2014-10-10 14:28:49 -05:00
|
|
|
NM_AVAILABLE_IN_1_2
|
|
|
|
|
const GPtrArray *nm_client_get_all_devices(NMClient *client);
|
2014-07-24 08:53:33 -04:00
|
|
|
NMDevice *nm_client_get_device_by_path (NMClient *client, const char *object_path);
|
|
|
|
|
NMDevice *nm_client_get_device_by_iface (NMClient *client, const char *iface);
|
|
|
|
|
|
2014-09-18 16:11:00 -04:00
|
|
|
/* Active Connections */
|
|
|
|
|
|
|
|
|
|
const GPtrArray *nm_client_get_active_connections (NMClient *client);
|
|
|
|
|
|
|
|
|
|
NMActiveConnection *nm_client_get_primary_connection (NMClient *client);
|
|
|
|
|
NMActiveConnection *nm_client_get_activating_connection (NMClient *client);
|
|
|
|
|
|
2014-09-11 16:27:13 -04:00
|
|
|
void nm_client_activate_connection_async (NMClient *client,
|
|
|
|
|
NMConnection *connection,
|
|
|
|
|
NMDevice *device,
|
|
|
|
|
const char *specific_object,
|
|
|
|
|
GCancellable *cancellable,
|
|
|
|
|
GAsyncReadyCallback callback,
|
|
|
|
|
gpointer user_data);
|
|
|
|
|
NMActiveConnection *nm_client_activate_connection_finish (NMClient *client,
|
|
|
|
|
GAsyncResult *result,
|
|
|
|
|
GError **error);
|
|
|
|
|
|
|
|
|
|
void nm_client_add_and_activate_connection_async (NMClient *client,
|
|
|
|
|
NMConnection *partial,
|
|
|
|
|
NMDevice *device,
|
|
|
|
|
const char *specific_object,
|
|
|
|
|
GCancellable *cancellable,
|
|
|
|
|
GAsyncReadyCallback callback,
|
|
|
|
|
gpointer user_data);
|
|
|
|
|
NMActiveConnection *nm_client_add_and_activate_connection_finish (NMClient *client,
|
|
|
|
|
GAsyncResult *result,
|
|
|
|
|
GError **error);
|
|
|
|
|
|
2018-11-18 17:59:31 +01:00
|
|
|
NM_AVAILABLE_IN_1_16
|
all: return output dictionary from "AddAndActivate2"
Add a "a{sv}" output argument to "AddAndActivate2" D-Bus API.
"AddAndActivate2" replaces "AddAndActivate" with more options.
It also has a dictionary argument to be forward compatible so that we
hopefully won't need an "AddAndActivate3". However, it lacked a similar
output dictionary. Add it for future extensibility. I think this is
really to workaround a shortcoming of D-Bus, which does provide strong
typing and type information about its API, but does not allow to extend
an existing API in a backward compatible manner. So we either resort to
Method(), Method2(), Method3() variants, or a catch-all variant with a
generic "a{sv}" input/output argument.
In libnm, rename "nm_client_add_and_activate_connection_options()" to
"nm_client_add_and_activate_connection2()". I think libnm API should have
an obvious correspondence with D-Bus API. Or stated differently, if
"AddAndActivateOptions" would be a better name, then the D-Bus API should
be renamed. We should prefer one name over the other, but regardless
of which is preferred, the naming for D-Bus and libnm API should
correspond.
In this case, I do think that AddAndActivate2() is a better name than
AddAndActivateOptions(). Hence I rename the libnm API.
Also, unless necessary, let libnm still call "AddAndActivate" instead of
"AddAndActivate2". Our backward compatibility works the way that libnm
requires a server version at least as new as itself. As such, libnm
theoretically could assume that server version is new enough to support
"AddAndActivate2" and could always use the more powerful variant.
However, we don't need to break compatibility intentionally and for
little gain. Here, it's easy to let libnm also handle old server API, by
continuing to use "AddAndActivate" for nm_client_add_and_activate_connection().
Note that during package update, we don't restart the currently running
NetworkManager instance. In such a scenario, it can easily happen that
nmcli/libnm is newer than the server version. Let's try a bit harder
to not break that.
Changes as discussed in [1].
[1] https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/37#note_79876
2018-12-20 07:48:31 +01:00
|
|
|
void nm_client_add_and_activate_connection2 (NMClient *client,
|
|
|
|
|
NMConnection *partial,
|
|
|
|
|
NMDevice *device,
|
|
|
|
|
const char *specific_object,
|
|
|
|
|
GVariant *options,
|
|
|
|
|
GCancellable *cancellable,
|
|
|
|
|
GAsyncReadyCallback callback,
|
|
|
|
|
gpointer user_data);
|
2018-11-18 17:59:31 +01:00
|
|
|
NM_AVAILABLE_IN_1_16
|
all: return output dictionary from "AddAndActivate2"
Add a "a{sv}" output argument to "AddAndActivate2" D-Bus API.
"AddAndActivate2" replaces "AddAndActivate" with more options.
It also has a dictionary argument to be forward compatible so that we
hopefully won't need an "AddAndActivate3". However, it lacked a similar
output dictionary. Add it for future extensibility. I think this is
really to workaround a shortcoming of D-Bus, which does provide strong
typing and type information about its API, but does not allow to extend
an existing API in a backward compatible manner. So we either resort to
Method(), Method2(), Method3() variants, or a catch-all variant with a
generic "a{sv}" input/output argument.
In libnm, rename "nm_client_add_and_activate_connection_options()" to
"nm_client_add_and_activate_connection2()". I think libnm API should have
an obvious correspondence with D-Bus API. Or stated differently, if
"AddAndActivateOptions" would be a better name, then the D-Bus API should
be renamed. We should prefer one name over the other, but regardless
of which is preferred, the naming for D-Bus and libnm API should
correspond.
In this case, I do think that AddAndActivate2() is a better name than
AddAndActivateOptions(). Hence I rename the libnm API.
Also, unless necessary, let libnm still call "AddAndActivate" instead of
"AddAndActivate2". Our backward compatibility works the way that libnm
requires a server version at least as new as itself. As such, libnm
theoretically could assume that server version is new enough to support
"AddAndActivate2" and could always use the more powerful variant.
However, we don't need to break compatibility intentionally and for
little gain. Here, it's easy to let libnm also handle old server API, by
continuing to use "AddAndActivate" for nm_client_add_and_activate_connection().
Note that during package update, we don't restart the currently running
NetworkManager instance. In such a scenario, it can easily happen that
nmcli/libnm is newer than the server version. Let's try a bit harder
to not break that.
Changes as discussed in [1].
[1] https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/37#note_79876
2018-12-20 07:48:31 +01:00
|
|
|
NMActiveConnection *nm_client_add_and_activate_connection2_finish (NMClient *client,
|
|
|
|
|
GAsyncResult *result,
|
|
|
|
|
GVariant **out_result,
|
|
|
|
|
GError **error);
|
2018-10-26 13:44:38 +02:00
|
|
|
|
2014-09-11 16:27:13 -04:00
|
|
|
gboolean nm_client_deactivate_connection (NMClient *client,
|
|
|
|
|
NMActiveConnection *active,
|
|
|
|
|
GCancellable *cancellable,
|
|
|
|
|
GError **error);
|
|
|
|
|
void nm_client_deactivate_connection_async (NMClient *client,
|
|
|
|
|
NMActiveConnection *active,
|
|
|
|
|
GCancellable *cancellable,
|
|
|
|
|
GAsyncReadyCallback callback,
|
|
|
|
|
gpointer user_data);
|
|
|
|
|
gboolean nm_client_deactivate_connection_finish (NMClient *client,
|
|
|
|
|
GAsyncResult *result,
|
|
|
|
|
GError **error);
|
2014-07-24 08:53:33 -04:00
|
|
|
|
2014-09-29 10:58:16 -04:00
|
|
|
/* Connections */
|
|
|
|
|
|
2014-10-22 12:32:46 -04:00
|
|
|
const GPtrArray *nm_client_get_connections (NMClient *client);
|
2014-09-29 10:58:16 -04:00
|
|
|
|
|
|
|
|
NMRemoteConnection *nm_client_get_connection_by_id (NMClient *client, const char *id);
|
|
|
|
|
NMRemoteConnection *nm_client_get_connection_by_path (NMClient *client, const char *path);
|
|
|
|
|
NMRemoteConnection *nm_client_get_connection_by_uuid (NMClient *client, const char *uuid);
|
|
|
|
|
|
|
|
|
|
void nm_client_add_connection_async (NMClient *client,
|
|
|
|
|
NMConnection *connection,
|
|
|
|
|
gboolean save_to_disk,
|
|
|
|
|
GCancellable *cancellable,
|
|
|
|
|
GAsyncReadyCallback callback,
|
|
|
|
|
gpointer user_data);
|
|
|
|
|
NMRemoteConnection *nm_client_add_connection_finish (NMClient *client,
|
|
|
|
|
GAsyncResult *result,
|
|
|
|
|
GError **error);
|
|
|
|
|
|
|
|
|
|
gboolean nm_client_load_connections (NMClient *client,
|
|
|
|
|
char **filenames,
|
|
|
|
|
char ***failures,
|
|
|
|
|
GCancellable *cancellable,
|
|
|
|
|
GError **error);
|
|
|
|
|
void nm_client_load_connections_async (NMClient *client,
|
|
|
|
|
char **filenames,
|
|
|
|
|
GCancellable *cancellable,
|
|
|
|
|
GAsyncReadyCallback callback,
|
|
|
|
|
gpointer user_data);
|
|
|
|
|
gboolean nm_client_load_connections_finish (NMClient *client,
|
|
|
|
|
char ***failures,
|
|
|
|
|
GAsyncResult *result,
|
|
|
|
|
GError **error);
|
|
|
|
|
|
|
|
|
|
gboolean nm_client_reload_connections (NMClient *client,
|
|
|
|
|
GCancellable *cancellable,
|
|
|
|
|
GError **error);
|
|
|
|
|
void nm_client_reload_connections_async (NMClient *client,
|
|
|
|
|
GCancellable *cancellable,
|
|
|
|
|
GAsyncReadyCallback callback,
|
|
|
|
|
gpointer user_data);
|
|
|
|
|
gboolean nm_client_reload_connections_finish (NMClient *client,
|
|
|
|
|
GAsyncResult *result,
|
|
|
|
|
GError **error);
|
|
|
|
|
|
2016-10-25 11:11:12 +02:00
|
|
|
NM_AVAILABLE_IN_1_6
|
|
|
|
|
const char *nm_client_get_dns_mode (NMClient *client);
|
|
|
|
|
NM_AVAILABLE_IN_1_6
|
|
|
|
|
const char *nm_client_get_dns_rc_manager (NMClient *client);
|
|
|
|
|
NM_AVAILABLE_IN_1_6
|
|
|
|
|
const GPtrArray *nm_client_get_dns_configuration (NMClient *client);
|
|
|
|
|
|
2017-10-21 16:05:19 +02:00
|
|
|
NM_AVAILABLE_IN_1_12
|
|
|
|
|
const GPtrArray *nm_client_get_checkpoints (NMClient *client);
|
|
|
|
|
|
|
|
|
|
NM_AVAILABLE_IN_1_12
|
2018-04-04 13:33:53 +02:00
|
|
|
void nm_client_checkpoint_create (NMClient *client,
|
|
|
|
|
const GPtrArray *devices,
|
|
|
|
|
guint32 rollback_timeout,
|
|
|
|
|
NMCheckpointCreateFlags flags,
|
|
|
|
|
GCancellable *cancellable,
|
|
|
|
|
GAsyncReadyCallback callback,
|
|
|
|
|
gpointer user_data);
|
2017-10-21 16:05:19 +02:00
|
|
|
NM_AVAILABLE_IN_1_12
|
|
|
|
|
NMCheckpoint *nm_client_checkpoint_create_finish (NMClient *client,
|
|
|
|
|
GAsyncResult *result,
|
|
|
|
|
GError **error);
|
|
|
|
|
|
|
|
|
|
NM_AVAILABLE_IN_1_12
|
2018-04-04 13:33:53 +02:00
|
|
|
void nm_client_checkpoint_destroy (NMClient *client,
|
|
|
|
|
const char *checkpoint_path,
|
|
|
|
|
GCancellable *cancellable,
|
|
|
|
|
GAsyncReadyCallback callback,
|
|
|
|
|
gpointer user_data);
|
2017-10-21 16:05:19 +02:00
|
|
|
NM_AVAILABLE_IN_1_12
|
|
|
|
|
gboolean nm_client_checkpoint_destroy_finish (NMClient *client,
|
|
|
|
|
GAsyncResult *result,
|
|
|
|
|
GError **error);
|
|
|
|
|
|
|
|
|
|
NM_AVAILABLE_IN_1_12
|
2018-04-04 13:33:53 +02:00
|
|
|
void nm_client_checkpoint_rollback (NMClient *client,
|
|
|
|
|
const char *checkpoint_path,
|
|
|
|
|
GCancellable *cancellable,
|
|
|
|
|
GAsyncReadyCallback callback,
|
|
|
|
|
gpointer user_data);
|
2017-10-21 16:05:19 +02:00
|
|
|
NM_AVAILABLE_IN_1_12
|
|
|
|
|
GHashTable *nm_client_checkpoint_rollback_finish (NMClient *client,
|
|
|
|
|
GAsyncResult *result,
|
|
|
|
|
GError **error);
|
|
|
|
|
|
checkpoint: allow resetting the rollback timeout via D-Bus
This allows to adjust the timeout of an existing checkpoint.
The main usecase of checkpoints, is to have a fail-safe when
configuring the network remotely. By allowing to reset the timeout,
the user can perform a series of actions, and keep bumping the
timeout. That way, the entire series is still guarded by the same
checkpoint, but the user can start with short timeout, and
re-adjust the timeout as he goes along.
The libnm API only implements the async form (at least for now).
Sync methods are fundamentally wrong with D-Bus, and it's probably
not needed. Also, follow glib convenction, where the async form
doesn't have the _async name suffix. Also, accept a D-Bus path
as argument, not a NMCheckpoint instance. The libnm API should
not be more restricted than the underlying D-Bus API. It would
be cumbersome to require the user to lookup the NMCheckpoint
instance first, especially since libnm doesn't provide an efficient
or convenient lookup-by-path method. On the other hand, retrieving
the path from a NMCheckpoint instance is always possible.
2018-03-28 08:09:56 +02:00
|
|
|
NM_AVAILABLE_IN_1_12
|
|
|
|
|
void nm_client_checkpoint_adjust_rollback_timeout (NMClient *client,
|
|
|
|
|
const char *checkpoint_path,
|
|
|
|
|
guint32 add_timeout,
|
|
|
|
|
GCancellable *cancellable,
|
|
|
|
|
GAsyncReadyCallback callback,
|
|
|
|
|
gpointer user_data);
|
|
|
|
|
|
|
|
|
|
NM_AVAILABLE_IN_1_12
|
|
|
|
|
gboolean nm_client_checkpoint_adjust_rollback_timeout_finish (NMClient *client,
|
|
|
|
|
GAsyncResult *result,
|
|
|
|
|
GError **error);
|
|
|
|
|
|
2014-07-24 08:53:33 -04:00
|
|
|
G_END_DECLS
|
|
|
|
|
|
all: fix up multiple-include-guard defines
Previously, src/nm-ip4-config.h, libnm/nm-ip4-config.h, and
libnm-glib/nm-ip4-config.h all used "NM_IP4_CONFIG_H" as an include
guard, which meant that nm-test-utils.h could not tell which of them
was being included (and so, eg, if you tried to include
nm-ip4-config.h in a libnm test, it would fail to compile because
nm-test-utils.h was referring to symbols in src/nm-ip4-config.h).
Fix this by changing the include guards in the non-API-stable parts of
the tree:
- libnm-glib/nm-ip4-config.h remains NM_IP4_CONFIG_H
- libnm/nm-ip4-config.h now uses __NM_IP4_CONFIG_H__
- src/nm-ip4-config.h now uses __NETWORKMANAGER_IP4_CONFIG_H__
And likewise for all other headers.
The two non-"nm"-prefixed headers, libnm/NetworkManager.h and
src/NetworkManagerUtils.h are now __NETWORKMANAGER_H__ and
__NETWORKMANAGER_UTILS_H__ respectively, which, while not entirely
consistent with the general scheme, do still mostly make sense in
isolation.
2014-08-13 14:10:11 -04:00
|
|
|
#endif /* __NM_CLIENT_H__ */
|