1 /* GIO - GLib Connection, Output and Gnutlsing Library
3 * Copyright © 2009 Red Hat, Inc.
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as published
7 * by the Free Software Foundation; either version 2 of the licence or (at
8 * your option) any later version.
10 * See the included COPYING file for more information.
13 #ifndef __G_TLS_CONNECTION_GNUTLS_H__
14 #define __G_TLS_CONNECTION_GNUTLS_H__
17 #include <gnutls/gnutls.h>
21 #define G_TYPE_TLS_CONNECTION_GNUTLS (g_tls_connection_gnutls_get_type ())
22 #define G_TLS_CONNECTION_GNUTLS(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), G_TYPE_TLS_CONNECTION_GNUTLS, GTlsConnectionGnutls))
23 #define G_TLS_CONNECTION_GNUTLS_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_TLS_CONNECTION_GNUTLS, GTlsConnectionGnutlsClass))
24 #define G_IS_TLS_CONNECTION_GNUTLS(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_TLS_CONNECTION_GNUTLS))
25 #define G_IS_TLS_CONNECTION_GNUTLS_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_TLS_CONNECTION_GNUTLS))
26 #define G_TLS_CONNECTION_GNUTLS_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), G_TYPE_TLS_CONNECTION_GNUTLS, GTlsConnectionGnutlsClass))
28 typedef struct _GTlsConnectionGnutlsPrivate GTlsConnectionGnutlsPrivate;
29 typedef struct _GTlsConnectionGnutlsClass GTlsConnectionGnutlsClass;
30 typedef struct _GTlsConnectionGnutls GTlsConnectionGnutls;
32 struct _GTlsConnectionGnutlsClass
34 GTlsConnectionClass parent_class;
36 void (*begin_handshake) (GTlsConnectionGnutls *gnutls);
37 gboolean (*verify_peer) (GTlsConnectionGnutls *gnutls,
38 GTlsCertificate *peer_certificate,
39 GTlsCertificateFlags *errors);
40 void (*finish_handshake) (GTlsConnectionGnutls *gnutls,
41 GError **inout_error);
44 struct _GTlsConnectionGnutls
46 GTlsConnection parent_instance;
47 GTlsConnectionGnutlsPrivate *priv;
50 GType g_tls_connection_gnutls_get_type (void) G_GNUC_CONST;
52 gnutls_certificate_credentials g_tls_connection_gnutls_get_credentials (GTlsConnectionGnutls *connection);
53 gnutls_session g_tls_connection_gnutls_get_session (GTlsConnectionGnutls *connection);
54 void g_tls_connection_gnutls_get_certificate (GTlsConnectionGnutls *gnutls,
57 gssize g_tls_connection_gnutls_read (GTlsConnectionGnutls *gnutls,
61 GCancellable *cancellable,
63 gssize g_tls_connection_gnutls_write (GTlsConnectionGnutls *gnutls,
67 GCancellable *cancellable,
70 gboolean g_tls_connection_gnutls_check (GTlsConnectionGnutls *gnutls,
71 GIOCondition condition);
72 GSource *g_tls_connection_gnutls_create_source (GTlsConnectionGnutls *gnutls,
73 GIOCondition condition,
74 GCancellable *cancellable);
78 #endif /* __G_TLS_CONNECTION_GNUTLS_H___ */