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