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