2018-05-04 14:42:54 +00:00
|
|
|
/*
|
|
|
|
* MDNS Dependecy injection -- preincluded to inject interface test functions into static variables
|
2020-11-10 07:40:01 +00:00
|
|
|
*
|
2018-05-04 14:42:54 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "mdns.h"
|
|
|
|
#include "mdns_private.h"
|
|
|
|
|
|
|
|
void (*mdns_test_static_execute_action)(mdns_action_t *) = NULL;
|
2021-04-07 08:21:16 +00:00
|
|
|
mdns_srv_item_t * (*mdns_test_static_mdns_get_service_item)(const char * service, const char * proto, const char *hostname) = NULL;
|
2021-12-17 14:40:52 +00:00
|
|
|
mdns_search_once_t *(*mdns_test_static_search_init)(const char *name, const char *service, const char *proto, uint16_t type, bool unicast,
|
|
|
|
uint32_t timeout, uint8_t max_results,
|
2021-08-05 08:59:04 +00:00
|
|
|
mdns_query_notify_t notifier) = NULL;
|
2018-05-04 14:42:54 +00:00
|
|
|
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);
|
2021-04-07 08:21:16 +00:00
|
|
|
static mdns_srv_item_t * _mdns_get_service_item(const char * service, const char * proto, const char *hostname);
|
2021-12-17 14:40:52 +00:00
|
|
|
static mdns_search_once_t *_mdns_search_init(const char *name, const char *service, const char *proto, uint16_t type, bool unicast,
|
2021-08-05 08:59:04 +00:00
|
|
|
uint32_t timeout, uint8_t max_results, mdns_query_notify_t notifier);
|
2018-05-04 14:42:54 +00:00
|
|
|
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);
|
|
|
|
|
2019-07-16 09:33:30 +00:00
|
|
|
void mdns_test_init_di(void)
|
2018-05-04 14:42:54 +00:00
|
|
|
{
|
|
|
|
mdns_test_static_execute_action = _mdns_execute_action;
|
|
|
|
mdns_test_static_mdns_get_service_item = _mdns_get_service_item;
|
|
|
|
mdns_test_static_search_init = _mdns_search_init;
|
|
|
|
mdns_test_static_send_search_action = _mdns_send_search_action;
|
|
|
|
mdns_test_static_search_free = _mdns_search_free;
|
|
|
|
}
|
|
|
|
|
|
|
|
void mdns_test_execute_action(void * action)
|
|
|
|
{
|
|
|
|
mdns_test_static_execute_action((mdns_action_t *)action);
|
|
|
|
}
|
|
|
|
|
|
|
|
void mdns_test_search_free(mdns_search_once_t * search)
|
|
|
|
{
|
|
|
|
return mdns_test_static_search_free(search);
|
|
|
|
}
|
|
|
|
|
|
|
|
esp_err_t mdns_test_send_search_action(mdns_action_type_t type, mdns_search_once_t * search)
|
|
|
|
{
|
|
|
|
return mdns_test_static_send_search_action(type, search);
|
|
|
|
}
|
|
|
|
|
|
|
|
mdns_search_once_t * mdns_test_search_init(const char * name, const char * service, const char * proto, uint16_t type, uint32_t timeout, uint8_t max_results)
|
|
|
|
{
|
2021-12-17 14:40:52 +00:00
|
|
|
return mdns_test_static_search_init(name, service, proto, type, timeout, type != MDNS_TYPE_PTR, max_results, NULL);
|
2018-05-04 14:42:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
mdns_srv_item_t * mdns_test_mdns_get_service_item(const char * service, const char * proto)
|
|
|
|
{
|
2021-04-07 08:21:16 +00:00
|
|
|
return mdns_test_static_mdns_get_service_item(service, proto, NULL);
|
2020-11-10 07:40:01 +00:00
|
|
|
}
|