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