]> git.proxmox.com Git - rustc.git/blob - vendor/core-foundation-sys/src/messageport.rs
New upstream version 1.63.0+dfsg1
[rustc.git] / vendor / core-foundation-sys / src / messageport.rs
1 // Copyright 2013-2015 The Servo Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution.
3 //
4 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
5 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
7 // option. This file may not be copied, modified, or distributed
8 // except according to those terms.
9
10 use std::os::raw::c_void;
11
12 use base::{CFAllocatorRef, CFIndex, CFTypeID, Boolean};
13 use data::CFDataRef;
14 use date::CFTimeInterval;
15 use runloop::CFRunLoopSourceRef;
16 use string::CFStringRef;
17
18 #[repr(C)]
19 #[derive(Copy, Clone)]
20 #[derive(Debug)]
21 pub struct CFMessagePortContext {
22 pub version: CFIndex,
23 pub info: *mut c_void,
24 pub retain: Option<unsafe extern fn(info: *const c_void) -> *const c_void>,
25 pub release: Option<unsafe extern fn(info: *const c_void)>,
26 pub copyDescription: Option<unsafe extern fn(info: *const c_void)
27 -> CFStringRef>,
28 }
29
30 pub type CFMessagePortCallBack = Option<
31 unsafe extern fn(local: CFMessagePortRef,
32 msgid: i32,
33 data: CFDataRef,
34 info: *mut c_void) -> CFDataRef>;
35
36 pub type CFMessagePortInvalidationCallBack = Option<
37 unsafe extern "C" fn(ms: CFMessagePortRef, info: *mut c_void)>;
38
39 #[repr(C)]
40 pub struct __CFMessagePort(c_void);
41 pub type CFMessagePortRef = *mut __CFMessagePort;
42
43 extern {
44 /*
45 * CFMessagePort.h
46 */
47 pub fn CFMessagePortGetTypeID() -> CFTypeID;
48 pub fn CFMessagePortCreateLocal(allocator: CFAllocatorRef,
49 name: CFStringRef,
50 callout: CFMessagePortCallBack,
51 context: *const CFMessagePortContext,
52 shouldFreeInfo: *mut Boolean)
53 -> CFMessagePortRef;
54 pub fn CFMessagePortCreateRemote(allocator: CFAllocatorRef,
55 name: CFStringRef) -> CFMessagePortRef;
56 pub fn CFMessagePortIsRemote(ms: CFMessagePortRef) -> Boolean;
57 pub fn CFMessagePortGetName(ms: CFMessagePortRef) -> CFStringRef;
58 pub fn CFMessagePortSetName(ms: CFMessagePortRef, newName: CFStringRef)
59 -> Boolean;
60 pub fn CFMessagePortGetContext(ms: CFMessagePortRef,
61 context: *mut CFMessagePortContext);
62 pub fn CFMessagePortInvalidate(ms: CFMessagePortRef);
63 pub fn CFMessagePortIsValid(ms: CFMessagePortRef) -> Boolean;
64 pub fn CFMessagePortGetInvalidationCallBack(ms: CFMessagePortRef)
65 -> CFMessagePortInvalidationCallBack;
66 pub fn CFMessagePortSetInvalidationCallBack(ms: CFMessagePortRef,
67 callout: CFMessagePortInvalidationCallBack);
68 pub fn CFMessagePortSendRequest(remote: CFMessagePortRef, msgid: i32,
69 data: CFDataRef,
70 sendTimeout: CFTimeInterval,
71 rcvTimeout: CFTimeInterval,
72 replyMode: CFStringRef,
73 returnData: *mut CFDataRef) -> i32;
74 pub fn CFMessagePortCreateRunLoopSource(allocator: CFAllocatorRef,
75 local: CFMessagePortRef,
76 order: CFIndex)
77 -> CFRunLoopSourceRef;
78 // CFMessagePortSetDispatchQueue
79 }