Imported Upstream version 2.34.0
[platform/upstream/glib-networking.git] / tls / gnutls / gtlsbackend-gnutls.h
1 /* GIO - GLib Input, Output and Streaming Library
2  *
3  * Copyright 2010 Red Hat, Inc.
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 of the licence or (at
8  * your option) any later version.
9  *
10  * See the included COPYING file for more information.
11  */
12
13 #ifndef __G_TLS_BACKEND_GNUTLS_H__
14 #define __G_TLS_BACKEND_GNUTLS_H__
15
16 #include <gio/gio.h>
17 #include <gnutls/gnutls.h>
18
19 G_BEGIN_DECLS
20
21 #define G_TYPE_TLS_BACKEND_GNUTLS            (g_tls_backend_gnutls_get_type ())
22 #define G_TLS_BACKEND_GNUTLS(inst)           (G_TYPE_CHECK_INSTANCE_CAST ((inst), G_TYPE_TLS_BACKEND_GNUTLS, GTlsBackendGnutls))
23 #define G_TLS_BACKEND_GNUTLS_CLASS(class)    (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_TLS_BACKEND_GNUTLS, GTlsBackendGnutlsClass))
24 #define G_IS_TLS_BACKEND_GNUTLS(inst)        (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_TLS_BACKEND_GNUTLS))
25 #define G_IS_TLS_BACKEND_GNUTLS_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_TLS_BACKEND_GNUTLS))
26 #define G_TLS_BACKEND_GNUTLS_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), G_TYPE_TLS_BACKEND_GNUTLS, GTlsBackendGnutlsClass))
27
28 typedef struct _GTlsBackendGnutls        GTlsBackendGnutls;
29 typedef struct _GTlsBackendGnutlsClass   GTlsBackendGnutlsClass;
30 typedef struct _GTlsBackendGnutlsPrivate GTlsBackendGnutlsPrivate;
31
32 struct _GTlsBackendGnutlsClass
33 {
34   GObjectClass parent_class;
35
36   GTlsDatabase*   (*create_database)      (GTlsBackendGnutls          *self,
37                                            GError                    **error);
38 };
39
40 struct _GTlsBackendGnutls
41 {
42   GObject parent_instance;
43   GTlsBackendGnutlsPrivate *priv;
44 };
45
46 GType g_tls_backend_gnutls_get_type (void) G_GNUC_CONST;
47 void  g_tls_backend_gnutls_register (GIOModule *module);
48
49 void    g_tls_backend_gnutls_store_session  (gnutls_connection_end_t  type,
50                                              GBytes                  *session_id,
51                                              GBytes                  *session_data);
52 void    g_tls_backend_gnutls_remove_session (gnutls_connection_end_t  type,
53                                              GBytes                  *session_id);
54 GBytes *g_tls_backend_gnutls_lookup_session (gnutls_connection_end_t  type,
55                                              GBytes                  *session_id);
56
57 G_END_DECLS
58
59 #endif /* __G_TLS_BACKEND_GNUTLS_H___ */