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