objc2_security/generated/
SecRequirement.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2_core_foundation::*;
5
6use crate::*;
7
8#[cfg(feature = "CSCommon")]
9unsafe impl ConcreteType for SecRequirement {
10    /// Returns the type identifier of all SecRequirement instances.
11    #[doc(alias = "SecRequirementGetTypeID")]
12    #[inline]
13    fn type_id() -> CFTypeID {
14        extern "C-unwind" {
15            fn SecRequirementGetTypeID() -> CFTypeID;
16        }
17        unsafe { SecRequirementGetTypeID() }
18    }
19}
20
21#[cfg(feature = "CSCommon")]
22impl SecRequirement {
23    /// Create a SecRequirement object from binary form.
24    /// This is the effective inverse of SecRequirementCopyData.
25    ///
26    ///
27    /// Parameter `data`: A binary blob obtained earlier from a valid SecRequirement object
28    /// using the SecRequirementCopyData call. This is the only publicly supported
29    /// way to get such a data blob.
30    ///
31    /// Parameter `flags`: Optional flags. Pass kSecCSDefaultFlags for standard behavior.
32    ///
33    /// Parameter `requirement`: On successful return, contains a reference to a SecRequirement
34    /// object that behaves identically to the one the data blob was obtained from.
35    ///
36    /// Returns: Upon success, errSecSuccess. Upon error, an OSStatus value documented in
37    /// CSCommon.h or certain other Security framework headers.
38    #[doc(alias = "SecRequirementCreateWithData")]
39    #[cfg(feature = "CSCommon")]
40    #[inline]
41    pub unsafe fn create_with_data(
42        data: &CFData,
43        flags: SecCSFlags,
44        requirement: NonNull<*mut SecRequirement>,
45    ) -> OSStatus {
46        extern "C-unwind" {
47            fn SecRequirementCreateWithData(
48                data: &CFData,
49                flags: SecCSFlags,
50                requirement: NonNull<*mut SecRequirement>,
51            ) -> OSStatus;
52        }
53        unsafe { SecRequirementCreateWithData(data, flags, requirement) }
54    }
55
56    /// Create a SecRequirement object by compiling a valid text representation
57    /// of a requirement.
58    ///
59    ///
60    /// Parameter `text`: A CFString containing the text form of a (single) Code Requirement.
61    ///
62    /// Parameter `flags`: Optional flags. Pass kSecCSDefaultFlags for standard behavior.
63    ///
64    /// Parameter `requirement`: On successful return, contains a reference to a SecRequirement
65    /// object that implements the conditions described in text.
66    ///
67    /// Returns: Upon success, errSecSuccess. Upon error, an OSStatus value documented in
68    /// CSCommon.h or certain other Security framework headers.
69    #[doc(alias = "SecRequirementCreateWithString")]
70    #[cfg(feature = "CSCommon")]
71    #[inline]
72    pub unsafe fn create_with_string(
73        text: &CFString,
74        flags: SecCSFlags,
75        requirement: NonNull<*mut SecRequirement>,
76    ) -> OSStatus {
77        extern "C-unwind" {
78            fn SecRequirementCreateWithString(
79                text: &CFString,
80                flags: SecCSFlags,
81                requirement: NonNull<*mut SecRequirement>,
82            ) -> OSStatus;
83        }
84        unsafe { SecRequirementCreateWithString(text, flags, requirement) }
85    }
86
87    #[doc(alias = "SecRequirementCreateWithStringAndErrors")]
88    #[cfg(feature = "CSCommon")]
89    #[inline]
90    pub unsafe fn create_with_string_and_errors(
91        text: &CFString,
92        flags: SecCSFlags,
93        errors: *mut *mut CFError,
94        requirement: NonNull<*mut SecRequirement>,
95    ) -> OSStatus {
96        extern "C-unwind" {
97            fn SecRequirementCreateWithStringAndErrors(
98                text: &CFString,
99                flags: SecCSFlags,
100                errors: *mut *mut CFError,
101                requirement: NonNull<*mut SecRequirement>,
102            ) -> OSStatus;
103        }
104        unsafe { SecRequirementCreateWithStringAndErrors(text, flags, errors, requirement) }
105    }
106
107    /// Extracts a stable, persistent binary form of a SecRequirement.
108    /// This is the effective inverse of SecRequirementCreateWithData.
109    ///
110    ///
111    /// Parameter `requirement`: A valid SecRequirement object.
112    ///
113    /// Parameter `flags`: Optional flags. Pass kSecCSDefaultFlags for standard behavior.
114    ///
115    /// Parameter `data`: On successful return, contains a reference to a CFData object
116    /// containing a binary blob that can be fed to SecRequirementCreateWithData
117    /// to recreate a SecRequirement object with identical behavior.
118    ///
119    /// Returns: Upon success, errSecSuccess. Upon error, an OSStatus value documented in
120    /// CSCommon.h or certain other Security framework headers.
121    #[doc(alias = "SecRequirementCopyData")]
122    #[cfg(feature = "CSCommon")]
123    #[inline]
124    pub unsafe fn copy_data(
125        self: &SecRequirement,
126        flags: SecCSFlags,
127        data: NonNull<*const CFData>,
128    ) -> OSStatus {
129        extern "C-unwind" {
130            fn SecRequirementCopyData(
131                requirement: &SecRequirement,
132                flags: SecCSFlags,
133                data: NonNull<*const CFData>,
134            ) -> OSStatus;
135        }
136        unsafe { SecRequirementCopyData(self, flags, data) }
137    }
138
139    /// Converts a SecRequirement object into text form.
140    /// This is the effective inverse of SecRequirementCreateWithString.
141    ///
142    /// Repeated application of this function may produce text that differs in
143    /// formatting, may contain different source comments, and may perform its
144    /// validation functions in different order. However, it is guaranteed that
145    /// recompiling the text using SecRequirementCreateWithString will produce a
146    /// SecRequirement object that behaves identically to the one you start with.
147    ///
148    ///
149    /// Parameter `requirement`: A valid SecRequirement object.
150    ///
151    /// Parameter `flags`: Optional flags. Pass kSecCSDefaultFlags for standard behavior.
152    ///
153    /// Parameter `text`: On successful return, contains a reference to a CFString object
154    /// containing a text representation of the requirement.
155    ///
156    /// Returns: Upon success, errSecSuccess. Upon error, an OSStatus value documented in
157    /// CSCommon.h or certain other Security framework headers.
158    #[doc(alias = "SecRequirementCopyString")]
159    #[cfg(feature = "CSCommon")]
160    #[inline]
161    pub unsafe fn copy_string(
162        self: &SecRequirement,
163        flags: SecCSFlags,
164        text: NonNull<*const CFString>,
165    ) -> OSStatus {
166        extern "C-unwind" {
167            fn SecRequirementCopyString(
168                requirement: &SecRequirement,
169                flags: SecCSFlags,
170                text: NonNull<*const CFString>,
171            ) -> OSStatus;
172        }
173        unsafe { SecRequirementCopyString(self, flags, text) }
174    }
175}
176
177extern "C-unwind" {
178    #[cfg(feature = "CSCommon")]
179    #[deprecated = "renamed to `SecRequirement::create_with_data`"]
180    pub fn SecRequirementCreateWithData(
181        data: &CFData,
182        flags: SecCSFlags,
183        requirement: NonNull<*mut SecRequirement>,
184    ) -> OSStatus;
185}
186
187extern "C-unwind" {
188    #[cfg(feature = "CSCommon")]
189    #[deprecated = "renamed to `SecRequirement::create_with_string`"]
190    pub fn SecRequirementCreateWithString(
191        text: &CFString,
192        flags: SecCSFlags,
193        requirement: NonNull<*mut SecRequirement>,
194    ) -> OSStatus;
195}
196
197extern "C-unwind" {
198    #[cfg(feature = "CSCommon")]
199    #[deprecated = "renamed to `SecRequirement::create_with_string_and_errors`"]
200    pub fn SecRequirementCreateWithStringAndErrors(
201        text: &CFString,
202        flags: SecCSFlags,
203        errors: *mut *mut CFError,
204        requirement: NonNull<*mut SecRequirement>,
205    ) -> OSStatus;
206}
207
208extern "C-unwind" {
209    #[cfg(feature = "CSCommon")]
210    #[deprecated = "renamed to `SecRequirement::copy_data`"]
211    pub fn SecRequirementCopyData(
212        requirement: &SecRequirement,
213        flags: SecCSFlags,
214        data: NonNull<*const CFData>,
215    ) -> OSStatus;
216}
217
218extern "C-unwind" {
219    #[cfg(feature = "CSCommon")]
220    #[deprecated = "renamed to `SecRequirement::copy_string`"]
221    pub fn SecRequirementCopyString(
222        requirement: &SecRequirement,
223        flags: SecCSFlags,
224        text: NonNull<*const CFString>,
225    ) -> OSStatus;
226}