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  * Conversion parameters:
26  * inFile  = GProxyResolver.html
27  * outPack = gio
28  * outFile = ProxyResolverT
29  * strct   = GProxyResolver
30  * realStrct=
31  * ctorStrct=
32  * clss    = ProxyResolverT
33  * interf  = ProxyResolverIF
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * 	- TStruct
38  * extend  = 
39  * implements:
40  * prefixes:
41  * 	- g_proxy_resolver_
42  * omit structs:
43  * omit prefixes:
44  * omit code:
45  * omit signals:
46  * imports:
47  * 	- glib.Str
48  * 	- glib.ErrorG
49  * 	- glib.GException
50  * 	- gio.AsyncResultIF
51  * 	- gio.Cancellable
52  * 	- gio.ProxyResolver
53  * 	- gio.ProxyResolverIF
54  * structWrap:
55  * 	- GAsyncResult* -> AsyncResultIF
56  * 	- GCancellable* -> Cancellable
57  * 	- GProxyResolver* -> ProxyResolverIF
58  * module aliases:
59  * local aliases:
60  * overrides:
61  */
62 
63 module gio.ProxyResolverT;
64 
65 public  import gtkc.giotypes;
66 
67 public import gtkc.gio;
68 public import glib.ConstructionException;
69 public import gobject.ObjectG;
70 
71 
72 public import glib.Str;
73 public import glib.ErrorG;
74 public import glib.GException;
75 public import gio.AsyncResultIF;
76 public import gio.Cancellable;
77 public import gio.ProxyResolver;
78 public import gio.ProxyResolverIF;
79 
80 
81 
82 
83 /**
84  * GProxyResolver provides synchronous and asynchronous network proxy
85  * resolution. GProxyResolver is used within GSocketClient through
86  * the method g_socket_connectable_proxy_enumerate().
87  */
88 public template ProxyResolverT(TStruct)
89 {
90 	
91 	/** the main Gtk struct */
92 	protected GProxyResolver* gProxyResolver;
93 	
94 	
95 	public GProxyResolver* getProxyResolverTStruct()
96 	{
97 		return cast(GProxyResolver*)getStruct();
98 	}
99 	
100 	
101 	/**
102 	 */
103 	
104 	/**
105 	 * Gets the default GProxyResolver for the system.
106 	 * Since 2.26
107 	 * Returns: the default GProxyResolver. [transfer none]
108 	 */
109 	public static ProxyResolverIF getDefault()
110 	{
111 		// GProxyResolver * g_proxy_resolver_get_default (void);
112 		auto p = g_proxy_resolver_get_default();
113 		
114 		if(p is null)
115 		{
116 			return null;
117 		}
118 		
119 		return ObjectG.getDObject!(ProxyResolver, ProxyResolverIF)(cast(GProxyResolver*) p);
120 	}
121 	
122 	/**
123 	 * Checks if resolver can be used on this system. (This is used
124 	 * internally; g_proxy_resolver_get_default() will only return a proxy
125 	 * resolver that returns TRUE for this method.)
126 	 * Since 2.26
127 	 * Returns: TRUE if resolver is supported.
128 	 */
129 	public int isSupported()
130 	{
131 		// gboolean g_proxy_resolver_is_supported (GProxyResolver *resolver);
132 		return g_proxy_resolver_is_supported(getProxyResolverTStruct());
133 	}
134 	
135 	/**
136 	 * Looks into the system proxy configuration to determine what proxy,
137 	 * if any, to use to connect to uri. The returned proxy URIs are of the
138 	 * form <protocol>://[user[:password]@]host:port
139 	 * or direct://, where <protocol> could be
140 	 * http, rtsp, socks or other proxying protocol.
141 	 * If you don't know what network protocol is being used on the
142 	 * socket, you should use none as the URI protocol.
143 	 * In this case, the resolver might still return a generic proxy type
144 	 * (such as SOCKS), but would not return protocol-specific proxy types
145 	 * (such as http).
146 	 * direct:// is used when no proxy is needed.
147 	 * Direct connection should not be attempted unless it is part of the
148 	 * returned array of proxies.
149 	 * Since 2.26
150 	 * Params:
151 	 * uri = a URI representing the destination to connect to
152 	 * cancellable = a GCancellable, or NULL. [allow-none]
153 	 * Returns: A NULL-terminated array of proxy URIs. Must be freed with g_strfreev(). [transfer full][array zero-terminated=1]
154 	 * Throws: GException on failure.
155 	 */
156 	public string[] lookup(string uri, Cancellable cancellable)
157 	{
158 		// gchar ** g_proxy_resolver_lookup (GProxyResolver *resolver,  const gchar *uri,  GCancellable *cancellable,  GError **error);
159 		GError* err = null;
160 		
161 		auto p = g_proxy_resolver_lookup(getProxyResolverTStruct(), Str.toStringz(uri), (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
162 		
163 		if (err !is null)
164 		{
165 			throw new GException( new ErrorG(err) );
166 		}
167 		
168 		return Str.toStringArray(p);
169 	}
170 	
171 	/**
172 	 * Asynchronous lookup of proxy. See g_proxy_resolver_lookup() for more
173 	 * details.
174 	 * Since 2.26
175 	 * Params:
176 	 * uri = a URI representing the destination to connect to
177 	 * cancellable = a GCancellable, or NULL. [allow-none]
178 	 * callback = callback to call after resolution completes. [scope async]
179 	 * userData = data for callback. [closure]
180 	 */
181 	public void lookupAsync(string uri, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
182 	{
183 		// void g_proxy_resolver_lookup_async (GProxyResolver *resolver,  const gchar *uri,  GCancellable *cancellable,  GAsyncReadyCallback callback,  gpointer user_data);
184 		g_proxy_resolver_lookup_async(getProxyResolverTStruct(), Str.toStringz(uri), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
185 	}
186 	
187 	/**
188 	 * Call this function to obtain the array of proxy URIs when
189 	 * g_proxy_resolver_lookup_async() is complete. See
190 	 * g_proxy_resolver_lookup() for more details.
191 	 * Since 2.26
192 	 * Params:
193 	 * result = the result passed to your GAsyncReadyCallback
194 	 * Returns: A NULL-terminated array of proxy URIs. Must be freed with g_strfreev(). [transfer full][array zero-terminated=1]
195 	 * Throws: GException on failure.
196 	 */
197 	public string[] lookupFinish(AsyncResultIF result)
198 	{
199 		// gchar ** g_proxy_resolver_lookup_finish (GProxyResolver *resolver,  GAsyncResult *result,  GError **error);
200 		GError* err = null;
201 		
202 		auto p = g_proxy_resolver_lookup_finish(getProxyResolverTStruct(), (result is null) ? null : result.getAsyncResultTStruct(), &err);
203 		
204 		if (err !is null)
205 		{
206 			throw new GException( new ErrorG(err) );
207 		}
208 		
209 		return Str.toStringArray(p);
210 	}
211 }