1// Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gio
3
4import (
5 "structs"
6 "unsafe"
7
8 "github.com/ebitengine/purego"
9
10 "github.com/bnema/puregotk/pkg/core"
11 "github.com/bnema/puregotk/v4/gobject"
12 "github.com/bnema/puregotk/v4/gobject/types"
13)
14
15type InetSocketAddressClass struct {
16 _ structs.HostLayout
17
18 ParentClass SocketAddressClass
19}
20
21func (x *InetSocketAddressClass) GoPointer() uintptr {
22 return uintptr(unsafe.Pointer(x))
23}
24
25type InetSocketAddressPrivate struct {
26 _ structs.HostLayout
27}
28
29func (x *InetSocketAddressPrivate) GoPointer() uintptr {
30 return uintptr(unsafe.Pointer(x))
31}
32
33// An IPv4 or IPv6 socket address. That is, the combination of a
34// [class@Gio.InetAddress] and a port number.
35//
36// In UNIX terms, `GInetSocketAddress` corresponds to a
37// [`struct sockaddr_in` or `struct sockaddr_in6`](man:sockaddr(3type)).
38type InetSocketAddress struct {
39 SocketAddress
40}
41
42var xInetSocketAddressGLibType func() types.GType
43
44func InetSocketAddressGLibType() types.GType {
45 return xInetSocketAddressGLibType()
46}
47
48func InetSocketAddressNewFromInternalPtr(ptr uintptr) *InetSocketAddress {
49 cls := &InetSocketAddress{}
50 cls.Ptr = ptr
51 return cls
52}
53
54var xNewInetSocketAddress func(uintptr, uint16) uintptr
55
56// Creates a new #GInetSocketAddress for @address and @port.
57func NewInetSocketAddress(AddressVar *InetAddress, PortVar uint16) *InetSocketAddress {
58 var cls *InetSocketAddress
59
60 cret := xNewInetSocketAddress(AddressVar.GoPointer(), PortVar)
61
62 if cret == 0 {
63 return nil
64 }
65 cls = &InetSocketAddress{}
66 cls.Ptr = cret
67 return cls
68}
69
70var xNewInetSocketAddressFromString func(string, uint) uintptr
71
72// Creates a new #GInetSocketAddress for @address and @port.
73//
74// If @address is an IPv6 address, it can also contain a scope ID
75// (separated from the address by a `%`). Note that currently this
76// behavior is platform specific. This may change in a future release.
77func NewInetSocketAddressFromString(AddressVar string, PortVar uint) *InetSocketAddress {
78 var cls *InetSocketAddress
79
80 cret := xNewInetSocketAddressFromString(AddressVar, PortVar)
81
82 if cret == 0 {
83 return nil
84 }
85 cls = &InetSocketAddress{}
86 cls.Ptr = cret
87 return cls
88}
89
90var xInetSocketAddressGetAddress func(uintptr) uintptr
91
92// Gets @address's #GInetAddress.
93func (x *InetSocketAddress) GetAddress() *InetAddress {
94 var cls *InetAddress
95
96 cret := xInetSocketAddressGetAddress(x.GoPointer())
97
98 if cret == 0 {
99 return nil
100 }
101 gobject.IncreaseRef(cret)
102 cls = &InetAddress{}
103 cls.Ptr = cret
104 return cls
105}
106
107var xInetSocketAddressGetFlowinfo func(uintptr) uint32
108
109// Gets the `sin6_flowinfo` field from @address,
110// which must be an IPv6 address.
111//
112// If not overridden this value will be inherited from [property@Gio.InetSocketAddress:address].
113func (x *InetSocketAddress) GetFlowinfo() uint32 {
114
115 cret := xInetSocketAddressGetFlowinfo(x.GoPointer())
116 return cret
117}
118
119var xInetSocketAddressGetPort func(uintptr) uint16
120
121// Gets @address's port.
122func (x *InetSocketAddress) GetPort() uint16 {
123
124 cret := xInetSocketAddressGetPort(x.GoPointer())
125 return cret
126}
127
128var xInetSocketAddressGetScopeId func(uintptr) uint32
129
130// Gets the `sin6_scope_id` field from @address,
131// which must be an IPv6 address.
132//
133// If not overridden this value will be inherited from [property@Gio.InetSocketAddress:address].
134func (x *InetSocketAddress) GetScopeId() uint32 {
135
136 cret := xInetSocketAddressGetScopeId(x.GoPointer())
137 return cret
138}
139
140func (c *InetSocketAddress) GoPointer() uintptr {
141 if c == nil {
142 return 0
143 }
144 return c.Ptr
145}
146
147func (c *InetSocketAddress) SetGoPointer(ptr uintptr) {
148 c.Ptr = ptr
149}
150
151// SetPropertyFlowinfo sets the "flowinfo" property.
152// The `sin6_flowinfo` field, for IPv6 addresses.
153//
154// If unset this property is inherited from [property@Gio.InetSocketAddress:address].
155func (x *InetSocketAddress) SetPropertyFlowinfo(value uint) {
156 var v gobject.Value
157 v.Init(gobject.TypeUintVal)
158 v.SetUint(value)
159 x.SetProperty("flowinfo", &v)
160}
161
162// GetPropertyFlowinfo gets the "flowinfo" property.
163// The `sin6_flowinfo` field, for IPv6 addresses.
164//
165// If unset this property is inherited from [property@Gio.InetSocketAddress:address].
166func (x *InetSocketAddress) GetPropertyFlowinfo() uint {
167 var v gobject.Value
168 x.GetProperty("flowinfo", &v)
169 return v.GetUint()
170}
171
172// SetPropertyPort sets the "port" property.
173// The port.
174func (x *InetSocketAddress) SetPropertyPort(value uint) {
175 var v gobject.Value
176 v.Init(gobject.TypeUintVal)
177 v.SetUint(value)
178 x.SetProperty("port", &v)
179}
180
181// GetPropertyPort gets the "port" property.
182// The port.
183func (x *InetSocketAddress) GetPropertyPort() uint {
184 var v gobject.Value
185 x.GetProperty("port", &v)
186 return v.GetUint()
187}
188
189// SetPropertyScopeId sets the "scope-id" property.
190// The `sin6_scope_id` field, for IPv6 addresses.
191//
192// If unset this property is inherited from [property@Gio.InetSocketAddress:address].
193func (x *InetSocketAddress) SetPropertyScopeId(value uint) {
194 var v gobject.Value
195 v.Init(gobject.TypeUintVal)
196 v.SetUint(value)
197 x.SetProperty("scope-id", &v)
198}
199
200// GetPropertyScopeId gets the "scope-id" property.
201// The `sin6_scope_id` field, for IPv6 addresses.
202//
203// If unset this property is inherited from [property@Gio.InetSocketAddress:address].
204func (x *InetSocketAddress) GetPropertyScopeId() uint {
205 var v gobject.Value
206 x.GetProperty("scope-id", &v)
207 return v.GetUint()
208}
209
210// Creates a #GSocketAddressEnumerator for @connectable.
211func (x *InetSocketAddress) Enumerate() *SocketAddressEnumerator {
212 var cls *SocketAddressEnumerator
213
214 cret := XGSocketConnectableEnumerate(x.GoPointer())
215
216 if cret == 0 {
217 return nil
218 }
219 cls = &SocketAddressEnumerator{}
220 cls.Ptr = cret
221 return cls
222}
223
224// Creates a #GSocketAddressEnumerator for @connectable that will
225// return a #GProxyAddress for each of its addresses that you must connect
226// to via a proxy.
227//
228// If @connectable does not implement
229// g_socket_connectable_proxy_enumerate(), this will fall back to
230// calling g_socket_connectable_enumerate().
231func (x *InetSocketAddress) ProxyEnumerate() *SocketAddressEnumerator {
232 var cls *SocketAddressEnumerator
233
234 cret := XGSocketConnectableProxyEnumerate(x.GoPointer())
235
236 if cret == 0 {
237 return nil
238 }
239 cls = &SocketAddressEnumerator{}
240 cls.Ptr = cret
241 return cls
242}
243
244// Format a #GSocketConnectable as a string. This is a human-readable format for
245// use in debugging output, and is not a stable serialization format. It is not
246// suitable for use in user interfaces as it exposes too much information for a
247// user.
248//
249// If the #GSocketConnectable implementation does not support string formatting,
250// the implementation’s type name will be returned as a fallback.
251func (x *InetSocketAddress) ToString() string {
252
253 cret := XGSocketConnectableToString(x.GoPointer())
254 return cret
255}
256
257func init() {
258 core.SetPackageName("GIO", "gio-2.0")
259 core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"})
260 var libs []uintptr
261 for _, libPath := range core.GetPaths("GIO") {
262 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
263 if err != nil {
264 panic(err)
265 }
266 libs = append(libs, lib)
267 }
268
269 core.PuregoSafeRegister(&xInetSocketAddressGLibType, libs, "g_inet_socket_address_get_type")
270
271 core.PuregoSafeRegister(&xNewInetSocketAddress, libs, "g_inet_socket_address_new")
272 core.PuregoSafeRegister(&xNewInetSocketAddressFromString, libs, "g_inet_socket_address_new_from_string")
273
274 core.PuregoSafeRegister(&xInetSocketAddressGetAddress, libs, "g_inet_socket_address_get_address")
275 core.PuregoSafeRegister(&xInetSocketAddressGetFlowinfo, libs, "g_inet_socket_address_get_flowinfo")
276 core.PuregoSafeRegister(&xInetSocketAddressGetPort, libs, "g_inet_socket_address_get_port")
277 core.PuregoSafeRegister(&xInetSocketAddressGetScopeId, libs, "g_inet_socket_address_get_scope_id")
278
279}