5 // Created by Richard Murphy on 12/4/14.
9 #ifndef sec_SOSCirclePriv_h
10 #define sec_SOSCirclePriv_h
12 #include <CoreFoundation/CFRuntime.h>
13 #include <CoreFoundation/CoreFoundation.h>
14 #include <Security/SecureObjectSync/SOSGenCount.h>
17 kOnlyCompatibleVersion
= 1, // Sometime in the future this name will be improved to reflect history.
18 kAlwaysIncompatibleVersion
= UINT64_MAX
,
21 struct __OpaqueSOSCircle
{
24 SOSGenCountRef generation
;
25 CFMutableSetRef peers
;
26 CFMutableSetRef applicants
;
27 CFMutableSetRef rejected_applicants
;
28 CFMutableDictionaryRef signatures
;
32 static inline void SOSCircleAssertStable(SOSCircleRef circle
) {
35 assert(circle
->generation
);
36 assert(circle
->peers
);
37 assert(circle
->applicants
);
38 assert(circle
->rejected_applicants
);
39 assert(circle
->signatures
);
43 static inline SOSCircleRef
SOSCircleConvertAndAssertStable(CFTypeRef circleAsType
) {
44 if (CFGetTypeID(circleAsType
) != SOSCircleGetTypeID()) return NULL
;
45 SOSCircleRef circle
= (SOSCircleRef
) circleAsType
;
46 SOSCircleAssertStable(circle
);
51 static inline bool SOSCircleIsOffering(SOSCircleRef circle
) {
52 return SOSCircleCountRetiredPeers(circle
) == 0 && SOSCircleCountPeers(circle
) == 1;