device: renew dhcp leases on awake for software devices
[NetworkManager.git] / libnm / nm-remote-settings.h
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2 /*
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.
7  *
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.
12  *
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.
17  *
18  * Copyright 2008 Novell, Inc.
19  * Copyright 2009 - 2011 Red Hat, Inc.
20  */
21
22 #ifndef __NM_REMOTE_SETTINGS_H__
23 #define __NM_REMOTE_SETTINGS_H__
24
25 #include <nm-object.h>
26
27 G_BEGIN_DECLS
28
29 #define NM_TYPE_REMOTE_SETTINGS            (nm_remote_settings_get_type ())
30 #define NM_REMOTE_SETTINGS(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_REMOTE_SETTINGS, NMRemoteSettings))
31 #define NM_REMOTE_SETTINGS_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_REMOTE_SETTINGS, NMRemoteSettingsClass))
32 #define NM_IS_REMOTE_SETTINGS(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_REMOTE_SETTINGS))
33 #define NM_IS_REMOTE_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_REMOTE_SETTINGS))
34 #define NM_REMOTE_SETTINGS_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_REMOTE_SETTINGS, NMRemoteSettingsClass))
35
36 #define NM_REMOTE_SETTINGS_CONNECTIONS     "connections"
37 #define NM_REMOTE_SETTINGS_HOSTNAME        "hostname"
38 #define NM_REMOTE_SETTINGS_CAN_MODIFY      "can-modify"
39
40 #define NM_REMOTE_SETTINGS_CONNECTION_ADDED   "connection-added"
41 #define NM_REMOTE_SETTINGS_CONNECTION_REMOVED "connection-removed"
42
43 typedef struct _NMRemoteSettings NMRemoteSettings;
44 typedef struct _NMRemoteSettingsClass NMRemoteSettingsClass;
45
46 struct _NMRemoteSettings {
47         NMObject parent;
48 };
49
50 struct _NMRemoteSettingsClass {
51         NMObjectClass parent;
52
53         /* Signals */
54         void (*connection_added)   (NMRemoteSettings *settings,
55                                     NMRemoteConnection *connection);
56         void (*connection_removed) (NMRemoteSettings *settings,
57                                     NMRemoteConnection *connection);
58
59         /*< private >*/
60         gpointer padding[8];
61 };
62
63 GType nm_remote_settings_get_type (void);
64
65 const GPtrArray    *nm_remote_settings_get_connections        (NMRemoteSettings *settings);
66
67 NMRemoteConnection *nm_remote_settings_get_connection_by_id   (NMRemoteSettings *settings,
68                                                                const char *id);
69
70 NMRemoteConnection *nm_remote_settings_get_connection_by_path (NMRemoteSettings *settings,
71                                                                const char *path);
72
73 NMRemoteConnection *nm_remote_settings_get_connection_by_uuid (NMRemoteSettings *settings,
74                                                                const char *uuid);
75
76 void                nm_remote_settings_add_connection_async  (NMRemoteSettings *settings,
77                                                               NMConnection *connection,
78                                                               gboolean save_to_disk,
79                                                               GCancellable *cancellable,
80                                                               GAsyncReadyCallback callback,
81                                                               gpointer user_data);
82 NMRemoteConnection *nm_remote_settings_add_connection_finish (NMRemoteSettings *settings,
83                                                               GAsyncResult *result,
84                                                               GError **error);
85
86 gboolean nm_remote_settings_load_connections        (NMRemoteSettings *settings,
87                                                      char **filenames,
88                                                      char ***failures,
89                                                      GCancellable *cancellable,
90                                                      GError **error);
91 void     nm_remote_settings_load_connections_async  (NMRemoteSettings *settings,
92                                                      char **filenames,
93                                                      GCancellable *cancellable,
94                                                      GAsyncReadyCallback callback,
95                                                      gpointer user_data);
96 gboolean nm_remote_settings_load_connections_finish (NMRemoteSettings *settings,
97                                                      char ***failures,
98                                                      GAsyncResult *result,
99                                                      GError **error);
100
101 gboolean nm_remote_settings_reload_connections        (NMRemoteSettings *settings,
102                                                        GCancellable *cancellable,
103                                                        GError **error);
104 void     nm_remote_settings_reload_connections_async  (NMRemoteSettings *settings,
105                                                        GCancellable *cancellable,
106                                                        GAsyncReadyCallback callback,
107                                                        gpointer user_data);
108 gboolean nm_remote_settings_reload_connections_finish (NMRemoteSettings *settings,
109                                                        GAsyncResult *result,
110                                                        GError **error);
111
112 gboolean nm_remote_settings_save_hostname        (NMRemoteSettings *settings,
113                                                   const char *hostname,
114                                                   GCancellable *cancellable,
115                                                   GError **error);
116 void     nm_remote_settings_save_hostname_async  (NMRemoteSettings *settings,
117                                                   const char *hostname,
118                                                   GCancellable *cancellable,
119                                                   GAsyncReadyCallback callback,
120                                                   gpointer user_data);
121 gboolean nm_remote_settings_save_hostname_finish (NMRemoteSettings *settings,
122                                                   GAsyncResult *result,
123                                                   GError **error);
124
125 G_END_DECLS
126
127 #endif /* __NM_REMOTE_SETTINGS_H__ */