
Header components
In the message header file ( /att/include/mesg.h ), the voice system defines the header structure of IPC messages for DIPs and voice system processes. The following example shows the header structure for these IPC messages.
struct mbhdr {
long mtype; /* Message type */
short irType; /* Source type for message */
ir_key_t irWhoto;/* Destination queue or channel owner */
long irChan; /* Channel number */
long mchan; /* Channel number */
short morig; /* Sender's Qkey */
short mcont; /* Message id */
unsigned short mseqno; /* Message sequence number */
};
The fields in the header structure are as follows:
- The mtype field allows more control over the destination of messages. This field is used only when sending messages from one DIP to another.
Note:
The mtype field is not often used, but must be a positive non-zero number. Set this field to 1 (one) if you do not plan to use it.
- The irType field indicates the source type for message. This value is set by the function used to send the message. This field can be ignored if the DIP is written not using IRAPI.
- The irWhoTo field specifies the Qkey for the destination queue or allows the IRAPI to specify that the message be sent to the channel owner. This field can be ignored if the DIP is written not using IRAPI.
- The irChan field specifies the channel number. This must be a valid channel number when irWhoTo == IRAPI; otherwise it should be set to IRD_INVALID. This field can be ignored if the DIP is written not using IRAPI.
- The mchan field refers to the channel number that determines which TSM script is to receive the message. Messages sent from a DIP to TSM are routed to the TSM script running on the specified channel. This field originally is set by TSM (discussed later in this section) and must be returned to TSM.
- The morig field specifies the Qkey of the sending or originating process. A DIP's Qkey is returned by VSstartup for DynaDIPs or irRegister for IRAPI processes, or is defined for a hardcoded DIP from the list in mesg.h. This field must be used for returning a message to the sending process.
- The mcont field (also referred to as the message id) specifies what type of data is contained in the message from TSM to the DIP, which allows the handling of messages with data of all shapes, sizes, and meanings. Message ids are usually defined in the DIP .h file (<dip_name> .h), and can be used in the TAS dbase instruction. Without this message id, the DIP is unaware of the kind of data received. It is important to use this field if a DIP can process more than one type of data input.
- For an application to identify each different message to be sent or received, select a unique positive number (see C-Library functions). Two different messages are defined: one is CALLER_INFO that is set to 6910 and the other is ORDER_AMOUNT that is set to 6930.
- The mseqno field allows more control over the sequencing of messages. This field is not used often.