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