-
-
Notifications
You must be signed in to change notification settings - Fork 31
More tls bindings #83
More tls bindings #83
Conversation
3a74b62
to
06afc08
Compare
src/auto/tls_interaction.rs
Outdated
} | ||
} | ||
|
||
fn ask_password_async<'a, P: Into<Option<&'a Cancellable>>, Q: FnOnce(Result<(), Error>) + Send + 'static>(&self, password: &TlsPassword, cancellable: P, callback: Q) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@MathieuDuponchelle please rebase on new master after #84 merged |
src/auto/tls_database.rs
Outdated
|
||
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); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 :)
There was a problem hiding this comment.
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 :)
src/auto/tls_database.rs
Outdated
|
||
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>; |
There was a problem hiding this comment.
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 :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess :)
src/auto/tls_interaction.rs
Outdated
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); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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 :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Proposed #85 , will update this PR after we have merged it |
06afc08
to
23e091d
Compare
#[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>; |
There was a problem hiding this comment.
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
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. |
Let's get it in then? And those bytearray functions should imho just be manually implemented and then use a GBytes |
Then let's go for it! Thanks everyone! |
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. |
Also files like |
List of not generated files:
|
Yes, the Gir.toml changes disappeared from the PR at some point |
How weird, I have 4 files neatly unstaged here, not sure why! |
More tls bindings
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 :)