@@ -26,6 +26,11 @@ extern "C" {
2626 */
2727typedef struct mdns_search_once_s mdns_search_once_t ;
2828
29+ /**
30+ * @brief Daemon query handle
31+ */
32+ typedef struct mdns_browse_s mdns_browse_t ;
33+
2934typedef enum {
3035 MDNS_EVENT_ENABLE_IP4 = 1 << 1 ,
3136 MDNS_EVENT_ENABLE_IP6 = 1 << 2 ,
@@ -97,6 +102,7 @@ typedef struct mdns_result_s {
97102} mdns_result_t ;
98103
99104typedef void (* mdns_query_notify_t )(mdns_search_once_t * search );
105+ typedef void (* mdns_browse_notify_t )(mdns_result_t * result );
100106
101107/**
102108 * @brief Initialize mDNS on given interface
@@ -830,6 +836,28 @@ esp_err_t mdns_unregister_netif(esp_netif_t *esp_netif);
830836 */
831837esp_err_t mdns_netif_action (esp_netif_t * esp_netif , mdns_event_actions_t event_action );
832838
839+ /**
840+ * @brief Browse mDNS for a service `_service._proto`.
841+ *
842+ * @param service Pointer to the `_service` which will be browsed.
843+ * @param proto Pointer to the `_proto` which will be browsed.
844+ * @param notifier The callback which will be called when the browsing service changed.
845+ * @return mdns_browse_t pointer to new browse object if initiated successfully.
846+ * NULL otherwise.
847+ */
848+ mdns_browse_t * mdns_browse_new (const char * service , const char * proto , mdns_browse_notify_t notifier );
849+
850+ /**
851+ * @brief Stop the `_service._proto` browse.
852+ * @param service Pointer to the `_service` which will be browsed.
853+ * @param proto Pointer to the `_proto` which will be browsed.
854+ * @return
855+ * - ESP_OK success.
856+ * - ESP_ERR_FAIL mDNS is not running or the browsing of `_service._proto` is never started.
857+ * - ESP_ERR_NO_MEM memory error.
858+ */
859+ esp_err_t mdns_browse_delete (const char * service , const char * proto );
860+
833861#ifdef __cplusplus
834862}
835863#endif
0 commit comments