Message Headers in C

Description

To process all of the basic message handling required by the EXS API, SwitchKit presents each message with a header and supplies the appropriate fields for the EXS Message Type, Size, Sequence numbers, and Node ID.

The data portion of the message can be an SwitchKit Message, an outbound (for example host to switch) or inbound (for example switch to host) EXS API message, or an acknowledgment message. In all cases, the manipulation of these messages is accomplished through the macros described later in this section.

Syntax of Basic C Message Header

typedef struct {

XBYTE Size;

int Tag;

XBYTE SeqNum;

UBYTE NodeID;

int EngineName;

} BaseFields;

Message Structure

To communicate with the LLC, sequences of bytes must be passed through interprocess communication. To hide the underlying byte representation, SwitchKit provides a set of message structures to represent the data more intelligently. These message structures are all defined in the Messages.api.h API file. The structures are hierarchical, so that a simple cast can convert one to another.

Example

typedef struct {

unsigned short Span;

UBYTE Channel;

UBYTE ResendFlag;

} XL_RequestForService;

 

MsgStruct msg;

if (sk_getMsgTag(&msg) == TAG_RequestForService)

{

XL_RequestForService *rfs;

rfs = (XL_RequestForService *)&msg;

}