Name

cyg_mdns_hinfo_register — Register HINFO record data

Synopsis

#include <mdns.h>

cyg_bool cyg_mdns_hinfo_register(const cyg_uint8 *data, cyg_uint8 len);

Description

This optional function (controlled by the CDL option CYGFUN_MDNS_HINFO_OVERRIDE) allows the application to supply an immutable data vector to be used as the HINFO record data when announcing that a hostname has been claimed. The passed len parameter specifies the length of the valid data from the supplied data pointer. Passing the NULL pointer allows the application to restore the default mDNS HINFO response.

The passed data vector should consist of two (2) length-prefixed strings conforming to the mDNS HINFO rules:

  • Each length-prefixed string must start with a letter.
  • Only upper-case letters, digits, hyphen and forward slash characters are permitted.

The following is a very simple fixed data example:

static const cyg_uint8 record_hinfo[] = {
  /* CPU */
  0x09,'C','O','R','T','E','X','-','M','3',
  /* OS */
  0x07,'E','C','O','S','P','R','O',
};

if (!cyg_mdns_hinfo_register(record_hinfo,sizeof(record_hinfo))) {
  /* generate error */
}

In some systems the CPU information may need to be derived dynamically at run-time (if multiple platforms are being supported by the application source) and so a RAM structure would be used that is then filled with the CPU and OS fields. The tests/mdns_example.c source, located in this package in the eCos source repository, provides an example dynamic implementation.

Return value

The boolean true is returned when the referenced data has been registered successfully. If an invalid HINFO data structure is supplied then boolean false is returned and the current mDNS HINFO state is not updated.