Name

cyg_mdns_name — Convert encoded name into dot-notation

Synopsis

#include <mdns.h>

cyg_uint16 cyg_mdns_name(char *dst, cyg_uint16 dstlimit, cyg_uint8 *strtab);

Description

This function is used to convert an encoded name into a “simple” dot-notation NUL-terminated string.

[Note]Note

This function is not available if the system is not configured with CYGIMP_NET_MDNS_DNSSD enabled.

If the passed dst pointer is NULL then the routine can be used to calculate the space needed to hold the converted name.

Pseudo-code example:

cyg_uint16 needed = cyg_mdns_name(NULL,0,hostname);
char buffer[needed];
cyg_uint16 used = cyg_mdns_name(buffer,needed,hostname);
if (used == needed) {
  diag_printf("  http://%s:%u/\n",buffer,port);
}

The routine will not write more than the passed dstlimit number of characters, and as such if the passed buffer is too small then the string will not be NUL terminated.

Return value

The number of characters needed to hold the converted string (when dst=NULL), or the number of characters used in the supplied dst destination buffer.