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