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