2 * Copyright (c) 2002,2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
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. The rights granted to you under the
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
35 * Mach RPC Subsystem Interfaces
41 #include <mach/boolean.h>
42 #include <mach/kern_return.h>
43 #include <mach/port.h>
44 #include <mach/vm_types.h>
47 #include <mach/mig_errors.h>
48 #include <mach/machine/rpc.h>
49 #include <mach/thread_status.h>
52 * These are the types for RPC-specific variants of the MIG routine
53 * descriptor and subsystem data types.
55 * THIS IS ONLY FOR COMPATIBILITY. WE WILL NOT BE IMPLEMENTING THIS.
59 * Basic mach rpc types.
61 typedef unsigned int routine_arg_type
;
62 typedef unsigned int routine_arg_offset
;
63 typedef unsigned int routine_arg_size
;
66 * Definitions for a signature's argument and routine descriptor's.
68 struct rpc_routine_arg_descriptor
{
69 routine_arg_type type
; /* Port, Array, etc. */
70 routine_arg_size size
; /* element size in bytes */
71 routine_arg_size count
; /* number of elements */
72 routine_arg_offset offset
; /* Offset in list of routine args */
74 typedef struct rpc_routine_arg_descriptor
*rpc_routine_arg_descriptor_t
;
76 struct rpc_routine_descriptor
{
77 mig_impl_routine_t impl_routine
; /* Server work func pointer */
78 mig_stub_routine_t stub_routine
; /* Unmarshalling func pointer */
79 unsigned int argc
; /* Number of argument words */
80 unsigned int descr_count
; /* Number of complex argument */
82 rpc_routine_arg_descriptor_t
83 arg_descr
; /* Pointer to beginning of */
84 /* the arg_descr array */
85 unsigned int max_reply_msg
; /* Max size for reply msg */
87 typedef struct rpc_routine_descriptor
*rpc_routine_descriptor_t
;
89 #define RPC_DESCR_SIZE(x) ((x)->descr_count * \
90 sizeof(struct rpc_routine_arg_descriptor))
92 struct rpc_signature
{
93 struct rpc_routine_descriptor rd
;
94 struct rpc_routine_arg_descriptor rad
[1];
97 #define RPC_SIGBUF_SIZE 8
100 * A subsystem describes a set of server routines that can be invoked by
101 * mach_rpc() on the ports that are registered with the subsystem. For
102 * each routine, the routine number is given, along with the
103 * address of the implementation function in the server and a
104 * description of the arguments of the routine (it's "signature").
106 * This structure definition is only a template for what is really a
107 * variable-length structure (generated by MIG for each subsystem).
108 * The actual structures do not always have one entry in the routine
109 * array, and also have a varying number of entries in the arg_descr
110 * array. Each routine has an array of zero or more arg descriptors
111 * one for each complex arg. These arrays are all catenated together
112 * to form the arg_descr field of the subsystem struct. The
113 * arg_descr field of each routine entry points to a unique sub-sequence
114 * within this catenated array. The goal is to keep everything
117 struct rpc_subsystem
{
118 void *reserved
; /* Reserved for system use */
120 mach_msg_id_t start
; /* Min routine number */
121 mach_msg_id_t end
; /* Max routine number + 1 */
122 unsigned int maxsize
; /* Max mach_msg size */
123 vm_address_t base_addr
; /* Address of this struct in user */
125 struct rpc_routine_descriptor
/* Array of routine descriptors */
126 routine
[1 /* Actually, (start-end+1) */
129 struct rpc_routine_arg_descriptor
130 arg_descriptor
[1 /* Actually, the sum of the descr_ */
131 ]; /* count fields for all routines */
133 typedef struct rpc_subsystem
*rpc_subsystem_t
;
135 #define RPC_SUBSYSTEM_NULL ((rpc_subsystem_t) 0)
137 #endif /* _MACH_RPC_H_ */