GSettings: deprecate 'schema' property
[platform/upstream/glib.git] / gio / gtlsdatabase.h
1 /* GIO - GLib Input, Output and Streaming Library
2  *
3  * Copyright (C) 2010 Collabora, Ltd.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General
16  * Public License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18  * Boston, MA 02111-1307, USA.
19  *
20  * Author: Stef Walter <stefw@collabora.co.uk>
21  */
22
23 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
24 #error "Only <gio/gio.h> can be included directly."
25 #endif
26
27 #ifndef __G_TLS_DATABASE_H__
28 #define __G_TLS_DATABASE_H__
29
30 #include <gio/giotypes.h>
31
32 G_BEGIN_DECLS
33
34 #define G_TLS_DATABASE_PURPOSE_AUTHENTICATE_SERVER "1.3.6.1.5.5.7.3.1"
35 #define G_TLS_DATABASE_PURPOSE_AUTHENTICATE_CLIENT "1.3.6.1.5.5.7.3.2"
36
37 #define G_TYPE_TLS_DATABASE            (g_tls_database_get_type ())
38 #define G_TLS_DATABASE(inst)           (G_TYPE_CHECK_INSTANCE_CAST ((inst), G_TYPE_TLS_DATABASE, GTlsDatabase))
39 #define G_TLS_DATABASE_CLASS(class)    (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_TLS_DATABASE, GTlsDatabaseClass))
40 #define G_IS_TLS_DATABASE(inst)        (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_TLS_DATABASE))
41 #define G_IS_TLS_DATABASE_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_TLS_DATABASE))
42 #define G_TLS_DATABASE_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), G_TYPE_TLS_DATABASE, GTlsDatabaseClass))
43
44 typedef struct _GTlsDatabaseClass   GTlsDatabaseClass;
45 typedef struct _GTlsDatabasePrivate GTlsDatabasePrivate;
46
47 struct _GTlsDatabase
48 {
49   GObject parent_instance;
50
51   GTlsDatabasePrivate *priv;
52 };
53
54 struct _GTlsDatabaseClass
55 {
56   GObjectClass parent_class;
57
58   /* virtual methods */
59
60   GTlsCertificateFlags  (*verify_chain)                         (GTlsDatabase            *self,
61                                                                  GTlsCertificate         *chain,
62                                                                  const gchar             *purpose,
63                                                                  GSocketConnectable      *identity,
64                                                                  GTlsInteraction         *interaction,
65                                                                  GTlsDatabaseVerifyFlags  flags,
66                                                                  GCancellable            *cancellable,
67                                                                  GError                 **error);
68
69   void                  (*verify_chain_async)                   (GTlsDatabase            *self,
70                                                                  GTlsCertificate         *chain,
71                                                                  const gchar             *purpose,
72                                                                  GSocketConnectable      *identity,
73                                                                  GTlsInteraction         *interaction,
74                                                                  GTlsDatabaseVerifyFlags  flags,
75                                                                  GCancellable            *cancellable,
76                                                                  GAsyncReadyCallback      callback,
77                                                                  gpointer                 user_data);
78
79   GTlsCertificateFlags  (*verify_chain_finish)                  (GTlsDatabase            *self,
80                                                                  GAsyncResult            *result,
81                                                                  GError                 **error);
82
83   gchar*                (*create_certificate_handle)            (GTlsDatabase            *self,
84                                                                  GTlsCertificate         *certificate);
85
86   GTlsCertificate*      (*lookup_certificate_for_handle)        (GTlsDatabase            *self,
87                                                                  const gchar             *handle,
88                                                                  GTlsInteraction         *interaction,
89                                                                  GTlsDatabaseLookupFlags  flags,
90                                                                  GCancellable            *cancellable,
91                                                                  GError                 **error);
92
93   void                  (*lookup_certificate_for_handle_async)  (GTlsDatabase            *self,
94                                                                  const gchar             *handle,
95                                                                  GTlsInteraction         *interaction,
96                                                                  GTlsDatabaseLookupFlags  flags,
97                                                                  GCancellable            *cancellable,
98                                                                  GAsyncReadyCallback      callback,
99                                                                  gpointer                 user_data);
100
101   GTlsCertificate*      (*lookup_certificate_for_handle_finish) (GTlsDatabase            *self,
102                                                                  GAsyncResult            *result,
103                                                                  GError                 **error);
104
105   GTlsCertificate*      (*lookup_certificate_issuer)            (GTlsDatabase            *self,
106                                                                  GTlsCertificate         *certificate,
107                                                                  GTlsInteraction         *interaction,
108                                                                  GTlsDatabaseLookupFlags  flags,
109                                                                  GCancellable            *cancellable,
110                                                                  GError                 **error);
111
112   void                  (*lookup_certificate_issuer_async)      (GTlsDatabase            *self,
113                                                                  GTlsCertificate         *certificate,
114                                                                  GTlsInteraction         *interaction,
115                                                                  GTlsDatabaseLookupFlags  flags,
116                                                                  GCancellable            *cancellable,
117                                                                  GAsyncReadyCallback      callback,
118                                                                  gpointer                 user_data);
119
120   GTlsCertificate*      (*lookup_certificate_issuer_finish)     (GTlsDatabase            *self,
121                                                                  GAsyncResult            *result,
122                                                                  GError                 **error);
123
124   GList*                (*lookup_certificates_issued_by)        (GTlsDatabase            *self,
125                                                                  GByteArray              *issuer_raw_dn,
126                                                                  GTlsInteraction         *interaction,
127                                                                  GTlsDatabaseLookupFlags  flags,
128                                                                  GCancellable            *cancellable,
129                                                                  GError                 **error);
130
131   void                  (*lookup_certificates_issued_by_async)  (GTlsDatabase            *self,
132                                                                  GByteArray              *issuer_raw_dn,
133                                                                  GTlsInteraction         *interaction,
134                                                                  GTlsDatabaseLookupFlags  flags,
135                                                                  GCancellable            *cancellable,
136                                                                  GAsyncReadyCallback      callback,
137                                                                  gpointer                 user_data);
138
139   GList*                (*lookup_certificates_issued_by_finish) (GTlsDatabase            *self,
140                                                                  GAsyncResult            *result,
141                                                                  GError                 **error);
142
143   /*< private >*/
144   /* Padding for future expansion */
145   gpointer padding[16];
146 };
147
148 GType                g_tls_database_get_type                              (void) G_GNUC_CONST;
149
150 GTlsCertificateFlags g_tls_database_verify_chain                          (GTlsDatabase            *self,
151                                                                            GTlsCertificate         *chain,
152                                                                            const gchar             *purpose,
153                                                                            GSocketConnectable      *identity,
154                                                                            GTlsInteraction         *interaction,
155                                                                            GTlsDatabaseVerifyFlags  flags,
156                                                                            GCancellable            *cancellable,
157                                                                            GError                 **error);
158
159 void                 g_tls_database_verify_chain_async                    (GTlsDatabase            *self,
160                                                                            GTlsCertificate         *chain,
161                                                                            const gchar             *purpose,
162                                                                            GSocketConnectable      *identity,
163                                                                            GTlsInteraction         *interaction,
164                                                                            GTlsDatabaseVerifyFlags  flags,
165                                                                            GCancellable            *cancellable,
166                                                                            GAsyncReadyCallback      callback,
167                                                                            gpointer                 user_data);
168
169 GTlsCertificateFlags g_tls_database_verify_chain_finish                   (GTlsDatabase            *self,
170                                                                            GAsyncResult            *result,
171                                                                            GError                 **error);
172
173 gchar*               g_tls_database_create_certificate_handle             (GTlsDatabase            *self,
174                                                                            GTlsCertificate         *certificate);
175
176 GTlsCertificate*     g_tls_database_lookup_certificate_for_handle         (GTlsDatabase            *self,
177                                                                            const gchar             *handle,
178                                                                            GTlsInteraction         *interaction,
179                                                                            GTlsDatabaseLookupFlags  flags,
180                                                                            GCancellable            *cancellable,
181                                                                            GError                 **error);
182
183 void                 g_tls_database_lookup_certificate_for_handle_async   (GTlsDatabase            *self,
184                                                                            const gchar             *handle,
185                                                                            GTlsInteraction         *interaction,
186                                                                            GTlsDatabaseLookupFlags  flags,
187                                                                            GCancellable            *cancellable,
188                                                                            GAsyncReadyCallback      callback,
189                                                                            gpointer                 user_data);
190
191 GTlsCertificate*     g_tls_database_lookup_certificate_for_handle_finish  (GTlsDatabase            *self,
192                                                                            GAsyncResult            *result,
193                                                                            GError                 **error);
194
195 GTlsCertificate*     g_tls_database_lookup_certificate_issuer             (GTlsDatabase            *self,
196                                                                            GTlsCertificate         *certificate,
197                                                                            GTlsInteraction         *interaction,
198                                                                            GTlsDatabaseLookupFlags  flags,
199                                                                            GCancellable            *cancellable,
200                                                                            GError                 **error);
201
202 void                 g_tls_database_lookup_certificate_issuer_async       (GTlsDatabase            *self,
203                                                                            GTlsCertificate         *certificate,
204                                                                            GTlsInteraction         *interaction,
205                                                                            GTlsDatabaseLookupFlags  flags,
206                                                                            GCancellable            *cancellable,
207                                                                            GAsyncReadyCallback      callback,
208                                                                            gpointer                 user_data);
209
210 GTlsCertificate*     g_tls_database_lookup_certificate_issuer_finish      (GTlsDatabase            *self,
211                                                                            GAsyncResult            *result,
212                                                                            GError                 **error);
213
214 GList*               g_tls_database_lookup_certificates_issued_by         (GTlsDatabase            *self,
215                                                                            GByteArray              *issuer_raw_dn,
216                                                                            GTlsInteraction         *interaction,
217                                                                            GTlsDatabaseLookupFlags  flags,
218                                                                            GCancellable            *cancellable,
219                                                                            GError                 **error);
220
221 void                 g_tls_database_lookup_certificates_issued_by_async    (GTlsDatabase            *self,
222                                                                             GByteArray              *issuer_raw_dn,
223                                                                             GTlsInteraction         *interaction,
224                                                                             GTlsDatabaseLookupFlags  flags,
225                                                                             GCancellable            *cancellable,
226                                                                             GAsyncReadyCallback      callback,
227                                                                             gpointer                 user_data);
228
229 GList*               g_tls_database_lookup_certificates_issued_by_finish   (GTlsDatabase            *self,
230                                                                             GAsyncResult            *result,
231                                                                             GError                 **error);
232
233 G_END_DECLS
234
235 #endif /* __G_TLS_DATABASE_H__ */