2 #include <Security/SecureObjectSync/SOSAccount.h>
3 #include <Security/SecureObjectSync/SOSTransport.h>
4 #include <Security/SecureObjectSync/SOSTransportKeyParameter.h>
5 #include <Security/SecureObjectSync/SOSKVSKeys.h>
7 #include <utilities/SecCFWrappers.h>
8 #include <Security/SecureObjectSync/SOSAccountPriv.h>
9 #include <SOSCloudKeychainClient.h>
11 CFGiblisWithCompareFor(SOSTransportKeyParameter
);
13 SOSTransportKeyParameterRef
SOSTransportKeyParameterCreateForSubclass(size_t size
, SOSAccountRef account
, CFErrorRef
*error
)
15 SOSTransportKeyParameterRef tpt
= CFTypeAllocateWithSpace(SOSTransportKeyParameter
, size
, kCFAllocatorDefault
);
16 tpt
->account
= CFRetainSafe(account
);
20 bool SOSTransportKeyParameterHandleNewAccount(SOSTransportKeyParameterRef transport
, SOSAccountRef account
){
21 return transport
->setToNewAccount(transport
, account
);
24 static CFStringRef
SOSTransportKeyParameterCopyFormatDescription(CFTypeRef aObj
, CFDictionaryRef formatOptions
) {
25 SOSTransportKeyParameterRef t
= (SOSTransportKeyParameterRef
) aObj
;
27 return CFStringCreateWithFormat(NULL
, NULL
, CFSTR("<SOSTransportKeyParameter@%p\n>"), t
);
30 static void SOSTransportKeyParameterDestroy(CFTypeRef aObj
) {
31 SOSTransportKeyParameterRef transport
= (SOSTransportKeyParameterRef
) aObj
;
33 if(transport
->destroy
)
34 transport
->destroy(transport
);
36 CFReleaseNull(transport
->account
);
40 bool SOSTransportKeyParameterHandleKeyParameterChanges(SOSTransportKeyParameterRef transport
, CFDataRef data
, CFErrorRef error
){
41 return transport
->handleKeyParameterChanges(transport
, data
, error
);
45 static CFHashCode
SOSTransportKeyParameterHash(CFTypeRef obj
)
47 return (intptr_t) obj
;
50 static Boolean
SOSTransportKeyParameterCompare(CFTypeRef lhs
, CFTypeRef rhs
)
52 return SOSTransportKeyParameterHash(lhs
) == SOSTransportKeyParameterHash(rhs
);
56 bool SOSTransportKeyParameterPublishCloudParameters(SOSTransportKeyParameterRef transport
, CFDataRef data
, CFErrorRef
* error
) {
57 return transport
->publishCloudParameters(transport
, data
, error
);
60 SOSAccountRef
SOSTransportKeyParameterGetAccount(SOSTransportKeyParameterRef transport
){
61 return transport
->account
;
65 CFIndex
SOSTransportKeyParameterGetTransportType(SOSTransportKeyParameterRef transport
, CFErrorRef
*error
){
66 return transport
->getTransportType
? transport
->getTransportType(transport
, error
) : kUnknown
;