]> git.saurik.com Git - apple/security.git/blobdiff - OSX/sec/ProjectHeaders/Security/SecureObjectSync/SOSCirclePriv.h
Security-57336.1.9.tar.gz
[apple/security.git] / OSX / sec / ProjectHeaders / Security / SecureObjectSync / SOSCirclePriv.h
diff --git a/OSX/sec/ProjectHeaders/Security/SecureObjectSync/SOSCirclePriv.h b/OSX/sec/ProjectHeaders/Security/SecureObjectSync/SOSCirclePriv.h
new file mode 100644 (file)
index 0000000..2f36e36
--- /dev/null
@@ -0,0 +1,49 @@
+//
+//  SOSCirclePriv.h
+//  sec
+//
+//  Created by Richard Murphy on 12/4/14.
+//
+//
+
+#ifndef sec_SOSCirclePriv_h
+#define sec_SOSCirclePriv_h
+
+#include <CoreFoundation/CFRuntime.h>
+#include <CoreFoundation/CoreFoundation.h>
+
+enum {
+    kOnlyCompatibleVersion = 1, // Sometime in the future this name will be improved to reflect history.
+    kAlwaysIncompatibleVersion = UINT64_MAX,
+};
+
+struct __OpaqueSOSCircle {
+    CFRuntimeBase _base;
+    CFStringRef name;
+    CFNumberRef generation;
+    CFMutableSetRef peers;
+    CFMutableSetRef applicants;
+    CFMutableSetRef rejected_applicants;
+    CFMutableDictionaryRef signatures;
+};
+
+
+static inline void SOSCircleAssertStable(SOSCircleRef circle) {
+    assert(circle);
+    assert(circle->name);
+    assert(circle->generation);
+    assert(circle->peers);
+    assert(circle->applicants);
+    assert(circle->rejected_applicants);
+    assert(circle->signatures);
+}
+
+
+static inline SOSCircleRef SOSCircleConvertAndAssertStable(CFTypeRef circleAsType) {
+    if (CFGetTypeID(circleAsType) != SOSCircleGetTypeID()) return NULL;
+    SOSCircleRef circle = (SOSCircleRef) circleAsType;
+    SOSCircleAssertStable(circle);
+    return circle;
+}
+
+#endif