objc2_foundation/generated/
NSConnection.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9extern_class!(
10 #[unsafe(super(NSObject))]
12 #[derive(Debug, PartialEq, Eq, Hash)]
13 #[deprecated = "Use NSXPCConnection instead"]
14 pub struct NSConnection;
15);
16
17unsafe impl NSObjectProtocol for NSConnection {}
18
19impl NSConnection {
20 extern_methods!(
21 #[cfg(all(feature = "NSDictionary", feature = "NSString", feature = "NSValue"))]
22 #[deprecated = "Use NSXPCConnection instead"]
23 #[unsafe(method(statistics))]
24 #[unsafe(method_family = none)]
25 pub unsafe fn statistics(&self) -> Retained<NSDictionary<NSString, NSNumber>>;
26
27 #[cfg(feature = "NSArray")]
28 #[deprecated = "Use NSXPCConnection instead"]
29 #[unsafe(method(allConnections))]
30 #[unsafe(method_family = none)]
31 pub unsafe fn allConnections() -> Retained<NSArray<NSConnection>>;
32
33 #[deprecated]
34 #[unsafe(method(defaultConnection))]
35 #[unsafe(method_family = none)]
36 pub unsafe fn defaultConnection() -> Retained<NSConnection>;
37
38 #[cfg(feature = "NSString")]
39 #[deprecated = "Use NSXPCConnection instead"]
40 #[unsafe(method(connectionWithRegisteredName:host:))]
41 #[unsafe(method_family = none)]
42 pub unsafe fn connectionWithRegisteredName_host(
43 name: &NSString,
44 host_name: Option<&NSString>,
45 ) -> Option<Retained<Self>>;
46
47 #[cfg(all(feature = "NSPortNameServer", feature = "NSString"))]
48 #[deprecated = "Use NSXPCConnection instead"]
49 #[unsafe(method(connectionWithRegisteredName:host:usingNameServer:))]
50 #[unsafe(method_family = none)]
51 pub unsafe fn connectionWithRegisteredName_host_usingNameServer(
52 name: &NSString,
53 host_name: Option<&NSString>,
54 server: &NSPortNameServer,
55 ) -> Option<Retained<Self>>;
56
57 #[cfg(all(feature = "NSDistantObject", feature = "NSProxy", feature = "NSString"))]
58 #[deprecated = "Use NSXPCConnection instead"]
59 #[unsafe(method(rootProxyForConnectionWithRegisteredName:host:))]
60 #[unsafe(method_family = none)]
61 pub unsafe fn rootProxyForConnectionWithRegisteredName_host(
62 name: &NSString,
63 host_name: Option<&NSString>,
64 ) -> Option<Retained<NSDistantObject>>;
65
66 #[cfg(all(
67 feature = "NSDistantObject",
68 feature = "NSPortNameServer",
69 feature = "NSProxy",
70 feature = "NSString"
71 ))]
72 #[deprecated = "Use NSXPCConnection instead"]
73 #[unsafe(method(rootProxyForConnectionWithRegisteredName:host:usingNameServer:))]
74 #[unsafe(method_family = none)]
75 pub unsafe fn rootProxyForConnectionWithRegisteredName_host_usingNameServer(
76 name: &NSString,
77 host_name: Option<&NSString>,
78 server: &NSPortNameServer,
79 ) -> Option<Retained<NSDistantObject>>;
80
81 #[cfg(all(feature = "NSPortNameServer", feature = "NSString"))]
82 #[unsafe(method(serviceConnectionWithName:rootObject:usingNameServer:))]
83 #[unsafe(method_family = none)]
84 pub unsafe fn serviceConnectionWithName_rootObject_usingNameServer(
85 name: &NSString,
86 root: &AnyObject,
87 server: &NSPortNameServer,
88 ) -> Option<Retained<Self>>;
89
90 #[cfg(feature = "NSString")]
91 #[unsafe(method(serviceConnectionWithName:rootObject:))]
92 #[unsafe(method_family = none)]
93 pub unsafe fn serviceConnectionWithName_rootObject(
94 name: &NSString,
95 root: &AnyObject,
96 ) -> Option<Retained<Self>>;
97
98 #[cfg(feature = "NSDate")]
99 #[deprecated = "Use NSXPCConnection instead"]
100 #[unsafe(method(requestTimeout))]
101 #[unsafe(method_family = none)]
102 pub unsafe fn requestTimeout(&self) -> NSTimeInterval;
103
104 #[cfg(feature = "NSDate")]
105 #[deprecated = "Use NSXPCConnection instead"]
107 #[unsafe(method(setRequestTimeout:))]
108 #[unsafe(method_family = none)]
109 pub unsafe fn setRequestTimeout(&self, request_timeout: NSTimeInterval);
110
111 #[cfg(feature = "NSDate")]
112 #[deprecated = "Use NSXPCConnection instead"]
113 #[unsafe(method(replyTimeout))]
114 #[unsafe(method_family = none)]
115 pub unsafe fn replyTimeout(&self) -> NSTimeInterval;
116
117 #[cfg(feature = "NSDate")]
118 #[deprecated = "Use NSXPCConnection instead"]
120 #[unsafe(method(setReplyTimeout:))]
121 #[unsafe(method_family = none)]
122 pub unsafe fn setReplyTimeout(&self, reply_timeout: NSTimeInterval);
123
124 #[deprecated = "Use NSXPCConnection instead"]
125 #[unsafe(method(rootObject))]
126 #[unsafe(method_family = none)]
127 pub unsafe fn rootObject(&self) -> Option<Retained<AnyObject>>;
128
129 #[deprecated = "Use NSXPCConnection instead"]
131 #[unsafe(method(setRootObject:))]
132 #[unsafe(method_family = none)]
133 pub unsafe fn setRootObject(&self, root_object: Option<&AnyObject>);
134
135 #[deprecated = "Use NSXPCConnection instead"]
136 #[unsafe(method(delegate))]
137 #[unsafe(method_family = none)]
138 pub unsafe fn delegate(&self)
139 -> Option<Retained<ProtocolObject<dyn NSConnectionDelegate>>>;
140
141 #[deprecated = "Use NSXPCConnection instead"]
143 #[unsafe(method(setDelegate:))]
144 #[unsafe(method_family = none)]
145 pub unsafe fn setDelegate(
146 &self,
147 delegate: Option<&ProtocolObject<dyn NSConnectionDelegate>>,
148 );
149
150 #[deprecated = "Use NSXPCConnection instead"]
151 #[unsafe(method(independentConversationQueueing))]
152 #[unsafe(method_family = none)]
153 pub unsafe fn independentConversationQueueing(&self) -> bool;
154
155 #[deprecated = "Use NSXPCConnection instead"]
157 #[unsafe(method(setIndependentConversationQueueing:))]
158 #[unsafe(method_family = none)]
159 pub unsafe fn setIndependentConversationQueueing(
160 &self,
161 independent_conversation_queueing: bool,
162 );
163
164 #[deprecated = "Use NSXPCConnection instead"]
165 #[unsafe(method(isValid))]
166 #[unsafe(method_family = none)]
167 pub unsafe fn isValid(&self) -> bool;
168
169 #[cfg(all(feature = "NSDistantObject", feature = "NSProxy"))]
170 #[deprecated = "Use NSXPCConnection instead"]
171 #[unsafe(method(rootProxy))]
172 #[unsafe(method_family = none)]
173 pub unsafe fn rootProxy(&self) -> Retained<NSDistantObject>;
174
175 #[deprecated = "Use NSXPCConnection instead"]
176 #[unsafe(method(invalidate))]
177 #[unsafe(method_family = none)]
178 pub unsafe fn invalidate(&self);
179
180 #[cfg(feature = "NSString")]
181 #[deprecated = "Use NSXPCConnection instead"]
182 #[unsafe(method(addRequestMode:))]
183 #[unsafe(method_family = none)]
184 pub unsafe fn addRequestMode(&self, rmode: &NSString);
185
186 #[cfg(feature = "NSString")]
187 #[deprecated = "Use NSXPCConnection instead"]
188 #[unsafe(method(removeRequestMode:))]
189 #[unsafe(method_family = none)]
190 pub unsafe fn removeRequestMode(&self, rmode: &NSString);
191
192 #[cfg(all(feature = "NSArray", feature = "NSString"))]
193 #[deprecated = "Use NSXPCConnection instead"]
194 #[unsafe(method(requestModes))]
195 #[unsafe(method_family = none)]
196 pub unsafe fn requestModes(&self) -> Retained<NSArray<NSString>>;
197
198 #[cfg(feature = "NSString")]
199 #[deprecated = "Use NSXPCConnection instead"]
200 #[unsafe(method(registerName:))]
201 #[unsafe(method_family = none)]
202 pub unsafe fn registerName(&self, name: Option<&NSString>) -> bool;
203
204 #[cfg(all(feature = "NSPortNameServer", feature = "NSString"))]
205 #[deprecated = "Use NSXPCConnection instead"]
206 #[unsafe(method(registerName:withNameServer:))]
207 #[unsafe(method_family = none)]
208 pub unsafe fn registerName_withNameServer(
209 &self,
210 name: Option<&NSString>,
211 server: &NSPortNameServer,
212 ) -> bool;
213
214 #[cfg(feature = "NSPort")]
215 #[deprecated = "Use NSXPCConnection instead"]
216 #[unsafe(method(connectionWithReceivePort:sendPort:))]
217 #[unsafe(method_family = none)]
218 pub unsafe fn connectionWithReceivePort_sendPort(
219 receive_port: Option<&NSPort>,
220 send_port: Option<&NSPort>,
221 ) -> Option<Retained<Self>>;
222
223 #[deprecated = "Use NSXPCConnection instead"]
224 #[unsafe(method(currentConversation))]
225 #[unsafe(method_family = none)]
226 pub unsafe fn currentConversation() -> Option<Retained<AnyObject>>;
227
228 #[cfg(feature = "NSPort")]
229 #[deprecated = "Use NSXPCConnection instead"]
230 #[unsafe(method(initWithReceivePort:sendPort:))]
231 #[unsafe(method_family = init)]
232 pub unsafe fn initWithReceivePort_sendPort(
233 this: Allocated<Self>,
234 receive_port: Option<&NSPort>,
235 send_port: Option<&NSPort>,
236 ) -> Option<Retained<Self>>;
237
238 #[cfg(feature = "NSPort")]
239 #[deprecated = "Use NSXPCConnection instead"]
240 #[unsafe(method(sendPort))]
241 #[unsafe(method_family = none)]
242 pub unsafe fn sendPort(&self) -> Retained<NSPort>;
243
244 #[cfg(feature = "NSPort")]
245 #[deprecated = "Use NSXPCConnection instead"]
246 #[unsafe(method(receivePort))]
247 #[unsafe(method_family = none)]
248 pub unsafe fn receivePort(&self) -> Retained<NSPort>;
249
250 #[deprecated = "Use NSXPCConnection instead"]
251 #[unsafe(method(enableMultipleThreads))]
252 #[unsafe(method_family = none)]
253 pub unsafe fn enableMultipleThreads(&self);
254
255 #[deprecated = "Use NSXPCConnection instead"]
256 #[unsafe(method(multipleThreadsEnabled))]
257 #[unsafe(method_family = none)]
258 pub unsafe fn multipleThreadsEnabled(&self) -> bool;
259
260 #[cfg(feature = "NSRunLoop")]
261 #[deprecated = "Use NSXPCConnection instead"]
262 #[unsafe(method(addRunLoop:))]
263 #[unsafe(method_family = none)]
264 pub unsafe fn addRunLoop(&self, runloop: &NSRunLoop);
265
266 #[cfg(feature = "NSRunLoop")]
267 #[deprecated = "Use NSXPCConnection instead"]
268 #[unsafe(method(removeRunLoop:))]
269 #[unsafe(method_family = none)]
270 pub unsafe fn removeRunLoop(&self, runloop: &NSRunLoop);
271
272 #[deprecated = "Use NSXPCConnection instead"]
273 #[unsafe(method(runInNewThread))]
274 #[unsafe(method_family = none)]
275 pub unsafe fn runInNewThread(&self);
276
277 #[cfg(feature = "NSArray")]
278 #[deprecated = "Use NSXPCConnection instead"]
279 #[unsafe(method(remoteObjects))]
280 #[unsafe(method_family = none)]
281 pub unsafe fn remoteObjects(&self) -> Retained<NSArray>;
282
283 #[cfg(feature = "NSArray")]
284 #[deprecated = "Use NSXPCConnection instead"]
285 #[unsafe(method(localObjects))]
286 #[unsafe(method_family = none)]
287 pub unsafe fn localObjects(&self) -> Retained<NSArray>;
288
289 #[cfg(feature = "NSArray")]
290 #[unsafe(method(dispatchWithComponents:))]
291 #[unsafe(method_family = none)]
292 pub unsafe fn dispatchWithComponents(&self, components: &NSArray);
293 );
294}
295
296impl NSConnection {
298 extern_methods!(
299 #[unsafe(method(init))]
300 #[unsafe(method_family = init)]
301 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
302
303 #[unsafe(method(new))]
304 #[unsafe(method_family = new)]
305 pub unsafe fn new() -> Retained<Self>;
306 );
307}
308
309extern "C" {
310 #[cfg(feature = "NSString")]
312 pub static NSConnectionReplyMode: &'static NSString;
313}
314
315extern "C" {
316 #[cfg(feature = "NSString")]
318 pub static NSConnectionDidDieNotification: &'static NSString;
319}
320
321extern_protocol!(
322 #[deprecated = "Use NSXPCConnection instead"]
324 pub unsafe trait NSConnectionDelegate: NSObjectProtocol {
325 #[deprecated = "Use NSXPCConnection instead"]
326 #[optional]
327 #[unsafe(method(makeNewConnection:sender:))]
328 #[unsafe(method_family = none)]
329 unsafe fn makeNewConnection_sender(
330 &self,
331 conn: &NSConnection,
332 ancestor: &NSConnection,
333 ) -> bool;
334
335 #[deprecated = "Use NSXPCConnection instead"]
336 #[optional]
337 #[unsafe(method(connection:shouldMakeNewConnection:))]
338 #[unsafe(method_family = none)]
339 unsafe fn connection_shouldMakeNewConnection(
340 &self,
341 ancestor: &NSConnection,
342 conn: &NSConnection,
343 ) -> bool;
344
345 #[cfg(all(feature = "NSArray", feature = "NSData"))]
346 #[deprecated = "Use NSXPCConnection instead"]
347 #[optional]
348 #[unsafe(method(authenticationDataForComponents:))]
349 #[unsafe(method_family = none)]
350 unsafe fn authenticationDataForComponents(&self, components: &NSArray) -> Retained<NSData>;
351
352 #[cfg(all(feature = "NSArray", feature = "NSData"))]
353 #[deprecated = "Use NSXPCConnection instead"]
354 #[optional]
355 #[unsafe(method(authenticateComponents:withData:))]
356 #[unsafe(method_family = none)]
357 unsafe fn authenticateComponents_withData(
358 &self,
359 components: &NSArray,
360 signature: &NSData,
361 ) -> bool;
362
363 #[deprecated = "Use NSXPCConnection instead"]
364 #[optional]
365 #[unsafe(method(createConversationForConnection:))]
366 #[unsafe(method_family = none)]
367 unsafe fn createConversationForConnection(
368 &self,
369 conn: &NSConnection,
370 ) -> Retained<AnyObject>;
371
372 #[deprecated = "Use NSXPCConnection instead"]
373 #[optional]
374 #[unsafe(method(connection:handleRequest:))]
375 #[unsafe(method_family = none)]
376 unsafe fn connection_handleRequest(
377 &self,
378 connection: &NSConnection,
379 doreq: &NSDistantObjectRequest,
380 ) -> bool;
381 }
382);
383
384extern "C" {
385 #[cfg(feature = "NSString")]
387 pub static NSFailedAuthenticationException: &'static NSString;
388}
389
390extern "C" {
391 #[cfg(feature = "NSString")]
393 pub static NSConnectionDidInitializeNotification: &'static NSString;
394}
395
396extern_class!(
397 #[unsafe(super(NSObject))]
399 #[derive(Debug, PartialEq, Eq, Hash)]
400 #[deprecated = "Use NSXPCConnection instead"]
401 pub struct NSDistantObjectRequest;
402);
403
404unsafe impl NSObjectProtocol for NSDistantObjectRequest {}
405
406impl NSDistantObjectRequest {
407 extern_methods!(
408 #[cfg(feature = "NSInvocation")]
409 #[deprecated = "Use NSXPCConnection instead"]
410 #[unsafe(method(invocation))]
411 #[unsafe(method_family = none)]
412 pub unsafe fn invocation(&self) -> Retained<NSInvocation>;
413
414 #[deprecated = "Use NSXPCConnection instead"]
415 #[unsafe(method(connection))]
416 #[unsafe(method_family = none)]
417 pub unsafe fn connection(&self) -> Retained<NSConnection>;
418
419 #[deprecated = "Use NSXPCConnection instead"]
420 #[unsafe(method(conversation))]
421 #[unsafe(method_family = none)]
422 pub unsafe fn conversation(&self) -> Retained<AnyObject>;
423
424 #[cfg(feature = "NSException")]
425 #[deprecated = "Use NSXPCConnection instead"]
426 #[unsafe(method(replyWithException:))]
427 #[unsafe(method_family = none)]
428 pub unsafe fn replyWithException(&self, exception: Option<&NSException>);
429 );
430}
431
432impl NSDistantObjectRequest {
434 extern_methods!(
435 #[unsafe(method(init))]
436 #[unsafe(method_family = init)]
437 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
438
439 #[unsafe(method(new))]
440 #[unsafe(method_family = new)]
441 pub unsafe fn new() -> Retained<Self>;
442 );
443}