#import <Foundation/Foundation.h>
#import <dispatch/queue.h>
#import <xpc/xpc.h>
#import <IDS/IDS.h>
#import "SOSCloudKeychainClient.h"
#import <utilities/debugging.h>
#import <Security/SecureObjectSync/SOSInternal.h>
typedef enum {
kIDSStartPingTestMessage = 1,
kIDSEndPingTestMessage= 2,
kIDSSendOneMessage = 3,
kIDSPeerReceivedACK = 4,
kIDSPeerAvailability = 6,
kIDSPeerAvailabilityDone = 7,
kIDSKeychainSyncIDSFragmentation = 8,
} idsOperation;
@interface KeychainSyncingOverIDSProxy : NSObject <IDSServiceDelegate>
{
IDSService *_service;
NSString *deviceID;
NSMutableDictionary *deviceIDFromAuthToken;
}
@property (retain, nonatomic) NSMutableDictionary *deviceIDFromAuthToken;
@property (retain, nonatomic) NSString *deviceID;
@property (retain, nonatomic) NSMutableDictionary *shadowPendingMessages;
@property (retain, nonatomic) NSMutableDictionary *allFragmentedMessages;
@property (retain, atomic) NSMutableDictionary *pingTimers;
@property (retain, nonatomic) NSMutableDictionary *peerNextSendCache;
@property (retain, nonatomic) NSMutableDictionary *messagesInFlight;
@property (retain, nonatomic) NSMutableDictionary *unhandledMessageBuffer;
@property (retain, nonatomic) NSMutableDictionary *monitor;
@property (retain, nonatomic) NSArray* listOfDevices;
@property (atomic) dispatch_source_t penaltyTimer;
@property (atomic) bool penaltyTimerScheduled;
@property (retain, atomic) NSDictionary *queuedMessages;
@property (retain, atomic) NSMutableDictionary *counterValues;
@property (atomic) NSInteger outgoingMessages;
@property (atomic) NSInteger incomingMessages;
@property (atomic) bool isIDSInitDone;
@property (atomic) bool shadowDoInitializeIDSService;
@property (atomic) bool isSecDRunningAsRoot;
@property (atomic) bool doesSecDHavePeer;
@property (atomic) dispatch_queue_t calloutQueue;
@property (atomic) dispatch_queue_t pingQueue;
@property dispatch_queue_t dataQueue;
@property (atomic) bool isLocked;
@property (atomic) bool unlockedSinceBoot;
@property (atomic) dispatch_source_t retryTimer;
@property (atomic) bool retryTimerScheduled;
@property (atomic) bool inCallout;
@property (atomic) bool setIDSDeviceID;
@property (atomic) bool shadowDoSetIDSDeviceID;
@property (atomic) bool handleAllPendingMessages;
@property (atomic) bool shadowHandleAllPendingMessages;
@property (atomic) bool sendRestoredMessages;
+ (KeychainSyncingOverIDSProxy *) idsProxy;
- (id)init;
- (void) doSetIDSDeviceID;
- (void) doIDSInitialization;
- (void) calloutWith: (void(^)(NSMutableDictionary *pending,
bool handlePendingMesssages,
bool doSetDeviceID,
dispatch_queue_t queue,
void(^done)(NSMutableDictionary *handledMessages,
bool handledPendingMessage,
bool handledSettingDeviceID))) callout;
- (void) sendKeysCallout: (NSMutableDictionary *(^)(NSMutableDictionary* pending, NSError** error)) handleMessages;
- (void) persistState;
- (void) sendPersistedMessagesAgain;
- (NSDictionary*) retrievePendingMessages;
- (NSDictionary*) collectStats;
- (void) scheduleRetryRequestTimer;
- (BOOL) haveMessagesInFlight;
@end
NSString* createErrorString(NSString* format, ...)
NS_FORMAT_FUNCTION(1, 2);