1 // Copyright 2013-2015 The Servo Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution.
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.
10 use std
::os
::raw
::c_void
;
12 use base
::{CFAllocatorRef, CFIndex, CFTypeID, Boolean}
;
14 use date
::CFTimeInterval
;
15 use runloop
::CFRunLoopSourceRef
;
16 use string
::CFStringRef
;
19 #[derive(Copy, Clone)]
21 pub struct CFMessagePortContext
{
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
)
30 pub type CFMessagePortCallBack
= Option
<
31 unsafe extern fn(local
: CFMessagePortRef
,
34 info
: *mut c_void
) -> CFDataRef
>;
36 pub type CFMessagePortInvalidationCallBack
= Option
<
37 unsafe extern "C" fn(ms
: CFMessagePortRef
, info
: *mut c_void
)>;
40 pub struct __CFMessagePort(c_void
);
41 pub type CFMessagePortRef
= *mut __CFMessagePort
;
47 pub fn CFMessagePortGetTypeID() -> CFTypeID
;
48 pub fn CFMessagePortCreateLocal(allocator
: CFAllocatorRef
,
50 callout
: CFMessagePortCallBack
,
51 context
: *const CFMessagePortContext
,
52 shouldFreeInfo
: *mut Boolean
)
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
)
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,
70 sendTimeout
: CFTimeInterval
,
71 rcvTimeout
: CFTimeInterval
,
72 replyMode
: CFStringRef
,
73 returnData
: *mut CFDataRef
) -> i32;
74 pub fn CFMessagePortCreateRunLoopSource(allocator
: CFAllocatorRef
,
75 local
: CFMessagePortRef
,
77 -> CFRunLoopSourceRef
;
78 // CFMessagePortSetDispatchQueue