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 
33 
34 /**
35  * TLS (Transport Layer Security, aka SSL) and DTLS backend.
36  *
37  * Since: 2.28
38  */
39 public template TlsBackendT(TStruct)
40 {
41 	/** Get the main Gtk struct */
42 	public GTlsBackend* getTlsBackendStruct(bool transferOwnership = false)
43 	{
44 		if (transferOwnership)
45 			ownedRef = false;
46 		return cast(GTlsBackend*)getStruct();
47 	}
48 
49 
50 	/**
51 	 * Gets the #GType of @backend's #GTlsCertificate implementation.
52 	 *
53 	 * Returns: the #GType of @backend's #GTlsCertificate
54 	 *     implementation.
55 	 *
56 	 * Since: 2.28
57 	 */
58 	public GType getCertificateType()
59 	{
60 		return g_tls_backend_get_certificate_type(getTlsBackendStruct());
61 	}
62 
63 	/**
64 	 * Gets the #GType of @backend's #GTlsClientConnection implementation.
65 	 *
66 	 * Returns: the #GType of @backend's #GTlsClientConnection
67 	 *     implementation.
68 	 *
69 	 * Since: 2.28
70 	 */
71 	public GType getClientConnectionType()
72 	{
73 		return g_tls_backend_get_client_connection_type(getTlsBackendStruct());
74 	}
75 
76 	/**
77 	 * Gets the default #GTlsDatabase used to verify TLS connections.
78 	 *
79 	 * Returns: the default database, which should be
80 	 *     unreffed when done.
81 	 *
82 	 * Since: 2.30
83 	 */
84 	public TlsDatabase getDefaultDatabase()
85 	{
86 		auto __p = g_tls_backend_get_default_database(getTlsBackendStruct());
87 
88 		if(__p is null)
89 		{
90 			return null;
91 		}
92 
93 		return ObjectG.getDObject!(TlsDatabase)(cast(GTlsDatabase*) __p, true);
94 	}
95 
96 	/**
97 	 * Gets the #GType of @backend’s #GDtlsClientConnection implementation.
98 	 *
99 	 * Returns: the #GType of @backend’s #GDtlsClientConnection
100 	 *     implementation, or %G_TYPE_INVALID if this backend doesn’t support DTLS.
101 	 *
102 	 * Since: 2.48
103 	 */
104 	public GType getDtlsClientConnectionType()
105 	{
106 		return g_tls_backend_get_dtls_client_connection_type(getTlsBackendStruct());
107 	}
108 
109 	/**
110 	 * Gets the #GType of @backend’s #GDtlsServerConnection implementation.
111 	 *
112 	 * Returns: the #GType of @backend’s #GDtlsServerConnection
113 	 *     implementation, or %G_TYPE_INVALID if this backend doesn’t support DTLS.
114 	 *
115 	 * Since: 2.48
116 	 */
117 	public GType getDtlsServerConnectionType()
118 	{
119 		return g_tls_backend_get_dtls_server_connection_type(getTlsBackendStruct());
120 	}
121 
122 	/**
123 	 * Gets the #GType of @backend's #GTlsFileDatabase implementation.
124 	 *
125 	 * Returns: the #GType of backend's #GTlsFileDatabase implementation.
126 	 *
127 	 * Since: 2.30
128 	 */
129 	public GType getFileDatabaseType()
130 	{
131 		return g_tls_backend_get_file_database_type(getTlsBackendStruct());
132 	}
133 
134 	/**
135 	 * Gets the #GType of @backend's #GTlsServerConnection implementation.
136 	 *
137 	 * Returns: the #GType of @backend's #GTlsServerConnection
138 	 *     implementation.
139 	 *
140 	 * Since: 2.28
141 	 */
142 	public GType getServerConnectionType()
143 	{
144 		return g_tls_backend_get_server_connection_type(getTlsBackendStruct());
145 	}
146 
147 	/**
148 	 * Set the default #GTlsDatabase used to verify TLS connections
149 	 *
150 	 * Any subsequent call to g_tls_backend_get_default_database() will return
151 	 * the database set in this call.  Existing databases and connections are not
152 	 * modified.
153 	 *
154 	 * Setting a %NULL default database will reset to using the system default
155 	 * database as if g_tls_backend_set_default_database() had never been called.
156 	 *
157 	 * Params:
158 	 *     database = the #GTlsDatabase
159 	 *
160 	 * Since: 2.60
161 	 */
162 	public void setDefaultDatabase(TlsDatabase database)
163 	{
164 		g_tls_backend_set_default_database(getTlsBackendStruct(), (database is null) ? null : database.getTlsDatabaseStruct());
165 	}
166 
167 	/**
168 	 * Checks if DTLS is supported. DTLS support may not be available even if TLS
169 	 * support is available, and vice-versa.
170 	 *
171 	 * Returns: whether DTLS is supported
172 	 *
173 	 * Since: 2.48
174 	 */
175 	public bool supportsDtls()
176 	{
177 		return g_tls_backend_supports_dtls(getTlsBackendStruct()) != 0;
178 	}
179 
180 	/**
181 	 * Checks if TLS is supported; if this returns %FALSE for the default
182 	 * #GTlsBackend, it means no "real" TLS backend is available.
183 	 *
184 	 * Returns: whether or not TLS is supported
185 	 *
186 	 * Since: 2.28
187 	 */
188 	public bool supportsTls()
189 	{
190 		return g_tls_backend_supports_tls(getTlsBackendStruct()) != 0;
191 	}
192 }