Skip to content
This repository was archived by the owner on Jun 8, 2021. It is now read-only.

More tls bindings #83

Merged
merged 1 commit into from
Feb 22, 2018

Conversation

MathieuDuponchelle
Copy link
Contributor

I only added the generated bindings, will happily fix anything that review points out, not yet comfortable enough to tell what's unsafely wrapped I'm afraid :)

}
}

fn ask_password_async<'a, P: Into<Option<&'a Cancellable>>, Q: FnOnce(Result<(), Error>) + Send + 'static>(&self, password: &TlsPassword, cancellable: P, callback: Q) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This must have FnOnce(Result<TlsInteractionResult, Error>) ... see ask_password return type,
so or ignore or make manual.
There will be also same error in others async functions for sure.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@EPashkin
Copy link
Member

@MathieuDuponchelle please rebase on new master after #84 merged


fn lookup_certificate_for_handle<'a, 'b, P: Into<Option<&'a TlsInteraction>>, Q: Into<Option<&'b Cancellable>>>(&self, handle: &str, interaction: P, flags: TlsDatabaseLookupFlags, cancellable: Q) -> Result<Option<TlsCertificate>, Error>;

fn lookup_certificate_for_handle_async<'a, 'b, P: Into<Option<&'a TlsInteraction>>, Q: Into<Option<&'b Cancellable>>, R: FnOnce(Result<(), Error>) + Send + 'static>(&self, handle: &str, interaction: P, flags: TlsDatabaseLookupFlags, cancellable: Q, callback: R);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These async functions are all wrong because they ignore the non-bool return value of the finish function (it should be put as first the component of the Result in the closure). Need to be written manually for now, see gtk-rs/gir#535

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Congrats for sending me down a new rabbit hole :P

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You found the end of it already :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, should be all good now :)


fn lookup_certificate_issuer_async<'a, 'b, P: Into<Option<&'a TlsInteraction>>, Q: Into<Option<&'b Cancellable>>, R: FnOnce(Result<(), Error>) + Send + 'static>(&self, certificate: &TlsCertificate, interaction: P, flags: TlsDatabaseLookupFlags, cancellable: Q, callback: R);

//fn lookup_certificates_issued_by<'a, 'b, P: Into<Option<&'a TlsInteraction>>, Q: Into<Option<&'b Cancellable>>>(&self, issuer_raw_dn: /*Ignored*/&glib::ByteArray, interaction: P, flags: TlsDatabaseLookupFlags, cancellable: Q) -> Result<Vec<TlsCertificate>, Error>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm why is this not using a GBytes? Should probably add bindings for GByteArray at some point :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess :)

fn request_certificate<'a, P: IsA<TlsConnection>, Q: Into<Option<&'a Cancellable>>>(&self, connection: &P, flags: TlsCertificateRequestFlags, cancellable: Q) -> Result<TlsInteractionResult, Error>;

#[cfg(any(feature = "v2_40", feature = "dox"))]
fn request_certificate_async<'a, P: IsA<TlsConnection>, Q: Into<Option<&'a Cancellable>>, R: FnOnce(Result<(), Error>) + Send + 'static>(&self, connection: &P, flags: TlsCertificateRequestFlags, cancellable: Q, callback: R);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same problem with the async function, probably various others elsewhere too

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

use std::ptr;

glib_wrapper! {
pub struct TlsConnection(Object<ffi::GTlsConnection, ffi::GTlsConnectionClass>): IOStream;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While we're at it, this is useless without GTlsClientConnection and/or GTlsServerConnection. Both of which look trivially autogenerateable :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@MathieuDuponchelle
Copy link
Contributor Author

Proposed #85 , will update this PR after we have merged it

#[cfg(any(feature = "v2_46", feature = "dox"))]
fn copy_session_state<P: IsA<TlsClientConnection>>(&self, source: &P);

//fn get_accepted_cas(&self) -> /*Ignored*/Vec<glib::ByteArray>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another byte array instead of GBytes, how weird

@sdroege
Copy link
Member

sdroege commented Feb 21, 2018

Looks all good to me, but the byte array stuff annoys me. I don't think we can safely wrap that in Rust because it's refcounted and any other user of it could cause reallocation of the memory area that we might borrow currently... this should really be GBytes in the C API.

@sdroege
Copy link
Member

sdroege commented Feb 22, 2018

Let's get it in then? And those bytearray functions should imho just be manually implemented and then use a GBytes

@GuillaumeGomez
Copy link
Member

Then let's go for it! Thanks everyone!

@GuillaumeGomez GuillaumeGomez merged commit 9698ac7 into gtk-rs:master Feb 22, 2018
@sdroege
Copy link
Member

sdroege commented Feb 23, 2018

Something went wrong here: https://travis-ci.org/sdroege/gstreamer-rs/jobs/345089461

TlsAuthenticationMode is not generated anymore, and basically all the TLS types are missing from the Gir.toml now except for two.

@sdroege
Copy link
Member

sdroege commented Feb 23, 2018

@MathieuDuponchelle

@EPashkin
Copy link
Member

EPashkin commented Feb 23, 2018

Also files like auto/tls_server_connection.rs still included but not added to auto/mod.rs

@EPashkin
Copy link
Member

List of not generated files:

src/auto/tls_client_connection.rs
src/auto/tls_connection.rs
src/auto/tls_database.rs
src/auto/tls_interaction.rs
src/auto/tls_password.rs
src/auto/tls_server_connection.rs

@sdroege
Copy link
Member

sdroege commented Feb 23, 2018

Yes, the Gir.toml changes disappeared from the PR at some point

@MathieuDuponchelle
Copy link
Contributor Author

How weird, I have 4 files neatly unstaged here, not sure why!

vhdirk pushed a commit to vhdirk/gio-rs that referenced this pull request Jan 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants