]> git.saurik.com Git - apple/security.git/blob - OSX/sec/SOSCircle/SecureObjectSync/SOSCirclePriv.h
Security-57336.1.9.tar.gz
[apple/security.git] / OSX / sec / SOSCircle / SecureObjectSync / SOSCirclePriv.h
1 //
2 // SOSCirclePriv.h
3 // sec
4 //
5 // Created by Richard Murphy on 12/4/14.
6 //
7 //
8
9 #ifndef sec_SOSCirclePriv_h
10 #define sec_SOSCirclePriv_h
11
12 #include <CoreFoundation/CFRuntime.h>
13 #include <CoreFoundation/CoreFoundation.h>
14
15 enum {
16 kOnlyCompatibleVersion = 1, // Sometime in the future this name will be improved to reflect history.
17 kAlwaysIncompatibleVersion = UINT64_MAX,
18 };
19
20 struct __OpaqueSOSCircle {
21 CFRuntimeBase _base;
22 CFStringRef name;
23 CFNumberRef generation;
24 CFMutableSetRef peers;
25 CFMutableSetRef applicants;
26 CFMutableSetRef rejected_applicants;
27 CFMutableDictionaryRef signatures;
28 };
29
30
31 static inline void SOSCircleAssertStable(SOSCircleRef circle) {
32 assert(circle);
33 assert(circle->name);
34 assert(circle->generation);
35 assert(circle->peers);
36 assert(circle->applicants);
37 assert(circle->rejected_applicants);
38 assert(circle->signatures);
39 }
40
41
42 static inline SOSCircleRef SOSCircleConvertAndAssertStable(CFTypeRef circleAsType) {
43 if (CFGetTypeID(circleAsType) != SOSCircleGetTypeID()) return NULL;
44 SOSCircleRef circle = (SOSCircleRef) circleAsType;
45 SOSCircleAssertStable(circle);
46 return circle;
47 }
48
49 #endif