GTlsInteraction

GTlsInteraction — Interaction with the user during TLS operations.

Synopsis

#include <gio/gio.h>

                    GTlsInteraction;
enum                GTlsInteractionResult;
GTlsInteractionResult  g_tls_interaction_ask_password   (GTlsInteraction *interaction,
                                                         GTlsPassword *password);
void                g_tls_interaction_ask_password_async
                                                        (GTlsInteraction *interaction,
                                                         GTlsPassword *password,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);
GTlsInteractionResult  g_tls_interaction_ask_password_finish
                                                        (GTlsInteraction *interaction,
                                                         GAsyncResult *result);

Object Hierarchy

  GObject
   +----GTlsInteraction

Description

GTlsInteraction provides a mechanism for the TLS connection and database code to interact with the user. It can be used to ask the user for passwords.

To use a GTlsInteraction with a TLS connection use g_tls_connection_set_interaction().

Callers should instantiate a subclass of this that implements all the various callbacks to show the required dialogs, such as GtkTlsInteraction. If no interaction is desired, usually NULL can be passed, see each method taking a GTlsInteraction for details.

Details

GTlsInteraction

typedef struct _GTlsInteraction GTlsInteraction;

An object representing interaction that the TLS connection and database might have with the user.

Since 2.30


enum GTlsInteractionResult

typedef enum {
  G_TLS_INTERACTION_HANDLED,
  G_TLS_INTERACTION_ABORTED,
  G_TLS_INTERACTION_UNHANDLED
} GTlsInteractionResult;

GTlsInteractionResult is returned by various functions in GTlsInteraction when finishing an interaction request.

G_TLS_INTERACTION_HANDLED

The interaction completed, and resulting data is available.

G_TLS_INTERACTION_ABORTED

The user cancelled the interaction, and requested the operation to be aborted.

G_TLS_INTERACTION_UNHANDLED

The interaction was unhandled (i.e. not implemented).

Since 2.30


g_tls_interaction_ask_password ()

GTlsInteractionResult  g_tls_interaction_ask_password   (GTlsInteraction *interaction,
                                                         GTlsPassword *password);

This function is normally called by GTlsConnection or GTlsDatabase to ask the user for a password.

Derived subclasses usually implement a password prompt, although they may also choose to provide a password from elsewhere. The password value will be filled in and then callback will be called. Alternatively the user may abort this password request, which will usually abort the TLS connection.

interaction :

a GTlsInteraction object

password :

a GTlsPassword object

Returns :

The status of the ask password interaction.

Since 2.30


g_tls_interaction_ask_password_async ()

void                g_tls_interaction_ask_password_async
                                                        (GTlsInteraction *interaction,
                                                         GTlsPassword *password,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);

This function is normally called by GTlsConnection or GTlsDatabase to ask the user for a password.

Derived subclasses usually implement a password prompt, although they may also choose to provide a password from elsewhere. The password value will be filled in and then callback will be called. Alternatively the user may abort this password request, which will usually abort the TLS connection.

The callback will be invoked on thread-default main context of the thread that called this function. The callback should call g_tls_interaction_ask_password_finish() to get the status of the user interaction.

interaction :

a GTlsInteraction object

password :

a GTlsPassword object

callback :

will be called when the interaction completes

user_data :

data to pass to the callback. [allow-none]

Since 2.30


g_tls_interaction_ask_password_finish ()

GTlsInteractionResult  g_tls_interaction_ask_password_finish
                                                        (GTlsInteraction *interaction,
                                                         GAsyncResult *result);

Complete an ask password user interaction request. This should be once the g_tls_interaction_ask_password() completion callback is called.

If G_TLS_INTERACTION_HANDLED is returned, then the GTlsPassword passed to g_tls_interaction_ask_password() will have its password filled in.

interaction :

a GTlsInteraction object

result :

the result passed to the callback

Returns :

The status of the ask password interaction.

Since 2.30