mdns: make delegate host address a list

Also adds unit test and doc string for new apis.


* Original commit: espressif/esp-idf@2d34352f3d
This commit is contained in:
Jiacheng Guo
2021-04-07 16:21:16 +08:00
committed by suren-gabrielyan-espressif
parent c8821199a2
commit 4049b3b5ed
9 changed files with 419 additions and 157 deletions

View File

@ -106,6 +106,7 @@ typedef void * SemaphoreHandle_t;
typedef void * xQueueHandle;
typedef void * QueueHandle_t;
typedef void * TaskHandle_t;
typedef int BaseType_t;
typedef uint32_t TickType_t;
typedef uint32_t portTickType;

View File

@ -98,3 +98,18 @@ void ForceTaskDelete(void)
{
g_queue_send_shall_fail = 1;
}
TaskHandle_t xTaskGetCurrentTaskHandle(void)
{
return NULL;
}
void xTaskNotifyGive(TaskHandle_t task)
{
return;
}
BaseType_t xTaskNotifyWait(uint32_t bits_entry_clear, uint32_t bits_exit_clear, uint32_t * value, TickType_t wait_time)
{
return pdTRUE;
}

View File

@ -24,4 +24,9 @@ esp_err_t esp_event_handler_unregister(const char * event_base, int32_t event_id
#define _mdns_udp_pcb_write(tcpip_if, ip_protocol, ip, port, data, len) len
// Task signify mock
TaskHandle_t xTaskGetCurrentTaskHandle(void);
void xTaskNotifyGive(TaskHandle_t task);
BaseType_t xTaskNotifyWait(uint32_t bits_entry_clear, uint32_t bits_exit_clear, uint32_t *value, TickType_t wait_time );
#endif /* ESP32_MOCK_H_ */

View File

@ -7,13 +7,13 @@
#include "mdns_private.h"
void (*mdns_test_static_execute_action)(mdns_action_t *) = NULL;
mdns_srv_item_t * (*mdns_test_static_mdns_get_service_item)(const char * service, const char * proto) = NULL;
mdns_srv_item_t * (*mdns_test_static_mdns_get_service_item)(const char * service, const char * proto, const char *hostname) = NULL;
mdns_search_once_t * (*mdns_test_static_search_init)(const char * name, const char * service, const char * proto, uint16_t type, uint32_t timeout, uint8_t max_results) = NULL;
esp_err_t (*mdns_test_static_send_search_action)(mdns_action_type_t type, mdns_search_once_t * search) = NULL;
void (*mdns_test_static_search_free)(mdns_search_once_t * search) = NULL;
static void _mdns_execute_action(mdns_action_t * action);
static mdns_srv_item_t * _mdns_get_service_item(const char * service, const char * proto);
static mdns_srv_item_t * _mdns_get_service_item(const char * service, const char * proto, const char *hostname);
static mdns_search_once_t * _mdns_search_init(const char * name, const char * service, const char * proto, uint16_t type, uint32_t timeout, uint8_t max_results);
static esp_err_t _mdns_send_search_action(mdns_action_type_t type, mdns_search_once_t * search);
static void _mdns_search_free(mdns_search_once_t * search);
@ -49,5 +49,5 @@ mdns_search_once_t * mdns_test_search_init(const char * name, const char * servi
mdns_srv_item_t * mdns_test_mdns_get_service_item(const char * service, const char * proto)
{
return mdns_test_static_mdns_get_service_item(service, proto);
return mdns_test_static_mdns_get_service_item(service, proto, NULL);
}