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