2 * Copyright (c) 2002,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 RPC Subsystem Interfaces
33 #include <mach/boolean.h>
34 #include <mach/kern_return.h>
35 #include <mach/port.h>
36 #include <mach/vm_types.h>
39 #include <mach/mig_errors.h>
40 #include <mach/machine/rpc.h>
41 #include <mach/thread_status.h>
43 #include <sys/appleapiopts.h>
45 #ifdef __APPLE_API_OBSOLETE
48 * These are the types for RPC-specific variants of the MIG routine
49 * descriptor and subsystem data types.
51 * THIS IS ONLY FOR COMPATIBILITY. WE WILL NOT BE IMPLEMENTING THIS.
55 * Basic mach rpc types.
57 typedef unsigned int routine_arg_type
;
58 typedef unsigned int routine_arg_offset
;
59 typedef unsigned int routine_arg_size
;
62 * Definitions for a signature's argument and routine descriptor's.
64 struct rpc_routine_arg_descriptor
{
65 routine_arg_type type
; /* Port, Array, etc. */
66 routine_arg_size size
; /* element size in bytes */
67 routine_arg_size count
; /* number of elements */
68 routine_arg_offset offset
; /* Offset in list of routine args */
70 typedef struct rpc_routine_arg_descriptor
*rpc_routine_arg_descriptor_t
;
72 struct rpc_routine_descriptor
{
73 mig_impl_routine_t impl_routine
; /* Server work func pointer */
74 mig_stub_routine_t stub_routine
; /* Unmarshalling func pointer */
75 unsigned int argc
; /* Number of argument words */
76 unsigned int descr_count
; /* Number of complex argument */
78 rpc_routine_arg_descriptor_t
79 arg_descr
; /* Pointer to beginning of */
80 /* the arg_descr array */
81 unsigned int max_reply_msg
; /* Max size for reply msg */
83 typedef struct rpc_routine_descriptor
*rpc_routine_descriptor_t
;
85 #define RPC_DESCR_SIZE(x) ((x)->descr_count * \
86 sizeof(struct rpc_routine_arg_descriptor))
88 struct rpc_signature
{
89 struct rpc_routine_descriptor rd
;
90 struct rpc_routine_arg_descriptor rad
[1];
93 #define RPC_SIGBUF_SIZE 8
96 * A subsystem describes a set of server routines that can be invoked by
97 * mach_rpc() on the ports that are registered with the subsystem. For
98 * each routine, the routine number is given, along with the
99 * address of the implementation function in the server and a
100 * description of the arguments of the routine (it's "signature").
102 * This structure definition is only a template for what is really a
103 * variable-length structure (generated by MIG for each subsystem).
104 * The actual structures do not always have one entry in the routine
105 * array, and also have a varying number of entries in the arg_descr
106 * array. Each routine has an array of zero or more arg descriptors
107 * one for each complex arg. These arrays are all catenated together
108 * to form the arg_descr field of the subsystem struct. The
109 * arg_descr field of each routine entry points to a unique sub-sequence
110 * within this catenated array. The goal is to keep everything
113 struct rpc_subsystem
{
114 void *reserved
; /* Reserved for system use */
116 mach_msg_id_t start
; /* Min routine number */
117 mach_msg_id_t end
; /* Max routine number + 1 */
118 unsigned int maxsize
; /* Max mach_msg size */
119 vm_address_t base_addr
; /* Address of this struct in user */
121 struct rpc_routine_descriptor
/* Array of routine descriptors */
122 routine
[1 /* Actually, (start-end+1) */
125 struct rpc_routine_arg_descriptor
126 arg_descriptor
[1 /* Actually, the sum of the descr_ */
127 ]; /* count fields for all routines */
129 typedef struct rpc_subsystem
*rpc_subsystem_t
;
131 #define RPC_SUBSYSTEM_NULL ((rpc_subsystem_t) 0)
133 #endif /* __APPLE_API_OBSOLETE */
135 #endif /* _MACH_RPC_H_ */