objc2_security/generated/
SecTrustedApplication.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2_core_foundation::*;
6
7use crate::*;
8
9#[cfg(feature = "SecBase")]
10unsafe impl ConcreteType for SecTrustedApplication {
11    /// Returns the type identifier of SecTrustedApplication instances.
12    ///
13    /// Returns: The CFTypeID of SecTrustedApplication instances.
14    #[doc(alias = "SecTrustedApplicationGetTypeID")]
15    #[inline]
16    fn type_id() -> CFTypeID {
17        extern "C-unwind" {
18            fn SecTrustedApplicationGetTypeID() -> CFTypeID;
19        }
20        unsafe { SecTrustedApplicationGetTypeID() }
21    }
22}
23
24#[cfg(feature = "SecBase")]
25impl SecTrustedApplication {
26    /// Creates a trusted application reference based on the trusted application specified by path.
27    ///
28    /// Parameter `path`: The path to the application or tool to trust. For application bundles, use the
29    /// path to the bundle directory. Pass NULL to refer to yourself, i.e. the application or tool
30    /// making this call.
31    ///
32    /// Parameter `app`: On return, a pointer to the trusted application reference.
33    ///
34    /// Returns: A result code.  See "Security Error Codes" (SecBase.h).
35    ///
36    /// # Safety
37    ///
38    /// - `path` must be a valid pointer or null.
39    /// - `app` must be a valid pointer.
40    #[doc(alias = "SecTrustedApplicationCreateFromPath")]
41    #[cfg(feature = "SecBase")]
42    #[deprecated = "SecKeychain is deprecated"]
43    #[inline]
44    pub unsafe fn create_from_path(
45        path: *const c_char,
46        app: NonNull<*mut SecTrustedApplication>,
47    ) -> OSStatus {
48        extern "C-unwind" {
49            fn SecTrustedApplicationCreateFromPath(
50                path: *const c_char,
51                app: NonNull<*mut SecTrustedApplication>,
52            ) -> OSStatus;
53        }
54        unsafe { SecTrustedApplicationCreateFromPath(path, app) }
55    }
56
57    /// Retrieves the data of a given trusted application reference
58    ///
59    /// Parameter `appRef`: A trusted application reference to retrieve data from
60    ///
61    /// Parameter `data`: On return, a pointer to a data reference of the trusted application.
62    ///
63    /// Returns: A result code.  See "Security Error Codes" (SecBase.h).
64    ///
65    /// # Safety
66    ///
67    /// `data` must be a valid pointer.
68    #[doc(alias = "SecTrustedApplicationCopyData")]
69    #[cfg(feature = "SecBase")]
70    #[deprecated = "SecKeychain is deprecated"]
71    #[inline]
72    pub unsafe fn copy_data(&self, data: NonNull<*const CFData>) -> OSStatus {
73        extern "C-unwind" {
74            fn SecTrustedApplicationCopyData(
75                app_ref: &SecTrustedApplication,
76                data: NonNull<*const CFData>,
77            ) -> OSStatus;
78        }
79        unsafe { SecTrustedApplicationCopyData(self, data) }
80    }
81
82    /// Sets the data of a given trusted application reference
83    ///
84    /// Parameter `appRef`: A trusted application reference.
85    ///
86    /// Parameter `data`: A reference to the data to set in the trusted application.
87    ///
88    /// Returns: A result code.  See "Security Error Codes" (SecBase.h).
89    #[doc(alias = "SecTrustedApplicationSetData")]
90    #[cfg(feature = "SecBase")]
91    #[deprecated = "SecKeychain is deprecated"]
92    #[inline]
93    pub unsafe fn set_data(&self, data: &CFData) -> OSStatus {
94        extern "C-unwind" {
95            fn SecTrustedApplicationSetData(
96                app_ref: &SecTrustedApplication,
97                data: &CFData,
98            ) -> OSStatus;
99        }
100        unsafe { SecTrustedApplicationSetData(self, data) }
101    }
102}
103
104extern "C-unwind" {
105    #[cfg(feature = "SecBase")]
106    #[deprecated = "renamed to `SecTrustedApplication::create_from_path`"]
107    pub fn SecTrustedApplicationCreateFromPath(
108        path: *const c_char,
109        app: NonNull<*mut SecTrustedApplication>,
110    ) -> OSStatus;
111}
112
113extern "C-unwind" {
114    #[cfg(feature = "SecBase")]
115    #[deprecated = "renamed to `SecTrustedApplication::copy_data`"]
116    pub fn SecTrustedApplicationCopyData(
117        app_ref: &SecTrustedApplication,
118        data: NonNull<*const CFData>,
119    ) -> OSStatus;
120}
121
122extern "C-unwind" {
123    #[cfg(feature = "SecBase")]
124    #[deprecated = "renamed to `SecTrustedApplication::set_data`"]
125    pub fn SecTrustedApplicationSetData(app_ref: &SecTrustedApplication, data: &CFData)
126        -> OSStatus;
127}