Class UnixCredentialsMessage
- All Implemented Interfaces:
Proxy
This SocketControlMessage contains a Credentials
instance. It may be sent using Socket.sendMessage(SocketAddress, OutputVector[], SocketControlMessage[], int, Cancellable) and received
using Socket.receiveMessage(Out, InputVector[], Out, Out, Cancellable) over UNIX sockets (ie: sockets in
the G_SOCKET_FAMILY_UNIX family).
For an easier way to send and receive credentials over
stream-oriented UNIX sockets, see
UnixConnection.sendCredentials(Cancellable) and
UnixConnection.receiveCredentials(Cancellable). To receive credentials of
a foreign process connected to a socket, use
Socket.getCredentials().
Since GLib 2.72, GUnixCredentialMessage is available on all platforms. It
requires underlying system support (such as Windows 10 with AF_UNIX) at run
time.
Before GLib 2.72, <gio/gunixcredentialsmessage.h> belonged to the UNIX-specific
GIO interfaces, thus you had to use the gio-unix-2.0.pc pkg-config file
when using it. This is no longer necessary since GLib 2.72.
- Since:
- 2.26
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classInner class implementing a builder pattern to construct a GObject with properties.static classClass structure forGUnixCredentialsMessage.Nested classes/interfaces inherited from class SocketControlMessage
SocketControlMessage.SocketControlMessage$Impl, SocketControlMessage.SocketControlMessageClassNested classes/interfaces inherited from class GObject
GObject.NotifyCallback, GObject.ObjectClass -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new UnixCredentialsMessage.UnixCredentialsMessage(MemorySegment address) Create a UnixCredentialsMessage instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected UnixCredentialsMessageasParent()Return this instance as if it were its parent type.static UnixCredentialsMessage.Builder<? extends UnixCredentialsMessage.Builder> builder()AUnixCredentialsMessage.Builderobject constructs aUnixCredentialsMessagewith the specified properties.Gets the credentials stored inmessage.static MemoryLayoutThe memory layout of the native struct.static @Nullable TypegetType()Get the GType of the UnixCredentialsMessage class.static booleanChecks if passingGCredentialson aGSocketis supported on this platform.static SocketControlMessagewithCredentials(Credentials credentials) Creates a newGUnixCredentialsMessageholdingcredentials.Methods inherited from class SocketControlMessage
deserialize, getLevel, getMsgType, getSize, serializeMethods inherited from class GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newv, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withPropertiesMethods inherited from class TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
UnixCredentialsMessage
Create a UnixCredentialsMessage instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
UnixCredentialsMessage
public UnixCredentialsMessage()Create a new UnixCredentialsMessage.
-
-
Method Details
-
getType
Get the GType of the UnixCredentialsMessage class.- Returns:
- the GType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
asParent
Return this instance as if it were its parent type. Comparable to the Javasuperkeyword, but ensures the parent typeclass is also used in native code.- Overrides:
asParentin classSocketControlMessage- Returns:
- the instance as if it were its parent type
-
withCredentials
Creates a newGUnixCredentialsMessageholdingcredentials.- Parameters:
credentials- AGCredentialsobject.- Returns:
- a new
GUnixCredentialsMessage - Since:
- 2.26
-
isSupported
public static boolean isSupported()Checks if passingGCredentialson aGSocketis supported on this platform.- Returns:
trueif supported,falseotherwise- Since:
- 2.26
-
getCredentials
Gets the credentials stored inmessage.- Returns:
- A
GCredentialsinstance. Do not free, it is owned bymessage. - Since:
- 2.26
-
builder
AUnixCredentialsMessage.Builderobject constructs aUnixCredentialsMessagewith the specified properties. Use the variousset...()methods to set properties, and finish construction withUnixCredentialsMessage.Builder.build().- Returns:
- the builder object
-