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 protected override void setStruct(GObject* obj) 67 { 68 gSimpleProxyResolver = cast(GSimpleProxyResolver*)obj; 69 super.setStruct(obj); 70 } 71 72 /** 73 * Sets our main struct and passes it to the parent class. 74 */ 75 public this (GSimpleProxyResolver* gSimpleProxyResolver, bool ownedRef = false) 76 { 77 this.gSimpleProxyResolver = gSimpleProxyResolver; 78 super(cast(GObject*)gSimpleProxyResolver, ownedRef); 79 } 80 81 // add the ProxyResolver capabilities 82 mixin ProxyResolverT!(GSimpleProxyResolver); 83 84 85 /** */ 86 public static GType getType() 87 { 88 return g_simple_proxy_resolver_get_type(); 89 } 90 91 /** 92 * Creates a new #GSimpleProxyResolver. See 93 * #GSimpleProxyResolver:default-proxy and 94 * #GSimpleProxyResolver:ignore-hosts for more details on how the 95 * arguments are interpreted. 96 * 97 * Params: 98 * defaultProxy = the default proxy to use, eg 99 * "socks://192.168.1.1" 100 * ignoreHosts = an optional list of hosts/IP addresses 101 * to not use a proxy for. 102 * 103 * Returns: a new #GSimpleProxyResolver 104 * 105 * Since: 2.36 106 * 107 * Throws: ConstructionException GTK+ fails to create the object. 108 */ 109 public this(string defaultProxy, string[] ignoreHosts) 110 { 111 auto p = g_simple_proxy_resolver_new(Str.toStringz(defaultProxy), Str.toStringzArray(ignoreHosts)); 112 113 if(p is null) 114 { 115 throw new ConstructionException("null returned by new"); 116 } 117 118 this(cast(GSimpleProxyResolver*) p, true); 119 } 120 121 /** 122 * Sets the default proxy on @resolver, to be used for any URIs that 123 * don't match #GSimpleProxyResolver:ignore-hosts or a proxy set 124 * via g_simple_proxy_resolver_set_uri_proxy(). 125 * 126 * If @default_proxy starts with "socks://", 127 * #GSimpleProxyResolver will treat it as referring to all three of 128 * the socks5, socks4a, and socks4 proxy types. 129 * 130 * Params: 131 * defaultProxy = the default proxy to use 132 * 133 * Since: 2.36 134 */ 135 public void setDefaultProxy(string defaultProxy) 136 { 137 g_simple_proxy_resolver_set_default_proxy(gSimpleProxyResolver, Str.toStringz(defaultProxy)); 138 } 139 140 /** 141 * Sets the list of ignored hosts. 142 * 143 * See #GSimpleProxyResolver:ignore-hosts for more details on how the 144 * @ignore_hosts argument is interpreted. 145 * 146 * Params: 147 * ignoreHosts = %NULL-terminated list of hosts/IP addresses 148 * to not use a proxy for 149 * 150 * Since: 2.36 151 */ 152 public void setIgnoreHosts(string[] ignoreHosts) 153 { 154 g_simple_proxy_resolver_set_ignore_hosts(gSimpleProxyResolver, Str.toStringzArray(ignoreHosts)); 155 } 156 157 /** 158 * Adds a URI-scheme-specific proxy to @resolver; URIs whose scheme 159 * matches @uri_scheme (and which don't match 160 * #GSimpleProxyResolver:ignore-hosts) will be proxied via @proxy. 161 * 162 * As with #GSimpleProxyResolver:default-proxy, if @proxy starts with 163 * "socks://", #GSimpleProxyResolver will treat it 164 * as referring to all three of the socks5, socks4a, and socks4 proxy 165 * types. 166 * 167 * Params: 168 * uriScheme = the URI scheme to add a proxy for 169 * proxy = the proxy to use for @uri_scheme 170 * 171 * Since: 2.36 172 */ 173 public void setUriProxy(string uriScheme, string proxy) 174 { 175 g_simple_proxy_resolver_set_uri_proxy(gSimpleProxyResolver, Str.toStringz(uriScheme), Str.toStringz(proxy)); 176 } 177 }