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.TlsClientConnectionT; 26 27 public import gio.IOStream; 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 * #GTlsClientConnection is the client-side subclass of 41 * #GTlsConnection, representing a client-side TLS connection. 42 * 43 * Since: 2.28 44 */ 45 public template TlsClientConnectionT(TStruct) 46 { 47 /** Get the main Gtk struct */ 48 public GTlsClientConnection* getTlsClientConnectionStruct() 49 { 50 return cast(GTlsClientConnection*)getStruct(); 51 } 52 53 54 /** 55 * Copies session state from one connection to another. This is 56 * not normally needed, but may be used when the same session 57 * needs to be used between different endpoints as is required 58 * by some protocols such as FTP over TLS. @source should have 59 * already completed a handshake, and @conn should not have 60 * completed a handshake. 61 * 62 * Params: 63 * source = a #GTlsClientConnection 64 * 65 * Since: 2.46 66 */ 67 public void copySessionState(TlsClientConnectionIF source) 68 { 69 g_tls_client_connection_copy_session_state(getTlsClientConnectionStruct(), (source is null) ? null : source.getTlsClientConnectionStruct()); 70 } 71 72 /** 73 * Gets the list of distinguished names of the Certificate Authorities 74 * that the server will accept certificates from. This will be set 75 * during the TLS handshake if the server requests a certificate. 76 * Otherwise, it will be %NULL. 77 * 78 * Each item in the list is a #GByteArray which contains the complete 79 * subject DN of the certificate authority. 80 * 81 * Return: the list of 82 * CA DNs. You should unref each element with g_byte_array_unref() and then 83 * the free the list with g_list_free(). 84 * 85 * Since: 2.28 86 */ 87 public ListG getAcceptedCas() 88 { 89 auto p = g_tls_client_connection_get_accepted_cas(getTlsClientConnectionStruct()); 90 91 if(p is null) 92 { 93 return null; 94 } 95 96 return new ListG(cast(GList*) p); 97 } 98 99 /** 100 * Gets @conn's expected server identity 101 * 102 * Return: a #GSocketConnectable describing the 103 * expected server identity, or %NULL if the expected identity is not 104 * known. 105 * 106 * Since: 2.28 107 */ 108 public SocketConnectableIF getServerIdentity() 109 { 110 auto p = g_tls_client_connection_get_server_identity(getTlsClientConnectionStruct()); 111 112 if(p is null) 113 { 114 return null; 115 } 116 117 return ObjectG.getDObject!(SocketConnectable, SocketConnectableIF)(cast(GSocketConnectable*) p); 118 } 119 120 /** 121 * Gets whether @conn will use SSL 3.0 rather than the 122 * highest-supported version of TLS; see 123 * g_tls_client_connection_set_use_ssl3(). 124 * 125 * Return: whether @conn will use SSL 3.0 126 * 127 * Since: 2.28 128 */ 129 public bool getUseSsl3() 130 { 131 return g_tls_client_connection_get_use_ssl3(getTlsClientConnectionStruct()) != 0; 132 } 133 134 /** 135 * Gets @conn's validation flags 136 * 137 * Return: the validation flags 138 * 139 * Since: 2.28 140 */ 141 public GTlsCertificateFlags getValidationFlags() 142 { 143 return g_tls_client_connection_get_validation_flags(getTlsClientConnectionStruct()); 144 } 145 146 /** 147 * Sets @conn's expected server identity, which is used both to tell 148 * servers on virtual hosts which certificate to present, and also 149 * to let @conn know what name to look for in the certificate when 150 * performing %G_TLS_CERTIFICATE_BAD_IDENTITY validation, if enabled. 151 * 152 * Params: 153 * identity = a #GSocketConnectable describing the expected server identity 154 * 155 * Since: 2.28 156 */ 157 public void setServerIdentity(SocketConnectableIF identity) 158 { 159 g_tls_client_connection_set_server_identity(getTlsClientConnectionStruct(), (identity is null) ? null : identity.getSocketConnectableStruct()); 160 } 161 162 /** 163 * If @use_ssl3 is %TRUE, this forces @conn to use SSL 3.0 rather than 164 * trying to properly negotiate the right version of TLS or SSL to use. 165 * This can be used when talking to servers that do not implement the 166 * fallbacks correctly and which will therefore fail to handshake with 167 * a "modern" TLS handshake attempt. 168 * 169 * Params: 170 * useSsl3 = whether to use SSL 3.0 171 * 172 * Since: 2.28 173 */ 174 public void setUseSsl3(bool useSsl3) 175 { 176 g_tls_client_connection_set_use_ssl3(getTlsClientConnectionStruct(), useSsl3); 177 } 178 179 /** 180 * Sets @conn's validation flags, to override the default set of 181 * checks performed when validating a server certificate. By default, 182 * %G_TLS_CERTIFICATE_VALIDATE_ALL is used. 183 * 184 * Params: 185 * flags = the #GTlsCertificateFlags to use 186 * 187 * Since: 2.28 188 */ 189 public void setValidationFlags(GTlsCertificateFlags flags) 190 { 191 g_tls_client_connection_set_validation_flags(getTlsClientConnectionStruct(), flags); 192 } 193 }