mirror of
https://github.com/espressif/esp-protocols.git
synced 2025-07-29 10:17:30 +02:00
feat(mdns): add a new mdns query mode browse
This commit is contained in:
@ -26,6 +26,11 @@ extern "C" {
|
||||
*/
|
||||
typedef struct mdns_search_once_s mdns_search_once_t;
|
||||
|
||||
/**
|
||||
* @brief Daemon query handle
|
||||
*/
|
||||
typedef struct mdns_browse_s mdns_browse_t;
|
||||
|
||||
typedef enum {
|
||||
MDNS_EVENT_ENABLE_IP4 = 1 << 1,
|
||||
MDNS_EVENT_ENABLE_IP6 = 1 << 2,
|
||||
@ -97,6 +102,7 @@ typedef struct mdns_result_s {
|
||||
} mdns_result_t;
|
||||
|
||||
typedef void (*mdns_query_notify_t)(mdns_search_once_t *search);
|
||||
typedef void (*mdns_browse_notify_t)(mdns_result_t *result);
|
||||
|
||||
/**
|
||||
* @brief Initialize mDNS on given interface
|
||||
@ -830,6 +836,28 @@ esp_err_t mdns_unregister_netif(esp_netif_t *esp_netif);
|
||||
*/
|
||||
esp_err_t mdns_netif_action(esp_netif_t *esp_netif, mdns_event_actions_t event_action);
|
||||
|
||||
/**
|
||||
* @brief Browse mDNS for a service `_service._proto`.
|
||||
*
|
||||
* @param service Pointer to the `_service` which will be browsed.
|
||||
* @param proto Pointer to the `_proto` which will be browsed.
|
||||
* @param notifier The callback which will be called when the browsing service changed.
|
||||
* @return mdns_browse_t pointer to new browse object if initiated successfully.
|
||||
* NULL otherwise.
|
||||
*/
|
||||
mdns_browse_t *mdns_browse_new(const char *service, const char *proto, mdns_browse_notify_t notifier);
|
||||
|
||||
/**
|
||||
* @brief Stop the `_service._proto` browse.
|
||||
* @param service Pointer to the `_service` which will be browsed.
|
||||
* @param proto Pointer to the `_proto` which will be browsed.
|
||||
* @return
|
||||
* - ESP_OK success.
|
||||
* - ESP_ERR_FAIL mDNS is not running or the browsing of `_service._proto` is never started.
|
||||
* - ESP_ERR_NO_MEM memory error.
|
||||
*/
|
||||
esp_err_t mdns_browse_delete(const char *service, const char *proto);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user