#![allow(unused_imports)]
#![allow(deprecated)]
#![allow(non_snake_case)]
#![allow(non_camel_case_types)]
#![allow(non_upper_case_globals)]
#![allow(missing_docs)]
#![allow(clippy::too_many_arguments)]
#![allow(clippy::type_complexity)]
#![allow(clippy::upper_case_acronyms)]
#![allow(clippy::identity_op)]
#![allow(clippy::missing_safety_doc)]
#![allow(clippy::doc_lazy_continuation)]
#![allow(rustdoc::broken_intra_doc_links)]
#![allow(rustdoc::bare_urls)]
#![allow(rustdoc::invalid_html_tags)]
#[link(name = "SystemExtensions", kind = "framework")]
extern "C" {}
use core::ffi::*;
use core::ptr::NonNull;
#[cfg(feature = "dispatch2")]
use dispatch2::*;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern "C" {
pub static OSSystemExtensionErrorDomain: &'static NSErrorDomain;
}
extern "C" {
pub static OSBundleUsageDescriptionKey: &'static NSString;
}
extern "C" {
pub static NSSystemExtensionUsageDescriptionKey: &'static NSString;
}
extern "C" {
pub static OSRelatedKernelExtensionKey: &'static NSString;
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct OSSystemExtensionErrorCode(pub NSInteger);
impl OSSystemExtensionErrorCode {
#[doc(alias = "OSSystemExtensionErrorUnknown")]
pub const Unknown: Self = Self(1);
#[doc(alias = "OSSystemExtensionErrorMissingEntitlement")]
pub const MissingEntitlement: Self = Self(2);
#[doc(alias = "OSSystemExtensionErrorUnsupportedParentBundleLocation")]
pub const UnsupportedParentBundleLocation: Self = Self(3);
#[doc(alias = "OSSystemExtensionErrorExtensionNotFound")]
pub const ExtensionNotFound: Self = Self(4);
#[doc(alias = "OSSystemExtensionErrorExtensionMissingIdentifier")]
pub const ExtensionMissingIdentifier: Self = Self(5);
#[doc(alias = "OSSystemExtensionErrorDuplicateExtensionIdentifer")]
pub const DuplicateExtensionIdentifer: Self = Self(6);
#[doc(alias = "OSSystemExtensionErrorUnknownExtensionCategory")]
pub const UnknownExtensionCategory: Self = Self(7);
#[doc(alias = "OSSystemExtensionErrorCodeSignatureInvalid")]
pub const CodeSignatureInvalid: Self = Self(8);
#[doc(alias = "OSSystemExtensionErrorValidationFailed")]
pub const ValidationFailed: Self = Self(9);
#[doc(alias = "OSSystemExtensionErrorForbiddenBySystemPolicy")]
pub const ForbiddenBySystemPolicy: Self = Self(10);
#[doc(alias = "OSSystemExtensionErrorRequestCanceled")]
pub const RequestCanceled: Self = Self(11);
#[doc(alias = "OSSystemExtensionErrorRequestSuperseded")]
pub const RequestSuperseded: Self = Self(12);
#[doc(alias = "OSSystemExtensionErrorAuthorizationRequired")]
pub const AuthorizationRequired: Self = Self(13);
}
unsafe impl Encode for OSSystemExtensionErrorCode {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for OSSystemExtensionErrorCode {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct OSSystemExtensionReplacementAction(pub NSInteger);
impl OSSystemExtensionReplacementAction {
#[doc(alias = "OSSystemExtensionReplacementActionCancel")]
pub const Cancel: Self = Self(0);
#[doc(alias = "OSSystemExtensionReplacementActionReplace")]
pub const Replace: Self = Self(1);
}
unsafe impl Encode for OSSystemExtensionReplacementAction {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for OSSystemExtensionReplacementAction {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct OSSystemExtensionRequestResult(pub NSInteger);
impl OSSystemExtensionRequestResult {
#[doc(alias = "OSSystemExtensionRequestCompleted")]
pub const Completed: Self = Self(0);
#[doc(alias = "OSSystemExtensionRequestWillCompleteAfterReboot")]
pub const WillCompleteAfterReboot: Self = Self(1);
}
unsafe impl Encode for OSSystemExtensionRequestResult {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for OSSystemExtensionRequestResult {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct OSSystemExtensionRequest;
);
extern_conformance!(
unsafe impl NSObjectProtocol for OSSystemExtensionRequest {}
);
impl OSSystemExtensionRequest {
extern_methods!(
#[cfg(feature = "dispatch2")]
#[unsafe(method(activationRequestForExtension:queue:))]
#[unsafe(method_family = none)]
pub unsafe fn activationRequestForExtension_queue(
identifier: &NSString,
queue: &DispatchQueue,
) -> Retained<Self>;
#[cfg(feature = "dispatch2")]
#[unsafe(method(deactivationRequestForExtension:queue:))]
#[unsafe(method_family = none)]
pub unsafe fn deactivationRequestForExtension_queue(
identifier: &NSString,
queue: &DispatchQueue,
) -> Retained<Self>;
#[cfg(feature = "dispatch2")]
#[unsafe(method(propertiesRequestForExtension:queue:))]
#[unsafe(method_family = none)]
pub unsafe fn propertiesRequestForExtension_queue(
identifier: &NSString,
queue: &DispatchQueue,
) -> Retained<Self>;
#[unsafe(method(delegate))]
#[unsafe(method_family = none)]
pub unsafe fn delegate(
&self,
) -> Option<Retained<ProtocolObject<dyn OSSystemExtensionRequestDelegate>>>;
#[unsafe(method(setDelegate:))]
#[unsafe(method_family = none)]
pub unsafe fn setDelegate(
&self,
delegate: Option<&ProtocolObject<dyn OSSystemExtensionRequestDelegate>>,
);
#[unsafe(method(identifier))]
#[unsafe(method_family = none)]
pub unsafe fn identifier(&self) -> Retained<NSString>;
);
}
impl OSSystemExtensionRequest {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct OSSystemExtensionProperties;
);
extern_conformance!(
unsafe impl NSObjectProtocol for OSSystemExtensionProperties {}
);
impl OSSystemExtensionProperties {
extern_methods!(
#[unsafe(method(URL))]
#[unsafe(method_family = none)]
pub unsafe fn URL(&self) -> Retained<NSURL>;
#[unsafe(method(bundleIdentifier))]
#[unsafe(method_family = none)]
pub unsafe fn bundleIdentifier(&self) -> Retained<NSString>;
#[unsafe(method(bundleVersion))]
#[unsafe(method_family = none)]
pub unsafe fn bundleVersion(&self) -> Retained<NSString>;
#[unsafe(method(bundleShortVersion))]
#[unsafe(method_family = none)]
pub unsafe fn bundleShortVersion(&self) -> Retained<NSString>;
#[unsafe(method(isEnabled))]
#[unsafe(method_family = none)]
pub unsafe fn isEnabled(&self) -> bool;
#[unsafe(method(isAwaitingUserApproval))]
#[unsafe(method_family = none)]
pub unsafe fn isAwaitingUserApproval(&self) -> bool;
#[unsafe(method(isUninstalling))]
#[unsafe(method_family = none)]
pub unsafe fn isUninstalling(&self) -> bool;
);
}
impl OSSystemExtensionProperties {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_protocol!(
pub unsafe trait OSSystemExtensionRequestDelegate: NSObjectProtocol {
#[unsafe(method(request:actionForReplacingExtension:withExtension:))]
#[unsafe(method_family = none)]
unsafe fn request_actionForReplacingExtension_withExtension(
&self,
request: &OSSystemExtensionRequest,
existing: &OSSystemExtensionProperties,
ext: &OSSystemExtensionProperties,
) -> OSSystemExtensionReplacementAction;
#[unsafe(method(requestNeedsUserApproval:))]
#[unsafe(method_family = none)]
unsafe fn requestNeedsUserApproval(&self, request: &OSSystemExtensionRequest);
#[unsafe(method(request:didFinishWithResult:))]
#[unsafe(method_family = none)]
unsafe fn request_didFinishWithResult(
&self,
request: &OSSystemExtensionRequest,
result: OSSystemExtensionRequestResult,
);
#[unsafe(method(request:didFailWithError:))]
#[unsafe(method_family = none)]
unsafe fn request_didFailWithError(
&self,
request: &OSSystemExtensionRequest,
error: &NSError,
);
#[optional]
#[unsafe(method(request:foundProperties:))]
#[unsafe(method_family = none)]
unsafe fn request_foundProperties(
&self,
request: &OSSystemExtensionRequest,
properties: &NSArray<OSSystemExtensionProperties>,
);
}
);
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct OSSystemExtensionManager;
);
extern_conformance!(
unsafe impl NSObjectProtocol for OSSystemExtensionManager {}
);
impl OSSystemExtensionManager {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new(&self) -> Retained<Self>;
#[unsafe(method(sharedManager))]
#[unsafe(method_family = none)]
pub unsafe fn sharedManager() -> Retained<OSSystemExtensionManager>;
#[unsafe(method(submitRequest:))]
#[unsafe(method_family = none)]
pub unsafe fn submitRequest(&self, request: &OSSystemExtensionRequest);
);
}
impl OSSystemExtensionManager {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new_class() -> Retained<Self>;
);
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct OSSystemExtensionInfo;
);
unsafe impl Send for OSSystemExtensionInfo {}
unsafe impl Sync for OSSystemExtensionInfo {}
extern_conformance!(
unsafe impl NSObjectProtocol for OSSystemExtensionInfo {}
);
impl OSSystemExtensionInfo {
extern_methods!(
#[unsafe(method(bundleIdentifier))]
#[unsafe(method_family = none)]
pub unsafe fn bundleIdentifier(&self) -> Retained<NSString>;
#[unsafe(method(bundleVersion))]
#[unsafe(method_family = none)]
pub unsafe fn bundleVersion(&self) -> Retained<NSString>;
#[unsafe(method(bundleShortVersion))]
#[unsafe(method_family = none)]
pub unsafe fn bundleShortVersion(&self) -> Retained<NSString>;
);
}
impl OSSystemExtensionInfo {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_protocol!(
pub unsafe trait OSSystemExtensionsWorkspaceObserver: NSObjectProtocol {
#[optional]
#[unsafe(method(systemExtensionWillBecomeEnabled:))]
#[unsafe(method_family = none)]
unsafe fn systemExtensionWillBecomeEnabled(
&self,
system_extension_info: &OSSystemExtensionInfo,
);
#[optional]
#[unsafe(method(systemExtensionWillBecomeDisabled:))]
#[unsafe(method_family = none)]
unsafe fn systemExtensionWillBecomeDisabled(
&self,
system_extension_info: &OSSystemExtensionInfo,
);
#[optional]
#[unsafe(method(systemExtensionWillBecomeInactive:))]
#[unsafe(method_family = none)]
unsafe fn systemExtensionWillBecomeInactive(
&self,
system_extension_info: &OSSystemExtensionInfo,
);
}
);
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct OSSystemExtensionsWorkspace;
);
unsafe impl Send for OSSystemExtensionsWorkspace {}
unsafe impl Sync for OSSystemExtensionsWorkspace {}
extern_conformance!(
unsafe impl NSObjectProtocol for OSSystemExtensionsWorkspace {}
);
impl OSSystemExtensionsWorkspace {
extern_methods!(
#[unsafe(method(sharedWorkspace))]
#[unsafe(method_family = none)]
pub unsafe fn sharedWorkspace() -> Retained<OSSystemExtensionsWorkspace>;
#[unsafe(method(addObserver:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn addObserver_error(
&self,
observer: &ProtocolObject<dyn OSSystemExtensionsWorkspaceObserver>,
) -> Result<(), Retained<NSError>>;
#[unsafe(method(removeObserver:))]
#[unsafe(method_family = none)]
pub unsafe fn removeObserver(
&self,
observer: &ProtocolObject<dyn OSSystemExtensionsWorkspaceObserver>,
);
#[unsafe(method(systemExtensionsForApplicationWithBundleID:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn systemExtensionsForApplicationWithBundleID_error(
&self,
bundle_id: &NSString,
) -> Result<Retained<NSSet<OSSystemExtensionProperties>>, Retained<NSError>>;
);
}
impl OSSystemExtensionsWorkspace {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}