]> git.saurik.com Git - apple/security.git/blobdiff - Security/sec/SOSCircle/SecureObjectSync/SOSTransportMessage.h
Security-57031.1.35.tar.gz
[apple/security.git] / Security / sec / SOSCircle / SecureObjectSync / SOSTransportMessage.h
diff --git a/Security/sec/SOSCircle/SecureObjectSync/SOSTransportMessage.h b/Security/sec/SOSCircle/SecureObjectSync/SOSTransportMessage.h
new file mode 100644 (file)
index 0000000..4535b51
--- /dev/null
@@ -0,0 +1,51 @@
+
+#ifndef SOSTransportMessage_h
+#define SOSTransportMessage_h
+
+#include <SecureObjectSync/SOSAccount.h>
+#include <CoreFoundation/CFRuntime.h>
+
+typedef struct __OpaqueSOSTransportMessage *SOSTransportMessageRef;
+
+struct __OpaqueSOSTransportMessage {
+    CFRuntimeBase   _base;
+    SOSEngineRef    engine;
+    SOSAccountRef   account;
+    
+    /* Connections from CF land to vtable land */
+    CFStringRef             (*copyDescription)(SOSTransportMessageRef object);
+    void                    (*destroy)(SOSTransportMessageRef object);
+    
+    /* send message operations */
+    bool                    (*syncWithPeers)(SOSTransportMessageRef transport, CFDictionaryRef circleToPeerIDs, CFErrorRef *error);
+    bool                    (*cleanupAfterPeerMessages)(SOSTransportMessageRef transport, CFDictionaryRef circleToPeerIDs, CFErrorRef* error);
+    bool                    (*sendMessages)(SOSTransportMessageRef transport, CFDictionaryRef circle_messages, CFErrorRef *error);
+    bool                    (*flushChanges)(SOSTransportMessageRef transport, CFErrorRef *error);
+    CFDictionaryRef         (*handleMessages)(SOSTransportMessageRef transport, CFMutableDictionaryRef circle_peer_messages_table, CFErrorRef *error);
+};
+
+SOSTransportMessageRef SOSTransportMessageCreateForSubclass(size_t size,SOSAccountRef account, CFStringRef circleName, CFErrorRef *error);
+bool SOSTransportMessageHandlePeerMessage(SOSTransportMessageRef transport, CFStringRef peer_id, CFDataRef codedMessage, CFErrorRef *error);
+
+typedef bool (^SOSTransportSendToPeerBlock)(SOSTransportMessageRef transport, CFStringRef peerID, CFDataRef message, SOSEnginePeerMessageSentBlock sentBlock);
+
+SOSEngineRef SOSTransportMessageGetEngine(SOSTransportMessageRef transport);
+
+SOSAccountRef SOSTransportMessageGetAccount(SOSTransportMessageRef transport);
+    
+bool SOSTransportMessageCleanupAfterPeerMessages(SOSTransportMessageRef transport, CFDictionaryRef circleToPeerIDs, CFErrorRef* error);
+
+bool SOSTransportMessageSendMessagesIfNeeded(SOSTransportMessageRef transport, CFStringRef circle_id, CFArrayRef handledPeers, CFErrorRef *error);
+
+bool SOSTransportMessageSendMessages(SOSTransportMessageRef transport, CFDictionaryRef circle_messages, CFErrorRef *error);
+bool SOSTransportMessageFlushChanges(SOSTransportMessageRef transport, CFErrorRef *error);
+
+
+SOSTransportMessageRef SOSTransportMessageCreateForSubclass(size_t size,
+                                                            SOSAccountRef account, CFStringRef circleName,
+                                                            CFErrorRef *error);
+CF_RETURNS_RETAINED
+CFDictionaryRef SOSTransportMessageHandleMessages(SOSTransportMessageRef transport, CFMutableDictionaryRef circle_peer_messages_table, CFErrorRef *error);
+
+
+#endif