99eff4710b43f5bc67befae6efeaa095c8eb7330
[platform/upstream/glib-networking.git] / tls / openssl / gtlsconnection-openssl.h
1 /*
2  * gtlsconnection-openssl.h
3  *
4  * Copyright (C) 2015 NICE s.r.l.
5  *
6  * This file 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.
10  *
11  * This file 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.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  *
19  * In addition, when the library is used with OpenSSL, a special
20  * exception applies. Refer to the LICENSE_EXCEPTION file for details.
21  *
22  * Authors: Ignacio Casal Quinteiro
23  */
24
25 #ifndef __G_TLS_CONNECTION_OPENSSL_H__
26 #define __G_TLS_CONNECTION_OPENSSL_H__
27
28 #include <gio/gio.h>
29
30 #include "gtlsconnection-base.h"
31 #include "openssl-include.h"
32
33 G_BEGIN_DECLS
34
35 #define G_TYPE_TLS_CONNECTION_OPENSSL            (g_tls_connection_openssl_get_type ())
36 #define G_TLS_CONNECTION_OPENSSL(inst)           (G_TYPE_CHECK_INSTANCE_CAST ((inst), G_TYPE_TLS_CONNECTION_OPENSSL, GTlsConnectionOpenssl))
37 #define G_TLS_CONNECTION_OPENSSL_CLASS(class)    (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_TLS_CONNECTION_OPENSSL, GTlsConnectionOpensslClass))
38 #define G_IS_TLS_CONNECTION_OPENSSL(inst)        (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_TLS_CONNECTION_OPENSSL))
39 #define G_IS_TLS_CONNECTION_OPENSSL_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_TLS_CONNECTION_OPENSSL))
40 #define G_TLS_CONNECTION_OPENSSL_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), G_TYPE_TLS_CONNECTION_OPENSSL, GTlsConnectionOpensslClass))
41
42 typedef struct _GTlsConnectionOpensslClass GTlsConnectionOpensslClass;
43 typedef struct _GTlsConnectionOpenssl      GTlsConnectionOpenssl;
44
45 struct _GTlsConnectionOpensslClass
46 {
47   GTlsConnectionBaseClass parent_class;
48
49   SSL *(*get_ssl) (GTlsConnectionOpenssl *connection);
50 };
51
52 struct _GTlsConnectionOpenssl
53 {
54   GTlsConnectionBase parent_instance;
55 };
56
57 GType g_tls_connection_openssl_get_type (void) G_GNUC_CONST;
58
59 SSL *g_tls_connection_openssl_get_ssl (GTlsConnectionOpenssl *connection);
60
61 gboolean g_tls_connection_openssl_request_certificate (GTlsConnectionOpenssl  *openssl,
62                                                        GError                **error);
63
64 G_END_DECLS
65
66 #endif /* __G_TLS_CONNECTION_OPENSSL_H___ */