Cleanup setting of 'sysroot' in common.gypi
[chromium-blink-merge.git] / third_party / libsecret / secret-service.h
blobe35f4150318f01cbacacec9cbb48dd43dddcdc4b
1 /* libsecret - GLib wrapper for Secret Service
3 * Copyright 2011 Collabora Ltd.
4 * Copyright 2012 Red Hat Inc.
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published
8 * by the Free Software Foundation; either version 2.1 of the licence or (at
9 * your option) any later version.
11 * See the included COPYING file for more information.
13 * Author: Stef Walter <stefw@gnome.org>
16 #if !defined (__SECRET_INSIDE_HEADER__) && !defined (SECRET_COMPILATION)
17 #error "Only <libsecret/secret.h> can be included directly."
18 #endif
20 #ifndef __SECRET_SERVICE_H__
21 #define __SECRET_SERVICE_H__
23 #include <gio/gio.h>
25 #include "secret-prompt.h"
26 #include "secret-schema.h"
27 #include "secret-types.h"
28 #include "secret-value.h"
30 G_BEGIN_DECLS
32 typedef enum {
33 SECRET_SERVICE_NONE = 0,
34 SECRET_SERVICE_OPEN_SESSION = 1 << 1,
35 SECRET_SERVICE_LOAD_COLLECTIONS = 1 << 2,
36 } SecretServiceFlags;
38 typedef enum {
39 SECRET_SEARCH_NONE = 0,
40 SECRET_SEARCH_ALL = 1 << 1,
41 SECRET_SEARCH_UNLOCK = 1 << 2,
42 SECRET_SEARCH_LOAD_SECRETS = 1 << 3,
43 } SecretSearchFlags;
45 #define SECRET_TYPE_SERVICE (secret_service_get_type ())
46 #define SECRET_SERVICE(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), SECRET_TYPE_SERVICE, SecretService))
47 #define SECRET_SERVICE_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), SECRET_TYPE_SERVICE, SecretServiceClass))
48 #define SECRET_IS_SERVICE(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), SECRET_TYPE_SERVICE))
49 #define SECRET_IS_SERVICE_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), SECRET_TYPE_SERVICE))
50 #define SECRET_SERVICE_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), SECRET_TYPE_SERVICE, SecretServiceClass))
52 typedef struct _SecretCollection SecretCollection;
53 typedef struct _SecretService SecretService;
54 typedef struct _SecretServiceClass SecretServiceClass;
55 typedef struct _SecretServicePrivate SecretServicePrivate;
57 struct _SecretService {
58 GDBusProxy parent;
60 /*< private >*/
61 SecretServicePrivate *pv;
64 struct _SecretServiceClass {
65 GDBusProxyClass parent_class;
67 GType collection_gtype;
68 GType item_gtype;
70 GVariant * (* prompt_sync) (SecretService *self,
71 SecretPrompt *prompt,
72 GCancellable *cancellable,
73 const GVariantType *return_type,
74 GError **error);
76 void (* prompt_async) (SecretService *self,
77 SecretPrompt *prompt,
78 const GVariantType *return_type,
79 GCancellable *cancellable,
80 GAsyncReadyCallback callback,
81 gpointer user_data);
83 GVariant * (* prompt_finish) (SecretService *self,
84 GAsyncResult *result,
85 GError **error);
87 GType (* get_collection_gtype) (SecretService *self);
89 GType (* get_item_gtype) (SecretService *self);
91 /*< private >*/
92 gpointer padding[14];
95 GType secret_service_get_type (void) G_GNUC_CONST;
97 GType secret_service_get_collection_gtype (SecretService *self);
99 GType secret_service_get_item_gtype (SecretService *self);
101 void secret_service_get (SecretServiceFlags flags,
102 GCancellable *cancellable,
103 GAsyncReadyCallback callback,
104 gpointer user_data);
106 SecretService * secret_service_get_finish (GAsyncResult *result,
107 GError **error);
109 SecretService * secret_service_get_sync (SecretServiceFlags flags,
110 GCancellable *cancellable,
111 GError **error);
113 void secret_service_disconnect (void);
115 void secret_service_open (GType service_gtype,
116 const gchar *service_bus_name,
117 SecretServiceFlags flags,
118 GCancellable *cancellable,
119 GAsyncReadyCallback callback,
120 gpointer user_data);
122 SecretService * secret_service_open_finish (GAsyncResult *result,
123 GError **error);
125 SecretService * secret_service_open_sync (GType service_gtype,
126 const gchar *service_bus_name,
127 SecretServiceFlags flags,
128 GCancellable *cancellable,
129 GError **error);
131 SecretServiceFlags secret_service_get_flags (SecretService *self);
133 const gchar * secret_service_get_session_algorithms (SecretService *self);
135 GList * secret_service_get_collections (SecretService *self);
137 void secret_service_ensure_session (SecretService *self,
138 GCancellable *cancellable,
139 GAsyncReadyCallback callback,
140 gpointer user_data);
142 gboolean secret_service_ensure_session_finish (SecretService *self,
143 GAsyncResult *result,
144 GError **error);
146 gboolean secret_service_ensure_session_sync (SecretService *self,
147 GCancellable *cancellable,
148 GError **error);
150 void secret_service_load_collections (SecretService *self,
151 GCancellable *cancellable,
152 GAsyncReadyCallback callback,
153 gpointer user_data);
155 gboolean secret_service_load_collections_finish (SecretService *self,
156 GAsyncResult *result,
157 GError **error);
159 gboolean secret_service_load_collections_sync (SecretService *self,
160 GCancellable *cancellable,
161 GError **error);
163 GVariant * secret_service_prompt_sync (SecretService *self,
164 SecretPrompt *prompt,
165 GCancellable *cancellable,
166 const GVariantType *return_type,
167 GError **error);
169 void secret_service_prompt (SecretService *self,
170 SecretPrompt *prompt,
171 const GVariantType *return_type,
172 GCancellable *cancellable,
173 GAsyncReadyCallback callback,
174 gpointer user_data);
176 GVariant * secret_service_prompt_finish (SecretService *self,
177 GAsyncResult *result,
178 GError **error);
180 void secret_service_search (SecretService *service,
181 const SecretSchema *schema,
182 GHashTable *attributes,
183 SecretSearchFlags flags,
184 GCancellable *cancellable,
185 GAsyncReadyCallback callback,
186 gpointer user_data);
188 GList * secret_service_search_finish (SecretService *service,
189 GAsyncResult *result,
190 GError **error);
192 GList * secret_service_search_sync (SecretService *service,
193 const SecretSchema *schema,
194 GHashTable *attributes,
195 SecretSearchFlags flags,
196 GCancellable *cancellable,
197 GError **error);
199 void secret_service_lock (SecretService *service,
200 GList *objects,
201 GCancellable *cancellable,
202 GAsyncReadyCallback callback,
203 gpointer user_data);
205 gint secret_service_lock_finish (SecretService *service,
206 GAsyncResult *result,
207 GList **locked,
208 GError **error);
210 gint secret_service_lock_sync (SecretService *service,
211 GList *objects,
212 GCancellable *cancellable,
213 GList **locked,
214 GError **error);
216 void secret_service_unlock (SecretService *service,
217 GList *objects,
218 GCancellable *cancellable,
219 GAsyncReadyCallback callback,
220 gpointer user_data);
222 gint secret_service_unlock_finish (SecretService *service,
223 GAsyncResult *result,
224 GList **unlocked,
225 GError **error);
227 gint secret_service_unlock_sync (SecretService *service,
228 GList *objects,
229 GCancellable *cancellable,
230 GList **unlocked,
231 GError **error);
233 void secret_service_store (SecretService *service,
234 const SecretSchema *schema,
235 GHashTable *attributes,
236 const gchar *collection,
237 const gchar *label,
238 SecretValue *value,
239 GCancellable *cancellable,
240 GAsyncReadyCallback callback,
241 gpointer user_data);
243 gboolean secret_service_store_finish (SecretService *service,
244 GAsyncResult *result,
245 GError **error);
247 gboolean secret_service_store_sync (SecretService *service,
248 const SecretSchema *schema,
249 GHashTable *attributes,
250 const gchar *collection,
251 const gchar *label,
252 SecretValue *value,
253 GCancellable *cancellable,
254 GError **error);
256 void secret_service_lookup (SecretService *service,
257 const SecretSchema *schema,
258 GHashTable *attributes,
259 GCancellable *cancellable,
260 GAsyncReadyCallback callback,
261 gpointer user_data);
263 SecretValue * secret_service_lookup_finish (SecretService *service,
264 GAsyncResult *result,
265 GError **error);
267 SecretValue * secret_service_lookup_sync (SecretService *service,
268 const SecretSchema *schema,
269 GHashTable *attributes,
270 GCancellable *cancellable,
271 GError **error);
273 void secret_service_clear (SecretService *service,
274 const SecretSchema *schema,
275 GHashTable *attributes,
276 GCancellable *cancellable,
277 GAsyncReadyCallback callback,
278 gpointer user_data);
280 gboolean secret_service_clear_finish (SecretService *service,
281 GAsyncResult *result,
282 GError **error);
284 gboolean secret_service_clear_sync (SecretService *service,
285 const SecretSchema *schema,
286 GHashTable *attributes,
287 GCancellable *cancellable,
288 GError **error);
290 void secret_service_set_alias (SecretService *service,
291 const gchar *alias,
292 SecretCollection *collection,
293 GCancellable *cancellable,
294 GAsyncReadyCallback callback,
295 gpointer user_data);
297 gboolean secret_service_set_alias_finish (SecretService *service,
298 GAsyncResult *result,
299 GError **error);
301 gboolean secret_service_set_alias_sync (SecretService *service,
302 const gchar *alias,
303 SecretCollection *collection,
304 GCancellable *cancellable,
305 GError **error);
307 G_END_DECLS
309 #endif /* __SECRET_SERVICE_H___ */