cyg_mdns_discovery_callback_flags — Read/Modify DNS-SD response callback control flags


#include <mdns.h>

cyg_bool cyg_mdns_discovery_callback_flags(cyg_mdns_discovery_context *handle, cyg_uint8 and, cyg_uint8 eor, cyg_uint8 *flags);


This function is used to read or modify the control flags used by the mDNS code to decide which received response records are passed to the registered callback function referenced by the abstract handle.


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

For simplicity, and code size, this function uses the standard AND/EOR scheme to allow the function to be used for non-destructive interrogation, as well as for flag modification. First the supplied “and” value is used as a mask to select the bits to be preserved, prior to the supplied “eor” parameter being used to modify specific flag bits. For example, to read the current state without affecting the flags:

cyg_mdns_discovery_callback_flags(handle,0xFF,0x00,&current); // READ

Whereas the following will ignore the existing flag state and only set the MDNS_DISCOVERY_ADDITIONAL flag value:

cyg_mdns_discovery_callback_flags(handle,0x00,MDNS_DISCOVERY_ADDITIONAL,&explicit); // SET

The following example explicitly clears the single MDNS_DISCOVERY_ALL flag:

cyg_mdns_discovery_callback_flags(handle,~MDNS_DISCOVERY_ALL,0,&modified); // CLEAR FLAG

The use of the AND/EOR scheme allows for a single operation to be used to read some flags, explicitly set/clear some flags and toggle other flags all in a single operation if required.

The full set of flags available are:

#define MDNS_DISCOVERY_ANSWER     (1 << 0) // Callback will be passed Answer records (default)
#define MDNS_DISCOVERY_ADDITIONAL (1 << 1) // Callback will be passed Additional records
#define MDNS_DISCOVERY_ALL        (1 << 2) // Callback will be passed ALL Additional records if
                                                 //   ANSWER callback executed

Return value

Boolean true if the operation has completed OK, or false on failure. On success the location referenced by the passed flags parameter is updated with the current (as optionally modified) flag state.