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