sk_packMessage()

Description

The sk_packMessage() function converts the message into a sequence of bytes suitable for sending to the LLC. This sequence of bytes is suitable for sk_sendMessage(), sk_sendMessageWithTag(), or sk_sendMessageWithHandler().

Syntax

int sk_packMessage(MsgStruct *aMsgStruct, char *aBuffer, int *aBufSize);

Parameters

The function parameters are shown in the table below.

Argument

I/O

Description

MsgStruct **m

I

Pointer to a generic C Structure representing a message.

aBuffer

O

Pointer to a packed message.

aBufSize

I

The size of aBuffer. This tells the SwitchKit API how large the user-provided buffer is and allows the API to stay within the provided buffer.

O

The number of bytes of aBuffer that were actually used to store the packed message.

Return Values

Possible return values for this function:

SK_LOST_LLC

This return value indicates that your application lost contact with the LLC.

SK_UNKNOWN_MSG_TYPE

The tag field of this MsgStruct is invalid. Did you call sk_initMsg()?

SK_BAD_MSG_
SIZE

The size field computed by SwitchKit does not match the size field set through sk_setMsgSize(). For this message, you should not set the message size, and instead should let SwitchKit compute it automatically.

SK_NO_MSG_
SIZE

For this MsgStruct, no size was set in with sk_setMsgSize(), and its size couldn’t be computed.