// GENERATED — DO NOT EDIT
///|
/// [Upstream documentation](https://docs.gtk.org/gio/iface.DtlsConnection.html).
pub type DtlsConnection
///|
pub(open) trait IDtlsConnection {
fn as_dtls_connection(Self) -> DtlsConnection
fn close(Self, &ICancellable?) -> Bool raise @glib.Error_ = _
fn emit_accept_certificate(Self, &ITlsCertificate, TlsCertificateFlags) -> Bool = _
fn get_certificate(Self) -> TlsCertificate? = _
fn get_ciphersuite_name(Self) -> String? = _
fn get_database(Self) -> TlsDatabase? = _
fn get_interaction(Self) -> TlsInteraction? = _
fn get_negotiated_protocol(Self) -> String? = _
fn get_peer_certificate(Self) -> TlsCertificate? = _
fn get_peer_certificate_errors(Self) -> TlsCertificateFlags = _
fn get_protocol_version(Self) -> TlsProtocolVersion = _
fn get_require_close_notify(Self) -> Bool = _
fn handshake(Self, &ICancellable?) -> Bool raise @glib.Error_ = _
fn set_advertised_protocols(Self, Array[String]?) -> Unit = _
fn set_certificate(Self, &ITlsCertificate) -> Unit = _
fn set_database(Self, &ITlsDatabase?) -> Unit = _
fn set_interaction(Self, &ITlsInteraction?) -> Unit = _
fn set_require_close_notify(Self, Bool) -> Unit = _
fn shutdown(Self, Bool, Bool, &ICancellable?) -> Bool raise @glib.Error_ = _
fn close_async(
Self,
Int,
&ICancellable?,
(Result[Bool, @glib.Error_]) -> Unit,
) -> Unit = _
fn handshake_async(
Self,
Int,
&ICancellable?,
(Result[Bool, @glib.Error_]) -> Unit,
) -> Unit = _
fn shutdown_async(
Self,
Bool,
Bool,
Int,
&ICancellable?,
(Result[Bool, @glib.Error_]) -> Unit,
) -> Unit = _
}
///|
pub impl IDtlsConnection for DtlsConnection with fn as_dtls_connection(self) {
self
}
///|
/// Implementation contract for DtlsConnection.set_advertised_protocols. Self is the retained MoonBit state; the second parameter is the invoked DtlsConnection object.
pub(open) trait VDtlsConnectionSetAdvertisedProtocols {
fn set_advertised_protocols(Self, DtlsConnection, Array[String]?) -> Unit
}
///|
#borrow(self_, cancellable, error)
extern "c" fn moonbit_g_dtls_connection_close(
self_ : DtlsConnection,
cancellable : @glib.Nullable[Cancellable],
error : Ref[@glib.Nullable[@glib.Error_]],
) -> Bool = "moonbit_g_dtls_connection_close"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.DtlsConnection.close.html).
pub fn DtlsConnection::close(
self : DtlsConnection,
cancellable : &ICancellable?,
) -> Bool raise @glib.Error_ {
let error_ : Ref[@glib.Nullable[@glib.Error_]] = Ref(@glib.Nullable::null())
let result = moonbit_g_dtls_connection_close(
self,
match cancellable {
Some(v) => @glib.Nullable::some(v.as_cancellable())
None => @glib.Nullable::null()
},
error_,
)
match error_.val.to_option() {
Some(e) => raise e
None => ()
}
result
}
///|
#borrow(self_, peer_cert)
extern "c" fn moonbit_g_dtls_connection_emit_accept_certificate(
self_ : DtlsConnection,
peer_cert : TlsCertificate,
errors : Int,
) -> Bool = "moonbit_g_dtls_connection_emit_accept_certificate"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.DtlsConnection.emit_accept_certificate.html).
pub fn DtlsConnection::emit_accept_certificate(
self : DtlsConnection,
peer_cert : &ITlsCertificate,
errors : TlsCertificateFlags,
) -> Bool {
moonbit_g_dtls_connection_emit_accept_certificate(
self,
peer_cert.as_tls_certificate(),
errors.to_int(),
)
}
///|
#borrow(self_)
extern "c" fn moonbit_g_dtls_connection_get_certificate(
self_ : DtlsConnection,
) -> @glib.Nullable[TlsCertificate] = "moonbit_g_dtls_connection_get_certificate"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.DtlsConnection.get_certificate.html).
pub fn DtlsConnection::get_certificate(
self : DtlsConnection,
) -> TlsCertificate? {
let raw_result = moonbit_g_dtls_connection_get_certificate(self)
raw_result.to_option()
}
///|
#borrow(self_)
extern "c" fn moonbit_g_dtls_connection_get_ciphersuite_name(
self_ : DtlsConnection,
) -> @glib.Nullable[Bytes] = "moonbit_g_dtls_connection_get_ciphersuite_name"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.DtlsConnection.get_ciphersuite_name.html).
pub fn DtlsConnection::get_ciphersuite_name(self : DtlsConnection) -> String? {
let result = moonbit_g_dtls_connection_get_ciphersuite_name(self)
match result.to_option() {
Some(bytes) => Some(@encoding/utf8.decode_lossy(bytes))
None => None
}
}
///|
#borrow(self_)
extern "c" fn moonbit_g_dtls_connection_get_database(
self_ : DtlsConnection,
) -> @glib.Nullable[TlsDatabase] = "moonbit_g_dtls_connection_get_database"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.DtlsConnection.get_database.html).
pub fn DtlsConnection::get_database(self : DtlsConnection) -> TlsDatabase? {
let raw_result = moonbit_g_dtls_connection_get_database(self)
raw_result.to_option()
}
///|
#borrow(self_)
extern "c" fn moonbit_g_dtls_connection_get_interaction(
self_ : DtlsConnection,
) -> @glib.Nullable[TlsInteraction] = "moonbit_g_dtls_connection_get_interaction"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.DtlsConnection.get_interaction.html).
pub fn DtlsConnection::get_interaction(
self : DtlsConnection,
) -> TlsInteraction? {
let raw_result = moonbit_g_dtls_connection_get_interaction(self)
raw_result.to_option()
}
///|
#borrow(self_)
extern "c" fn moonbit_g_dtls_connection_get_negotiated_protocol(
self_ : DtlsConnection,
) -> @glib.Nullable[Bytes] = "moonbit_g_dtls_connection_get_negotiated_protocol"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.DtlsConnection.get_negotiated_protocol.html).
pub fn DtlsConnection::get_negotiated_protocol(
self : DtlsConnection,
) -> String? {
let result = moonbit_g_dtls_connection_get_negotiated_protocol(self)
match result.to_option() {
Some(bytes) => Some(@encoding/utf8.decode_lossy(bytes))
None => None
}
}
///|
#borrow(self_)
extern "c" fn moonbit_g_dtls_connection_get_peer_certificate(
self_ : DtlsConnection,
) -> @glib.Nullable[TlsCertificate] = "moonbit_g_dtls_connection_get_peer_certificate"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.DtlsConnection.get_peer_certificate.html).
pub fn DtlsConnection::get_peer_certificate(
self : DtlsConnection,
) -> TlsCertificate? {
let raw_result = moonbit_g_dtls_connection_get_peer_certificate(self)
raw_result.to_option()
}
///|
#borrow(self_)
extern "c" fn moonbit_g_dtls_connection_get_peer_certificate_errors(
self_ : DtlsConnection,
) -> Int = "moonbit_g_dtls_connection_get_peer_certificate_errors"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.DtlsConnection.get_peer_certificate_errors.html).
pub fn DtlsConnection::get_peer_certificate_errors(
self : DtlsConnection,
) -> TlsCertificateFlags {
TlsCertificateFlags::from_int(
moonbit_g_dtls_connection_get_peer_certificate_errors(self),
)
}
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.DtlsConnection.get_protocol_version.html).
#borrow(self)
pub extern "c" fn DtlsConnection::get_protocol_version(
self : DtlsConnection,
) -> TlsProtocolVersion = "moonbit_g_dtls_connection_get_protocol_version"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.DtlsConnection.get_require_close_notify.html).
#borrow(self)
pub extern "c" fn DtlsConnection::get_require_close_notify(
self : DtlsConnection,
) -> Bool = "moonbit_g_dtls_connection_get_require_close_notify"
///|
#borrow(self_, cancellable, error)
extern "c" fn moonbit_g_dtls_connection_handshake(
self_ : DtlsConnection,
cancellable : @glib.Nullable[Cancellable],
error : Ref[@glib.Nullable[@glib.Error_]],
) -> Bool = "moonbit_g_dtls_connection_handshake"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.DtlsConnection.handshake.html).
pub fn DtlsConnection::handshake(
self : DtlsConnection,
cancellable : &ICancellable?,
) -> Bool raise @glib.Error_ {
let error_ : Ref[@glib.Nullable[@glib.Error_]] = Ref(@glib.Nullable::null())
let result = moonbit_g_dtls_connection_handshake(
self,
match cancellable {
Some(v) => @glib.Nullable::some(v.as_cancellable())
None => @glib.Nullable::null()
},
error_,
)
match error_.val.to_option() {
Some(e) => raise e
None => ()
}
result
}
///|
#borrow(self_, __sa_protocols)
extern "c" fn moonbit_g_dtls_connection_set_advertised_protocols(
self_ : DtlsConnection,
__sa_protocols : @glib.Nullable[FixedArray[Bytes]],
) = "moonbit_g_dtls_connection_set_advertised_protocols"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.DtlsConnection.set_advertised_protocols.html).
pub fn DtlsConnection::set_advertised_protocols(
self : DtlsConnection,
protocols : Array[String]?,
) -> Unit {
moonbit_g_dtls_connection_set_advertised_protocols(
self,
match protocols {
Some(arr) =>
@glib.Nullable::some(
FixedArray::from_array(arr.map(fn(s) { @encoding/utf8.encode(s) })),
)
None => @glib.Nullable::null()
},
)
}
///|
#borrow(self_, certificate)
extern "c" fn moonbit_g_dtls_connection_set_certificate(
self_ : DtlsConnection,
certificate : TlsCertificate,
) = "moonbit_g_dtls_connection_set_certificate"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.DtlsConnection.set_certificate.html).
pub fn DtlsConnection::set_certificate(
self : DtlsConnection,
certificate : &ITlsCertificate,
) -> Unit {
moonbit_g_dtls_connection_set_certificate(
self,
certificate.as_tls_certificate(),
)
}
///|
#borrow(self_, database)
extern "c" fn moonbit_g_dtls_connection_set_database(
self_ : DtlsConnection,
database : @glib.Nullable[TlsDatabase],
) = "moonbit_g_dtls_connection_set_database"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.DtlsConnection.set_database.html).
pub fn DtlsConnection::set_database(
self : DtlsConnection,
database : &ITlsDatabase?,
) -> Unit {
moonbit_g_dtls_connection_set_database(
self,
match database {
Some(v) => @glib.Nullable::some(v.as_tls_database())
None => @glib.Nullable::null()
},
)
}
///|
#borrow(self_, interaction)
extern "c" fn moonbit_g_dtls_connection_set_interaction(
self_ : DtlsConnection,
interaction : @glib.Nullable[TlsInteraction],
) = "moonbit_g_dtls_connection_set_interaction"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.DtlsConnection.set_interaction.html).
pub fn DtlsConnection::set_interaction(
self : DtlsConnection,
interaction : &ITlsInteraction?,
) -> Unit {
moonbit_g_dtls_connection_set_interaction(
self,
match interaction {
Some(v) => @glib.Nullable::some(v.as_tls_interaction())
None => @glib.Nullable::null()
},
)
}
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.DtlsConnection.set_require_close_notify.html).
#borrow(self)
pub extern "c" fn DtlsConnection::set_require_close_notify(
self : DtlsConnection,
require_close_notify : Bool,
) = "moonbit_g_dtls_connection_set_require_close_notify"
///|
#borrow(self_, cancellable, error)
extern "c" fn moonbit_g_dtls_connection_shutdown(
self_ : DtlsConnection,
shutdown_read : Bool,
shutdown_write : Bool,
cancellable : @glib.Nullable[Cancellable],
error : Ref[@glib.Nullable[@glib.Error_]],
) -> Bool = "moonbit_g_dtls_connection_shutdown"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.DtlsConnection.shutdown.html).
pub fn DtlsConnection::shutdown(
self : DtlsConnection,
shutdown_read : Bool,
shutdown_write : Bool,
cancellable : &ICancellable?,
) -> Bool raise @glib.Error_ {
let error_ : Ref[@glib.Nullable[@glib.Error_]] = Ref(@glib.Nullable::null())
let result = moonbit_g_dtls_connection_shutdown(
self,
shutdown_read,
shutdown_write,
match cancellable {
Some(v) => @glib.Nullable::some(v.as_cancellable())
None => @glib.Nullable::null()
},
error_,
)
match error_.val.to_option() {
Some(e) => raise e
None => ()
}
result
}
///|
#borrow(self_, cancellable)
extern "c" fn g_dtls_connection_close_async(
self_ : DtlsConnection,
io_priority : Int,
cancellable : @glib.Nullable[Cancellable],
function : FuncRef[
(
Bool,
@glib.Nullable[@glib.Error_],
(Bool, @glib.Nullable[@glib.Error_]) -> Unit,
) -> Unit,
],
closure : (Bool, @glib.Nullable[@glib.Error_]) -> Unit,
) = "moonbit_g_dtls_connection_close_async"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.DtlsConnection.close_async.html).
pub fn DtlsConnection::close_async(
self : DtlsConnection,
io_priority : Int,
cancellable : &ICancellable?,
callback : (Result[Bool, @glib.Error_]) -> Unit,
) -> Unit {
g_dtls_connection_close_async(
self,
io_priority,
match cancellable {
Some(v) => @glib.Nullable::some(v.as_cancellable())
None => @glib.Nullable::null()
},
fn(result, error, f) { f(result, error) },
fn(result, error) {
match error.to_option() {
Some(e) => callback(Err(e))
None => callback(Ok(result))
}
},
)
}
///|
#borrow(self_, cancellable)
extern "c" fn g_dtls_connection_handshake_async(
self_ : DtlsConnection,
io_priority : Int,
cancellable : @glib.Nullable[Cancellable],
function : FuncRef[
(
Bool,
@glib.Nullable[@glib.Error_],
(Bool, @glib.Nullable[@glib.Error_]) -> Unit,
) -> Unit,
],
closure : (Bool, @glib.Nullable[@glib.Error_]) -> Unit,
) = "moonbit_g_dtls_connection_handshake_async"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.DtlsConnection.handshake_async.html).
pub fn DtlsConnection::handshake_async(
self : DtlsConnection,
io_priority : Int,
cancellable : &ICancellable?,
callback : (Result[Bool, @glib.Error_]) -> Unit,
) -> Unit {
g_dtls_connection_handshake_async(
self,
io_priority,
match cancellable {
Some(v) => @glib.Nullable::some(v.as_cancellable())
None => @glib.Nullable::null()
},
fn(result, error, f) { f(result, error) },
fn(result, error) {
match error.to_option() {
Some(e) => callback(Err(e))
None => callback(Ok(result))
}
},
)
}
///|
#borrow(self_, cancellable)
extern "c" fn g_dtls_connection_shutdown_async(
self_ : DtlsConnection,
shutdown_read : Bool,
shutdown_write : Bool,
io_priority : Int,
cancellable : @glib.Nullable[Cancellable],
function : FuncRef[
(
Bool,
@glib.Nullable[@glib.Error_],
(Bool, @glib.Nullable[@glib.Error_]) -> Unit,
) -> Unit,
],
closure : (Bool, @glib.Nullable[@glib.Error_]) -> Unit,
) = "moonbit_g_dtls_connection_shutdown_async"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.DtlsConnection.shutdown_async.html).
pub fn DtlsConnection::shutdown_async(
self : DtlsConnection,
shutdown_read : Bool,
shutdown_write : Bool,
io_priority : Int,
cancellable : &ICancellable?,
callback : (Result[Bool, @glib.Error_]) -> Unit,
) -> Unit {
g_dtls_connection_shutdown_async(
self,
shutdown_read,
shutdown_write,
io_priority,
match cancellable {
Some(v) => @glib.Nullable::some(v.as_cancellable())
None => @glib.Nullable::null()
},
fn(result, error, f) { f(result, error) },
fn(result, error) {
match error.to_option() {
Some(e) => callback(Err(e))
None => callback(Ok(result))
}
},
)
}
///|
impl IDtlsConnection with fn close(self, cancellable) -> Bool raise @glib.Error_ {
self.as_dtls_connection().close(cancellable)
}
///|
impl IDtlsConnection with fn emit_accept_certificate(self, peer_cert, errors) -> Bool {
self.as_dtls_connection().emit_accept_certificate(peer_cert, errors)
}
///|
impl IDtlsConnection with fn get_certificate(self) -> TlsCertificate? {
self.as_dtls_connection().get_certificate()
}
///|
impl IDtlsConnection with fn get_ciphersuite_name(self) -> String? {
self.as_dtls_connection().get_ciphersuite_name()
}
///|
impl IDtlsConnection with fn get_database(self) -> TlsDatabase? {
self.as_dtls_connection().get_database()
}
///|
impl IDtlsConnection with fn get_interaction(self) -> TlsInteraction? {
self.as_dtls_connection().get_interaction()
}
///|
impl IDtlsConnection with fn get_negotiated_protocol(self) -> String? {
self.as_dtls_connection().get_negotiated_protocol()
}
///|
impl IDtlsConnection with fn get_peer_certificate(self) -> TlsCertificate? {
self.as_dtls_connection().get_peer_certificate()
}
///|
impl IDtlsConnection with fn get_peer_certificate_errors(self) -> TlsCertificateFlags {
self.as_dtls_connection().get_peer_certificate_errors()
}
///|
impl IDtlsConnection with fn get_protocol_version(self) -> TlsProtocolVersion {
self.as_dtls_connection().get_protocol_version()
}
///|
impl IDtlsConnection with fn get_require_close_notify(self) -> Bool {
self.as_dtls_connection().get_require_close_notify()
}
///|
impl IDtlsConnection with fn handshake(self, cancellable) -> Bool raise @glib.Error_ {
self.as_dtls_connection().handshake(cancellable)
}
///|
impl IDtlsConnection with fn set_advertised_protocols(self, protocols) -> Unit {
self.as_dtls_connection().set_advertised_protocols(protocols)
}
///|
impl IDtlsConnection with fn set_certificate(self, certificate) -> Unit {
self.as_dtls_connection().set_certificate(certificate)
}
///|
impl IDtlsConnection with fn set_database(self, database) -> Unit {
self.as_dtls_connection().set_database(database)
}
///|
impl IDtlsConnection with fn set_interaction(self, interaction) -> Unit {
self.as_dtls_connection().set_interaction(interaction)
}
///|
impl IDtlsConnection with fn set_require_close_notify(
self,
require_close_notify,
) -> Unit {
self.as_dtls_connection().set_require_close_notify(require_close_notify)
}
///|
impl IDtlsConnection with fn shutdown(
self,
shutdown_read,
shutdown_write,
cancellable,
) -> Bool raise @glib.Error_ {
self.as_dtls_connection().shutdown(shutdown_read, shutdown_write, cancellable)
}
///|
impl IDtlsConnection with fn close_async(
self,
io_priority,
cancellable,
callback,
) -> Unit {
self.as_dtls_connection().close_async(io_priority, cancellable, callback)
}
///|
impl IDtlsConnection with fn handshake_async(
self,
io_priority,
cancellable,
callback,
) -> Unit {
self.as_dtls_connection().handshake_async(io_priority, cancellable, callback)
}
///|
impl IDtlsConnection with fn shutdown_async(
self,
shutdown_read,
shutdown_write,
io_priority,
cancellable,
callback,
) -> Unit {
self
.as_dtls_connection()
.shutdown_async(
shutdown_read, shutdown_write, io_priority, cancellable, callback,
)
}
///|
pub fn DtlsConnection::as_datagram_based(
self : DtlsConnection,
) -> DatagramBased = "%identity"
///|
pub impl IDatagramBased for DtlsConnection with fn as_datagram_based(self) {
self.as_datagram_based()
}