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.DtlsClientConnectionT;
26 
27 public  import gio.DatagramBasedIF;
28 public  import gio.SocketConnectableIF;
29 public  import gio.c.functions;
30 public  import gio.c.types;
31 public  import glib.ConstructionException;
32 public  import glib.ErrorG;
33 public  import glib.GException;
34 public  import glib.ListG;
35 public  import gobject.ObjectG;
36 
37 
38 /**
39  * #GDtlsClientConnection is the client-side subclass of
40  * #GDtlsConnection, representing a client-side DTLS connection.
41  *
42  * Since: 2.48
43  */
44 public template DtlsClientConnectionT(TStruct)
45 {
46 	/** Get the main Gtk struct */
47 	public GDtlsClientConnection* getDtlsClientConnectionStruct(bool transferOwnership = false)
48 	{
49 		if (transferOwnership)
50 			ownedRef = false;
51 		return cast(GDtlsClientConnection*)getStruct();
52 	}
53 
54 
55 	/**
56 	 * Gets the list of distinguished names of the Certificate Authorities
57 	 * that the server will accept certificates from. This will be set
58 	 * during the TLS handshake if the server requests a certificate.
59 	 * Otherwise, it will be %NULL.
60 	 *
61 	 * Each item in the list is a #GByteArray which contains the complete
62 	 * subject DN of the certificate authority.
63 	 *
64 	 * Returns: the list of
65 	 *     CA DNs. You should unref each element with g_byte_array_unref() and then
66 	 *     the free the list with g_list_free().
67 	 *
68 	 * Since: 2.48
69 	 */
70 	public ListG getAcceptedCas()
71 	{
72 		auto __p = g_dtls_client_connection_get_accepted_cas(getDtlsClientConnectionStruct());
73 
74 		if(__p is null)
75 		{
76 			return null;
77 		}
78 
79 		return new ListG(cast(GList*) __p, true);
80 	}
81 
82 	/**
83 	 * Gets @conn's expected server identity
84 	 *
85 	 * Returns: a #GSocketConnectable describing the
86 	 *     expected server identity, or %NULL if the expected identity is not
87 	 *     known.
88 	 *
89 	 * Since: 2.48
90 	 */
91 	public SocketConnectableIF getServerIdentity()
92 	{
93 		auto __p = g_dtls_client_connection_get_server_identity(getDtlsClientConnectionStruct());
94 
95 		if(__p is null)
96 		{
97 			return null;
98 		}
99 
100 		return ObjectG.getDObject!(SocketConnectableIF)(cast(GSocketConnectable*) __p);
101 	}
102 
103 	/**
104 	 * Gets @conn's validation flags
105 	 *
106 	 * Returns: the validation flags
107 	 *
108 	 * Since: 2.48
109 	 */
110 	public GTlsCertificateFlags getValidationFlags()
111 	{
112 		return g_dtls_client_connection_get_validation_flags(getDtlsClientConnectionStruct());
113 	}
114 
115 	/**
116 	 * Sets @conn's expected server identity, which is used both to tell
117 	 * servers on virtual hosts which certificate to present, and also
118 	 * to let @conn know what name to look for in the certificate when
119 	 * performing %G_TLS_CERTIFICATE_BAD_IDENTITY validation, if enabled.
120 	 *
121 	 * Params:
122 	 *     identity = a #GSocketConnectable describing the expected server identity
123 	 *
124 	 * Since: 2.48
125 	 */
126 	public void setServerIdentity(SocketConnectableIF identity)
127 	{
128 		g_dtls_client_connection_set_server_identity(getDtlsClientConnectionStruct(), (identity is null) ? null : identity.getSocketConnectableStruct());
129 	}
130 
131 	/**
132 	 * Sets @conn's validation flags, to override the default set of
133 	 * checks performed when validating a server certificate. By default,
134 	 * %G_TLS_CERTIFICATE_VALIDATE_ALL is used.
135 	 *
136 	 * Params:
137 	 *     flags = the #GTlsCertificateFlags to use
138 	 *
139 	 * Since: 2.48
140 	 */
141 	public void setValidationFlags(GTlsCertificateFlags flags)
142 	{
143 		g_dtls_client_connection_set_validation_flags(getDtlsClientConnectionStruct(), flags);
144 	}
145 }