xref: /xnu-8796.121.2/osfmk/man/mach_msg_header.html (revision c54f35ca767986246321eb901baf8f5ff7923f6a)
1*c54f35caSApple OSS Distributions<h2>mach_msg_header</h2>
2*c54f35caSApple OSS Distributions<hr>
3*c54f35caSApple OSS Distributions<p>
4*c54f35caSApple OSS Distributions<strong>Structure</strong> - Specifies the content of an IPC message header.
5*c54f35caSApple OSS Distributions<h3>SYNOPSIS</h3>
6*c54f35caSApple OSS Distributions<pre>
7*c54f35caSApple OSS Distributions<strong>typedef struct</strong>
8*c54f35caSApple OSS Distributions<strong>{</strong>
9*c54f35caSApple OSS Distributions       <strong>mach_msg_bits_t </strong>                    <var>msgh_bits</var><strong>;</strong>
10*c54f35caSApple OSS Distributions       <strong>mach_msg_size_t</strong>                     <var>msgh_size</var><strong>;</strong>
11*c54f35caSApple OSS Distributions       <strong>mach_port_t</strong>                  <var>msgh_remote_port</var><strong>;</strong>
12*c54f35caSApple OSS Distributions       <strong>mach_port_t</strong>                   <var>msgh_local_port</var><strong>;</strong>
13*c54f35caSApple OSS Distributions       <strong>mach_msg_size_t</strong>                 <var>msgh_reserved</var><strong>;</strong>
14*c54f35caSApple OSS Distributions       <strong>mach_msg_id_t</strong>                         <var>msgh_id</var><strong>;</strong>
15*c54f35caSApple OSS Distributions<strong>} mach_msg_header_t;</strong>
16*c54f35caSApple OSS Distributions
17*c54f35caSApple OSS Distributions<strong>typedef struct</strong>
18*c54f35caSApple OSS Distributions<strong>{</strong>
19*c54f35caSApple OSS Distributions       <strong>mach_msg_size_t</strong>         <var>msgh_descriptor_count</var><strong>;</strong>
20*c54f35caSApple OSS Distributions<strong>} mach_msg_body_t;</strong>
21*c54f35caSApple OSS Distributions
22*c54f35caSApple OSS Distributions<strong>typedef struct</strong>
23*c54f35caSApple OSS Distributions<strong>{</strong>
24*c54f35caSApple OSS Distributions       <strong>mach_msg_trailer_type_t</strong>     <var>msgh_trailer_type</var><strong>;</strong>
25*c54f35caSApple OSS Distributions       <strong>mach_msg_trailer_size_t</strong>     <var>msgh_trailer_size</var><strong>;</strong>
26*c54f35caSApple OSS Distributions<strong>} mach_msg_trailer_t;</strong>
27*c54f35caSApple OSS Distributions
28*c54f35caSApple OSS Distributions<strong>typedef struct</strong>
29*c54f35caSApple OSS Distributions<strong>{</strong>
30*c54f35caSApple OSS Distributions       <strong>mach_msg_trailer_type_t</strong>     <var>msgh_trailer_type</var><strong>;</strong>
31*c54f35caSApple OSS Distributions       <strong>mach_msg_trailer_size_t</strong>     <var>msgh_trailer_size</var><strong>;</strong>
32*c54f35caSApple OSS Distributions       <strong>mach_port_seqno_t</strong>                  <var>msgh_seqno</var><strong>;</strong>
33*c54f35caSApple OSS Distributions<strong>} mach_msg_seqno_trailer_t;</strong>
34*c54f35caSApple OSS Distributions
35*c54f35caSApple OSS Distributions<strong>typedef struct</strong>
36*c54f35caSApple OSS Distributions<strong>{</strong>
37*c54f35caSApple OSS Distributions       <strong>mach_msg_trailer_type_t</strong>    <var>msgh_trailer_type</var><strong>;</strong>
38*c54f35caSApple OSS Distributions       <strong>mach_msg_trailer_size_t</strong>    <var>msgh_trailer_size</var><strong>;</strong>
39*c54f35caSApple OSS Distributions       <strong>mach_port_seqno_t</strong>                 <var>msgh_seqno</var><strong>;</strong>
40*c54f35caSApple OSS Distributions       <strong>security_token_t</strong>                 <var>msgh_sender</var><strong>;</strong>
41*c54f35caSApple OSS Distributions<strong>} mach_msg_security_trailer_t;</strong>
42*c54f35caSApple OSS Distributions
43*c54f35caSApple OSS Distributions<strong>typedef struct</strong>
44*c54f35caSApple OSS Distributions<strong>{</strong>
45*c54f35caSApple OSS Distributions       <strong>mach_msg_trailer_type_t</strong>    <var>msgh_trailer_type</var><strong>;</strong>
46*c54f35caSApple OSS Distributions       <strong>mach_msg_trailer_size_t</strong>    <var>msgh_trailer_size</var><strong>;</strong>
47*c54f35caSApple OSS Distributions       <strong>mach_port_seqno_t</strong>                 <var>msgh_seqno</var><strong>;</strong>
48*c54f35caSApple OSS Distributions       <strong>security_token_t</strong>                  <var>msgh_sender</var><strong>;</strong>
49*c54f35caSApple OSS Distributions       <strong>unsigned int</strong>                 <var>dipc_sender_kmsg</var><strong>;</strong>
50*c54f35caSApple OSS Distributions<strong>} mach_msg_dipc_trailer_t;</strong>
51*c54f35caSApple OSS Distributions</pre>
52*c54f35caSApple OSS Distributions<h3>FIELDS</h3>
53*c54f35caSApple OSS Distributions<dl>
54*c54f35caSApple OSS Distributions<dt> <var>msgh_bits</var>
55*c54f35caSApple OSS Distributions<dd>
56*c54f35caSApple OSS DistributionsThis field specifies the following properties of the message:
57*c54f35caSApple OSS Distributions<dl>
58*c54f35caSApple OSS Distributions  <p>
59*c54f35caSApple OSS Distributions<dt> <strong>MACH_MSGH_BITS_REMOTE_MASK</strong>
60*c54f35caSApple OSS Distributions<dd>
61*c54f35caSApple OSS DistributionsEncodes <var>mach_msg_type_name_t</var> values that specify the port
62*c54f35caSApple OSS Distributionsrights in the <var>msgh_remote_port</var> field.  The value must specify
63*c54f35caSApple OSS Distributionsa send or send-once right for the destination of the message.
64*c54f35caSApple OSS Distributions     <p>
65*c54f35caSApple OSS Distributions<dt> <strong>MACH_MSGH_BITS_LOCAL_MASK</strong>
66*c54f35caSApple OSS Distributions<dd>
67*c54f35caSApple OSS DistributionsEncodes <var>mach_msg_type_name_t</var> values that specify the port
68*c54f35caSApple OSS Distributionsrights in the <var>msgh_local_port</var> field.  If the value doesn't
69*c54f35caSApple OSS Distributionsspecify a send or send-once right for the message's reply port, it
70*c54f35caSApple OSS Distributionsmust be zero and <var>msgh_local_port</var> must be <strong>MACH_PORT_NULL</strong>.
71*c54f35caSApple OSS Distributions     <p>
72*c54f35caSApple OSS Distributions<dt> <strong>MACH_MSGH_BITS_COMPLEX</strong>
73*c54f35caSApple OSS Distributions<dd>
74*c54f35caSApple OSS DistributionsThe complex bit must be specified if the message body
75*c54f35caSApple OSS Distributionscontains additional port rights or out-of-line memory regions.
76*c54f35caSApple OSS Distributions     <p>
77*c54f35caSApple OSS Distributions<dt> <strong>MACH_MSGH_BITS_REMOTE</strong>(<var>bits</var>)
78*c54f35caSApple OSS Distributions<dd>
79*c54f35caSApple OSS DistributionsThis macro returns the appropriate <var>mach_msg_type_name_t</var>
80*c54f35caSApple OSS Distributionsvalues, given a <var>msgh_bits</var> value.
81*c54f35caSApple OSS Distributions     <p>
82*c54f35caSApple OSS Distributions<dt> <strong>MACH_MSGH_BITS_LOCAL</strong>(<var>bits</var>)
83*c54f35caSApple OSS Distributions<dd>
84*c54f35caSApple OSS DistributionsThis macro returns the appropriate <var>mach_msg_type_name_t</var>
85*c54f35caSApple OSS Distributionsvalues, given a <var>msgh_bits</var> value.
86*c54f35caSApple OSS Distributions     <p>
87*c54f35caSApple OSS Distributions<dt> <strong>MACH_MSGH_BITS</strong>(<var>remote</var>, <var>local</var>)
88*c54f35caSApple OSS Distributions<dd>
89*c54f35caSApple OSS DistributionsThis macro constructs a value for <var>msgh_bits</var>, given two
90*c54f35caSApple OSS Distributions<var>mach_msg_type_name_t</var> values.
91*c54f35caSApple OSS Distributions</dl>
92*c54f35caSApple OSS Distributions<p>
93*c54f35caSApple OSS Distributions<dt> <var>msgh_size</var>
94*c54f35caSApple OSS Distributions<dd>
95*c54f35caSApple OSS DistributionsThis field is ignored on send (the size to send is specified by the
96*c54f35caSApple OSS Distributions<var>send_size</var> parameter to <strong>mach_msg</strong>); the field is set on
97*c54f35caSApple OSS Distributionsreceive to the sum of
98*c54f35caSApple OSS Distributionsthe message header and body sizes (in bytes).  Note that this value may
99*c54f35caSApple OSS Distributionsbe different from the send size specified by the sender if the sender and
100*c54f35caSApple OSS Distributionsreceiver machines have differing sizes for port names, memory
101*c54f35caSApple OSS Distributionsaddresses or memory range sizes.
102*c54f35caSApple OSS Distributions     <p>
103*c54f35caSApple OSS Distributions<dt> <var>msgh_remote_port</var>
104*c54f35caSApple OSS Distributions<dd>
105*c54f35caSApple OSS DistributionsWhen sending, specifies the destination port of the message.  The field
106*c54f35caSApple OSS Distributionsmust carry a legitimate send or send-once right for a port.  When
107*c54f35caSApple OSS Distributionsreceived, this field is swapped with <var>msgh_local_port</var>.
108*c54f35caSApple OSS Distributions     <p>
109*c54f35caSApple OSS Distributions<dt> <var>msgh_local_port</var>
110*c54f35caSApple OSS Distributions<dd>
111*c54f35caSApple OSS DistributionsWhen sending, specifies an auxiliary port right, which is
112*c54f35caSApple OSS Distributionsconventionally used as a reply port by the recipient of the message.
113*c54f35caSApple OSS DistributionsThe field must
114*c54f35caSApple OSS Distributionscarry a send right, a send-once right, <strong>MACH_PORT_NULL</strong>, or
115*c54f35caSApple OSS Distributions<strong>MACH_PORT_DEAD</strong>.  When received, this field is swapped with
116*c54f35caSApple OSS Distributions<var>msgh_remote_port</var>.
117*c54f35caSApple OSS Distributions     <p>
118*c54f35caSApple OSS Distributions<dt> <var>msgh_id</var>
119*c54f35caSApple OSS Distributions<dd>
120*c54f35caSApple OSS DistributionsNot set or read by the <strong>mach_msg</strong> call.  The conventional meaning is to
121*c54f35caSApple OSS Distributionsconvey an operation or function ID.
122*c54f35caSApple OSS Distributions     <p>
123*c54f35caSApple OSS Distributions<dt> <var>msgh_descriptor_count</var>
124*c54f35caSApple OSS Distributions<dd>
125*c54f35caSApple OSS DistributionsThe number of descriptors of kernel processed data (port rights and
126*c54f35caSApple OSS Distributionsout-of-line data).
127*c54f35caSApple OSS Distributions     <p>
128*c54f35caSApple OSS Distributions<dt> <var>msgh_trailer_type</var>
129*c54f35caSApple OSS Distributions<dd>
130*c54f35caSApple OSS DistributionsAn identifier of the trailer version.  Different values indicate not
131*c54f35caSApple OSS Distributionsnecessarily compatible trailer formats.  The current (and only) trailer format
132*c54f35caSApple OSS Distributionsis <strong>MACH_MSG_TRAILER_FORMAT_0</strong>.  There is currently only one
133*c54f35caSApple OSS Distributionsattribute defined within this trailer type: the sender's identity.
134*c54f35caSApple OSS Distributions     <p>
135*c54f35caSApple OSS Distributions<dt> <var>msgh_trailer_size</var>
136*c54f35caSApple OSS Distributions<dd>
137*c54f35caSApple OSS DistributionsThe length, in bytes, of the message trailer, including the trailer type
138*c54f35caSApple OSS Distributionsand length fields.
139*c54f35caSApple OSS Distributions     <p>
140*c54f35caSApple OSS Distributions<dt> <var>msgh_seqno</var>
141*c54f35caSApple OSS Distributions<dd>
142*c54f35caSApple OSS DistributionsThe sequence number of this message relative to the port from which it
143*c54f35caSApple OSS Distributionsis received.
144*c54f35caSApple OSS Distributions     <p>
145*c54f35caSApple OSS Distributions<dt> <var>msgh_sender</var>
146*c54f35caSApple OSS Distributions<dd>
147*c54f35caSApple OSS DistributionsThe security ID of the sender of the message.
148*c54f35caSApple OSS Distributions</dl>
149*c54f35caSApple OSS Distributions<h3>DESCRIPTION</h3>
150*c54f35caSApple OSS Distributions<p>
151*c54f35caSApple OSS DistributionsThe <strong>mach_msg_header</strong> structure defines the fixed size header of a Mach
152*c54f35caSApple OSS Distributionsmessage.  The header is followed by a message body containing data and port
153*c54f35caSApple OSS Distributionsdescriptors and zero or more data bytes.
154*c54f35caSApple OSS Distributions<p>
155*c54f35caSApple OSS DistributionsIf the <strong>MACH_MSGH_BITS_COMPLEX</strong> flag in the <var>msgh_bits</var> field is not set,
156*c54f35caSApple OSS Distributionsthen this is a simple message described by <strong>mach_msg_header_t</strong>.
157*c54f35caSApple OSS DistributionsIn this case, the header is immediately followed by untyped data.
158*c54f35caSApple OSS Distributions<p>
159*c54f35caSApple OSS DistributionsIf the complex flag is set, then this is a "complex" message consisting of a
160*c54f35caSApple OSS Distributions<strong>mach_msg_header_t</strong> structure followed by a <strong>mach_msg_body_t</strong> structure
161*c54f35caSApple OSS Distributionscontaining a count followed by an array of descriptors specifying
162*c54f35caSApple OSS Distributionsthe disposition
163*c54f35caSApple OSS Distributions(processing) to be performed for the out-of-line memory regions and additional
164*c54f35caSApple OSS Distributionsport rights.
165*c54f35caSApple OSS Distributions<p>
166*c54f35caSApple OSS DistributionsFollowing the header (and any kernel processed descriptors), at natural
167*c54f35caSApple OSS Distributionsalignment can be additional (un-typed) data, up to the size of the message
168*c54f35caSApple OSS Distributions(<var>msgh_size</var>).  This extra data typically carries information
169*c54f35caSApple OSS Distributionsused to decode the data stream and out-of-line data.
170*c54f35caSApple OSS Distributions<p>
171*c54f35caSApple OSS DistributionsAt the next natural boundary following the message data is the message trailer
172*c54f35caSApple OSS Distributions(<strong>mach_msg_trailer_t</strong>).  This structure indicates the type and length of the
173*c54f35caSApple OSS Distributionstrailer.  If the length is greater than sizeof (<strong>mach_msg_trailer_t</strong>),
174*c54f35caSApple OSS Distributionsadditional fields
175*c54f35caSApple OSS Distributionsfollow providing kernel-generated message attributes.
176*c54f35caSApple OSS Distributions<h3>RELATED INFORMATION</h3>
177*c54f35caSApple OSS Distributions<p>
178*c54f35caSApple OSS DistributionsFunctions:
179*c54f35caSApple OSS Distributions<a href="mach_msg.html"><strong>mach_msg</strong></a>.
180*c54f35caSApple OSS Distributions<p>
181*c54f35caSApple OSS DistributionsData Structures:
182*c54f35caSApple OSS Distributions<a href="mach_msg_descriptor.html"><strong>mach_msg_descriptor</strong></a>.
183*c54f35caSApple OSS Distributions
184