You are here: SwitchKit® Development Environment Programmer’s Guide > 7 Message Functions > sk_unpackAutoStorage()

sk_unpackAutoStorage()

Description

The sk_unpackAutoStorage() function takes the character buffer and size returned by sk_rcvMessage() and unpacks it into a MsgStruct. This function is equivalent to sk_unpackMessage(), except that instead of requiring you to pass in a pre-allocated buffer, it automatically allocates an appropriate buffer with sufficient storage for the given message.

Syntax

int sk_unpackAutoStorage(char *aBuffer, int aBufSize,
MsgStruct *aMsgStructPtr);

Parameters

The function parameters are shown in the table below.

Argument | Description
--- | ---
aBuffer | Pointer to a packed message.
aBufSize | Size of the packed message.
*aMsgStructPtr | Pointer to a generic C Structure representing a message pointing to memory allocated and owned by SwitchKit API.

Important! The storage of this buffer is managed automatically by SwitchKit.

Return Values

Possible return values for this function:

SK_LOST_LLC | This return value indicates that your application lost contact with the LLC.
SK__MSG_TOO_BIG | The amount of memory needid to be allocated is greater than 65536 bytes.
SK_INTERNAL_ERROR | Message could not be unpacked.