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 = GProxyResolver.html 27 * outPack = gio 28 * outFile = ProxyResolverT 29 * strct = GProxyResolver 30 * realStrct= 31 * ctorStrct= 32 * clss = ProxyResolverT 33 * interf = ProxyResolverIF 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * - TStruct 38 * extend = 39 * implements: 40 * prefixes: 41 * - g_proxy_resolver_ 42 * omit structs: 43 * omit prefixes: 44 * omit code: 45 * omit signals: 46 * imports: 47 * - glib.Str 48 * - glib.ErrorG 49 * - glib.GException 50 * - gio.AsyncResultIF 51 * - gio.Cancellable 52 * - gio.ProxyResolver 53 * - gio.ProxyResolverIF 54 * structWrap: 55 * - GAsyncResult* -> AsyncResultIF 56 * - GCancellable* -> Cancellable 57 * - GProxyResolver* -> ProxyResolverIF 58 * module aliases: 59 * local aliases: 60 * overrides: 61 */ 62 63 module gio.ProxyResolverT; 64 65 public import gtkc.giotypes; 66 67 public import gtkc.gio; 68 public import glib.ConstructionException; 69 public import gobject.ObjectG; 70 71 72 public import glib.Str; 73 public import glib.ErrorG; 74 public import glib.GException; 75 public import gio.AsyncResultIF; 76 public import gio.Cancellable; 77 public import gio.ProxyResolver; 78 public import gio.ProxyResolverIF; 79 80 81 82 83 /** 84 * Description 85 * GProxyResolver provides synchronous and asynchronous network proxy 86 * resolution. GProxyResolver is used within GClientSocket through 87 * the method g_socket_connectable_proxy_enumerate(). 88 */ 89 public template ProxyResolverT(TStruct) 90 { 91 92 /** the main Gtk struct */ 93 protected GProxyResolver* gProxyResolver; 94 95 96 public GProxyResolver* getProxyResolverTStruct() 97 { 98 return cast(GProxyResolver*)getStruct(); 99 } 100 101 102 /** 103 */ 104 105 /** 106 * Gets the default GProxyResolver for the system. 107 * Since 2.26 108 * Returns: the default GProxyResolver. [transfer none] 109 */ 110 public static ProxyResolverIF getDefault() 111 { 112 // GProxyResolver * g_proxy_resolver_get_default (void); 113 auto p = g_proxy_resolver_get_default(); 114 115 if(p is null) 116 { 117 return null; 118 } 119 120 return ObjectG.getDObject!(ProxyResolver, ProxyResolverIF)(cast(GProxyResolver*) p); 121 } 122 123 /** 124 * Checks if resolver can be used on this system. (This is used 125 * internally; g_proxy_resolver_get_default() will only return a proxy 126 * resolver that returns TRUE for this method.) 127 * Since 2.26 128 * Returns: TRUE if resolver is supported. 129 */ 130 public int isSupported() 131 { 132 // gboolean g_proxy_resolver_is_supported (GProxyResolver *resolver); 133 return g_proxy_resolver_is_supported(getProxyResolverTStruct()); 134 } 135 136 /** 137 * Looks into the system proxy configuration to determine what proxy, 138 * if any, to use to connect to uri. The returned proxy URIs are of the 139 * form <protocol>://[user[:password]@]host:port 140 * or direct://, where <protocol> could be 141 * http, rtsp, socks or other proxying protocol. 142 * If you don't know what network protocol is being used on the 143 * socket, you should use none as the URI protocol. 144 * In this case, the resolver might still return a generic proxy type 145 * (such as SOCKS), but would not return protocol-specific proxy types 146 * (such as http). 147 * direct:// is used when no proxy is needed. 148 * Direct connection should not be attempted unless it is part of the 149 * returned array of proxies. 150 * Since 2.26 151 * Params: 152 * uri = a URI representing the destination to connect to 153 * cancellable = a GCancellable, or NULL. [allow-none] 154 * Returns: A NULL-terminated array of proxy URIs. Must be freed with g_strfreev(). [transfer full][array zero-terminated=1] 155 * Throws: GException on failure. 156 */ 157 public string[] lookup(string uri, Cancellable cancellable) 158 { 159 // gchar ** g_proxy_resolver_lookup (GProxyResolver *resolver, const gchar *uri, GCancellable *cancellable, GError **error); 160 GError* err = null; 161 162 auto p = g_proxy_resolver_lookup(getProxyResolverTStruct(), Str.toStringz(uri), (cancellable is null) ? null : cancellable.getCancellableStruct(), &err); 163 164 if (err !is null) 165 { 166 throw new GException( new ErrorG(err) ); 167 } 168 169 return Str.toStringArray(p); 170 } 171 172 /** 173 * Asynchronous lookup of proxy. See g_proxy_resolver_lookup() for more 174 * details. 175 * Since 2.26 176 * Params: 177 * uri = a URI representing the destination to connect to 178 * cancellable = a GCancellable, or NULL. [allow-none] 179 * callback = callback to call after resolution completes. [scope async] 180 * userData = data for callback. [closure] 181 */ 182 public void lookupAsync(string uri, Cancellable cancellable, GAsyncReadyCallback callback, void* userData) 183 { 184 // void g_proxy_resolver_lookup_async (GProxyResolver *resolver, const gchar *uri, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); 185 g_proxy_resolver_lookup_async(getProxyResolverTStruct(), Str.toStringz(uri), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); 186 } 187 188 /** 189 * Call this function to obtain the array of proxy URIs when 190 * g_proxy_resolver_lookup_async() is complete. See 191 * g_proxy_resolver_lookup() for more details. 192 * Since 2.26 193 * Params: 194 * result = the result passed to your GAsyncReadyCallback 195 * Returns: A NULL-terminated array of proxy URIs. Must be freed with g_strfreev(). [transfer full][array zero-terminated=1] 196 * Throws: GException on failure. 197 */ 198 public string[] lookupFinish(AsyncResultIF result) 199 { 200 // gchar ** g_proxy_resolver_lookup_finish (GProxyResolver *resolver, GAsyncResult *result, GError **error); 201 GError* err = null; 202 203 auto p = g_proxy_resolver_lookup_finish(getProxyResolverTStruct(), (result is null) ? null : result.getAsyncResultTStruct(), &err); 204 205 if (err !is null) 206 { 207 throw new GException( new ErrorG(err) ); 208 } 209 210 return Str.toStringArray(p); 211 } 212 }