Copy as Markdown
Other Tools
//
// DO NOT EDIT. THIS FILE IS GENERATED FROM $SRCDIR/security/manager/ssl/nsITLSSocketControl.idl
//
/// `interface nsITLSSocketControl : nsISupports`
///
// The actual type definition for the interface. This struct has methods
// declared on it which will call through its vtable. You never want to pass
// this type around by value, always pass it behind a reference.
#[repr(C)]
pub struct nsITLSSocketControl {
vtable: &'static nsITLSSocketControlVTable,
/// This field is a phantomdata to ensure that the VTable type and any
/// struct containing it is not safe to send across threads by default, as
/// XPCOM is generally not threadsafe.
///
/// If this type is marked as [rust_sync], there will be explicit `Send` and
/// `Sync` implementations on this type, which will override the inherited
/// negative impls from `Rc`.
__nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>,
// Make the rust compiler aware that there might be interior mutability
// in what actually implements the interface. This works around UB
// introduced by https://github.com/llvm/llvm-project/commit/01859da84bad95fd51d6a03b08b60c660e642a4f
// that a rust lint would make blatantly obvious, but doesn't exist.
// This prevents optimizations, but those optimizations weren't available
// before rustc switched to LLVM 16, and they now cause problems because
// of the UB.
// Until there's a lint available to find all our UB, it's simpler to
// avoid the UB in the first place, at the cost of preventing optimizations
// in places that don't cause UB. But again, those optimizations weren't
// available before.
__maybe_interior_mutability: ::std::cell::UnsafeCell<[u8; 0]>,
}
// Implementing XpCom for an interface exposes its IID, which allows for easy
// use of the `.query_interface<T>` helper method. This also defines that
// method for nsITLSSocketControl.
unsafe impl XpCom for nsITLSSocketControl {
const IID: nsIID = nsID(0x418265c8, 0x654e, 0x4fbb,
[0xba, 0x62, 0x4e, 0xed, 0x27, 0xde, 0x1f, 0x03]);
}
// We need to implement the RefCounted trait so we can be used with `RefPtr`.
// This trait teaches `RefPtr` how to manage our memory.
unsafe impl RefCounted for nsITLSSocketControl {
#[inline]
unsafe fn addref(&self) {
self.AddRef();
}
#[inline]
unsafe fn release(&self) {
self.Release();
}
}
// This trait is implemented on all types which can be coerced to from nsITLSSocketControl.
// It is used in the implementation of `fn coerce<T>`. We hide it from the
// documentation, because it clutters it up a lot.
#[doc(hidden)]
pub trait nsITLSSocketControlCoerce {
/// Cheaply cast a value of this type from a `nsITLSSocketControl`.
fn coerce_from(v: &nsITLSSocketControl) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsITLSSocketControlCoerce for nsITLSSocketControl {
#[inline]
fn coerce_from(v: &nsITLSSocketControl) -> &Self {
v
}
}
impl nsITLSSocketControl {
/// Cast this `nsITLSSocketControl` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsITLSSocketControlCoerce>(&self) -> &T {
T::coerce_from(self)
}
}
// Every interface struct type implements `Deref` to its base interface. This
// causes methods on the base interfaces to be directly avaliable on the
// object. For example, you can call `.AddRef` or `.QueryInterface` directly
// on any interface which inherits from `nsISupports`.
impl ::std::ops::Deref for nsITLSSocketControl {
type Target = nsISupports;
#[inline]
fn deref(&self) -> &nsISupports {
unsafe {
::std::mem::transmute(self)
}
}
}
// Ensure we can use .coerce() to cast to our base types as well. Any type which
// our base interface can coerce from should be coercable from us as well.
impl<T: nsISupportsCoerce> nsITLSSocketControlCoerce for T {
#[inline]
fn coerce_from(v: &nsITLSSocketControl) -> &Self {
T::coerce_from(v)
}
}
// This struct represents the interface's VTable. A pointer to a statically
// allocated version of this struct is at the beginning of every nsITLSSocketControl
// object. It contains one pointer field for each method in the interface. In
// the case where we can't generate a binding for a method, we include a void
// pointer.
#[doc(hidden)]
#[repr(C)]
pub struct nsITLSSocketControlVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* [noscript] void proxyStartSSL (); */
pub ProxyStartSSL: unsafe extern "system" fn (this: *const nsITLSSocketControl) -> ::nserror::nsresult,
/* [noscript] void StartTLS (); */
pub StartTLS: unsafe extern "system" fn (this: *const nsITLSSocketControl) -> ::nserror::nsresult,
/* [implicit_jscontext,must_use] Promise asyncStartTLS (); */
/// Unable to generate binding because `jscontext is unsupported`
pub AsyncStartTLS: *const ::libc::c_void,
/* [noscript] void setNPNList (in nsCStringTArrayRef aNPNList); */
/// Unable to generate binding because `native type nsTArray<nsCString> unsupported`
pub SetNPNList: *const ::libc::c_void,
/* ACString getAlpnEarlySelection (); */
pub GetAlpnEarlySelection: unsafe extern "system" fn (this: *const nsITLSSocketControl, _retval: *mut ::nsstring::nsACString) -> ::nserror::nsresult,
/* readonly attribute boolean earlyDataAccepted; */
pub GetEarlyDataAccepted: unsafe extern "system" fn (this: *const nsITLSSocketControl, aEarlyDataAccepted: *mut bool) -> ::nserror::nsresult,
/* void driveHandshake (); */
pub DriveHandshake: unsafe extern "system" fn (this: *const nsITLSSocketControl) -> ::nserror::nsresult,
/* boolean joinConnection (in ACString npnProtocol, in ACString hostname, in long port); */
pub JoinConnection: unsafe extern "system" fn (this: *const nsITLSSocketControl, npnProtocol: *const ::nsstring::nsACString, hostname: *const ::nsstring::nsACString, port: i32, _retval: *mut bool) -> ::nserror::nsresult,
/* boolean testJoinConnection (in ACString npnProtocol, in ACString hostname, in long port); */
pub TestJoinConnection: unsafe extern "system" fn (this: *const nsITLSSocketControl, npnProtocol: *const ::nsstring::nsACString, hostname: *const ::nsstring::nsACString, port: i32, _retval: *mut bool) -> ::nserror::nsresult,
/* boolean isAcceptableForHost (in ACString hostname); */
pub IsAcceptableForHost: unsafe extern "system" fn (this: *const nsITLSSocketControl, hostname: *const ::nsstring::nsACString, _retval: *mut bool) -> ::nserror::nsresult,
/* [infallible] readonly attribute short KEAUsed; */
pub GetKEAUsed: unsafe extern "system" fn (this: *const nsITLSSocketControl, aKEAUsed: *mut i16) -> ::nserror::nsresult,
/* [infallible] readonly attribute unsigned long KEAKeyBits; */
pub GetKEAKeyBits: unsafe extern "system" fn (this: *const nsITLSSocketControl, aKEAKeyBits: *mut u32) -> ::nserror::nsresult,
/* readonly attribute uint32_t providerFlags; */
pub GetProviderFlags: unsafe extern "system" fn (this: *const nsITLSSocketControl, aProviderFlags: *mut u32) -> ::nserror::nsresult,
/* [infallible] readonly attribute short SSLVersionUsed; */
pub GetSSLVersionUsed: unsafe extern "system" fn (this: *const nsITLSSocketControl, aSSLVersionUsed: *mut i16) -> ::nserror::nsresult,
/* [infallible] readonly attribute short SSLVersionOffered; */
pub GetSSLVersionOffered: unsafe extern "system" fn (this: *const nsITLSSocketControl, aSSLVersionOffered: *mut i16) -> ::nserror::nsresult,
/* [infallible] readonly attribute short MACAlgorithmUsed; */
pub GetMACAlgorithmUsed: unsafe extern "system" fn (this: *const nsITLSSocketControl, aMACAlgorithmUsed: *mut i16) -> ::nserror::nsresult,
/* [nostdcall,notxpcom] attribute boolean denyClientCert; */
/// Unable to generate binding because `nostdcall is unsupported`
pub GetDenyClientCert: *const ::libc::c_void,
/* [nostdcall,notxpcom] attribute boolean denyClientCert; */
/// Unable to generate binding because `nostdcall is unsupported`
pub SetDenyClientCert: *const ::libc::c_void,
/* [infallible] readonly attribute boolean clientCertSent; */
pub GetClientCertSent: unsafe extern "system" fn (this: *const nsITLSSocketControl, aClientCertSent: *mut bool) -> ::nserror::nsresult,
/* [infallible] readonly attribute boolean failedVerification; */
pub GetFailedVerification: unsafe extern "system" fn (this: *const nsITLSSocketControl, aFailedVerification: *mut bool) -> ::nserror::nsresult,
/* attribute ACString esniTxt; */
pub GetEsniTxt: unsafe extern "system" fn (this: *const nsITLSSocketControl, aEsniTxt: *mut ::nsstring::nsACString) -> ::nserror::nsresult,
/* attribute ACString esniTxt; */
pub SetEsniTxt: unsafe extern "system" fn (this: *const nsITLSSocketControl, aEsniTxt: *const ::nsstring::nsACString) -> ::nserror::nsresult,
/* attribute ACString echConfig; */
pub GetEchConfig: unsafe extern "system" fn (this: *const nsITLSSocketControl, aEchConfig: *mut ::nsstring::nsACString) -> ::nserror::nsresult,
/* attribute ACString echConfig; */
pub SetEchConfig: unsafe extern "system" fn (this: *const nsITLSSocketControl, aEchConfig: *const ::nsstring::nsACString) -> ::nserror::nsresult,
/* readonly attribute ACString retryEchConfig; */
pub GetRetryEchConfig: unsafe extern "system" fn (this: *const nsITLSSocketControl, aRetryEchConfig: *mut ::nsstring::nsACString) -> ::nserror::nsresult,
/* [noscript] void disableEarlyData (); */
pub DisableEarlyData: unsafe extern "system" fn (this: *const nsITLSSocketControl) -> ::nserror::nsresult,
/* [noscript] void setHandshakeCallbackListener (in nsITlsHandshakeCallbackListener callback); */
pub SetHandshakeCallbackListener: unsafe extern "system" fn (this: *const nsITLSSocketControl, callback: *const nsITlsHandshakeCallbackListener) -> ::nserror::nsresult,
/* readonly attribute ACString peerId; */
pub GetPeerId: unsafe extern "system" fn (this: *const nsITLSSocketControl, aPeerId: *mut ::nsstring::nsACString) -> ::nserror::nsresult,
/* readonly attribute nsITransportSecurityInfo securityInfo; */
pub GetSecurityInfo: unsafe extern "system" fn (this: *const nsITLSSocketControl, aSecurityInfo: *mut*const nsITransportSecurityInfo) -> ::nserror::nsresult,
/* [implicit_jscontext,must_use] Promise asyncGetSecurityInfo (); */
/// Unable to generate binding because `jscontext is unsupported`
pub AsyncGetSecurityInfo: *const ::libc::c_void,
/* void claim (); */
pub Claim: unsafe extern "system" fn (this: *const nsITLSSocketControl) -> ::nserror::nsresult,
/* attribute uint64_t browserId; */
pub GetBrowserId: unsafe extern "system" fn (this: *const nsITLSSocketControl, aBrowserId: *mut u64) -> ::nserror::nsresult,
/* attribute uint64_t browserId; */
pub SetBrowserId: unsafe extern "system" fn (this: *const nsITLSSocketControl, aBrowserId: u64) -> ::nserror::nsresult,
}
// The implementations of the function wrappers which are exposed to rust code.
// Call these methods rather than manually calling through the VTable struct.
impl nsITLSSocketControl {
pub const KEY_EXCHANGE_UNKNOWN: i16 = -1;
pub const SSL_VERSION_3: i16 = 768;
pub const TLS_VERSION_1: i16 = 769;
pub const TLS_VERSION_1_1: i16 = 770;
pub const TLS_VERSION_1_2: i16 = 771;
pub const TLS_VERSION_1_3: i16 = 772;
pub const SSL_VERSION_UNKNOWN: i16 = -1;
pub const SSL_MAC_UNKNOWN: i16 = -1;
pub const SSL_MAC_NULL: i16 = 0;
pub const SSL_MAC_MD5: i16 = 1;
pub const SSL_MAC_SHA: i16 = 2;
pub const SSL_HMAC_MD5: i16 = 3;
pub const SSL_HMAC_SHA: i16 = 4;
pub const SSL_HMAC_SHA256: i16 = 5;
pub const SSL_MAC_AEAD: i16 = 6;
/// `[noscript] void proxyStartSSL ();`
#[inline]
pub unsafe fn ProxyStartSSL(&self, ) -> ::nserror::nsresult {
((*self.vtable).ProxyStartSSL)(self, )
}
/// `[noscript] void StartTLS ();`
#[inline]
pub unsafe fn StartTLS(&self, ) -> ::nserror::nsresult {
((*self.vtable).StartTLS)(self, )
}
/// ```text
/// /**
/// * Calls StartTLS on the socket thread, and resolves with the nsresult
/// * return value of that call.
/// */
/// ```
///
/// `[implicit_jscontext,must_use] Promise asyncStartTLS ();`
const _AsyncStartTLS: () = ();
/// `[noscript] void setNPNList (in nsCStringTArrayRef aNPNList);`
const _SetNPNList: () = ();
/// `ACString getAlpnEarlySelection ();`
#[inline]
pub unsafe fn GetAlpnEarlySelection(&self, _retval: *mut ::nsstring::nsACString) -> ::nserror::nsresult {
((*self.vtable).GetAlpnEarlySelection)(self, _retval)
}
/// `readonly attribute boolean earlyDataAccepted;`
#[inline]
pub unsafe fn GetEarlyDataAccepted(&self, aEarlyDataAccepted: *mut bool) -> ::nserror::nsresult {
((*self.vtable).GetEarlyDataAccepted)(self, aEarlyDataAccepted)
}
/// `void driveHandshake ();`
#[inline]
pub unsafe fn DriveHandshake(&self, ) -> ::nserror::nsresult {
((*self.vtable).DriveHandshake)(self, )
}
/// `boolean joinConnection (in ACString npnProtocol, in ACString hostname, in long port);`
#[inline]
pub unsafe fn JoinConnection(&self, npnProtocol: *const ::nsstring::nsACString, hostname: *const ::nsstring::nsACString, port: i32, _retval: *mut bool) -> ::nserror::nsresult {
((*self.vtable).JoinConnection)(self, npnProtocol, hostname, port, _retval)
}
/// `boolean testJoinConnection (in ACString npnProtocol, in ACString hostname, in long port);`
#[inline]
pub unsafe fn TestJoinConnection(&self, npnProtocol: *const ::nsstring::nsACString, hostname: *const ::nsstring::nsACString, port: i32, _retval: *mut bool) -> ::nserror::nsresult {
((*self.vtable).TestJoinConnection)(self, npnProtocol, hostname, port, _retval)
}
/// `boolean isAcceptableForHost (in ACString hostname);`
#[inline]
pub unsafe fn IsAcceptableForHost(&self, hostname: *const ::nsstring::nsACString, _retval: *mut bool) -> ::nserror::nsresult {
((*self.vtable).IsAcceptableForHost)(self, hostname, _retval)
}
/// `[infallible] readonly attribute short KEAUsed;`
#[inline]
pub unsafe fn GetKEAUsed(&self) -> i16 {
let mut result = <i16 as ::std::default::Default>::default();
let _rv = ((*self.vtable).GetKEAUsed)(self, &mut result);
debug_assert!(_rv.succeeded());
result
}
/// `[infallible] readonly attribute unsigned long KEAKeyBits;`
#[inline]
pub unsafe fn GetKEAKeyBits(&self) -> u32 {
let mut result = <u32 as ::std::default::Default>::default();
let _rv = ((*self.vtable).GetKEAKeyBits)(self, &mut result);
debug_assert!(_rv.succeeded());
result
}
/// `readonly attribute uint32_t providerFlags;`
#[inline]
pub unsafe fn GetProviderFlags(&self, aProviderFlags: *mut u32) -> ::nserror::nsresult {
((*self.vtable).GetProviderFlags)(self, aProviderFlags)
}
/// `[infallible] readonly attribute short SSLVersionUsed;`
#[inline]
pub unsafe fn GetSSLVersionUsed(&self) -> i16 {
let mut result = <i16 as ::std::default::Default>::default();
let _rv = ((*self.vtable).GetSSLVersionUsed)(self, &mut result);
debug_assert!(_rv.succeeded());
result
}
/// `[infallible] readonly attribute short SSLVersionOffered;`
#[inline]
pub unsafe fn GetSSLVersionOffered(&self) -> i16 {
let mut result = <i16 as ::std::default::Default>::default();
let _rv = ((*self.vtable).GetSSLVersionOffered)(self, &mut result);
debug_assert!(_rv.succeeded());
result
}
/// `[infallible] readonly attribute short MACAlgorithmUsed;`
#[inline]
pub unsafe fn GetMACAlgorithmUsed(&self) -> i16 {
let mut result = <i16 as ::std::default::Default>::default();
let _rv = ((*self.vtable).GetMACAlgorithmUsed)(self, &mut result);
debug_assert!(_rv.succeeded());
result
}
/// ```text
/// /**
/// * If set to true before the server requests a client cert
/// * no cert will be sent.
/// */
/// ```
///
/// `[nostdcall,notxpcom] attribute boolean denyClientCert;`
const _GetDenyClientCert: () = ();
/// ```text
/// /**
/// * If set to true before the server requests a client cert
/// * no cert will be sent.
/// */
/// ```
///
/// `[nostdcall,notxpcom] attribute boolean denyClientCert;`
const _SetDenyClientCert: () = ();
/// ```text
/// /**
/// * True iff a client cert has been sent to the server - i.e. this
/// * socket has been client-cert authenticated.
/// */
/// ```
///
/// `[infallible] readonly attribute boolean clientCertSent;`
#[inline]
pub unsafe fn GetClientCertSent(&self) -> bool {
let mut result = <bool as ::std::default::Default>::default();
let _rv = ((*self.vtable).GetClientCertSent)(self, &mut result);
debug_assert!(_rv.succeeded());
result
}
/// `[infallible] readonly attribute boolean failedVerification;`
#[inline]
pub unsafe fn GetFailedVerification(&self) -> bool {
let mut result = <bool as ::std::default::Default>::default();
let _rv = ((*self.vtable).GetFailedVerification)(self, &mut result);
debug_assert!(_rv.succeeded());
result
}
/// `attribute ACString esniTxt;`
#[inline]
pub unsafe fn GetEsniTxt(&self, aEsniTxt: *mut ::nsstring::nsACString) -> ::nserror::nsresult {
((*self.vtable).GetEsniTxt)(self, aEsniTxt)
}
/// `attribute ACString esniTxt;`
#[inline]
pub unsafe fn SetEsniTxt(&self, aEsniTxt: *const ::nsstring::nsACString) -> ::nserror::nsresult {
((*self.vtable).SetEsniTxt)(self, aEsniTxt)
}
/// `attribute ACString echConfig;`
#[inline]
pub unsafe fn GetEchConfig(&self, aEchConfig: *mut ::nsstring::nsACString) -> ::nserror::nsresult {
((*self.vtable).GetEchConfig)(self, aEchConfig)
}
/// `attribute ACString echConfig;`
#[inline]
pub unsafe fn SetEchConfig(&self, aEchConfig: *const ::nsstring::nsACString) -> ::nserror::nsresult {
((*self.vtable).SetEchConfig)(self, aEchConfig)
}
/// ```text
/// /**
/// * The echConfig that should be used to retry for the connection setup.
/// */
/// ```
///
/// `readonly attribute ACString retryEchConfig;`
#[inline]
pub unsafe fn GetRetryEchConfig(&self, aRetryEchConfig: *mut ::nsstring::nsACString) -> ::nserror::nsresult {
((*self.vtable).GetRetryEchConfig)(self, aRetryEchConfig)
}
/// ```text
/// /**
/// * Disable early data.
/// */
/// ```
///
/// `[noscript] void disableEarlyData ();`
#[inline]
pub unsafe fn DisableEarlyData(&self, ) -> ::nserror::nsresult {
((*self.vtable).DisableEarlyData)(self, )
}
/// `[noscript] void setHandshakeCallbackListener (in nsITlsHandshakeCallbackListener callback);`
#[inline]
pub unsafe fn SetHandshakeCallbackListener(&self, callback: *const nsITlsHandshakeCallbackListener) -> ::nserror::nsresult {
((*self.vtable).SetHandshakeCallbackListener)(self, callback)
}
/// ```text
/// /**
/// * The id used to uniquely identify the connection to the peer.
/// */
/// ```
///
/// `readonly attribute ACString peerId;`
#[inline]
pub unsafe fn GetPeerId(&self, aPeerId: *mut ::nsstring::nsACString) -> ::nserror::nsresult {
((*self.vtable).GetPeerId)(self, aPeerId)
}
/// ```text
/// /**
/// * The securityInfo of the TLS handshake.
/// */
/// ```
///
/// `readonly attribute nsITransportSecurityInfo securityInfo;`
#[inline]
pub unsafe fn GetSecurityInfo(&self, aSecurityInfo: *mut*const nsITransportSecurityInfo) -> ::nserror::nsresult {
((*self.vtable).GetSecurityInfo)(self, aSecurityInfo)
}
/// ```text
/// /**
/// * Asynchronously obtain the securityInfo of the TLS handshake. Resolves
/// * with an nsITransportSecurityInfo. This should probably only be used in
/// * tests, where JS running on the main thread cannot access any of the
/// * other fields of nsITLSSocketControl.
/// */
/// ```
///
/// `[implicit_jscontext,must_use] Promise asyncGetSecurityInfo ();`
const _AsyncGetSecurityInfo: () = ();
/// ```text
/// /**
/// * Claim a speculative connection.
/// */
/// ```
///
/// `void claim ();`
#[inline]
pub unsafe fn Claim(&self, ) -> ::nserror::nsresult {
((*self.vtable).Claim)(self, )
}
/// ```text
/// /**
/// * The top-level outer content window ID (called "browserId" in networking
/// * code) associated with this connection, if any (otherwise, 0). Useful for
/// * associating this connection with a browser tab in order to show UI (e.g.
/// * the client authentication certificate selection dialog).
/// */
/// ```
///
/// `attribute uint64_t browserId;`
#[inline]
pub unsafe fn GetBrowserId(&self, aBrowserId: *mut u64) -> ::nserror::nsresult {
((*self.vtable).GetBrowserId)(self, aBrowserId)
}
/// ```text
/// /**
/// * The top-level outer content window ID (called "browserId" in networking
/// * code) associated with this connection, if any (otherwise, 0). Useful for
/// * associating this connection with a browser tab in order to show UI (e.g.
/// * the client authentication certificate selection dialog).
/// */
/// ```
///
/// `attribute uint64_t browserId;`
#[inline]
pub unsafe fn SetBrowserId(&self, aBrowserId: u64) -> ::nserror::nsresult {
((*self.vtable).SetBrowserId)(self, aBrowserId)
}
}