Name

cyg_mdns_getservicelabel — Get current service label value

Synopsis

#include <mdns.h>

cyg_bool cyg_mdns_getservicelabel(const cyg_mdns_service_identity *id, cyg_uint8 *dstbuf, cyg_uint8 *len);

Description

This function provides access to the currently configured mDNS UTF-8 label for the specified id service descriptor. This function is intended for debug or non-time critical UI usage. The active label is copied into the supplied buffer, where the passed *len specifies the valid buffer length of dstbuf. Normally the referenced dstbuf should have at least MDNS_MAX_LABEL available space, and *len set accordingly. The return boolean state indicates success or failure, with *len updated with the number of bytes written/required. On failure the contents of dstbuf are undefined. If dstbuf is NULL then the call can be used with a valid len pointer to ascertain the amount of storage required to hold the name.

[Note]Note

It is possible due to a dynamically changing external network that any returned label may already be invalid by the time the call returns the filled buffer to the application. For normal real-world operations the servicelabel callback function should be tracked by the application to cope with the actual active/current state with suitable cross-thread synchronisation implemented as required.

[Note]Note

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

Return value

If a non-null len is supplied then the referenced location is updated with the label length at the time of the function call. Boolean true is returned if dstbuf is NULL or is a pointer to a *len buffer large enough to hold the service label at the time of the call, which is filled with the service label. On error boolean false is returned.