mdns: Use multi/uni-cast types in API

pull/8262/head
David Cermak 2022-01-10 09:16:10 +01:00 zatwierdzone przez David Čermák
rodzic 7eeeb01ea7
commit 125c312552
2 zmienionych plików z 13 dodań i 4 usunięć

Wyświetl plik

@ -60,6 +60,14 @@ typedef enum mdns_if_internal {
MDNS_IF_MAX
} mdns_if_t;
/**
* @brief mDNS query type to be explicitly set to either Unicast or Multicast
*/
typedef enum {
MDNS_QUERY_UNICAST,
MDNS_QUERY_MULTICAST,
} mdns_query_transmission_type_t;
/**
* @brief mDNS query result structure
*/
@ -580,7 +588,7 @@ mdns_search_once_t *mdns_query_async_new(const char *name, const char *service_t
* @param service_type service type (_http, _arduino, _ftp etc.) (NULL for host queries)
* @param proto service protocol (_tcp, _udp, etc.) (NULL for host queries)
* @param type type of query (MDNS_TYPE_*)
* @param unicast true for Unicast query, false for Multicast query
* @param transmission_type either Unicast query, or Multicast query
* @param timeout time in milliseconds to wait for answers.
* @param max_results maximum results to be collected
* @param results pointer to the results of the query
@ -592,7 +600,8 @@ mdns_search_once_t *mdns_query_async_new(const char *name, const char *service_t
* - ESP_ERR_NO_MEM memory error
* - ESP_ERR_INVALID_ARG timeout was not given
*/
esp_err_t mdns_query_generic(const char * name, const char * service_type, const char * proto, uint16_t type, bool unicast, uint32_t timeout, size_t max_results, mdns_result_t ** results);
esp_err_t mdns_query_generic(const char * name, const char * service_type, const char * proto, uint16_t type,
mdns_query_transmission_type_t transmission_type, uint32_t timeout, size_t max_results, mdns_result_t ** results);
/**
* @brief Query mDNS for host or service

Wyświetl plik

@ -5624,7 +5624,7 @@ mdns_search_once_t *mdns_query_async_new(const char *name, const char *service,
return search;
}
esp_err_t mdns_query_generic(const char * name, const char * service, const char * proto, uint16_t type, bool unicast, uint32_t timeout, size_t max_results, mdns_result_t ** results)
esp_err_t mdns_query_generic(const char * name, const char * service, const char * proto, uint16_t type, mdns_query_transmission_type_t transmission_type, uint32_t timeout, size_t max_results, mdns_result_t ** results)
{
mdns_search_once_t * search = NULL;
@ -5638,7 +5638,7 @@ esp_err_t mdns_query_generic(const char * name, const char * service, const char
return ESP_ERR_INVALID_ARG;
}
search = _mdns_search_init(name, service, proto, type, unicast, timeout, max_results, NULL);
search = _mdns_search_init(name, service, proto, type, transmission_type == MDNS_QUERY_UNICAST, timeout, max_results, NULL);
if (!search) {
return ESP_ERR_NO_MEM;
}