meson: work around meson not passing on the threads dependency when link_with is...
[glib.git] / gio / gdtlsconnection.h
blob207b6dfde86c99f1e1add8b06506e2ca838d1413
1 /* GIO - GLib Input, Output and Streaming Library
3 * Copyright © 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.1 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_DTLS_CONNECTION_H__
21 #define __G_DTLS_CONNECTION_H__
23 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
24 #error "Only <gio/gio.h> can be included directly."
25 #endif
27 #include <gio/gdatagrambased.h>
29 G_BEGIN_DECLS
31 #define G_TYPE_DTLS_CONNECTION (g_dtls_connection_get_type ())
32 #define G_DTLS_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), G_TYPE_DTLS_CONNECTION, GDtlsConnection))
33 #define G_IS_DTLS_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_DTLS_CONNECTION))
34 #define G_DTLS_CONNECTION_GET_INTERFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), G_TYPE_DTLS_CONNECTION, GDtlsConnectionInterface))
36 typedef struct _GDtlsConnectionInterface GDtlsConnectionInterface;
38 /**
39 * GDtlsConnectionInterface:
40 * @g_iface: The parent interface.
41 * @accept_certificate: Check whether to accept a certificate.
42 * @handshake: Perform a handshake operation.
43 * @handshake_async: Start an asynchronous handshake operation.
44 * @handshake_finish: Finish an asynchronous handshake operation.
45 * @shutdown: Shut down one or both directions of the connection.
46 * @shutdown_async: Start an asynchronous shutdown operation.
47 * @shutdown_finish: Finish an asynchronous shutdown operation.
49 * Virtual method table for a #GDtlsConnection implementation.
51 * Since: 2.48
53 struct _GDtlsConnectionInterface
55 GTypeInterface g_iface;
57 /* signals */
58 gboolean (*accept_certificate) (GDtlsConnection *connection,
59 GTlsCertificate *peer_cert,
60 GTlsCertificateFlags errors);
62 /* methods */
63 gboolean (*handshake) (GDtlsConnection *conn,
64 GCancellable *cancellable,
65 GError **error);
67 void (*handshake_async) (GDtlsConnection *conn,
68 int io_priority,
69 GCancellable *cancellable,
70 GAsyncReadyCallback callback,
71 gpointer user_data);
72 gboolean (*handshake_finish) (GDtlsConnection *conn,
73 GAsyncResult *result,
74 GError **error);
76 gboolean (*shutdown) (GDtlsConnection *conn,
77 gboolean shutdown_read,
78 gboolean shutdown_write,
79 GCancellable *cancellable,
80 GError **error);
82 void (*shutdown_async) (GDtlsConnection *conn,
83 gboolean shutdown_read,
84 gboolean shutdown_write,
85 int io_priority,
86 GCancellable *cancellable,
87 GAsyncReadyCallback callback,
88 gpointer user_data);
89 gboolean (*shutdown_finish) (GDtlsConnection *conn,
90 GAsyncResult *result,
91 GError **error);
94 GLIB_AVAILABLE_IN_2_48
95 GType g_dtls_connection_get_type (void) G_GNUC_CONST;
97 GLIB_AVAILABLE_IN_2_48
98 void g_dtls_connection_set_database (GDtlsConnection *conn,
99 GTlsDatabase *database);
100 GLIB_AVAILABLE_IN_2_48
101 GTlsDatabase *g_dtls_connection_get_database (GDtlsConnection *conn);
103 GLIB_AVAILABLE_IN_2_48
104 void g_dtls_connection_set_certificate (GDtlsConnection *conn,
105 GTlsCertificate *certificate);
106 GLIB_AVAILABLE_IN_2_48
107 GTlsCertificate *g_dtls_connection_get_certificate (GDtlsConnection *conn);
109 GLIB_AVAILABLE_IN_2_48
110 void g_dtls_connection_set_interaction (GDtlsConnection *conn,
111 GTlsInteraction *interaction);
112 GLIB_AVAILABLE_IN_2_48
113 GTlsInteraction *g_dtls_connection_get_interaction (GDtlsConnection *conn);
115 GLIB_AVAILABLE_IN_2_48
116 GTlsCertificate *g_dtls_connection_get_peer_certificate (GDtlsConnection *conn);
117 GLIB_AVAILABLE_IN_2_48
118 GTlsCertificateFlags g_dtls_connection_get_peer_certificate_errors (GDtlsConnection *conn);
120 GLIB_AVAILABLE_IN_2_48
121 void g_dtls_connection_set_require_close_notify (GDtlsConnection *conn,
122 gboolean require_close_notify);
123 GLIB_AVAILABLE_IN_2_48
124 gboolean g_dtls_connection_get_require_close_notify (GDtlsConnection *conn);
126 GLIB_AVAILABLE_IN_2_48
127 void g_dtls_connection_set_rehandshake_mode (GDtlsConnection *conn,
128 GTlsRehandshakeMode mode);
129 GLIB_AVAILABLE_IN_2_48
130 GTlsRehandshakeMode g_dtls_connection_get_rehandshake_mode (GDtlsConnection *conn);
132 GLIB_AVAILABLE_IN_2_48
133 gboolean g_dtls_connection_handshake (GDtlsConnection *conn,
134 GCancellable *cancellable,
135 GError **error);
137 GLIB_AVAILABLE_IN_2_48
138 void g_dtls_connection_handshake_async (GDtlsConnection *conn,
139 int io_priority,
140 GCancellable *cancellable,
141 GAsyncReadyCallback callback,
142 gpointer user_data);
143 GLIB_AVAILABLE_IN_2_48
144 gboolean g_dtls_connection_handshake_finish (GDtlsConnection *conn,
145 GAsyncResult *result,
146 GError **error);
148 GLIB_AVAILABLE_IN_2_48
149 gboolean g_dtls_connection_shutdown (GDtlsConnection *conn,
150 gboolean shutdown_read,
151 gboolean shutdown_write,
152 GCancellable *cancellable,
153 GError **error);
155 GLIB_AVAILABLE_IN_2_48
156 void g_dtls_connection_shutdown_async (GDtlsConnection *conn,
157 gboolean shutdown_read,
158 gboolean shutdown_write,
159 int io_priority,
160 GCancellable *cancellable,
161 GAsyncReadyCallback callback,
162 gpointer user_data);
163 GLIB_AVAILABLE_IN_2_48
164 gboolean g_dtls_connection_shutdown_finish (GDtlsConnection *conn,
165 GAsyncResult *result,
166 GError **error);
168 GLIB_AVAILABLE_IN_2_48
169 gboolean g_dtls_connection_close (GDtlsConnection *conn,
170 GCancellable *cancellable,
171 GError **error);
173 GLIB_AVAILABLE_IN_2_48
174 void g_dtls_connection_close_async (GDtlsConnection *conn,
175 int io_priority,
176 GCancellable *cancellable,
177 GAsyncReadyCallback callback,
178 gpointer user_data);
179 GLIB_AVAILABLE_IN_2_48
180 gboolean g_dtls_connection_close_finish (GDtlsConnection *conn,
181 GAsyncResult *result,
182 GError **error);
184 /*< protected >*/
185 GLIB_AVAILABLE_IN_2_48
186 gboolean g_dtls_connection_emit_accept_certificate (GDtlsConnection *conn,
187 GTlsCertificate *peer_cert,
188 GTlsCertificateFlags errors);
189 G_END_DECLS
191 #endif /* __G_DTLS_CONNECTION_H__ */