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