1use core::cell::UnsafeCell;
4use core::ffi::*;
5use core::marker::{PhantomData, PhantomPinned};
6use core::ptr::NonNull;
7#[cfg(feature = "objc2")]
8use objc2::__framework_prelude::*;
9use objc2_core_foundation::*;
10
11use crate::*;
12
13#[doc(alias = "WSProtocolHandlerRef")]
15#[repr(C)]
16pub struct WSProtocolHandler {
17 inner: [u8; 0],
18 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
19}
20
21cf_type!(
22 unsafe impl WSProtocolHandler {}
23);
24#[cfg(feature = "objc2")]
25cf_objc2_type!(
26 unsafe impl RefEncode<"OpaqueWSProtocolHandlerRef"> for WSProtocolHandler {}
27);
28
29unsafe impl ConcreteType for WSProtocolHandler {
30 #[doc(alias = "WSProtocolHandlerGetTypeID")]
31 #[inline]
32 fn type_id() -> CFTypeID {
33 extern "C-unwind" {
34 fn WSProtocolHandlerGetTypeID() -> CFTypeID;
35 }
36 unsafe { WSProtocolHandlerGetTypeID() }
37 }
38}
39
40impl WSProtocolHandler {
41 #[doc(alias = "WSProtocolHandlerCreate")]
46 #[deprecated = "No longer supported"]
47 #[inline]
48 pub unsafe fn new(
49 allocator: Option<&CFAllocator>,
50 protocol: Option<&CFString>,
51 ) -> Option<CFRetained<WSProtocolHandler>> {
52 extern "C-unwind" {
53 fn WSProtocolHandlerCreate(
54 allocator: Option<&CFAllocator>,
55 protocol: Option<&CFString>,
56 ) -> Option<NonNull<WSProtocolHandler>>;
57 }
58 let ret = unsafe { WSProtocolHandlerCreate(allocator, protocol) };
59 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
60 }
61
62 #[doc(alias = "WSProtocolHandlerCopyRequestDictionary")]
66 #[deprecated = "No longer supported"]
67 #[inline]
68 pub unsafe fn request_dictionary(
69 &self,
70 data: Option<&CFData>,
71 ) -> Option<CFRetained<CFDictionary>> {
72 extern "C-unwind" {
73 fn WSProtocolHandlerCopyRequestDictionary(
74 r#ref: &WSProtocolHandler,
75 data: Option<&CFData>,
76 ) -> Option<NonNull<CFDictionary>>;
77 }
78 let ret = unsafe { WSProtocolHandlerCopyRequestDictionary(self, data) };
79 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
80 }
81
82 #[doc(alias = "WSProtocolHandlerCopyReplyDictionary")]
87 #[deprecated = "No longer supported"]
88 #[inline]
89 pub unsafe fn reply_dictionary(
90 &self,
91 method_name: Option<&CFString>,
92 data: Option<&CFData>,
93 ) -> Option<CFRetained<CFDictionary>> {
94 extern "C-unwind" {
95 fn WSProtocolHandlerCopyReplyDictionary(
96 r#ref: &WSProtocolHandler,
97 method_name: Option<&CFString>,
98 data: Option<&CFData>,
99 ) -> Option<NonNull<CFDictionary>>;
100 }
101 let ret = unsafe { WSProtocolHandlerCopyReplyDictionary(self, method_name, data) };
102 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
103 }
104
105 #[doc(alias = "WSProtocolHandlerCopyReplyDocument")]
112 #[deprecated = "No longer supported"]
113 #[inline]
114 pub unsafe fn reply_document(
115 &self,
116 method_context: Option<&CFDictionary>,
117 result_value: Option<&CFType>,
118 ) -> Option<CFRetained<CFData>> {
119 extern "C-unwind" {
120 fn WSProtocolHandlerCopyReplyDocument(
121 r#ref: &WSProtocolHandler,
122 method_context: Option<&CFDictionary>,
123 result_value: Option<&CFType>,
124 ) -> Option<NonNull<CFData>>;
125 }
126 let ret = unsafe { WSProtocolHandlerCopyReplyDocument(self, method_context, result_value) };
127 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
128 }
129
130 #[doc(alias = "WSProtocolHandlerCopyFaultDocument")]
137 #[deprecated = "No longer supported"]
138 #[inline]
139 pub unsafe fn fault_document(
140 &self,
141 method_context: Option<&CFDictionary>,
142 fault_dict: Option<&CFDictionary>,
143 ) -> Option<CFRetained<CFData>> {
144 extern "C-unwind" {
145 fn WSProtocolHandlerCopyFaultDocument(
146 r#ref: &WSProtocolHandler,
147 method_context: Option<&CFDictionary>,
148 fault_dict: Option<&CFDictionary>,
149 ) -> Option<NonNull<CFData>>;
150 }
151 let ret = unsafe { WSProtocolHandlerCopyFaultDocument(self, method_context, fault_dict) };
152 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
153 }
154
155 #[doc(alias = "WSProtocolHandlerCopyRequestDocument")]
165 #[deprecated = "No longer supported"]
166 #[inline]
167 pub unsafe fn request_document(
168 &self,
169 method_name: Option<&CFString>,
170 method_params: Option<&CFDictionary>,
171 method_param_order: Option<&CFArray>,
172 method_extras: Option<&CFDictionary>,
173 ) -> Option<CFRetained<CFData>> {
174 extern "C-unwind" {
175 fn WSProtocolHandlerCopyRequestDocument(
176 r#ref: &WSProtocolHandler,
177 method_name: Option<&CFString>,
178 method_params: Option<&CFDictionary>,
179 method_param_order: Option<&CFArray>,
180 method_extras: Option<&CFDictionary>,
181 ) -> Option<NonNull<CFData>>;
182 }
183 let ret = unsafe {
184 WSProtocolHandlerCopyRequestDocument(
185 self,
186 method_name,
187 method_params,
188 method_param_order,
189 method_extras,
190 )
191 };
192 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
193 }
194
195 #[doc(alias = "WSProtocolHandlerCopyProperty")]
199 #[deprecated = "No longer supported"]
200 #[inline]
201 pub unsafe fn property(&self, property_name: Option<&CFString>) -> Option<CFRetained<CFType>> {
202 extern "C-unwind" {
203 fn WSProtocolHandlerCopyProperty(
204 r#ref: &WSProtocolHandler,
205 property_name: Option<&CFString>,
206 ) -> Option<NonNull<CFType>>;
207 }
208 let ret = unsafe { WSProtocolHandlerCopyProperty(self, property_name) };
209 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
210 }
211
212 #[doc(alias = "WSProtocolHandlerSetProperty")]
218 #[deprecated = "No longer supported"]
219 #[inline]
220 pub unsafe fn set_property(
221 &self,
222 property_name: Option<&CFString>,
223 property_value: Option<&CFType>,
224 ) {
225 extern "C-unwind" {
226 fn WSProtocolHandlerSetProperty(
227 r#ref: &WSProtocolHandler,
228 property_name: Option<&CFString>,
229 property_value: Option<&CFType>,
230 );
231 }
232 unsafe { WSProtocolHandlerSetProperty(self, property_name, property_value) }
233 }
234}
235
236pub type WSProtocolHandlerSerializationProcPtr = Option<
238 unsafe extern "C-unwind" fn(
239 *mut WSProtocolHandler,
240 *const CFType,
241 *mut c_void,
242 ) -> *const CFString,
243>;
244
245impl WSProtocolHandler {
246 #[doc(alias = "WSProtocolHandlerSetSerializationOverride")]
251 #[cfg(feature = "WSTypes")]
252 #[deprecated = "No longer supported"]
253 #[inline]
254 pub unsafe fn set_serialization_override(
255 &self,
256 obj_type: CFTypeID,
257 serialization_proc: WSProtocolHandlerSerializationProcPtr,
258 context: *mut WSClientContext,
259 ) {
260 extern "C-unwind" {
261 fn WSProtocolHandlerSetSerializationOverride(
262 protocol: &WSProtocolHandler,
263 obj_type: CFTypeID,
264 serialization_proc: WSProtocolHandlerSerializationProcPtr,
265 context: *mut WSClientContext,
266 );
267 }
268 unsafe {
269 WSProtocolHandlerSetSerializationOverride(self, obj_type, serialization_proc, context)
270 }
271 }
272}
273
274pub type WSProtocolHandlerDeserializationProcPtr = Option<
276 unsafe extern "C-unwind" fn(
277 *mut WSProtocolHandler,
278 *mut CFXMLTree,
279 *mut CFXMLTree,
280 *mut c_void,
281 ) -> *const CFType,
282>;
283
284impl WSProtocolHandler {
285 #[doc(alias = "WSProtocolHandlerSetDeserializationOverride")]
292 #[cfg(feature = "WSTypes")]
293 #[deprecated = "No longer supported"]
294 #[inline]
295 pub unsafe fn set_deserialization_override(
296 &self,
297 type_namespace: Option<&CFString>,
298 type_name: Option<&CFString>,
299 deserialization_proc: WSProtocolHandlerDeserializationProcPtr,
300 context: *mut WSClientContext,
301 ) {
302 extern "C-unwind" {
303 fn WSProtocolHandlerSetDeserializationOverride(
304 protocol: &WSProtocolHandler,
305 type_namespace: Option<&CFString>,
306 type_name: Option<&CFString>,
307 deserialization_proc: WSProtocolHandlerDeserializationProcPtr,
308 context: *mut WSClientContext,
309 );
310 }
311 unsafe {
312 WSProtocolHandlerSetDeserializationOverride(
313 self,
314 type_namespace,
315 type_name,
316 deserialization_proc,
317 context,
318 )
319 }
320 }
321}
322
323#[deprecated = "renamed to `WSProtocolHandler::new`"]
324#[inline]
325pub unsafe extern "C-unwind" fn WSProtocolHandlerCreate(
326 allocator: Option<&CFAllocator>,
327 protocol: Option<&CFString>,
328) -> Option<CFRetained<WSProtocolHandler>> {
329 extern "C-unwind" {
330 fn WSProtocolHandlerCreate(
331 allocator: Option<&CFAllocator>,
332 protocol: Option<&CFString>,
333 ) -> Option<NonNull<WSProtocolHandler>>;
334 }
335 let ret = unsafe { WSProtocolHandlerCreate(allocator, protocol) };
336 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
337}
338
339#[deprecated = "renamed to `WSProtocolHandler::request_dictionary`"]
340#[inline]
341pub unsafe extern "C-unwind" fn WSProtocolHandlerCopyRequestDictionary(
342 r#ref: &WSProtocolHandler,
343 data: Option<&CFData>,
344) -> Option<CFRetained<CFDictionary>> {
345 extern "C-unwind" {
346 fn WSProtocolHandlerCopyRequestDictionary(
347 r#ref: &WSProtocolHandler,
348 data: Option<&CFData>,
349 ) -> Option<NonNull<CFDictionary>>;
350 }
351 let ret = unsafe { WSProtocolHandlerCopyRequestDictionary(r#ref, data) };
352 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
353}
354
355#[deprecated = "renamed to `WSProtocolHandler::reply_dictionary`"]
356#[inline]
357pub unsafe extern "C-unwind" fn WSProtocolHandlerCopyReplyDictionary(
358 r#ref: &WSProtocolHandler,
359 method_name: Option<&CFString>,
360 data: Option<&CFData>,
361) -> Option<CFRetained<CFDictionary>> {
362 extern "C-unwind" {
363 fn WSProtocolHandlerCopyReplyDictionary(
364 r#ref: &WSProtocolHandler,
365 method_name: Option<&CFString>,
366 data: Option<&CFData>,
367 ) -> Option<NonNull<CFDictionary>>;
368 }
369 let ret = unsafe { WSProtocolHandlerCopyReplyDictionary(r#ref, method_name, data) };
370 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
371}
372
373#[deprecated = "renamed to `WSProtocolHandler::reply_document`"]
374#[inline]
375pub unsafe extern "C-unwind" fn WSProtocolHandlerCopyReplyDocument(
376 r#ref: &WSProtocolHandler,
377 method_context: Option<&CFDictionary>,
378 result_value: Option<&CFType>,
379) -> Option<CFRetained<CFData>> {
380 extern "C-unwind" {
381 fn WSProtocolHandlerCopyReplyDocument(
382 r#ref: &WSProtocolHandler,
383 method_context: Option<&CFDictionary>,
384 result_value: Option<&CFType>,
385 ) -> Option<NonNull<CFData>>;
386 }
387 let ret = unsafe { WSProtocolHandlerCopyReplyDocument(r#ref, method_context, result_value) };
388 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
389}
390
391#[deprecated = "renamed to `WSProtocolHandler::fault_document`"]
392#[inline]
393pub unsafe extern "C-unwind" fn WSProtocolHandlerCopyFaultDocument(
394 r#ref: &WSProtocolHandler,
395 method_context: Option<&CFDictionary>,
396 fault_dict: Option<&CFDictionary>,
397) -> Option<CFRetained<CFData>> {
398 extern "C-unwind" {
399 fn WSProtocolHandlerCopyFaultDocument(
400 r#ref: &WSProtocolHandler,
401 method_context: Option<&CFDictionary>,
402 fault_dict: Option<&CFDictionary>,
403 ) -> Option<NonNull<CFData>>;
404 }
405 let ret = unsafe { WSProtocolHandlerCopyFaultDocument(r#ref, method_context, fault_dict) };
406 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
407}
408
409#[deprecated = "renamed to `WSProtocolHandler::request_document`"]
410#[inline]
411pub unsafe extern "C-unwind" fn WSProtocolHandlerCopyRequestDocument(
412 r#ref: &WSProtocolHandler,
413 method_name: Option<&CFString>,
414 method_params: Option<&CFDictionary>,
415 method_param_order: Option<&CFArray>,
416 method_extras: Option<&CFDictionary>,
417) -> Option<CFRetained<CFData>> {
418 extern "C-unwind" {
419 fn WSProtocolHandlerCopyRequestDocument(
420 r#ref: &WSProtocolHandler,
421 method_name: Option<&CFString>,
422 method_params: Option<&CFDictionary>,
423 method_param_order: Option<&CFArray>,
424 method_extras: Option<&CFDictionary>,
425 ) -> Option<NonNull<CFData>>;
426 }
427 let ret = unsafe {
428 WSProtocolHandlerCopyRequestDocument(
429 r#ref,
430 method_name,
431 method_params,
432 method_param_order,
433 method_extras,
434 )
435 };
436 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
437}
438
439#[deprecated = "renamed to `WSProtocolHandler::property`"]
440#[inline]
441pub unsafe extern "C-unwind" fn WSProtocolHandlerCopyProperty(
442 r#ref: &WSProtocolHandler,
443 property_name: Option<&CFString>,
444) -> Option<CFRetained<CFType>> {
445 extern "C-unwind" {
446 fn WSProtocolHandlerCopyProperty(
447 r#ref: &WSProtocolHandler,
448 property_name: Option<&CFString>,
449 ) -> Option<NonNull<CFType>>;
450 }
451 let ret = unsafe { WSProtocolHandlerCopyProperty(r#ref, property_name) };
452 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
453}
454
455extern "C-unwind" {
456 #[deprecated = "renamed to `WSProtocolHandler::set_property`"]
457 pub fn WSProtocolHandlerSetProperty(
458 r#ref: &WSProtocolHandler,
459 property_name: Option<&CFString>,
460 property_value: Option<&CFType>,
461 );
462}
463
464extern "C-unwind" {
465 #[cfg(feature = "WSTypes")]
466 #[deprecated = "renamed to `WSProtocolHandler::set_serialization_override`"]
467 pub fn WSProtocolHandlerSetSerializationOverride(
468 protocol: &WSProtocolHandler,
469 obj_type: CFTypeID,
470 serialization_proc: WSProtocolHandlerSerializationProcPtr,
471 context: *mut WSClientContext,
472 );
473}
474
475extern "C-unwind" {
476 #[cfg(feature = "WSTypes")]
477 #[deprecated = "renamed to `WSProtocolHandler::set_deserialization_override`"]
478 pub fn WSProtocolHandlerSetDeserializationOverride(
479 protocol: &WSProtocolHandler,
480 type_namespace: Option<&CFString>,
481 type_name: Option<&CFString>,
482 deserialization_proc: WSProtocolHandlerDeserializationProcPtr,
483 context: *mut WSClientContext,
484 );
485}