Merge branch 'bugfix/fix_minor_gh_issues' into 'master'

mdns: minor fixes mainly from GitHub

Closes #77

See merge request idf/esp-idf!4930
pull/3486/head
Angus Gratton 2019-05-10 12:31:30 +08:00
commit b991aa1ecb
3 zmienionych plików z 11 dodań i 10 usunięć

Wyświetl plik

@ -44,8 +44,8 @@ typedef enum {
* Used in mdns_service_add() * Used in mdns_service_add()
*/ */
typedef struct { typedef struct {
char * key; /*!< item key name */ const char * key; /*!< item key name */
char * value; /*!< item value string */ const char * value; /*!< item value string */
} mdns_txt_item_t; } mdns_txt_item_t;
/** /**
@ -81,10 +81,9 @@ typedef struct mdns_result_s {
* *
* @return * @return
* - ESP_OK on success * - ESP_OK on success
* - ESP_ERR_INVALID_ARG when bad tcpip_if is given * - ESP_ERR_INVALID_STATE when failed to register event handler
* - ESP_ERR_INVALID_STATE when the network returned error
* - ESP_ERR_NO_MEM on memory error * - ESP_ERR_NO_MEM on memory error
* - ESP_ERR_WIFI_NOT_INIT when WiFi is not initialized by eps_wifi_init * - ESP_FAIL when failed to start mdns task
*/ */
esp_err_t mdns_init(); esp_err_t mdns_init();
@ -127,13 +126,14 @@ esp_err_t mdns_instance_name_set(const char * instance_name);
* @param service_type service type (_http, _ftp, etc) * @param service_type service type (_http, _ftp, etc)
* @param proto service protocol (_tcp, _udp) * @param proto service protocol (_tcp, _udp)
* @param port service port * @param port service port
* @param num_items number of items in TXT data
* @param txt string array of TXT data (eg. {{"var","val"},{"other","2"}}) * @param txt string array of TXT data (eg. {{"var","val"},{"other","2"}})
* @param num_items number of items in TXT data
* *
* @return * @return
* - ESP_OK success * - ESP_OK success
* - ESP_ERR_INVALID_ARG Parameter error * - ESP_ERR_INVALID_ARG Parameter error
* - ESP_ERR_NO_MEM memory error * - ESP_ERR_NO_MEM memory error
* - ESP_FAIL failed to add serivce
*/ */
esp_err_t mdns_service_add(const char * instance_name, const char * service_type, const char * proto, uint16_t port, mdns_txt_item_t txt[], size_t num_items); esp_err_t mdns_service_add(const char * instance_name, const char * service_type, const char * proto, uint16_t port, mdns_txt_item_t txt[], size_t num_items);
@ -147,7 +147,7 @@ esp_err_t mdns_service_add(const char * instance_name, const char * service_type
* - ESP_OK success * - ESP_OK success
* - ESP_ERR_INVALID_ARG Parameter error * - ESP_ERR_INVALID_ARG Parameter error
* - ESP_ERR_NOT_FOUND Service not found * - ESP_ERR_NOT_FOUND Service not found
* - ESP_FAIL unknown error * - ESP_ERR_NO_MEM memory error
*/ */
esp_err_t mdns_service_remove(const char * service_type, const char * proto); esp_err_t mdns_service_remove(const char * service_type, const char * proto);
@ -177,6 +177,7 @@ esp_err_t mdns_service_instance_name_set(const char * service_type, const char *
* - ESP_OK success * - ESP_OK success
* - ESP_ERR_INVALID_ARG Parameter error * - ESP_ERR_INVALID_ARG Parameter error
* - ESP_ERR_NOT_FOUND Service not found * - ESP_ERR_NOT_FOUND Service not found
* - ESP_ERR_NO_MEM memory error
*/ */
esp_err_t mdns_service_port_set(const char * service_type, const char * proto, uint16_t port); esp_err_t mdns_service_port_set(const char * service_type, const char * proto, uint16_t port);
@ -185,8 +186,8 @@ esp_err_t mdns_service_port_set(const char * service_type, const char * proto, u
* *
* @param service_type service type (_http, _ftp, etc) * @param service_type service type (_http, _ftp, etc)
* @param proto service protocol (_tcp, _udp) * @param proto service protocol (_tcp, _udp)
* @param num_items number of items in TXT data
* @param txt array of TXT data (eg. {{"var","val"},{"other","2"}}) * @param txt array of TXT data (eg. {{"var","val"},{"other","2"}})
* @param num_items number of items in TXT data
* *
* @return * @return
* - ESP_OK success * - ESP_OK success

Wyświetl plik

@ -2886,7 +2886,7 @@ void mdns_parse_packet(mdns_rx_packet_t * packet)
col = 1; col = 1;
} else if (!clas) { } else if (!clas) {
col = -1; col = -1;
} else { } else if (service) { // only detect txt collision if service existed
col = _mdns_check_txt_collision(service->service, data_ptr, data_len); col = _mdns_check_txt_collision(service->service, data_ptr, data_len);
} }
if (col && !_mdns_server->interfaces[packet->tcpip_if].pcbs[packet->ip_protocol].probe_running) { if (col && !_mdns_server->interfaces[packet->tcpip_if].pcbs[packet->ip_protocol].probe_running) {

Wyświetl plik

@ -260,7 +260,7 @@ typedef struct mdns_srv_item_s {
typedef struct mdns_out_question_s { typedef struct mdns_out_question_s {
struct mdns_out_question_s * next; struct mdns_out_question_s * next;
uint16_t type; uint16_t type;
uint8_t unicast; bool unicast;
const char * host; const char * host;
const char * service; const char * service;
const char * proto; const char * proto;