common: make gsignond-identity-info.h private, as it's not used by anything in the...
[platform/upstream/gsignond.git] / src / daemon / db / gsignond-db-credentials-database.h
1 /* vi: set et sw=4 ts=4 cino=t0,(0: */
2 /* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 /*
4  * This file is part of gsignond
5  *
6  * Copyright (C) 2012 Intel Corporation.
7  *
8  * Contact: Imran Zaman <imran.zaman@linux.intel.com>
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 2.1 of the License, or (at your option) any later version.
14  *
15  * This library is distributed in the hope that it will be useful, but
16  * WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with this library; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
23  * 02110-1301 USA
24  */
25
26 #ifndef __GSIGNOND_DB_CREDENTIALS_DATABASE_H__
27 #define __GSIGNOND_DB_CREDENTIALS_DATABASE_H__
28
29 #include <glib.h>
30 #include <glib-object.h>
31 #include "common/gsignond-identity-info.h"
32 #include <gsignond/gsignond-config.h>
33 #include <gsignond/gsignond-secret-storage.h>
34
35 #include "gsignond-db-metadata-database.h"
36
37 G_BEGIN_DECLS
38
39 /*
40  * Type macros.
41  */
42 #define GSIGNOND_DB_TYPE_CREDENTIALS_DATABASE   \
43                                        (gsignond_db_credentials_database_get_type ())
44 #define GSIGNOND_DB_CREDENTIALS_DATABASE(obj)  (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
45                                            GSIGNOND_DB_TYPE_CREDENTIALS_DATABASE, \
46                                            GSignondDbCredentialsDatabase))
47 #define GSIGNOND_DB_IS_CREDENTIALS_DATABASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj),\
48                                            GSIGNOND_DB_TYPE_CREDENTIALS_DATABASE))
49 #define GSIGNOND_DB_CREDENTIALS_DATABASE_CLASS(klass) \
50                                             (G_TYPE_CHECK_CLASS_CAST ((klass), \
51                                              GSIGNOND_DB_TYPE_CREDENTIALS_DATABASE, \
52                                              GSignondDbCredentialsDatabaseClass))
53 #define GSIGNOND_DB_IS_CREDENTIALS_DATABASE_CLASS(klass) \
54                                             (G_TYPE_CHECK_CLASS_TYPE ((klass), \
55                                              GSIGNOND_DB_TYPE_CREDENTIALS_DATABASE))
56 #define GSIGNOND_DB_CREDENTIALS_DATABASE_GET_CLASS(obj) \
57                                             (G_TYPE_INSTANCE_GET_CLASS ((obj), \
58                                              GSIGNOND_DB_TYPE_CREDENTIALS_DATABASE, \
59                                              GSignondDbCredentialsDatabaseClass))
60
61 typedef struct _GSignondDbCredentialsDatabasePrivate
62                     GSignondDbCredentialsDatabasePrivate;
63
64 typedef struct
65 {
66     GObject parent_instance;
67
68     /*< private >*/
69     GSignondConfig *config;
70     GSignondSecretStorage *secret_storage;
71     GSignondDbCredentialsDatabasePrivate *priv;
72 } GSignondDbCredentialsDatabase;
73
74 typedef struct {
75     GObjectClass parent_class;
76
77 } GSignondDbCredentialsDatabaseClass;
78
79 /* used by GSIGNOND_DB_TYPE_CREDENTIALS_DATABASE */
80 GType
81 gsignond_db_credentials_database_get_type (void);
82
83 GSignondDbCredentialsDatabase*
84 gsignond_db_credentials_database_new (
85         GSignondConfig *config,
86         GSignondSecretStorage *storage);
87
88 gboolean
89 gsignond_db_credentials_database_open_secret_storage (
90         GSignondDbCredentialsDatabase *self);
91
92 gboolean
93 gsignond_db_credentials_database_close_secret_storage (
94         GSignondDbCredentialsDatabase *self);
95
96 gboolean
97 gsignond_db_credentials_database_is_open_secret_storage (
98         GSignondDbCredentialsDatabase *self);
99
100 gboolean
101 gsignond_db_credentials_database_clear (
102         GSignondDbCredentialsDatabase *self);
103
104 GSignondIdentityInfo *
105 gsignond_db_credentials_database_load_identity (
106         GSignondDbCredentialsDatabase *self,
107         const guint32 identity_id,
108         gboolean query_secret);
109
110 GSignondIdentityInfoList *
111 gsignond_db_credentials_database_load_identities (
112         GSignondDbCredentialsDatabase *self,
113         GSignondDictionary *filter);
114
115 guint32
116 gsignond_db_credentials_database_update_identity (
117         GSignondDbCredentialsDatabase *self,
118         GSignondIdentityInfo* identity);
119
120 gboolean
121 gsignond_db_credentials_database_remove_identity (
122         GSignondDbCredentialsDatabase *self,
123         const guint32 identity_id);
124
125 gboolean
126 gsignond_db_credentials_database_check_secret (
127         GSignondDbCredentialsDatabase *self,
128         const guint32 identity_id,
129         const gchar *username,
130         const gchar *secret);
131
132 GHashTable*
133 gsignond_db_credentials_database_load_data (
134         GSignondDbCredentialsDatabase *self,
135         const guint32 identity_id,
136         const gchar *method);
137
138 gboolean
139 gsignond_db_credentials_database_update_data (
140         GSignondDbCredentialsDatabase *self,
141         const guint32 identity_id,
142         const gchar *method,
143         GHashTable *data);
144
145 gboolean
146 gsignond_db_credentials_database_remove_data (
147         GSignondDbCredentialsDatabase *self,
148         const guint32 identity_id,
149         const gchar *method);
150
151 GList *
152 gsignond_db_credentials_database_get_methods (
153         GSignondDbCredentialsDatabase *self,
154         const guint32 identity_id,
155         GSignondSecurityContext* sec_ctx);
156
157 gboolean
158 gsignond_db_credentials_database_insert_reference (
159         GSignondDbCredentialsDatabase *self,
160         const guint32 identity_id,
161         const GSignondSecurityContext *ref_owner,
162         const gchar *reference);
163 gboolean
164 gsignond_db_credentials_database_remove_reference (
165         GSignondDbCredentialsDatabase *self,
166         const guint32 id,
167         const GSignondSecurityContext *ref_owner,
168         const gchar *reference);
169
170 GList *
171 gsignond_db_credentials_database_get_references (
172         GSignondDbCredentialsDatabase *self,
173         const guint32 id,
174         const GSignondSecurityContext *ref_owner);
175
176 GSignondSecurityContextList *
177 gsignond_db_credentials_database_get_accesscontrol_list(
178         GSignondDbCredentialsDatabase *self,
179         const guint32 identity_id);
180
181 GSignondSecurityContext *
182 gsignond_db_credentials_database_get_owner(
183         GSignondDbCredentialsDatabase *self,
184         const guint32 identity_id);
185
186 GSignondSecurityContext *
187 gsignond_db_credentials_database_get_identity_owner (
188         GSignondDbCredentialsDatabase *self,
189         const guint32 identity_id);
190
191 const GError *
192 gsignond_db_credentials_database_get_last_error (
193         GSignondDbCredentialsDatabase *self);
194
195 G_END_DECLS
196
197 #endif /* __GSIGNOND_DB_CREDENTIALS_DATABASE_H__ */
198