Structure - Specifies the content of an IPC message header.
typedef struct
{
       mach_msg_bits_t                     msgh_bits;
       mach_msg_size_t                     msgh_size;
       mach_port_t                  msgh_remote_port;
       mach_port_t                   msgh_local_port;
       mach_msg_size_t                 msgh_reserved;
       mach_msg_id_t                         msgh_id;
} mach_msg_header_t;
typedef struct
{
       mach_msg_size_t         msgh_descriptor_count;
} mach_msg_body_t;
typedef struct
{
       mach_msg_trailer_type_t     msgh_trailer_type;
       mach_msg_trailer_size_t     msgh_trailer_size;
} mach_msg_trailer_t;
typedef struct
{
       mach_msg_trailer_type_t     msgh_trailer_type;
       mach_msg_trailer_size_t     msgh_trailer_size;
       mach_port_seqno_t                  msgh_seqno;
} mach_msg_seqno_trailer_t;
typedef struct
{
       mach_msg_trailer_type_t    msgh_trailer_type;
       mach_msg_trailer_size_t    msgh_trailer_size;
       mach_port_seqno_t                 msgh_seqno;
       security_token_t                 msgh_sender;
} mach_msg_security_trailer_t;
typedef struct
{
       mach_msg_trailer_type_t    msgh_trailer_type;
       mach_msg_trailer_size_t    msgh_trailer_size;
       mach_port_seqno_t                 msgh_seqno;
       security_token_t                  msgh_sender;
       unsigned int                 dipc_sender_kmsg;
} mach_msg_dipc_trailer_t;
The mach_msg_header structure defines the fixed size header of a Mach message. The header is followed by a message body containing data and port descriptors and zero or more data bytes.
If the MACH_MSGH_BITS_COMPLEX flag in the msgh_bits field is not set, then this is a simple message described by mach_msg_header_t. In this case, the header is immediately followed by untyped data.
If the complex flag is set, then this is a "complex" message consisting of a mach_msg_header_t structure followed by a mach_msg_body_t structure containing a count followed by an array of descriptors specifying the disposition (processing) to be performed for the out-of-line memory regions and additional port rights.
Following the header (and any kernel processed descriptors), at natural alignment can be additional (un-typed) data, up to the size of the message (msgh_size). This extra data typically carries information used to decode the data stream and out-of-line data.
At the next natural boundary following the message data is the message trailer (mach_msg_trailer_t). This structure indicates the type and length of the trailer. If the length is greater than sizeof (mach_msg_trailer_t), additional fields follow providing kernel-generated message attributes.
Functions: mach_msg.
Data Structures: mach_msg_descriptor.