1 | /* GIO - GLib Input, Output and Streaming Library |
2 | * |
3 | * Copyright (C) 2010 Red Hat, Inc. |
4 | * Copyright © 2015 Collabora, Ltd. |
5 | * |
6 | * SPDX-License-Identifier: LGPL-2.1-or-later |
7 | * |
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. |
12 | * |
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. |
17 | * |
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/>. |
20 | */ |
21 | |
22 | #ifndef __G_TLS_BACKEND_H__ |
23 | #define __G_TLS_BACKEND_H__ |
24 | |
25 | #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) |
26 | #error "Only <gio/gio.h> can be included directly." |
27 | #endif |
28 | |
29 | #include <gio/giotypes.h> |
30 | |
31 | G_BEGIN_DECLS |
32 | |
33 | /** |
34 | * G_TLS_BACKEND_EXTENSION_POINT_NAME: |
35 | * |
36 | * Extension point for TLS functionality via #GTlsBackend. |
37 | * See [Extending GIO][extending-gio]. |
38 | */ |
39 | #define G_TLS_BACKEND_EXTENSION_POINT_NAME "gio-tls-backend" |
40 | |
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)) |
45 | |
46 | typedef struct _GTlsBackend GTlsBackend; |
47 | typedef struct _GTlsBackendInterface GTlsBackendInterface; |
48 | |
49 | /** |
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 |
61 | * |
62 | * Provides an interface for describing TLS-related types. |
63 | * |
64 | * Since: 2.28 |
65 | */ |
66 | struct _GTlsBackendInterface |
67 | { |
68 | GTypeInterface g_iface; |
69 | |
70 | /* methods */ |
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); |
80 | }; |
81 | |
82 | GIO_AVAILABLE_IN_ALL |
83 | GType g_tls_backend_get_type (void) G_GNUC_CONST; |
84 | |
85 | GIO_AVAILABLE_IN_ALL |
86 | GTlsBackend * g_tls_backend_get_default (void); |
87 | |
88 | GIO_AVAILABLE_IN_ALL |
89 | GTlsDatabase * g_tls_backend_get_default_database (GTlsBackend *backend); |
90 | GIO_AVAILABLE_IN_2_60 |
91 | void g_tls_backend_set_default_database (GTlsBackend *backend, |
92 | GTlsDatabase *database); |
93 | |
94 | GIO_AVAILABLE_IN_ALL |
95 | gboolean g_tls_backend_supports_tls (GTlsBackend *backend); |
96 | GIO_AVAILABLE_IN_2_48 |
97 | gboolean g_tls_backend_supports_dtls (GTlsBackend *backend); |
98 | |
99 | GIO_AVAILABLE_IN_ALL |
100 | GType g_tls_backend_get_certificate_type (GTlsBackend *backend); |
101 | GIO_AVAILABLE_IN_ALL |
102 | GType g_tls_backend_get_client_connection_type (GTlsBackend *backend); |
103 | GIO_AVAILABLE_IN_ALL |
104 | GType g_tls_backend_get_server_connection_type (GTlsBackend *backend); |
105 | GIO_AVAILABLE_IN_ALL |
106 | GType g_tls_backend_get_file_database_type (GTlsBackend *backend); |
107 | |
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); |
112 | |
113 | G_END_DECLS |
114 | |
115 | #endif /* __G_TLS_BACKEND_H__ */ |
116 | |