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