Use AM_CPPFLAGS instead of INCLUDES
[platform/upstream/libsecret.git] / libsecret / secret-private.h
1 /* libsecret - GLib wrapper for Secret Service
2  *
3  * Copyright 2011 Collabora Ltd.
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Lesser General Public License as published
7  * by the Free Software Foundation; either version 2.1 of the licence or (at
8  * your option) any later version.
9  *
10  * See the included COPYING file for more information.
11  *
12  * Author: Stef Walter <stefw@gnome.org>
13  */
14
15 #ifndef __SECRET_PRIVATE_H__
16 #define __SECRET_PRIVATE_H__
17
18 #include <gio/gio.h>
19
20 #include "secret-item.h"
21 #include "secret-service.h"
22 #include "secret-value.h"
23
24 G_BEGIN_DECLS
25
26 typedef struct {
27         GAsyncResult *result;
28         GMainContext *context;
29         GMainLoop *loop;
30 } SecretSync;
31
32 typedef struct _SecretSession SecretSession;
33
34 #define              SECRET_ALIAS_PREFIX                      "/org/freedesktop/secrets/aliases/"
35
36 #define              SECRET_SERVICE_PATH                      "/org/freedesktop/secrets"
37
38 #define              SECRET_SERVICE_BUS_NAME                  "org.freedesktop.secrets"
39
40 #define              SECRET_ITEM_INTERFACE                    "org.freedesktop.Secret.Item"
41 #define              SECRET_COLLECTION_INTERFACE              "org.freedesktop.Secret.Collection"
42 #define              SECRET_PROMPT_INTERFACE                  "org.freedesktop.Secret.Prompt"
43 #define              SECRET_SERVICE_INTERFACE                 "org.freedesktop.Secret.Service"
44
45 #define              SECRET_SIGNAL_COLLECTION_CREATED "CollectionCreated"
46 #define              SECRET_SIGNAL_COLLECTION_CHANGED "CollectionChanged"
47 #define              SECRET_SIGNAL_COLLECTION_DELETED "CollectionDeleted"
48 #define              SECRET_SIGNAL_ITEM_CREATED       "ItemCreated"
49 #define              SECRET_SIGNAL_ITEM_CHANGED       "ItemChanged"
50 #define              SECRET_SIGNAL_ITEM_DELETED       "ItemDeleted"
51 #define              SECRET_PROMPT_SIGNAL_COMPLETED   "Completed"
52
53 #define              SECRET_PROPERTIES_INTERFACE              "org.freedesktop.DBus.Properties"
54
55 SecretSync *         _secret_sync_new                         (void);
56
57 void                 _secret_sync_free                        (gpointer data);
58
59 void                 _secret_sync_on_result                   (GObject *source,
60                                                                GAsyncResult *result,
61                                                                gpointer user_data);
62
63 SecretPrompt *       _secret_prompt_instance                  (SecretService *service,
64                                                                const gchar *prompt_path);
65
66 void                 _secret_util_strip_remote_error          (GError **error);
67
68 gboolean             _secret_util_propagate_error             (GSimpleAsyncResult *async,
69                                                                GError **error);
70
71 gchar *              _secret_util_parent_path                 (const gchar *path);
72
73 gboolean             _secret_util_empty_path                  (const gchar *path);
74
75 gchar *              _secret_util_collection_to_path          (const gchar *collection);
76
77 gint                 _secret_util_array_index_of              (GVariant *array,
78                                                                GVariant *value);
79
80 GType                _secret_list_get_type                    (void) G_GNUC_CONST;
81
82 GVariant *           _secret_attributes_to_variant            (GHashTable *attributes,
83                                                                const gchar *schema_name);
84
85 GHashTable *         _secret_attributes_for_variant           (GVariant *variant);
86
87 GHashTable *         _secret_attributes_copy                  (GHashTable *attributes);
88
89 gboolean             _secret_attributes_validate              (const SecretSchema *schema,
90                                                                GHashTable *attributes,
91                                                                const gchar *pretty_function,
92                                                                gboolean matching);
93
94 GVariant *           _secret_util_variant_for_properties      (GHashTable *properties);
95
96 void                 _secret_util_get_properties              (GDBusProxy *proxy,
97                                                                gpointer result_tag,
98                                                                GCancellable *cancellable,
99                                                                GAsyncReadyCallback callback,
100                                                                gpointer user_data);
101
102 gboolean             _secret_util_get_properties_finish       (GDBusProxy *proxy,
103                                                                gpointer result_tag,
104                                                                GAsyncResult *result,
105                                                                GError **error);
106
107 void                 _secret_util_set_property                (GDBusProxy *proxy,
108                                                                const gchar *property,
109                                                                GVariant *value,
110                                                                gpointer result_tag,
111                                                                GCancellable *cancellable,
112                                                                GAsyncReadyCallback callback,
113                                                                gpointer user_data);
114
115 gboolean             _secret_util_set_property_finish         (GDBusProxy *proxy,
116                                                                gpointer result_tag,
117                                                                GAsyncResult *result,
118                                                                GError **error);
119
120 gboolean             _secret_util_set_property_sync           (GDBusProxy *proxy,
121                                                                const gchar *property,
122                                                                GVariant *value,
123                                                                GCancellable *cancellable,
124                                                                GError **error);
125
126 gboolean             _secret_util_have_cached_properties      (GDBusProxy *proxy);
127
128 SecretSession *      _secret_service_get_session              (SecretService *self);
129
130 void                 _secret_service_take_session             (SecretService *self,
131                                                                SecretSession *session);
132
133 void                 _secret_service_delete_path              (SecretService *self,
134                                                                const gchar *object_path,
135                                                                gboolean is_an_item,
136                                                                GCancellable *cancellable,
137                                                                GAsyncReadyCallback callback,
138                                                                gpointer user_data);
139
140 gboolean             _secret_service_delete_path_finish       (SecretService *self,
141                                                                GAsyncResult *result,
142                                                                GError **error);
143
144 void                 _secret_service_search_for_paths_variant (SecretService *self,
145                                                                GVariant *attributes,
146                                                                GCancellable *cancellable,
147                                                                GAsyncReadyCallback callback,
148                                                                gpointer user_data);
149
150 SecretItem *         _secret_service_find_item_instance       (SecretService *self,
151                                                                const gchar *item_path);
152
153 SecretCollection *   _secret_service_find_collection_instance (SecretService *self,
154                                                                const gchar *collection_path);
155
156 SecretValue *        _secret_service_decode_get_secrets_first (SecretService *self,
157                                                                GVariant *out);
158
159 GHashTable *         _secret_service_decode_get_secrets_all   (SecretService *self,
160                                                                GVariant *out);
161
162 void                 _secret_service_xlock_paths_async        (SecretService *self,
163                                                                const gchar *method,
164                                                                const gchar **paths,
165                                                                GCancellable *cancellable,
166                                                                GAsyncReadyCallback callback,
167                                                                gpointer user_data);
168
169 gint                 _secret_service_xlock_paths_finish       (SecretService *self,
170                                                                GAsyncResult *result,
171                                                                gchar ***xlocked,
172                                                                GError **error);
173
174 void                 _secret_service_create_item_dbus_path_finish_raw  (GAsyncResult *result,
175                                                                         GError **error);
176
177 GHashTable *         _secret_collection_properties_new        (const gchar *label);
178
179 SecretItem *         _secret_collection_find_item_instance    (SecretCollection *self,
180                                                                const gchar *item_path);
181
182 gchar *              _secret_value_unref_to_password          (SecretValue *value);
183
184 gchar *              _secret_value_unref_to_string            (SecretValue *value);
185
186 void                 _secret_session_free                     (gpointer data);
187
188 const gchar *        _secret_session_get_algorithms           (SecretSession *session);
189
190 const gchar *        _secret_session_get_path                 (SecretSession *session);
191
192 void                 _secret_session_open                     (SecretService *service,
193                                                                GCancellable *cancellable,
194                                                                GAsyncReadyCallback callback,
195                                                                gpointer user_data);
196
197 gboolean             _secret_session_open_finish              (GAsyncResult *result,
198                                                                GError **error);
199
200 GVariant *           _secret_session_encode_secret            (SecretSession *session,
201                                                                SecretValue *value);
202
203 SecretValue *        _secret_session_decode_secret            (SecretSession *session,
204                                                                GVariant *encoded);
205
206 void                 _secret_item_set_cached_secret           (SecretItem *self,
207                                                                SecretValue *value);
208
209 const SecretSchema * _secret_schema_ref_if_nonstatic          (const SecretSchema *schema);
210
211 void                 _secret_schema_unref_if_nonstatic        (const SecretSchema *schema);
212
213 G_END_DECLS
214
215 #endif /* __SECRET_PRIVATE_H___ */