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::Block<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::Block<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
62unsafe impl NSObjectProtocol for NSXPCConnection {}
63
64unsafe impl NSXPCProxyCreating for NSXPCConnection {}
65
66impl NSXPCConnection {
67 extern_methods!(
68 #[cfg(feature = "NSString")]
69 #[unsafe(method(initWithServiceName:))]
70 #[unsafe(method_family = init)]
71 pub unsafe fn initWithServiceName(
72 this: Allocated<Self>,
73 service_name: &NSString,
74 ) -> Retained<Self>;
75
76 #[cfg(feature = "NSString")]
77 #[unsafe(method(serviceName))]
78 #[unsafe(method_family = none)]
79 pub unsafe fn serviceName(&self) -> Option<Retained<NSString>>;
80
81 #[cfg(feature = "NSString")]
82 #[unsafe(method(initWithMachServiceName:options:))]
83 #[unsafe(method_family = init)]
84 pub unsafe fn initWithMachServiceName_options(
85 this: Allocated<Self>,
86 name: &NSString,
87 options: NSXPCConnectionOptions,
88 ) -> Retained<Self>;
89
90 #[unsafe(method(initWithListenerEndpoint:))]
91 #[unsafe(method_family = init)]
92 pub unsafe fn initWithListenerEndpoint(
93 this: Allocated<Self>,
94 endpoint: &NSXPCListenerEndpoint,
95 ) -> Retained<Self>;
96
97 #[unsafe(method(endpoint))]
98 #[unsafe(method_family = none)]
99 pub unsafe fn endpoint(&self) -> Retained<NSXPCListenerEndpoint>;
100
101 #[unsafe(method(exportedInterface))]
102 #[unsafe(method_family = none)]
103 pub unsafe fn exportedInterface(&self) -> Option<Retained<NSXPCInterface>>;
104
105 #[unsafe(method(setExportedInterface:))]
107 #[unsafe(method_family = none)]
108 pub unsafe fn setExportedInterface(&self, exported_interface: Option<&NSXPCInterface>);
109
110 #[unsafe(method(exportedObject))]
111 #[unsafe(method_family = none)]
112 pub unsafe fn exportedObject(&self) -> Option<Retained<AnyObject>>;
113
114 #[unsafe(method(setExportedObject:))]
116 #[unsafe(method_family = none)]
117 pub unsafe fn setExportedObject(&self, exported_object: Option<&AnyObject>);
118
119 #[unsafe(method(remoteObjectInterface))]
120 #[unsafe(method_family = none)]
121 pub unsafe fn remoteObjectInterface(&self) -> Option<Retained<NSXPCInterface>>;
122
123 #[unsafe(method(setRemoteObjectInterface:))]
125 #[unsafe(method_family = none)]
126 pub unsafe fn setRemoteObjectInterface(
127 &self,
128 remote_object_interface: Option<&NSXPCInterface>,
129 );
130
131 #[unsafe(method(remoteObjectProxy))]
132 #[unsafe(method_family = none)]
133 pub unsafe fn remoteObjectProxy(&self) -> Retained<AnyObject>;
134
135 #[cfg(all(feature = "NSError", feature = "block2"))]
136 #[unsafe(method(remoteObjectProxyWithErrorHandler:))]
137 #[unsafe(method_family = none)]
138 pub unsafe fn remoteObjectProxyWithErrorHandler(
139 &self,
140 handler: &block2::Block<dyn Fn(NonNull<NSError>)>,
141 ) -> Retained<AnyObject>;
142
143 #[cfg(all(feature = "NSError", feature = "block2"))]
144 #[unsafe(method(synchronousRemoteObjectProxyWithErrorHandler:))]
145 #[unsafe(method_family = none)]
146 pub unsafe fn synchronousRemoteObjectProxyWithErrorHandler(
147 &self,
148 handler: &block2::Block<dyn Fn(NonNull<NSError>)>,
149 ) -> Retained<AnyObject>;
150
151 #[cfg(feature = "block2")]
152 #[unsafe(method(interruptionHandler))]
153 #[unsafe(method_family = none)]
154 pub unsafe fn interruptionHandler(&self) -> *mut block2::Block<dyn Fn()>;
155
156 #[cfg(feature = "block2")]
157 #[unsafe(method(setInterruptionHandler:))]
159 #[unsafe(method_family = none)]
160 pub unsafe fn setInterruptionHandler(
161 &self,
162 interruption_handler: Option<&block2::Block<dyn Fn()>>,
163 );
164
165 #[cfg(feature = "block2")]
166 #[unsafe(method(invalidationHandler))]
167 #[unsafe(method_family = none)]
168 pub unsafe fn invalidationHandler(&self) -> *mut block2::Block<dyn Fn()>;
169
170 #[cfg(feature = "block2")]
171 #[unsafe(method(setInvalidationHandler:))]
173 #[unsafe(method_family = none)]
174 pub unsafe fn setInvalidationHandler(
175 &self,
176 invalidation_handler: Option<&block2::Block<dyn Fn()>>,
177 );
178
179 #[unsafe(method(resume))]
180 #[unsafe(method_family = none)]
181 pub unsafe fn resume(&self);
182
183 #[unsafe(method(suspend))]
184 #[unsafe(method_family = none)]
185 pub unsafe fn suspend(&self);
186
187 #[unsafe(method(activate))]
188 #[unsafe(method_family = none)]
189 pub unsafe fn activate(&self);
190
191 #[unsafe(method(invalidate))]
192 #[unsafe(method_family = none)]
193 pub unsafe fn invalidate(&self);
194
195 #[cfg(feature = "libc")]
196 #[unsafe(method(processIdentifier))]
197 #[unsafe(method_family = none)]
198 pub unsafe fn processIdentifier(&self) -> libc::pid_t;
199
200 #[cfg(feature = "libc")]
201 #[unsafe(method(effectiveUserIdentifier))]
202 #[unsafe(method_family = none)]
203 pub unsafe fn effectiveUserIdentifier(&self) -> libc::uid_t;
204
205 #[cfg(feature = "libc")]
206 #[unsafe(method(effectiveGroupIdentifier))]
207 #[unsafe(method_family = none)]
208 pub unsafe fn effectiveGroupIdentifier(&self) -> libc::gid_t;
209
210 #[unsafe(method(currentConnection))]
211 #[unsafe(method_family = none)]
212 pub unsafe fn currentConnection() -> Option<Retained<NSXPCConnection>>;
213
214 #[cfg(feature = "block2")]
215 #[unsafe(method(scheduleSendBarrierBlock:))]
216 #[unsafe(method_family = none)]
217 pub unsafe fn scheduleSendBarrierBlock(&self, block: &block2::Block<dyn Fn()>);
218
219 #[cfg(feature = "NSString")]
220 #[unsafe(method(setCodeSigningRequirement:))]
223 #[unsafe(method_family = none)]
224 pub unsafe fn setCodeSigningRequirement(&self, requirement: &NSString);
225 );
226}
227
228impl NSXPCConnection {
230 extern_methods!(
231 #[unsafe(method(init))]
232 #[unsafe(method_family = init)]
233 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
234
235 #[unsafe(method(new))]
236 #[unsafe(method_family = new)]
237 pub unsafe fn new() -> Retained<Self>;
238 );
239}
240
241extern_class!(
242 #[unsafe(super(NSObject))]
244 #[derive(Debug, PartialEq, Eq, Hash)]
245 pub struct NSXPCListener;
246);
247
248unsafe impl NSObjectProtocol for NSXPCListener {}
249
250impl NSXPCListener {
251 extern_methods!(
252 #[unsafe(method(serviceListener))]
253 #[unsafe(method_family = none)]
254 pub unsafe fn serviceListener() -> Retained<NSXPCListener>;
255
256 #[unsafe(method(anonymousListener))]
257 #[unsafe(method_family = none)]
258 pub unsafe fn anonymousListener() -> Retained<NSXPCListener>;
259
260 #[cfg(feature = "NSString")]
261 #[unsafe(method(initWithMachServiceName:))]
262 #[unsafe(method_family = init)]
263 pub unsafe fn initWithMachServiceName(
264 this: Allocated<Self>,
265 name: &NSString,
266 ) -> Retained<Self>;
267
268 #[unsafe(method(delegate))]
269 #[unsafe(method_family = none)]
270 pub unsafe fn delegate(
271 &self,
272 ) -> Option<Retained<ProtocolObject<dyn NSXPCListenerDelegate>>>;
273
274 #[unsafe(method(setDelegate:))]
277 #[unsafe(method_family = none)]
278 pub unsafe fn setDelegate(
279 &self,
280 delegate: Option<&ProtocolObject<dyn NSXPCListenerDelegate>>,
281 );
282
283 #[unsafe(method(endpoint))]
284 #[unsafe(method_family = none)]
285 pub unsafe fn endpoint(&self) -> Retained<NSXPCListenerEndpoint>;
286
287 #[unsafe(method(resume))]
288 #[unsafe(method_family = none)]
289 pub unsafe fn resume(&self);
290
291 #[unsafe(method(suspend))]
292 #[unsafe(method_family = none)]
293 pub unsafe fn suspend(&self);
294
295 #[unsafe(method(activate))]
296 #[unsafe(method_family = none)]
297 pub unsafe fn activate(&self);
298
299 #[unsafe(method(invalidate))]
300 #[unsafe(method_family = none)]
301 pub unsafe fn invalidate(&self);
302
303 #[cfg(feature = "NSString")]
304 #[unsafe(method(setConnectionCodeSigningRequirement:))]
308 #[unsafe(method_family = none)]
309 pub unsafe fn setConnectionCodeSigningRequirement(&self, requirement: &NSString);
310 );
311}
312
313impl NSXPCListener {
315 extern_methods!(
316 #[unsafe(method(init))]
317 #[unsafe(method_family = init)]
318 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
319
320 #[unsafe(method(new))]
321 #[unsafe(method_family = new)]
322 pub unsafe fn new() -> Retained<Self>;
323 );
324}
325
326extern_protocol!(
327 pub unsafe trait NSXPCListenerDelegate: NSObjectProtocol {
329 #[optional]
330 #[unsafe(method(listener:shouldAcceptNewConnection:))]
331 #[unsafe(method_family = none)]
332 unsafe fn listener_shouldAcceptNewConnection(
333 &self,
334 listener: &NSXPCListener,
335 new_connection: &NSXPCConnection,
336 ) -> bool;
337 }
338);
339
340extern_class!(
341 #[unsafe(super(NSObject))]
343 #[derive(Debug, PartialEq, Eq, Hash)]
344 pub struct NSXPCInterface;
345);
346
347unsafe impl NSObjectProtocol for NSXPCInterface {}
348
349impl NSXPCInterface {
350 extern_methods!(
351 #[unsafe(method(interfaceWithProtocol:))]
352 #[unsafe(method_family = none)]
353 pub unsafe fn interfaceWithProtocol(protocol: &AnyProtocol) -> Retained<NSXPCInterface>;
354
355 #[unsafe(method(protocol))]
356 #[unsafe(method_family = none)]
357 pub unsafe fn protocol(&self) -> Retained<AnyProtocol>;
358
359 #[unsafe(method(setProtocol:))]
361 #[unsafe(method_family = none)]
362 pub unsafe fn setProtocol(&self, protocol: &AnyProtocol);
363
364 #[cfg(feature = "NSSet")]
365 #[unsafe(method(setClasses:forSelector:argumentIndex:ofReply:))]
366 #[unsafe(method_family = none)]
367 pub unsafe fn setClasses_forSelector_argumentIndex_ofReply(
368 &self,
369 classes: &NSSet<AnyClass>,
370 sel: Sel,
371 arg: NSUInteger,
372 of_reply: bool,
373 );
374
375 #[cfg(feature = "NSSet")]
376 #[unsafe(method(classesForSelector:argumentIndex:ofReply:))]
377 #[unsafe(method_family = none)]
378 pub unsafe fn classesForSelector_argumentIndex_ofReply(
379 &self,
380 sel: Sel,
381 arg: NSUInteger,
382 of_reply: bool,
383 ) -> Retained<NSSet<AnyClass>>;
384
385 #[unsafe(method(setInterface:forSelector:argumentIndex:ofReply:))]
386 #[unsafe(method_family = none)]
387 pub unsafe fn setInterface_forSelector_argumentIndex_ofReply(
388 &self,
389 ifc: &NSXPCInterface,
390 sel: Sel,
391 arg: NSUInteger,
392 of_reply: bool,
393 );
394
395 #[unsafe(method(interfaceForSelector:argumentIndex:ofReply:))]
396 #[unsafe(method_family = none)]
397 pub unsafe fn interfaceForSelector_argumentIndex_ofReply(
398 &self,
399 sel: Sel,
400 arg: NSUInteger,
401 of_reply: bool,
402 ) -> Option<Retained<NSXPCInterface>>;
403 );
404}
405
406impl NSXPCInterface {
408 extern_methods!(
409 #[unsafe(method(init))]
410 #[unsafe(method_family = init)]
411 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
412
413 #[unsafe(method(new))]
414 #[unsafe(method_family = new)]
415 pub unsafe fn new() -> Retained<Self>;
416 );
417}
418
419extern_class!(
420 #[unsafe(super(NSObject))]
422 #[derive(Debug, PartialEq, Eq, Hash)]
423 pub struct NSXPCListenerEndpoint;
424);
425
426unsafe impl Send for NSXPCListenerEndpoint {}
427
428unsafe impl Sync for NSXPCListenerEndpoint {}
429
430#[cfg(feature = "NSObject")]
431unsafe impl NSCoding for NSXPCListenerEndpoint {}
432
433unsafe impl NSObjectProtocol for NSXPCListenerEndpoint {}
434
435#[cfg(feature = "NSObject")]
436unsafe impl NSSecureCoding for NSXPCListenerEndpoint {}
437
438impl NSXPCListenerEndpoint {
439 extern_methods!();
440}
441
442impl NSXPCListenerEndpoint {
444 extern_methods!(
445 #[unsafe(method(init))]
446 #[unsafe(method_family = init)]
447 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
448
449 #[unsafe(method(new))]
450 #[unsafe(method_family = new)]
451 pub unsafe fn new() -> Retained<Self>;
452 );
453}
454
455extern_class!(
456 #[unsafe(super(NSCoder, NSObject))]
458 #[derive(Debug, PartialEq, Eq, Hash)]
459 #[cfg(feature = "NSCoder")]
460 pub struct NSXPCCoder;
461);
462
463#[cfg(feature = "NSCoder")]
464unsafe impl NSObjectProtocol for NSXPCCoder {}
465
466#[cfg(feature = "NSCoder")]
467impl NSXPCCoder {
468 extern_methods!(
469 #[unsafe(method(userInfo))]
470 #[unsafe(method_family = none)]
471 pub unsafe fn userInfo(&self) -> Option<Retained<ProtocolObject<dyn NSObjectProtocol>>>;
472
473 #[unsafe(method(setUserInfo:))]
475 #[unsafe(method_family = none)]
476 pub unsafe fn setUserInfo(&self, user_info: Option<&ProtocolObject<dyn NSObjectProtocol>>);
477
478 #[unsafe(method(connection))]
479 #[unsafe(method_family = none)]
480 pub unsafe fn connection(&self) -> Option<Retained<NSXPCConnection>>;
481 );
482}
483
484#[cfg(feature = "NSCoder")]
486impl NSXPCCoder {
487 extern_methods!(
488 #[unsafe(method(init))]
489 #[unsafe(method_family = init)]
490 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
491
492 #[unsafe(method(new))]
493 #[unsafe(method_family = new)]
494 pub unsafe fn new() -> Retained<Self>;
495 );
496}