You are here: SwitchKit® Development Environment Programmer’s Guide > 7 Message Functions > Message Headers in C

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;

}

Range of channels provided by T1 or E1 transmission service. A physical span is a group of channels taking up a single physical wire. A logical span is a group of channels taking up less than a single logical wire, or carried over more than one physical wire.