2008-07-27 20:03:46 +00: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.
|
|
|
|
|
*
|
2014-07-04 13:33:18 -04:00
|
|
|
* Copyright 2007 - 2013 Red Hat, Inc.
|
|
|
|
|
* Copyright 2007 - 2008 Novell, Inc.
|
2008-07-27 20:03:46 +00:00
|
|
|
*/
|
2007-11-07 16:06:43 +00:00
|
|
|
|
2007-05-07 14:39:20 +00:00
|
|
|
#ifndef NM_CONNECTION_H
|
|
|
|
|
#define NM_CONNECTION_H
|
|
|
|
|
|
|
|
|
|
#include <glib.h>
|
2007-09-03 01:12:23 +00:00
|
|
|
#include <glib-object.h>
|
2017-03-09 13:02:20 +01:00
|
|
|
#include "nm-setting.h"
|
2007-05-07 14:39:20 +00:00
|
|
|
|
2017-03-09 13:02:20 +01:00
|
|
|
#include "nm-setting-8021x.h"
|
|
|
|
|
#include "nm-setting-bluetooth.h"
|
|
|
|
|
#include "nm-setting-bond.h"
|
|
|
|
|
#include "nm-setting-team.h"
|
|
|
|
|
#include "nm-setting-team-port.h"
|
|
|
|
|
#include "nm-setting-bridge.h"
|
|
|
|
|
#include "nm-setting-bridge-port.h"
|
|
|
|
|
#include "nm-setting-cdma.h"
|
|
|
|
|
#include "nm-setting-connection.h"
|
|
|
|
|
#include "nm-setting-dcb.h"
|
|
|
|
|
#include "nm-setting-generic.h"
|
|
|
|
|
#include "nm-setting-gsm.h"
|
|
|
|
|
#include "nm-setting-infiniband.h"
|
|
|
|
|
#include "nm-setting-ip4-config.h"
|
|
|
|
|
#include "nm-setting-ip6-config.h"
|
|
|
|
|
#include "nm-setting-olpc-mesh.h"
|
|
|
|
|
#include "nm-setting-ppp.h"
|
|
|
|
|
#include "nm-setting-pppoe.h"
|
|
|
|
|
#include "nm-setting-serial.h"
|
|
|
|
|
#include "nm-setting-vpn.h"
|
|
|
|
|
#include "nm-setting-wimax.h"
|
|
|
|
|
#include "nm-setting-wired.h"
|
|
|
|
|
#include "nm-setting-adsl.h"
|
|
|
|
|
#include "nm-setting-wireless.h"
|
|
|
|
|
#include "nm-setting-wireless-security.h"
|
|
|
|
|
#include "nm-setting-vlan.h"
|
2011-03-15 10:32:42 -05:00
|
|
|
|
2007-08-09 09:19:57 +00:00
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
2007-09-03 01:12:23 +00:00
|
|
|
#define NM_TYPE_CONNECTION (nm_connection_get_type ())
|
|
|
|
|
#define NM_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_CONNECTION, NMConnection))
|
|
|
|
|
#define NM_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_CONNECTION, NMConnectionClass))
|
|
|
|
|
#define NM_IS_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_CONNECTION))
|
2012-07-27 13:15:54 +02:00
|
|
|
#define NM_IS_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_CONNECTION))
|
2007-09-03 01:12:23 +00:00
|
|
|
#define NM_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_CONNECTION, NMConnectionClass))
|
|
|
|
|
|
2013-04-11 18:52:31 -05:00
|
|
|
/* Signals */
|
|
|
|
|
#define NM_CONNECTION_SECRETS_UPDATED "secrets-updated"
|
|
|
|
|
#define NM_CONNECTION_SECRETS_CLEARED "secrets-cleared"
|
|
|
|
|
#define NM_CONNECTION_CHANGED "changed"
|
|
|
|
|
|
|
|
|
|
/* Properties */
|
|
|
|
|
#define NM_CONNECTION_PATH "path"
|
2008-11-24 04:30:36 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* NMConnectionError:
|
|
|
|
|
* @NM_CONNECTION_ERROR_UNKNOWN: unknown or unclassified error
|
|
|
|
|
* @NM_CONNECTION_ERROR_CONNECTION_SETTING_NOT_FOUND: the #NMConnection object
|
|
|
|
|
* did not contain the required #NMSettingConnection object, which must be
|
|
|
|
|
* present for all connections
|
libnm-util: verify connection's 'type' setting is actually a base type
By 'base type' I mean a hardware-related type that can actually be used
to activate the connection, like wifi, wired, gsm, cdma, wimax, bluetooth,
etc, but not ipv4, ipv6, 8021x, etc.
2011-03-28 10:40:38 -05:00
|
|
|
* @NM_CONNECTION_ERROR_CONNECTION_TYPE_INVALID: the 'type' property of the
|
|
|
|
|
* 'connection' setting did not point to a valid connection base type; ie
|
|
|
|
|
* it was not a hardware-related setting like #NMSettingWired or
|
|
|
|
|
* #NMSettingWireless.
|
2011-08-16 15:47:12 -05:00
|
|
|
* @NM_CONNECTION_ERROR_SETTING_NOT_FOUND: the #NMConnection object
|
|
|
|
|
* did not contain the specified #NMSetting object
|
2013-12-01 23:31:47 +01:00
|
|
|
*@NM_CONNECTION_ERROR_INVALID_SETTING: the #NMConnection object contains
|
|
|
|
|
* a conflicting setting object
|
2008-11-24 04:30:36 +00:00
|
|
|
*
|
|
|
|
|
* Describes errors that may result from operations involving a #NMConnection.
|
|
|
|
|
*
|
|
|
|
|
**/
|
2008-08-04 22:16:08 +00:00
|
|
|
typedef enum
|
|
|
|
|
{
|
2012-03-09 09:39:58 -05:00
|
|
|
NM_CONNECTION_ERROR_UNKNOWN = 0, /*< nick=UnknownError >*/
|
|
|
|
|
NM_CONNECTION_ERROR_CONNECTION_SETTING_NOT_FOUND, /*< nick=ConnectionSettingNotFound >*/
|
|
|
|
|
NM_CONNECTION_ERROR_CONNECTION_TYPE_INVALID, /*< nick=ConnectionTypeInvalid >*/
|
2013-12-01 23:31:47 +01:00
|
|
|
NM_CONNECTION_ERROR_SETTING_NOT_FOUND, /*< nick=SettingNotFound >*/
|
|
|
|
|
NM_CONNECTION_ERROR_INVALID_SETTING, /*< nick=InvalidSetting >*/
|
2008-08-04 22:16:08 +00:00
|
|
|
} NMConnectionError;
|
|
|
|
|
|
2013-12-01 23:31:47 +01:00
|
|
|
/*
|
|
|
|
|
* NM_CONNECTION_NORMALIZE_PARAM_IP6_CONFIG_METHOD: overwrite the ip6 method
|
|
|
|
|
* when normalizing ip6 configuration. If omited, this defaults to
|
|
|
|
|
* @NM_SETTING_IP6_CONFIG_METHOD_AUTO.
|
|
|
|
|
*/
|
|
|
|
|
#define NM_CONNECTION_NORMALIZE_PARAM_IP6_CONFIG_METHOD "ip6-config-method"
|
|
|
|
|
|
2008-08-04 22:16:08 +00:00
|
|
|
#define NM_CONNECTION_ERROR nm_connection_error_quark ()
|
|
|
|
|
GQuark nm_connection_error_quark (void);
|
|
|
|
|
|
2008-11-24 04:30:36 +00:00
|
|
|
/**
|
|
|
|
|
* NMConnection:
|
|
|
|
|
*
|
|
|
|
|
* The NMConnection struct contains only private data.
|
|
|
|
|
* It should only be accessed through the functions described below.
|
|
|
|
|
*/
|
2007-05-07 14:39:20 +00:00
|
|
|
typedef struct {
|
2007-09-03 01:12:23 +00:00
|
|
|
GObject parent;
|
2007-05-07 14:39:20 +00:00
|
|
|
} NMConnection;
|
|
|
|
|
|
2007-09-03 01:12:23 +00:00
|
|
|
typedef struct {
|
|
|
|
|
GObjectClass parent;
|
2007-09-11 18:02:27 +00:00
|
|
|
|
|
|
|
|
/* Signals */
|
|
|
|
|
void (*secrets_updated) (NMConnection *connection, const char * setting);
|
2007-09-03 01:12:23 +00:00
|
|
|
} NMConnectionClass;
|
|
|
|
|
|
|
|
|
|
GType nm_connection_get_type (void);
|
|
|
|
|
|
2007-05-07 14:39:20 +00:00
|
|
|
NMConnection *nm_connection_new (void);
|
2008-06-12 23:58:08 +00:00
|
|
|
|
|
|
|
|
NMConnection *nm_connection_new_from_hash (GHashTable *hash, GError **error);
|
|
|
|
|
|
2008-06-20 11:26:50 +00:00
|
|
|
NMConnection *nm_connection_duplicate (NMConnection *connection);
|
|
|
|
|
|
2011-02-09 16:28:57 -06:00
|
|
|
NMSetting *nm_connection_create_setting (const char *name);
|
|
|
|
|
|
2007-05-07 14:39:20 +00:00
|
|
|
void nm_connection_add_setting (NMConnection *connection,
|
2011-02-09 16:28:57 -06:00
|
|
|
NMSetting *setting);
|
2007-05-07 14:39:20 +00:00
|
|
|
|
2008-04-15 16:03:26 +00:00
|
|
|
void nm_connection_remove_setting (NMConnection *connection,
|
2008-11-20 16:03:00 +00:00
|
|
|
GType setting_type);
|
2008-04-15 16:03:26 +00:00
|
|
|
|
2007-05-07 14:39:20 +00:00
|
|
|
NMSetting *nm_connection_get_setting (NMConnection *connection,
|
2008-11-20 16:03:00 +00:00
|
|
|
GType setting_type);
|
2007-11-07 16:06:43 +00:00
|
|
|
|
|
|
|
|
NMSetting *nm_connection_get_setting_by_name (NMConnection *connection,
|
2011-02-09 16:28:57 -06:00
|
|
|
const char *name);
|
2007-05-07 14:39:20 +00:00
|
|
|
|
2007-10-06 04:25:48 +00:00
|
|
|
gboolean nm_connection_replace_settings (NMConnection *connection,
|
2008-11-19 15:09:05 +00:00
|
|
|
GHashTable *new_settings,
|
|
|
|
|
GError **error);
|
2007-10-06 04:25:48 +00:00
|
|
|
|
2014-02-12 12:28:52 -05:00
|
|
|
NM_AVAILABLE_IN_0_9_10
|
2013-04-11 12:35:25 -05:00
|
|
|
gboolean nm_connection_replace_settings_from_connection (NMConnection *connection,
|
|
|
|
|
NMConnection *new_connection,
|
|
|
|
|
GError **error);
|
|
|
|
|
|
2008-11-19 18:30:38 +00:00
|
|
|
gboolean nm_connection_compare (NMConnection *a,
|
|
|
|
|
NMConnection *b,
|
2008-02-21 04:34:34 +00:00
|
|
|
NMSettingCompareFlags flags);
|
2007-06-22 15:09:02 +00:00
|
|
|
|
2011-02-22 23:36:43 -06:00
|
|
|
gboolean nm_connection_diff (NMConnection *a,
|
|
|
|
|
NMConnection *b,
|
|
|
|
|
NMSettingCompareFlags flags,
|
|
|
|
|
GHashTable **out_settings);
|
|
|
|
|
|
2008-06-12 23:58:08 +00:00
|
|
|
gboolean nm_connection_verify (NMConnection *connection, GError **error);
|
2013-11-29 12:50:34 +01:00
|
|
|
NM_AVAILABLE_IN_1_0
|
|
|
|
|
gboolean nm_connection_normalize (NMConnection *connection,
|
|
|
|
|
GHashTable *parameters,
|
|
|
|
|
gboolean *modified,
|
|
|
|
|
GError **error);
|
2007-10-04 14:11:33 +00:00
|
|
|
|
2007-11-08 19:25:00 +00:00
|
|
|
const char * nm_connection_need_secrets (NMConnection *connection,
|
|
|
|
|
GPtrArray **hints);
|
2007-08-28 14:47:31 +00:00
|
|
|
|
2007-09-25 06:11:44 +00:00
|
|
|
void nm_connection_clear_secrets (NMConnection *connection);
|
|
|
|
|
|
2011-08-16 16:19:23 -05:00
|
|
|
void nm_connection_clear_secrets_with_flags (NMConnection *connection,
|
|
|
|
|
NMSettingClearSecretsWithFlagsFn func,
|
|
|
|
|
gpointer user_data);
|
|
|
|
|
|
2008-11-19 18:30:38 +00:00
|
|
|
gboolean nm_connection_update_secrets (NMConnection *connection,
|
2007-09-11 18:02:27 +00:00
|
|
|
const char *setting_name,
|
2011-08-22 19:02:12 -05:00
|
|
|
GHashTable *secrets,
|
2008-11-20 15:44:57 +00:00
|
|
|
GError **error);
|
2007-09-11 18:02:27 +00:00
|
|
|
|
2011-02-09 16:28:57 -06:00
|
|
|
void nm_connection_set_path (NMConnection *connection,
|
|
|
|
|
const char *path);
|
2008-02-20 22:37:39 +00:00
|
|
|
|
2011-02-09 16:28:57 -06:00
|
|
|
const char * nm_connection_get_path (NMConnection *connection);
|
2008-02-20 22:37:39 +00:00
|
|
|
|
2011-12-07 13:15:18 +01:00
|
|
|
const char * nm_connection_get_virtual_iface_name (NMConnection *connection);
|
|
|
|
|
|
2014-01-10 18:08:03 +01:00
|
|
|
NM_AVAILABLE_IN_1_0
|
|
|
|
|
const char * nm_connection_get_interface_name (NMConnection *connection);
|
|
|
|
|
|
2011-10-18 13:48:43 +02:00
|
|
|
gboolean nm_connection_is_type (NMConnection *connection, const char *type);
|
|
|
|
|
|
2007-09-16 12:47:14 +00:00
|
|
|
void nm_connection_for_each_setting_value (NMConnection *connection,
|
2011-01-31 21:53:16 -06:00
|
|
|
NMSettingValueIterFn func,
|
|
|
|
|
gpointer user_data);
|
2007-09-16 12:47:14 +00:00
|
|
|
|
2011-01-26 14:14:37 -06:00
|
|
|
GHashTable *nm_connection_to_hash (NMConnection *connection,
|
|
|
|
|
NMSettingHashFlags flags);
|
|
|
|
|
|
2007-06-06 13:33:51 +00:00
|
|
|
void nm_connection_dump (NMConnection *connection);
|
2007-05-07 14:39:20 +00:00
|
|
|
|
2011-02-09 16:28:57 -06:00
|
|
|
GType nm_connection_lookup_setting_type (const char *name);
|
2008-03-17 19:37:23 +00:00
|
|
|
|
2011-02-09 16:28:57 -06:00
|
|
|
GType nm_connection_lookup_setting_type_by_quark (GQuark error_quark);
|
2008-06-12 23:58:08 +00:00
|
|
|
|
2011-02-09 16:34:42 -06:00
|
|
|
/* Helpers */
|
2014-03-03 15:01:36 +01:00
|
|
|
const char * nm_connection_get_uuid (NMConnection *connection);
|
|
|
|
|
const char * nm_connection_get_id (NMConnection *connection);
|
|
|
|
|
NM_AVAILABLE_IN_0_9_10
|
|
|
|
|
const char * nm_connection_get_connection_type (NMConnection *connection);
|
2013-12-18 15:15:21 -05:00
|
|
|
|
2014-02-12 12:28:52 -05:00
|
|
|
NM_AVAILABLE_IN_0_9_10
|
2013-12-18 15:15:21 -05:00
|
|
|
char * nm_connection_get_virtual_device_description (NMConnection *connection);
|
2011-02-09 16:34:42 -06:00
|
|
|
|
2011-03-15 10:32:42 -05:00
|
|
|
NMSetting8021x * nm_connection_get_setting_802_1x (NMConnection *connection);
|
|
|
|
|
NMSettingBluetooth * nm_connection_get_setting_bluetooth (NMConnection *connection);
|
2011-10-18 13:48:42 +02:00
|
|
|
NMSettingBond * nm_connection_get_setting_bond (NMConnection *connection);
|
2014-02-12 12:28:52 -05:00
|
|
|
NM_AVAILABLE_IN_0_9_10
|
2013-07-25 15:36:45 +02:00
|
|
|
NMSettingTeam * nm_connection_get_setting_team (NMConnection *connection);
|
2014-02-12 12:28:52 -05:00
|
|
|
NM_AVAILABLE_IN_0_9_10
|
2013-07-25 15:36:46 +02:00
|
|
|
NMSettingTeamPort * nm_connection_get_setting_team_port (NMConnection *connection);
|
2012-05-23 16:19:27 +02:00
|
|
|
NMSettingBridge * nm_connection_get_setting_bridge (NMConnection *connection);
|
2012-10-29 11:01:38 -05:00
|
|
|
NMSettingBridgePort * nm_connection_get_setting_bridge_port (NMConnection *connection);
|
2011-03-15 10:32:42 -05:00
|
|
|
NMSettingCdma * nm_connection_get_setting_cdma (NMConnection *connection);
|
|
|
|
|
NMSettingConnection * nm_connection_get_setting_connection (NMConnection *connection);
|
2014-02-12 12:28:52 -05:00
|
|
|
NM_AVAILABLE_IN_0_9_10
|
2013-09-13 09:44:56 -05:00
|
|
|
NMSettingDcb * nm_connection_get_setting_dcb (NMConnection *connection);
|
2014-02-12 12:28:52 -05:00
|
|
|
NM_AVAILABLE_IN_0_9_10
|
2013-04-08 11:03:07 -04:00
|
|
|
NMSettingGeneric * nm_connection_get_setting_generic (NMConnection *connection);
|
2011-03-15 10:32:42 -05:00
|
|
|
NMSettingGsm * nm_connection_get_setting_gsm (NMConnection *connection);
|
2011-10-13 16:28:25 -04:00
|
|
|
NMSettingInfiniband * nm_connection_get_setting_infiniband (NMConnection *connection);
|
2011-03-15 10:32:42 -05:00
|
|
|
NMSettingIP4Config * nm_connection_get_setting_ip4_config (NMConnection *connection);
|
|
|
|
|
NMSettingIP6Config * nm_connection_get_setting_ip6_config (NMConnection *connection);
|
|
|
|
|
NMSettingOlpcMesh * nm_connection_get_setting_olpc_mesh (NMConnection *connection);
|
|
|
|
|
NMSettingPPP * nm_connection_get_setting_ppp (NMConnection *connection);
|
|
|
|
|
NMSettingPPPOE * nm_connection_get_setting_pppoe (NMConnection *connection);
|
2011-12-05 12:27:48 +01:00
|
|
|
NMSettingSerial * nm_connection_get_setting_serial (NMConnection *connection);
|
2011-03-15 10:32:42 -05:00
|
|
|
NMSettingVPN * nm_connection_get_setting_vpn (NMConnection *connection);
|
|
|
|
|
NMSettingWimax * nm_connection_get_setting_wimax (NMConnection *connection);
|
2011-05-17 21:03:20 +03:00
|
|
|
NMSettingAdsl * nm_connection_get_setting_adsl (NMConnection *connection);
|
2011-03-15 10:32:42 -05:00
|
|
|
NMSettingWired * nm_connection_get_setting_wired (NMConnection *connection);
|
|
|
|
|
NMSettingWireless * nm_connection_get_setting_wireless (NMConnection *connection);
|
|
|
|
|
NMSettingWirelessSecurity *nm_connection_get_setting_wireless_security (NMConnection *connection);
|
2011-12-12 22:20:56 -05:00
|
|
|
NMSettingVlan * nm_connection_get_setting_vlan (NMConnection *connection);
|
2011-03-15 10:32:42 -05:00
|
|
|
|
2007-08-09 09:19:57 +00:00
|
|
|
G_END_DECLS
|
|
|
|
|
|
2007-05-07 14:39:20 +00:00
|
|
|
#endif /* NM_CONNECTION_H */
|