1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD 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
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module gio.TlsBackendT;
26 
27 public  import gio.TlsBackendIF;
28 public  import gio.TlsDatabase;
29 public  import gio.c.functions;
30 public  import gio.c.types;
31 public  import gobject.ObjectG;
32 public  import gtkc.giotypes;
33 
34 
35 /**
36  * TLS (Transport Layer Security, aka SSL) and DTLS backend.
37  *
38  * Since: 2.28
39  */
40 public template TlsBackendT(TStruct)
41 {
42 	/** Get the main Gtk struct */
43 	public GTlsBackend* getTlsBackendStruct(bool transferOwnership = false)
44 	{
45 		if (transferOwnership)
46 			ownedRef = false;
47 		return cast(GTlsBackend*)getStruct();
48 	}
49 
50 
51 	/**
52 	 * Gets the #GType of @backend's #GTlsCertificate implementation.
53 	 *
54 	 * Returns: the #GType of @backend's #GTlsCertificate
55 	 *     implementation.
56 	 *
57 	 * Since: 2.28
58 	 */
59 	public GType getCertificateType()
60 	{
61 		return g_tls_backend_get_certificate_type(getTlsBackendStruct());
62 	}
63 
64 	/**
65 	 * Gets the #GType of @backend's #GTlsClientConnection implementation.
66 	 *
67 	 * Returns: the #GType of @backend's #GTlsClientConnection
68 	 *     implementation.
69 	 *
70 	 * Since: 2.28
71 	 */
72 	public GType getClientConnectionType()
73 	{
74 		return g_tls_backend_get_client_connection_type(getTlsBackendStruct());
75 	}
76 
77 	/**
78 	 * Gets the default #GTlsDatabase used to verify TLS connections.
79 	 *
80 	 * Returns: the default database, which should be
81 	 *     unreffed when done.
82 	 *
83 	 * Since: 2.30
84 	 */
85 	public TlsDatabase getDefaultDatabase()
86 	{
87 		auto __p = g_tls_backend_get_default_database(getTlsBackendStruct());
88 
89 		if(__p is null)
90 		{
91 			return null;
92 		}
93 
94 		return ObjectG.getDObject!(TlsDatabase)(cast(GTlsDatabase*) __p, true);
95 	}
96 
97 	/**
98 	 * Gets the #GType of @backend’s #GDtlsClientConnection implementation.
99 	 *
100 	 * Returns: the #GType of @backend’s #GDtlsClientConnection
101 	 *     implementation, or %G_TYPE_INVALID if this backend doesn’t support DTLS.
102 	 *
103 	 * Since: 2.48
104 	 */
105 	public GType getDtlsClientConnectionType()
106 	{
107 		return g_tls_backend_get_dtls_client_connection_type(getTlsBackendStruct());
108 	}
109 
110 	/**
111 	 * Gets the #GType of @backend’s #GDtlsServerConnection implementation.
112 	 *
113 	 * Returns: the #GType of @backend’s #GDtlsServerConnection
114 	 *     implementation, or %G_TYPE_INVALID if this backend doesn’t support DTLS.
115 	 *
116 	 * Since: 2.48
117 	 */
118 	public GType getDtlsServerConnectionType()
119 	{
120 		return g_tls_backend_get_dtls_server_connection_type(getTlsBackendStruct());
121 	}
122 
123 	/**
124 	 * Gets the #GType of @backend's #GTlsFileDatabase implementation.
125 	 *
126 	 * Returns: the #GType of backend's #GTlsFileDatabase implementation.
127 	 *
128 	 * Since: 2.30
129 	 */
130 	public GType getFileDatabaseType()
131 	{
132 		return g_tls_backend_get_file_database_type(getTlsBackendStruct());
133 	}
134 
135 	/**
136 	 * Gets the #GType of @backend's #GTlsServerConnection implementation.
137 	 *
138 	 * Returns: the #GType of @backend's #GTlsServerConnection
139 	 *     implementation.
140 	 *
141 	 * Since: 2.28
142 	 */
143 	public GType getServerConnectionType()
144 	{
145 		return g_tls_backend_get_server_connection_type(getTlsBackendStruct());
146 	}
147 
148 	/**
149 	 * Set the default #GTlsDatabase used to verify TLS connections
150 	 *
151 	 * Any subsequent call to g_tls_backend_get_default_database() will return
152 	 * the database set in this call.  Existing databases and connections are not
153 	 * modified.
154 	 *
155 	 * Setting a %NULL default database will reset to using the system default
156 	 * database as if g_tls_backend_set_default_database() had never been called.
157 	 *
158 	 * Params:
159 	 *     database = the #GTlsDatabase
160 	 *
161 	 * Since: 2.60
162 	 */
163 	public void setDefaultDatabase(TlsDatabase database)
164 	{
165 		g_tls_backend_set_default_database(getTlsBackendStruct(), (database is null) ? null : database.getTlsDatabaseStruct());
166 	}
167 
168 	/**
169 	 * Checks if DTLS is supported. DTLS support may not be available even if TLS
170 	 * support is available, and vice-versa.
171 	 *
172 	 * Returns: whether DTLS is supported
173 	 *
174 	 * Since: 2.48
175 	 */
176 	public bool supportsDtls()
177 	{
178 		return g_tls_backend_supports_dtls(getTlsBackendStruct()) != 0;
179 	}
180 
181 	/**
182 	 * Checks if TLS is supported; if this returns %FALSE for the default
183 	 * #GTlsBackend, it means no "real" TLS backend is available.
184 	 *
185 	 * Returns: whether or not TLS is supported
186 	 *
187 	 * Since: 2.28
188 	 */
189 	public bool supportsTls()
190 	{
191 		return g_tls_backend_supports_tls(getTlsBackendStruct()) != 0;
192 	}
193 }