W Wrapl, The Programming Language

Libraries:Gtk:Gio:GCredentials

Types

T

Inherits from:

The T type is a reference-counted wrapper for native credentials. This information is typically used for identifying, authenticating and authorizing other processes.

Some operating systems supports looking up the credentials of the remote peer of a communication endpoint - see e.g. Gtk.Gio.GSocket.GetCredentials.

Some operating systems supports securely sending and receiving credentials over a Unix Domain Socket, see Gtk.Gio.GUnixCredentialsMessage.T, g_unix_connection_send_credentials() and g_unix_connection_receive_credentials() for details.

On Linux, the native credential type is a struct ucred - see the unix(7) man page for details. This corresponds to Gtk.Gio.GCredentialsType.LinuxUcred.

On FreeBSD, the native credential type is a struct cmsgcred. This corresponds to Gtk.Gio.GCredentialsType.FreebsdCmsgcred.

On OpenBSD, the native credential type is a struct sockpeercred. This corresponds to Gtk.Gio.GCredentialsType.OpenbsdSockpeercred.



Constants

Nil : T

Functions

GetType() : Gtk.GObject.Type.T



New() : Gtk.Gio.GCredentials.T

Creates a new T object with credentials matching the the current process.

Returns A T. Free with g_object_unref().


Methods

:GetNative(self @ T, native_type @ Gtk.Gio.GCredentialsType.T) : Std.Address.T

Gets a pointer to native credentials of type native_type from credentials.

It is a programming error (which will cause an warning to be logged) to use this method if there is no T support for the OS or if native_type isn't supported by the OS.

credentials A T.
native_type The type of native credentials to get.
Returns The pointer to native credentials or NULL if the operation there is no T support for the OS or if native_type isn't supported by the OS. Do not free the returned data, it is owned by credentials.


:GetUnixUser(self @ T, error @ Std.Object.T) : Std.Object.T

Tries to get the UNIX user identifier from credentials. This method is only available on UNIX platforms.

This operation can fail if T is not supported on the OS or if the native credentials type does not contain information about the UNIX user.

credentials A T
error Return location for error or NULL.
Returns The UNIX user identifier or -1 if error is set.


:IsSameUser(self @ T, other_credentials @ Gtk.Gio.GCredentials.T, error @ Std.Object.T) : Std.Symbol.T

Checks if credentials and other_credentials is the same user.

This operation can fail if T is not supported on the the OS.

credentials A T.
other_credentials A T.
error Return location for error or NULL.
Returns TRUE if credentials and other_credentials has the same user, FALSE otherwise or if error is set.


:SetNative(self @ T, native_type @ Gtk.Gio.GCredentialsType.T, native @ Std.Address.T) : Std.Object.T

Copies the native credentials of type native_type from native into credentials.

It is a programming error (which will cause an warning to be logged) to use this method if there is no T support for the OS or if native_type isn't supported by the OS.

credentials A T.
native_type The type of native credentials to set.
native A pointer to native credentials.


:SetUnixUser(self @ T, uid @ Std.Object.T, error @ Std.Object.T) : Std.Symbol.T

Tries to set the UNIX user identifier on credentials. This method is only available on UNIX platforms.

This operation can fail if T is not supported on the OS or if the native credentials type does not contain information about the UNIX user.

credentials A T.
uid The UNIX user identifier to set.
error Return location for error or NULL.
Returns TRUE if uid was set, FALSE if error is set.


:ToString(self @ T) : Std.String.T

Creates a human-readable textual representation of credentials that can be used in logging and debug messages. The format of the returned string may change in future GLib release.

credentials A T object.
Returns A string that should be freed with g_free().