Update German translation
[glib.git] / gio / gtlsconnection.h
blob15b29aa8639450e3af0b4459edcb89baa6dd48e0
1 /* GIO - GLib Input, Output and Streaming Library
3 * Copyright (C) 2010 Red Hat, Inc.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General
16 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
19 #ifndef __G_TLS_CONNECTION_H__
20 #define __G_TLS_CONNECTION_H__
22 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
23 #error "Only <gio/gio.h> can be included directly."
24 #endif
26 #include <gio/giostream.h>
28 G_BEGIN_DECLS
30 #define G_TYPE_TLS_CONNECTION (g_tls_connection_get_type ())
31 #define G_TLS_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), G_TYPE_TLS_CONNECTION, GTlsConnection))
32 #define G_TLS_CONNECTION_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_TLS_CONNECTION, GTlsConnectionClass))
33 #define G_IS_TLS_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_TLS_CONNECTION))
34 #define G_IS_TLS_CONNECTION_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_TLS_CONNECTION))
35 #define G_TLS_CONNECTION_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), G_TYPE_TLS_CONNECTION, GTlsConnectionClass))
37 typedef struct _GTlsConnectionClass GTlsConnectionClass;
38 typedef struct _GTlsConnectionPrivate GTlsConnectionPrivate;
40 struct _GTlsConnection {
41 GIOStream parent_instance;
43 GTlsConnectionPrivate *priv;
46 struct _GTlsConnectionClass
48 GIOStreamClass parent_class;
50 /* signals */
51 gboolean ( *accept_certificate) (GTlsConnection *connection,
52 GTlsCertificate *peer_cert,
53 GTlsCertificateFlags errors);
55 /* methods */
56 gboolean ( *handshake ) (GTlsConnection *conn,
57 GCancellable *cancellable,
58 GError **error);
60 void ( *handshake_async ) (GTlsConnection *conn,
61 int io_priority,
62 GCancellable *cancellable,
63 GAsyncReadyCallback callback,
64 gpointer user_data);
65 gboolean ( *handshake_finish ) (GTlsConnection *conn,
66 GAsyncResult *result,
67 GError **error);
69 /*< private >*/
70 /* Padding for future expansion */
71 gpointer padding[8];
74 GLIB_AVAILABLE_IN_ALL
75 GType g_tls_connection_get_type (void) G_GNUC_CONST;
77 GLIB_DEPRECATED
78 void g_tls_connection_set_use_system_certdb (GTlsConnection *conn,
79 gboolean use_system_certdb);
80 GLIB_DEPRECATED
81 gboolean g_tls_connection_get_use_system_certdb (GTlsConnection *conn);
83 GLIB_AVAILABLE_IN_ALL
84 void g_tls_connection_set_database (GTlsConnection *conn,
85 GTlsDatabase *database);
86 GLIB_AVAILABLE_IN_ALL
87 GTlsDatabase * g_tls_connection_get_database (GTlsConnection *conn);
89 GLIB_AVAILABLE_IN_ALL
90 void g_tls_connection_set_certificate (GTlsConnection *conn,
91 GTlsCertificate *certificate);
92 GLIB_AVAILABLE_IN_ALL
93 GTlsCertificate *g_tls_connection_get_certificate (GTlsConnection *conn);
95 GLIB_AVAILABLE_IN_ALL
96 void g_tls_connection_set_interaction (GTlsConnection *conn,
97 GTlsInteraction *interaction);
98 GLIB_AVAILABLE_IN_ALL
99 GTlsInteraction * g_tls_connection_get_interaction (GTlsConnection *conn);
101 GLIB_AVAILABLE_IN_ALL
102 GTlsCertificate *g_tls_connection_get_peer_certificate (GTlsConnection *conn);
103 GLIB_AVAILABLE_IN_ALL
104 GTlsCertificateFlags g_tls_connection_get_peer_certificate_errors (GTlsConnection *conn);
106 GLIB_AVAILABLE_IN_ALL
107 void g_tls_connection_set_require_close_notify (GTlsConnection *conn,
108 gboolean require_close_notify);
109 GLIB_AVAILABLE_IN_ALL
110 gboolean g_tls_connection_get_require_close_notify (GTlsConnection *conn);
112 GLIB_AVAILABLE_IN_ALL
113 void g_tls_connection_set_rehandshake_mode (GTlsConnection *conn,
114 GTlsRehandshakeMode mode);
115 GLIB_AVAILABLE_IN_ALL
116 GTlsRehandshakeMode g_tls_connection_get_rehandshake_mode (GTlsConnection *conn);
118 GLIB_AVAILABLE_IN_ALL
119 gboolean g_tls_connection_handshake (GTlsConnection *conn,
120 GCancellable *cancellable,
121 GError **error);
123 GLIB_AVAILABLE_IN_ALL
124 void g_tls_connection_handshake_async (GTlsConnection *conn,
125 int io_priority,
126 GCancellable *cancellable,
127 GAsyncReadyCallback callback,
128 gpointer user_data);
129 GLIB_AVAILABLE_IN_ALL
130 gboolean g_tls_connection_handshake_finish (GTlsConnection *conn,
131 GAsyncResult *result,
132 GError **error);
135 * G_TLS_ERROR:
137 * Error domain for TLS. Errors in this domain will be from the
138 * #GTlsError enumeration. See #GError for more information on error
139 * domains.
141 #define G_TLS_ERROR (g_tls_error_quark ())
142 GLIB_AVAILABLE_IN_ALL
143 GQuark g_tls_error_quark (void);
146 /*< protected >*/
147 GLIB_AVAILABLE_IN_ALL
148 gboolean g_tls_connection_emit_accept_certificate (GTlsConnection *conn,
149 GTlsCertificate *peer_cert,
150 GTlsCertificateFlags errors);
152 G_END_DECLS
154 #endif /* __G_TLS_CONNECTION_H__ */