Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:59:55

0001 /* GIO - GLib Input, Output and Streaming Library
0002  *
0003  * Copyright © 2010 Red Hat, Inc.
0004  * Copyright © 2015 Collabora, Ltd.
0005  *
0006  * SPDX-License-Identifier: LGPL-2.1-or-later
0007  *
0008  * This library is free software; you can redistribute it and/or
0009  * modify it under the terms of the GNU Lesser General Public
0010  * License as published by the Free Software Foundation; either
0011  * version 2.1 of the License, or (at your option) any later version.
0012  *
0013  * This library is distributed in the hope that it will be useful,
0014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0016  * Lesser General Public License for more details.
0017  *
0018  * You should have received a copy of the GNU Lesser General
0019  * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
0020  */
0021 
0022 #ifndef __G_DTLS_CONNECTION_H__
0023 #define __G_DTLS_CONNECTION_H__
0024 
0025 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
0026 #error "Only <gio/gio.h> can be included directly."
0027 #endif
0028 
0029 #include <gio/gdatagrambased.h>
0030 
0031 G_BEGIN_DECLS
0032 
0033 #define G_TYPE_DTLS_CONNECTION                (g_dtls_connection_get_type ())
0034 #define G_DTLS_CONNECTION(inst)               (G_TYPE_CHECK_INSTANCE_CAST ((inst), G_TYPE_DTLS_CONNECTION, GDtlsConnection))
0035 #define G_IS_DTLS_CONNECTION(inst)            (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_DTLS_CONNECTION))
0036 #define G_DTLS_CONNECTION_GET_INTERFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), G_TYPE_DTLS_CONNECTION, GDtlsConnectionInterface))
0037 
0038 typedef struct _GDtlsConnectionInterface GDtlsConnectionInterface;
0039 
0040 /**
0041  * GDtlsConnectionInterface:
0042  * @g_iface: The parent interface.
0043  * @accept_certificate: Check whether to accept a certificate.
0044  * @handshake: Perform a handshake operation.
0045  * @handshake_async: Start an asynchronous handshake operation.
0046  * @handshake_finish: Finish an asynchronous handshake operation.
0047  * @shutdown: Shut down one or both directions of the connection.
0048  * @shutdown_async: Start an asynchronous shutdown operation.
0049  * @shutdown_finish: Finish an asynchronous shutdown operation.
0050  * @set_advertised_protocols: Set APLN protocol list (Since: 2.60)
0051  * @get_negotiated_protocol: Get ALPN-negotiated protocol (Since: 2.60)
0052  * @get_binding_data: Retrieve TLS channel binding data (Since: 2.66)
0053  *
0054  * Virtual method table for a #GDtlsConnection implementation.
0055  *
0056  * Since: 2.48
0057  */
0058 struct _GDtlsConnectionInterface
0059 {
0060   GTypeInterface g_iface;
0061 
0062   /* signals */
0063   gboolean (*accept_certificate) (GDtlsConnection       *connection,
0064                                   GTlsCertificate       *peer_cert,
0065                                   GTlsCertificateFlags   errors);
0066 
0067   /* methods */
0068   gboolean (*handshake)          (GDtlsConnection       *conn,
0069                                   GCancellable          *cancellable,
0070                                   GError               **error);
0071 
0072   void     (*handshake_async)    (GDtlsConnection       *conn,
0073                                   int                    io_priority,
0074                                   GCancellable          *cancellable,
0075                                   GAsyncReadyCallback    callback,
0076                                   gpointer               user_data);
0077   gboolean (*handshake_finish)   (GDtlsConnection       *conn,
0078                                   GAsyncResult          *result,
0079                                   GError               **error);
0080 
0081   gboolean (*shutdown)           (GDtlsConnection       *conn,
0082                                   gboolean               shutdown_read,
0083                                   gboolean               shutdown_write,
0084                                   GCancellable          *cancellable,
0085                                   GError               **error);
0086 
0087   void     (*shutdown_async)     (GDtlsConnection       *conn,
0088                                   gboolean               shutdown_read,
0089                                   gboolean               shutdown_write,
0090                                   int                    io_priority,
0091                                   GCancellable          *cancellable,
0092                                   GAsyncReadyCallback    callback,
0093                                   gpointer               user_data);
0094   gboolean (*shutdown_finish)    (GDtlsConnection       *conn,
0095                                   GAsyncResult          *result,
0096                                   GError               **error);
0097 
0098   void (*set_advertised_protocols)        (GDtlsConnection     *conn,
0099                                            const gchar * const *protocols);
0100   const gchar *(*get_negotiated_protocol) (GDtlsConnection     *conn);
0101 
0102 G_GNUC_BEGIN_IGNORE_DEPRECATIONS
0103   gboolean  (*get_binding_data)  (GDtlsConnection         *conn,
0104                                   GTlsChannelBindingType   type,
0105                                   GByteArray              *data,
0106                                   GError                 **error);
0107 G_GNUC_END_IGNORE_DEPRECATIONS
0108 };
0109 
0110 GIO_AVAILABLE_IN_2_48
0111 GType                 g_dtls_connection_get_type                    (void) G_GNUC_CONST;
0112 
0113 GIO_AVAILABLE_IN_2_48
0114 void                  g_dtls_connection_set_database                (GDtlsConnection       *conn,
0115                                                                      GTlsDatabase          *database);
0116 GIO_AVAILABLE_IN_2_48
0117 GTlsDatabase         *g_dtls_connection_get_database                (GDtlsConnection       *conn);
0118 
0119 GIO_AVAILABLE_IN_2_48
0120 void                  g_dtls_connection_set_certificate             (GDtlsConnection       *conn,
0121                                                                      GTlsCertificate       *certificate);
0122 GIO_AVAILABLE_IN_2_48
0123 GTlsCertificate      *g_dtls_connection_get_certificate             (GDtlsConnection       *conn);
0124 
0125 GIO_AVAILABLE_IN_2_48
0126 void                  g_dtls_connection_set_interaction             (GDtlsConnection       *conn,
0127                                                                      GTlsInteraction       *interaction);
0128 GIO_AVAILABLE_IN_2_48
0129 GTlsInteraction      *g_dtls_connection_get_interaction             (GDtlsConnection       *conn);
0130 
0131 GIO_AVAILABLE_IN_2_48
0132 GTlsCertificate      *g_dtls_connection_get_peer_certificate        (GDtlsConnection       *conn);
0133 GIO_AVAILABLE_IN_2_48
0134 GTlsCertificateFlags  g_dtls_connection_get_peer_certificate_errors (GDtlsConnection       *conn);
0135 
0136 GIO_AVAILABLE_IN_2_48
0137 void                  g_dtls_connection_set_require_close_notify    (GDtlsConnection       *conn,
0138                                                                      gboolean               require_close_notify);
0139 GIO_AVAILABLE_IN_2_48
0140 gboolean              g_dtls_connection_get_require_close_notify    (GDtlsConnection       *conn);
0141 
0142 G_GNUC_BEGIN_IGNORE_DEPRECATIONS
0143 GIO_DEPRECATED_IN_2_60
0144 void                  g_dtls_connection_set_rehandshake_mode        (GDtlsConnection       *conn,
0145                                                                      GTlsRehandshakeMode    mode);
0146 GIO_DEPRECATED_IN_2_60
0147 GTlsRehandshakeMode   g_dtls_connection_get_rehandshake_mode        (GDtlsConnection       *conn);
0148 G_GNUC_END_IGNORE_DEPRECATIONS
0149 
0150 GIO_AVAILABLE_IN_2_48
0151 gboolean              g_dtls_connection_handshake                   (GDtlsConnection       *conn,
0152                                                                      GCancellable          *cancellable,
0153                                                                      GError               **error);
0154 
0155 GIO_AVAILABLE_IN_2_48
0156 void                  g_dtls_connection_handshake_async             (GDtlsConnection       *conn,
0157                                                                      int                    io_priority,
0158                                                                      GCancellable          *cancellable,
0159                                                                      GAsyncReadyCallback    callback,
0160                                                                      gpointer               user_data);
0161 GIO_AVAILABLE_IN_2_48
0162 gboolean              g_dtls_connection_handshake_finish            (GDtlsConnection       *conn,
0163                                                                      GAsyncResult          *result,
0164                                                                      GError               **error);
0165 
0166 GIO_AVAILABLE_IN_2_48
0167 gboolean              g_dtls_connection_shutdown                    (GDtlsConnection       *conn,
0168                                                                      gboolean               shutdown_read,
0169                                                                      gboolean               shutdown_write,
0170                                                                      GCancellable          *cancellable,
0171                                                                      GError               **error);
0172 
0173 GIO_AVAILABLE_IN_2_48
0174 void                  g_dtls_connection_shutdown_async              (GDtlsConnection       *conn,
0175                                                                      gboolean               shutdown_read,
0176                                                                      gboolean               shutdown_write,
0177                                                                      int                    io_priority,
0178                                                                      GCancellable          *cancellable,
0179                                                                      GAsyncReadyCallback    callback,
0180                                                                      gpointer               user_data);
0181 GIO_AVAILABLE_IN_2_48
0182 gboolean              g_dtls_connection_shutdown_finish             (GDtlsConnection       *conn,
0183                                                                      GAsyncResult          *result,
0184                                                                      GError               **error);
0185 
0186 GIO_AVAILABLE_IN_2_48
0187 gboolean              g_dtls_connection_close                       (GDtlsConnection       *conn,
0188                                                                      GCancellable          *cancellable,
0189                                                                      GError               **error);
0190 
0191 GIO_AVAILABLE_IN_2_48
0192 void                  g_dtls_connection_close_async                 (GDtlsConnection       *conn,
0193                                                                      int                    io_priority,
0194                                                                      GCancellable          *cancellable,
0195                                                                      GAsyncReadyCallback    callback,
0196                                                                      gpointer               user_data);
0197 GIO_AVAILABLE_IN_2_48
0198 gboolean              g_dtls_connection_close_finish                (GDtlsConnection       *conn,
0199                                                                      GAsyncResult          *result,
0200                                                                      GError               **error);
0201 
0202 /*< protected >*/
0203 GIO_AVAILABLE_IN_2_48
0204 gboolean              g_dtls_connection_emit_accept_certificate     (GDtlsConnection       *conn,
0205                                                                      GTlsCertificate       *peer_cert,
0206                                                                      GTlsCertificateFlags   errors);
0207 GIO_AVAILABLE_IN_2_60
0208 void                  g_dtls_connection_set_advertised_protocols    (GDtlsConnection     *conn,
0209                                                                      const gchar * const *protocols);
0210 
0211 GIO_AVAILABLE_IN_2_60
0212 const gchar *          g_dtls_connection_get_negotiated_protocol     (GDtlsConnection    *conn);
0213 
0214 G_GNUC_BEGIN_IGNORE_DEPRECATIONS
0215 GIO_AVAILABLE_IN_2_66
0216 gboolean              g_dtls_connection_get_channel_binding_data    (GDtlsConnection         *conn,
0217                                                                      GTlsChannelBindingType   type,
0218                                                                      GByteArray              *data,
0219                                                                      GError                 **error);
0220 G_GNUC_END_IGNORE_DEPRECATIONS
0221 
0222 GIO_AVAILABLE_IN_2_70
0223 GTlsProtocolVersion   g_dtls_connection_get_protocol_version        (GDtlsConnection       *conn);
0224 
0225 GIO_AVAILABLE_IN_2_70
0226 gchar *               g_dtls_connection_get_ciphersuite_name        (GDtlsConnection       *conn);
0227 
0228 G_END_DECLS
0229 
0230 #endif /* __G_DTLS_CONNECTION_H__ */