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::cell::UnsafeCell;
use core::ffi::*;
use core::marker::{PhantomData, PhantomPinned};
use core::ptr::NonNull;
#[cfg(feature = "objc2")]
use objc2::__framework_prelude::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/security/secasn1coder?language=objc)
#[repr(C)]
#[derive(Debug)]
pub struct SecAsn1Coder {
    inner: [u8; 0],
    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for SecAsn1Coder {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Encoding::Struct("SecAsn1Coder", &[]));
}

/// [Apple's documentation](https://developer.apple.com/documentation/security/secasn1coderref?language=objc)
#[deprecated = "SecAsn1 is not supported"]
pub type SecAsn1CoderRef = *mut SecAsn1Coder;

impl SecAsn1Coder {
    /// # Safety
    ///
    /// `coder` must be a valid pointer.
    #[doc(alias = "SecAsn1CoderCreate")]
    #[deprecated = "SecAsn1 is not supported"]
    #[inline]
    pub unsafe fn create(coder: NonNull<SecAsn1CoderRef>) -> OSStatus {
        extern "C-unwind" {
            fn SecAsn1CoderCreate(coder: NonNull<SecAsn1CoderRef>) -> OSStatus;
        }
        unsafe { SecAsn1CoderCreate(coder) }
    }

    /// # Safety
    ///
    /// `coder` must be a valid pointer.
    #[doc(alias = "SecAsn1CoderRelease")]
    #[deprecated = "SecAsn1 is not supported"]
    #[inline]
    pub unsafe fn release(coder: SecAsn1CoderRef) -> OSStatus {
        extern "C-unwind" {
            fn SecAsn1CoderRelease(coder: SecAsn1CoderRef) -> OSStatus;
        }
        unsafe { SecAsn1CoderRelease(coder) }
    }
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `coder` must be a valid pointer.
    /// - `src` must be a valid pointer.
    /// - `templates` must be a valid pointer.
    /// - `dest` must be a valid pointer.
    #[cfg(feature = "SecAsn1Types")]
    #[deprecated = "SecAsn1 is not supported"]
    pub fn SecAsn1Decode(
        coder: SecAsn1CoderRef,
        src: NonNull<c_void>,
        len: usize,
        templates: NonNull<SecAsn1Template>,
        dest: NonNull<c_void>,
    ) -> OSStatus;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `coder` must be a valid pointer.
    /// - `src` must be a valid pointer.
    /// - `templ` must be a valid pointer.
    /// - `dest` must be a valid pointer.
    #[cfg(feature = "SecAsn1Types")]
    #[deprecated = "SecAsn1 is not supported"]
    pub fn SecAsn1DecodeData(
        coder: SecAsn1CoderRef,
        src: NonNull<SecAsn1Item>,
        templ: NonNull<SecAsn1Template>,
        dest: NonNull<c_void>,
    ) -> OSStatus;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `coder` must be a valid pointer.
    /// - `src` must be a valid pointer.
    /// - `templates` must be a valid pointer.
    /// - `dest` must be a valid pointer.
    #[cfg(feature = "SecAsn1Types")]
    #[deprecated = "SecAsn1 is not supported"]
    pub fn SecAsn1EncodeItem(
        coder: SecAsn1CoderRef,
        src: NonNull<c_void>,
        templates: NonNull<SecAsn1Template>,
        dest: NonNull<SecAsn1Item>,
    ) -> OSStatus;
}

/// # Safety
///
/// `coder` must be a valid pointer.
#[deprecated = "SecAsn1 is not supported"]
#[inline]
pub unsafe extern "C-unwind" fn SecAsn1Malloc(
    coder: SecAsn1CoderRef,
    len: usize,
) -> NonNull<c_void> {
    extern "C-unwind" {
        fn SecAsn1Malloc(coder: SecAsn1CoderRef, len: usize) -> Option<NonNull<c_void>>;
    }
    let ret = unsafe { SecAsn1Malloc(coder, len) };
    ret.expect("function was marked as returning non-null, but actually returned NULL")
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `coder` must be a valid pointer.
    /// - `item` must be a valid pointer.
    #[cfg(feature = "SecAsn1Types")]
    #[deprecated = "SecAsn1 is not supported"]
    pub fn SecAsn1AllocItem(
        coder: SecAsn1CoderRef,
        item: NonNull<SecAsn1Item>,
        len: usize,
    ) -> OSStatus;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `coder` must be a valid pointer.
    /// - `src` must be a valid pointer.
    /// - `dest` must be a valid pointer.
    #[cfg(feature = "SecAsn1Types")]
    #[deprecated = "SecAsn1 is not supported"]
    pub fn SecAsn1AllocCopy(
        coder: SecAsn1CoderRef,
        src: NonNull<c_void>,
        len: usize,
        dest: NonNull<SecAsn1Item>,
    ) -> OSStatus;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `coder` must be a valid pointer.
    /// - `src` must be a valid pointer.
    /// - `dest` must be a valid pointer.
    #[cfg(feature = "SecAsn1Types")]
    #[deprecated = "SecAsn1 is not supported"]
    pub fn SecAsn1AllocCopyItem(
        coder: SecAsn1CoderRef,
        src: NonNull<SecAsn1Item>,
        dest: NonNull<SecAsn1Item>,
    ) -> OSStatus;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// - `oid1` must be a valid pointer.
    /// - `oid2` must be a valid pointer.
    #[cfg(feature = "SecAsn1Types")]
    #[deprecated = "SecAsn1 is not supported"]
    pub fn SecAsn1OidCompare(oid1: NonNull<SecAsn1Oid>, oid2: NonNull<SecAsn1Oid>) -> bool;
}

extern "C-unwind" {
    #[deprecated = "renamed to `SecAsn1Coder::create`"]
    pub fn SecAsn1CoderCreate(coder: NonNull<SecAsn1CoderRef>) -> OSStatus;
}

extern "C-unwind" {
    #[deprecated = "renamed to `SecAsn1Coder::release`"]
    pub fn SecAsn1CoderRelease(coder: SecAsn1CoderRef) -> OSStatus;
}