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