Copy as Markdown
Other Tools
//
// DO NOT EDIT. THIS FILE IS GENERATED FROM $SRCDIR/security/manager/ssl/nsISiteSecurityService.idl
//
/// `interface nsISiteSecurityService : 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 nsISiteSecurityService {
vtable: &'static nsISiteSecurityServiceVTable,
/// 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 nsISiteSecurityService.
unsafe impl XpCom for nsISiteSecurityService {
const IID: nsIID = nsID(0x275127f8, 0xdbd7, 0x4681,
[0xaf, 0xbf, 0x6d, 0xf0, 0xc6, 0x58, 0x7a, 0x01]);
}
// 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 nsISiteSecurityService {
#[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 nsISiteSecurityService.
// 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 nsISiteSecurityServiceCoerce {
/// Cheaply cast a value of this type from a `nsISiteSecurityService`.
fn coerce_from(v: &nsISiteSecurityService) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsISiteSecurityServiceCoerce for nsISiteSecurityService {
#[inline]
fn coerce_from(v: &nsISiteSecurityService) -> &Self {
v
}
}
impl nsISiteSecurityService {
/// Cast this `nsISiteSecurityService` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsISiteSecurityServiceCoerce>(&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 nsISiteSecurityService {
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> nsISiteSecurityServiceCoerce for T {
#[inline]
fn coerce_from(v: &nsISiteSecurityService) -> &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 nsISiteSecurityService
// 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 nsISiteSecurityServiceVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* [binaryname(ProcessHeader),must_use,noscript] void processHeaderNative (in nsIURI aSourceURI, in ACString aHeader, in const_OriginAttributesRef aOriginAttributes, [optional] out unsigned long long aMaxAge, [optional] out boolean aIncludeSubdomains, [optional] out uint32_t aFailureResult); */
/// Unable to generate binding because `native type const mozilla::OriginAttributes unsupported`
pub ProcessHeader: *const ::libc::c_void,
/* [binaryname(ProcessHeaderScriptable),implicit_jscontext,must_use,optional_argc] void processHeader (in nsIURI aSourceURI, in ACString aHeader, [optional] in jsval aOriginAttributes, [optional] out unsigned long long aMaxAge, [optional] out boolean aIncludeSubdomains, [optional] out uint32_t aFailureResult); */
/// Unable to generate binding because `special type jsval unsupported`
pub ProcessHeaderScriptable: *const ::libc::c_void,
/* [implicit_jscontext,must_use,optional_argc] void resetState (in nsIURI aURI, [optional] in jsval aOriginAttributes, [optional] in nsISiteSecurityService_ResetStateBy aScope); */
/// Unable to generate binding because `special type jsval unsupported`
pub ResetState: *const ::libc::c_void,
/* [binaryname(IsSecureURI),must_use,noscript] boolean isSecureURINative (in nsIURI aURI, in const_OriginAttributesRef aOriginAttributes); */
/// Unable to generate binding because `native type const mozilla::OriginAttributes unsupported`
pub IsSecureURI: *const ::libc::c_void,
/* [binaryname(IsSecureURIScriptable),implicit_jscontext,must_use,optional_argc] boolean isSecureURI (in nsIURI aURI, [optional] in jsval aOriginAttributes); */
/// Unable to generate binding because `special type jsval unsupported`
pub IsSecureURIScriptable: *const ::libc::c_void,
/* [must_use] void clearAll (); */
pub ClearAll: unsafe extern "system" fn (this: *const nsISiteSecurityService) -> ::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 nsISiteSecurityService {
pub const Success: u32 = 0;
pub const ERROR_UNKNOWN: u32 = 1;
pub const ERROR_COULD_NOT_PARSE_HEADER: u32 = 3;
pub const ERROR_NO_MAX_AGE: u32 = 4;
pub const ERROR_MULTIPLE_MAX_AGES: u32 = 5;
pub const ERROR_INVALID_MAX_AGE: u32 = 6;
pub const ERROR_MULTIPLE_INCLUDE_SUBDOMAINS: u32 = 7;
pub const ERROR_INVALID_INCLUDE_SUBDOMAINS: u32 = 8;
pub const ERROR_COULD_NOT_SAVE_STATE: u32 = 13;
pub const ExactDomain: u8 = 0;
pub const RootDomain: u8 = 1;
pub const BaseDomain: u8 = 2;
/// ```text
/// /**
/// * Parses a given HTTP header and records the results internally.
/// * Currently one header type is supported: HSTS (aka STS).
/// * The format of the HSTS header is defined by the HSTS specification:
/// * and allows a host to specify that future HTTP requests should be
/// * upgraded to HTTPS.
/// * The caller is responsible for first determining that the header was
/// * delivered via a trustworthy connection (namely, https with no errors).
/// *
/// * @param aSourceURI the URI of the resource with the HTTP header.
/// * @param aHeader the HTTP response header specifying security data.
/// * @param aOriginAttributes the origin attributes that isolate this origin,
/// * (note that this implementation does not isolate
/// * by userContextId because of the risk of man-in-
/// * the-middle attacks before trust-on-second-use
/// * happens).
/// * If mPrivateBrowsingId > 0, information gathered
/// * from this header will not be saved persistently.
/// * @param aMaxAge the parsed max-age directive of the header.
/// * @param aIncludeSubdomains the parsed includeSubdomains directive.
/// * @param aFailureResult a more specific failure result if NS_ERROR_FAILURE
/// was returned.
/// * @return NS_OK if it succeeds
/// * NS_ERROR_FAILURE if it can't be parsed
/// * NS_SUCCESS_LOSS_OF_INSIGNIFICANT_DATA
/// * if there are unrecognized tokens in the header.
/// */
/// ```
///
/// `[binaryname(ProcessHeader),must_use,noscript] void processHeaderNative (in nsIURI aSourceURI, in ACString aHeader, in const_OriginAttributesRef aOriginAttributes, [optional] out unsigned long long aMaxAge, [optional] out boolean aIncludeSubdomains, [optional] out uint32_t aFailureResult);`
const _ProcessHeader: () = ();
/// `[binaryname(ProcessHeaderScriptable),implicit_jscontext,must_use,optional_argc] void processHeader (in nsIURI aSourceURI, in ACString aHeader, [optional] in jsval aOriginAttributes, [optional] out unsigned long long aMaxAge, [optional] out boolean aIncludeSubdomains, [optional] out uint32_t aFailureResult);`
const _ProcessHeaderScriptable: () = ();
/// ```text
/// /**
/// * Resets HSTS state a host, including the includeSubdomains state that
/// * would affect subdomains. This essentially removes the state for the
/// * domain tree rooted at this host. If any preloaded information is present
/// * for that host, that information will then be used instead of any other
/// * previously existing state.
/// *
/// * @param aURI the URI of the target host
/// * @param aOriginAttributes the origin attributes that isolate this origin,
/// * (note that this implementation does not isolate
/// * by userContextId because of the risk of man-in-
/// * the-middle attacks before trust-on-second-use
/// * happens).
/// * @param aScope The scope of state to reset. See ResetStateBy. Defaults
/// * to ExactDomain.
/// */
/// ```
///
/// `[implicit_jscontext,must_use,optional_argc] void resetState (in nsIURI aURI, [optional] in jsval aOriginAttributes, [optional] in nsISiteSecurityService_ResetStateBy aScope);`
const _ResetState: () = ();
/// ```text
/// /**
/// * Checks whether or not the URI's hostname has HSTS set.
/// * For example:
/// * The URI is an HSTS URI if either the host has the HSTS state set, or one
/// * of its super-domains has the HSTS "includeSubdomains" flag set.
/// * NOTE: this function makes decisions based only on the
/// * host contained in the URI, and disregards other portions of the URI
/// * such as path and port.
/// *
/// * @param aURI the URI to query for STS state.
/// * @param aOriginAttributes the origin attributes that isolate this origin,
/// * (note that this implementation does not isolate
/// * by userContextId because of the risk of man-in-
/// * the-middle attacks before trust-on-second-use
/// * happens).
/// */
/// ```
///
/// `[binaryname(IsSecureURI),must_use,noscript] boolean isSecureURINative (in nsIURI aURI, in const_OriginAttributesRef aOriginAttributes);`
const _IsSecureURI: () = ();
/// `[binaryname(IsSecureURIScriptable),implicit_jscontext,must_use,optional_argc] boolean isSecureURI (in nsIURI aURI, [optional] in jsval aOriginAttributes);`
const _IsSecureURIScriptable: () = ();
/// ```text
/// /**
/// * Removes all non-preloaded HSTS state by resetting to factory-original
/// * settings.
/// */
/// ```
///
/// `[must_use] void clearAll ();`
#[inline]
pub unsafe fn ClearAll(&self, ) -> ::nserror::nsresult {
((*self.vtable).ClearAll)(self, )
}
}