1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301 USA.
19 * Copyright 2007 - 2013 Red Hat, Inc.
20 * Copyright 2007 - 2008 Novell, Inc.
23 #ifndef NM_CONNECTION_H
24 #define NM_CONNECTION_H
27 #include <glib-object.h>
28 #include <nm-setting.h>
30 #include <nm-setting-8021x.h>
31 #include <nm-setting-bluetooth.h>
32 #include <nm-setting-bond.h>
33 #include <nm-setting-team.h>
34 #include <nm-setting-team-port.h>
35 #include <nm-setting-bridge.h>
36 #include <nm-setting-bridge-port.h>
37 #include <nm-setting-cdma.h>
38 #include <nm-setting-connection.h>
39 #include <nm-setting-dcb.h>
40 #include <nm-setting-generic.h>
41 #include <nm-setting-gsm.h>
42 #include <nm-setting-infiniband.h>
43 #include <nm-setting-ip4-config.h>
44 #include <nm-setting-ip6-config.h>
45 #include <nm-setting-olpc-mesh.h>
46 #include <nm-setting-ppp.h>
47 #include <nm-setting-pppoe.h>
48 #include <nm-setting-serial.h>
49 #include <nm-setting-vpn.h>
50 #include <nm-setting-wimax.h>
51 #include <nm-setting-wired.h>
52 #include <nm-setting-adsl.h>
53 #include <nm-setting-wireless.h>
54 #include <nm-setting-wireless-security.h>
55 #include <nm-setting-vlan.h>
59 #define NM_TYPE_CONNECTION (nm_connection_get_type ())
60 #define NM_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_CONNECTION, NMConnection))
61 #define NM_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_CONNECTION, NMConnectionClass))
62 #define NM_IS_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_CONNECTION))
63 #define NM_IS_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_CONNECTION))
64 #define NM_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_CONNECTION, NMConnectionClass))
67 #define NM_CONNECTION_SECRETS_UPDATED "secrets-updated"
68 #define NM_CONNECTION_SECRETS_CLEARED "secrets-cleared"
69 #define NM_CONNECTION_CHANGED "changed"
72 #define NM_CONNECTION_PATH "path"
76 * @NM_CONNECTION_ERROR_UNKNOWN: unknown or unclassified error
77 * @NM_CONNECTION_ERROR_CONNECTION_SETTING_NOT_FOUND: the #NMConnection object
78 * did not contain the required #NMSettingConnection object, which must be
79 * present for all connections
80 * @NM_CONNECTION_ERROR_CONNECTION_TYPE_INVALID: the 'type' property of the
81 * 'connection' setting did not point to a valid connection base type; ie
82 * it was not a hardware-related setting like #NMSettingWired or
84 * @NM_CONNECTION_ERROR_SETTING_NOT_FOUND: the #NMConnection object
85 * did not contain the specified #NMSetting object
86 *@NM_CONNECTION_ERROR_INVALID_SETTING: the #NMConnection object contains
87 * a conflicting setting object
89 * Describes errors that may result from operations involving a #NMConnection.
94 NM_CONNECTION_ERROR_UNKNOWN = 0, /*< nick=UnknownError >*/
95 NM_CONNECTION_ERROR_CONNECTION_SETTING_NOT_FOUND, /*< nick=ConnectionSettingNotFound >*/
96 NM_CONNECTION_ERROR_CONNECTION_TYPE_INVALID, /*< nick=ConnectionTypeInvalid >*/
97 NM_CONNECTION_ERROR_SETTING_NOT_FOUND, /*< nick=SettingNotFound >*/
98 NM_CONNECTION_ERROR_INVALID_SETTING, /*< nick=InvalidSetting >*/
102 * NM_CONNECTION_NORMALIZE_PARAM_IP6_CONFIG_METHOD: overwrite the ip6 method
103 * when normalizing ip6 configuration. If omited, this defaults to
104 * @NM_SETTING_IP6_CONFIG_METHOD_AUTO.
106 #define NM_CONNECTION_NORMALIZE_PARAM_IP6_CONFIG_METHOD "ip6-config-method"
108 #define NM_CONNECTION_ERROR nm_connection_error_quark ()
109 GQuark nm_connection_error_quark (void);
114 * The NMConnection struct contains only private data.
115 * It should only be accessed through the functions described below.
125 void (*secrets_updated) (NMConnection *connection, const char * setting);
128 GType nm_connection_get_type (void);
130 NMConnection *nm_connection_new (void);
132 NMConnection *nm_connection_new_from_hash (GHashTable *hash, GError **error);
134 NMConnection *nm_connection_duplicate (NMConnection *connection);
136 NMSetting *nm_connection_create_setting (const char *name);
138 void nm_connection_add_setting (NMConnection *connection,
141 void nm_connection_remove_setting (NMConnection *connection,
144 NMSetting *nm_connection_get_setting (NMConnection *connection,
147 NMSetting *nm_connection_get_setting_by_name (NMConnection *connection,
150 gboolean nm_connection_replace_settings (NMConnection *connection,
151 GHashTable *new_settings,
154 NM_AVAILABLE_IN_0_9_10
155 gboolean nm_connection_replace_settings_from_connection (NMConnection *connection,
156 NMConnection *new_connection,
159 gboolean nm_connection_compare (NMConnection *a,
161 NMSettingCompareFlags flags);
163 gboolean nm_connection_diff (NMConnection *a,
165 NMSettingCompareFlags flags,
166 GHashTable **out_settings);
168 gboolean nm_connection_verify (NMConnection *connection, GError **error);
170 gboolean nm_connection_normalize (NMConnection *connection,
171 GHashTable *parameters,
175 const char * nm_connection_need_secrets (NMConnection *connection,
178 void nm_connection_clear_secrets (NMConnection *connection);
180 void nm_connection_clear_secrets_with_flags (NMConnection *connection,
181 NMSettingClearSecretsWithFlagsFn func,
184 gboolean nm_connection_update_secrets (NMConnection *connection,
185 const char *setting_name,
189 void nm_connection_set_path (NMConnection *connection,
192 const char * nm_connection_get_path (NMConnection *connection);
194 const char * nm_connection_get_virtual_iface_name (NMConnection *connection);
197 const char * nm_connection_get_interface_name (NMConnection *connection);
199 gboolean nm_connection_is_type (NMConnection *connection, const char *type);
201 void nm_connection_for_each_setting_value (NMConnection *connection,
202 NMSettingValueIterFn func,
205 GHashTable *nm_connection_to_hash (NMConnection *connection,
206 NMSettingHashFlags flags);
208 void nm_connection_dump (NMConnection *connection);
210 GType nm_connection_lookup_setting_type (const char *name);
212 GType nm_connection_lookup_setting_type_by_quark (GQuark error_quark);
215 const char * nm_connection_get_uuid (NMConnection *connection);
216 const char * nm_connection_get_id (NMConnection *connection);
217 NM_AVAILABLE_IN_0_9_10
218 const char * nm_connection_get_connection_type (NMConnection *connection);
220 NM_AVAILABLE_IN_0_9_10
221 char * nm_connection_get_virtual_device_description (NMConnection *connection);
223 NMSetting8021x * nm_connection_get_setting_802_1x (NMConnection *connection);
224 NMSettingBluetooth * nm_connection_get_setting_bluetooth (NMConnection *connection);
225 NMSettingBond * nm_connection_get_setting_bond (NMConnection *connection);
226 NM_AVAILABLE_IN_0_9_10
227 NMSettingTeam * nm_connection_get_setting_team (NMConnection *connection);
228 NM_AVAILABLE_IN_0_9_10
229 NMSettingTeamPort * nm_connection_get_setting_team_port (NMConnection *connection);
230 NMSettingBridge * nm_connection_get_setting_bridge (NMConnection *connection);
231 NMSettingBridgePort * nm_connection_get_setting_bridge_port (NMConnection *connection);
232 NMSettingCdma * nm_connection_get_setting_cdma (NMConnection *connection);
233 NMSettingConnection * nm_connection_get_setting_connection (NMConnection *connection);
234 NM_AVAILABLE_IN_0_9_10
235 NMSettingDcb * nm_connection_get_setting_dcb (NMConnection *connection);
236 NM_AVAILABLE_IN_0_9_10
237 NMSettingGeneric * nm_connection_get_setting_generic (NMConnection *connection);
238 NMSettingGsm * nm_connection_get_setting_gsm (NMConnection *connection);
239 NMSettingInfiniband * nm_connection_get_setting_infiniband (NMConnection *connection);
240 NMSettingIP4Config * nm_connection_get_setting_ip4_config (NMConnection *connection);
241 NMSettingIP6Config * nm_connection_get_setting_ip6_config (NMConnection *connection);
242 NMSettingOlpcMesh * nm_connection_get_setting_olpc_mesh (NMConnection *connection);
243 NMSettingPPP * nm_connection_get_setting_ppp (NMConnection *connection);
244 NMSettingPPPOE * nm_connection_get_setting_pppoe (NMConnection *connection);
245 NMSettingSerial * nm_connection_get_setting_serial (NMConnection *connection);
246 NMSettingVPN * nm_connection_get_setting_vpn (NMConnection *connection);
247 NMSettingWimax * nm_connection_get_setting_wimax (NMConnection *connection);
248 NMSettingAdsl * nm_connection_get_setting_adsl (NMConnection *connection);
249 NMSettingWired * nm_connection_get_setting_wired (NMConnection *connection);
250 NMSettingWireless * nm_connection_get_setting_wireless (NMConnection *connection);
251 NMSettingWirelessSecurity *nm_connection_get_setting_wireless_security (NMConnection *connection);
252 NMSettingVlan * nm_connection_get_setting_vlan (NMConnection *connection);
256 #endif /* NM_CONNECTION_H */