1 /* GIO - GLib Input, Output and Streaming Library
3 * Copyright (C) 2010 Red Hat, Inc.
4 * Copyright © 2015 Collabora, Ltd.
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 of the License, or (at your option) any later version.
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.
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/>.
20 #ifndef __G_TLS_BACKEND_H__
21 #define __G_TLS_BACKEND_H__
23 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
24 #error "Only <gio/gio.h> can be included directly."
27 #include <gio/giotypes.h>
32 * G_TLS_BACKEND_EXTENSION_POINT_NAME:
34 * Extension point for TLS functionality via #GTlsBackend.
35 * See [Extending GIO][extending-gio].
37 #define G_TLS_BACKEND_EXTENSION_POINT_NAME "gio-tls-backend"
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))
44 typedef struct _GTlsBackend GTlsBackend
;
45 typedef struct _GTlsBackendInterface GTlsBackendInterface
;
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
60 * Provides an interface for describing TLS-related types.
64 struct _GTlsBackendInterface
66 GTypeInterface g_iface
;
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);
81 GType
g_tls_backend_get_type (void) G_GNUC_CONST
;
84 GTlsBackend
* g_tls_backend_get_default (void);
87 GTlsDatabase
* g_tls_backend_get_default_database (GTlsBackend
*backend
);
90 gboolean
g_tls_backend_supports_tls (GTlsBackend
*backend
);
91 GLIB_AVAILABLE_IN_2_48
92 gboolean
g_tls_backend_supports_dtls (GTlsBackend
*backend
);
95 GType
g_tls_backend_get_certificate_type (GTlsBackend
*backend
);
97 GType
g_tls_backend_get_client_connection_type (GTlsBackend
*backend
);
99 GType
g_tls_backend_get_server_connection_type (GTlsBackend
*backend
);
100 GLIB_AVAILABLE_IN_ALL
101 GType
g_tls_backend_get_file_database_type (GTlsBackend
*backend
);
103 GLIB_AVAILABLE_IN_2_48
104 GType
g_tls_backend_get_dtls_client_connection_type (GTlsBackend
*backend
);
105 GLIB_AVAILABLE_IN_2_48
106 GType
g_tls_backend_get_dtls_server_connection_type (GTlsBackend
*backend
);
110 #endif /* __G_TLS_BACKEND_H__ */