]> git.saurik.com Git - apple/security.git/blob - OSX/sec/SOSCircle/SecureObjectSync/SOSManifest.h
Security-58286.270.3.0.1.tar.gz
[apple/security.git] / OSX / sec / SOSCircle / SecureObjectSync / SOSManifest.h
1 /*
2 * Copyright (c) 2013-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 /*!
26 @header SOSManifest.h
27 The functions provided in SOSTransport.h provide an interface to the
28 secure object syncing transport
29 */
30
31 #ifndef _SEC_SOSMANIFEST_H_
32 #define _SEC_SOSMANIFEST_H_
33
34 #include <corecrypto/ccsha1.h>
35 #include <CoreFoundation/CFData.h>
36 #include <CoreFoundation/CFError.h>
37
38 __BEGIN_DECLS
39
40 enum {
41 kSOSManifestUnsortedError = 1,
42 kSOSManifestCreateError = 2,
43 };
44
45 extern CFStringRef kSOSManifestErrorDomain;
46
47 /* SOSObject. */
48
49 /* Forward declarations of SOS types. */
50 typedef struct __OpaqueSOSManifest *SOSManifestRef;
51 struct SOSDigestVector;
52
53 /* SOSManifest. */
54 CFTypeID SOSManifestGetTypeID(void);
55
56 SOSManifestRef SOSManifestCreateWithBytes(const uint8_t *bytes, size_t len,
57 CFErrorRef *error);
58 SOSManifestRef SOSManifestCreateWithDigestVector(struct SOSDigestVector *dv, CFErrorRef *error);
59 SOSManifestRef SOSManifestCreateWithData(CFDataRef data, CFErrorRef *error);
60
61 size_t SOSManifestGetSize(SOSManifestRef m);
62
63 size_t SOSManifestGetCount(SOSManifestRef m);
64
65 const uint8_t *SOSManifestGetBytePtr(SOSManifestRef m);
66
67 CFDataRef SOSManifestGetData(SOSManifestRef m);
68
69 const struct SOSDigestVector *SOSManifestGetDigestVector(SOSManifestRef manifest);
70
71 bool SOSManifestDiff(SOSManifestRef a, SOSManifestRef b,
72 SOSManifestRef *a_minus_b, SOSManifestRef *b_minus_a,
73 CFErrorRef *error);
74
75 SOSManifestRef SOSManifestCreateWithPatch(SOSManifestRef base,
76 SOSManifestRef removals,
77 SOSManifestRef additions,
78 CFErrorRef *error);
79
80 // Returns the set of elements in B that are not in A.
81 // This is the relative complement of A in B (B\A), sometimes written B − A
82 SOSManifestRef SOSManifestCreateComplement(SOSManifestRef A,
83 SOSManifestRef B,
84 CFErrorRef *error);
85
86 SOSManifestRef SOSManifestCreateIntersection(SOSManifestRef m1,
87 SOSManifestRef m2,
88 CFErrorRef *error);
89
90
91 SOSManifestRef SOSManifestCreateUnion(SOSManifestRef m1,
92 SOSManifestRef m2,
93 CFErrorRef *error);
94
95 void SOSManifestForEach(SOSManifestRef m, void(^block)(CFDataRef e, bool *stop));
96
97 CFDataRef SOSManifestGetDigest(SOSManifestRef m, CFErrorRef *error);
98
99 __END_DECLS
100
101 #endif /* !_SEC_SOSMANIFEST_H_ */