gio/gdbusaddress: Clean up Win32 code a bit
[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 #ifndef __G_TLS_DATABASE_H__
24 #define __G_TLS_DATABASE_H__
25
26 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
27 #error "Only <gio/gio.h> can be included directly."
28 #endif
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 GLIB_AVAILABLE_IN_ALL
149 GType                g_tls_database_get_type                              (void) G_GNUC_CONST;
150
151 GLIB_AVAILABLE_IN_ALL
152 GTlsCertificateFlags g_tls_database_verify_chain                          (GTlsDatabase            *self,
153                                                                            GTlsCertificate         *chain,
154                                                                            const gchar             *purpose,
155                                                                            GSocketConnectable      *identity,
156                                                                            GTlsInteraction         *interaction,
157                                                                            GTlsDatabaseVerifyFlags  flags,
158                                                                            GCancellable            *cancellable,
159                                                                            GError                 **error);
160
161 GLIB_AVAILABLE_IN_ALL
162 void                 g_tls_database_verify_chain_async                    (GTlsDatabase            *self,
163                                                                            GTlsCertificate         *chain,
164                                                                            const gchar             *purpose,
165                                                                            GSocketConnectable      *identity,
166                                                                            GTlsInteraction         *interaction,
167                                                                            GTlsDatabaseVerifyFlags  flags,
168                                                                            GCancellable            *cancellable,
169                                                                            GAsyncReadyCallback      callback,
170                                                                            gpointer                 user_data);
171
172 GLIB_AVAILABLE_IN_ALL
173 GTlsCertificateFlags g_tls_database_verify_chain_finish                   (GTlsDatabase            *self,
174                                                                            GAsyncResult            *result,
175                                                                            GError                 **error);
176
177 GLIB_AVAILABLE_IN_ALL
178 gchar*               g_tls_database_create_certificate_handle             (GTlsDatabase            *self,
179                                                                            GTlsCertificate         *certificate);
180
181 GLIB_AVAILABLE_IN_ALL
182 GTlsCertificate*     g_tls_database_lookup_certificate_for_handle         (GTlsDatabase            *self,
183                                                                            const gchar             *handle,
184                                                                            GTlsInteraction         *interaction,
185                                                                            GTlsDatabaseLookupFlags  flags,
186                                                                            GCancellable            *cancellable,
187                                                                            GError                 **error);
188
189 GLIB_AVAILABLE_IN_ALL
190 void                 g_tls_database_lookup_certificate_for_handle_async   (GTlsDatabase            *self,
191                                                                            const gchar             *handle,
192                                                                            GTlsInteraction         *interaction,
193                                                                            GTlsDatabaseLookupFlags  flags,
194                                                                            GCancellable            *cancellable,
195                                                                            GAsyncReadyCallback      callback,
196                                                                            gpointer                 user_data);
197
198 GLIB_AVAILABLE_IN_ALL
199 GTlsCertificate*     g_tls_database_lookup_certificate_for_handle_finish  (GTlsDatabase            *self,
200                                                                            GAsyncResult            *result,
201                                                                            GError                 **error);
202
203 GLIB_AVAILABLE_IN_ALL
204 GTlsCertificate*     g_tls_database_lookup_certificate_issuer             (GTlsDatabase            *self,
205                                                                            GTlsCertificate         *certificate,
206                                                                            GTlsInteraction         *interaction,
207                                                                            GTlsDatabaseLookupFlags  flags,
208                                                                            GCancellable            *cancellable,
209                                                                            GError                 **error);
210
211 GLIB_AVAILABLE_IN_ALL
212 void                 g_tls_database_lookup_certificate_issuer_async       (GTlsDatabase            *self,
213                                                                            GTlsCertificate         *certificate,
214                                                                            GTlsInteraction         *interaction,
215                                                                            GTlsDatabaseLookupFlags  flags,
216                                                                            GCancellable            *cancellable,
217                                                                            GAsyncReadyCallback      callback,
218                                                                            gpointer                 user_data);
219
220 GLIB_AVAILABLE_IN_ALL
221 GTlsCertificate*     g_tls_database_lookup_certificate_issuer_finish      (GTlsDatabase            *self,
222                                                                            GAsyncResult            *result,
223                                                                            GError                 **error);
224
225 GLIB_AVAILABLE_IN_ALL
226 GList*               g_tls_database_lookup_certificates_issued_by         (GTlsDatabase            *self,
227                                                                            GByteArray              *issuer_raw_dn,
228                                                                            GTlsInteraction         *interaction,
229                                                                            GTlsDatabaseLookupFlags  flags,
230                                                                            GCancellable            *cancellable,
231                                                                            GError                 **error);
232
233 GLIB_AVAILABLE_IN_ALL
234 void                 g_tls_database_lookup_certificates_issued_by_async    (GTlsDatabase            *self,
235                                                                             GByteArray              *issuer_raw_dn,
236                                                                             GTlsInteraction         *interaction,
237                                                                             GTlsDatabaseLookupFlags  flags,
238                                                                             GCancellable            *cancellable,
239                                                                             GAsyncReadyCallback      callback,
240                                                                             gpointer                 user_data);
241
242 GLIB_AVAILABLE_IN_ALL
243 GList*               g_tls_database_lookup_certificates_issued_by_finish   (GTlsDatabase            *self,
244                                                                             GAsyncResult            *result,
245                                                                             GError                 **error);
246
247 G_END_DECLS
248
249 #endif /* __G_TLS_DATABASE_H__ */