]> git.saurik.com Git - apple/security.git/blob - Security/sec/securityd/SOSCloudCircleServer.h
Security-57031.1.35.tar.gz
[apple/security.git] / Security / sec / securityd / SOSCloudCircleServer.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 #ifndef _SECURITY_SOSCLOUDCIRCLESERVER_H_
26 #define _SECURITY_SOSCLOUDCIRCLESERVER_H_
27
28 #include <SecureObjectSync/SOSCloudCircle.h>
29 #include <SecureObjectSync/SOSAccount.h>
30
31
32 __BEGIN_DECLS
33
34 //
35 // MARK: Server versions of our SPI
36 //
37 bool SOSCCTryUserCredentials_Server(CFStringRef user_label, CFDataRef user_password, CFErrorRef *error);
38 bool SOSCCSetUserCredentials_Server(CFStringRef user_label, CFDataRef user_password, CFErrorRef *error);
39 bool SOSCCCanAuthenticate_Server(CFErrorRef *error);
40 bool SOSCCPurgeUserCredentials_Server(CFErrorRef *error);
41
42 SOSCCStatus SOSCCThisDeviceIsInCircle_Server(CFErrorRef *error);
43 bool SOSCCRequestToJoinCircle_Server(CFErrorRef* error);
44 bool SOSCCRequestToJoinCircleAfterRestore_Server(CFErrorRef* error);
45 CFStringRef SOSCCRequestDeviceID_Server(CFErrorRef *error);
46 bool SOSCCSetDeviceID_Server(CFStringRef IDS, CFErrorRef *error);
47 bool SOSCCRemoveThisDeviceFromCircle_Server(CFErrorRef* error);
48 bool SOSCCBailFromCircle_Server(uint64_t limit_in_seconds, CFErrorRef* error);
49 bool SOSCCRequestEnsureFreshParameters_Server(CFErrorRef* error);
50
51 CFArrayRef SOSCCCopyGenerationPeerInfo_Server(CFErrorRef* error);
52 CFArrayRef SOSCCCopyApplicantPeerInfo_Server(CFErrorRef* error);
53 CFArrayRef SOSCCCopyValidPeerPeerInfo_Server(CFErrorRef* error);
54 bool SOSCCValidateUserPublic_Server(CFErrorRef* error);
55
56 CFArrayRef SOSCCCopyNotValidPeerPeerInfo_Server(CFErrorRef* error);
57 CFArrayRef SOSCCCopyRetirementPeerInfo_Server(CFErrorRef* error);
58 bool SOSCCRejectApplicants_Server(CFArrayRef applicants, CFErrorRef* error);
59 bool SOSCCAcceptApplicants_Server(CFArrayRef applicants, CFErrorRef* error);
60
61 CFArrayRef SOSCCCopyPeerPeerInfo_Server(CFErrorRef* error);
62 CFArrayRef SOSCCCopyConcurringPeerPeerInfo_Server(CFErrorRef* error);
63
64 bool SOSCCResetToOffering_Server(CFErrorRef* error);
65 bool SOSCCResetToEmpty_Server(CFErrorRef* error);
66
67 CFStringRef SOSCCCopyIncompatibilityInfo_Server(CFErrorRef* error);
68 enum DepartureReason SOSCCGetLastDepartureReason_Server(CFErrorRef* error);
69
70 bool SOSCCProcessEnsurePeerRegistration_Server(CFErrorRef* error);
71 SyncWithAllPeersReason SOSCCProcessSyncWithAllPeers_Server(CFErrorRef* error);
72
73 //
74 // MARK: Internal kicks.
75 //
76 CF_RETURNS_RETAINED CFArrayRef SOSCCHandleUpdateKeyParameter(CFDictionaryRef updates);
77 CF_RETURNS_RETAINED CFArrayRef SOSCCHandleUpdateCircle(CFDictionaryRef updates);
78 CF_RETURNS_RETAINED CFArrayRef SOSCCHandleUpdateMessage(CFDictionaryRef updates);
79
80
81 // Expected to be called when the data source changes.
82 void SOSCCSyncWithAllPeers(void);
83 void SOSCCAddSyncablePeerBlock(CFStringRef ds_name, SOSAccountSyncablePeersBlock changeBlock);
84 dispatch_queue_t SOSCCGetAccountQueue(void);
85
86
87 // Internal careful questioning.
88 bool SOSCCThisDeviceDefinitelyNotActiveInCircle(void);
89 void SOSCCSetThisDeviceDefinitelyNotActiveInCircle(SOSCCStatus currentStatus);
90
91 //
92 // MARK: Internal access to local account for tests.
93 //
94 typedef SOSDataSourceFactoryRef (^SOSCCAccountDataSourceFactoryBlock)();
95
96 SOSAccountRef SOSKeychainAccountGetSharedAccount(void);
97 bool SOSKeychainAccountSetFactoryForAccount(SOSCCAccountDataSourceFactoryBlock factory);
98
99 //
100 // MARK: Testing operations, dangerous to call in normal operation.
101 //
102 bool SOSKeychainSaveAccountDataAndPurge(CFErrorRef *error);
103
104
105 //
106 // MARK: Constants for where we store persistent information in the keychain
107 //
108
109 extern CFStringRef kSOSInternalAccessGroup;
110
111 extern CFStringRef kSOSAccountLabel;
112 extern CFStringRef kSOSPeerDataLabel;
113
114 CFDataRef SOSItemCopy(CFStringRef label, CFErrorRef* error);
115 bool SOSItemUpdateOrAdd(CFStringRef label, CFStringRef accessibility, CFDataRef data, CFErrorRef *error);
116
117 bool SOSCCCircleIsOn_Artifact(void);
118
119 __END_DECLS
120
121 #endif