From 0b370fbade35305985b0b55e013959ee01f178dc Mon Sep 17 00:00:00 2001 From: Daniel Pauli Date: Wed, 15 Aug 2018 11:11:11 +0200 Subject: [PATCH] add API function mdns_resp_netif_active() that can be used to test if an MDNS responder is active for a given network interface. Signed-off-by: Erik Ekman --- src/apps/mdns/mdns.c | 12 ++++++++++++ src/include/lwip/apps/mdns.h | 1 + 2 files changed, 13 insertions(+) diff --git a/src/apps/mdns/mdns.c b/src/apps/mdns/mdns.c index 36238570..5eb79206 100644 --- a/src/apps/mdns/mdns.c +++ b/src/apps/mdns/mdns.c @@ -2483,6 +2483,18 @@ mdns_resp_rename_netif(struct netif *netif, const char *hostname) return ERR_OK; } +/** + * @ingroup mdns + * Checks if an MDNS responder is active for a given network interface. + * @param netif The network interface to test. + * @return nonzero if responder active, zero otherwise. + */ +int +mdns_resp_netif_active(struct netif *netif) +{ + return NETIF_TO_HOST(netif) != NULL; +} + /** * @ingroup mdns * Add a service to the selected network interface. diff --git a/src/include/lwip/apps/mdns.h b/src/include/lwip/apps/mdns.h index e8c1ef9e..33da4a3e 100644 --- a/src/include/lwip/apps/mdns.h +++ b/src/include/lwip/apps/mdns.h @@ -110,6 +110,7 @@ void mdns_resp_register_name_result_cb(mdns_name_result_cb_t cb); err_t mdns_resp_add_netif(struct netif *netif, const char *hostname); err_t mdns_resp_remove_netif(struct netif *netif); err_t mdns_resp_rename_netif(struct netif *netif, const char *hostname); +int mdns_resp_netif_active(struct netif *netif); s8_t mdns_resp_add_service(struct netif *netif, const char *name, const char *service, enum mdns_sd_proto proto, u16_t port, service_get_txt_fn_t txt_fn, void *txt_userdata); err_t mdns_resp_del_service(struct netif *netif, u8_t slot);