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.ProxyResolverIF;
26 
27 private import gio.AsyncResultIF;
28 private import gio.Cancellable;
29 private import gio.ProxyResolverIF;
30 private import gio.c.functions;
31 public  import gio.c.types;
32 private import glib.ErrorG;
33 private import glib.GException;
34 private import glib.Str;
35 private import gobject.ObjectG;
36 public  import gtkc.giotypes;
37 
38 
39 /**
40  * #GProxyResolver provides synchronous and asynchronous network proxy
41  * resolution. #GProxyResolver is used within #GSocketClient through
42  * the method g_socket_connectable_proxy_enumerate().
43  * 
44  * Implementations of #GProxyResolver based on libproxy and GNOME settings can
45  * be found in glib-networking. GIO comes with an implementation for use inside
46  * Flatpak portals.
47  *
48  * Since: 2.26
49  */
50 public interface ProxyResolverIF{
51 	/** Get the main Gtk struct */
52 	public GProxyResolver* getProxyResolverStruct(bool transferOwnership = false);
53 
54 	/** the main Gtk struct as a void* */
55 	protected void* getStruct();
56 
57 
58 	/** */
59 	public static GType getType()
60 	{
61 		return g_proxy_resolver_get_type();
62 	}
63 
64 	/**
65 	 * Gets the default #GProxyResolver for the system.
66 	 *
67 	 * Returns: the default #GProxyResolver.
68 	 *
69 	 * Since: 2.26
70 	 */
71 	public static ProxyResolverIF getDefault()
72 	{
73 		auto p = g_proxy_resolver_get_default();
74 
75 		if(p is null)
76 		{
77 			return null;
78 		}
79 
80 		return ObjectG.getDObject!(ProxyResolverIF)(cast(GProxyResolver*) p);
81 	}
82 
83 	/**
84 	 * Checks if @resolver can be used on this system. (This is used
85 	 * internally; g_proxy_resolver_get_default() will only return a proxy
86 	 * resolver that returns %TRUE for this method.)
87 	 *
88 	 * Returns: %TRUE if @resolver is supported.
89 	 *
90 	 * Since: 2.26
91 	 */
92 	public bool isSupported();
93 
94 	/**
95 	 * Looks into the system proxy configuration to determine what proxy,
96 	 * if any, to use to connect to @uri. The returned proxy URIs are of
97 	 * the form `<protocol>://[user[:password]@]host:port` or
98 	 * `direct://`, where <protocol> could be http, rtsp, socks
99 	 * or other proxying protocol.
100 	 *
101 	 * If you don't know what network protocol is being used on the
102 	 * socket, you should use `none` as the URI protocol.
103 	 * In this case, the resolver might still return a generic proxy type
104 	 * (such as SOCKS), but would not return protocol-specific proxy types
105 	 * (such as http).
106 	 *
107 	 * `direct://` is used when no proxy is needed.
108 	 * Direct connection should not be attempted unless it is part of the
109 	 * returned array of proxies.
110 	 *
111 	 * Params:
112 	 *     uri = a URI representing the destination to connect to
113 	 *     cancellable = a #GCancellable, or %NULL
114 	 *
115 	 * Returns: A
116 	 *     NULL-terminated array of proxy URIs. Must be freed
117 	 *     with g_strfreev().
118 	 *
119 	 * Since: 2.26
120 	 *
121 	 * Throws: GException on failure.
122 	 */
123 	public string[] lookup(string uri, Cancellable cancellable);
124 
125 	/**
126 	 * Asynchronous lookup of proxy. See g_proxy_resolver_lookup() for more
127 	 * details.
128 	 *
129 	 * Params:
130 	 *     uri = a URI representing the destination to connect to
131 	 *     cancellable = a #GCancellable, or %NULL
132 	 *     callback = callback to call after resolution completes
133 	 *     userData = data for @callback
134 	 *
135 	 * Since: 2.26
136 	 */
137 	public void lookupAsync(string uri, Cancellable cancellable, GAsyncReadyCallback callback, void* userData);
138 
139 	/**
140 	 * Call this function to obtain the array of proxy URIs when
141 	 * g_proxy_resolver_lookup_async() is complete. See
142 	 * g_proxy_resolver_lookup() for more details.
143 	 *
144 	 * Params:
145 	 *     result = the result passed to your #GAsyncReadyCallback
146 	 *
147 	 * Returns: A
148 	 *     NULL-terminated array of proxy URIs. Must be freed
149 	 *     with g_strfreev().
150 	 *
151 	 * Since: 2.26
152 	 *
153 	 * Throws: GException on failure.
154 	 */
155 	public string[] lookupFinish(AsyncResultIF result);
156 }