objc2_security/generated/
SecTask.rs1use core::cell::UnsafeCell;
4use core::marker::{PhantomData, PhantomPinned};
5use core::ptr::NonNull;
6#[cfg(feature = "objc2")]
7use objc2::__framework_prelude::*;
8use objc2_core_foundation::*;
9
10use crate::*;
11
12#[doc(alias = "SecTaskRef")]
16#[repr(C)]
17pub struct SecTask {
18 inner: [u8; 0],
19 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
20}
21
22cf_type!(
23 unsafe impl SecTask {}
24);
25#[cfg(feature = "objc2")]
26cf_objc2_type!(
27 unsafe impl RefEncode<"__SecTask"> for SecTask {}
28);
29
30unsafe impl ConcreteType for SecTask {
31 #[doc(alias = "SecTaskGetTypeID")]
35 #[inline]
36 fn type_id() -> CFTypeID {
37 extern "C-unwind" {
38 fn SecTaskGetTypeID() -> CFTypeID;
39 }
40 unsafe { SecTaskGetTypeID() }
41 }
42}
43
44impl SecTask {
45 #[doc(alias = "SecTaskCreateFromSelf")]
50 #[inline]
51 pub unsafe fn from_self(allocator: Option<&CFAllocator>) -> Option<CFRetained<SecTask>> {
52 extern "C-unwind" {
53 fn SecTaskCreateFromSelf(allocator: Option<&CFAllocator>) -> Option<NonNull<SecTask>>;
54 }
55 let ret = unsafe { SecTaskCreateFromSelf(allocator) };
56 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
57 }
58
59 #[doc(alias = "SecTaskCopyValueForEntitlement")]
83 #[inline]
84 pub unsafe fn value_for_entitlement(
85 &self,
86 entitlement: &CFString,
87 error: *mut *mut CFError,
88 ) -> Option<CFRetained<CFType>> {
89 extern "C-unwind" {
90 fn SecTaskCopyValueForEntitlement(
91 task: &SecTask,
92 entitlement: &CFString,
93 error: *mut *mut CFError,
94 ) -> Option<NonNull<CFType>>;
95 }
96 let ret = unsafe { SecTaskCopyValueForEntitlement(self, entitlement, error) };
97 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
98 }
99
100 #[doc(alias = "SecTaskCopyValuesForEntitlements")]
118 #[inline]
119 pub unsafe fn values_for_entitlements(
120 &self,
121 entitlements: &CFArray,
122 error: *mut *mut CFError,
123 ) -> Option<CFRetained<CFDictionary>> {
124 extern "C-unwind" {
125 fn SecTaskCopyValuesForEntitlements(
126 task: &SecTask,
127 entitlements: &CFArray,
128 error: *mut *mut CFError,
129 ) -> Option<NonNull<CFDictionary>>;
130 }
131 let ret = unsafe { SecTaskCopyValuesForEntitlements(self, entitlements, error) };
132 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
133 }
134
135 #[doc(alias = "SecTaskCopySigningIdentifier")]
147 #[inline]
148 pub unsafe fn signing_identifier(
149 &self,
150 error: *mut *mut CFError,
151 ) -> Option<CFRetained<CFString>> {
152 extern "C-unwind" {
153 fn SecTaskCopySigningIdentifier(
154 task: &SecTask,
155 error: *mut *mut CFError,
156 ) -> Option<NonNull<CFString>>;
157 }
158 let ret = unsafe { SecTaskCopySigningIdentifier(self, error) };
159 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
160 }
161
162 #[doc(alias = "SecTaskGetCodeSignStatus")]
166 #[inline]
167 pub unsafe fn code_sign_status(&self) -> u32 {
168 extern "C-unwind" {
169 fn SecTaskGetCodeSignStatus(task: &SecTask) -> u32;
170 }
171 unsafe { SecTaskGetCodeSignStatus(self) }
172 }
173}
174
175#[deprecated = "renamed to `SecTask::from_self`"]
176#[inline]
177pub unsafe extern "C-unwind" fn SecTaskCreateFromSelf(
178 allocator: Option<&CFAllocator>,
179) -> Option<CFRetained<SecTask>> {
180 extern "C-unwind" {
181 fn SecTaskCreateFromSelf(allocator: Option<&CFAllocator>) -> Option<NonNull<SecTask>>;
182 }
183 let ret = unsafe { SecTaskCreateFromSelf(allocator) };
184 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
185}
186
187#[deprecated = "renamed to `SecTask::value_for_entitlement`"]
188#[inline]
189pub unsafe extern "C-unwind" fn SecTaskCopyValueForEntitlement(
190 task: &SecTask,
191 entitlement: &CFString,
192 error: *mut *mut CFError,
193) -> Option<CFRetained<CFType>> {
194 extern "C-unwind" {
195 fn SecTaskCopyValueForEntitlement(
196 task: &SecTask,
197 entitlement: &CFString,
198 error: *mut *mut CFError,
199 ) -> Option<NonNull<CFType>>;
200 }
201 let ret = unsafe { SecTaskCopyValueForEntitlement(task, entitlement, error) };
202 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
203}
204
205#[deprecated = "renamed to `SecTask::values_for_entitlements`"]
206#[inline]
207pub unsafe extern "C-unwind" fn SecTaskCopyValuesForEntitlements(
208 task: &SecTask,
209 entitlements: &CFArray,
210 error: *mut *mut CFError,
211) -> Option<CFRetained<CFDictionary>> {
212 extern "C-unwind" {
213 fn SecTaskCopyValuesForEntitlements(
214 task: &SecTask,
215 entitlements: &CFArray,
216 error: *mut *mut CFError,
217 ) -> Option<NonNull<CFDictionary>>;
218 }
219 let ret = unsafe { SecTaskCopyValuesForEntitlements(task, entitlements, error) };
220 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
221}
222
223#[deprecated = "renamed to `SecTask::signing_identifier`"]
224#[inline]
225pub unsafe extern "C-unwind" fn SecTaskCopySigningIdentifier(
226 task: &SecTask,
227 error: *mut *mut CFError,
228) -> Option<CFRetained<CFString>> {
229 extern "C-unwind" {
230 fn SecTaskCopySigningIdentifier(
231 task: &SecTask,
232 error: *mut *mut CFError,
233 ) -> Option<NonNull<CFString>>;
234 }
235 let ret = unsafe { SecTaskCopySigningIdentifier(task, error) };
236 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
237}
238
239extern "C-unwind" {
240 #[deprecated = "renamed to `SecTask::code_sign_status`"]
241 pub fn SecTaskGetCodeSignStatus(task: &SecTask) -> u32;
242}