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