1 // Copyright (c) 2018 Apple Inc. All rights reserved.
3 #import "OctagonTestHarnessXPCService.h"
5 #import <objc/runtime.h>
6 #import <Security/CKKSControlProtocol.h>
7 #import <Security/SecAccessControlPriv.h>
8 #import "SecDbKeychainItem.h"
9 #import "SecRemoteDevice.h"
12 @interface OctagonTestHarnessXPCService ()
13 @property (strong) SecRemoteDevice *remoteDevice;
16 #pragma clang diagnostic push
17 #pragma clang diagnostic ignored "-Wprotocol"
19 @implementation OctagonTestHarnessXPCService
21 - (instancetype)init {
22 if ((self = [super init]) != NULL) {
23 self.remoteDevice = [SecRemoteDevice new];
24 if (self.remoteDevice == nil) {
31 - (void)octagonReset:(NSString *)altDSID complete:(void (^)(NSNumber *, NSError *))complete {
34 OTControl* rpc = [OTControl controlObject:true error:&error];
41 [rpc resetAndEstablish:NULL context:OTDefaultContext altDSID:altDSID reply:^(NSError * _Nullable e) {
42 complete([NSNumber numberWithBool:e != NULL], e);
46 /* Oh, ObjC, you are my friend */
47 - (void)forwardInvocation:(NSInvocation *)invocation {
48 struct objc_method_description desc = protocol_getMethodDescription(@protocol(SecRemoteDeviceProtocol), [invocation selector], true, true);
49 if (desc.name == NULL) {
50 [super forwardInvocation:invocation];
52 [invocation invokeWithTarget:self.remoteDevice];
58 #pragma clang diagnostic pop