// GENERATED — DO NOT EDIT
///|
/// [Upstream documentation](https://docs.gtk.org/gio/class.TlsConnection.html).
pub type TlsConnection
///|
pub(open) trait ITlsConnection {
fn as_tls_connection(Self) -> TlsConnection
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 connect_accept_certificate(
Self,
(TlsConnection, TlsCertificate, TlsCertificateFlags) -> Bool,
) -> UInt64 = _
fn handshake_async(
Self,
Int,
&ICancellable?,
(Result[Bool, @glib.Error_]) -> Unit,
) -> Unit = _
}
///|
pub impl ITlsConnection for TlsConnection with fn as_tls_connection(self) {
self
}
///|
#borrow(self_, peer_cert)
extern "c" fn moonbit_g_tls_connection_emit_accept_certificate(
self_ : TlsConnection,
peer_cert : TlsCertificate,
errors : Int,
) -> Bool = "moonbit_g_tls_connection_emit_accept_certificate"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.TlsConnection.emit_accept_certificate.html).
pub fn TlsConnection::emit_accept_certificate(
self : TlsConnection,
peer_cert : &ITlsCertificate,
errors : TlsCertificateFlags,
) -> Bool {
moonbit_g_tls_connection_emit_accept_certificate(
self,
peer_cert.as_tls_certificate(),
errors.to_int(),
)
}
///|
#borrow(self_)
extern "c" fn moonbit_g_tls_connection_get_certificate(
self_ : TlsConnection,
) -> @glib.Nullable[TlsCertificate] = "moonbit_g_tls_connection_get_certificate"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.TlsConnection.get_certificate.html).
pub fn TlsConnection::get_certificate(self : TlsConnection) -> TlsCertificate? {
let raw_result = moonbit_g_tls_connection_get_certificate(self)
raw_result.to_option()
}
///|
#borrow(self_)
extern "c" fn moonbit_g_tls_connection_get_ciphersuite_name(
self_ : TlsConnection,
) -> @glib.Nullable[Bytes] = "moonbit_g_tls_connection_get_ciphersuite_name"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.TlsConnection.get_ciphersuite_name.html).
pub fn TlsConnection::get_ciphersuite_name(self : TlsConnection) -> String? {
let result = moonbit_g_tls_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_tls_connection_get_database(
self_ : TlsConnection,
) -> @glib.Nullable[TlsDatabase] = "moonbit_g_tls_connection_get_database"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.TlsConnection.get_database.html).
pub fn TlsConnection::get_database(self : TlsConnection) -> TlsDatabase? {
let raw_result = moonbit_g_tls_connection_get_database(self)
raw_result.to_option()
}
///|
#borrow(self_)
extern "c" fn moonbit_g_tls_connection_get_interaction(
self_ : TlsConnection,
) -> @glib.Nullable[TlsInteraction] = "moonbit_g_tls_connection_get_interaction"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.TlsConnection.get_interaction.html).
pub fn TlsConnection::get_interaction(self : TlsConnection) -> TlsInteraction? {
let raw_result = moonbit_g_tls_connection_get_interaction(self)
raw_result.to_option()
}
///|
#borrow(self_)
extern "c" fn moonbit_g_tls_connection_get_negotiated_protocol(
self_ : TlsConnection,
) -> @glib.Nullable[Bytes] = "moonbit_g_tls_connection_get_negotiated_protocol"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.TlsConnection.get_negotiated_protocol.html).
pub fn TlsConnection::get_negotiated_protocol(self : TlsConnection) -> String? {
let result = moonbit_g_tls_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_tls_connection_get_peer_certificate(
self_ : TlsConnection,
) -> @glib.Nullable[TlsCertificate] = "moonbit_g_tls_connection_get_peer_certificate"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.TlsConnection.get_peer_certificate.html).
pub fn TlsConnection::get_peer_certificate(
self : TlsConnection,
) -> TlsCertificate? {
let raw_result = moonbit_g_tls_connection_get_peer_certificate(self)
raw_result.to_option()
}
///|
#borrow(self_)
extern "c" fn moonbit_g_tls_connection_get_peer_certificate_errors(
self_ : TlsConnection,
) -> Int = "moonbit_g_tls_connection_get_peer_certificate_errors"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.TlsConnection.get_peer_certificate_errors.html).
pub fn TlsConnection::get_peer_certificate_errors(
self : TlsConnection,
) -> TlsCertificateFlags {
TlsCertificateFlags::from_int(
moonbit_g_tls_connection_get_peer_certificate_errors(self),
)
}
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.TlsConnection.get_protocol_version.html).
#borrow(self)
pub extern "c" fn TlsConnection::get_protocol_version(
self : TlsConnection,
) -> TlsProtocolVersion = "moonbit_g_tls_connection_get_protocol_version"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.TlsConnection.get_require_close_notify.html).
#borrow(self)
pub extern "c" fn TlsConnection::get_require_close_notify(
self : TlsConnection,
) -> Bool = "moonbit_g_tls_connection_get_require_close_notify"
///|
#borrow(self_, cancellable, error)
extern "c" fn moonbit_g_tls_connection_handshake(
self_ : TlsConnection,
cancellable : @glib.Nullable[Cancellable],
error : Ref[@glib.Nullable[@glib.Error_]],
) -> Bool = "moonbit_g_tls_connection_handshake"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.TlsConnection.handshake.html).
pub fn TlsConnection::handshake(
self : TlsConnection,
cancellable : &ICancellable?,
) -> Bool raise @glib.Error_ {
let error_ : Ref[@glib.Nullable[@glib.Error_]] = Ref(@glib.Nullable::null())
let result = moonbit_g_tls_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_tls_connection_set_advertised_protocols(
self_ : TlsConnection,
__sa_protocols : @glib.Nullable[FixedArray[Bytes]],
) = "moonbit_g_tls_connection_set_advertised_protocols"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.TlsConnection.set_advertised_protocols.html).
pub fn TlsConnection::set_advertised_protocols(
self : TlsConnection,
protocols : Array[String]?,
) -> Unit {
moonbit_g_tls_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_tls_connection_set_certificate(
self_ : TlsConnection,
certificate : TlsCertificate,
) = "moonbit_g_tls_connection_set_certificate"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.TlsConnection.set_certificate.html).
pub fn TlsConnection::set_certificate(
self : TlsConnection,
certificate : &ITlsCertificate,
) -> Unit {
moonbit_g_tls_connection_set_certificate(
self,
certificate.as_tls_certificate(),
)
}
///|
#borrow(self_, database)
extern "c" fn moonbit_g_tls_connection_set_database(
self_ : TlsConnection,
database : @glib.Nullable[TlsDatabase],
) = "moonbit_g_tls_connection_set_database"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.TlsConnection.set_database.html).
pub fn TlsConnection::set_database(
self : TlsConnection,
database : &ITlsDatabase?,
) -> Unit {
moonbit_g_tls_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_tls_connection_set_interaction(
self_ : TlsConnection,
interaction : @glib.Nullable[TlsInteraction],
) = "moonbit_g_tls_connection_set_interaction"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.TlsConnection.set_interaction.html).
pub fn TlsConnection::set_interaction(
self : TlsConnection,
interaction : &ITlsInteraction?,
) -> Unit {
moonbit_g_tls_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.TlsConnection.set_require_close_notify.html).
#borrow(self)
pub extern "c" fn TlsConnection::set_require_close_notify(
self : TlsConnection,
require_close_notify : Bool,
) = "moonbit_g_tls_connection_set_require_close_notify"
///|
#borrow(instance)
extern "c" fn g_tls_connection_connect_accept_certificate(
instance : TlsConnection,
function : FuncRef[
(
TlsConnection,
TlsCertificate,
Int,
(TlsConnection, TlsCertificate, TlsCertificateFlags) -> Bool,
) -> Bool,
],
closure : (TlsConnection, TlsCertificate, TlsCertificateFlags) -> Bool,
) -> UInt64 = "moonbit_g_tls_connection_connect_accept_certificate"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/signal.TlsConnection.accept-certificate.html).
pub fn TlsConnection::connect_accept_certificate(
self : TlsConnection,
f : (TlsConnection, TlsCertificate, TlsCertificateFlags) -> Bool,
) -> UInt64 {
g_tls_connection_connect_accept_certificate(
self,
fn(instance_, peer_cert, errors, f) {
f(instance_, peer_cert, TlsCertificateFlags::from_int(errors))
},
f,
)
}
///|
#borrow(self_, cancellable)
extern "c" fn g_tls_connection_handshake_async(
self_ : TlsConnection,
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_tls_connection_handshake_async"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.TlsConnection.handshake_async.html).
pub fn TlsConnection::handshake_async(
self : TlsConnection,
io_priority : Int,
cancellable : &ICancellable?,
callback : (Result[Bool, @glib.Error_]) -> Unit,
) -> Unit {
g_tls_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_)
extern "c" fn moonbit_g_tls_connection_get_base_io_stream(
self_ : TlsConnection,
) -> @glib.Nullable[IOStream] = "moonbit_g_tls_connection_get_base_io_stream"
///|
/// [Upstream documentation](https://docs.gtk.org/gio/property.TlsConnection.base-io-stream.html).
pub fn TlsConnection::get_base_io_stream(self : TlsConnection) -> IOStream? {
moonbit_g_tls_connection_get_base_io_stream(self).to_option()
}
///|
impl ITlsConnection with fn emit_accept_certificate(self, peer_cert, errors) -> Bool {
self.as_tls_connection().emit_accept_certificate(peer_cert, errors)
}
///|
impl ITlsConnection with fn get_certificate(self) -> TlsCertificate? {
self.as_tls_connection().get_certificate()
}
///|
impl ITlsConnection with fn get_ciphersuite_name(self) -> String? {
self.as_tls_connection().get_ciphersuite_name()
}
///|
impl ITlsConnection with fn get_database(self) -> TlsDatabase? {
self.as_tls_connection().get_database()
}
///|
impl ITlsConnection with fn get_interaction(self) -> TlsInteraction? {
self.as_tls_connection().get_interaction()
}
///|
impl ITlsConnection with fn get_negotiated_protocol(self) -> String? {
self.as_tls_connection().get_negotiated_protocol()
}
///|
impl ITlsConnection with fn get_peer_certificate(self) -> TlsCertificate? {
self.as_tls_connection().get_peer_certificate()
}
///|
impl ITlsConnection with fn get_peer_certificate_errors(self) -> TlsCertificateFlags {
self.as_tls_connection().get_peer_certificate_errors()
}
///|
impl ITlsConnection with fn get_protocol_version(self) -> TlsProtocolVersion {
self.as_tls_connection().get_protocol_version()
}
///|
impl ITlsConnection with fn get_require_close_notify(self) -> Bool {
self.as_tls_connection().get_require_close_notify()
}
///|
impl ITlsConnection with fn handshake(self, cancellable) -> Bool raise @glib.Error_ {
self.as_tls_connection().handshake(cancellable)
}
///|
impl ITlsConnection with fn set_advertised_protocols(self, protocols) -> Unit {
self.as_tls_connection().set_advertised_protocols(protocols)
}
///|
impl ITlsConnection with fn set_certificate(self, certificate) -> Unit {
self.as_tls_connection().set_certificate(certificate)
}
///|
impl ITlsConnection with fn set_database(self, database) -> Unit {
self.as_tls_connection().set_database(database)
}
///|
impl ITlsConnection with fn set_interaction(self, interaction) -> Unit {
self.as_tls_connection().set_interaction(interaction)
}
///|
impl ITlsConnection with fn set_require_close_notify(self, require_close_notify) -> Unit {
self.as_tls_connection().set_require_close_notify(require_close_notify)
}
///|
impl ITlsConnection with fn connect_accept_certificate(self, f) -> UInt64 {
self.as_tls_connection().connect_accept_certificate(f)
}
///|
impl ITlsConnection with fn handshake_async(
self,
io_priority,
cancellable,
callback,
) -> Unit {
self.as_tls_connection().handshake_async(io_priority, cancellable, callback)
}
///|
pub fn TlsConnection::as_io_stream(self : TlsConnection) -> IOStream = "%identity"
///|
pub impl IIOStream for TlsConnection with fn as_io_stream(self) {
self.as_io_stream()
}
///|
pub fn TlsConnection::as_gobject_object(
self : TlsConnection,
) -> @gobject.Object = "%identity"
///|
pub impl @gobject.IObject for TlsConnection with fn as_object(self) {
self.as_gobject_object()
}