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.SimpleProxyResolver; 26 27 private import gio.ProxyResolverIF; 28 private import gio.ProxyResolverT; 29 private import gio.c.functions; 30 public import gio.c.types; 31 private import glib.ConstructionException; 32 private import glib.Str; 33 private import gobject.ObjectG; 34 public import gtkc.giotypes; 35 36 37 /** 38 * #GSimpleProxyResolver is a simple #GProxyResolver implementation 39 * that handles a single default proxy, multiple URI-scheme-specific 40 * proxies, and a list of hosts that proxies should not be used for. 41 * 42 * #GSimpleProxyResolver is never the default proxy resolver, but it 43 * can be used as the base class for another proxy resolver 44 * implementation, or it can be created and used manually, such as 45 * with g_socket_client_set_proxy_resolver(). 46 */ 47 public class SimpleProxyResolver : ObjectG, ProxyResolverIF 48 { 49 /** the main Gtk struct */ 50 protected GSimpleProxyResolver* gSimpleProxyResolver; 51 52 /** Get the main Gtk struct */ 53 public GSimpleProxyResolver* getSimpleProxyResolverStruct(bool transferOwnership = false) 54 { 55 if (transferOwnership) 56 ownedRef = false; 57 return gSimpleProxyResolver; 58 } 59 60 /** the main Gtk struct as a void* */ 61 protected override void* getStruct() 62 { 63 return cast(void*)gSimpleProxyResolver; 64 } 65 66 /** 67 * Sets our main struct and passes it to the parent class. 68 */ 69 public this (GSimpleProxyResolver* gSimpleProxyResolver, bool ownedRef = false) 70 { 71 this.gSimpleProxyResolver = gSimpleProxyResolver; 72 super(cast(GObject*)gSimpleProxyResolver, ownedRef); 73 } 74 75 // add the ProxyResolver capabilities 76 mixin ProxyResolverT!(GSimpleProxyResolver); 77 78 79 /** */ 80 public static GType getType() 81 { 82 return g_simple_proxy_resolver_get_type(); 83 } 84 85 /** 86 * Creates a new #GSimpleProxyResolver. See 87 * #GSimpleProxyResolver:default-proxy and 88 * #GSimpleProxyResolver:ignore-hosts for more details on how the 89 * arguments are interpreted. 90 * 91 * Params: 92 * defaultProxy = the default proxy to use, eg 93 * "socks://192.168.1.1" 94 * ignoreHosts = an optional list of hosts/IP addresses 95 * to not use a proxy for. 96 * 97 * Returns: a new #GSimpleProxyResolver 98 * 99 * Since: 2.36 100 * 101 * Throws: ConstructionException GTK+ fails to create the object. 102 */ 103 public this(string defaultProxy, string[] ignoreHosts) 104 { 105 auto p = g_simple_proxy_resolver_new(Str.toStringz(defaultProxy), Str.toStringzArray(ignoreHosts)); 106 107 if(p is null) 108 { 109 throw new ConstructionException("null returned by new"); 110 } 111 112 this(cast(GSimpleProxyResolver*) p, true); 113 } 114 115 /** 116 * Sets the default proxy on @resolver, to be used for any URIs that 117 * don't match #GSimpleProxyResolver:ignore-hosts or a proxy set 118 * via g_simple_proxy_resolver_set_uri_proxy(). 119 * 120 * If @default_proxy starts with "socks://", 121 * #GSimpleProxyResolver will treat it as referring to all three of 122 * the socks5, socks4a, and socks4 proxy types. 123 * 124 * Params: 125 * defaultProxy = the default proxy to use 126 * 127 * Since: 2.36 128 */ 129 public void setDefaultProxy(string defaultProxy) 130 { 131 g_simple_proxy_resolver_set_default_proxy(gSimpleProxyResolver, Str.toStringz(defaultProxy)); 132 } 133 134 /** 135 * Sets the list of ignored hosts. 136 * 137 * See #GSimpleProxyResolver:ignore-hosts for more details on how the 138 * @ignore_hosts argument is interpreted. 139 * 140 * Params: 141 * ignoreHosts = %NULL-terminated list of hosts/IP addresses 142 * to not use a proxy for 143 * 144 * Since: 2.36 145 */ 146 public void setIgnoreHosts(string[] ignoreHosts) 147 { 148 g_simple_proxy_resolver_set_ignore_hosts(gSimpleProxyResolver, Str.toStringzArray(ignoreHosts)); 149 } 150 151 /** 152 * Adds a URI-scheme-specific proxy to @resolver; URIs whose scheme 153 * matches @uri_scheme (and which don't match 154 * #GSimpleProxyResolver:ignore-hosts) will be proxied via @proxy. 155 * 156 * As with #GSimpleProxyResolver:default-proxy, if @proxy starts with 157 * "socks://", #GSimpleProxyResolver will treat it 158 * as referring to all three of the socks5, socks4a, and socks4 proxy 159 * types. 160 * 161 * Params: 162 * uriScheme = the URI scheme to add a proxy for 163 * proxy = the proxy to use for @uri_scheme 164 * 165 * Since: 2.36 166 */ 167 public void setUriProxy(string uriScheme, string proxy) 168 { 169 g_simple_proxy_resolver_set_uri_proxy(gSimpleProxyResolver, Str.toStringz(uriScheme), Str.toStringz(proxy)); 170 } 171 }