1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2 of the License, or (at your option) any later version.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the
15 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 * Boston, MA 02110-1301 USA.
18 * Copyright 2008 Novell, Inc.
19 * Copyright 2009 - 2011 Red Hat, Inc.
22 #ifndef NM_REMOTE_SETTINGS_H
23 #define NM_REMOTE_SETTINGS_H
26 #include <dbus/dbus-glib.h>
27 #include <nm-connection.h>
28 #include <nm-remote-connection.h>
32 #define NM_TYPE_REMOTE_SETTINGS (nm_remote_settings_get_type ())
33 #define NM_REMOTE_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_REMOTE_SETTINGS, NMRemoteSettings))
34 #define NM_REMOTE_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_REMOTE_SETTINGS, NMRemoteSettingsClass))
35 #define NM_IS_REMOTE_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_REMOTE_SETTINGS))
36 #define NM_IS_REMOTE_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_REMOTE_SETTINGS))
37 #define NM_REMOTE_SETTINGS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_REMOTE_SETTINGS, NMRemoteSettingsClass))
40 * NMRemoteSettingsError:
41 * @NM_REMOTE_SETTINGS_ERROR_UNKNOWN: unknown or unclassified error
42 * @NM_REMOTE_SETTINGS_ERROR_CONNECTION_REMOVED: the #NMRemoteConnection object
43 * was removed before it was completely initialized
44 * @NM_REMOTE_SETTINGS_ERROR_CONNECTION_UNAVAILABLE: the #NMRemoteConnection object
45 * is not visible or otherwise unreadable
46 * @NM_REMOTE_SETTINGS_ERROR_SERVICE_UNAVAILABLE: NetworkManager is not running.
49 * Describes errors that may result from operations involving a #NMRemoteSettings.
53 NM_REMOTE_SETTINGS_ERROR_UNKNOWN = 0, /*< nick=UnknownError >*/
54 NM_REMOTE_SETTINGS_ERROR_CONNECTION_REMOVED, /*< nick=ConnectionRemoved >*/
55 NM_REMOTE_SETTINGS_ERROR_CONNECTION_UNAVAILABLE, /*< nick=ConnectionUnavailable >*/
56 NM_REMOTE_SETTINGS_ERROR_SERVICE_UNAVAILABLE, /*< nick=ServiceUnavailable >*/
57 } NMRemoteSettingsError;
59 #define NM_REMOTE_SETTINGS_ERROR nm_remote_settings_error_quark ()
60 GQuark nm_remote_settings_error_quark (void);
63 #define NM_REMOTE_SETTINGS_BUS "bus"
64 #define NM_REMOTE_SETTINGS_SERVICE_RUNNING "service-running"
65 #define NM_REMOTE_SETTINGS_HOSTNAME "hostname"
66 #define NM_REMOTE_SETTINGS_CAN_MODIFY "can-modify"
68 #define NM_REMOTE_SETTINGS_NEW_CONNECTION "new-connection"
69 #define NM_REMOTE_SETTINGS_CONNECTIONS_READ "connections-read"
71 typedef struct _NMRemoteSettings NMRemoteSettings;
72 typedef struct _NMRemoteSettingsClass NMRemoteSettingsClass;
75 typedef void (*NMRemoteSettingsAddConnectionFunc) (NMRemoteSettings *settings,
76 NMRemoteConnection *connection,
80 typedef void (*NMRemoteSettingsLoadConnectionsFunc) (NMRemoteSettings *settings,
85 typedef void (*NMRemoteSettingsSaveHostnameFunc) (NMRemoteSettings *settings,
90 struct _NMRemoteSettings {
94 struct _NMRemoteSettingsClass {
98 void (*new_connection) (NMRemoteSettings *settings,
99 NMRemoteConnection *connection);
101 void (*connections_read) (NMRemoteSettings *settings);
103 /* Padding for future expansion */
104 void (*_reserved1) (void);
105 void (*_reserved2) (void);
106 void (*_reserved3) (void);
107 void (*_reserved4) (void);
108 void (*_reserved5) (void);
109 void (*_reserved6) (void);
112 GType nm_remote_settings_get_type (void);
114 NMRemoteSettings *nm_remote_settings_new (DBusGConnection *bus);
116 void nm_remote_settings_new_async (DBusGConnection *bus,
117 GCancellable *cancellable,
118 GAsyncReadyCallback callback,
120 NMRemoteSettings *nm_remote_settings_new_finish (GAsyncResult *result,
123 GSList *nm_remote_settings_list_connections (NMRemoteSettings *settings);
125 NMRemoteConnection *nm_remote_settings_get_connection_by_id (NMRemoteSettings *settings,
128 NMRemoteConnection * nm_remote_settings_get_connection_by_path (NMRemoteSettings *settings,
131 NMRemoteConnection *nm_remote_settings_get_connection_by_uuid (NMRemoteSettings *settings,
134 gboolean nm_remote_settings_add_connection (NMRemoteSettings *settings,
135 NMConnection *connection,
136 NMRemoteSettingsAddConnectionFunc callback,
139 NM_AVAILABLE_IN_0_9_10
140 gboolean nm_remote_settings_add_connection_unsaved (NMRemoteSettings *settings,
141 NMConnection *connection,
142 NMRemoteSettingsAddConnectionFunc callback,
145 NM_AVAILABLE_IN_0_9_10
146 gboolean nm_remote_settings_load_connections (NMRemoteSettings *settings,
151 NM_AVAILABLE_IN_0_9_10
152 gboolean nm_remote_settings_reload_connections (NMRemoteSettings *settings,
155 gboolean nm_remote_settings_save_hostname (NMRemoteSettings *settings,
156 const char *hostname,
157 NMRemoteSettingsSaveHostnameFunc callback,
162 #endif /* NM_REMOTE_SETTINGS_H */