Name

cyg_mdns_strlen — Calculate uncompressed length of (possibly compressed) string

Synopsis

#include <mdns.h>

cyg_uint16 cyg_mdns_strlen(struct pbuf *p, cyg_uint16 index, cyg_bool raw);

Description

This function is used to calculate the space needed to hold an uncompressed copy of a Resource Record encoded string. The p pointer references the lwIP packet buffer containing the original string structure, with the index specifying the starting offset within the lwIP packet for the string.

The boolean raw flag is used to control the style of uncompressed string for which a length is being calculated.

Return value

The return value depends on the supplied boolean raw flag parameter. When raw=true the return value is the size needed for an uncompressed “raw” copy of the string still using the mDNS encoding style (length byte followed by UTF-8 character data). When raw=false is specified then the function returns the size needed to hold a final string representation using '.' to separate fields, and also including the terminating NUL character. If invalid parameters, or data, are given then the error limit value 0xFFFF is returned.