]> git.saurik.com Git - apple/security.git/blob - OSX/sec/SOSCircle/CloudKeychainProxy/CKDKVSProxy.h
Security-57336.10.29.tar.gz
[apple/security.git] / OSX / sec / SOSCircle / CloudKeychainProxy / CKDKVSProxy.h
1 /*
2 * Copyright (c) 2012-2014 Apple Inc. All Rights Reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24 //
25 // CKDKVSProxy.h
26 // ckd-xpc
27
28 #import <Foundation/Foundation.h>
29 #import <dispatch/queue.h>
30 #import <xpc/xpc.h>
31 #import <IDS/IDS.h>
32
33 #import <utilities/debugging.h>
34
35 #import "SOSCloudKeychainConstants.h"
36 #import "SOSCloudKeychainClient.h"
37
38 #define XPROXYSCOPE "proxy"
39
40 @interface UbiqitousKVSProxy : NSObject
41 {
42 id currentiCloudToken;
43 CloudItemsChangedBlock itemsChangedCallback;
44 int callbackMethod;
45 }
46
47 @property (retain, nonatomic) NSDictionary *keyParameterKeys;
48 @property (retain, nonatomic) NSDictionary *circleKeys;
49 @property (retain, nonatomic) NSDictionary *messageKeys;
50
51 @property (retain, nonatomic) NSMutableSet *alwaysKeys;
52 @property (retain, nonatomic) NSMutableSet *firstUnlockKeys;
53 @property (retain, nonatomic) NSMutableSet *unlockedKeys;
54 @property (retain, nonatomic) NSMutableSet *pendingKeys;
55 @property (retain, nonatomic) NSMutableSet *shadowPendingKeys;
56 @property (retain, nonatomic) NSString *dsid;
57
58 @property (atomic) bool syncWithPeersPending;
59 @property (atomic) bool shadowSyncWithPeersPending;
60 @property (atomic) bool inCallout;
61 @property (atomic) bool oldInCallout;
62 @property (atomic) bool unlockedSinceBoot;
63 @property (atomic) bool isLocked;
64 @property (atomic) bool seenKVSStoreChange;
65 @property (atomic) bool ensurePeerRegistration;
66 @property (atomic) bool shadowEnsurePeerRegistration;
67 @property (atomic) dispatch_time_t nextFreshnessTime;
68
69 @property (atomic) dispatch_source_t syncTimer;
70 @property (atomic) bool syncTimerScheduled;
71 @property (atomic) dispatch_time_t deadline;
72 @property (atomic) dispatch_time_t lastSyncTime;
73 @property (atomic) dispatch_queue_t calloutQueue;
74 @property (atomic) dispatch_queue_t freshParamsQueue;
75
76 + (UbiqitousKVSProxy *) sharedKVSProxy;
77 - (NSString *)description;
78 - (id)init;
79 - (void)streamEvent:(xpc_object_t)notification;
80 - (void)setItemsChangedBlock:(CloudItemsChangedBlock)itemsChangedBlock;
81
82 - (void)setObject:(id)obj forKey:(id)key;
83 - (id)get:(id)key;
84 - (NSDictionary *)getAll;
85 - (void)requestSynchronization:(bool)force;
86 - (void)waitForSynchronization:(NSArray *)keys handler:(void (^)(NSDictionary *values, NSError *err))handler;
87 - (void)clearStore;
88 - (void)setObjectsFromDictionary:(NSDictionary *)values;
89 - (void)removeObjectForKey:(NSString *)keyToRemove;
90 - (void)processAllItems;
91 - (void)requestSyncWithAllPeers;
92 - (void)requestEnsurePeerRegistration;
93
94 - (NSUbiquitousKeyValueStore *)cloudStore;
95
96 -(void)registerAtTimeKeys:(NSDictionary*)keyparms;
97
98 - (NSSet*) keysForCurrentLockState;
99 - (void) intersectWithCurrentLockState: (NSMutableSet*) set;
100
101 - (NSMutableSet*) pendKeysAndGetNewlyPended: (NSSet*) keysToPend;
102
103 - (NSMutableSet*) pendingKeysForCurrentLockState;
104 - (NSMutableSet*) pendKeysAndGetPendingForCurrentLockState: (NSSet*) startingSet;
105
106 - (void) processPendingKeysForCurrentLockState;
107
108 - (void)registerKeys: (NSDictionary*)keys;
109
110 - (NSDictionary *)localNotification:(NSDictionary *)localNotificationDict outFlags:(int64_t *)outFlags;
111
112 - (void)processKeyChangedEvent:(NSDictionary *)keysChangedInCloud;
113 - (NSMutableDictionary *)copyValues:(NSSet *)keysOfInterest;
114
115 - (void) doAfterFlush: (dispatch_block_t) block;
116 - (void) calloutWith: (void(^)(NSSet *pending, bool syncWithPeersPending, bool ensurePeerRegistration, dispatch_queue_t queue, void(^done)(NSSet *handledKeys, bool handledSyncWithPeers, bool handledEnsurePeerRegistration))) callout;
117 - (void) sendKeysCallout: (NSSet *(^)(NSSet* pending, NSError **error)) handleKeys;
118
119
120
121 @end