1111#include "mdns_debug.h"
1212#include "mdns_utils.h"
1313#include "mdns_querier.h"
14+ #include "mdns_netif.h"
1415#include "esp_log.h"
1516
1617static const char * TAG = "mdns_browser" ;
@@ -33,7 +34,7 @@ static esp_err_t _mdns_send_browse_action(mdns_action_type_t type, mdns_browse_t
3334
3435 action -> type = type ;
3536 action -> data .browse_add .browse = browse ;
36- if (!mdns_action_queue (action )) {
37+ if (!mdns_priv_queue_action (action )) {
3738 mdns_mem_free (action );
3839 return ESP_ERR_NO_MEM ;
3940 }
@@ -170,7 +171,7 @@ mdns_browse_t *mdns_browse_new(const char *service, const char *proto, mdns_brow
170171{
171172 mdns_browse_t * browse = NULL ;
172173
173- if (is_mdns_server () || mdns_utils_str_null_or_empty (service ) || mdns_utils_str_null_or_empty (proto )) {
174+ if (mdns_priv_is_server_init () || mdns_utils_str_null_or_empty (service ) || mdns_utils_str_null_or_empty (proto )) {
174175 return NULL ;
175176 }
176177
@@ -191,7 +192,7 @@ esp_err_t mdns_browse_delete(const char *service, const char *proto)
191192{
192193 mdns_browse_t * browse = NULL ;
193194
194- if (!is_mdns_server () || mdns_utils_str_null_or_empty (service ) || mdns_utils_str_null_or_empty (proto )) {
195+ if (!mdns_priv_is_server_init () || mdns_utils_str_null_or_empty (service ) || mdns_utils_str_null_or_empty (proto )) {
195196 return ESP_FAIL ;
196197 }
197198
@@ -258,7 +259,7 @@ mdns_browse_t *_mdns_browse_find(mdns_name_t *name, uint16_t type, mdns_if_t tcp
258259 } else if (type == MDNS_TYPE_A || type == MDNS_TYPE_AAAA ) {
259260 r = b -> result ;
260261 while (r ) {
261- if (r -> esp_netif == _mdns_get_esp_netif (tcpip_if ) && r -> ip_protocol == ip_protocol && !mdns_utils_str_null_or_empty (r -> hostname ) && !strcasecmp (name -> host , r -> hostname )) {
262+ if (r -> esp_netif == mdns_netif_get_esp_netif (tcpip_if ) && r -> ip_protocol == ip_protocol && !mdns_utils_str_null_or_empty (r -> hostname ) && !strcasecmp (name -> host , r -> hostname )) {
262263 return b ;
263264 }
264265 r = r -> next ;
@@ -366,7 +367,7 @@ void mdns_browse_result_add_ip(mdns_browse_t *browse, const char *hostname, esp_
366367 while (r ) {
367368 if (r -> ip_protocol == ip_protocol ) {
368369 // Find the target result in browse result.
369- if (r -> esp_netif == _mdns_get_esp_netif (tcpip_if ) && !mdns_utils_str_null_or_empty (r -> hostname ) && !strcasecmp (hostname , r -> hostname )) {
370+ if (r -> esp_netif == mdns_netif_get_esp_netif (tcpip_if ) && !mdns_utils_str_null_or_empty (r -> hostname ) && !strcasecmp (hostname , r -> hostname )) {
370371 r_a = r -> addr ;
371372 // Check if the address has already added in result.
372373 while (r_a ) {
@@ -385,7 +386,7 @@ void mdns_browse_result_add_ip(mdns_browse_t *browse, const char *hostname, esp_
385386 if (!r_a ) {
386387 // The current IP is a new one, add it to the link list.
387388 mdns_ip_addr_t * a = NULL ;
388- a = _mdns_result_addr_create_ip (ip );
389+ a = mdns_priv_result_addr_create_ip (ip );
389390 if (!a ) {
390391 return ;
391392 }
@@ -395,7 +396,7 @@ void mdns_browse_result_add_ip(mdns_browse_t *browse, const char *hostname, esp_
395396 if (r -> ttl == 0 ) {
396397 r -> ttl = ttl ;
397398 } else {
398- _mdns_result_update_ttl (r , ttl );
399+ mdns_priv_query_update_result_ttl (r , ttl );
399400 }
400401 }
401402 if (_mdns_add_browse_result (out_sync_browse , r ) != ESP_OK ) {
@@ -441,7 +442,7 @@ void mdns_browse_result_add_txt(mdns_browse_t *browse, const char *instance, con
441442 }
442443 mdns_result_t * r = browse -> result ;
443444 while (r ) {
444- if (r -> esp_netif == _mdns_get_esp_netif (tcpip_if ) && r -> ip_protocol == ip_protocol &&
445+ if (r -> esp_netif == mdns_netif_get_esp_netif (tcpip_if ) && r -> ip_protocol == ip_protocol &&
445446 !mdns_utils_str_null_or_empty (r -> instance_name ) && !strcasecmp (instance , r -> instance_name ) &&
446447 !mdns_utils_str_null_or_empty (r -> service_type ) && !strcasecmp (service , r -> service_type ) &&
447448 !mdns_utils_str_null_or_empty (r -> proto ) && !strcasecmp (proto , r -> proto )) {
@@ -474,7 +475,7 @@ void mdns_browse_result_add_txt(mdns_browse_t *browse, const char *instance, con
474475 if (r -> ttl == 0 ) {
475476 r -> ttl = ttl ;
476477 } else {
477- _mdns_result_update_ttl (r , ttl );
478+ mdns_priv_query_update_result_ttl (r , ttl );
478479 }
479480 if (previous_ttl != r -> ttl ) {
480481 should_update = true;
@@ -508,7 +509,7 @@ void mdns_browse_result_add_txt(mdns_browse_t *browse, const char *instance, con
508509 r -> txt = txt ;
509510 r -> txt_value_len = txt_value_len ;
510511 r -> txt_count = txt_count ;
511- r -> esp_netif = _mdns_get_esp_netif (tcpip_if );
512+ r -> esp_netif = mdns_netif_get_esp_netif (tcpip_if );
512513 r -> ip_protocol = ip_protocol ;
513514 r -> ttl = ttl ;
514515 r -> next = browse -> result ;
@@ -532,7 +533,7 @@ static esp_err_t _mdns_copy_address_in_previous_result(mdns_result_t *result_lis
532533 if (!mdns_utils_str_null_or_empty (result_list -> hostname ) && !mdns_utils_str_null_or_empty (r -> hostname ) && !strcasecmp (result_list -> hostname , r -> hostname ) &&
533534 result_list -> ip_protocol == r -> ip_protocol && result_list -> addr && !r -> addr ) {
534535 // If there is a same hostname in previous result, we need to copy the address here.
535- r -> addr = copy_address_list (result_list -> addr );
536+ r -> addr = mdns_utils_copy_address_list (result_list -> addr );
536537 if (!r -> addr ) {
537538 return ESP_ERR_NO_MEM ;
538539 }
@@ -559,7 +560,7 @@ void mdns_browse_result_add_srv(mdns_browse_t *browse, const char *hostname, con
559560 }
560561 mdns_result_t * r = browse -> result ;
561562 while (r ) {
562- if (r -> esp_netif == _mdns_get_esp_netif (tcpip_if ) && r -> ip_protocol == ip_protocol &&
563+ if (r -> esp_netif == mdns_netif_get_esp_netif (tcpip_if ) && r -> ip_protocol == ip_protocol &&
563564 !mdns_utils_str_null_or_empty (r -> instance_name ) && !strcasecmp (instance , r -> instance_name ) &&
564565 !mdns_utils_str_null_or_empty (r -> service_type ) && !strcasecmp (service , r -> service_type ) &&
565566 !mdns_utils_str_null_or_empty (r -> proto ) && !strcasecmp (proto , r -> proto )) {
@@ -585,7 +586,7 @@ void mdns_browse_result_add_srv(mdns_browse_t *browse, const char *hostname, con
585586 if (r -> ttl == 0 ) {
586587 r -> ttl = ttl ;
587588 } else {
588- _mdns_result_update_ttl (r , ttl );
589+ mdns_priv_query_update_result_ttl (r , ttl );
589590 }
590591 if (previous_ttl != r -> ttl ) {
591592 if (_mdns_add_browse_result (out_sync_browse , r ) != ESP_OK ) {
@@ -618,7 +619,7 @@ void mdns_browse_result_add_srv(mdns_browse_t *browse, const char *hostname, con
618619 return ;
619620 }
620621 r -> port = port ;
621- r -> esp_netif = _mdns_get_esp_netif (tcpip_if );
622+ r -> esp_netif = mdns_netif_get_esp_netif (tcpip_if );
622623 r -> ip_protocol = ip_protocol ;
623624 r -> ttl = ttl ;
624625 r -> next = browse -> result ;
0 commit comments