2 * Copyright (c) 2002,2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
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
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.
23 * @APPLE_LICENSE_HEADER_END@
30 * Mach RPC Subsystem Interfaces
36 #include <mach/boolean.h>
37 #include <mach/kern_return.h>
38 #include <mach/port.h>
39 #include <mach/vm_types.h>
42 #include <mach/mig_errors.h>
43 #include <mach/machine/rpc.h>
44 #include <mach/thread_status.h>
46 #include <sys/appleapiopts.h>
48 #ifdef __APPLE_API_OBSOLETE
51 * These are the types for RPC-specific variants of the MIG routine
52 * descriptor and subsystem data types.
54 * THIS IS ONLY FOR COMPATIBILITY. WE WILL NOT BE IMPLEMENTING THIS.
58 * Basic mach rpc types.
60 typedef unsigned int routine_arg_type
;
61 typedef unsigned int routine_arg_offset
;
62 typedef unsigned int routine_arg_size
;
65 * Definitions for a signature's argument and routine descriptor's.
67 struct rpc_routine_arg_descriptor
{
68 routine_arg_type type
; /* Port, Array, etc. */
69 routine_arg_size size
; /* element size in bytes */
70 routine_arg_size count
; /* number of elements */
71 routine_arg_offset offset
; /* Offset in list of routine args */
73 typedef struct rpc_routine_arg_descriptor
*rpc_routine_arg_descriptor_t
;
75 struct rpc_routine_descriptor
{
76 mig_impl_routine_t impl_routine
; /* Server work func pointer */
77 mig_stub_routine_t stub_routine
; /* Unmarshalling func pointer */
78 unsigned int argc
; /* Number of argument words */
79 unsigned int descr_count
; /* Number of complex argument */
81 rpc_routine_arg_descriptor_t
82 arg_descr
; /* Pointer to beginning of */
83 /* the arg_descr array */
84 unsigned int max_reply_msg
; /* Max size for reply msg */
86 typedef struct rpc_routine_descriptor
*rpc_routine_descriptor_t
;
88 #define RPC_DESCR_SIZE(x) ((x)->descr_count * \
89 sizeof(struct rpc_routine_arg_descriptor))
91 struct rpc_signature
{
92 struct rpc_routine_descriptor rd
;
93 struct rpc_routine_arg_descriptor rad
[1];
96 #define RPC_SIGBUF_SIZE 8
99 * A subsystem describes a set of server routines that can be invoked by
100 * mach_rpc() on the ports that are registered with the subsystem. For
101 * each routine, the routine number is given, along with the
102 * address of the implementation function in the server and a
103 * description of the arguments of the routine (it's "signature").
105 * This structure definition is only a template for what is really a
106 * variable-length structure (generated by MIG for each subsystem).
107 * The actual structures do not always have one entry in the routine
108 * array, and also have a varying number of entries in the arg_descr
109 * array. Each routine has an array of zero or more arg descriptors
110 * one for each complex arg. These arrays are all catenated together
111 * to form the arg_descr field of the subsystem struct. The
112 * arg_descr field of each routine entry points to a unique sub-sequence
113 * within this catenated array. The goal is to keep everything
116 struct rpc_subsystem
{
117 void *reserved
; /* Reserved for system use */
119 mach_msg_id_t start
; /* Min routine number */
120 mach_msg_id_t end
; /* Max routine number + 1 */
121 unsigned int maxsize
; /* Max mach_msg size */
122 vm_address_t base_addr
; /* Address of this struct in user */
124 struct rpc_routine_descriptor
/* Array of routine descriptors */
125 routine
[1 /* Actually, (start-end+1) */
128 struct rpc_routine_arg_descriptor
129 arg_descriptor
[1 /* Actually, the sum of the descr_ */
130 ]; /* count fields for all routines */
132 typedef struct rpc_subsystem
*rpc_subsystem_t
;
134 #define RPC_SUBSYSTEM_NULL ((rpc_subsystem_t) 0)
136 #endif /* __APPLE_API_OBSOLETE */
138 #endif /* _MACH_RPC_H_ */