use core::cell::UnsafeCell;
use core::marker::{PhantomData, PhantomPinned};
use core::ptr::NonNull;
#[cfg(feature = "objc2")]
use objc2::__framework_prelude::*;
use objc2_core_foundation::*;
use crate::*;
#[doc(alias = "SecTaskRef")]
#[repr(C)]
pub struct SecTask {
inner: [u8; 0],
_p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
}
cf_type!(
unsafe impl SecTask {}
);
#[cfg(feature = "objc2")]
cf_objc2_type!(
unsafe impl RefEncode<"__SecTask"> for SecTask {}
);
unsafe impl ConcreteType for SecTask {
#[doc(alias = "SecTaskGetTypeID")]
#[inline]
fn type_id() -> CFTypeID {
extern "C-unwind" {
fn SecTaskGetTypeID() -> CFTypeID;
}
unsafe { SecTaskGetTypeID() }
}
}
impl SecTask {
#[doc(alias = "SecTaskCreateFromSelf")]
#[inline]
pub unsafe fn from_self(allocator: Option<&CFAllocator>) -> Option<CFRetained<SecTask>> {
extern "C-unwind" {
fn SecTaskCreateFromSelf(allocator: Option<&CFAllocator>) -> Option<NonNull<SecTask>>;
}
let ret = unsafe { SecTaskCreateFromSelf(allocator) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[doc(alias = "SecTaskCopyValueForEntitlement")]
#[inline]
pub unsafe fn value_for_entitlement(
&self,
entitlement: &CFString,
error: *mut *mut CFError,
) -> Option<CFRetained<CFType>> {
extern "C-unwind" {
fn SecTaskCopyValueForEntitlement(
task: &SecTask,
entitlement: &CFString,
error: *mut *mut CFError,
) -> Option<NonNull<CFType>>;
}
let ret = unsafe { SecTaskCopyValueForEntitlement(self, entitlement, error) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[doc(alias = "SecTaskCopyValuesForEntitlements")]
#[inline]
pub unsafe fn values_for_entitlements(
&self,
entitlements: &CFArray,
error: *mut *mut CFError,
) -> Option<CFRetained<CFDictionary>> {
extern "C-unwind" {
fn SecTaskCopyValuesForEntitlements(
task: &SecTask,
entitlements: &CFArray,
error: *mut *mut CFError,
) -> Option<NonNull<CFDictionary>>;
}
let ret = unsafe { SecTaskCopyValuesForEntitlements(self, entitlements, error) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[doc(alias = "SecTaskCopySigningIdentifier")]
#[inline]
pub unsafe fn signing_identifier(
&self,
error: *mut *mut CFError,
) -> Option<CFRetained<CFString>> {
extern "C-unwind" {
fn SecTaskCopySigningIdentifier(
task: &SecTask,
error: *mut *mut CFError,
) -> Option<NonNull<CFString>>;
}
let ret = unsafe { SecTaskCopySigningIdentifier(self, error) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[doc(alias = "SecTaskGetCodeSignStatus")]
#[inline]
pub unsafe fn code_sign_status(&self) -> u32 {
extern "C-unwind" {
fn SecTaskGetCodeSignStatus(task: &SecTask) -> u32;
}
unsafe { SecTaskGetCodeSignStatus(self) }
}
}
#[deprecated = "renamed to `SecTask::from_self`"]
#[inline]
pub unsafe extern "C-unwind" fn SecTaskCreateFromSelf(
allocator: Option<&CFAllocator>,
) -> Option<CFRetained<SecTask>> {
extern "C-unwind" {
fn SecTaskCreateFromSelf(allocator: Option<&CFAllocator>) -> Option<NonNull<SecTask>>;
}
let ret = unsafe { SecTaskCreateFromSelf(allocator) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[deprecated = "renamed to `SecTask::value_for_entitlement`"]
#[inline]
pub unsafe extern "C-unwind" fn SecTaskCopyValueForEntitlement(
task: &SecTask,
entitlement: &CFString,
error: *mut *mut CFError,
) -> Option<CFRetained<CFType>> {
extern "C-unwind" {
fn SecTaskCopyValueForEntitlement(
task: &SecTask,
entitlement: &CFString,
error: *mut *mut CFError,
) -> Option<NonNull<CFType>>;
}
let ret = unsafe { SecTaskCopyValueForEntitlement(task, entitlement, error) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[deprecated = "renamed to `SecTask::values_for_entitlements`"]
#[inline]
pub unsafe extern "C-unwind" fn SecTaskCopyValuesForEntitlements(
task: &SecTask,
entitlements: &CFArray,
error: *mut *mut CFError,
) -> Option<CFRetained<CFDictionary>> {
extern "C-unwind" {
fn SecTaskCopyValuesForEntitlements(
task: &SecTask,
entitlements: &CFArray,
error: *mut *mut CFError,
) -> Option<NonNull<CFDictionary>>;
}
let ret = unsafe { SecTaskCopyValuesForEntitlements(task, entitlements, error) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[deprecated = "renamed to `SecTask::signing_identifier`"]
#[inline]
pub unsafe extern "C-unwind" fn SecTaskCopySigningIdentifier(
task: &SecTask,
error: *mut *mut CFError,
) -> Option<CFRetained<CFString>> {
extern "C-unwind" {
fn SecTaskCopySigningIdentifier(
task: &SecTask,
error: *mut *mut CFError,
) -> Option<NonNull<CFString>>;
}
let ret = unsafe { SecTaskCopySigningIdentifier(task, error) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
extern "C-unwind" {
#[deprecated = "renamed to `SecTask::code_sign_status`"]
pub fn SecTaskGetCodeSignStatus(task: &SecTask) -> u32;
}