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 public static GType getType() 77 { 78 return g_proxy_address_get_type(); 79 } 80 81 /** 82 * Creates a new #GProxyAddress for @inetaddr with @protocol that should 83 * tunnel through @dest_hostname and @dest_port. 84 * 85 * (Note that this method doesn't set the #GProxyAddress:uri or 86 * #GProxyAddress:destination-protocol fields; use g_object_new() 87 * directly if you want to set those.) 88 * 89 * Params: 90 * inetaddr = The proxy server #GInetAddress. 91 * port = The proxy server port. 92 * protocol = The proxy protocol to support, in lower case (e.g. socks, http). 93 * destHostname = The destination hostname the proxy should tunnel to. 94 * destPort = The destination port to tunnel to. 95 * username = The username to authenticate to the proxy server 96 * (or %NULL). 97 * password = The password to authenticate to the proxy server 98 * (or %NULL). 99 * 100 * Return: a new #GProxyAddress 101 * 102 * Since: 2.26 103 * 104 * Throws: ConstructionException GTK+ fails to create the object. 105 */ 106 public this(InetAddress inetaddr, ushort port, string protocol, string destHostname, ushort destPort, string username, string password) 107 { 108 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)); 109 110 if(p is null) 111 { 112 throw new ConstructionException("null returned by new"); 113 } 114 115 this(cast(GProxyAddress*) p, true); 116 } 117 118 /** 119 * Gets @proxy's destination hostname; that is, the name of the host 120 * that will be connected to via the proxy, not the name of the proxy 121 * itself. 122 * 123 * Return: the @proxy's destination hostname 124 * 125 * Since: 2.26 126 */ 127 public string getDestinationHostname() 128 { 129 return Str.toString(g_proxy_address_get_destination_hostname(gProxyAddress)); 130 } 131 132 /** 133 * Gets @proxy's destination port; that is, the port on the 134 * destination host that will be connected to via the proxy, not the 135 * port number of the proxy itself. 136 * 137 * Return: the @proxy's destination port 138 * 139 * Since: 2.26 140 */ 141 public ushort getDestinationPort() 142 { 143 return g_proxy_address_get_destination_port(gProxyAddress); 144 } 145 146 /** 147 * Gets the protocol that is being spoken to the destination 148 * server; eg, "http" or "ftp". 149 * 150 * Return: the @proxy's destination protocol 151 * 152 * Since: 2.34 153 */ 154 public string getDestinationProtocol() 155 { 156 return Str.toString(g_proxy_address_get_destination_protocol(gProxyAddress)); 157 } 158 159 /** 160 * Gets @proxy's password. 161 * 162 * Return: the @proxy's password 163 * 164 * Since: 2.26 165 */ 166 public string getPassword() 167 { 168 return Str.toString(g_proxy_address_get_password(gProxyAddress)); 169 } 170 171 /** 172 * Gets @proxy's protocol. eg, "socks" or "http" 173 * 174 * Return: the @proxy's protocol 175 * 176 * Since: 2.26 177 */ 178 public string getProtocol() 179 { 180 return Str.toString(g_proxy_address_get_protocol(gProxyAddress)); 181 } 182 183 /** 184 * Gets the proxy URI that @proxy was constructed from. 185 * 186 * Return: the @proxy's URI, or %NULL if unknown 187 * 188 * Since: 2.34 189 */ 190 public string getUri() 191 { 192 return Str.toString(g_proxy_address_get_uri(gProxyAddress)); 193 } 194 195 /** 196 * Gets @proxy's username. 197 * 198 * Return: the @proxy's username 199 * 200 * Since: 2.26 201 */ 202 public string getUsername() 203 { 204 return Str.toString(g_proxy_address_get_username(gProxyAddress)); 205 } 206 }