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 * Conversion parameters: 26 * inFile = GTlsClientConnection.html 27 * outPack = gio 28 * outFile = TlsClientConnection 29 * strct = GTlsClientConnection 30 * realStrct= 31 * ctorStrct=GIOStream 32 * clss = TlsClientConnection 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = GTlsConnection 38 * implements: 39 * prefixes: 40 * - g_tls_client_connection_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * - glib.Str 47 * - glib.ErrorG 48 * - glib.GException 49 * - glib.ListG 50 * - gio.IOStream 51 * - gio.SocketConnectable 52 * - gio.SocketConnectableIF 53 * structWrap: 54 * - GIOStream* -> IOStream 55 * - GList* -> ListG 56 * - GSocketConnectable* -> SocketConnectableIF 57 * module aliases: 58 * local aliases: 59 * overrides: 60 */ 61 62 module gio.TlsClientConnection; 63 64 public import gtkc.giotypes; 65 66 private import gtkc.gio; 67 private import glib.ConstructionException; 68 private import gobject.ObjectG; 69 70 71 private import glib.Str; 72 private import glib.ErrorG; 73 private import glib.GException; 74 private import glib.ListG; 75 private import gio.IOStream; 76 private import gio.SocketConnectable; 77 private import gio.SocketConnectableIF; 78 79 80 81 private import gio.TlsConnection; 82 83 /** 84 * GTlsClientConnection is the client-side subclass of 85 * GTlsConnection, representing a client-side TLS connection. 86 */ 87 public class TlsClientConnection : TlsConnection 88 { 89 90 /** the main Gtk struct */ 91 protected GTlsClientConnection* gTlsClientConnection; 92 93 94 public GTlsClientConnection* getTlsClientConnectionStruct() 95 { 96 return gTlsClientConnection; 97 } 98 99 100 /** the main Gtk struct as a void* */ 101 protected override void* getStruct() 102 { 103 return cast(void*)gTlsClientConnection; 104 } 105 106 /** 107 * Sets our main struct and passes it to the parent class 108 */ 109 public this (GTlsClientConnection* gTlsClientConnection) 110 { 111 super(cast(GTlsConnection*)gTlsClientConnection); 112 this.gTlsClientConnection = gTlsClientConnection; 113 } 114 115 protected override void setStruct(GObject* obj) 116 { 117 super.setStruct(obj); 118 gTlsClientConnection = cast(GTlsClientConnection*)obj; 119 } 120 121 /** 122 */ 123 124 /** 125 * Creates a new GTlsClientConnection wrapping base_io_stream (which 126 * must have pollable input and output streams) which is assumed to 127 * communicate with the server identified by server_identity. 128 * Since 2.28 129 * Params: 130 * baseIoStream = the GIOStream to wrap 131 * serverIdentity = the expected identity of the server. [allow-none] 132 * Throws: GException on failure. 133 * Throws: ConstructionException GTK+ fails to create the object. 134 */ 135 public this (IOStream baseIoStream, SocketConnectableIF serverIdentity) 136 { 137 // GIOStream * g_tls_client_connection_new (GIOStream *base_io_stream, GSocketConnectable *server_identity, GError **error); 138 GError* err = null; 139 140 auto p = g_tls_client_connection_new((baseIoStream is null) ? null : baseIoStream.getIOStreamStruct(), (serverIdentity is null) ? null : serverIdentity.getSocketConnectableTStruct(), &err); 141 142 if (err !is null) 143 { 144 throw new GException( new ErrorG(err) ); 145 } 146 147 if(p is null) 148 { 149 throw new ConstructionException("null returned by g_tls_client_connection_new((baseIoStream is null) ? null : baseIoStream.getIOStreamStruct(), (serverIdentity is null) ? null : serverIdentity.getSocketConnectableTStruct(), &err)"); 150 } 151 this(cast(GTlsClientConnection*) p); 152 } 153 154 /** 155 * Sets conn's expected server identity, which is used both to tell 156 * servers on virtual hosts which certificate to present, and also 157 * to let conn know what name to look for in the certificate when 158 * performing G_TLS_CERTIFICATE_BAD_IDENTITY validation, if enabled. 159 * Since 2.28 160 * Params: 161 * identity = a GSocketConnectable describing the expected server identity 162 */ 163 public void setServerIdentity(SocketConnectableIF identity) 164 { 165 // void g_tls_client_connection_set_server_identity (GTlsClientConnection *conn, GSocketConnectable *identity); 166 g_tls_client_connection_set_server_identity(gTlsClientConnection, (identity is null) ? null : identity.getSocketConnectableTStruct()); 167 } 168 169 /** 170 * Gets conn's expected server identity 171 * Since 2.28 172 * Returns: a GSocketConnectable describing the expected server identity, or NULL if the expected identity is not known. [transfer none] 173 */ 174 public SocketConnectableIF getServerIdentity() 175 { 176 // GSocketConnectable * g_tls_client_connection_get_server_identity (GTlsClientConnection *conn); 177 auto p = g_tls_client_connection_get_server_identity(gTlsClientConnection); 178 179 if(p is null) 180 { 181 return null; 182 } 183 184 return ObjectG.getDObject!(SocketConnectable, SocketConnectableIF)(cast(GSocketConnectable*) p); 185 } 186 187 /** 188 * Sets conn's validation flags, to override the default set of 189 * checks performed when validating a server certificate. By default, 190 * G_TLS_CERTIFICATE_VALIDATE_ALL is used. 191 * Since 2.28 192 * Params: 193 * flags = the GTlsCertificateFlags to use 194 */ 195 public void setValidationFlags(GTlsCertificateFlags flags) 196 { 197 // void g_tls_client_connection_set_validation_flags (GTlsClientConnection *conn, GTlsCertificateFlags flags); 198 g_tls_client_connection_set_validation_flags(gTlsClientConnection, flags); 199 } 200 201 /** 202 * Gets conn's validation flags 203 * Since 2.28 204 * Returns: the validation flags 205 */ 206 public GTlsCertificateFlags getValidationFlags() 207 { 208 // GTlsCertificateFlags g_tls_client_connection_get_validation_flags (GTlsClientConnection *conn); 209 return g_tls_client_connection_get_validation_flags(gTlsClientConnection); 210 } 211 212 /** 213 * If use_ssl3 is TRUE, this forces conn to use SSL 3.0 rather than 214 * trying to properly negotiate the right version of TLS or SSL to use. 215 * This can be used when talking to servers that do not implement the 216 * fallbacks correctly and which will therefore fail to handshake with 217 * a "modern" TLS handshake attempt. 218 * Since 2.28 219 * Params: 220 * useSsl3 = whether to use SSL 3.0 221 */ 222 public void setUseSsl3(int useSsl3) 223 { 224 // void g_tls_client_connection_set_use_ssl3 (GTlsClientConnection *conn, gboolean use_ssl3); 225 g_tls_client_connection_set_use_ssl3(gTlsClientConnection, useSsl3); 226 } 227 228 /** 229 * Gets whether conn will use SSL 3.0 rather than the 230 * highest-supported version of TLS; see 231 * g_tls_client_connection_set_use_ssl3(). 232 * Since 2.28 233 * Returns: whether conn will use SSL 3.0 234 */ 235 public int getUseSsl3() 236 { 237 // gboolean g_tls_client_connection_get_use_ssl3 (GTlsClientConnection *conn); 238 return g_tls_client_connection_get_use_ssl3(gTlsClientConnection); 239 } 240 241 /** 242 * Gets the list of distinguished names of the Certificate Authorities 243 * that the server will accept certificates from. This will be set 244 * during the TLS handshake if the server requests a certificate. 245 * Otherwise, it will be NULL. 246 * Each item in the list is a GByteArray which contains the complete 247 * subject DN of the certificate authority. 248 * Since 2.28 249 * Returns: the list of CA DNs. You should unref each element with g_byte_array_unref() and then the free the list with g_list_free(). [element-type GByteArray][transfer full] 250 */ 251 public ListG getAcceptedCas() 252 { 253 // GList * g_tls_client_connection_get_accepted_cas (GTlsClientConnection *conn); 254 auto p = g_tls_client_connection_get_accepted_cas(gTlsClientConnection); 255 256 if(p is null) 257 { 258 return null; 259 } 260 261 return ObjectG.getDObject!(ListG)(cast(GList*) p); 262 } 263 }