glibmm: Gio::TlsInteraction Class Reference

TlsInteraction - Interaction with the user during TLS operations. More...

#include <giomm/tlsinteraction.h>

Inheritance diagram for Gio::TlsInteraction:

Public Member Functions

TlsInteraction ( TlsInteraction && src) noexcept
TlsInteraction & operator= ( TlsInteraction && src) noexcept
~TlsInteraction () noexceptoverride
GTlsInteraction* gobj ()
Provides access to the underlying C GObject. More...

const GTlsInteraction* gobj () const
Provides access to the underlying C GObject. More...

GTlsInteraction* gobj_copy ()
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...

TlsInteractionResult ask_password (const Glib::RefPtr < TlsPassword >& password, const Glib::RefPtr < Cancellable >& cancellable)
Run synchronous interaction to ask the user for a password. More...

TlsInteractionResult ask_password (const Glib::RefPtr < TlsPassword >& password)
A ask_password() convenience overload. More...

void ask_password_async (const Glib::RefPtr < TlsPassword >& password, const SlotAsyncReady & slot, const Glib::RefPtr < Cancellable >& cancellable)
Run asynchronous interaction to ask the user for a password. More...

void ask_password_async (const Glib::RefPtr < TlsPassword >& password, const SlotAsyncReady & slot)
A ask_password_async() convenience overload. More...

void ask_password_async (const Glib::RefPtr < TlsPassword >& password, const Glib::RefPtr < Cancellable >& cancellable)
A ask_password_async() convenience overload. More...

void ask_password_async (const Glib::RefPtr < TlsPassword >& password)
A ask_password_async() convenience overload. More...

TlsInteractionResult ask_password_finish (const Glib::RefPtr < AsyncResult >& result)
Complete an ask password user interaction request. More...

TlsInteractionResult invoke_ask_password (const Glib::RefPtr < TlsPassword >& password, const Glib::RefPtr < Cancellable >& cancellable)
Invoke the interaction to ask the user for a password. More...

TlsInteractionResult invoke_ask_password (const Glib::RefPtr < TlsPassword >& password)
A invoke_ask_password() convenience overload. More...

TlsInteractionResult invoke_request_certificate (const Glib::RefPtr < TlsConnection >& connection, TlsCertificateRequestFlags flags, const Glib::RefPtr < Cancellable >& cancellable)
Invoke the interaction to ask the user to choose a certificate to use with the connection. More...

TlsInteractionResult invoke_request_certificate (const Glib::RefPtr < TlsConnection >& connection, TlsCertificateRequestFlags flags)
A invoke_request_certificate() convenience overload. More...

TlsInteractionResult request_certificate (const Glib::RefPtr < TlsConnection >& connection, TlsCertificateRequestFlags flags, const Glib::RefPtr < Cancellable >& cancellable)
Run synchronous interaction to ask the user to choose a certificate to use with the connection. More...

TlsInteractionResult request_certificate (const Glib::RefPtr < TlsConnection >& connection, TlsCertificateRequestFlags flags)
A request_certificate() convenience overload. More...

void request_certificate_async (const Glib::RefPtr < TlsConnection >& connection, TlsCertificateRequestFlags flags, const SlotAsyncReady & slot, const Glib::RefPtr < Cancellable >& cancellable)
Run asynchronous interaction to ask the user for a certificate to use with the connection. More...

void request_certificate_async (const Glib::RefPtr < TlsConnection >& connection, TlsCertificateRequestFlags flags, const SlotAsyncReady & slot)
A request_certificate_async() convenience overload. More...

void request_certificate_async (const Glib::RefPtr < TlsConnection >& connection, TlsCertificateRequestFlags flags, const Glib::RefPtr < Cancellable >& cancellable)
A request_certificate_async() convenience overload. More...

void request_certificate_async (const Glib::RefPtr < TlsConnection >& connection, TlsCertificateRequestFlags flags)
A request_certificate_async() convenience overload. More...

TlsInteractionResult request_certificate_finish (const Glib::RefPtr < AsyncResult >& result)
Complete an request certificate user interaction request. More...

virtual TlsInteractionResult ask_password_vfunc (const Glib::RefPtr < TlsPassword >& password, const Glib::RefPtr < Cancellable >& cancellable)
virtual void ask_password_async_vfunc (const Glib::RefPtr < TlsPassword >& password, const SlotAsyncReady & slot, const Glib::RefPtr < Cancellable >& cancellable)
virtual TlsInteractionResult ask_password_finish_vfunc (const Glib::RefPtr < AsyncResult >& result)
- Public Member Functions inherited from Glib::Object
Object (const Object &)=delete
Object & operator= (const Object &)=delete
Object ( Object && src) noexcept
Object & operator= ( Object && src) noexcept
void* get_data (const QueryQuark & key)
void set_data (const Quark & key, void* data)
void set_data (const Quark & key, void* data, DestroyNotify notify)
void remove_data (const QueryQuark & quark)
void* steal_data (const QueryQuark & quark)
- Public Member Functions inherited from Glib::ObjectBase
ObjectBase (const ObjectBase &)=delete
ObjectBase & operator= (const ObjectBase &)=delete
void set_property_value (const Glib::ustring & property_name, const Glib::ValueBase & value)
You probably want to use a specific property_*() accessor method instead. More...

void get_property_value (const Glib::ustring & property_name, Glib::ValueBase & value) const
You probably want to use a specific property_*() accessor method instead. More...

template<class PropertyType >
void set_property (const Glib::ustring & property_name, const PropertyType& value)
You probably want to use a specific property_*() accessor method instead. More...

template<class PropertyType >
void get_property (const Glib::ustring & property_name, PropertyType& value) const
You probably want to use a specific property_*() accessor method instead. More...

void connect_property_changed (const Glib::ustring & property_name, const sigc::slot < void >& slot)
You can use the signal_changed() signal of the property proxy instead. More...

void connect_property_changed (const Glib::ustring & property_name, sigc::slot < void >&& slot)
You can use the signal_changed() signal of the property proxy instead. More...

sigc::connection connect_property_changed_with_return (const Glib::ustring & property_name, const sigc::slot < void >& slot)
You can use the signal_changed() signal of the property proxy instead. More...

sigc::connection connect_property_changed_with_return (const Glib::ustring & property_name, sigc::slot < void >&& slot)
You can use the signal_changed() signal of the property proxy instead. More...

void freeze_notify ()
Increases the freeze count on object. More...

void thaw_notify ()
Reverts the effect of a previous call to freeze_notify() . More...

virtual void reference () const
Increment the reference count for this object. More...

virtual void unreference () const
Decrement the reference count for this object. More...

GObject* gobj ()
Provides access to the underlying C GObject. More...

const GObject* gobj () const
Provides access to the underlying C GObject. More...

GObject* gobj_copy () const
Give a ref-ed copy to someone. Use for direct struct access. More...

- Public Member Functions inherited from sigc::trackable
trackable () noexcept
trackable (const trackable &src) noexcept
trackable ( trackable &&src)
~trackable ()
void add_destroy_notify_callback (void *data, func_destroy_notify func) const
void notify_callbacks ()
trackable & operator= (const trackable &src)
trackable & operator= ( trackable &&src)
void remove_destroy_notify_callback (void *data) const

Static Public Member Functions

static GType get_type ()
Get the GType for this class, for use with the underlying GObject type system. More...

Protected Member Functions

TlsInteraction ()
- Protected Member Functions inherited from Glib::Object
Object ()
Object (const Glib::ConstructParams& construct_params)
Object (GObject* castitem)
~Object () noexceptoverride
- Protected Member Functions inherited from Glib::ObjectBase
ObjectBase ()
This default constructor is called implicitly from the constructor of user-derived classes, even if, for instance, Gtk::Button calls a different ObjectBase constructor. More...

ObjectBase (const char* custom_type_name)
A derived constructor always overrides this choice. More...

ObjectBase (const std::type_info & custom_type_info)
This constructor is a special feature to allow creation of derived types on the fly, without having to use g_object_new() manually. More...

ObjectBase ( ObjectBase && src) noexcept
ObjectBase & operator= ( ObjectBase && src) noexcept
virtual ~ObjectBase () noexcept=0
void initialize (GObject* castitem)
void initialize_move (GObject* castitem, Glib::ObjectBase * previous_wrapper)

Related Functions

(Note that these are not member functions.)

Glib::RefPtr < Gio::TlsInteraction > wrap (GTlsInteraction* object, bool take_copy=false)
A Glib::wrap() method for this object. More...

Additional Inherited Members

- Public Types inherited from Glib::Object
using DestroyNotify = void(*)(gpointer data)
- Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify func_destroy_notify

Detailed Description

TlsInteraction - Interaction with the user during TLS operations.

TlsInteraction 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 TlsInteraction with a TLS connection use Gio::TlsConnection::set_interaction() .

Callers should instantiate a derived class that implements the various interaction methods to show the required dialogs.

Callers should use the 'invoke' functions like invoke_ask_password() to run interaction methods. These functions make sure that the interaction is invoked in the main loop and not in the current thread, if the current thread is not running the main loop.

Derived classes can choose to implement whichever interactions methods they'd like to support by overriding those virtual methods. Any interactions not implemented will return Gio::TLS_INTERACTION_UNHANDLED . If a derived class implements an async method, it must also implement the corresponding finish method.

Since glibmm 2.36:

Constructor & Destructor Documentation

Gio::TlsInteraction::TlsInteraction ( TlsInteraction && src )
noexcept
Gio::TlsInteraction::~TlsInteraction ( )
override noexcept
Gio::TlsInteraction::TlsInteraction ( )
protected

Member Function Documentation

TlsInteractionResult Gio::TlsInteraction::ask_password ( const Glib::RefPtr < TlsPassword >& password ,
const Glib::RefPtr < Cancellable >& cancellable
)

Run synchronous interaction to ask the user for a password.

In general, g_tls_interaction_invoke_ask_password() should be used instead of this function.

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.

If the interaction is cancelled by the cancellation object, or by the user then TLS_INTERACTION_FAILED will be returned with an error that contains a IO_ERROR_CANCELLED error code. Certain implementations may not support immediate cancellation.

Since glibmm 2.30:
Parameters
password A TlsPassword object.
cancellable An optional Cancellable cancellation object.
Returns
The status of the ask password interaction.
TlsInteractionResult Gio::TlsInteraction::ask_password ( const Glib::RefPtr < TlsPassword >& password )

A ask_password() convenience overload.

void Gio::TlsInteraction::ask_password_async ( const Glib::RefPtr < TlsPassword >& password ,
const SlotAsyncReady & slot ,
const Glib::RefPtr < Cancellable >& cancellable
)

Run asynchronous interaction to ask the user for a password.

In general, g_tls_interaction_invoke_ask_password() should be used instead of this function.

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 slot will be called. Alternatively the user may abort this password request, which will usually abort the TLS connection.

If the interaction is cancelled by the cancellation object, or by the user then TLS_INTERACTION_FAILED will be returned with an error that contains a IO_ERROR_CANCELLED error code. Certain implementations may not support immediate cancellation.

Certain implementations may not support immediate cancellation.

Since glibmm 2.30:
Parameters
password A TlsPassword object.
cancellable An optional Cancellable cancellation object.
slot Will be called when the interaction completes.
void Gio::TlsInteraction::ask_password_async ( const Glib::RefPtr < TlsPassword >& password ,
const SlotAsyncReady & slot
)

A ask_password_async() convenience overload.

void Gio::TlsInteraction::ask_password_async ( const Glib::RefPtr < TlsPassword >& password ,
const Glib::RefPtr < Cancellable >& cancellable
)

A ask_password_async() convenience overload.

void Gio::TlsInteraction::ask_password_async ( const Glib::RefPtr < TlsPassword >& password )

A ask_password_async() convenience overload.

virtual void Gio::TlsInteraction::ask_password_async_vfunc ( const Glib::RefPtr < TlsPassword >& password ,
const SlotAsyncReady & slot ,
const Glib::RefPtr < Cancellable >& cancellable
)
virtual
TlsInteractionResult Gio::TlsInteraction::ask_password_finish ( const Glib::RefPtr < AsyncResult >& result )

Complete an ask password user interaction request.

This should be once the g_tls_interaction_ask_password_async() completion callback is called.

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

If the interaction is cancelled by the cancellation object, or by the user then TLS_INTERACTION_FAILED will be returned with an error that contains a IO_ERROR_CANCELLED error code.

Since glibmm 2.30:
Parameters
result The result passed to the callback.
Returns
The status of the ask password interaction.
virtual TlsInteractionResult Gio::TlsInteraction::ask_password_finish_vfunc ( const Glib::RefPtr < AsyncResult >& result )
virtual
Exceptions
Glib::Error.
virtual TlsInteractionResult Gio::TlsInteraction::ask_password_vfunc ( const Glib::RefPtr < TlsPassword >& password ,
const Glib::RefPtr < Cancellable >& cancellable
)
virtual
Exceptions
Glib::Error.
static GType Gio::TlsInteraction::get_type ( )
static

Get the GType for this class, for use with the underlying GObject type system.

GTlsInteraction* Gio::TlsInteraction::gobj ( )
inline

Provides access to the underlying C GObject.

const GTlsInteraction* Gio::TlsInteraction::gobj ( ) const
inline

Provides access to the underlying C GObject.

GTlsInteraction* Gio::TlsInteraction::gobj_copy ( )

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

TlsInteractionResult Gio::TlsInteraction::invoke_ask_password ( const Glib::RefPtr < TlsPassword >& password ,
const Glib::RefPtr < Cancellable >& cancellable
)

Invoke the interaction to ask the user for a password.

It invokes this interaction in the main loop, specifically the MainContext returned by Glib::main_context_get_thread_default() when the interaction is created. This is called by called by TlsConnection or TlsDatabase 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 implementation can either be a synchronous (eg: modal dialog) or an asynchronous one (eg: modeless dialog). This function will take care of calling which ever one correctly.

If the interaction is cancelled by the cancellation object, or by the user then TLS_INTERACTION_FAILED will be returned with an error that contains a IO_ERROR_CANCELLED error code. Certain implementations may not support immediate cancellation.

Since glibmm 2.30:
Parameters
password A TlsPassword object.
cancellable An optional Cancellable cancellation object.
Returns
The status of the ask password interaction.
TlsInteractionResult Gio::TlsInteraction::invoke_ask_password ( const Glib::RefPtr < TlsPassword >& password )

A invoke_ask_password() convenience overload.

TlsInteractionResult Gio::TlsInteraction::invoke_request_certificate ( const Glib::RefPtr < TlsConnection >& connection ,
TlsCertificateRequestFlags flags ,
const Glib::RefPtr < Cancellable >& cancellable
)

Invoke the interaction to ask the user to choose a certificate to use with the connection.

It invokes this interaction in the main loop, specifically the MainContext returned by Glib::main_context_get_thread_default() when the interaction is created. This is called by called by TlsConnection when the peer requests a certificate during the handshake.

Derived subclasses usually implement a certificate selector, although they may also choose to provide a certificate from elsewhere. Alternatively the user may abort this certificate request, which may or may not abort the TLS connection.

The implementation can either be a synchronous (eg: modal dialog) or an asynchronous one (eg: modeless dialog). This function will take care of calling which ever one correctly.

If the interaction is cancelled by the cancellation object, or by the user then TLS_INTERACTION_FAILED will be returned with an error that contains a IO_ERROR_CANCELLED error code. Certain implementations may not support immediate cancellation.

Since glibmm 2.40:
Parameters
connection A TlsConnection object.
flags Flags providing more information about the request.
cancellable An optional Cancellable cancellation object.
Returns
The status of the certificate request interaction.
TlsInteractionResult Gio::TlsInteraction::invoke_request_certificate ( const Glib::RefPtr < TlsConnection >& connection ,
TlsCertificateRequestFlags flags
)

A invoke_request_certificate() convenience overload.

TlsInteraction & Gio::TlsInteraction::operator= ( TlsInteraction && src )
noexcept
TlsInteractionResult Gio::TlsInteraction::request_certificate ( const Glib::RefPtr < TlsConnection >& connection ,
TlsCertificateRequestFlags flags ,
const Glib::RefPtr < Cancellable >& cancellable
)

Run synchronous interaction to ask the user to choose a certificate to use with the connection.

In general, g_tls_interaction_invoke_request_certificate() should be used instead of this function.

Derived subclasses usually implement a certificate selector, although they may also choose to provide a certificate from elsewhere. Alternatively the user may abort this certificate request, which will usually abort the TLS connection.

If TLS_INTERACTION_HANDLED is returned, then the TlsConnection passed to g_tls_interaction_request_certificate() will have had its TlsConnection::property_certificate() filled in.

If the interaction is cancelled by the cancellation object, or by the user then TLS_INTERACTION_FAILED will be returned with an error that contains a IO_ERROR_CANCELLED error code. Certain implementations may not support immediate cancellation.

Since glibmm 2.40:
Parameters
connection A TlsConnection object.
flags Flags providing more information about the request.
cancellable An optional Cancellable cancellation object.
Returns
The status of the request certificate interaction.
TlsInteractionResult Gio::TlsInteraction::request_certificate ( const Glib::RefPtr < TlsConnection >& connection ,
TlsCertificateRequestFlags flags
)

A request_certificate() convenience overload.

void Gio::TlsInteraction::request_certificate_async ( const Glib::RefPtr < TlsConnection >& connection ,
TlsCertificateRequestFlags flags ,
const SlotAsyncReady & slot ,
const Glib::RefPtr < Cancellable >& cancellable
)

Run asynchronous interaction to ask the user for a certificate to use with the connection.

In general, g_tls_interaction_invoke_request_certificate() should be used instead of this function.

Derived subclasses usually implement a certificate selector, although they may also choose to provide a certificate from elsewhere. slot will be called when the operation completes. Alternatively the user may abort this certificate request, which will usually abort the TLS connection.

Since glibmm 2.40:
Parameters
connection A TlsConnection object.
flags Flags providing more information about the request.
cancellable An optional Cancellable cancellation object.
slot Will be called when the interaction completes.
void Gio::TlsInteraction::request_certificate_async ( const Glib::RefPtr < TlsConnection >& connection ,
TlsCertificateRequestFlags flags ,
const SlotAsyncReady & slot
)

A request_certificate_async() convenience overload.

void Gio::TlsInteraction::request_certificate_async ( const Glib::RefPtr < TlsConnection >& connection ,
TlsCertificateRequestFlags flags ,
const Glib::RefPtr < Cancellable >& cancellable
)

A request_certificate_async() convenience overload.

void Gio::TlsInteraction::request_certificate_async ( const Glib::RefPtr < TlsConnection >& connection ,
TlsCertificateRequestFlags flags
)

A request_certificate_async() convenience overload.

TlsInteractionResult Gio::TlsInteraction::request_certificate_finish ( const Glib::RefPtr < AsyncResult >& result )

Complete an request certificate user interaction request.

This should be once the g_tls_interaction_request_certificate_async() completion callback is called.

If TLS_INTERACTION_HANDLED is returned, then the TlsConnection passed to g_tls_interaction_request_certificate_async() will have had its TlsConnection::property_certificate() filled in.

If the interaction is cancelled by the cancellation object, or by the user then TLS_INTERACTION_FAILED will be returned with an error that contains a IO_ERROR_CANCELLED error code.

Since glibmm 2.40:
Parameters
result The result passed to the callback.
Returns
The status of the request certificate interaction.

Friends And Related Function Documentation

Glib::RefPtr < Gio::TlsInteraction > wrap ( GTlsInteraction * object ,
bool take_copy = false
)
related

A Glib::wrap() method for this object.

Parameters
object The C instance.
take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
Returns
A C++ instance that wraps this C instance.