Imported Upstream version 2.72.alpha
[platform/upstream/glib-networking.git] / tls / gnutls / gtlsdatabase-gnutls.h
1 /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /*
3  * GIO - GLib Input, Output and Streaming Library
4  *
5  * Copyright 2010 Collabora, Ltd.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General
18  * Public License along with this library; if not, see
19  * <http://www.gnu.org/licenses/>.
20  *
21  * In addition, when the library is used with OpenSSL, a special
22  * exception applies. Refer to the LICENSE_EXCEPTION file for details.
23  *
24  * Author: Stef Walter <stefw@collabora.co.uk>
25  */
26
27 #pragma once
28
29 #include <gio/gio.h>
30 #include <gnutls/x509.h>
31
32 #include "gtlscertificate-gnutls.h"
33
34 G_BEGIN_DECLS
35
36 #define G_TYPE_TLS_DATABASE_GNUTLS            (g_tls_database_gnutls_get_type ())
37
38 G_DECLARE_DERIVABLE_TYPE (GTlsDatabaseGnutls, g_tls_database_gnutls, G, TLS_DATABASE_GNUTLS, GTlsDatabase)
39
40 struct _GTlsDatabaseGnutlsClass
41 {
42   GTlsDatabaseClass parent_class;
43
44   gchar    *(*create_handle_for_certificate)  (GTlsDatabaseGnutls                *self,
45                                                GBytes                            *der);
46   gboolean  (*populate_trust_list)            (GTlsDatabaseGnutls                *self,
47                                                gnutls_x509_trust_list_t           trust_list,
48                                                GError                           **error);
49 };
50
51 GTlsDatabaseGnutls *g_tls_database_gnutls_new (GError **error);
52
53 gnutls_certificate_credentials_t g_tls_database_gnutls_get_credentials (GTlsDatabaseGnutls  *self,
54                                                                         GError             **error);
55
56 G_END_DECLS