DtlsConnectionIF

GDtlsConnection is the base DTLS connection class type, which wraps a GDatagramBased and provides DTLS encryption on top of it. Its subclasses, GDtlsClientConnection and GDtlsServerConnection, implement client-side and server-side DTLS, respectively.

For TLS support, see gio.TlsConnection

As DTLS is datagram based, GDtlsConnection implements GDatagramBased, presenting a datagram-socket-like API for the encrypted connection. This operates over a base datagram connection, which is also a GDatagramBased (base-socket).

To close a DTLS connection, use g_dtls_connection_close().

Neither GDtlsServerConnection or GDtlsClientConnection set the peer address on their base GDatagramBased if it is a atk.Socket — it is up to the caller to do that if they wish. If they do not, and Socket.close is called on the base socket, the GDtlsConnection will not raise a G_IO_ERROR_NOT_CONNECTED error on further I/O.

interface DtlsConnectionIF {}

Members

Functions

addOnAcceptCertificate
gulong addOnAcceptCertificate(bool delegate(TlsCertificate, GTlsCertificateFlags, DtlsConnectionIF) dlg, ConnectFlags connectFlags)

Emitted during the TLS handshake after the peer certificate has been received. You can examine peer_cert's certification path by calling TlsCertificate.getIssuer on it.

close
bool close(Cancellable cancellable)

Close the DTLS connection. This is equivalent to calling g_dtls_connection_shutdown() to shut down both sides of the connection.

closeAsync
void closeAsync(int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)

Asynchronously close the DTLS connection. See g_dtls_connection_close() for more information.

closeFinish
bool closeFinish(AsyncResultIF result)

Finish an asynchronous TLS close operation. See g_dtls_connection_close() for more information.

emitAcceptCertificate
bool emitAcceptCertificate(TlsCertificate peerCert, GTlsCertificateFlags errors)

Used by GDtlsConnection implementations to emit the accept-certificate signal.

getCertificate
TlsCertificate getCertificate()

Gets conn's certificate, as set by g_dtls_connection_set_certificate().

getDatabase
TlsDatabase getDatabase()

Gets the certificate database that conn uses to verify peer certificates. See g_dtls_connection_set_database().

getDtlsConnectionStruct
GDtlsConnection* getDtlsConnectionStruct(bool transferOwnership)

Get the main Gtk struct

getInteraction
TlsInteraction getInteraction()

Get the object that will be used to interact with the user. It will be used for things like prompting the user for passwords. If NULL is returned, then no user interaction will occur for this connection.

getNegotiatedProtocol
string getNegotiatedProtocol()

Gets the name of the application-layer protocol negotiated during the handshake.

getPeerCertificate
TlsCertificate getPeerCertificate()

Gets conn's peer's certificate after the handshake has completed. (It is not set during the emission of accept-certificate.)

getPeerCertificateErrors
GTlsCertificateFlags getPeerCertificateErrors()

Gets the errors associated with validating conn's peer's certificate, after the handshake has completed. (It is not set during the emission of accept-certificate.)

getRehandshakeMode
GTlsRehandshakeMode getRehandshakeMode()

Gets conn rehandshaking mode. See g_dtls_connection_set_rehandshake_mode() for details.

getRequireCloseNotify
bool getRequireCloseNotify()

Tests whether or not conn expects a proper TLS close notification when the connection is closed. See g_dtls_connection_set_require_close_notify() for details.

getStruct
void* getStruct()

the main Gtk struct as a void*

handshake
bool handshake(Cancellable cancellable)

Attempts a TLS handshake on conn.

handshakeAsync
void handshakeAsync(int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)

Asynchronously performs a TLS handshake on conn. See g_dtls_connection_handshake() for more information.

handshakeFinish
bool handshakeFinish(AsyncResultIF result)

Finish an asynchronous TLS handshake operation. See g_dtls_connection_handshake() for more information.

setAdvertisedProtocols
void setAdvertisedProtocols(string[] protocols)

Sets the list of application-layer protocols to advertise that the caller is willing to speak on this connection. The Application-Layer Protocol Negotiation (ALPN) extension will be used to negotiate a compatible protocol with the peer; use g_dtls_connection_get_negotiated_protocol() to find the negotiated protocol after the handshake. Specifying NULL for the the value of protocols will disable ALPN negotiation.

setCertificate
void setCertificate(TlsCertificate certificate)

This sets the certificate that conn will present to its peer during the TLS handshake. For a GDtlsServerConnection, it is mandatory to set this, and that will normally be done at construct time.

setDatabase
void setDatabase(TlsDatabase database)

Sets the certificate database that is used to verify peer certificates. This is set to the default database by default. See g_tls_backend_get_default_database(). If set to NULL, then peer certificate validation will always set the G_TLS_CERTIFICATE_UNKNOWN_CA error (meaning accept-certificate will always be emitted on client-side connections, unless that bit is not set in validation-flags).

setInteraction
void setInteraction(TlsInteraction interaction)

Set the object that will be used to interact with the user. It will be used for things like prompting the user for passwords.

setRehandshakeMode
void setRehandshakeMode(GTlsRehandshakeMode mode)

Since GLib 2.64, changing the rehandshake mode is no longer supported and will have no effect. With TLS 1.3, rehandshaking has been removed from the TLS protocol, replaced by separate post-handshake authentication and rekey operations.

setRequireCloseNotify
void setRequireCloseNotify(bool requireCloseNotify)

Sets whether or not conn expects a proper TLS close notification before the connection is closed. If this is TRUE (the default), then conn will expect to receive a TLS close notification from its peer before the connection is closed, and will return a G_TLS_ERROR_EOF error if the connection is closed without proper notification (since this may indicate a network error, or man-in-the-middle attack).

shutdown
bool shutdown(bool shutdownRead, bool shutdownWrite, Cancellable cancellable)

Shut down part or all of a DTLS connection.

shutdownAsync
void shutdownAsync(bool shutdownRead, bool shutdownWrite, int ioPriority, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)

Asynchronously shut down part or all of the DTLS connection. See g_dtls_connection_shutdown() for more information.

shutdownFinish
bool shutdownFinish(AsyncResultIF result)

Finish an asynchronous TLS shutdown operation. See g_dtls_connection_shutdown() for more information.

Static functions

getType
GType getType()

Meta

Since

2.48