]> git.saurik.com Git - apple/security.git/blobdiff - Security/sec/SOSCircle/SecureObjectSync/SOSTransportKeyParameter.c
Security-57031.1.35.tar.gz
[apple/security.git] / Security / sec / SOSCircle / SecureObjectSync / SOSTransportKeyParameter.c
diff --git a/Security/sec/SOSCircle/SecureObjectSync/SOSTransportKeyParameter.c b/Security/sec/SOSCircle/SecureObjectSync/SOSTransportKeyParameter.c
new file mode 100644 (file)
index 0000000..ece0dcd
--- /dev/null
@@ -0,0 +1,62 @@
+
+#include <SecureObjectSync/SOSAccount.h>
+#include <SecureObjectSync/SOSTransport.h>
+#include <SecureObjectSync/SOSTransportKeyParameter.h>
+#include <SecureObjectSync/SOSKVSKeys.h>
+
+#include <utilities/SecCFWrappers.h>
+#include <SecureObjectSync/SOSAccountPriv.h>
+#include <SOSCloudKeychainClient.h>
+
+CFGiblisWithCompareFor(SOSTransportKeyParameter);
+
+SOSTransportKeyParameterRef SOSTransportKeyParameterCreateForSubclass(size_t size, SOSAccountRef account, CFErrorRef *error)
+{
+    SOSTransportKeyParameterRef tpt = CFTypeAllocateWithSpace(SOSTransportKeyParameter, size, kCFAllocatorDefault);
+    tpt->account = CFRetainSafe(account);
+    return tpt;
+}
+
+bool SOSTransportKeyParameterHandleNewAccount(SOSTransportKeyParameterRef transport){
+    return transport->setToNewAccount(transport);
+}
+
+static CFStringRef SOSTransportKeyParameterCopyDescription(CFTypeRef aObj) {
+    SOSTransportKeyParameterRef t = (SOSTransportKeyParameterRef) aObj;
+    
+    return CFStringCreateWithFormat(NULL, NULL, CFSTR("<SOSTransportKeyParameter@%p\n>"), t);
+}
+
+static void SOSTransportKeyParameterDestroy(CFTypeRef aObj) {
+    SOSTransportKeyParameterRef transport = (SOSTransportKeyParameterRef) aObj;
+   
+    if(transport->destroy)
+        transport->destroy(transport);
+    
+    CFReleaseNull(transport->account);
+    
+}
+
+bool SOSTransportKeyParameterHandleKeyParameterChanges(SOSTransportKeyParameterRef transport, CFDataRef data, CFErrorRef error){
+    return transport->handleKeyParameterChanges(transport, data, error);
+}
+
+
+static CFHashCode SOSTransportKeyParameterHash(CFTypeRef obj)
+{
+    return (intptr_t) obj;
+}
+
+static Boolean SOSTransportKeyParameterCompare(CFTypeRef lhs, CFTypeRef rhs)
+{
+    return SOSTransportKeyParameterHash(lhs) == SOSTransportKeyParameterHash(rhs);
+}
+
+
+bool SOSTrasnportKeyParameterPublishCloudParameters(SOSTransportKeyParameterRef transport, CFDataRef data, CFErrorRef* error) {
+    return transport->publishCloudParameters(transport, data, error);
+}
+
+SOSAccountRef SOSTransportKeyParameterGetAccount(SOSTransportKeyParameterRef transport){
+    return transport->account;
+}