UnixCredentialsMessage

This gio.socket_control_message.SocketControlMessage contains a gio.credentials.Credentials instance. It may be sent using gio.socket.Socket.sendMessage and received using gio.socket.Socket.receiveMessage over UNIX sockets (ie: sockets in the gio.types.SocketFamily.Unix family).

For an easier way to send and receive credentials over stream-oriented UNIX sockets, see gio.unix_connection.UnixConnection.sendCredentials and gio.unix_connection.UnixConnection.receiveCredentials. To receive credentials of a foreign process connected to a socket, use gio.socket.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.

Constructors

this
this()

Creates a new #GUnixCredentialsMessage with credentials matching the current processes.

Members

Functions

getCredentials
gio.credentials.Credentials getCredentials()

Gets the credentials stored in message.

Static functions

isSupported
bool isSupported()

Checks if passing #GCredentials on a #GSocket is supported on this platform.

newWithCredentials
gio.unix_credentials_message.UnixCredentialsMessage newWithCredentials(gio.credentials.Credentials credentials)

Creates a new #GUnixCredentialsMessage holding credentials.

Inherited Members

From SocketControlMessage

deserialize
gio.socket_control_message.SocketControlMessage deserialize(int level, int type, ubyte[] data)

Tries to deserialize a socket control message of a given level and type. This will ask all known (to GType) subclasses of #GSocketControlMessage if they can understand this kind of message and if so deserialize it into a #GSocketControlMessage.

getLevel
int getLevel()

Returns the "level" (i.e. the originating protocol) of the control message. This is often SOL_SOCKET.

getMsgType
int getMsgType()

Returns the protocol specific type of the control message. For instance, for UNIX fd passing this would be SCM_RIGHTS.

getSize
size_t getSize()

Returns the space required for the control message, not including headers or alignment.

serialize
void serialize(void* data)

Converts the data in the message to bytes placed in the message.