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