]> git.saurik.com Git - apple/cf.git/blame - RunLoop.subproj/CFMessagePort.h
CF-368.28.tar.gz
[apple/cf.git] / RunLoop.subproj / CFMessagePort.h
CommitLineData
9ce05555 1/*
d8925383 2 * Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
9ce05555
A
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
9ce05555
A
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23/* CFMessagePort.h
d8925383 24 Copyright (c) 1998-2005, Apple, Inc. All rights reserved.
9ce05555
A
25*/
26
27#if !defined(__COREFOUNDATION_CFMESSAGEPORT__)
28#define __COREFOUNDATION_CFMESSAGEPORT__ 1
29
30#include <CoreFoundation/CFString.h>
31#include <CoreFoundation/CFRunLoop.h>
32#include <CoreFoundation/CFData.h>
33
34#if defined(__cplusplus)
35extern "C" {
36#endif
37
38typedef struct __CFMessagePort * CFMessagePortRef;
39
40enum {
41 kCFMessagePortSuccess = 0,
42 kCFMessagePortSendTimeout = -1,
43 kCFMessagePortReceiveTimeout = -2,
44 kCFMessagePortIsInvalid = -3,
45 kCFMessagePortTransportError = -4
46};
47
48typedef struct {
49 CFIndex version;
50 void * info;
51 const void *(*retain)(const void *info);
52 void (*release)(const void *info);
53 CFStringRef (*copyDescription)(const void *info);
54} CFMessagePortContext;
55
56typedef CFDataRef (*CFMessagePortCallBack)(CFMessagePortRef local, SInt32 msgid, CFDataRef data, void *info);
57/* If callout wants to keep a hold of the data past the return of the callout, it must COPY the data. This includes the case where the data is given to some routine which _might_ keep a hold of it; System will release returned CFData. */
58typedef void (*CFMessagePortInvalidationCallBack)(CFMessagePortRef ms, void *info);
59
60CF_EXPORT CFTypeID CFMessagePortGetTypeID(void);
61
62CF_EXPORT CFMessagePortRef CFMessagePortCreateLocal(CFAllocatorRef allocator, CFStringRef name, CFMessagePortCallBack callout, CFMessagePortContext *context, Boolean *shouldFreeInfo);
63CF_EXPORT CFMessagePortRef CFMessagePortCreateRemote(CFAllocatorRef allocator, CFStringRef name);
64
65CF_EXPORT Boolean CFMessagePortIsRemote(CFMessagePortRef ms);
66CF_EXPORT CFStringRef CFMessagePortGetName(CFMessagePortRef ms);
67CF_EXPORT Boolean CFMessagePortSetName(CFMessagePortRef ms, CFStringRef newName);
68CF_EXPORT void CFMessagePortGetContext(CFMessagePortRef ms, CFMessagePortContext *context);
69CF_EXPORT void CFMessagePortInvalidate(CFMessagePortRef ms);
70CF_EXPORT Boolean CFMessagePortIsValid(CFMessagePortRef ms);
71CF_EXPORT CFMessagePortInvalidationCallBack CFMessagePortGetInvalidationCallBack(CFMessagePortRef ms);
72CF_EXPORT void CFMessagePortSetInvalidationCallBack(CFMessagePortRef ms, CFMessagePortInvalidationCallBack callout);
73
74/* NULL replyMode argument means no return value expected, dont wait for it */
75CF_EXPORT SInt32 CFMessagePortSendRequest(CFMessagePortRef remote, SInt32 msgid, CFDataRef data, CFTimeInterval sendTimeout, CFTimeInterval rcvTimeout, CFStringRef replyMode, CFDataRef *returnData);
76
77CF_EXPORT CFRunLoopSourceRef CFMessagePortCreateRunLoopSource(CFAllocatorRef allocator, CFMessagePortRef local, CFIndex order);
78
79#if defined(__cplusplus)
80}
81#endif
82
83#endif /* ! __COREFOUNDATION_CFMESSAGEPORT__ */
84