| 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 = GProxy.html |
|---|
| 27 |
* outPack = gio |
|---|
| 28 |
* outFile = ProxyT |
|---|
| 29 |
* strct = GProxy |
|---|
| 30 |
* realStrct= |
|---|
| 31 |
* ctorStrct= |
|---|
| 32 |
* clss = ProxyT |
|---|
| 33 |
* interf = ProxyIF |
|---|
| 34 |
* class Code: No |
|---|
| 35 |
* interface Code: No |
|---|
| 36 |
* template for: |
|---|
| 37 |
* - TStruct |
|---|
| 38 |
* extend = |
|---|
| 39 |
* implements: |
|---|
| 40 |
* prefixes: |
|---|
| 41 |
* - g_initable_ |
|---|
| 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.IOStream |
|---|
| 53 |
* - gio.ProxyAddress |
|---|
| 54 |
* structWrap: |
|---|
| 55 |
* - GAsyncResult* -> AsyncResultIF |
|---|
| 56 |
* - GCancellable* -> Cancellable |
|---|
| 57 |
* - GIOStream* -> IOStream |
|---|
| 58 |
* - GProxy* -> ProxyIF |
|---|
| 59 |
* - GProxyAddress* -> ProxyAddress |
|---|
| 60 |
* module aliases: |
|---|
| 61 |
* local aliases: |
|---|
| 62 |
* overrides: |
|---|
| 63 |
*/ |
|---|
| 64 |
|
|---|
| 65 |
module gio.ProxyT; |
|---|
| 66 |
|
|---|
| 67 |
public import gtkc.giotypes; |
|---|
| 68 |
|
|---|
| 69 |
public import gtkc.gio; |
|---|
| 70 |
public import glib.ConstructionException; |
|---|
| 71 |
|
|---|
| 72 |
|
|---|
| 73 |
public import glib.Str; |
|---|
| 74 |
public import glib.ErrorG; |
|---|
| 75 |
public import glib.GException; |
|---|
| 76 |
public import gio.AsyncResultIF; |
|---|
| 77 |
public import gio.Cancellable; |
|---|
| 78 |
public import gio.IOStream; |
|---|
| 79 |
public import gio.ProxyAddress; |
|---|
| 80 |
|
|---|
| 81 |
|
|---|
| 82 |
|
|---|
| 83 |
|
|---|
| 84 |
/** |
|---|
| 85 |
* Description |
|---|
| 86 |
* A GProxy handles connecting to a remote host via a given type of |
|---|
| 87 |
* proxy server. It is implemented by the 'gio-proxy' extension point. |
|---|
| 88 |
* The extensions are named after their proxy protocol name. As an |
|---|
| 89 |
* example, a SOCKS5 proxy implementation can be retrieved with the |
|---|
| 90 |
* name 'socks5' using the function |
|---|
| 91 |
* g_io_extension_point_get_extension_by_name(). |
|---|
| 92 |
*/ |
|---|
| 93 |
public template ProxyT(TStruct) |
|---|
| 94 |
{ |
|---|
| 95 |
|
|---|
| 96 |
/** the main Gtk struct */ |
|---|
| 97 |
protected GProxy* gProxy; |
|---|
| 98 |
|
|---|
| 99 |
|
|---|
| 100 |
public GProxy* getProxyTStruct() |
|---|
| 101 |
{ |
|---|
| 102 |
return cast(GProxy*)getStruct(); |
|---|
| 103 |
} |
|---|
| 104 |
|
|---|
| 105 |
|
|---|
| 106 |
/** |
|---|
| 107 |
*/ |
|---|
| 108 |
|
|---|
| 109 |
/** |
|---|
| 110 |
* Given connection to communicate with a proxy (eg, a |
|---|
| 111 |
* GSocketConnection that is connected to the proxy server), this |
|---|
| 112 |
* does the necessary handshake to connect to proxy_address, and if |
|---|
| 113 |
* required, wraps the GIOStream to handle proxy payload. |
|---|
| 114 |
* Since 2.26 |
|---|
| 115 |
* Params: |
|---|
| 116 |
* proxy = a GProxy |
|---|
| 117 |
* connection = a GIOStream |
|---|
| 118 |
* proxyAddress = a GProxyAddress |
|---|
| 119 |
* cancellable = a GCancellable. [allow-none] |
|---|
| 120 |
* Returns: a GIOStream that will replace connection. This might be the same as connection, in which case a reference will be added. [transfer full] |
|---|
| 121 |
* Throws: GException on failure. |
|---|
| 122 |
*/ |
|---|
| 123 |
public IOStream gProxyConnect(IOStream connection, ProxyAddress proxyAddress, Cancellable cancellable) |
|---|
| 124 |
{ |
|---|
| 125 |
// GIOStream * g_proxy_connect (GProxy *proxy, GIOStream *connection, GProxyAddress *proxy_address, GCancellable *cancellable, GError **error); |
|---|
| 126 |
GError* err = null; |
|---|
| 127 |
|
|---|
| 128 |
auto p = g_proxy_connect(getProxyTStruct(), (connection is null) ? null : connection.getIOStreamStruct(), (proxyAddress is null) ? null : proxyAddress.getProxyAddressStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), &err); |
|---|
| 129 |
|
|---|
| 130 |
if (err !is null) |
|---|
| 131 |
{ |
|---|
| 132 |
throw new GException( new ErrorG(err) ); |
|---|
| 133 |
} |
|---|
| 134 |
|
|---|
| 135 |
if(p is null) |
|---|
| 136 |
{ |
|---|
| 137 |
return null; |
|---|
| 138 |
} |
|---|
| 139 |
return new IOStream(cast(GIOStream*) p); |
|---|
| 140 |
} |
|---|
| 141 |
|
|---|
| 142 |
/** |
|---|
| 143 |
* Asynchronous version of g_proxy_connect(). |
|---|
| 144 |
* Since 2.26 |
|---|
| 145 |
* Params: |
|---|
| 146 |
* proxy = a GProxy |
|---|
| 147 |
* connection = a GIOStream |
|---|
| 148 |
* proxyAddress = a GProxyAddress |
|---|
| 149 |
* cancellable = a GCancellable. [allow-none] |
|---|
| 150 |
* callback = a GAsyncReadyCallback. [scope async] |
|---|
| 151 |
* userData = callback data. [closure] |
|---|
| 152 |
*/ |
|---|
| 153 |
public void gProxyConnectAsync(IOStream connection, ProxyAddress proxyAddress, Cancellable cancellable, GAsyncReadyCallback callback, void* userData) |
|---|
| 154 |
{ |
|---|
| 155 |
// void g_proxy_connect_async (GProxy *proxy, GIOStream *connection, GProxyAddress *proxy_address, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); |
|---|
| 156 |
g_proxy_connect_async(getProxyTStruct(), (connection is null) ? null : connection.getIOStreamStruct(), (proxyAddress is null) ? null : proxyAddress.getProxyAddressStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); |
|---|
| 157 |
} |
|---|
| 158 |
|
|---|
| 159 |
/** |
|---|
| 160 |
* See g_proxy_connect(). |
|---|
| 161 |
* Since 2.26 |
|---|
| 162 |
* Params: |
|---|
| 163 |
* result = a GAsyncRetult |
|---|
| 164 |
* Returns: a GIOStream. [transfer full] |
|---|
| 165 |
* Throws: GException on failure. |
|---|
| 166 |
*/ |
|---|
| 167 |
public IOStream gProxyConnectFinish(AsyncResultIF result) |
|---|
| 168 |
{ |
|---|
| 169 |
// GIOStream * g_proxy_connect_finish (GProxy *proxy, GAsyncResult *result, GError **error); |
|---|
| 170 |
GError* err = null; |
|---|
| 171 |
|
|---|
| 172 |
auto p = g_proxy_connect_finish(getProxyTStruct(), (result is null) ? null : result.getAsyncResultTStruct(), &err); |
|---|
| 173 |
|
|---|
| 174 |
if (err !is null) |
|---|
| 175 |
{ |
|---|
| 176 |
throw new GException( new ErrorG(err) ); |
|---|
| 177 |
} |
|---|
| 178 |
|
|---|
| 179 |
if(p is null) |
|---|
| 180 |
{ |
|---|
| 181 |
return null; |
|---|
| 182 |
} |
|---|
| 183 |
return new IOStream(cast(GIOStream*) p); |
|---|
| 184 |
} |
|---|
| 185 |
|
|---|
| 186 |
/** |
|---|
| 187 |
* Lookup "gio-proxy" extension point for a proxy implementation that supports |
|---|
| 188 |
* specified protocol. |
|---|
| 189 |
* Since 2.26 |
|---|
| 190 |
* Params: |
|---|
| 191 |
* protocol = the proxy protocol name (e.g. http, socks, etc) |
|---|
| 192 |
* Returns: return a GProxy or NULL if protocol is not supported. [transfer full] |
|---|
| 193 |
*/ |
|---|
| 194 |
public static ProxyIF gProxyGetDefaultForProtocol(string protocol) |
|---|
| 195 |
{ |
|---|
| 196 |
// GProxy * g_proxy_get_default_for_protocol (const gchar *protocol); |
|---|
| 197 |
auto p = g_proxy_get_default_for_protocol(Str.toStringz(protocol)); |
|---|
| 198 |
if(p is null) |
|---|
| 199 |
{ |
|---|
| 200 |
return null; |
|---|
| 201 |
} |
|---|
| 202 |
return new Proxy(cast(GProxy*) p); |
|---|
| 203 |
} |
|---|
| 204 |
|
|---|
| 205 |
/** |
|---|
| 206 |
* Some proxy protocols expect to be passed a hostname, which they |
|---|
| 207 |
* will resolve to an IP address themselves. Others, like SOCKS4, do |
|---|
| 208 |
* not allow this. This function will return FALSE if proxy is |
|---|
| 209 |
* implementing such a protocol. When FALSE is returned, the caller |
|---|
| 210 |
* should resolve the destination hostname first, and then pass a |
|---|
| 211 |
* GProxyAddress containing the stringified IP address to |
|---|
| 212 |
* g_proxy_connect() or g_proxy_connect_async(). |
|---|
| 213 |
* Since 2.26 |
|---|
| 214 |
* Returns: TRUE if hostname resolution is supported. |
|---|
| 215 |
*/ |
|---|
| 216 |
public int gProxySupportsHostname() |
|---|
| 217 |
{ |
|---|
| 218 |
// gboolean g_proxy_supports_hostname (GProxy *proxy); |
|---|
| 219 |
return g_proxy_supports_hostname(getProxyTStruct()); |
|---|
| 220 |
} |
|---|
| 221 |
} |
|---|