2 * Copyright (c) 2015-2016 Apple Inc. All Rights Reserved.
4 * @APPLE_LICENSE_HEADER_START@
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
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.
21 * @APPLE_LICENSE_HEADER_END@
28 #ifndef _sec_SOSRingTypes_
29 #define _sec_SOSRingTypes_
32 #include <CoreFoundation/CFRuntime.h>
33 #include <CoreFoundation/CoreFoundation.h>
34 #include "keychain/SecureObjectSync/SOSAccount.h"
35 #include "keychain/SecureObjectSync/SOSRingUtils.h"
37 typedef struct ringfuncs_t
{
40 SOSRingRef (*sosRingCreate
)(CFStringRef name
, CFStringRef myPeerID
, CFErrorRef
*error
);
41 bool (*sosRingResetToEmpty
)(SOSRingRef ring
, CFStringRef myPeerID
, CFErrorRef
*error
);
42 bool (*sosRingResetToOffering
)(SOSRingRef ring
, SecKeyRef user_privkey
, SOSFullPeerInfoRef requestor
, CFErrorRef
*error
);
43 SOSRingStatus (*sosRingDeviceIsInRing
)(SOSRingRef ring
, CFStringRef peerID
);
44 bool (*sosRingApply
)(SOSRingRef ring
, SecKeyRef user_pubkey
, SOSFullPeerInfoRef requestor
, CFErrorRef
*error
);
45 bool (*sosRingWithdraw
)(SOSRingRef ring
, SecKeyRef user_privkey
, SOSFullPeerInfoRef requestor
, CFErrorRef
*error
);
46 bool (*sosRingGenerationSign
)(SOSRingRef ring
, SecKeyRef user_privkey
, SOSFullPeerInfoRef requestor
, CFErrorRef
*error
);
47 bool (*sosRingConcordanceSign
)(SOSRingRef ring
, SOSFullPeerInfoRef requestor
, CFErrorRef
*error
);
48 SOSConcordanceStatus (*sosRingConcordanceTrust
)(SOSFullPeerInfoRef me
, CFSetRef peers
,
49 SOSRingRef knownRing
, SOSRingRef proposedRing
,
50 SecKeyRef knownPubkey
, SecKeyRef userPubkey
,
51 CFStringRef excludePeerID
, CFErrorRef
*error
);
52 bool (*sosRingAccept
)(SOSRingRef ring
, SecKeyRef user_privkey
, SOSFullPeerInfoRef requestor
, CFErrorRef
*error
);
53 bool (*sosRingReject
)(SOSRingRef ring
, SecKeyRef user_privkey
, SOSFullPeerInfoRef requestor
, CFErrorRef
*error
);
54 bool (*sosRingSetPayload
)(SOSRingRef ring
, SecKeyRef user_privkey
, CFDataRef payload
, SOSFullPeerInfoRef requestor
, CFErrorRef
*error
);
55 CFDataRef (*sosRingGetPayload
)(SOSRingRef ring
, CFErrorRef
*error
);
56 } ringFuncStruct
, *ringFuncs
;
58 static inline SOSRingRef
SOSRingCreate_ForType(CFStringRef name
, SOSRingType type
, CFStringRef myPeerID
, CFErrorRef
*error
) {
59 SOSRingRef retval
= NULL
;
60 retval
= SOSRingCreate_Internal(name
, type
, error
);
61 if(!retval
) return NULL
;
62 SOSRingSetLastModifier(retval
, myPeerID
);
66 #endif /* defined(_sec_SOSRingTypes_) */