objc2_core_services/generated/OSServices/
CSIdentity.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::cell::UnsafeCell;
4use core::ffi::*;
5use core::marker::{PhantomData, PhantomPinned};
6use core::ptr::NonNull;
7#[cfg(feature = "objc2")]
8use objc2::__framework_prelude::*;
9use objc2_core_foundation::*;
10#[cfg(feature = "objc2-security")]
11use objc2_security::*;
12
13use crate::*;
14
15/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/csidentity?language=objc)
16#[repr(C)]
17pub struct CSIdentity {
18    inner: [u8; 0],
19    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
20}
21
22cf_type!(
23    unsafe impl CSIdentity {}
24);
25#[cfg(feature = "objc2")]
26cf_objc2_type!(
27    unsafe impl RefEncode<"__CSIdentity"> for CSIdentity {}
28);
29
30/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/csidentityquery?language=objc)
31#[repr(C)]
32pub struct CSIdentityQuery {
33    inner: [u8; 0],
34    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
35}
36
37cf_type!(
38    unsafe impl CSIdentityQuery {}
39);
40#[cfg(feature = "objc2")]
41cf_objc2_type!(
42    unsafe impl RefEncode<"__CSIdentityQuery"> for CSIdentityQuery {}
43);
44
45extern "C" {
46    /// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kcsidentitygenerateposixname?language=objc)
47    pub static kCSIdentityGeneratePosixName: Option<&'static CFString>;
48}
49
50/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kcsidentityclassuser?language=objc)
51pub const kCSIdentityClassUser: c_uint = 1;
52/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kcsidentityclassgroup?language=objc)
53pub const kCSIdentityClassGroup: c_uint = 2;
54
55/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/csidentityclass?language=objc)
56pub type CSIdentityClass = CFIndex;
57
58/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kcsidentityflagnone?language=objc)
59pub const kCSIdentityFlagNone: c_uint = 0;
60/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kcsidentityflaghidden?language=objc)
61pub const kCSIdentityFlagHidden: c_uint = 1;
62
63/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/csidentityflags?language=objc)
64pub type CSIdentityFlags = CFOptionFlags;
65
66unsafe impl ConcreteType for CSIdentity {
67    #[doc(alias = "CSIdentityGetTypeID")]
68    #[inline]
69    fn type_id() -> CFTypeID {
70        extern "C-unwind" {
71            fn CSIdentityGetTypeID() -> CFTypeID;
72        }
73        unsafe { CSIdentityGetTypeID() }
74    }
75}
76
77impl CSIdentity {
78    #[doc(alias = "CSIdentityCreate")]
79    #[cfg(feature = "CSIdentityAuthority")]
80    #[inline]
81    pub unsafe fn new(
82        allocator: Option<&CFAllocator>,
83        identity_class: CSIdentityClass,
84        full_name: Option<&CFString>,
85        posix_name: Option<&CFString>,
86        flags: CSIdentityFlags,
87        authority: Option<&CSIdentityAuthority>,
88    ) -> Option<CFRetained<CSIdentity>> {
89        extern "C-unwind" {
90            fn CSIdentityCreate(
91                allocator: Option<&CFAllocator>,
92                identity_class: CSIdentityClass,
93                full_name: Option<&CFString>,
94                posix_name: Option<&CFString>,
95                flags: CSIdentityFlags,
96                authority: Option<&CSIdentityAuthority>,
97            ) -> Option<NonNull<CSIdentity>>;
98        }
99        let ret = unsafe {
100            CSIdentityCreate(
101                allocator,
102                identity_class,
103                full_name,
104                posix_name,
105                flags,
106                authority,
107            )
108        };
109        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
110    }
111
112    #[doc(alias = "CSIdentityCreateCopy")]
113    #[inline]
114    pub unsafe fn new_copy(
115        allocator: Option<&CFAllocator>,
116        identity: Option<&CSIdentity>,
117    ) -> Option<CFRetained<CSIdentity>> {
118        extern "C-unwind" {
119            fn CSIdentityCreateCopy(
120                allocator: Option<&CFAllocator>,
121                identity: Option<&CSIdentity>,
122            ) -> Option<NonNull<CSIdentity>>;
123        }
124        let ret = unsafe { CSIdentityCreateCopy(allocator, identity) };
125        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
126    }
127
128    #[doc(alias = "CSIdentityGetClass")]
129    #[inline]
130    pub unsafe fn class(self: &CSIdentity) -> CSIdentityClass {
131        extern "C-unwind" {
132            fn CSIdentityGetClass(identity: &CSIdentity) -> CSIdentityClass;
133        }
134        unsafe { CSIdentityGetClass(self) }
135    }
136
137    #[doc(alias = "CSIdentityGetAuthority")]
138    #[cfg(feature = "CSIdentityAuthority")]
139    #[inline]
140    pub unsafe fn authority(self: &CSIdentity) -> Option<CFRetained<CSIdentityAuthority>> {
141        extern "C-unwind" {
142            fn CSIdentityGetAuthority(
143                identity: &CSIdentity,
144            ) -> Option<NonNull<CSIdentityAuthority>>;
145        }
146        let ret = unsafe { CSIdentityGetAuthority(self) };
147        ret.map(|ret| unsafe { CFRetained::retain(ret) })
148    }
149
150    #[doc(alias = "CSIdentityGetUUID")]
151    #[inline]
152    pub unsafe fn uuid(self: &CSIdentity) -> Option<CFRetained<CFUUID>> {
153        extern "C-unwind" {
154            fn CSIdentityGetUUID(identity: &CSIdentity) -> Option<NonNull<CFUUID>>;
155        }
156        let ret = unsafe { CSIdentityGetUUID(self) };
157        ret.map(|ret| unsafe { CFRetained::retain(ret) })
158    }
159
160    #[doc(alias = "CSIdentityGetFullName")]
161    #[inline]
162    pub unsafe fn full_name(self: &CSIdentity) -> Option<CFRetained<CFString>> {
163        extern "C-unwind" {
164            fn CSIdentityGetFullName(identity: &CSIdentity) -> Option<NonNull<CFString>>;
165        }
166        let ret = unsafe { CSIdentityGetFullName(self) };
167        ret.map(|ret| unsafe { CFRetained::retain(ret) })
168    }
169
170    #[doc(alias = "CSIdentityGetPosixID")]
171    #[cfg(feature = "libc")]
172    #[inline]
173    pub unsafe fn posix_id(self: &CSIdentity) -> libc::id_t {
174        extern "C-unwind" {
175            fn CSIdentityGetPosixID(identity: &CSIdentity) -> libc::id_t;
176        }
177        unsafe { CSIdentityGetPosixID(self) }
178    }
179
180    #[doc(alias = "CSIdentityGetPosixName")]
181    #[inline]
182    pub unsafe fn posix_name(self: &CSIdentity) -> Option<CFRetained<CFString>> {
183        extern "C-unwind" {
184            fn CSIdentityGetPosixName(identity: &CSIdentity) -> Option<NonNull<CFString>>;
185        }
186        let ret = unsafe { CSIdentityGetPosixName(self) };
187        ret.map(|ret| unsafe { CFRetained::retain(ret) })
188    }
189
190    #[doc(alias = "CSIdentityGetEmailAddress")]
191    #[inline]
192    pub unsafe fn email_address(self: &CSIdentity) -> Option<CFRetained<CFString>> {
193        extern "C-unwind" {
194            fn CSIdentityGetEmailAddress(identity: &CSIdentity) -> Option<NonNull<CFString>>;
195        }
196        let ret = unsafe { CSIdentityGetEmailAddress(self) };
197        ret.map(|ret| unsafe { CFRetained::retain(ret) })
198    }
199
200    #[doc(alias = "CSIdentityGetImageURL")]
201    #[inline]
202    pub unsafe fn image_url(self: &CSIdentity) -> Option<CFRetained<CFURL>> {
203        extern "C-unwind" {
204            fn CSIdentityGetImageURL(identity: &CSIdentity) -> Option<NonNull<CFURL>>;
205        }
206        let ret = unsafe { CSIdentityGetImageURL(self) };
207        ret.map(|ret| unsafe { CFRetained::retain(ret) })
208    }
209
210    #[doc(alias = "CSIdentityGetImageData")]
211    #[inline]
212    pub unsafe fn image_data(self: &CSIdentity) -> Option<CFRetained<CFData>> {
213        extern "C-unwind" {
214            fn CSIdentityGetImageData(identity: &CSIdentity) -> Option<NonNull<CFData>>;
215        }
216        let ret = unsafe { CSIdentityGetImageData(self) };
217        ret.map(|ret| unsafe { CFRetained::retain(ret) })
218    }
219
220    #[doc(alias = "CSIdentityGetImageDataType")]
221    #[inline]
222    pub unsafe fn image_data_type(self: &CSIdentity) -> Option<CFRetained<CFString>> {
223        extern "C-unwind" {
224            fn CSIdentityGetImageDataType(identity: &CSIdentity) -> Option<NonNull<CFString>>;
225        }
226        let ret = unsafe { CSIdentityGetImageDataType(self) };
227        ret.map(|ret| unsafe { CFRetained::retain(ret) })
228    }
229
230    #[doc(alias = "CSIdentityGetAliases")]
231    #[inline]
232    pub unsafe fn aliases(self: &CSIdentity) -> Option<CFRetained<CFArray>> {
233        extern "C-unwind" {
234            fn CSIdentityGetAliases(identity: &CSIdentity) -> Option<NonNull<CFArray>>;
235        }
236        let ret = unsafe { CSIdentityGetAliases(self) };
237        ret.map(|ret| unsafe { CFRetained::retain(ret) })
238    }
239
240    #[doc(alias = "CSIdentityIsMemberOfGroup")]
241    #[inline]
242    pub unsafe fn is_member_of_group(self: &CSIdentity, group: Option<&CSIdentity>) -> bool {
243        extern "C-unwind" {
244            fn CSIdentityIsMemberOfGroup(
245                identity: &CSIdentity,
246                group: Option<&CSIdentity>,
247            ) -> Boolean;
248        }
249        let ret = unsafe { CSIdentityIsMemberOfGroup(self, group) };
250        ret != 0
251    }
252
253    #[doc(alias = "CSIdentityIsHidden")]
254    #[inline]
255    pub unsafe fn is_hidden(self: &CSIdentity) -> bool {
256        extern "C-unwind" {
257            fn CSIdentityIsHidden(identity: &CSIdentity) -> Boolean;
258        }
259        let ret = unsafe { CSIdentityIsHidden(self) };
260        ret != 0
261    }
262
263    #[doc(alias = "CSIdentityCreatePersistentReference")]
264    #[inline]
265    pub unsafe fn new_persistent_reference(
266        allocator: Option<&CFAllocator>,
267        identity: Option<&CSIdentity>,
268    ) -> Option<CFRetained<CFData>> {
269        extern "C-unwind" {
270            fn CSIdentityCreatePersistentReference(
271                allocator: Option<&CFAllocator>,
272                identity: Option<&CSIdentity>,
273            ) -> Option<NonNull<CFData>>;
274        }
275        let ret = unsafe { CSIdentityCreatePersistentReference(allocator, identity) };
276        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
277    }
278
279    #[doc(alias = "CSIdentityIsEnabled")]
280    #[inline]
281    pub unsafe fn is_enabled(self: &CSIdentity) -> bool {
282        extern "C-unwind" {
283            fn CSIdentityIsEnabled(user: &CSIdentity) -> Boolean;
284        }
285        let ret = unsafe { CSIdentityIsEnabled(self) };
286        ret != 0
287    }
288
289    #[doc(alias = "CSIdentityAuthenticateUsingPassword")]
290    #[inline]
291    pub unsafe fn authenticate_using_password(
292        self: &CSIdentity,
293        password: Option<&CFString>,
294    ) -> bool {
295        extern "C-unwind" {
296            fn CSIdentityAuthenticateUsingPassword(
297                user: &CSIdentity,
298                password: Option<&CFString>,
299            ) -> Boolean;
300        }
301        let ret = unsafe { CSIdentityAuthenticateUsingPassword(self, password) };
302        ret != 0
303    }
304
305    #[doc(alias = "CSIdentityGetCertificate")]
306    #[cfg(feature = "objc2-security")]
307    #[inline]
308    pub unsafe fn certificate(self: &CSIdentity) -> Option<CFRetained<SecCertificate>> {
309        extern "C-unwind" {
310            fn CSIdentityGetCertificate(user: &CSIdentity) -> Option<NonNull<SecCertificate>>;
311        }
312        let ret = unsafe { CSIdentityGetCertificate(self) };
313        ret.map(|ret| unsafe { CFRetained::retain(ret) })
314    }
315
316    #[doc(alias = "CSIdentityCreateGroupMembershipQuery")]
317    #[inline]
318    pub unsafe fn new_group_membership_query(
319        allocator: Option<&CFAllocator>,
320        group: Option<&CSIdentity>,
321    ) -> Option<CFRetained<CSIdentityQuery>> {
322        extern "C-unwind" {
323            fn CSIdentityCreateGroupMembershipQuery(
324                allocator: Option<&CFAllocator>,
325                group: Option<&CSIdentity>,
326            ) -> Option<NonNull<CSIdentityQuery>>;
327        }
328        let ret = unsafe { CSIdentityCreateGroupMembershipQuery(allocator, group) };
329        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
330    }
331
332    #[doc(alias = "CSIdentitySetFullName")]
333    #[inline]
334    pub unsafe fn set_full_name(self: &CSIdentity, full_name: Option<&CFString>) {
335        extern "C-unwind" {
336            fn CSIdentitySetFullName(identity: &CSIdentity, full_name: Option<&CFString>);
337        }
338        unsafe { CSIdentitySetFullName(self, full_name) }
339    }
340
341    #[doc(alias = "CSIdentitySetEmailAddress")]
342    #[inline]
343    pub unsafe fn set_email_address(self: &CSIdentity, email_address: Option<&CFString>) {
344        extern "C-unwind" {
345            fn CSIdentitySetEmailAddress(identity: &CSIdentity, email_address: Option<&CFString>);
346        }
347        unsafe { CSIdentitySetEmailAddress(self, email_address) }
348    }
349
350    #[doc(alias = "CSIdentitySetImageURL")]
351    #[inline]
352    pub unsafe fn set_image_url(self: &CSIdentity, url: Option<&CFURL>) {
353        extern "C-unwind" {
354            fn CSIdentitySetImageURL(identity: &CSIdentity, url: Option<&CFURL>);
355        }
356        unsafe { CSIdentitySetImageURL(self, url) }
357    }
358
359    #[doc(alias = "CSIdentitySetImageData")]
360    #[inline]
361    pub unsafe fn set_image_data(
362        self: &CSIdentity,
363        image_data: Option<&CFData>,
364        image_data_type: Option<&CFString>,
365    ) {
366        extern "C-unwind" {
367            fn CSIdentitySetImageData(
368                identity: &CSIdentity,
369                image_data: Option<&CFData>,
370                image_data_type: Option<&CFString>,
371            );
372        }
373        unsafe { CSIdentitySetImageData(self, image_data, image_data_type) }
374    }
375
376    #[doc(alias = "CSIdentityAddAlias")]
377    #[inline]
378    pub unsafe fn add_alias(self: &CSIdentity, alias: Option<&CFString>) {
379        extern "C-unwind" {
380            fn CSIdentityAddAlias(identity: &CSIdentity, alias: Option<&CFString>);
381        }
382        unsafe { CSIdentityAddAlias(self, alias) }
383    }
384
385    #[doc(alias = "CSIdentityRemoveAlias")]
386    #[inline]
387    pub unsafe fn remove_alias(self: &CSIdentity, alias: Option<&CFString>) {
388        extern "C-unwind" {
389            fn CSIdentityRemoveAlias(identity: &CSIdentity, alias: Option<&CFString>);
390        }
391        unsafe { CSIdentityRemoveAlias(self, alias) }
392    }
393
394    #[doc(alias = "CSIdentityAddMember")]
395    #[inline]
396    pub unsafe fn add_member(self: &CSIdentity, member: Option<&CSIdentity>) {
397        extern "C-unwind" {
398            fn CSIdentityAddMember(group: &CSIdentity, member: Option<&CSIdentity>);
399        }
400        unsafe { CSIdentityAddMember(self, member) }
401    }
402
403    #[doc(alias = "CSIdentityRemoveMember")]
404    #[inline]
405    pub unsafe fn remove_member(self: &CSIdentity, member: Option<&CSIdentity>) {
406        extern "C-unwind" {
407            fn CSIdentityRemoveMember(group: &CSIdentity, member: Option<&CSIdentity>);
408        }
409        unsafe { CSIdentityRemoveMember(self, member) }
410    }
411
412    #[doc(alias = "CSIdentitySetIsEnabled")]
413    #[inline]
414    pub unsafe fn set_is_enabled(self: &CSIdentity, is_enabled: bool) {
415        extern "C-unwind" {
416            fn CSIdentitySetIsEnabled(user: &CSIdentity, is_enabled: Boolean);
417        }
418        unsafe { CSIdentitySetIsEnabled(self, is_enabled as _) }
419    }
420
421    #[doc(alias = "CSIdentitySetPassword")]
422    #[inline]
423    pub unsafe fn set_password(self: &CSIdentity, password: Option<&CFString>) {
424        extern "C-unwind" {
425            fn CSIdentitySetPassword(user: &CSIdentity, password: Option<&CFString>);
426        }
427        unsafe { CSIdentitySetPassword(self, password) }
428    }
429
430    #[doc(alias = "CSIdentitySetCertificate")]
431    #[cfg(feature = "objc2-security")]
432    #[inline]
433    pub unsafe fn set_certificate(self: &CSIdentity, certificate: Option<&SecCertificate>) {
434        extern "C-unwind" {
435            fn CSIdentitySetCertificate(user: &CSIdentity, certificate: Option<&SecCertificate>);
436        }
437        unsafe { CSIdentitySetCertificate(self, certificate) }
438    }
439
440    #[doc(alias = "CSIdentityDelete")]
441    #[inline]
442    pub unsafe fn delete(self: &CSIdentity) {
443        extern "C-unwind" {
444            fn CSIdentityDelete(identity: &CSIdentity);
445        }
446        unsafe { CSIdentityDelete(self) }
447    }
448
449    #[doc(alias = "CSIdentityCommit")]
450    #[cfg(feature = "objc2-security")]
451    #[inline]
452    pub unsafe fn commit(
453        self: &CSIdentity,
454        authorization: AuthorizationRef,
455        error: *mut *mut CFError,
456    ) -> bool {
457        extern "C-unwind" {
458            fn CSIdentityCommit(
459                identity: &CSIdentity,
460                authorization: AuthorizationRef,
461                error: *mut *mut CFError,
462            ) -> Boolean;
463        }
464        let ret = unsafe { CSIdentityCommit(self, authorization, error) };
465        ret != 0
466    }
467}
468
469/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/kcsidentitycommitcompleted?language=objc)
470pub const kCSIdentityCommitCompleted: c_uint = 1;
471
472/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/csidentitystatusupdatedcallback?language=objc)
473pub type CSIdentityStatusUpdatedCallback =
474    Option<unsafe extern "C-unwind" fn(*mut CSIdentity, CFIndex, *mut CFError, *mut c_void)>;
475
476/// [Apple's documentation](https://developer.apple.com/documentation/coreservices/csidentityclientcontext?language=objc)
477#[repr(C)]
478#[derive(Clone, Copy, Debug, PartialEq)]
479pub struct CSIdentityClientContext {
480    pub version: CFIndex,
481    pub info: *mut c_void,
482    pub retain: CFAllocatorRetainCallBack,
483    pub release: CFAllocatorReleaseCallBack,
484    pub copyDescription: CFAllocatorCopyDescriptionCallBack,
485    pub statusUpdated: CSIdentityStatusUpdatedCallback,
486}
487
488#[cfg(feature = "objc2")]
489unsafe impl Encode for CSIdentityClientContext {
490    const ENCODING: Encoding = Encoding::Struct(
491        "CSIdentityClientContext",
492        &[
493            <CFIndex>::ENCODING,
494            <*mut c_void>::ENCODING,
495            <CFAllocatorRetainCallBack>::ENCODING,
496            <CFAllocatorReleaseCallBack>::ENCODING,
497            <CFAllocatorCopyDescriptionCallBack>::ENCODING,
498            <CSIdentityStatusUpdatedCallback>::ENCODING,
499        ],
500    );
501}
502
503#[cfg(feature = "objc2")]
504unsafe impl RefEncode for CSIdentityClientContext {
505    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
506}
507
508impl CSIdentity {
509    #[doc(alias = "CSIdentityCommitAsynchronously")]
510    #[cfg(feature = "objc2-security")]
511    #[inline]
512    pub unsafe fn commit_asynchronously(
513        self: &CSIdentity,
514        client_context: *const CSIdentityClientContext,
515        run_loop: Option<&CFRunLoop>,
516        run_loop_mode: Option<&CFString>,
517        authorization: AuthorizationRef,
518    ) -> bool {
519        extern "C-unwind" {
520            fn CSIdentityCommitAsynchronously(
521                identity: &CSIdentity,
522                client_context: *const CSIdentityClientContext,
523                run_loop: Option<&CFRunLoop>,
524                run_loop_mode: Option<&CFString>,
525                authorization: AuthorizationRef,
526            ) -> Boolean;
527        }
528        let ret = unsafe {
529            CSIdentityCommitAsynchronously(
530                self,
531                client_context,
532                run_loop,
533                run_loop_mode,
534                authorization,
535            )
536        };
537        ret != 0
538    }
539
540    #[doc(alias = "CSIdentityIsCommitting")]
541    #[inline]
542    pub unsafe fn is_committing(self: &CSIdentity) -> bool {
543        extern "C-unwind" {
544            fn CSIdentityIsCommitting(identity: &CSIdentity) -> Boolean;
545        }
546        let ret = unsafe { CSIdentityIsCommitting(self) };
547        ret != 0
548    }
549
550    #[doc(alias = "CSIdentityRemoveClient")]
551    #[inline]
552    pub unsafe fn remove_client(self: &CSIdentity) {
553        extern "C-unwind" {
554            fn CSIdentityRemoveClient(identity: &CSIdentity);
555        }
556        unsafe { CSIdentityRemoveClient(self) }
557    }
558}
559
560#[cfg(feature = "CSIdentityAuthority")]
561#[deprecated = "renamed to `CSIdentity::new`"]
562#[inline]
563pub unsafe extern "C-unwind" fn CSIdentityCreate(
564    allocator: Option<&CFAllocator>,
565    identity_class: CSIdentityClass,
566    full_name: Option<&CFString>,
567    posix_name: Option<&CFString>,
568    flags: CSIdentityFlags,
569    authority: Option<&CSIdentityAuthority>,
570) -> Option<CFRetained<CSIdentity>> {
571    extern "C-unwind" {
572        fn CSIdentityCreate(
573            allocator: Option<&CFAllocator>,
574            identity_class: CSIdentityClass,
575            full_name: Option<&CFString>,
576            posix_name: Option<&CFString>,
577            flags: CSIdentityFlags,
578            authority: Option<&CSIdentityAuthority>,
579        ) -> Option<NonNull<CSIdentity>>;
580    }
581    let ret = unsafe {
582        CSIdentityCreate(
583            allocator,
584            identity_class,
585            full_name,
586            posix_name,
587            flags,
588            authority,
589        )
590    };
591    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
592}
593
594#[deprecated = "renamed to `CSIdentity::new_copy`"]
595#[inline]
596pub unsafe extern "C-unwind" fn CSIdentityCreateCopy(
597    allocator: Option<&CFAllocator>,
598    identity: Option<&CSIdentity>,
599) -> Option<CFRetained<CSIdentity>> {
600    extern "C-unwind" {
601        fn CSIdentityCreateCopy(
602            allocator: Option<&CFAllocator>,
603            identity: Option<&CSIdentity>,
604        ) -> Option<NonNull<CSIdentity>>;
605    }
606    let ret = unsafe { CSIdentityCreateCopy(allocator, identity) };
607    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
608}
609
610extern "C-unwind" {
611    #[deprecated = "renamed to `CSIdentity::class`"]
612    pub fn CSIdentityGetClass(identity: &CSIdentity) -> CSIdentityClass;
613}
614
615#[cfg(feature = "CSIdentityAuthority")]
616#[deprecated = "renamed to `CSIdentity::authority`"]
617#[inline]
618pub unsafe extern "C-unwind" fn CSIdentityGetAuthority(
619    identity: &CSIdentity,
620) -> Option<CFRetained<CSIdentityAuthority>> {
621    extern "C-unwind" {
622        fn CSIdentityGetAuthority(identity: &CSIdentity) -> Option<NonNull<CSIdentityAuthority>>;
623    }
624    let ret = unsafe { CSIdentityGetAuthority(identity) };
625    ret.map(|ret| unsafe { CFRetained::retain(ret) })
626}
627
628#[deprecated = "renamed to `CSIdentity::uuid`"]
629#[inline]
630pub unsafe extern "C-unwind" fn CSIdentityGetUUID(
631    identity: &CSIdentity,
632) -> Option<CFRetained<CFUUID>> {
633    extern "C-unwind" {
634        fn CSIdentityGetUUID(identity: &CSIdentity) -> Option<NonNull<CFUUID>>;
635    }
636    let ret = unsafe { CSIdentityGetUUID(identity) };
637    ret.map(|ret| unsafe { CFRetained::retain(ret) })
638}
639
640#[deprecated = "renamed to `CSIdentity::full_name`"]
641#[inline]
642pub unsafe extern "C-unwind" fn CSIdentityGetFullName(
643    identity: &CSIdentity,
644) -> Option<CFRetained<CFString>> {
645    extern "C-unwind" {
646        fn CSIdentityGetFullName(identity: &CSIdentity) -> Option<NonNull<CFString>>;
647    }
648    let ret = unsafe { CSIdentityGetFullName(identity) };
649    ret.map(|ret| unsafe { CFRetained::retain(ret) })
650}
651
652extern "C-unwind" {
653    #[cfg(feature = "libc")]
654    #[deprecated = "renamed to `CSIdentity::posix_id`"]
655    pub fn CSIdentityGetPosixID(identity: &CSIdentity) -> libc::id_t;
656}
657
658#[deprecated = "renamed to `CSIdentity::posix_name`"]
659#[inline]
660pub unsafe extern "C-unwind" fn CSIdentityGetPosixName(
661    identity: &CSIdentity,
662) -> Option<CFRetained<CFString>> {
663    extern "C-unwind" {
664        fn CSIdentityGetPosixName(identity: &CSIdentity) -> Option<NonNull<CFString>>;
665    }
666    let ret = unsafe { CSIdentityGetPosixName(identity) };
667    ret.map(|ret| unsafe { CFRetained::retain(ret) })
668}
669
670#[deprecated = "renamed to `CSIdentity::email_address`"]
671#[inline]
672pub unsafe extern "C-unwind" fn CSIdentityGetEmailAddress(
673    identity: &CSIdentity,
674) -> Option<CFRetained<CFString>> {
675    extern "C-unwind" {
676        fn CSIdentityGetEmailAddress(identity: &CSIdentity) -> Option<NonNull<CFString>>;
677    }
678    let ret = unsafe { CSIdentityGetEmailAddress(identity) };
679    ret.map(|ret| unsafe { CFRetained::retain(ret) })
680}
681
682#[deprecated = "renamed to `CSIdentity::image_url`"]
683#[inline]
684pub unsafe extern "C-unwind" fn CSIdentityGetImageURL(
685    identity: &CSIdentity,
686) -> Option<CFRetained<CFURL>> {
687    extern "C-unwind" {
688        fn CSIdentityGetImageURL(identity: &CSIdentity) -> Option<NonNull<CFURL>>;
689    }
690    let ret = unsafe { CSIdentityGetImageURL(identity) };
691    ret.map(|ret| unsafe { CFRetained::retain(ret) })
692}
693
694#[deprecated = "renamed to `CSIdentity::image_data`"]
695#[inline]
696pub unsafe extern "C-unwind" fn CSIdentityGetImageData(
697    identity: &CSIdentity,
698) -> Option<CFRetained<CFData>> {
699    extern "C-unwind" {
700        fn CSIdentityGetImageData(identity: &CSIdentity) -> Option<NonNull<CFData>>;
701    }
702    let ret = unsafe { CSIdentityGetImageData(identity) };
703    ret.map(|ret| unsafe { CFRetained::retain(ret) })
704}
705
706#[deprecated = "renamed to `CSIdentity::image_data_type`"]
707#[inline]
708pub unsafe extern "C-unwind" fn CSIdentityGetImageDataType(
709    identity: &CSIdentity,
710) -> Option<CFRetained<CFString>> {
711    extern "C-unwind" {
712        fn CSIdentityGetImageDataType(identity: &CSIdentity) -> Option<NonNull<CFString>>;
713    }
714    let ret = unsafe { CSIdentityGetImageDataType(identity) };
715    ret.map(|ret| unsafe { CFRetained::retain(ret) })
716}
717
718#[deprecated = "renamed to `CSIdentity::aliases`"]
719#[inline]
720pub unsafe extern "C-unwind" fn CSIdentityGetAliases(
721    identity: &CSIdentity,
722) -> Option<CFRetained<CFArray>> {
723    extern "C-unwind" {
724        fn CSIdentityGetAliases(identity: &CSIdentity) -> Option<NonNull<CFArray>>;
725    }
726    let ret = unsafe { CSIdentityGetAliases(identity) };
727    ret.map(|ret| unsafe { CFRetained::retain(ret) })
728}
729
730#[deprecated = "renamed to `CSIdentity::is_member_of_group`"]
731#[inline]
732pub unsafe extern "C-unwind" fn CSIdentityIsMemberOfGroup(
733    identity: &CSIdentity,
734    group: Option<&CSIdentity>,
735) -> bool {
736    extern "C-unwind" {
737        fn CSIdentityIsMemberOfGroup(identity: &CSIdentity, group: Option<&CSIdentity>) -> Boolean;
738    }
739    let ret = unsafe { CSIdentityIsMemberOfGroup(identity, group) };
740    ret != 0
741}
742
743#[deprecated = "renamed to `CSIdentity::is_hidden`"]
744#[inline]
745pub unsafe extern "C-unwind" fn CSIdentityIsHidden(identity: &CSIdentity) -> bool {
746    extern "C-unwind" {
747        fn CSIdentityIsHidden(identity: &CSIdentity) -> Boolean;
748    }
749    let ret = unsafe { CSIdentityIsHidden(identity) };
750    ret != 0
751}
752
753#[deprecated = "renamed to `CSIdentity::new_persistent_reference`"]
754#[inline]
755pub unsafe extern "C-unwind" fn CSIdentityCreatePersistentReference(
756    allocator: Option<&CFAllocator>,
757    identity: Option<&CSIdentity>,
758) -> Option<CFRetained<CFData>> {
759    extern "C-unwind" {
760        fn CSIdentityCreatePersistentReference(
761            allocator: Option<&CFAllocator>,
762            identity: Option<&CSIdentity>,
763        ) -> Option<NonNull<CFData>>;
764    }
765    let ret = unsafe { CSIdentityCreatePersistentReference(allocator, identity) };
766    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
767}
768
769#[deprecated = "renamed to `CSIdentity::is_enabled`"]
770#[inline]
771pub unsafe extern "C-unwind" fn CSIdentityIsEnabled(user: &CSIdentity) -> bool {
772    extern "C-unwind" {
773        fn CSIdentityIsEnabled(user: &CSIdentity) -> Boolean;
774    }
775    let ret = unsafe { CSIdentityIsEnabled(user) };
776    ret != 0
777}
778
779#[deprecated = "renamed to `CSIdentity::authenticate_using_password`"]
780#[inline]
781pub unsafe extern "C-unwind" fn CSIdentityAuthenticateUsingPassword(
782    user: &CSIdentity,
783    password: Option<&CFString>,
784) -> bool {
785    extern "C-unwind" {
786        fn CSIdentityAuthenticateUsingPassword(
787            user: &CSIdentity,
788            password: Option<&CFString>,
789        ) -> Boolean;
790    }
791    let ret = unsafe { CSIdentityAuthenticateUsingPassword(user, password) };
792    ret != 0
793}
794
795#[cfg(feature = "objc2-security")]
796#[deprecated = "renamed to `CSIdentity::certificate`"]
797#[inline]
798pub unsafe extern "C-unwind" fn CSIdentityGetCertificate(
799    user: &CSIdentity,
800) -> Option<CFRetained<SecCertificate>> {
801    extern "C-unwind" {
802        fn CSIdentityGetCertificate(user: &CSIdentity) -> Option<NonNull<SecCertificate>>;
803    }
804    let ret = unsafe { CSIdentityGetCertificate(user) };
805    ret.map(|ret| unsafe { CFRetained::retain(ret) })
806}
807
808#[deprecated = "renamed to `CSIdentity::new_group_membership_query`"]
809#[inline]
810pub unsafe extern "C-unwind" fn CSIdentityCreateGroupMembershipQuery(
811    allocator: Option<&CFAllocator>,
812    group: Option<&CSIdentity>,
813) -> Option<CFRetained<CSIdentityQuery>> {
814    extern "C-unwind" {
815        fn CSIdentityCreateGroupMembershipQuery(
816            allocator: Option<&CFAllocator>,
817            group: Option<&CSIdentity>,
818        ) -> Option<NonNull<CSIdentityQuery>>;
819    }
820    let ret = unsafe { CSIdentityCreateGroupMembershipQuery(allocator, group) };
821    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
822}
823
824extern "C-unwind" {
825    #[deprecated = "renamed to `CSIdentity::set_full_name`"]
826    pub fn CSIdentitySetFullName(identity: &CSIdentity, full_name: Option<&CFString>);
827}
828
829extern "C-unwind" {
830    #[deprecated = "renamed to `CSIdentity::set_email_address`"]
831    pub fn CSIdentitySetEmailAddress(identity: &CSIdentity, email_address: Option<&CFString>);
832}
833
834extern "C-unwind" {
835    #[deprecated = "renamed to `CSIdentity::set_image_url`"]
836    pub fn CSIdentitySetImageURL(identity: &CSIdentity, url: Option<&CFURL>);
837}
838
839extern "C-unwind" {
840    #[deprecated = "renamed to `CSIdentity::set_image_data`"]
841    pub fn CSIdentitySetImageData(
842        identity: &CSIdentity,
843        image_data: Option<&CFData>,
844        image_data_type: Option<&CFString>,
845    );
846}
847
848extern "C-unwind" {
849    #[deprecated = "renamed to `CSIdentity::add_alias`"]
850    pub fn CSIdentityAddAlias(identity: &CSIdentity, alias: Option<&CFString>);
851}
852
853extern "C-unwind" {
854    #[deprecated = "renamed to `CSIdentity::remove_alias`"]
855    pub fn CSIdentityRemoveAlias(identity: &CSIdentity, alias: Option<&CFString>);
856}
857
858extern "C-unwind" {
859    #[deprecated = "renamed to `CSIdentity::add_member`"]
860    pub fn CSIdentityAddMember(group: &CSIdentity, member: Option<&CSIdentity>);
861}
862
863extern "C-unwind" {
864    #[deprecated = "renamed to `CSIdentity::remove_member`"]
865    pub fn CSIdentityRemoveMember(group: &CSIdentity, member: Option<&CSIdentity>);
866}
867
868#[deprecated = "renamed to `CSIdentity::set_is_enabled`"]
869#[inline]
870pub unsafe extern "C-unwind" fn CSIdentitySetIsEnabled(user: &CSIdentity, is_enabled: bool) {
871    extern "C-unwind" {
872        fn CSIdentitySetIsEnabled(user: &CSIdentity, is_enabled: Boolean);
873    }
874    unsafe { CSIdentitySetIsEnabled(user, is_enabled as _) }
875}
876
877extern "C-unwind" {
878    #[deprecated = "renamed to `CSIdentity::set_password`"]
879    pub fn CSIdentitySetPassword(user: &CSIdentity, password: Option<&CFString>);
880}
881
882extern "C-unwind" {
883    #[cfg(feature = "objc2-security")]
884    #[deprecated = "renamed to `CSIdentity::set_certificate`"]
885    pub fn CSIdentitySetCertificate(user: &CSIdentity, certificate: Option<&SecCertificate>);
886}
887
888extern "C-unwind" {
889    #[deprecated = "renamed to `CSIdentity::delete`"]
890    pub fn CSIdentityDelete(identity: &CSIdentity);
891}
892
893#[cfg(feature = "objc2-security")]
894#[deprecated = "renamed to `CSIdentity::commit`"]
895#[inline]
896pub unsafe extern "C-unwind" fn CSIdentityCommit(
897    identity: &CSIdentity,
898    authorization: AuthorizationRef,
899    error: *mut *mut CFError,
900) -> bool {
901    extern "C-unwind" {
902        fn CSIdentityCommit(
903            identity: &CSIdentity,
904            authorization: AuthorizationRef,
905            error: *mut *mut CFError,
906        ) -> Boolean;
907    }
908    let ret = unsafe { CSIdentityCommit(identity, authorization, error) };
909    ret != 0
910}
911
912#[cfg(feature = "objc2-security")]
913#[deprecated = "renamed to `CSIdentity::commit_asynchronously`"]
914#[inline]
915pub unsafe extern "C-unwind" fn CSIdentityCommitAsynchronously(
916    identity: &CSIdentity,
917    client_context: *const CSIdentityClientContext,
918    run_loop: Option<&CFRunLoop>,
919    run_loop_mode: Option<&CFString>,
920    authorization: AuthorizationRef,
921) -> bool {
922    extern "C-unwind" {
923        fn CSIdentityCommitAsynchronously(
924            identity: &CSIdentity,
925            client_context: *const CSIdentityClientContext,
926            run_loop: Option<&CFRunLoop>,
927            run_loop_mode: Option<&CFString>,
928            authorization: AuthorizationRef,
929        ) -> Boolean;
930    }
931    let ret = unsafe {
932        CSIdentityCommitAsynchronously(
933            identity,
934            client_context,
935            run_loop,
936            run_loop_mode,
937            authorization,
938        )
939    };
940    ret != 0
941}
942
943#[deprecated = "renamed to `CSIdentity::is_committing`"]
944#[inline]
945pub unsafe extern "C-unwind" fn CSIdentityIsCommitting(identity: &CSIdentity) -> bool {
946    extern "C-unwind" {
947        fn CSIdentityIsCommitting(identity: &CSIdentity) -> Boolean;
948    }
949    let ret = unsafe { CSIdentityIsCommitting(identity) };
950    ret != 0
951}
952
953extern "C-unwind" {
954    #[deprecated = "renamed to `CSIdentity::remove_client`"]
955    pub fn CSIdentityRemoveClient(identity: &CSIdentity);
956}