/* * Copyright (c) 1994, 1995, 1996, 1997 The University of Utah and * the Computer Systems Laboratory at the University of Utah (CSL). * * This file is part of Flick, the Flexible IDL Compiler Kit. * * Flick is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Flick is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Flick; see the file COPYING. If not, write to * the Free Software Foundation, 59 Temple Place #330, Boston, MA 02111, USA. */ #ifndef _MIG_MESSAGE_H #define _MIG_MESSAGE_H /* * This file is a substitute for mach/message.h, * to be used within MIG sources compiled for the build machine. * This way we avoid pulling in all the bogus typedefs and stuff * that would normally come with mach/message.h. */ #define word_size (4) #define word_size_in_bits (8 * word_size) typedef int integer_t; typedef int natural_t; /* From . */ typedef natural_t mach_port_t; typedef natural_t mach_port_seqno_t; /* * Mach Operating System * Copyright (c) 1992-1987 Carnegie Mellon University * All Rights Reserved. * * Permission to use, copy, modify and distribute this software and its * documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. * * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. * * Carnegie Mellon requests users of this software to return to * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU * School of Computer Science * Carnegie Mellon University * Pittsburgh PA 15213-3890 * * any improvements or extensions that they make and grant Carnegie Mellon * the rights to redistribute these changes. */ /* * Every message starts with a message header. * Following the message header are zero or more pairs of * type descriptors (mach_msg_type_t/mach_msg_type_long_t) and * data values. The size of the message must be specified in bytes, * and includes the message header, type descriptors, inline * data, and inline pointer for out-of-line data. * * The msgh_remote_port field specifies the destination of the message. * It must specify a valid send or send-once right for a port. * * The msgh_local_port field specifies a "reply port". Normally, * This field carries a send-once right that the receiver will use * to reply to the message. It may carry the values MACH_PORT_NULL, * MACH_PORT_DEAD, a send-once right, or a send right. * * The msgh_seqno field carries a sequence number associated with the * received-from port. A port's sequence number is incremented every * time a message is received from it. In sent messages, the field's * value is ignored. * * The msgh_id field is uninterpreted by the message primitives. * It normally carries information specifying the format * or meaning of the message. */ typedef unsigned int mach_msg_bits_t; typedef unsigned int mach_msg_size_t; typedef natural_t mach_msg_seqno_t; typedef integer_t mach_msg_id_t; 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_port_seqno_t msgh_seqno; mach_msg_id_t msgh_id; } mach_msg_header_t; /* * The msgt_number field specifies the number of data elements. * The msgt_size field specifies the size of each data element, in bits. * The msgt_name field specifies the type of each data element. * If msgt_inline is TRUE, the data follows the type descriptor * in the body of the message. If msgt_inline is FALSE, then a pointer * to the data should follow the type descriptor, and the data is * sent out-of-line. In this case, if msgt_deallocate is TRUE, * then the out-of-line data is moved (instead of copied) into the message. * If msgt_longform is TRUE, then the type descriptor is actually * a mach_msg_type_long_t. * * The actual amount of inline data following the descriptor must * a multiple of the word size. For out-of-line data, this is a * pointer. For inline data, the supplied data size (calculated * from msgt_number/msgt_size) is rounded up. This guarantees * that type descriptors always fall on word boundaries. * * For port rights, msgt_size must be 8*sizeof(mach_port_t). * If the data is inline, msgt_deallocate should be FALSE. * The msgt_unused bit should be zero. * The msgt_name, msgt_size, msgt_number fields in * a mach_msg_type_long_t should be zero. */ typedef unsigned int mach_msg_type_name_t; typedef unsigned int mach_msg_type_size_t; typedef natural_t mach_msg_type_number_t; typedef struct { unsigned int msgt_name : 8, msgt_size : 8, msgt_number : 12, msgt_inline : 1, msgt_longform : 1, msgt_deallocate : 1, msgt_unused : 1; } mach_msg_type_t; typedef struct { mach_msg_type_t msgtl_header; unsigned short msgtl_name; unsigned short msgtl_size; natural_t msgtl_number; } mach_msg_type_long_t; #define sizeof_mach_msg_header_t (sizeof(mach_msg_header_t)) #define sizeof_mach_msg_type_t (sizeof(mach_msg_type_t)) #define sizeof_mach_msg_type_long_t (sizeof(mach_msg_type_long_t)) #define sizeof_pointer (sizeof(void *)) /* * Known values for the msgt_name field. * * The only types known to the Mach kernel are * the port types, and those types used in the * kernel RPC interface. */ #define MACH_MSG_TYPE_UNSTRUCTURED 0 #define MACH_MSG_TYPE_BIT 0 #define MACH_MSG_TYPE_BOOLEAN 0 #define MACH_MSG_TYPE_INTEGER_16 1 #define MACH_MSG_TYPE_INTEGER_32 2 #define MACH_MSG_TYPE_CHAR 8 #define MACH_MSG_TYPE_BYTE 9 #define MACH_MSG_TYPE_INTEGER_8 9 #define MACH_MSG_TYPE_REAL 10 #define MACH_MSG_TYPE_INTEGER_64 11 #define MACH_MSG_TYPE_STRING 12 #define MACH_MSG_TYPE_STRING_C 12 /* * Values used when sending a port right. */ #define MACH_MSG_TYPE_MOVE_RECEIVE 16 /* Must hold receive rights */ #define MACH_MSG_TYPE_MOVE_SEND 17 /* Must hold send rights */ #define MACH_MSG_TYPE_MOVE_SEND_ONCE 18 /* Must hold sendonce rights */ #define MACH_MSG_TYPE_COPY_SEND 19 /* Must hold send rights */ #define MACH_MSG_TYPE_MAKE_SEND 20 /* Must hold receive rights */ #define MACH_MSG_TYPE_MAKE_SEND_ONCE 21 /* Must hold receive rights */ /* * Values received/carried in messages. Tells the receiver what * sort of port right he now has. * * MACH_MSG_TYPE_PORT_NAME is used to transfer a port name * which should remain uninterpreted by the kernel. (Port rights * are not transferred, just the port name.) */ #define MACH_MSG_TYPE_PORT_NAME 15 #define MACH_MSG_TYPE_PORT_RECEIVE MACH_MSG_TYPE_MOVE_RECEIVE #define MACH_MSG_TYPE_PORT_SEND MACH_MSG_TYPE_MOVE_SEND #define MACH_MSG_TYPE_PORT_SEND_ONCE MACH_MSG_TYPE_MOVE_SEND_ONCE #define MACH_MSG_TYPE_LAST 22 /* Last assigned */ /* * A dummy value. Mostly used to indicate that the actual value * will be filled in later, dynamically. */ #define MACH_MSG_TYPE_POLYMORPHIC ((mach_msg_type_name_t) -1) /* * Is a given item a port type? */ #define MACH_MSG_TYPE_PORT_ANY(x) \ (((x) >= MACH_MSG_TYPE_MOVE_RECEIVE) && \ ((x) <= MACH_MSG_TYPE_MAKE_SEND_ONCE)) #endif /* _MIG_MESSAGE_H */ /* End of file. */