@@ -43,6 +43,21 @@ @implementation MTRDeviceController_XPC
43
43
44
44
@synthesize uniqueIdentifier = _uniqueIdentifier;
45
45
46
+ - (NSXPCInterface *)_interfaceForServerProtocol
47
+ {
48
+ NSXPCInterface * interface = [NSXPCInterface interfaceWithProtocol: @protocol (MTRXPCServerProtocol)];
49
+
50
+ NSSet * allowedClasses = [NSSet setWithArray: @[
51
+ [NSString class ], [NSNumber class ], [NSData class ], [NSArray class ], [NSDictionary class ], [NSError class ], [MTRCommandPath class ], [MTRAttributePath class ]
52
+ ]];
53
+
54
+ [interface setClasses: allowedClasses
55
+ forSelector: @selector (deviceController:nodeID:invokeCommandWithEndpointID:clusterID:commandID:commandFields:expectedValues:expectedValueInterval:timedInvokeTimeout:completion: )
56
+ argumentIndex: 0
57
+ ofReply: YES ];
58
+ return interface;
59
+ }
60
+
46
61
- (NSXPCInterface *)_interfaceForClientProtocol
47
62
{
48
63
NSXPCInterface * interface = [NSXPCInterface interfaceWithProtocol: @protocol (MTRXPCClientProtocol)];
@@ -84,7 +99,7 @@ - (id)initWithUniqueIdentifier:(NSUUID *)UUID xpConnectionBlock:(NSXPCConnection
84
99
85
100
MTR_LOG (" Set up XPC Connection: %@" , self.xpcConnection );
86
101
if (self.xpcConnection ) {
87
- self.xpcConnection .remoteObjectInterface = [NSXPCInterface interfaceWithProtocol: @protocol (MTRXPCServerProtocol) ];
102
+ self.xpcConnection .remoteObjectInterface = [self _interfaceForServerProtocol ];
88
103
89
104
self.xpcConnection .exportedInterface = [self _interfaceForClientProtocol ];
90
105
self.xpcConnection .exportedObject = self;
@@ -118,9 +133,9 @@ - (id)initWithUniqueIdentifier:(NSUUID *)UUID machServiceName:(NSString *)machSe
118
133
119
134
MTR_LOG (" Set up XPC Connection: %@" , self.xpcConnection );
120
135
if (self.xpcConnection ) {
121
- self.xpcConnection .remoteObjectInterface = [NSXPCInterface interfaceWithProtocol: @protocol (MTRXPCServerProtocol) ];
136
+ self.xpcConnection .remoteObjectInterface = [self _interfaceForServerProtocol ];
122
137
123
- self.xpcConnection .exportedInterface = [NSXPCInterface interfaceWithProtocol: @protocol (MTRXPCClientProtocol) ];
138
+ self.xpcConnection .exportedInterface = [self _interfaceForClientProtocol ];
124
139
self.xpcConnection .exportedObject = self;
125
140
126
141
MTR_LOG (" %s: resuming new XPC connection" );
0 commit comments