]>
Commit | Line | Data |
---|---|---|
d8f41ccd | 1 | |
5c19dc3a A |
2 | #include <Security/SecureObjectSync/SOSAccount.h> |
3 | #include <Security/SecureObjectSync/SOSTransport.h> | |
4 | #include <Security/SecureObjectSync/SOSTransportKeyParameter.h> | |
5 | #include <Security/SecureObjectSync/SOSKVSKeys.h> | |
d8f41ccd A |
6 | |
7 | #include <utilities/SecCFWrappers.h> | |
5c19dc3a | 8 | #include <Security/SecureObjectSync/SOSAccountPriv.h> |
d8f41ccd A |
9 | #include <SOSCloudKeychainClient.h> |
10 | ||
11 | CFGiblisWithCompareFor(SOSTransportKeyParameter); | |
12 | ||
13 | SOSTransportKeyParameterRef SOSTransportKeyParameterCreateForSubclass(size_t size, SOSAccountRef account, CFErrorRef *error) | |
14 | { | |
15 | SOSTransportKeyParameterRef tpt = CFTypeAllocateWithSpace(SOSTransportKeyParameter, size, kCFAllocatorDefault); | |
16 | tpt->account = CFRetainSafe(account); | |
17 | return tpt; | |
18 | } | |
19 | ||
5c19dc3a A |
20 | bool SOSTransportKeyParameterHandleNewAccount(SOSTransportKeyParameterRef transport, SOSAccountRef account){ |
21 | return transport->setToNewAccount(transport, account); | |
d8f41ccd A |
22 | } |
23 | ||
d87e1158 | 24 | static CFStringRef SOSTransportKeyParameterCopyFormatDescription(CFTypeRef aObj, CFDictionaryRef formatOptions) { |
d8f41ccd A |
25 | SOSTransportKeyParameterRef t = (SOSTransportKeyParameterRef) aObj; |
26 | ||
27 | return CFStringCreateWithFormat(NULL, NULL, CFSTR("<SOSTransportKeyParameter@%p\n>"), t); | |
28 | } | |
29 | ||
30 | static void SOSTransportKeyParameterDestroy(CFTypeRef aObj) { | |
31 | SOSTransportKeyParameterRef transport = (SOSTransportKeyParameterRef) aObj; | |
32 | ||
33 | if(transport->destroy) | |
34 | transport->destroy(transport); | |
35 | ||
36 | CFReleaseNull(transport->account); | |
37 | ||
38 | } | |
39 | ||
40 | bool SOSTransportKeyParameterHandleKeyParameterChanges(SOSTransportKeyParameterRef transport, CFDataRef data, CFErrorRef error){ | |
41 | return transport->handleKeyParameterChanges(transport, data, error); | |
42 | } | |
43 | ||
44 | ||
45 | static CFHashCode SOSTransportKeyParameterHash(CFTypeRef obj) | |
46 | { | |
47 | return (intptr_t) obj; | |
48 | } | |
49 | ||
50 | static Boolean SOSTransportKeyParameterCompare(CFTypeRef lhs, CFTypeRef rhs) | |
51 | { | |
52 | return SOSTransportKeyParameterHash(lhs) == SOSTransportKeyParameterHash(rhs); | |
53 | } | |
54 | ||
55 | ||
5c19dc3a | 56 | bool SOSTransportKeyParameterPublishCloudParameters(SOSTransportKeyParameterRef transport, CFDataRef data, CFErrorRef* error) { |
d8f41ccd A |
57 | return transport->publishCloudParameters(transport, data, error); |
58 | } | |
59 | ||
60 | SOSAccountRef SOSTransportKeyParameterGetAccount(SOSTransportKeyParameterRef transport){ | |
61 | return transport->account; | |
62 | } | |
5c19dc3a A |
63 | |
64 | ||
65 | CFIndex SOSTransportKeyParameterGetTransportType(SOSTransportKeyParameterRef transport, CFErrorRef *error){ | |
66 | return transport->getTransportType ? transport->getTransportType(transport, error) : kUnknown; | |
67 | } |