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 private import gio.InetAddress;
63 
64 
65 private import gio.SocketAddress;
66 
67 /**
68  * An IPv4 or IPv6 socket address; that is, the combination of a
69  * GInetAddress and a port number.
70  */
71 public class InetSocketAddress : SocketAddress
72 {
73 	
74 	/** the main Gtk struct */
75 	protected GInetSocketAddress* gInetSocketAddress;
76 	
77 	
78 	/** Get the main Gtk struct */
79 	public GInetSocketAddress* getInetSocketAddressStruct()
80 	{
81 		return gInetSocketAddress;
82 	}
83 	
84 	
85 	/** the main Gtk struct as a void* */
86 	protected override void* getStruct()
87 	{
88 		return cast(void*)gInetSocketAddress;
89 	}
90 	
91 	/**
92 	 * Sets our main struct and passes it to the parent class
93 	 */
94 	public this (GInetSocketAddress* gInetSocketAddress)
95 	{
96 		super(cast(GSocketAddress*)gInetSocketAddress);
97 		this.gInetSocketAddress = gInetSocketAddress;
98 	}
99 	
100 	protected override void setStruct(GObject* obj)
101 	{
102 		super.setStruct(obj);
103 		gInetSocketAddress = cast(GInetSocketAddress*)obj;
104 	}
105 	
106 	/**
107 	 */
108 	
109 	/**
110 	 * Creates a new GInetSocketAddress for address and port.
111 	 * Since 2.22
112 	 * Params:
113 	 * address = a GInetAddress
114 	 * port = a port number
115 	 * Throws: ConstructionException GTK+ fails to create the object.
116 	 */
117 	public this (InetAddress address, ushort port)
118 	{
119 		// GSocketAddress * g_inet_socket_address_new (GInetAddress *address,  guint16 port);
120 		auto p = g_inet_socket_address_new((address is null) ? null : address.getInetAddressStruct(), port);
121 		if(p is null)
122 		{
123 			throw new ConstructionException("null returned by g_inet_socket_address_new((address is null) ? null : address.getInetAddressStruct(), port)");
124 		}
125 		this(cast(GInetSocketAddress*) p);
126 	}
127 	
128 	/**
129 	 * Gets address's GInetAddress.
130 	 * Since 2.22
131 	 * Returns: the GInetAddress for address, which must be g_object_ref()'d if it will be stored. [transfer none]
132 	 */
133 	public InetAddress getAddress()
134 	{
135 		// GInetAddress * g_inet_socket_address_get_address (GInetSocketAddress *address);
136 		auto p = g_inet_socket_address_get_address(gInetSocketAddress);
137 		
138 		if(p is null)
139 		{
140 			return null;
141 		}
142 		
143 		return ObjectG.getDObject!(InetAddress)(cast(GInetAddress*) p);
144 	}
145 	
146 	/**
147 	 * Gets address's port.
148 	 * Since 2.22
149 	 * Returns: the port for address
150 	 */
151 	public ushort getPort()
152 	{
153 		// guint16 g_inet_socket_address_get_port (GInetSocketAddress *address);
154 		return g_inet_socket_address_get_port(gInetSocketAddress);
155 	}
156 	
157 	/**
158 	 * Gets the sin6_flowinfo field from address,
159 	 * which must be an IPv6 address.
160 	 * Since 2.32
161 	 * Returns: the flowinfo field
162 	 */
163 	public uint getFlowinfo()
164 	{
165 		// guint32 g_inet_socket_address_get_flowinfo (GInetSocketAddress *address);
166 		return g_inet_socket_address_get_flowinfo(gInetSocketAddress);
167 	}
168 	
169 	/**
170 	 * Gets the sin6_scope_id field from address,
171 	 * which must be an IPv6 address.
172 	 * Since 2.32
173 	 * Returns: the scope id field
174 	 */
175 	public uint getScopeId()
176 	{
177 		// guint32 g_inet_socket_address_get_scope_id (GInetSocketAddress *address);
178 		return g_inet_socket_address_get_scope_id(gInetSocketAddress);
179 	}
180 }