objc2-security 0.3.2

Bindings to the Security framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2_core_foundation::*;

use crate::*;

#[cfg(feature = "SecBase")]
unsafe impl ConcreteType for SecTrustedApplication {
    /// Returns the type identifier of SecTrustedApplication instances.
    ///
    /// Returns: The CFTypeID of SecTrustedApplication instances.
    #[doc(alias = "SecTrustedApplicationGetTypeID")]
    #[inline]
    fn type_id() -> CFTypeID {
        extern "C-unwind" {
            fn SecTrustedApplicationGetTypeID() -> CFTypeID;
        }
        unsafe { SecTrustedApplicationGetTypeID() }
    }
}

#[cfg(feature = "SecBase")]
impl SecTrustedApplication {
    /// Creates a trusted application reference based on the trusted application specified by path.
    ///
    /// Parameter `path`: The path to the application or tool to trust. For application bundles, use the
    /// path to the bundle directory. Pass NULL to refer to yourself, i.e. the application or tool
    /// making this call.
    ///
    /// Parameter `app`: On return, a pointer to the trusted application reference.
    ///
    /// Returns: A result code.  See "Security Error Codes" (SecBase.h).
    ///
    /// # Safety
    ///
    /// - `path` must be a valid pointer or null.
    /// - `app` must be a valid pointer.
    #[doc(alias = "SecTrustedApplicationCreateFromPath")]
    #[cfg(feature = "SecBase")]
    #[deprecated = "SecKeychain is deprecated"]
    #[inline]
    pub unsafe fn create_from_path(
        path: *const c_char,
        app: NonNull<*mut SecTrustedApplication>,
    ) -> OSStatus {
        extern "C-unwind" {
            fn SecTrustedApplicationCreateFromPath(
                path: *const c_char,
                app: NonNull<*mut SecTrustedApplication>,
            ) -> OSStatus;
        }
        unsafe { SecTrustedApplicationCreateFromPath(path, app) }
    }

    /// Retrieves the data of a given trusted application reference
    ///
    /// Parameter `appRef`: A trusted application reference to retrieve data from
    ///
    /// Parameter `data`: On return, a pointer to a data reference of the trusted application.
    ///
    /// Returns: A result code.  See "Security Error Codes" (SecBase.h).
    ///
    /// # Safety
    ///
    /// `data` must be a valid pointer.
    #[doc(alias = "SecTrustedApplicationCopyData")]
    #[cfg(feature = "SecBase")]
    #[deprecated = "SecKeychain is deprecated"]
    #[inline]
    pub unsafe fn copy_data(&self, data: NonNull<*const CFData>) -> OSStatus {
        extern "C-unwind" {
            fn SecTrustedApplicationCopyData(
                app_ref: &SecTrustedApplication,
                data: NonNull<*const CFData>,
            ) -> OSStatus;
        }
        unsafe { SecTrustedApplicationCopyData(self, data) }
    }

    /// Sets the data of a given trusted application reference
    ///
    /// Parameter `appRef`: A trusted application reference.
    ///
    /// Parameter `data`: A reference to the data to set in the trusted application.
    ///
    /// Returns: A result code.  See "Security Error Codes" (SecBase.h).
    #[doc(alias = "SecTrustedApplicationSetData")]
    #[cfg(feature = "SecBase")]
    #[deprecated = "SecKeychain is deprecated"]
    #[inline]
    pub unsafe fn set_data(&self, data: &CFData) -> OSStatus {
        extern "C-unwind" {
            fn SecTrustedApplicationSetData(
                app_ref: &SecTrustedApplication,
                data: &CFData,
            ) -> OSStatus;
        }
        unsafe { SecTrustedApplicationSetData(self, data) }
    }
}

extern "C-unwind" {
    #[cfg(feature = "SecBase")]
    #[deprecated = "renamed to `SecTrustedApplication::create_from_path`"]
    pub fn SecTrustedApplicationCreateFromPath(
        path: *const c_char,
        app: NonNull<*mut SecTrustedApplication>,
    ) -> OSStatus;
}

extern "C-unwind" {
    #[cfg(feature = "SecBase")]
    #[deprecated = "renamed to `SecTrustedApplication::copy_data`"]
    pub fn SecTrustedApplicationCopyData(
        app_ref: &SecTrustedApplication,
        data: NonNull<*const CFData>,
    ) -> OSStatus;
}

extern "C-unwind" {
    #[cfg(feature = "SecBase")]
    #[deprecated = "renamed to `SecTrustedApplication::set_data`"]
    pub fn SecTrustedApplicationSetData(app_ref: &SecTrustedApplication, data: &CFData)
        -> OSStatus;
}