]> git.saurik.com Git - apple/xnu.git/blame - osfmk/mach/rpc.h
xnu-6153.121.1.tar.gz
[apple/xnu.git] / osfmk / mach / rpc.h
CommitLineData
1c79356b 1/*
9bccf70c 2 * Copyright (c) 2002,2000 Apple Computer, Inc. All rights reserved.
1c79356b 3 *
2d21ac55 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
0a7de745 5 *
2d21ac55
A
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.
0a7de745 14 *
2d21ac55
A
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
0a7de745 17 *
2d21ac55
A
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
8f6c56a5
A
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
2d21ac55
A
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.
0a7de745 25 *
2d21ac55 26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
1c79356b
A
27 */
28/*
29 * @OSF_COPYRIGHT@
30 */
31
32/*
33 * Mach RPC Subsystem Interfaces
34 */
35
0a7de745 36#ifndef _MACH_RPC_H_
1c79356b
A
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
1c79356b 49/*
9bccf70c
A
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.
1c79356b
A
54 */
55
1c79356b
A
56/*
57 * Basic mach rpc types.
58 */
59typedef unsigned int routine_arg_type;
0a7de745
A
60typedef unsigned int routine_arg_offset;
61typedef unsigned int routine_arg_size;
1c79356b
A
62
63/*
64 * Definitions for a signature's argument and routine descriptor's.
65 */
9bccf70c 66struct rpc_routine_arg_descriptor {
0a7de745
A
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 */
1c79356b 71};
9bccf70c 72typedef struct rpc_routine_arg_descriptor *rpc_routine_arg_descriptor_t;
1c79356b 73
9bccf70c 74struct rpc_routine_descriptor {
0a7de745
A
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 */
9bccf70c 80 rpc_routine_arg_descriptor_t
0a7de745
A
81 arg_descr; /* Pointer to beginning of */
82 /* the arg_descr array */
83 unsigned int max_reply_msg; /* Max size for reply msg */
1c79356b 84};
9bccf70c 85typedef struct rpc_routine_descriptor *rpc_routine_descriptor_t;
1c79356b 86
9bccf70c 87#define RPC_DESCR_SIZE(x) ((x)->descr_count * \
0a7de745 88 sizeof(struct rpc_routine_arg_descriptor))
1c79356b
A
89
90struct rpc_signature {
0a7de745
A
91 struct rpc_routine_descriptor rd;
92 struct rpc_routine_arg_descriptor rad[1];
1c79356b
A
93};
94
1c79356b 95#define RPC_SIGBUF_SIZE 8
9bccf70c 96
1c79356b
A
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 */
115struct rpc_subsystem {
0a7de745 116 void *reserved; /* Reserved for system use */
1c79356b 117
0a7de745
A
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 */
1c79356b 122
0a7de745
A
123 struct rpc_routine_descriptor /* Array of routine descriptors */
124 routine[1 /* Actually, (start-end+1) */
125 ];
1c79356b 126
9bccf70c 127 struct rpc_routine_arg_descriptor
0a7de745
A
128 arg_descriptor[1 /* Actually, the sum of the descr_ */
129 ]; /* count fields for all routines */
1c79356b
A
130};
131typedef struct rpc_subsystem *rpc_subsystem_t;
132
0a7de745 133#define RPC_SUBSYSTEM_NULL ((rpc_subsystem_t) 0)
1c79356b 134
0a7de745 135#endif /* _MACH_RPC_H_ */