objc2_foundation/generated/
NSXPCConnection.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9extern_protocol!(
10 pub unsafe trait NSXPCProxyCreating {
12 #[unsafe(method(remoteObjectProxy))]
13 #[unsafe(method_family = none)]
14 unsafe fn remoteObjectProxy(&self) -> Retained<AnyObject>;
15
16 #[cfg(all(feature = "NSError", feature = "block2"))]
17 #[unsafe(method(remoteObjectProxyWithErrorHandler:))]
18 #[unsafe(method_family = none)]
19 unsafe fn remoteObjectProxyWithErrorHandler(
20 &self,
21 handler: &block2::DynBlock<dyn Fn(NonNull<NSError>)>,
22 ) -> Retained<AnyObject>;
23
24 #[cfg(all(feature = "NSError", feature = "block2"))]
25 #[optional]
26 #[unsafe(method(synchronousRemoteObjectProxyWithErrorHandler:))]
27 #[unsafe(method_family = none)]
28 unsafe fn synchronousRemoteObjectProxyWithErrorHandler(
29 &self,
30 handler: &block2::DynBlock<dyn Fn(NonNull<NSError>)>,
31 ) -> Retained<AnyObject>;
32 }
33);
34
35#[repr(transparent)]
38#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
39pub struct NSXPCConnectionOptions(pub NSUInteger);
40bitflags::bitflags! {
41 impl NSXPCConnectionOptions: NSUInteger {
42 #[doc(alias = "NSXPCConnectionPrivileged")]
43 const Privileged = 1<<12;
44 }
45}
46
47unsafe impl Encode for NSXPCConnectionOptions {
48 const ENCODING: Encoding = NSUInteger::ENCODING;
49}
50
51unsafe impl RefEncode for NSXPCConnectionOptions {
52 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
53}
54
55extern_class!(
56 #[unsafe(super(NSObject))]
58 #[derive(Debug, PartialEq, Eq, Hash)]
59 pub struct NSXPCConnection;
60);
61
62extern_conformance!(
63 unsafe impl NSObjectProtocol for NSXPCConnection {}
64);
65
66extern_conformance!(
67 unsafe impl NSXPCProxyCreating for NSXPCConnection {}
68);
69
70impl NSXPCConnection {
71 extern_methods!(
72 #[cfg(feature = "NSString")]
73 #[unsafe(method(initWithServiceName:))]
74 #[unsafe(method_family = init)]
75 pub unsafe fn initWithServiceName(
76 this: Allocated<Self>,
77 service_name: &NSString,
78 ) -> Retained<Self>;
79
80 #[cfg(feature = "NSString")]
81 #[unsafe(method(serviceName))]
82 #[unsafe(method_family = none)]
83 pub unsafe fn serviceName(&self) -> Option<Retained<NSString>>;
84
85 #[cfg(feature = "NSString")]
86 #[unsafe(method(initWithMachServiceName:options:))]
87 #[unsafe(method_family = init)]
88 pub unsafe fn initWithMachServiceName_options(
89 this: Allocated<Self>,
90 name: &NSString,
91 options: NSXPCConnectionOptions,
92 ) -> Retained<Self>;
93
94 #[unsafe(method(initWithListenerEndpoint:))]
95 #[unsafe(method_family = init)]
96 pub unsafe fn initWithListenerEndpoint(
97 this: Allocated<Self>,
98 endpoint: &NSXPCListenerEndpoint,
99 ) -> Retained<Self>;
100
101 #[unsafe(method(endpoint))]
102 #[unsafe(method_family = none)]
103 pub unsafe fn endpoint(&self) -> Retained<NSXPCListenerEndpoint>;
104
105 #[unsafe(method(exportedInterface))]
106 #[unsafe(method_family = none)]
107 pub unsafe fn exportedInterface(&self) -> Option<Retained<NSXPCInterface>>;
108
109 #[unsafe(method(setExportedInterface:))]
111 #[unsafe(method_family = none)]
112 pub unsafe fn setExportedInterface(&self, exported_interface: Option<&NSXPCInterface>);
113
114 #[unsafe(method(exportedObject))]
115 #[unsafe(method_family = none)]
116 pub unsafe fn exportedObject(&self) -> Option<Retained<AnyObject>>;
117
118 #[unsafe(method(setExportedObject:))]
120 #[unsafe(method_family = none)]
121 pub unsafe fn setExportedObject(&self, exported_object: Option<&AnyObject>);
122
123 #[unsafe(method(remoteObjectInterface))]
124 #[unsafe(method_family = none)]
125 pub unsafe fn remoteObjectInterface(&self) -> Option<Retained<NSXPCInterface>>;
126
127 #[unsafe(method(setRemoteObjectInterface:))]
129 #[unsafe(method_family = none)]
130 pub unsafe fn setRemoteObjectInterface(
131 &self,
132 remote_object_interface: Option<&NSXPCInterface>,
133 );
134
135 #[unsafe(method(remoteObjectProxy))]
136 #[unsafe(method_family = none)]
137 pub unsafe fn remoteObjectProxy(&self) -> Retained<AnyObject>;
138
139 #[cfg(all(feature = "NSError", feature = "block2"))]
140 #[unsafe(method(remoteObjectProxyWithErrorHandler:))]
141 #[unsafe(method_family = none)]
142 pub unsafe fn remoteObjectProxyWithErrorHandler(
143 &self,
144 handler: &block2::DynBlock<dyn Fn(NonNull<NSError>)>,
145 ) -> Retained<AnyObject>;
146
147 #[cfg(all(feature = "NSError", feature = "block2"))]
148 #[unsafe(method(synchronousRemoteObjectProxyWithErrorHandler:))]
149 #[unsafe(method_family = none)]
150 pub unsafe fn synchronousRemoteObjectProxyWithErrorHandler(
151 &self,
152 handler: &block2::DynBlock<dyn Fn(NonNull<NSError>)>,
153 ) -> Retained<AnyObject>;
154
155 #[cfg(feature = "block2")]
156 #[unsafe(method(interruptionHandler))]
157 #[unsafe(method_family = none)]
158 pub unsafe fn interruptionHandler(&self) -> *mut block2::DynBlock<dyn Fn()>;
159
160 #[cfg(feature = "block2")]
161 #[unsafe(method(setInterruptionHandler:))]
163 #[unsafe(method_family = none)]
164 pub unsafe fn setInterruptionHandler(
165 &self,
166 interruption_handler: Option<&block2::DynBlock<dyn Fn()>>,
167 );
168
169 #[cfg(feature = "block2")]
170 #[unsafe(method(invalidationHandler))]
171 #[unsafe(method_family = none)]
172 pub unsafe fn invalidationHandler(&self) -> *mut block2::DynBlock<dyn Fn()>;
173
174 #[cfg(feature = "block2")]
175 #[unsafe(method(setInvalidationHandler:))]
177 #[unsafe(method_family = none)]
178 pub unsafe fn setInvalidationHandler(
179 &self,
180 invalidation_handler: Option<&block2::DynBlock<dyn Fn()>>,
181 );
182
183 #[unsafe(method(resume))]
184 #[unsafe(method_family = none)]
185 pub unsafe fn resume(&self);
186
187 #[unsafe(method(suspend))]
188 #[unsafe(method_family = none)]
189 pub unsafe fn suspend(&self);
190
191 #[unsafe(method(activate))]
192 #[unsafe(method_family = none)]
193 pub unsafe fn activate(&self);
194
195 #[unsafe(method(invalidate))]
196 #[unsafe(method_family = none)]
197 pub unsafe fn invalidate(&self);
198
199 #[cfg(feature = "libc")]
200 #[unsafe(method(processIdentifier))]
201 #[unsafe(method_family = none)]
202 pub unsafe fn processIdentifier(&self) -> libc::pid_t;
203
204 #[cfg(feature = "libc")]
205 #[unsafe(method(effectiveUserIdentifier))]
206 #[unsafe(method_family = none)]
207 pub unsafe fn effectiveUserIdentifier(&self) -> libc::uid_t;
208
209 #[cfg(feature = "libc")]
210 #[unsafe(method(effectiveGroupIdentifier))]
211 #[unsafe(method_family = none)]
212 pub unsafe fn effectiveGroupIdentifier(&self) -> libc::gid_t;
213
214 #[unsafe(method(currentConnection))]
215 #[unsafe(method_family = none)]
216 pub unsafe fn currentConnection() -> Option<Retained<NSXPCConnection>>;
217
218 #[cfg(feature = "block2")]
219 #[unsafe(method(scheduleSendBarrierBlock:))]
220 #[unsafe(method_family = none)]
221 pub unsafe fn scheduleSendBarrierBlock(&self, block: &block2::DynBlock<dyn Fn()>);
222
223 #[cfg(feature = "NSString")]
224 #[unsafe(method(setCodeSigningRequirement:))]
227 #[unsafe(method_family = none)]
228 pub unsafe fn setCodeSigningRequirement(&self, requirement: &NSString);
229 );
230}
231
232impl NSXPCConnection {
234 extern_methods!(
235 #[unsafe(method(init))]
236 #[unsafe(method_family = init)]
237 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
238
239 #[unsafe(method(new))]
240 #[unsafe(method_family = new)]
241 pub unsafe fn new() -> Retained<Self>;
242 );
243}
244
245extern_class!(
246 #[unsafe(super(NSObject))]
248 #[derive(Debug, PartialEq, Eq, Hash)]
249 pub struct NSXPCListener;
250);
251
252extern_conformance!(
253 unsafe impl NSObjectProtocol for NSXPCListener {}
254);
255
256impl NSXPCListener {
257 extern_methods!(
258 #[unsafe(method(serviceListener))]
259 #[unsafe(method_family = none)]
260 pub unsafe fn serviceListener() -> Retained<NSXPCListener>;
261
262 #[unsafe(method(anonymousListener))]
263 #[unsafe(method_family = none)]
264 pub unsafe fn anonymousListener() -> Retained<NSXPCListener>;
265
266 #[cfg(feature = "NSString")]
267 #[unsafe(method(initWithMachServiceName:))]
268 #[unsafe(method_family = init)]
269 pub unsafe fn initWithMachServiceName(
270 this: Allocated<Self>,
271 name: &NSString,
272 ) -> Retained<Self>;
273
274 #[unsafe(method(delegate))]
275 #[unsafe(method_family = none)]
276 pub unsafe fn delegate(
277 &self,
278 ) -> Option<Retained<ProtocolObject<dyn NSXPCListenerDelegate>>>;
279
280 #[unsafe(method(setDelegate:))]
283 #[unsafe(method_family = none)]
284 pub unsafe fn setDelegate(
285 &self,
286 delegate: Option<&ProtocolObject<dyn NSXPCListenerDelegate>>,
287 );
288
289 #[unsafe(method(endpoint))]
290 #[unsafe(method_family = none)]
291 pub unsafe fn endpoint(&self) -> Retained<NSXPCListenerEndpoint>;
292
293 #[unsafe(method(resume))]
294 #[unsafe(method_family = none)]
295 pub unsafe fn resume(&self);
296
297 #[unsafe(method(suspend))]
298 #[unsafe(method_family = none)]
299 pub unsafe fn suspend(&self);
300
301 #[unsafe(method(activate))]
302 #[unsafe(method_family = none)]
303 pub unsafe fn activate(&self);
304
305 #[unsafe(method(invalidate))]
306 #[unsafe(method_family = none)]
307 pub unsafe fn invalidate(&self);
308
309 #[cfg(feature = "NSString")]
310 #[unsafe(method(setConnectionCodeSigningRequirement:))]
314 #[unsafe(method_family = none)]
315 pub unsafe fn setConnectionCodeSigningRequirement(&self, requirement: &NSString);
316 );
317}
318
319impl NSXPCListener {
321 extern_methods!(
322 #[unsafe(method(init))]
323 #[unsafe(method_family = init)]
324 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
325
326 #[unsafe(method(new))]
327 #[unsafe(method_family = new)]
328 pub unsafe fn new() -> Retained<Self>;
329 );
330}
331
332extern_protocol!(
333 pub unsafe trait NSXPCListenerDelegate: NSObjectProtocol {
335 #[optional]
336 #[unsafe(method(listener:shouldAcceptNewConnection:))]
337 #[unsafe(method_family = none)]
338 unsafe fn listener_shouldAcceptNewConnection(
339 &self,
340 listener: &NSXPCListener,
341 new_connection: &NSXPCConnection,
342 ) -> bool;
343 }
344);
345
346extern_class!(
347 #[unsafe(super(NSObject))]
349 #[derive(Debug, PartialEq, Eq, Hash)]
350 pub struct NSXPCInterface;
351);
352
353extern_conformance!(
354 unsafe impl NSObjectProtocol for NSXPCInterface {}
355);
356
357impl NSXPCInterface {
358 extern_methods!(
359 #[unsafe(method(interfaceWithProtocol:))]
360 #[unsafe(method_family = none)]
361 pub unsafe fn interfaceWithProtocol(protocol: &AnyProtocol) -> Retained<NSXPCInterface>;
362
363 #[unsafe(method(protocol))]
364 #[unsafe(method_family = none)]
365 pub unsafe fn protocol(&self) -> Retained<AnyProtocol>;
366
367 #[unsafe(method(setProtocol:))]
369 #[unsafe(method_family = none)]
370 pub unsafe fn setProtocol(&self, protocol: &AnyProtocol);
371
372 #[cfg(feature = "NSSet")]
373 #[unsafe(method(setClasses:forSelector:argumentIndex:ofReply:))]
374 #[unsafe(method_family = none)]
375 pub unsafe fn setClasses_forSelector_argumentIndex_ofReply(
376 &self,
377 classes: &NSSet<AnyClass>,
378 sel: Sel,
379 arg: NSUInteger,
380 of_reply: bool,
381 );
382
383 #[cfg(feature = "NSSet")]
384 #[unsafe(method(classesForSelector:argumentIndex:ofReply:))]
385 #[unsafe(method_family = none)]
386 pub unsafe fn classesForSelector_argumentIndex_ofReply(
387 &self,
388 sel: Sel,
389 arg: NSUInteger,
390 of_reply: bool,
391 ) -> Retained<NSSet<AnyClass>>;
392
393 #[unsafe(method(setInterface:forSelector:argumentIndex:ofReply:))]
394 #[unsafe(method_family = none)]
395 pub unsafe fn setInterface_forSelector_argumentIndex_ofReply(
396 &self,
397 ifc: &NSXPCInterface,
398 sel: Sel,
399 arg: NSUInteger,
400 of_reply: bool,
401 );
402
403 #[unsafe(method(interfaceForSelector:argumentIndex:ofReply:))]
404 #[unsafe(method_family = none)]
405 pub unsafe fn interfaceForSelector_argumentIndex_ofReply(
406 &self,
407 sel: Sel,
408 arg: NSUInteger,
409 of_reply: bool,
410 ) -> Option<Retained<NSXPCInterface>>;
411 );
412}
413
414impl NSXPCInterface {
416 extern_methods!(
417 #[unsafe(method(init))]
418 #[unsafe(method_family = init)]
419 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
420
421 #[unsafe(method(new))]
422 #[unsafe(method_family = new)]
423 pub unsafe fn new() -> Retained<Self>;
424 );
425}
426
427extern_class!(
428 #[unsafe(super(NSObject))]
430 #[derive(Debug, PartialEq, Eq, Hash)]
431 pub struct NSXPCListenerEndpoint;
432);
433
434unsafe impl Send for NSXPCListenerEndpoint {}
435
436unsafe impl Sync for NSXPCListenerEndpoint {}
437
438#[cfg(feature = "NSObject")]
439extern_conformance!(
440 unsafe impl NSCoding for NSXPCListenerEndpoint {}
441);
442
443extern_conformance!(
444 unsafe impl NSObjectProtocol for NSXPCListenerEndpoint {}
445);
446
447#[cfg(feature = "NSObject")]
448extern_conformance!(
449 unsafe impl NSSecureCoding for NSXPCListenerEndpoint {}
450);
451
452impl NSXPCListenerEndpoint {
453 extern_methods!();
454}
455
456impl NSXPCListenerEndpoint {
458 extern_methods!(
459 #[unsafe(method(init))]
460 #[unsafe(method_family = init)]
461 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
462
463 #[unsafe(method(new))]
464 #[unsafe(method_family = new)]
465 pub unsafe fn new() -> Retained<Self>;
466 );
467}
468
469extern_class!(
470 #[unsafe(super(NSCoder, NSObject))]
472 #[derive(Debug, PartialEq, Eq, Hash)]
473 #[cfg(feature = "NSCoder")]
474 pub struct NSXPCCoder;
475);
476
477#[cfg(feature = "NSCoder")]
478extern_conformance!(
479 unsafe impl NSObjectProtocol for NSXPCCoder {}
480);
481
482#[cfg(feature = "NSCoder")]
483impl NSXPCCoder {
484 extern_methods!(
485 #[unsafe(method(userInfo))]
486 #[unsafe(method_family = none)]
487 pub unsafe fn userInfo(&self) -> Option<Retained<ProtocolObject<dyn NSObjectProtocol>>>;
488
489 #[unsafe(method(setUserInfo:))]
491 #[unsafe(method_family = none)]
492 pub unsafe fn setUserInfo(&self, user_info: Option<&ProtocolObject<dyn NSObjectProtocol>>);
493
494 #[unsafe(method(connection))]
495 #[unsafe(method_family = none)]
496 pub unsafe fn connection(&self) -> Option<Retained<NSXPCConnection>>;
497 );
498}
499
500#[cfg(feature = "NSCoder")]
502impl NSXPCCoder {
503 extern_methods!(
504 #[unsafe(method(init))]
505 #[unsafe(method_family = init)]
506 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
507
508 #[unsafe(method(new))]
509 #[unsafe(method_family = new)]
510 pub unsafe fn new() -> Retained<Self>;
511 );
512}