Apply modified version of bug #52747: mdns resp: separate the announce function and add netifapi support for it

Changes made by me:
- Move all error handling code into mdns_resp_announce() so it can be safely used by external code
- Remove mdns_resp_netif_settings_changed() because it is the same as mdns_resp_announce() after my changes
- Declare #define for a "thread-safe" version of mdns_resp_announce in mdns.h instead of netifapi.h - I don't want to intermix netif API with APPs
This commit is contained in:
Dirk Ziegelmeier
2017-12-30 12:08:01 +01:00
parent 1b57284bb4
commit b536fd9767
2 changed files with 48 additions and 42 deletions

View File

@@ -66,7 +66,24 @@ err_t mdns_resp_del_service(struct netif *netif, s8_t slot);
err_t mdns_resp_add_service_txtitem(struct mdns_service *service, const char *txt, u8_t txt_len);
void mdns_resp_netif_settings_changed(struct netif *netif);
void mdns_resp_announce(struct netif *netif);
/**
* @ingroup mdns
* Announce IP settings have changed on netif.
* Call this in your callback registered by netif_set_status_callback().
* No need to call this function when LWIP_NETIF_EXT_STATUS_CALLBACK==1,
* this handled automatically for you.
* @param netif The network interface where settings have changed.
*/
#define mdns_resp_netif_settings_changed(netif) mdns_resp_announce(netif)
/** @ingroup mdns
* To trigger announces from non-TCPIP threads
* Be sure to \#include lwip/netifapi.h when using this macro
* @see mdns_resp_announce()
*/
#define mdnsapi_mdns_resp_announce(netif) netifapi_netif_common(netif, NULL, mdns_resp_announce)
#endif /* LWIP_MDNS_RESPONDER */