]> git.saurik.com Git - apple/security.git/blob - OSX/sec/SOSCircle/SecureObjectSync/SOSTransportMessage.h
Security-57336.10.29.tar.gz
[apple/security.git] / OSX / sec / SOSCircle / SecureObjectSync / SOSTransportMessage.h
1
2 #ifndef SOSTransportMessage_h
3 #define SOSTransportMessage_h
4
5 #include <Security/SecureObjectSync/SOSAccount.h>
6 #include <Security/SecureObjectSync/SOSEngine.h> // TODO: Remove when SOSEnginePeerMessageSentBlock moves to SOSPeer.h
7 #include <CoreFoundation/CFRuntime.h>
8
9 typedef struct __OpaqueSOSTransportMessage *SOSTransportMessageRef;
10
11
12 struct __OpaqueSOSTransportMessage {
13 CFRuntimeBase _base;
14 SOSEngineRef engine;
15 SOSAccountRef account;
16 CFStringRef circleName;
17 /* Connections from CF land to vtable land */
18 CFStringRef (*copyDescription)(SOSTransportMessageRef object);
19 void (*destroy)(SOSTransportMessageRef object);
20 CFStringRef (*getName)(SOSTransportMessageRef object);
21
22 /* send message operations */
23 bool (*syncWithPeers)(SOSTransportMessageRef transport, CFDictionaryRef circleToPeerIDs, CFErrorRef *error);
24 bool (*cleanupAfterPeerMessages)(SOSTransportMessageRef transport, CFDictionaryRef circleToPeerIDs, CFErrorRef* error);
25 bool (*sendMessages)(SOSTransportMessageRef transport, CFDictionaryRef circle_messages, CFErrorRef *error);
26 bool (*flushChanges)(SOSTransportMessageRef transport, CFErrorRef *error);
27 CFIndex (*getTransportType)(SOSTransportMessageRef transport, CFErrorRef *error);
28 CFDictionaryRef (*handleMessages)(SOSTransportMessageRef transport, CFMutableDictionaryRef circle_peer_messages_table, CFErrorRef *error);
29
30 };
31
32 CFStringRef SOSTransportMessageGetCircleName(SOSTransportMessageRef transport);
33
34 SOSTransportMessageRef SOSTransportMessageCreateForSubclass(size_t size,SOSAccountRef account, CFStringRef circleName, CFErrorRef *error);
35 bool SOSTransportMessageHandlePeerMessage(SOSTransportMessageRef transport, CFStringRef peer_id, CFDataRef codedMessage, CFErrorRef *error);
36
37 typedef bool (^SOSTransportSendToPeerBlock)(SOSTransportMessageRef transport, CFStringRef peerID, CFDataRef message, SOSEnginePeerMessageSentBlock sentBlock);
38
39 SOSEngineRef SOSTransportMessageGetEngine(SOSTransportMessageRef transport);
40
41 SOSAccountRef SOSTransportMessageGetAccount(SOSTransportMessageRef transport);
42
43 bool SOSTransportMessageCleanupAfterPeerMessages(SOSTransportMessageRef transport, CFDictionaryRef circleToPeerIDs, CFErrorRef* error);
44
45 bool SOSTransportMessageSendMessages(SOSTransportMessageRef transport, CFDictionaryRef circle_messages, CFErrorRef *error);
46 bool SOSTransportMessageFlushChanges(SOSTransportMessageRef transport, CFErrorRef *error);
47
48 bool SOSTransportMessageSyncWithPeers(SOSTransportMessageRef transport, CFDictionaryRef circleToPeerIDs, CFErrorRef *error);
49
50 SOSTransportMessageRef SOSTransportMessageCreateForSubclass(size_t size,
51 SOSAccountRef account, CFStringRef circleName,
52 CFErrorRef *error);
53 CF_RETURNS_RETAINED
54 CFDictionaryRef SOSTransportMessageHandleMessages(SOSTransportMessageRef transport, CFMutableDictionaryRef circle_peer_messages_table, CFErrorRef *error);
55
56 CFTypeID SOSTransportMessageGetTypeID(void);
57
58 CFIndex SOSTransportMessageGetTransportType(SOSTransportMessageRef transport, CFErrorRef *error);
59
60 #endif