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.ProxyAddress;
26 
27 private import gio.InetAddress;
28 private import gio.InetSocketAddress;
29 private import gio.SocketAddress;
30 private import gio.c.functions;
31 public  import gio.c.types;
32 private import glib.ConstructionException;
33 private import glib.Str;
34 private import gobject.ObjectG;
35 public  import gtkc.giotypes;
36 
37 
38 /**
39  * Support for proxied #GInetSocketAddress.
40  *
41  * Since: 2.26
42  */
43 public class ProxyAddress : InetSocketAddress
44 {
45 	/** the main Gtk struct */
46 	protected GProxyAddress* gProxyAddress;
47 
48 	/** Get the main Gtk struct */
49 	public GProxyAddress* getProxyAddressStruct(bool transferOwnership = false)
50 	{
51 		if (transferOwnership)
52 			ownedRef = false;
53 		return gProxyAddress;
54 	}
55 
56 	/** the main Gtk struct as a void* */
57 	protected override void* getStruct()
58 	{
59 		return cast(void*)gProxyAddress;
60 	}
61 
62 	protected override void setStruct(GObject* obj)
63 	{
64 		gProxyAddress = cast(GProxyAddress*)obj;
65 		super.setStruct(obj);
66 	}
67 
68 	/**
69 	 * Sets our main struct and passes it to the parent class.
70 	 */
71 	public this (GProxyAddress* gProxyAddress, bool ownedRef = false)
72 	{
73 		this.gProxyAddress = gProxyAddress;
74 		super(cast(GInetSocketAddress*)gProxyAddress, ownedRef);
75 	}
76 
77 
78 	/** */
79 	public static GType getType()
80 	{
81 		return g_proxy_address_get_type();
82 	}
83 
84 	/**
85 	 * Creates a new #GProxyAddress for @inetaddr with @protocol that should
86 	 * tunnel through @dest_hostname and @dest_port.
87 	 *
88 	 * (Note that this method doesn't set the #GProxyAddress:uri or
89 	 * #GProxyAddress:destination-protocol fields; use g_object_new()
90 	 * directly if you want to set those.)
91 	 *
92 	 * Params:
93 	 *     inetaddr = The proxy server #GInetAddress.
94 	 *     port = The proxy server port.
95 	 *     protocol = The proxy protocol to support, in lower case (e.g. socks, http).
96 	 *     destHostname = The destination hostname the proxy should tunnel to.
97 	 *     destPort = The destination port to tunnel to.
98 	 *     username = The username to authenticate to the proxy server
99 	 *         (or %NULL).
100 	 *     password = The password to authenticate to the proxy server
101 	 *         (or %NULL).
102 	 *
103 	 * Returns: a new #GProxyAddress
104 	 *
105 	 * Since: 2.26
106 	 *
107 	 * Throws: ConstructionException GTK+ fails to create the object.
108 	 */
109 	public this(InetAddress inetaddr, ushort port, string protocol, string destHostname, ushort destPort, string username, string password)
110 	{
111 		auto p = g_proxy_address_new((inetaddr is null) ? null : inetaddr.getInetAddressStruct(), port, Str.toStringz(protocol), Str.toStringz(destHostname), destPort, Str.toStringz(username), Str.toStringz(password));
112 
113 		if(p is null)
114 		{
115 			throw new ConstructionException("null returned by new");
116 		}
117 
118 		this(cast(GProxyAddress*) p, true);
119 	}
120 
121 	/**
122 	 * Gets @proxy's destination hostname; that is, the name of the host
123 	 * that will be connected to via the proxy, not the name of the proxy
124 	 * itself.
125 	 *
126 	 * Returns: the @proxy's destination hostname
127 	 *
128 	 * Since: 2.26
129 	 */
130 	public string getDestinationHostname()
131 	{
132 		return Str.toString(g_proxy_address_get_destination_hostname(gProxyAddress));
133 	}
134 
135 	/**
136 	 * Gets @proxy's destination port; that is, the port on the
137 	 * destination host that will be connected to via the proxy, not the
138 	 * port number of the proxy itself.
139 	 *
140 	 * Returns: the @proxy's destination port
141 	 *
142 	 * Since: 2.26
143 	 */
144 	public ushort getDestinationPort()
145 	{
146 		return g_proxy_address_get_destination_port(gProxyAddress);
147 	}
148 
149 	/**
150 	 * Gets the protocol that is being spoken to the destination
151 	 * server; eg, "http" or "ftp".
152 	 *
153 	 * Returns: the @proxy's destination protocol
154 	 *
155 	 * Since: 2.34
156 	 */
157 	public string getDestinationProtocol()
158 	{
159 		return Str.toString(g_proxy_address_get_destination_protocol(gProxyAddress));
160 	}
161 
162 	/**
163 	 * Gets @proxy's password.
164 	 *
165 	 * Returns: the @proxy's password
166 	 *
167 	 * Since: 2.26
168 	 */
169 	public string getPassword()
170 	{
171 		return Str.toString(g_proxy_address_get_password(gProxyAddress));
172 	}
173 
174 	/**
175 	 * Gets @proxy's protocol. eg, "socks" or "http"
176 	 *
177 	 * Returns: the @proxy's protocol
178 	 *
179 	 * Since: 2.26
180 	 */
181 	public string getProtocol()
182 	{
183 		return Str.toString(g_proxy_address_get_protocol(gProxyAddress));
184 	}
185 
186 	/**
187 	 * Gets the proxy URI that @proxy was constructed from.
188 	 *
189 	 * Returns: the @proxy's URI, or %NULL if unknown
190 	 *
191 	 * Since: 2.34
192 	 */
193 	public string getUri()
194 	{
195 		return Str.toString(g_proxy_address_get_uri(gProxyAddress));
196 	}
197 
198 	/**
199 	 * Gets @proxy's username.
200 	 *
201 	 * Returns: the @proxy's username
202 	 *
203 	 * Since: 2.26
204 	 */
205 	public string getUsername()
206 	{
207 		return Str.toString(g_proxy_address_get_username(gProxyAddress));
208 	}
209 }