glib (2.79.0)

(root)/
include/
glib-2.0/
gio/
gdtlsconnection.h
       1  /* GIO - GLib Input, Output and Streaming Library
       2   *
       3   * Copyright © 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_DTLS_CONNECTION_H__
      23  #define __G_DTLS_CONNECTION_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/gdatagrambased.h>
      30  
      31  G_BEGIN_DECLS
      32  
      33  #define G_TYPE_DTLS_CONNECTION                (g_dtls_connection_get_type ())
      34  #define G_DTLS_CONNECTION(inst)               (G_TYPE_CHECK_INSTANCE_CAST ((inst), G_TYPE_DTLS_CONNECTION, GDtlsConnection))
      35  #define G_IS_DTLS_CONNECTION(inst)            (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_DTLS_CONNECTION))
      36  #define G_DTLS_CONNECTION_GET_INTERFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), G_TYPE_DTLS_CONNECTION, GDtlsConnectionInterface))
      37  
      38  typedef struct _GDtlsConnectionInterface GDtlsConnectionInterface;
      39  
      40  /**
      41   * GDtlsConnectionInterface:
      42   * @g_iface: The parent interface.
      43   * @accept_certificate: Check whether to accept a certificate.
      44   * @handshake: Perform a handshake operation.
      45   * @handshake_async: Start an asynchronous handshake operation.
      46   * @handshake_finish: Finish an asynchronous handshake operation.
      47   * @shutdown: Shut down one or both directions of the connection.
      48   * @shutdown_async: Start an asynchronous shutdown operation.
      49   * @shutdown_finish: Finish an asynchronous shutdown operation.
      50   * @set_advertised_protocols: Set APLN protocol list (Since: 2.60)
      51   * @get_negotiated_protocol: Get ALPN-negotiated protocol (Since: 2.60)
      52   * @get_binding_data: Retrieve TLS channel binding data (Since: 2.66)
      53   *
      54   * Virtual method table for a #GDtlsConnection implementation.
      55   *
      56   * Since: 2.48
      57   */
      58  struct _GDtlsConnectionInterface
      59  {
      60    GTypeInterface g_iface;
      61  
      62    /* signals */
      63    gboolean (*accept_certificate) (GDtlsConnection       *connection,
      64                                    GTlsCertificate       *peer_cert,
      65                                    GTlsCertificateFlags   errors);
      66  
      67    /* methods */
      68    gboolean (*handshake)          (GDtlsConnection       *conn,
      69                                    GCancellable          *cancellable,
      70                                    GError               **error);
      71  
      72    void     (*handshake_async)    (GDtlsConnection       *conn,
      73                                    int                    io_priority,
      74                                    GCancellable          *cancellable,
      75                                    GAsyncReadyCallback    callback,
      76                                    gpointer               user_data);
      77    gboolean (*handshake_finish)   (GDtlsConnection       *conn,
      78                                    GAsyncResult          *result,
      79                                    GError               **error);
      80  
      81    gboolean (*shutdown)           (GDtlsConnection       *conn,
      82                                    gboolean               shutdown_read,
      83                                    gboolean               shutdown_write,
      84                                    GCancellable          *cancellable,
      85                                    GError               **error);
      86  
      87    void     (*shutdown_async)     (GDtlsConnection       *conn,
      88                                    gboolean               shutdown_read,
      89                                    gboolean               shutdown_write,
      90                                    int                    io_priority,
      91                                    GCancellable          *cancellable,
      92                                    GAsyncReadyCallback    callback,
      93                                    gpointer               user_data);
      94    gboolean (*shutdown_finish)    (GDtlsConnection       *conn,
      95                                    GAsyncResult          *result,
      96                                    GError               **error);
      97  
      98    void (*set_advertised_protocols)        (GDtlsConnection     *conn,
      99                                             const gchar * const *protocols);
     100    const gchar *(*get_negotiated_protocol) (GDtlsConnection     *conn);
     101  
     102  G_GNUC_BEGIN_IGNORE_DEPRECATIONS
     103    gboolean  (*get_binding_data)  (GDtlsConnection         *conn,
     104                                    GTlsChannelBindingType   type,
     105                                    GByteArray              *data,
     106                                    GError                 **error);
     107  G_GNUC_END_IGNORE_DEPRECATIONS
     108  };
     109  
     110  GIO_AVAILABLE_IN_2_48
     111  GType                 g_dtls_connection_get_type                    (void) G_GNUC_CONST;
     112  
     113  GIO_AVAILABLE_IN_2_48
     114  void                  g_dtls_connection_set_database                (GDtlsConnection       *conn,
     115                                                                       GTlsDatabase          *database);
     116  GIO_AVAILABLE_IN_2_48
     117  GTlsDatabase         *g_dtls_connection_get_database                (GDtlsConnection       *conn);
     118  
     119  GIO_AVAILABLE_IN_2_48
     120  void                  g_dtls_connection_set_certificate             (GDtlsConnection       *conn,
     121                                                                       GTlsCertificate       *certificate);
     122  GIO_AVAILABLE_IN_2_48
     123  GTlsCertificate      *g_dtls_connection_get_certificate             (GDtlsConnection       *conn);
     124  
     125  GIO_AVAILABLE_IN_2_48
     126  void                  g_dtls_connection_set_interaction             (GDtlsConnection       *conn,
     127                                                                       GTlsInteraction       *interaction);
     128  GIO_AVAILABLE_IN_2_48
     129  GTlsInteraction      *g_dtls_connection_get_interaction             (GDtlsConnection       *conn);
     130  
     131  GIO_AVAILABLE_IN_2_48
     132  GTlsCertificate      *g_dtls_connection_get_peer_certificate        (GDtlsConnection       *conn);
     133  GIO_AVAILABLE_IN_2_48
     134  GTlsCertificateFlags  g_dtls_connection_get_peer_certificate_errors (GDtlsConnection       *conn);
     135  
     136  GIO_AVAILABLE_IN_2_48
     137  void                  g_dtls_connection_set_require_close_notify    (GDtlsConnection       *conn,
     138                                                                       gboolean               require_close_notify);
     139  GIO_AVAILABLE_IN_2_48
     140  gboolean              g_dtls_connection_get_require_close_notify    (GDtlsConnection       *conn);
     141  
     142  G_GNUC_BEGIN_IGNORE_DEPRECATIONS
     143  GIO_DEPRECATED_IN_2_60
     144  void                  g_dtls_connection_set_rehandshake_mode        (GDtlsConnection       *conn,
     145                                                                       GTlsRehandshakeMode    mode);
     146  GIO_DEPRECATED_IN_2_60
     147  GTlsRehandshakeMode   g_dtls_connection_get_rehandshake_mode        (GDtlsConnection       *conn);
     148  G_GNUC_END_IGNORE_DEPRECATIONS
     149  
     150  GIO_AVAILABLE_IN_2_48
     151  gboolean              g_dtls_connection_handshake                   (GDtlsConnection       *conn,
     152                                                                       GCancellable          *cancellable,
     153                                                                       GError               **error);
     154  
     155  GIO_AVAILABLE_IN_2_48
     156  void                  g_dtls_connection_handshake_async             (GDtlsConnection       *conn,
     157                                                                       int                    io_priority,
     158                                                                       GCancellable          *cancellable,
     159                                                                       GAsyncReadyCallback    callback,
     160                                                                       gpointer               user_data);
     161  GIO_AVAILABLE_IN_2_48
     162  gboolean              g_dtls_connection_handshake_finish            (GDtlsConnection       *conn,
     163                                                                       GAsyncResult          *result,
     164                                                                       GError               **error);
     165  
     166  GIO_AVAILABLE_IN_2_48
     167  gboolean              g_dtls_connection_shutdown                    (GDtlsConnection       *conn,
     168                                                                       gboolean               shutdown_read,
     169                                                                       gboolean               shutdown_write,
     170                                                                       GCancellable          *cancellable,
     171                                                                       GError               **error);
     172  
     173  GIO_AVAILABLE_IN_2_48
     174  void                  g_dtls_connection_shutdown_async              (GDtlsConnection       *conn,
     175                                                                       gboolean               shutdown_read,
     176                                                                       gboolean               shutdown_write,
     177                                                                       int                    io_priority,
     178                                                                       GCancellable          *cancellable,
     179                                                                       GAsyncReadyCallback    callback,
     180                                                                       gpointer               user_data);
     181  GIO_AVAILABLE_IN_2_48
     182  gboolean              g_dtls_connection_shutdown_finish             (GDtlsConnection       *conn,
     183                                                                       GAsyncResult          *result,
     184                                                                       GError               **error);
     185  
     186  GIO_AVAILABLE_IN_2_48
     187  gboolean              g_dtls_connection_close                       (GDtlsConnection       *conn,
     188                                                                       GCancellable          *cancellable,
     189                                                                       GError               **error);
     190  
     191  GIO_AVAILABLE_IN_2_48
     192  void                  g_dtls_connection_close_async                 (GDtlsConnection       *conn,
     193                                                                       int                    io_priority,
     194                                                                       GCancellable          *cancellable,
     195                                                                       GAsyncReadyCallback    callback,
     196                                                                       gpointer               user_data);
     197  GIO_AVAILABLE_IN_2_48
     198  gboolean              g_dtls_connection_close_finish                (GDtlsConnection       *conn,
     199                                                                       GAsyncResult          *result,
     200                                                                       GError               **error);
     201  
     202  /*< protected >*/
     203  GIO_AVAILABLE_IN_2_48
     204  gboolean              g_dtls_connection_emit_accept_certificate     (GDtlsConnection       *conn,
     205                                                                       GTlsCertificate       *peer_cert,
     206                                                                       GTlsCertificateFlags   errors);
     207  GIO_AVAILABLE_IN_2_60
     208  void                  g_dtls_connection_set_advertised_protocols    (GDtlsConnection     *conn,
     209                                                                       const gchar * const *protocols);
     210  
     211  GIO_AVAILABLE_IN_2_60
     212  const gchar *          g_dtls_connection_get_negotiated_protocol     (GDtlsConnection    *conn);
     213  
     214  G_GNUC_BEGIN_IGNORE_DEPRECATIONS
     215  GIO_AVAILABLE_IN_2_66
     216  gboolean              g_dtls_connection_get_channel_binding_data    (GDtlsConnection         *conn,
     217                                                                       GTlsChannelBindingType   type,
     218                                                                       GByteArray              *data,
     219                                                                       GError                 **error);
     220  G_GNUC_END_IGNORE_DEPRECATIONS
     221  
     222  GIO_AVAILABLE_IN_2_70
     223  GTlsProtocolVersion   g_dtls_connection_get_protocol_version        (GDtlsConnection       *conn);
     224  
     225  GIO_AVAILABLE_IN_2_70
     226  gchar *               g_dtls_connection_get_ciphersuite_name        (GDtlsConnection       *conn);
     227  
     228  G_END_DECLS
     229  
     230  #endif /* __G_DTLS_CONNECTION_H__ */