v0.2.1 c0399be

gunixconnection.go RawHistoryFolder

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/glib"
12	"github.com/bnema/puregotk/v4/gobject/types"
13)
14
15type UnixConnectionClass struct {
16	_ structs.HostLayout
17
18	ParentClass SocketConnectionClass
19}
20
21func (x *UnixConnectionClass) GoPointer() uintptr {
22	return uintptr(unsafe.Pointer(x))
23}
24
25type UnixConnectionPrivate struct {
26	_ structs.HostLayout
27}
28
29func (x *UnixConnectionPrivate) GoPointer() uintptr {
30	return uintptr(unsafe.Pointer(x))
31}
32
33// This is the subclass of [class@Gio.SocketConnection] that is created
34// for UNIX domain sockets.
35//
36// It contains functions to do some of the UNIX socket specific
37// functionality like passing file descriptors.
38//
39// Since GLib 2.72, `GUnixConnection` is available on all platforms. It requires
40// underlying system support (such as Windows 10 with `AF_UNIX`) at run time.
41//
42// Before GLib 2.72, `<gio/gunixconnection.h>` belonged to the UNIX-specific GIO
43// interfaces, thus you had to use the `gio-unix-2.0.pc` pkg-config file when
44// using it. This is no longer necessary since GLib 2.72.
45type UnixConnection struct {
46	SocketConnection
47}
48
49var xUnixConnectionGLibType func() types.GType
50
51func UnixConnectionGLibType() types.GType {
52	return xUnixConnectionGLibType()
53}
54
55func UnixConnectionNewFromInternalPtr(ptr uintptr) *UnixConnection {
56	cls := &UnixConnection{}
57	cls.Ptr = ptr
58	return cls
59}
60
61var xUnixConnectionReceiveCredentials func(uintptr, uintptr, **glib.Error) uintptr
62
63// Receives credentials from the sending end of the connection.  The
64// sending end has to call g_unix_connection_send_credentials() (or
65// similar) for this to work.
66//
67// As well as reading the credentials this also reads (and discards) a
68// single byte from the stream, as this is required for credentials
69// passing to work on some implementations.
70//
71// This method can be expected to be available on the following platforms:
72//
73// - Linux since GLib 2.26
74// - FreeBSD since GLib 2.26
75// - GNU/kFreeBSD since GLib 2.36
76// - Solaris, Illumos and OpenSolaris since GLib 2.40
77// - GNU/Hurd since GLib 2.40
78//
79// Other ways to exchange credentials with a foreign peer includes the
80// #GUnixCredentialsMessage type and g_socket_get_credentials() function.
81func (x *UnixConnection) ReceiveCredentials(CancellableVar *Cancellable) (*Credentials, error) {
82	var cls *Credentials
83	var cerr *glib.Error
84
85	cret := xUnixConnectionReceiveCredentials(x.GoPointer(), CancellableVar.GoPointer(), &cerr)
86
87	if cret == 0 {
88		return nil, cerr
89	}
90	cls = &Credentials{}
91	cls.Ptr = cret
92	if cerr == nil {
93		return cls, nil
94	}
95	return cls, cerr
96
97}
98
99var xUnixConnectionReceiveCredentialsAsync func(uintptr, uintptr, uintptr, uintptr)
100
101// Asynchronously receive credentials.
102//
103// For more details, see g_unix_connection_receive_credentials() which is
104// the synchronous version of this call.
105//
106// When the operation is finished, @callback will be called. You can then call
107// g_unix_connection_receive_credentials_finish() to get the result of the operation.
108func (x *UnixConnection) ReceiveCredentialsAsync(CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
109
110	var CallbackVarRef uintptr
111	if CallbackVar != nil {
112		CallbackVarPtr := uintptr(unsafe.Pointer(CallbackVar))
113		if cbRefPtr, ok := glib.GetCallback(CallbackVarPtr); ok {
114			CallbackVarRef = cbRefPtr
115		} else {
116			fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) {
117				cbFn := *CallbackVar
118				cbFn(arg0, arg1, arg2)
119			}
120			CallbackVarRef = purego.NewCallback(fcb)
121			glib.SaveCallbackWithClosure(CallbackVarPtr, CallbackVarRef, CallbackVar)
122		}
123	}
124
125	xUnixConnectionReceiveCredentialsAsync(x.GoPointer(), CancellableVar.GoPointer(), CallbackVarRef, UserDataVar)
126
127}
128
129var xUnixConnectionReceiveCredentialsFinish func(uintptr, uintptr, **glib.Error) uintptr
130
131// Finishes an asynchronous receive credentials operation started with
132// g_unix_connection_receive_credentials_async().
133func (x *UnixConnection) ReceiveCredentialsFinish(ResultVar AsyncResult) (*Credentials, error) {
134	var cls *Credentials
135	var cerr *glib.Error
136
137	cret := xUnixConnectionReceiveCredentialsFinish(x.GoPointer(), ResultVar.GoPointer(), &cerr)
138
139	if cret == 0 {
140		return nil, cerr
141	}
142	cls = &Credentials{}
143	cls.Ptr = cret
144	if cerr == nil {
145		return cls, nil
146	}
147	return cls, cerr
148
149}
150
151var xUnixConnectionReceiveFd func(uintptr, uintptr, **glib.Error) int
152
153// Receives a file descriptor from the sending end of the connection.
154// The sending end has to call g_unix_connection_send_fd() for this
155// to work.
156//
157// As well as reading the fd this also reads a single byte from the
158// stream, as this is required for fd passing to work on some
159// implementations.
160func (x *UnixConnection) ReceiveFd(CancellableVar *Cancellable) (int, error) {
161	var cerr *glib.Error
162
163	cret := xUnixConnectionReceiveFd(x.GoPointer(), CancellableVar.GoPointer(), &cerr)
164	if cerr == nil {
165		return cret, nil
166	}
167	return cret, cerr
168
169}
170
171var xUnixConnectionSendCredentials func(uintptr, uintptr, **glib.Error) bool
172
173// Passes the credentials of the current user the receiving side
174// of the connection. The receiving end has to call
175// g_unix_connection_receive_credentials() (or similar) to accept the
176// credentials.
177//
178// As well as sending the credentials this also writes a single NUL
179// byte to the stream, as this is required for credentials passing to
180// work on some implementations.
181//
182// This method can be expected to be available on the following platforms:
183//
184// - Linux since GLib 2.26
185// - FreeBSD since GLib 2.26
186// - GNU/kFreeBSD since GLib 2.36
187// - Solaris, Illumos and OpenSolaris since GLib 2.40
188// - GNU/Hurd since GLib 2.40
189//
190// Other ways to exchange credentials with a foreign peer includes the
191// #GUnixCredentialsMessage type and g_socket_get_credentials() function.
192func (x *UnixConnection) SendCredentials(CancellableVar *Cancellable) (bool, error) {
193	var cerr *glib.Error
194
195	cret := xUnixConnectionSendCredentials(x.GoPointer(), CancellableVar.GoPointer(), &cerr)
196	if cerr == nil {
197		return cret, nil
198	}
199	return cret, cerr
200
201}
202
203var xUnixConnectionSendCredentialsAsync func(uintptr, uintptr, uintptr, uintptr)
204
205// Asynchronously send credentials.
206//
207// For more details, see g_unix_connection_send_credentials() which is
208// the synchronous version of this call.
209//
210// When the operation is finished, @callback will be called. You can then call
211// g_unix_connection_send_credentials_finish() to get the result of the operation.
212func (x *UnixConnection) SendCredentialsAsync(CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
213
214	var CallbackVarRef uintptr
215	if CallbackVar != nil {
216		CallbackVarPtr := uintptr(unsafe.Pointer(CallbackVar))
217		if cbRefPtr, ok := glib.GetCallback(CallbackVarPtr); ok {
218			CallbackVarRef = cbRefPtr
219		} else {
220			fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) {
221				cbFn := *CallbackVar
222				cbFn(arg0, arg1, arg2)
223			}
224			CallbackVarRef = purego.NewCallback(fcb)
225			glib.SaveCallbackWithClosure(CallbackVarPtr, CallbackVarRef, CallbackVar)
226		}
227	}
228
229	xUnixConnectionSendCredentialsAsync(x.GoPointer(), CancellableVar.GoPointer(), CallbackVarRef, UserDataVar)
230
231}
232
233var xUnixConnectionSendCredentialsFinish func(uintptr, uintptr, **glib.Error) bool
234
235// Finishes an asynchronous send credentials operation started with
236// g_unix_connection_send_credentials_async().
237func (x *UnixConnection) SendCredentialsFinish(ResultVar AsyncResult) (bool, error) {
238	var cerr *glib.Error
239
240	cret := xUnixConnectionSendCredentialsFinish(x.GoPointer(), ResultVar.GoPointer(), &cerr)
241	if cerr == nil {
242		return cret, nil
243	}
244	return cret, cerr
245
246}
247
248var xUnixConnectionSendFd func(uintptr, int, uintptr, **glib.Error) bool
249
250// Passes a file descriptor to the receiving side of the
251// connection. The receiving end has to call g_unix_connection_receive_fd()
252// to accept the file descriptor.
253//
254// As well as sending the fd this also writes a single byte to the
255// stream, as this is required for fd passing to work on some
256// implementations.
257func (x *UnixConnection) SendFd(FdVar int, CancellableVar *Cancellable) (bool, error) {
258	var cerr *glib.Error
259
260	cret := xUnixConnectionSendFd(x.GoPointer(), FdVar, CancellableVar.GoPointer(), &cerr)
261	if cerr == nil {
262		return cret, nil
263	}
264	return cret, cerr
265
266}
267
268func (c *UnixConnection) GoPointer() uintptr {
269	if c == nil {
270		return 0
271	}
272	return c.Ptr
273}
274
275func (c *UnixConnection) SetGoPointer(ptr uintptr) {
276	c.Ptr = ptr
277}
278
279func init() {
280	core.SetPackageName("GIO", "gio-2.0")
281	core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"})
282	var libs []uintptr
283	for _, libPath := range core.GetPaths("GIO") {
284		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
285		if err != nil {
286			panic(err)
287		}
288		libs = append(libs, lib)
289	}
290
291	core.PuregoSafeRegister(&xUnixConnectionGLibType, libs, "g_unix_connection_get_type")
292
293	core.PuregoSafeRegister(&xUnixConnectionReceiveCredentials, libs, "g_unix_connection_receive_credentials")
294	core.PuregoSafeRegister(&xUnixConnectionReceiveCredentialsAsync, libs, "g_unix_connection_receive_credentials_async")
295	core.PuregoSafeRegister(&xUnixConnectionReceiveCredentialsFinish, libs, "g_unix_connection_receive_credentials_finish")
296	core.PuregoSafeRegister(&xUnixConnectionReceiveFd, libs, "g_unix_connection_receive_fd")
297	core.PuregoSafeRegister(&xUnixConnectionSendCredentials, libs, "g_unix_connection_send_credentials")
298	core.PuregoSafeRegister(&xUnixConnectionSendCredentialsAsync, libs, "g_unix_connection_send_credentials_async")
299	core.PuregoSafeRegister(&xUnixConnectionSendCredentialsFinish, libs, "g_unix_connection_send_credentials_finish")
300	core.PuregoSafeRegister(&xUnixConnectionSendFd, libs, "g_unix_connection_send_fd")
301
302}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 102

↑↓ moveenter openesc close