New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More tls bindings #83

Merged
merged 1 commit into from Feb 22, 2018

Conversation

Projects
None yet
4 participants
@MathieuDuponchelle
Contributor

MathieuDuponchelle commented Feb 17, 2018

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) {

This comment has been minimized.

@EPashkin

EPashkin Feb 17, 2018

Member

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.

This comment has been minimized.

@MathieuDuponchelle
@EPashkin

This comment has been minimized.

Member

EPashkin commented Feb 17, 2018

@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);

This comment has been minimized.

@sdroege

sdroege Feb 17, 2018

Member

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

This comment has been minimized.

@MathieuDuponchelle

MathieuDuponchelle Feb 18, 2018

Contributor

Congrats for sending me down a new rabbit hole :P

This comment has been minimized.

@sdroege

sdroege Feb 20, 2018

Member

You found the end of it already :)

This comment has been minimized.

@MathieuDuponchelle

MathieuDuponchelle Feb 21, 2018

Contributor

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>;

This comment has been minimized.

@sdroege

sdroege Feb 17, 2018

Member

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

This comment has been minimized.

@MathieuDuponchelle

MathieuDuponchelle Feb 21, 2018

Contributor

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);

This comment has been minimized.

@sdroege

sdroege Feb 17, 2018

Member

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

This comment has been minimized.

@MathieuDuponchelle
use std::ptr;
glib_wrapper! {
pub struct TlsConnection(Object<ffi::GTlsConnection, ffi::GTlsConnectionClass>): IOStream;

This comment has been minimized.

@sdroege

sdroege Feb 17, 2018

Member

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

This comment has been minimized.

@MathieuDuponchelle
@MathieuDuponchelle

This comment has been minimized.

Contributor

MathieuDuponchelle commented Feb 20, 2018

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>;

This comment has been minimized.

@sdroege

sdroege Feb 21, 2018

Member

Another byte array instead of GBytes, how weird

@sdroege

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

Member

GuillaumeGomez commented Feb 22, 2018

Then let's go for it! Thanks everyone!

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

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@sdroege

This comment has been minimized.

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

This comment has been minimized.

Member

sdroege commented Feb 23, 2018

@EPashkin

This comment has been minimized.

Member

EPashkin commented Feb 23, 2018

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

@EPashkin

This comment has been minimized.

Member

EPashkin commented Feb 23, 2018

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

This comment has been minimized.

Member

sdroege commented Feb 23, 2018

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

@MathieuDuponchelle

This comment has been minimized.

Contributor

MathieuDuponchelle commented Feb 23, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment