2 #ifndef SOSTransportMessage_h
3 #define SOSTransportMessage_h
5 #include <SecureObjectSync/SOSAccount.h>
6 #include <CoreFoundation/CFRuntime.h>
8 typedef struct __OpaqueSOSTransportMessage
*SOSTransportMessageRef
;
10 struct __OpaqueSOSTransportMessage
{
13 SOSAccountRef account
;
15 /* Connections from CF land to vtable land */
16 CFStringRef (*copyDescription
)(SOSTransportMessageRef object
);
17 void (*destroy
)(SOSTransportMessageRef object
);
19 /* send message operations */
20 bool (*syncWithPeers
)(SOSTransportMessageRef transport
, CFDictionaryRef circleToPeerIDs
, CFErrorRef
*error
);
21 bool (*cleanupAfterPeerMessages
)(SOSTransportMessageRef transport
, CFDictionaryRef circleToPeerIDs
, CFErrorRef
* error
);
22 bool (*sendMessages
)(SOSTransportMessageRef transport
, CFDictionaryRef circle_messages
, CFErrorRef
*error
);
23 bool (*flushChanges
)(SOSTransportMessageRef transport
, CFErrorRef
*error
);
24 CFDictionaryRef (*handleMessages
)(SOSTransportMessageRef transport
, CFMutableDictionaryRef circle_peer_messages_table
, CFErrorRef
*error
);
27 SOSTransportMessageRef
SOSTransportMessageCreateForSubclass(size_t size
,SOSAccountRef account
, CFStringRef circleName
, CFErrorRef
*error
);
28 bool SOSTransportMessageHandlePeerMessage(SOSTransportMessageRef transport
, CFStringRef peer_id
, CFDataRef codedMessage
, CFErrorRef
*error
);
30 typedef bool (^SOSTransportSendToPeerBlock
)(SOSTransportMessageRef transport
, CFStringRef peerID
, CFDataRef message
, SOSEnginePeerMessageSentBlock sentBlock
);
32 SOSEngineRef
SOSTransportMessageGetEngine(SOSTransportMessageRef transport
);
34 SOSAccountRef
SOSTransportMessageGetAccount(SOSTransportMessageRef transport
);
36 bool SOSTransportMessageCleanupAfterPeerMessages(SOSTransportMessageRef transport
, CFDictionaryRef circleToPeerIDs
, CFErrorRef
* error
);
38 bool SOSTransportMessageSendMessagesIfNeeded(SOSTransportMessageRef transport
, CFStringRef circle_id
, CFArrayRef handledPeers
, CFErrorRef
*error
);
40 bool SOSTransportMessageSendMessages(SOSTransportMessageRef transport
, CFDictionaryRef circle_messages
, CFErrorRef
*error
);
41 bool SOSTransportMessageFlushChanges(SOSTransportMessageRef transport
, CFErrorRef
*error
);
44 SOSTransportMessageRef
SOSTransportMessageCreateForSubclass(size_t size
,
45 SOSAccountRef account
, CFStringRef circleName
,
48 CFDictionaryRef
SOSTransportMessageHandleMessages(SOSTransportMessageRef transport
, CFMutableDictionaryRef circle_peer_messages_table
, CFErrorRef
*error
);