2 #ifndef SOSTransportMessage_h
3 #define SOSTransportMessage_h
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>
9 typedef struct __OpaqueSOSTransportMessage
*SOSTransportMessageRef
;
12 struct __OpaqueSOSTransportMessage
{
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
);
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
);
32 CFStringRef
SOSTransportMessageGetCircleName(SOSTransportMessageRef transport
);
34 SOSTransportMessageRef
SOSTransportMessageCreateForSubclass(size_t size
,SOSAccountRef account
, CFStringRef circleName
, CFErrorRef
*error
);
35 bool SOSTransportMessageHandlePeerMessage(SOSTransportMessageRef transport
, CFStringRef peer_id
, CFDataRef codedMessage
, CFErrorRef
*error
);
37 typedef bool (^SOSTransportSendToPeerBlock
)(SOSTransportMessageRef transport
, CFStringRef peerID
, CFDataRef message
, SOSEnginePeerMessageSentBlock sentBlock
);
39 SOSEngineRef
SOSTransportMessageGetEngine(SOSTransportMessageRef transport
);
41 SOSAccountRef
SOSTransportMessageGetAccount(SOSTransportMessageRef transport
);
43 bool SOSTransportMessageCleanupAfterPeerMessages(SOSTransportMessageRef transport
, CFDictionaryRef circleToPeerIDs
, CFErrorRef
* error
);
45 bool SOSTransportMessageSendMessages(SOSTransportMessageRef transport
, CFDictionaryRef circle_messages
, CFErrorRef
*error
);
46 bool SOSTransportMessageFlushChanges(SOSTransportMessageRef transport
, CFErrorRef
*error
);
48 bool SOSTransportMessageSyncWithPeers(SOSTransportMessageRef transport
, CFDictionaryRef circleToPeerIDs
, CFErrorRef
*error
);
50 SOSTransportMessageRef
SOSTransportMessageCreateForSubclass(size_t size
,
51 SOSAccountRef account
, CFStringRef circleName
,
54 CFDictionaryRef
SOSTransportMessageHandleMessages(SOSTransportMessageRef transport
, CFMutableDictionaryRef circle_peer_messages_table
, CFErrorRef
*error
);
56 CFTypeID
SOSTransportMessageGetTypeID(void);
58 CFIndex
SOSTransportMessageGetTransportType(SOSTransportMessageRef transport
, CFErrorRef
*error
);