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.ProxyIF;
26 
27 private import gio.AsyncResultIF;
28 private import gio.Cancellable;
29 private import gio.IOStream;
30 private import gio.ProxyAddress;
31 private import gio.ProxyIF;
32 private import gio.c.functions;
33 public  import gio.c.types;
34 private import glib.ErrorG;
35 private import glib.GException;
36 private import glib.Str;
37 private import gobject.ObjectG;
38 public  import gtkc.giotypes;
39 
40 
41 /**
42  * A #GProxy handles connecting to a remote host via a given type of
43  * proxy server. It is implemented by the 'gio-proxy' extension point.
44  * The extensions are named after their proxy protocol name. As an
45  * example, a SOCKS5 proxy implementation can be retrieved with the
46  * name 'socks5' using the function
47  * g_io_extension_point_get_extension_by_name().
48  *
49  * Since: 2.26
50  */
51 public interface ProxyIF{
52 	/** Get the main Gtk struct */
53 	public GProxy* getProxyStruct(bool transferOwnership = false);
54 
55 	/** the main Gtk struct as a void* */
56 	protected void* getStruct();
57 
58 
59 	/** */
60 	public static GType getType()
61 	{
62 		return g_proxy_get_type();
63 	}
64 
65 	/**
66 	 * Lookup "gio-proxy" extension point for a proxy implementation that supports
67 	 * specified protocol.
68 	 *
69 	 * Params:
70 	 *     protocol = the proxy protocol name (e.g. http, socks, etc)
71 	 *
72 	 * Returns: return a #GProxy or NULL if protocol
73 	 *     is not supported.
74 	 *
75 	 * Since: 2.26
76 	 */
77 	public static ProxyIF getDefaultForProtocol(string protocol)
78 	{
79 		auto p = g_proxy_get_default_for_protocol(Str.toStringz(protocol));
80 
81 		if(p is null)
82 		{
83 			return null;
84 		}
85 
86 		return ObjectG.getDObject!(ProxyIF)(cast(GProxy*) p, true);
87 	}
88 
89 	/**
90 	 * Given @connection to communicate with a proxy (eg, a
91 	 * #GSocketConnection that is connected to the proxy server), this
92 	 * does the necessary handshake to connect to @proxy_address, and if
93 	 * required, wraps the #GIOStream to handle proxy payload.
94 	 *
95 	 * Params:
96 	 *     connection = a #GIOStream
97 	 *     proxyAddress = a #GProxyAddress
98 	 *     cancellable = a #GCancellable
99 	 *
100 	 * Returns: a #GIOStream that will replace @connection. This might
101 	 *     be the same as @connection, in which case a reference
102 	 *     will be added.
103 	 *
104 	 * Since: 2.26
105 	 *
106 	 * Throws: GException on failure.
107 	 */
108 	public IOStream connect(IOStream connection, ProxyAddress proxyAddress, Cancellable cancellable);
109 
110 	/**
111 	 * Asynchronous version of g_proxy_connect().
112 	 *
113 	 * Params:
114 	 *     connection = a #GIOStream
115 	 *     proxyAddress = a #GProxyAddress
116 	 *     cancellable = a #GCancellable
117 	 *     callback = a #GAsyncReadyCallback
118 	 *     userData = callback data
119 	 *
120 	 * Since: 2.26
121 	 */
122 	public void connectAsync(IOStream connection, ProxyAddress proxyAddress, Cancellable cancellable, GAsyncReadyCallback callback, void* userData);
123 
124 	/**
125 	 * See g_proxy_connect().
126 	 *
127 	 * Params:
128 	 *     result = a #GAsyncResult
129 	 *
130 	 * Returns: a #GIOStream.
131 	 *
132 	 * Since: 2.26
133 	 *
134 	 * Throws: GException on failure.
135 	 */
136 	public IOStream connectFinish(AsyncResultIF result);
137 
138 	/**
139 	 * Some proxy protocols expect to be passed a hostname, which they
140 	 * will resolve to an IP address themselves. Others, like SOCKS4, do
141 	 * not allow this. This function will return %FALSE if @proxy is
142 	 * implementing such a protocol. When %FALSE is returned, the caller
143 	 * should resolve the destination hostname first, and then pass a
144 	 * #GProxyAddress containing the stringified IP address to
145 	 * g_proxy_connect() or g_proxy_connect_async().
146 	 *
147 	 * Returns: %TRUE if hostname resolution is supported.
148 	 *
149 	 * Since: 2.26
150 	 */
151 	public bool supportsHostname();
152 }