IXP_PSTRINGS(3)

NAME

ixp_pstrings

SYNOPSIS
#include <ixp.h>
void ixp_pstrings(IxpMsg *msg, uint16_t *num, char *strings[], uint max);

DESCRIPTION

Packs or unpacks an array of UTF-8 encoded strings. The packed representation consists of a 16-bit element count followed by an array of strings as packed by ixp_pstring(3). The unpacked representation is an array of nul-terminated character arrays.

If msg->mode is MsgPack, *num strings in the array pointed to by strings are packed into the buffer at msg->pos. If msg->mode is MsgUnpack, *num is loaded with the number of strings unpacked, the array at *strings is loaded with pointers to the unpacked strings, and (*strings)[0] must be freed by the user. In either case, msg->pos is advanced by the number of bytes read or written. If the action would advance msg->pos beyond msg->end, msg->pos is still advanced, but no other action is taken. If *num is greater than max, msg->pos is set beyond msg->end and no other action is taken.

SEE ALSO

IxpMsg, ixp_pstring, ixp_pdata