11
11
#include "mdns_debug.h"
12
12
#include "mdns_utils.h"
13
13
#include "mdns_querier.h"
14
+ #include "mdns_netif.h"
14
15
#include "esp_log.h"
15
16
16
17
static 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
33
34
34
35
action -> type = type ;
35
36
action -> data .browse_add .browse = browse ;
36
- if (!mdns_action_queue (action )) {
37
+ if (!mdns_priv_queue_action (action )) {
37
38
mdns_mem_free (action );
38
39
return ESP_ERR_NO_MEM ;
39
40
}
@@ -170,7 +171,7 @@ mdns_browse_t *mdns_browse_new(const char *service, const char *proto, mdns_brow
170
171
{
171
172
mdns_browse_t * browse = NULL ;
172
173
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 )) {
174
175
return NULL ;
175
176
}
176
177
@@ -191,7 +192,7 @@ esp_err_t mdns_browse_delete(const char *service, const char *proto)
191
192
{
192
193
mdns_browse_t * browse = NULL ;
193
194
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 )) {
195
196
return ESP_FAIL ;
196
197
}
197
198
@@ -258,7 +259,7 @@ mdns_browse_t *_mdns_browse_find(mdns_name_t *name, uint16_t type, mdns_if_t tcp
258
259
} else if (type == MDNS_TYPE_A || type == MDNS_TYPE_AAAA ) {
259
260
r = b -> result ;
260
261
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 )) {
262
263
return b ;
263
264
}
264
265
r = r -> next ;
@@ -366,7 +367,7 @@ void mdns_browse_result_add_ip(mdns_browse_t *browse, const char *hostname, esp_
366
367
while (r ) {
367
368
if (r -> ip_protocol == ip_protocol ) {
368
369
// 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 )) {
370
371
r_a = r -> addr ;
371
372
// Check if the address has already added in result.
372
373
while (r_a ) {
@@ -385,7 +386,7 @@ void mdns_browse_result_add_ip(mdns_browse_t *browse, const char *hostname, esp_
385
386
if (!r_a ) {
386
387
// The current IP is a new one, add it to the link list.
387
388
mdns_ip_addr_t * a = NULL ;
388
- a = _mdns_result_addr_create_ip (ip );
389
+ a = mdns_priv_result_addr_create_ip (ip );
389
390
if (!a ) {
390
391
return ;
391
392
}
@@ -395,7 +396,7 @@ void mdns_browse_result_add_ip(mdns_browse_t *browse, const char *hostname, esp_
395
396
if (r -> ttl == 0 ) {
396
397
r -> ttl = ttl ;
397
398
} else {
398
- _mdns_result_update_ttl (r , ttl );
399
+ mdns_priv_query_update_result_ttl (r , ttl );
399
400
}
400
401
}
401
402
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
441
442
}
442
443
mdns_result_t * r = browse -> result ;
443
444
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 &&
445
446
!mdns_utils_str_null_or_empty (r -> instance_name ) && !strcasecmp (instance , r -> instance_name ) &&
446
447
!mdns_utils_str_null_or_empty (r -> service_type ) && !strcasecmp (service , r -> service_type ) &&
447
448
!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
474
475
if (r -> ttl == 0 ) {
475
476
r -> ttl = ttl ;
476
477
} else {
477
- _mdns_result_update_ttl (r , ttl );
478
+ mdns_priv_query_update_result_ttl (r , ttl );
478
479
}
479
480
if (previous_ttl != r -> ttl ) {
480
481
should_update = true;
@@ -508,7 +509,7 @@ void mdns_browse_result_add_txt(mdns_browse_t *browse, const char *instance, con
508
509
r -> txt = txt ;
509
510
r -> txt_value_len = txt_value_len ;
510
511
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 );
512
513
r -> ip_protocol = ip_protocol ;
513
514
r -> ttl = ttl ;
514
515
r -> next = browse -> result ;
@@ -532,7 +533,7 @@ static esp_err_t _mdns_copy_address_in_previous_result(mdns_result_t *result_lis
532
533
if (!mdns_utils_str_null_or_empty (result_list -> hostname ) && !mdns_utils_str_null_or_empty (r -> hostname ) && !strcasecmp (result_list -> hostname , r -> hostname ) &&
533
534
result_list -> ip_protocol == r -> ip_protocol && result_list -> addr && !r -> addr ) {
534
535
// 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 );
536
537
if (!r -> addr ) {
537
538
return ESP_ERR_NO_MEM ;
538
539
}
@@ -559,7 +560,7 @@ void mdns_browse_result_add_srv(mdns_browse_t *browse, const char *hostname, con
559
560
}
560
561
mdns_result_t * r = browse -> result ;
561
562
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 &&
563
564
!mdns_utils_str_null_or_empty (r -> instance_name ) && !strcasecmp (instance , r -> instance_name ) &&
564
565
!mdns_utils_str_null_or_empty (r -> service_type ) && !strcasecmp (service , r -> service_type ) &&
565
566
!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
585
586
if (r -> ttl == 0 ) {
586
587
r -> ttl = ttl ;
587
588
} else {
588
- _mdns_result_update_ttl (r , ttl );
589
+ mdns_priv_query_update_result_ttl (r , ttl );
589
590
}
590
591
if (previous_ttl != r -> ttl ) {
591
592
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
618
619
return ;
619
620
}
620
621
r -> port = port ;
621
- r -> esp_netif = _mdns_get_esp_netif (tcpip_if );
622
+ r -> esp_netif = mdns_netif_get_esp_netif (tcpip_if );
622
623
r -> ip_protocol = ip_protocol ;
623
624
r -> ttl = ttl ;
624
625
r -> next = browse -> result ;
0 commit comments