2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
27 * Mach MIG Subsystem Interfaces
33 #include <mach/port.h>
34 #include <mach/message.h>
35 #include <mach/kern_return.h>
38 * Definition for MIG-generated server stub routines. These routines
39 * unpack the request message, call the server procedure, and pack the
42 typedef void (*mig_stub_routine_t
) (mach_msg_header_t
*InHeadP
,
43 mach_msg_header_t
*OutHeadP
);
45 typedef mig_stub_routine_t mig_routine_t
;
48 * Definition for MIG-generated server routine. This routine takes a
49 * message, and returns the appropriate stub function for handling that
52 typedef mig_routine_t (*mig_server_routine_t
) (mach_msg_header_t
*InHeadP
);
55 * Generic definition for implementation routines. These routines do
56 * the real work associated with this request. This generic type is
57 * used for keeping the pointers in the subsystem array.
59 typedef kern_return_t (*mig_impl_routine_t
)(void);
61 typedef struct mig_routine_descriptor
{
62 mig_stub_routine_t stub_routine
; /* Unmarshalling function */
63 mach_msg_size_t max_reply_msg
; /* Max size for this reply */
64 } mig_routine_descriptor
;
65 typedef mig_routine_descriptor
*mig_routine_descriptor_t
;
67 typedef struct mig_subsystem
{
68 mig_server_routine_t server
; /* server routine */
69 mach_msg_id_t start
; /* Min routine number */
70 mach_msg_id_t end
; /* Max routine number + 1 */
71 mach_msg_size_t max_reply
; /* Max reply message size */
72 mach_msg_size_t max_request
; /* Max request msg size */
73 mig_routine_descriptor routine
[1]; /* Routine descriptor array */
78 * MIG object runtime definitions
80 * Conforming MIG subsystems may enable this support to get
81 * significant assistance from the base mig_object_t implementation.
84 * - Transparency from port manipulation.
85 * - Dymanic port allocation on first "remoting" of an object.
86 * - Reference conversions from object to port and vice versa.
87 * - Automatic port deallocation on no-more-senders.
88 * - Support for multiple server implementations in a single space.
89 * - Messaging bypass for local servers.
90 * - Automatic hookup to base dispatch mechanism.
91 * - General notification support
93 * - User-level support
95 typedef unsigned int mig_notify_type_t
;
97 typedef struct MIGIID
{
100 unsigned short data3
;
101 unsigned char data4
[8];
104 typedef struct IMIGObjectVtbl IMIGObjectVtbl
;
105 typedef struct IMIGNotifyObjectVtbl IMIGNotifyObjectVtbl
;
107 typedef struct IMIGObject
{
108 IMIGObjectVtbl
*pVtbl
;
111 typedef struct IMIGNotifyObject
{
112 IMIGNotifyObjectVtbl
*pVtbl
;
115 struct IMIGObjectVtbl
{
116 kern_return_t (*QueryInterface
)(
121 unsigned long (*AddRef
)(
124 unsigned long (*Release
)(
127 unsigned long (*GetServer
)(
129 mig_server_routine_t
*server
);
131 boolean_t (*RaiseNotification
)(
133 mig_notify_type_t notify_type
);
135 boolean_t (*RequestNotification
)(
137 IMIGNotifyObject
*notify
,
138 mig_notify_type_t notify_type
);
144 * A variant of the IMIGObject interface that is a sink for
147 * A reference is held on both the subject MIGObject and the target
148 * MIGNotifyObject. Because of this, care must be exercised to avoid
149 * reference cycles. Once a notification is raised, the object
150 * reference is returned and the request must be re-requested (if
153 * One interesting note: because this interface is itself a MIG
154 * object, one may request notification about state changes in
155 * the MIGNotifyObject itself.
157 struct IMIGNotifyObjectVtbl
{
158 kern_return_t (*QueryInterface
)(
159 IMIGNotifyObject
*notify
,
163 unsigned long (*AddRef
)(
164 IMIGNotifyObject
*notify
);
166 unsigned long (*Release
)(
167 IMIGNotifyObject
*notify
);
169 unsigned long (*GetServer
)(
170 IMIGNotifyObject
*notify
,
171 mig_server_routine_t
*server
);
173 boolean_t (*RaiseNotification
)(
174 IMIGNotifyObject
*notify
,
175 mig_notify_type_t notify_type
);
177 boolean_t (*RequestNotification
)(
178 IMIGNotifyObject
*notify
,
179 IMIGNotifyObject
*notify_notify
,
180 mig_notify_type_t notify_type
);
182 void (*HandleNotification
)(
183 IMIGNotifyObject
*notify
,
185 mig_notify_type_t notify_type
);
188 #endif /* KERNEL_PRIVATE */
190 #endif /* _MACH_MIG_H_ */