1 /* GIO - GLib Input, Output and Streaming Library
3 * Copyright (C) 2010 Red Hat, Inc.
4 * Copyright © 2015 Collabora, Ltd.
6 * SPDX-License-Identifier: LGPL-2.1-or-later
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General
19 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
22 #ifndef __G_TLS_BACKEND_H__
23 #define __G_TLS_BACKEND_H__
25 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
26 #error "Only <gio/gio.h> can be included directly."
29 #include <gio/giotypes.h>
34 * G_TLS_BACKEND_EXTENSION_POINT_NAME:
36 * Extension point for TLS functionality via #GTlsBackend.
37 * See [Extending GIO][extending-gio].
39 #define G_TLS_BACKEND_EXTENSION_POINT_NAME "gio-tls-backend"
41 #define G_TYPE_TLS_BACKEND (g_tls_backend_get_type ())
42 #define G_TLS_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_TLS_BACKEND, GTlsBackend))
43 #define G_IS_TLS_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_TLS_BACKEND))
44 #define G_TLS_BACKEND_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_TLS_BACKEND, GTlsBackendInterface))
46 typedef struct _GTlsBackend GTlsBackend;
47 typedef struct _GTlsBackendInterface GTlsBackendInterface;
50 * GTlsBackendInterface:
51 * @g_iface: The parent interface.
52 * @supports_tls: returns whether the backend supports TLS.
53 * @supports_dtls: returns whether the backend supports DTLS
54 * @get_default_database: returns a default #GTlsDatabase instance.
55 * @get_certificate_type: returns the #GTlsCertificate implementation type
56 * @get_client_connection_type: returns the #GTlsClientConnection implementation type
57 * @get_server_connection_type: returns the #GTlsServerConnection implementation type
58 * @get_file_database_type: returns the #GTlsFileDatabase implementation type.
59 * @get_dtls_client_connection_type: returns the #GDtlsClientConnection implementation type
60 * @get_dtls_server_connection_type: returns the #GDtlsServerConnection implementation type
62 * Provides an interface for describing TLS-related types.
66 struct _GTlsBackendInterface
68 GTypeInterface g_iface;
71 gboolean ( *supports_tls) (GTlsBackend *backend);
72 GType ( *get_certificate_type) (void);
73 GType ( *get_client_connection_type) (void);
74 GType ( *get_server_connection_type) (void);
75 GType ( *get_file_database_type) (void);
76 GTlsDatabase * ( *get_default_database) (GTlsBackend *backend);
77 gboolean ( *supports_dtls) (GTlsBackend *backend);
78 GType ( *get_dtls_client_connection_type) (void);
79 GType ( *get_dtls_server_connection_type) (void);
83 GType g_tls_backend_get_type (void) G_GNUC_CONST;
86 GTlsBackend * g_tls_backend_get_default (void);
89 GTlsDatabase * g_tls_backend_get_default_database (GTlsBackend *backend);
91 void g_tls_backend_set_default_database (GTlsBackend *backend,
92 GTlsDatabase *database);
95 gboolean g_tls_backend_supports_tls (GTlsBackend *backend);
97 gboolean g_tls_backend_supports_dtls (GTlsBackend *backend);
100 GType g_tls_backend_get_certificate_type (GTlsBackend *backend);
102 GType g_tls_backend_get_client_connection_type (GTlsBackend *backend);
104 GType g_tls_backend_get_server_connection_type (GTlsBackend *backend);
106 GType g_tls_backend_get_file_database_type (GTlsBackend *backend);
108 GIO_AVAILABLE_IN_2_48
109 GType g_tls_backend_get_dtls_client_connection_type (GTlsBackend *backend);
110 GIO_AVAILABLE_IN_2_48
111 GType g_tls_backend_get_dtls_server_connection_type (GTlsBackend *backend);
115 #endif /* __G_TLS_BACKEND_H__ */