1/* GIO - GLib Input, Output and Streaming Library
2 *
3 * Copyright (C) 2010 Red Hat, Inc.
4 * Copyright © 2015 Collabora, Ltd.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General
17 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef __G_TLS_BACKEND_H__
21#define __G_TLS_BACKEND_H__
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#include <gio/giotypes.h>
28
29G_BEGIN_DECLS
30
31/**
32 * G_TLS_BACKEND_EXTENSION_POINT_NAME:
33 *
34 * Extension point for TLS functionality via #GTlsBackend.
35 * See [Extending GIO][extending-gio].
36 */
37#define G_TLS_BACKEND_EXTENSION_POINT_NAME "gio-tls-backend"
38
39#define G_TYPE_TLS_BACKEND (g_tls_backend_get_type ())
40#define G_TLS_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_TLS_BACKEND, GTlsBackend))
41#define G_IS_TLS_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_TLS_BACKEND))
42#define G_TLS_BACKEND_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_TLS_BACKEND, GTlsBackendInterface))
43
44typedef struct _GTlsBackend GTlsBackend;
45typedef struct _GTlsBackendInterface GTlsBackendInterface;
46
47/**
48 * GTlsBackendInterface:
49 * @g_iface: The parent interface.
50 * @supports_tls: returns whether the backend supports TLS.
51 * @supports_dtls: returns whether the backend supports DTLS
52 * @get_default_database: returns a default #GTlsDatabase instance.
53 * @get_certificate_type: returns the #GTlsCertificate implementation type
54 * @get_client_connection_type: returns the #GTlsClientConnection implementation type
55 * @get_server_connection_type: returns the #GTlsServerConnection implementation type
56 * @get_file_database_type: returns the #GTlsFileDatabase implementation type.
57 * @get_dtls_client_connection_type: returns the #GDtlsClientConnection implementation type
58 * @get_dtls_server_connection_type: returns the #GDtlsServerConnection implementation type
59 *
60 * Provides an interface for describing TLS-related types.
61 *
62 * Since: 2.28
63 */
64struct _GTlsBackendInterface
65{
66 GTypeInterface g_iface;
67
68 /* methods */
69 gboolean ( *supports_tls) (GTlsBackend *backend);
70 GType ( *get_certificate_type) (void);
71 GType ( *get_client_connection_type) (void);
72 GType ( *get_server_connection_type) (void);
73 GType ( *get_file_database_type) (void);
74 GTlsDatabase * ( *get_default_database) (GTlsBackend *backend);
75 gboolean ( *supports_dtls) (GTlsBackend *backend);
76 GType ( *get_dtls_client_connection_type) (void);
77 GType ( *get_dtls_server_connection_type) (void);
78};
79
80GLIB_AVAILABLE_IN_ALL
81GType g_tls_backend_get_type (void) G_GNUC_CONST;
82
83GLIB_AVAILABLE_IN_ALL
84GTlsBackend * g_tls_backend_get_default (void);
85
86GLIB_AVAILABLE_IN_ALL
87GTlsDatabase * g_tls_backend_get_default_database (GTlsBackend *backend);
88GLIB_AVAILABLE_IN_2_60
89void g_tls_backend_set_default_database (GTlsBackend *backend,
90 GTlsDatabase *database);
91
92GLIB_AVAILABLE_IN_ALL
93gboolean g_tls_backend_supports_tls (GTlsBackend *backend);
94GLIB_AVAILABLE_IN_2_48
95gboolean g_tls_backend_supports_dtls (GTlsBackend *backend);
96
97GLIB_AVAILABLE_IN_ALL
98GType g_tls_backend_get_certificate_type (GTlsBackend *backend);
99GLIB_AVAILABLE_IN_ALL
100GType g_tls_backend_get_client_connection_type (GTlsBackend *backend);
101GLIB_AVAILABLE_IN_ALL
102GType g_tls_backend_get_server_connection_type (GTlsBackend *backend);
103GLIB_AVAILABLE_IN_ALL
104GType g_tls_backend_get_file_database_type (GTlsBackend *backend);
105
106GLIB_AVAILABLE_IN_2_48
107GType g_tls_backend_get_dtls_client_connection_type (GTlsBackend *backend);
108GLIB_AVAILABLE_IN_2_48
109GType g_tls_backend_get_dtls_server_connection_type (GTlsBackend *backend);
110
111G_END_DECLS
112
113#endif /* __G_TLS_BACKEND_H__ */
114

source code of include/glib-2.0/gio/gtlsbackend.h