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#[repr(C)]
15pub struct WSProtocolHandler {
16 inner: [u8; 0],
17 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
18}
19
20cf_type!(
21 unsafe impl WSProtocolHandler {}
22);
23#[cfg(feature = "objc2")]
24cf_objc2_type!(
25 unsafe impl RefEncode<"OpaqueWSProtocolHandlerRef"> for WSProtocolHandler {}
26);
27
28unsafe impl ConcreteType for WSProtocolHandler {
29 #[doc(alias = "WSProtocolHandlerGetTypeID")]
30 #[inline]
31 fn type_id() -> CFTypeID {
32 extern "C-unwind" {
33 fn WSProtocolHandlerGetTypeID() -> CFTypeID;
34 }
35 unsafe { WSProtocolHandlerGetTypeID() }
36 }
37}
38
39impl WSProtocolHandler {
40 #[doc(alias = "WSProtocolHandlerCreate")]
41 #[deprecated = "No longer supported"]
42 #[inline]
43 pub unsafe fn new(
44 allocator: Option<&CFAllocator>,
45 protocol: Option<&CFString>,
46 ) -> Option<CFRetained<WSProtocolHandler>> {
47 extern "C-unwind" {
48 fn WSProtocolHandlerCreate(
49 allocator: Option<&CFAllocator>,
50 protocol: Option<&CFString>,
51 ) -> Option<NonNull<WSProtocolHandler>>;
52 }
53 let ret = unsafe { WSProtocolHandlerCreate(allocator, protocol) };
54 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
55 }
56
57 #[doc(alias = "WSProtocolHandlerCopyRequestDictionary")]
58 #[deprecated = "No longer supported"]
59 #[inline]
60 pub unsafe fn request_dictionary(
61 self: &WSProtocolHandler,
62 data: Option<&CFData>,
63 ) -> Option<CFRetained<CFDictionary>> {
64 extern "C-unwind" {
65 fn WSProtocolHandlerCopyRequestDictionary(
66 r#ref: &WSProtocolHandler,
67 data: Option<&CFData>,
68 ) -> Option<NonNull<CFDictionary>>;
69 }
70 let ret = unsafe { WSProtocolHandlerCopyRequestDictionary(self, data) };
71 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
72 }
73
74 #[doc(alias = "WSProtocolHandlerCopyReplyDictionary")]
75 #[deprecated = "No longer supported"]
76 #[inline]
77 pub unsafe fn reply_dictionary(
78 self: &WSProtocolHandler,
79 method_name: Option<&CFString>,
80 data: Option<&CFData>,
81 ) -> Option<CFRetained<CFDictionary>> {
82 extern "C-unwind" {
83 fn WSProtocolHandlerCopyReplyDictionary(
84 r#ref: &WSProtocolHandler,
85 method_name: Option<&CFString>,
86 data: Option<&CFData>,
87 ) -> Option<NonNull<CFDictionary>>;
88 }
89 let ret = unsafe { WSProtocolHandlerCopyReplyDictionary(self, method_name, data) };
90 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
91 }
92
93 #[doc(alias = "WSProtocolHandlerCopyReplyDocument")]
94 #[deprecated = "No longer supported"]
95 #[inline]
96 pub unsafe fn reply_document(
97 self: &WSProtocolHandler,
98 method_context: Option<&CFDictionary>,
99 result_value: Option<&CFType>,
100 ) -> Option<CFRetained<CFData>> {
101 extern "C-unwind" {
102 fn WSProtocolHandlerCopyReplyDocument(
103 r#ref: &WSProtocolHandler,
104 method_context: Option<&CFDictionary>,
105 result_value: Option<&CFType>,
106 ) -> Option<NonNull<CFData>>;
107 }
108 let ret = unsafe { WSProtocolHandlerCopyReplyDocument(self, method_context, result_value) };
109 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
110 }
111
112 #[doc(alias = "WSProtocolHandlerCopyFaultDocument")]
113 #[deprecated = "No longer supported"]
114 #[inline]
115 pub unsafe fn fault_document(
116 self: &WSProtocolHandler,
117 method_context: Option<&CFDictionary>,
118 fault_dict: Option<&CFDictionary>,
119 ) -> Option<CFRetained<CFData>> {
120 extern "C-unwind" {
121 fn WSProtocolHandlerCopyFaultDocument(
122 r#ref: &WSProtocolHandler,
123 method_context: Option<&CFDictionary>,
124 fault_dict: Option<&CFDictionary>,
125 ) -> Option<NonNull<CFData>>;
126 }
127 let ret = unsafe { WSProtocolHandlerCopyFaultDocument(self, method_context, fault_dict) };
128 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
129 }
130
131 #[doc(alias = "WSProtocolHandlerCopyRequestDocument")]
132 #[deprecated = "No longer supported"]
133 #[inline]
134 pub unsafe fn request_document(
135 self: &WSProtocolHandler,
136 method_name: Option<&CFString>,
137 method_params: Option<&CFDictionary>,
138 method_param_order: Option<&CFArray>,
139 method_extras: Option<&CFDictionary>,
140 ) -> Option<CFRetained<CFData>> {
141 extern "C-unwind" {
142 fn WSProtocolHandlerCopyRequestDocument(
143 r#ref: &WSProtocolHandler,
144 method_name: Option<&CFString>,
145 method_params: Option<&CFDictionary>,
146 method_param_order: Option<&CFArray>,
147 method_extras: Option<&CFDictionary>,
148 ) -> Option<NonNull<CFData>>;
149 }
150 let ret = unsafe {
151 WSProtocolHandlerCopyRequestDocument(
152 self,
153 method_name,
154 method_params,
155 method_param_order,
156 method_extras,
157 )
158 };
159 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
160 }
161
162 #[doc(alias = "WSProtocolHandlerCopyProperty")]
163 #[deprecated = "No longer supported"]
164 #[inline]
165 pub unsafe fn property(
166 self: &WSProtocolHandler,
167 property_name: Option<&CFString>,
168 ) -> Option<CFRetained<CFType>> {
169 extern "C-unwind" {
170 fn WSProtocolHandlerCopyProperty(
171 r#ref: &WSProtocolHandler,
172 property_name: Option<&CFString>,
173 ) -> Option<NonNull<CFType>>;
174 }
175 let ret = unsafe { WSProtocolHandlerCopyProperty(self, property_name) };
176 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
177 }
178
179 #[doc(alias = "WSProtocolHandlerSetProperty")]
180 #[deprecated = "No longer supported"]
181 #[inline]
182 pub unsafe fn set_property(
183 self: &WSProtocolHandler,
184 property_name: Option<&CFString>,
185 property_value: Option<&CFType>,
186 ) {
187 extern "C-unwind" {
188 fn WSProtocolHandlerSetProperty(
189 r#ref: &WSProtocolHandler,
190 property_name: Option<&CFString>,
191 property_value: Option<&CFType>,
192 );
193 }
194 unsafe { WSProtocolHandlerSetProperty(self, property_name, property_value) }
195 }
196}
197
198pub type WSProtocolHandlerSerializationProcPtr = Option<
200 unsafe extern "C-unwind" fn(
201 *mut WSProtocolHandler,
202 *const CFType,
203 *mut c_void,
204 ) -> *const CFString,
205>;
206
207impl WSProtocolHandler {
208 #[doc(alias = "WSProtocolHandlerSetSerializationOverride")]
209 #[cfg(feature = "WSTypes")]
210 #[deprecated = "No longer supported"]
211 #[inline]
212 pub unsafe fn set_serialization_override(
213 self: &WSProtocolHandler,
214 obj_type: CFTypeID,
215 serialization_proc: WSProtocolHandlerSerializationProcPtr,
216 context: *mut WSClientContext,
217 ) {
218 extern "C-unwind" {
219 fn WSProtocolHandlerSetSerializationOverride(
220 protocol: &WSProtocolHandler,
221 obj_type: CFTypeID,
222 serialization_proc: WSProtocolHandlerSerializationProcPtr,
223 context: *mut WSClientContext,
224 );
225 }
226 unsafe {
227 WSProtocolHandlerSetSerializationOverride(self, obj_type, serialization_proc, context)
228 }
229 }
230}
231
232pub type WSProtocolHandlerDeserializationProcPtr = Option<
234 unsafe extern "C-unwind" fn(
235 *mut WSProtocolHandler,
236 *mut CFXMLTree,
237 *mut CFXMLTree,
238 *mut c_void,
239 ) -> *const CFType,
240>;
241
242impl WSProtocolHandler {
243 #[doc(alias = "WSProtocolHandlerSetDeserializationOverride")]
244 #[cfg(feature = "WSTypes")]
245 #[deprecated = "No longer supported"]
246 #[inline]
247 pub unsafe fn set_deserialization_override(
248 self: &WSProtocolHandler,
249 type_namespace: Option<&CFString>,
250 type_name: Option<&CFString>,
251 deserialization_proc: WSProtocolHandlerDeserializationProcPtr,
252 context: *mut WSClientContext,
253 ) {
254 extern "C-unwind" {
255 fn WSProtocolHandlerSetDeserializationOverride(
256 protocol: &WSProtocolHandler,
257 type_namespace: Option<&CFString>,
258 type_name: Option<&CFString>,
259 deserialization_proc: WSProtocolHandlerDeserializationProcPtr,
260 context: *mut WSClientContext,
261 );
262 }
263 unsafe {
264 WSProtocolHandlerSetDeserializationOverride(
265 self,
266 type_namespace,
267 type_name,
268 deserialization_proc,
269 context,
270 )
271 }
272 }
273}
274
275#[deprecated = "renamed to `WSProtocolHandler::new`"]
276#[inline]
277pub unsafe extern "C-unwind" fn WSProtocolHandlerCreate(
278 allocator: Option<&CFAllocator>,
279 protocol: Option<&CFString>,
280) -> Option<CFRetained<WSProtocolHandler>> {
281 extern "C-unwind" {
282 fn WSProtocolHandlerCreate(
283 allocator: Option<&CFAllocator>,
284 protocol: Option<&CFString>,
285 ) -> Option<NonNull<WSProtocolHandler>>;
286 }
287 let ret = unsafe { WSProtocolHandlerCreate(allocator, protocol) };
288 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
289}
290
291#[deprecated = "renamed to `WSProtocolHandler::request_dictionary`"]
292#[inline]
293pub unsafe extern "C-unwind" fn WSProtocolHandlerCopyRequestDictionary(
294 r#ref: &WSProtocolHandler,
295 data: Option<&CFData>,
296) -> Option<CFRetained<CFDictionary>> {
297 extern "C-unwind" {
298 fn WSProtocolHandlerCopyRequestDictionary(
299 r#ref: &WSProtocolHandler,
300 data: Option<&CFData>,
301 ) -> Option<NonNull<CFDictionary>>;
302 }
303 let ret = unsafe { WSProtocolHandlerCopyRequestDictionary(r#ref, data) };
304 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
305}
306
307#[deprecated = "renamed to `WSProtocolHandler::reply_dictionary`"]
308#[inline]
309pub unsafe extern "C-unwind" fn WSProtocolHandlerCopyReplyDictionary(
310 r#ref: &WSProtocolHandler,
311 method_name: Option<&CFString>,
312 data: Option<&CFData>,
313) -> Option<CFRetained<CFDictionary>> {
314 extern "C-unwind" {
315 fn WSProtocolHandlerCopyReplyDictionary(
316 r#ref: &WSProtocolHandler,
317 method_name: Option<&CFString>,
318 data: Option<&CFData>,
319 ) -> Option<NonNull<CFDictionary>>;
320 }
321 let ret = unsafe { WSProtocolHandlerCopyReplyDictionary(r#ref, method_name, data) };
322 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
323}
324
325#[deprecated = "renamed to `WSProtocolHandler::reply_document`"]
326#[inline]
327pub unsafe extern "C-unwind" fn WSProtocolHandlerCopyReplyDocument(
328 r#ref: &WSProtocolHandler,
329 method_context: Option<&CFDictionary>,
330 result_value: Option<&CFType>,
331) -> Option<CFRetained<CFData>> {
332 extern "C-unwind" {
333 fn WSProtocolHandlerCopyReplyDocument(
334 r#ref: &WSProtocolHandler,
335 method_context: Option<&CFDictionary>,
336 result_value: Option<&CFType>,
337 ) -> Option<NonNull<CFData>>;
338 }
339 let ret = unsafe { WSProtocolHandlerCopyReplyDocument(r#ref, method_context, result_value) };
340 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
341}
342
343#[deprecated = "renamed to `WSProtocolHandler::fault_document`"]
344#[inline]
345pub unsafe extern "C-unwind" fn WSProtocolHandlerCopyFaultDocument(
346 r#ref: &WSProtocolHandler,
347 method_context: Option<&CFDictionary>,
348 fault_dict: Option<&CFDictionary>,
349) -> Option<CFRetained<CFData>> {
350 extern "C-unwind" {
351 fn WSProtocolHandlerCopyFaultDocument(
352 r#ref: &WSProtocolHandler,
353 method_context: Option<&CFDictionary>,
354 fault_dict: Option<&CFDictionary>,
355 ) -> Option<NonNull<CFData>>;
356 }
357 let ret = unsafe { WSProtocolHandlerCopyFaultDocument(r#ref, method_context, fault_dict) };
358 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
359}
360
361#[deprecated = "renamed to `WSProtocolHandler::request_document`"]
362#[inline]
363pub unsafe extern "C-unwind" fn WSProtocolHandlerCopyRequestDocument(
364 r#ref: &WSProtocolHandler,
365 method_name: Option<&CFString>,
366 method_params: Option<&CFDictionary>,
367 method_param_order: Option<&CFArray>,
368 method_extras: Option<&CFDictionary>,
369) -> Option<CFRetained<CFData>> {
370 extern "C-unwind" {
371 fn WSProtocolHandlerCopyRequestDocument(
372 r#ref: &WSProtocolHandler,
373 method_name: Option<&CFString>,
374 method_params: Option<&CFDictionary>,
375 method_param_order: Option<&CFArray>,
376 method_extras: Option<&CFDictionary>,
377 ) -> Option<NonNull<CFData>>;
378 }
379 let ret = unsafe {
380 WSProtocolHandlerCopyRequestDocument(
381 r#ref,
382 method_name,
383 method_params,
384 method_param_order,
385 method_extras,
386 )
387 };
388 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
389}
390
391#[deprecated = "renamed to `WSProtocolHandler::property`"]
392#[inline]
393pub unsafe extern "C-unwind" fn WSProtocolHandlerCopyProperty(
394 r#ref: &WSProtocolHandler,
395 property_name: Option<&CFString>,
396) -> Option<CFRetained<CFType>> {
397 extern "C-unwind" {
398 fn WSProtocolHandlerCopyProperty(
399 r#ref: &WSProtocolHandler,
400 property_name: Option<&CFString>,
401 ) -> Option<NonNull<CFType>>;
402 }
403 let ret = unsafe { WSProtocolHandlerCopyProperty(r#ref, property_name) };
404 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
405}
406
407extern "C-unwind" {
408 #[deprecated = "renamed to `WSProtocolHandler::set_property`"]
409 pub fn WSProtocolHandlerSetProperty(
410 r#ref: &WSProtocolHandler,
411 property_name: Option<&CFString>,
412 property_value: Option<&CFType>,
413 );
414}
415
416extern "C-unwind" {
417 #[cfg(feature = "WSTypes")]
418 #[deprecated = "renamed to `WSProtocolHandler::set_serialization_override`"]
419 pub fn WSProtocolHandlerSetSerializationOverride(
420 protocol: &WSProtocolHandler,
421 obj_type: CFTypeID,
422 serialization_proc: WSProtocolHandlerSerializationProcPtr,
423 context: *mut WSClientContext,
424 );
425}
426
427extern "C-unwind" {
428 #[cfg(feature = "WSTypes")]
429 #[deprecated = "renamed to `WSProtocolHandler::set_deserialization_override`"]
430 pub fn WSProtocolHandlerSetDeserializationOverride(
431 protocol: &WSProtocolHandler,
432 type_namespace: Option<&CFString>,
433 type_name: Option<&CFString>,
434 deserialization_proc: WSProtocolHandlerDeserializationProcPtr,
435 context: *mut WSClientContext,
436 );
437}