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 2007 - 2008 Novell, Inc.
19 * Copyright 2007 - 2011 Red Hat, Inc.
22 #ifndef __NM_REMOTE_CONNECTION_H__
23 #define __NM_REMOTE_CONNECTION_H__
25 #include <glib-object.h>
26 #include <dbus/dbus-glib.h>
28 #include <nm-connection.h>
32 #define NM_TYPE_REMOTE_CONNECTION (nm_remote_connection_get_type ())
33 #define NM_REMOTE_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_REMOTE_CONNECTION, NMRemoteConnection))
34 #define NM_REMOTE_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_REMOTE_CONNECTION, NMRemoteConnectionClass))
35 #define NM_IS_REMOTE_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_REMOTE_CONNECTION))
36 #define NM_IS_REMOTE_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_REMOTE_CONNECTION))
37 #define NM_REMOTE_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_REMOTE_CONNECTION, NMRemoteConnectionClass))
41 * NMRemoteConnectionError:
42 * @NM_REMOTE_CONNECTION_ERROR_UNKNOWN: unknown or unclassified error
43 * @NM_REMOTE_CONNECTION_ERROR_DISCONNECTED: dbus disconnected
46 NM_REMOTE_CONNECTION_ERROR_UNKNOWN = 0, /*< nick=UnknownError >*/
47 NM_REMOTE_CONNECTION_ERROR_DISCONNECTED, /*< nick=Disconnected >*/
48 } NMRemoteConnectionError;
50 #define NM_REMOTE_CONNECTION_ERROR (nm_remote_connection_error_quark ())
51 GQuark nm_remote_connection_error_quark (void);
54 #define NM_REMOTE_CONNECTION_UNSAVED "unsaved"
57 #define NM_REMOTE_CONNECTION_UPDATED "updated"
58 #define NM_REMOTE_CONNECTION_REMOVED "removed"
65 NMConnectionClass parent_class;
68 void (*updated) (NMRemoteConnection *connection,
69 GHashTable *new_settings);
71 void (*removed) (NMRemoteConnection *connection);
73 /* Padding for future expansion */
74 void (*_reserved1) (void);
75 void (*_reserved2) (void);
76 void (*_reserved3) (void);
77 void (*_reserved4) (void);
78 void (*_reserved5) (void);
79 void (*_reserved6) (void);
80 } NMRemoteConnectionClass;
83 * NMRemoteConnectionResultFunc:
84 * @connection: the connection for which an operation was performed
85 * @error: on failure, a descriptive error
86 * @user_data: user data passed to function which began the operation
88 * Called when NetworkManager has finished an asynchronous operation on a
89 * connection, like commit changes, deleting, saving, etc.
91 typedef void (*NMRemoteConnectionResultFunc) (NMRemoteConnection *connection,
95 /* Backwards compatibility */
96 typedef NMRemoteConnectionResultFunc NMRemoteConnectionCommitFunc;
97 typedef NMRemoteConnectionResultFunc NMRemoteConnectionDeleteFunc;
100 * NMRemoteConnectionGetSecretsFunc:
101 * @connection: the connection for which secrets were requested
102 * @secrets: (element-type utf8 GLib.HashTable): on success, a hash table of
103 * hash tables, with each inner hash mapping a setting property to a #GValue
104 * containing that property's value
105 * @error: on failure, a descriptive error
106 * @user_data: user data passed to nm_remote_connection_get_secrets()
108 * Called when NetworkManager returns secrets in response to a request for
109 * secrets via nm_remote_connection_get_secrets().
111 typedef void (*NMRemoteConnectionGetSecretsFunc) (NMRemoteConnection *connection,
116 GType nm_remote_connection_get_type (void);
118 NMRemoteConnection *nm_remote_connection_new (DBusGConnection *bus,
121 void nm_remote_connection_commit_changes (NMRemoteConnection *connection,
122 NMRemoteConnectionResultFunc callback,
125 NM_AVAILABLE_IN_0_9_10
126 void nm_remote_connection_commit_changes_unsaved (NMRemoteConnection *connection,
127 NMRemoteConnectionResultFunc callback,
130 NM_AVAILABLE_IN_0_9_10
131 void nm_remote_connection_save (NMRemoteConnection *connection,
132 NMRemoteConnectionResultFunc callback,
135 void nm_remote_connection_delete (NMRemoteConnection *connection,
136 NMRemoteConnectionResultFunc callback,
139 void nm_remote_connection_get_secrets (NMRemoteConnection *connection,
140 const char *setting_name,
141 NMRemoteConnectionGetSecretsFunc callback,
144 NM_AVAILABLE_IN_0_9_10
145 gboolean nm_remote_connection_get_unsaved (NMRemoteConnection *connection);
149 #endif /* __NM_REMOTE_CONNECTION__ */