]> git.saurik.com Git - apple/xnu.git/blame - osfmk/mach/rpc.h
xnu-792.6.76.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
A
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
37839358
A
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.
1c79356b 11 *
37839358
A
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
1c79356b
A
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
37839358
A
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.
1c79356b
A
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
1c79356b 43/*
9bccf70c
A
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.
1c79356b
A
48 */
49
1c79356b
A
50/*
51 * Basic mach rpc types.
52 */
53typedef unsigned int routine_arg_type;
54typedef unsigned int routine_arg_offset;
55typedef unsigned int routine_arg_size;
56
57/*
58 * Definitions for a signature's argument and routine descriptor's.
59 */
9bccf70c 60struct rpc_routine_arg_descriptor {
1c79356b
A
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};
9bccf70c 66typedef struct rpc_routine_arg_descriptor *rpc_routine_arg_descriptor_t;
1c79356b 67
9bccf70c 68struct rpc_routine_descriptor {
1c79356b
A
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 */
9bccf70c 74 rpc_routine_arg_descriptor_t
1c79356b
A
75 arg_descr; /* Pointer to beginning of */
76 /* the arg_descr array */
77 unsigned int max_reply_msg; /* Max size for reply msg */
78};
9bccf70c 79typedef struct rpc_routine_descriptor *rpc_routine_descriptor_t;
1c79356b 80
9bccf70c
A
81#define RPC_DESCR_SIZE(x) ((x)->descr_count * \
82 sizeof(struct rpc_routine_arg_descriptor))
1c79356b
A
83
84struct rpc_signature {
9bccf70c
A
85 struct rpc_routine_descriptor rd;
86 struct rpc_routine_arg_descriptor rad[1];
1c79356b
A
87};
88
1c79356b 89#define RPC_SIGBUF_SIZE 8
9bccf70c 90
1c79356b
A
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 */
109struct rpc_subsystem {
9bccf70c 110 void *reserved; /* Reserved for system use */
1c79356b
A
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
9bccf70c 117 struct rpc_routine_descriptor /* Array of routine descriptors */
1c79356b
A
118 routine[1 /* Actually, (start-end+1) */
119 ];
120
9bccf70c 121 struct rpc_routine_arg_descriptor
1c79356b
A
122 arg_descriptor[1 /* Actually, the sum of the descr_ */
123 ]; /* count fields for all routines */
124};
125typedef struct rpc_subsystem *rpc_subsystem_t;
126
127#define RPC_SUBSYSTEM_NULL ((rpc_subsystem_t) 0)
128
1c79356b 129#endif /* _MACH_RPC_H_ */