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 * Conversion parameters: 26 * inFile = GInetSocketAddress.html 27 * outPack = gio 28 * outFile = InetSocketAddress 29 * strct = GInetSocketAddress 30 * realStrct= 31 * ctorStrct=GSocketAddress 32 * clss = InetSocketAddress 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - g_inet_socket_address_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * - gio.InetAddress 47 * structWrap: 48 * - GInetAddress* -> InetAddress 49 * module aliases: 50 * local aliases: 51 * overrides: 52 */ 53 54 module gio.InetSocketAddress; 55 56 public import gtkc.giotypes; 57 58 private import gtkc.gio; 59 private import glib.ConstructionException; 60 private import gobject.ObjectG; 61 62 63 private import gio.InetAddress; 64 65 66 67 private import gio.SocketAddress; 68 69 /** 70 * An IPv4 or IPv6 socket address; that is, the combination of a 71 * GInetAddress and a port number. 72 */ 73 public class InetSocketAddress : SocketAddress 74 { 75 76 /** the main Gtk struct */ 77 protected GInetSocketAddress* gInetSocketAddress; 78 79 80 public GInetSocketAddress* getInetSocketAddressStruct() 81 { 82 return gInetSocketAddress; 83 } 84 85 86 /** the main Gtk struct as a void* */ 87 protected override void* getStruct() 88 { 89 return cast(void*)gInetSocketAddress; 90 } 91 92 /** 93 * Sets our main struct and passes it to the parent class 94 */ 95 public this (GInetSocketAddress* gInetSocketAddress) 96 { 97 super(cast(GSocketAddress*)gInetSocketAddress); 98 this.gInetSocketAddress = gInetSocketAddress; 99 } 100 101 protected override void setStruct(GObject* obj) 102 { 103 super.setStruct(obj); 104 gInetSocketAddress = cast(GInetSocketAddress*)obj; 105 } 106 107 /** 108 */ 109 110 /** 111 * Creates a new GInetSocketAddress for address and port. 112 * Since 2.22 113 * Params: 114 * address = a GInetAddress 115 * port = a port number 116 * Throws: ConstructionException GTK+ fails to create the object. 117 */ 118 public this (InetAddress address, ushort port) 119 { 120 // GSocketAddress * g_inet_socket_address_new (GInetAddress *address, guint16 port); 121 auto p = g_inet_socket_address_new((address is null) ? null : address.getInetAddressStruct(), port); 122 if(p is null) 123 { 124 throw new ConstructionException("null returned by g_inet_socket_address_new((address is null) ? null : address.getInetAddressStruct(), port)"); 125 } 126 this(cast(GInetSocketAddress*) p); 127 } 128 129 /** 130 * Gets address's GInetAddress. 131 * Since 2.22 132 * Returns: the GInetAddress for address, which must be g_object_ref()'d if it will be stored. [transfer none] 133 */ 134 public InetAddress getAddress() 135 { 136 // GInetAddress * g_inet_socket_address_get_address (GInetSocketAddress *address); 137 auto p = g_inet_socket_address_get_address(gInetSocketAddress); 138 139 if(p is null) 140 { 141 return null; 142 } 143 144 return ObjectG.getDObject!(InetAddress)(cast(GInetAddress*) p); 145 } 146 147 /** 148 * Gets address's port. 149 * Since 2.22 150 * Returns: the port for address 151 */ 152 public ushort getPort() 153 { 154 // guint16 g_inet_socket_address_get_port (GInetSocketAddress *address); 155 return g_inet_socket_address_get_port(gInetSocketAddress); 156 } 157 158 /** 159 * Gets the sin6_flowinfo field from address, 160 * which must be an IPv6 address. 161 * Since 2.32 162 * Returns: the flowinfo field 163 */ 164 public uint getFlowinfo() 165 { 166 // guint32 g_inet_socket_address_get_flowinfo (GInetSocketAddress *address); 167 return g_inet_socket_address_get_flowinfo(gInetSocketAddress); 168 } 169 170 /** 171 * Gets the sin6_scope_id field from address, 172 * which must be an IPv6 address. 173 * Since 2.32 174 * Returns: the scope id field 175 */ 176 public uint getScopeId() 177 { 178 // guint32 g_inet_socket_address_get_scope_id (GInetSocketAddress *address); 179 return g_inet_socket_address_get_scope_id(gInetSocketAddress); 180 } 181 }