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