`GDtlsConnection` is the base DTLS connection class type, which wraps a [iface@Gio.
DatagramBased] and provides DTLS encryption on top of it. Its subclasses, [iface@Gio.DtlsClientConnection] and [iface@Gio.DtlsServerConnection]
, implement client-side and server-side DTLS, respectively.
For TLS support, see [class@Gio.TlsConnection].
As DTLS is datagram based, `GDtlsConnection` implements [iface@Gio.DatagramBased], presenting a datagram-socket-like API for the encrypted
connection. This operates over a base datagram connection, which is also a `GDatagramBased` ([property@Gio.DtlsConnection:base-socket]).
To close a DTLS connection, use [method@Gio.DtlsConnection.close].
Neither [iface@Gio.DtlsServerConnection] or [iface@Gio.DtlsClientConnection] set the peer address on their base [iface@Gio.DatagramBased] if it
is a [class@Gio.Socket] — it is up to the caller to do that if they wish. If they do not, and [method@Gio.Socket.close] is called on the base
socket, the `GDtlsConnection` will not raise a `G_IO_ERROR_NOT_CONNECTED` error on further I/O.
- public bool close (Cancellable? cancellable = null) throws Error
Close the DTLS connection.
- public async bool close_async (int io_priority = DEFAULT, Cancellable? cancellable = null) throws Error
Asynchronously close the DTLS connection.
- public bool emit_accept_certificate (TlsCertificate peer_cert, TlsCertificateFlags errors)
- public unowned TlsCertificate? get_certificate ()
- public virtual bool get_channel_binding_data (TlsChannelBindingType type, out unowned ByteArray data) throws TlsChannelBindingError
Query the TLS backend for TLS channel binding data of type
for
this.
- public string? get_ciphersuite_name ()
Returns the name of the current DTLS ciphersuite, or
null if the connection has not handshaked or has been closed.
- public unowned TlsDatabase? get_database ()
Gets the certificate database that this
uses to verify peer certificates.
- public unowned TlsInteraction? get_interaction ()
Get the object that will be used to interact with the user.
- public abstract unowned string? get_negotiated_protocol ()
Gets the name of the application-layer protocol negotiated during the
handshake.
- public unowned TlsCertificate? get_peer_certificate ()
Gets this's peer's certificate after the
handshake has completed or failed.
- public TlsCertificateFlags get_peer_certificate_errors ()
Gets the errors associated with validating this
's peer's certificate, after the handshake has completed or failed.
- public TlsProtocolVersion get_protocol_version ()
Returns the current DTLS protocol version, which may be
g_tls_protocol_version_unknown if the connection has not handshaked, or has been closed, or if the TLS
backend has implemented a protocol version that is not a recognized
TlsProtocolVersion.
- public TlsRehandshakeMode get_rehandshake_mode ()
Gets this rehandshaking mode.
- public bool get_require_close_notify ()
Tests whether or not this expects a proper
TLS close notification when the connection is closed.
- public abstract bool handshake (Cancellable? cancellable = null) throws Error
Attempts a TLS handshake on this.
- public abstract async bool handshake_async (int io_priority = DEFAULT, Cancellable? cancellable = null) throws Error
Asynchronously performs a TLS handshake on this
.
- public abstract void set_advertised_protocols (string[]? protocols)
Sets the list of application-layer protocols to advertise that the caller is
willing to speak on this connection.
- public void set_certificate (TlsCertificate certificate)
This sets the certificate that this will
present to its peer during the TLS handshake.
- public void set_database (TlsDatabase? database)
Sets the certificate database that is used to verify peer certificates.
- public void set_interaction (TlsInteraction? interaction)
Set the object that will be used to interact with the user.
- public void set_rehandshake_mode (TlsRehandshakeMode mode)
Since GLib 2.64, changing the rehandshake mode is no longer supported and
will have no effect.
- public void set_require_close_notify (bool require_close_notify)
Sets whether or not this expects a proper
TLS close notification before the connection is closed.
- public abstract bool shutdown (bool shutdown_read, bool shutdown_write, Cancellable? cancellable = null) throws Error
Shut down part or all of a DTLS connection.
- public abstract async bool shutdown_async (bool shutdown_read, bool shutdown_write, int io_priority = DEFAULT, Cancellable? cancellable = null) throws Error
Asynchronously shut down part or all of the DTLS connection.