Package ch.bailu.gtk.gio
Class TlsInteraction
java.lang.Object
ch.bailu.gtk.type.Type
ch.bailu.gtk.type.Pointer
ch.bailu.gtk.gobject.Object
ch.bailu.gtk.gio.TlsInteraction
- All Implemented Interfaces:
PointerInterface
#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 derived class that implements the various
interaction methods to show the required dialogs.
Callers should use the 'invoke' functions like
g_tls_interaction_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 in their class
initialization function. Any interactions not implemented will return
%G_TLS_INTERACTION_UNHANDLED. If a derived class implements an async method,
it must also implement the corresponding finish method.
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 derived class that implements the various
interaction methods to show the required dialogs.
Callers should use the 'invoke' functions like
g_tls_interaction_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 in their class
initialization function. Any interactions not implemented will return
%G_TLS_INTERACTION_UNHANDLED. If a derived class implements an async method,
it must also implement the corresponding finish method.
-
Nested Class Summary
Nested classes/interfaces inherited from class ch.bailu.gtk.gobject.Object
Object.OnBindingTransformFunc, Object.OnDestroyNotify, Object.OnDuplicateFunc, Object.OnNotify, Object.OnToggleNotify, Object.OnWeakNotify
-
Field Summary
Fields inherited from class ch.bailu.gtk.gobject.Object
SIGNAL_ON_NOTIFY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
askPassword
(TlsPassword password, Cancellable cancellable) Run synchronous interaction to ask the user for a password.void
askPasswordAsync
(TlsPassword password, Cancellable cancellable, TlsInteraction.OnAsyncReadyCallback callback, Pointer user_data) Run asynchronous interaction to ask the user for a password.int
askPasswordFinish
(AsyncResult result) Complete an ask password user interaction request.static ClassHandler
static int
static long
static TypeSystem.TypeSize
static long
static TypeSystem.TypeSize
int
invokeAskPassword
(TlsPassword password, Cancellable cancellable) Invoke the interaction to ask the user for a password.int
invokeRequestCertificate
(TlsConnection connection, int flags, Cancellable cancellable) Invoke the interaction to ask the user to choose a certificate to
use with the connection.int
requestCertificate
(TlsConnection connection, int flags, Cancellable cancellable) Run synchronous interaction to ask the user to choose a certificate to use
with the connection.void
requestCertificateAsync
(TlsConnection connection, int flags, Cancellable cancellable, TlsInteraction.OnAsyncReadyCallback callback, Pointer user_data) Run asynchronous interaction to ask the user for a certificate to use with
the connection.int
requestCertificateFinish
(AsyncResult result) Complete a request certificate user interaction request.Methods inherited from class ch.bailu.gtk.gobject.Object
addToggleRef, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, disconnect, disconnect, dupData, dupData, dupQdata, forceFloating, freezeNotify, get, get, getData, getData, getProperty, getProperty, getQdata, interfaceFindProperty, interfaceInstallProperty, isFloating, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, replaceData, replaceData, replaceQdata, runDispose, set, set, setData, setData, setDataFull, setDataFull, setProperty, setProperty, setQdata, setQdataFull, stealData, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref
Methods inherited from class ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Methods inherited from class ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Constructor Details
-
TlsInteraction
-
-
Method Details
-
getClassHandler
-
askPassword
public int askPassword(@Nonnull TlsPassword password, @Nullable Cancellable cancellable) throws AllocationError 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 %G_TLS_INTERACTION_FAILED will be returned with an error that
contains a %G_IO_ERROR_CANCELLED error code. Certain implementations may
not support immediate cancellation.- Parameters:
password
- a #GTlsPassword objectcancellable
- an optional #GCancellable cancellation object- Returns:
- The status of the ask password interaction.
- Throws:
AllocationError
-
askPasswordAsync
public void askPasswordAsync(@Nonnull TlsPassword password, @Nullable Cancellable cancellable, TlsInteraction.OnAsyncReadyCallback callback, @Nullable Pointer user_data) 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 @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 %G_TLS_INTERACTION_FAILED will be returned with an error that
contains a %G_IO_ERROR_CANCELLED error code. Certain implementations may
not support immediate cancellation.
Certain implementations may not support immediate cancellation.- Parameters:
password
- a #GTlsPassword objectcancellable
- an optional #GCancellable cancellation objectcallback
- will be called when the interaction completesuser_data
- data to pass to the @callback
-
askPasswordFinish
Complete an ask password user interaction request. This should be once
the g_tls_interaction_ask_password_async() 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.
If the interaction is cancelled by the cancellation object, or by the
user then %G_TLS_INTERACTION_FAILED will be returned with an error that
contains a %G_IO_ERROR_CANCELLED error code.- Parameters:
result
- the result passed to the callback- Returns:
- The status of the ask password interaction.
- Throws:
AllocationError
-
invokeAskPassword
public int invokeAskPassword(@Nonnull TlsPassword password, @Nullable Cancellable cancellable) throws AllocationError Invoke the interaction to ask the user for a password. It invokes this
interaction in the main loop, specifically the #GMainContext returned by
g_main_context_get_thread_default() when the interaction is created. This
is called by 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 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 %G_TLS_INTERACTION_FAILED will be returned with an error that
contains a %G_IO_ERROR_CANCELLED error code. Certain implementations may
not support immediate cancellation.- Parameters:
password
- a #GTlsPassword objectcancellable
- an optional #GCancellable cancellation object- Returns:
- The status of the ask password interaction.
- Throws:
AllocationError
-
invokeRequestCertificate
public int invokeRequestCertificate(@Nonnull TlsConnection connection, int flags, @Nullable Cancellable cancellable) throws AllocationError 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 #GMainContext returned by
g_main_context_get_thread_default() when the interaction is
created. This is called by called by #GTlsConnection 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 %G_TLS_INTERACTION_FAILED will be returned with an error that
contains a %G_IO_ERROR_CANCELLED error code. Certain implementations may
not support immediate cancellation.- Parameters:
connection
- a #GTlsConnection objectflags
- flags providing more information about the requestcancellable
- an optional #GCancellable cancellation object- Returns:
- The status of the certificate request interaction.
- Throws:
AllocationError
-
requestCertificate
public int requestCertificate(@Nonnull TlsConnection connection, int flags, @Nullable Cancellable cancellable) throws AllocationError 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 %G_TLS_INTERACTION_HANDLED is returned, then the #GTlsConnection
passed to g_tls_interaction_request_certificate() will have had its
#GTlsConnection:certificate filled in.
If the interaction is cancelled by the cancellation object, or by the
user then %G_TLS_INTERACTION_FAILED will be returned with an error that
contains a %G_IO_ERROR_CANCELLED error code. Certain implementations may
not support immediate cancellation.- Parameters:
connection
- a #GTlsConnection objectflags
- flags providing more information about the requestcancellable
- an optional #GCancellable cancellation object- Returns:
- The status of the request certificate interaction.
- Throws:
AllocationError
-
requestCertificateAsync
public void requestCertificateAsync(@Nonnull TlsConnection connection, int flags, @Nullable Cancellable cancellable, TlsInteraction.OnAsyncReadyCallback callback, @Nullable Pointer user_data) 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. @callback will be called
when the operation completes. Alternatively the user may abort this certificate
request, which will usually abort the TLS connection.- Parameters:
connection
- a #GTlsConnection objectflags
- flags providing more information about the requestcancellable
- an optional #GCancellable cancellation objectcallback
- will be called when the interaction completesuser_data
- data to pass to the @callback
-
requestCertificateFinish
Complete a request certificate user interaction request. This should be once
the g_tls_interaction_request_certificate_async() completion callback is called.
If %G_TLS_INTERACTION_HANDLED is returned, then the #GTlsConnection
passed to g_tls_interaction_request_certificate_async() will have had its
#GTlsConnection:certificate filled in.
If the interaction is cancelled by the cancellation object, or by the
user then %G_TLS_INTERACTION_FAILED will be returned with an error that
contains a %G_IO_ERROR_CANCELLED error code.- Parameters:
result
- the result passed to the callback- Returns:
- The status of the request certificate interaction.
- Throws:
AllocationError
-
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-