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