@@ -48,20 +48,23 @@ void mdns_priv_pcb_announce(mdns_if_t tcpip_if, mdns_ip_protocol_t ip_protocol,
4848 if (PCB_STATE_IS_PROBING (_pcb )) {
4949 mdns_priv_init_pcb_probe (tcpip_if , ip_protocol , services , len , include_ip );
5050 } else if (PCB_STATE_IS_ANNOUNCING (_pcb )) {
51- mdns_tx_packet_t * p = _mdns_get_next_pcb_packet (tcpip_if , ip_protocol );
51+ mdns_tx_packet_t * p = mdns_priv_get_next_packet (tcpip_if , ip_protocol );
5252 if (p ) {
5353 for (i = 0 ; i < len ; i ++ ) {
54- if (!_mdns_alloc_answer (& p -> answers , MDNS_TYPE_SDPTR , services [i ]-> service , NULL , false, false)
55- || !_mdns_alloc_answer (& p -> answers , MDNS_TYPE_PTR , services [i ]-> service , NULL , false, false)
56- || !_mdns_alloc_answer (& p -> answers , MDNS_TYPE_SRV , services [i ]-> service , NULL , true, false)
57- || !_mdns_alloc_answer (& p -> answers , MDNS_TYPE_TXT , services [i ]-> service , NULL , true, false)) {
54+ if (!mdns_priv_create_answer (& p -> answers , MDNS_TYPE_SDPTR , services [i ]-> service , NULL , false, false)
55+ || !mdns_priv_create_answer (& p -> answers , MDNS_TYPE_PTR , services [i ]-> service , NULL , false,
56+ false)
57+ || !mdns_priv_create_answer (& p -> answers , MDNS_TYPE_SRV , services [i ]-> service , NULL , true,
58+ false)
59+ || !mdns_priv_create_answer (& p -> answers , MDNS_TYPE_TXT , services [i ]-> service , NULL , true,
60+ false)) {
5861 break ;
5962 }
6063 }
6164 if (include_ip ) {
62- _mdns_dealloc_answer (& p -> additional , MDNS_TYPE_A , NULL );
63- _mdns_dealloc_answer (& p -> additional , MDNS_TYPE_AAAA , NULL );
64- _mdns_append_host_list_in_services (& p -> answers , services , len , true, false);
65+ mdns_priv_dealloc_answer (& p -> additional , MDNS_TYPE_A , NULL );
66+ mdns_priv_dealloc_answer (& p -> additional , MDNS_TYPE_AAAA , NULL );
67+ mdns_priv_append_host_list_in_services (& p -> answers , services , len , true, false);
6568 }
6669 _pcb -> state = PCB_ANNOUNCE_1 ;
6770 }
@@ -72,9 +75,9 @@ void mdns_priv_pcb_announce(mdns_if_t tcpip_if, mdns_ip_protocol_t ip_protocol,
7275 }
7376
7477 _pcb -> state = PCB_ANNOUNCE_1 ;
75- mdns_tx_packet_t * p = _mdns_create_announce_packet (tcpip_if , ip_protocol , services , len , include_ip );
78+ mdns_tx_packet_t * p = mdns_priv_create_announce_packet (tcpip_if , ip_protocol , services , len , include_ip );
7679 if (p ) {
77- mdns_send_schedule_tx_packet (p , 0 );
80+ mdns_priv_send_after (p , 0 );
7881 }
7982 }
8083 }
@@ -152,7 +155,7 @@ void mdns_priv_pcb_disable(mdns_if_t tcpip_if, mdns_ip_protocol_t ip_protocol)
152155 mdns_priv_netif_disable (tcpip_if );
153156
154157 if (mdns_priv_if_ready (tcpip_if , ip_protocol )) {
155- _mdns_clear_pcb_tx_queue_head (tcpip_if , ip_protocol );
158+ mdns_priv_clear_tx_queue_if (tcpip_if , ip_protocol );
156159 deinit_pcb (tcpip_if , ip_protocol );
157160 mdns_if_t other_if = mdns_priv_netif_get_other_interface (tcpip_if );
158161 if (other_if != MDNS_MAX_INTERFACES && s_pcbs [other_if ][ip_protocol ].state == PCB_DUP ) {
@@ -191,7 +194,7 @@ void mdns_priv_pcb_set_duplicate(mdns_if_t tcpip_if)
191194 if (mdns_priv_if_ready (other_if , i )) {
192195 //stop this interface and mark as dup
193196 if (mdns_priv_if_ready (tcpip_if , i )) {
194- _mdns_clear_pcb_tx_queue_head (tcpip_if , i );
197+ mdns_priv_clear_tx_queue_if (tcpip_if , i );
195198 deinit_pcb (tcpip_if , i );
196199 }
197200 s_pcbs [tcpip_if ][i ].state = PCB_DUP ;
@@ -220,13 +223,13 @@ void mdns_priv_pcb_schedule_tx_packet(mdns_tx_packet_t *p)
220223 }
221224 //fallthrough
222225 case PCB_PROBE_2 :
223- mdns_send_schedule_tx_packet (p , 250 );
226+ mdns_priv_send_after (p , 250 );
224227 pcb -> state = (mdns_pcb_state_t )((uint8_t )(pcb -> state ) + 1 );
225228 break ;
226229 case PCB_PROBE_3 :
227- a = _mdns_create_announce_from_probe (p );
230+ a = mdns_priv_create_announce_from_probe (p );
228231 if (!a ) {
229- mdns_send_schedule_tx_packet (p , 250 );
232+ mdns_priv_send_after (p , 250 );
230233 break ;
231234 }
232235 pcb -> probe_running = false;
@@ -235,22 +238,22 @@ void mdns_priv_pcb_schedule_tx_packet(mdns_tx_packet_t *p)
235238 pcb -> failed_probes = 0 ;
236239 mdns_mem_free (pcb -> probe_services );
237240 pcb -> probe_services = NULL ;
238- _mdns_free_tx_packet (p );
241+ mdns_priv_free_tx_packet (p );
239242 p = a ;
240243 send_after = 250 ;
241244 //fallthrough
242245 case PCB_ANNOUNCE_1 :
243246 //fallthrough
244247 case PCB_ANNOUNCE_2 :
245- mdns_send_schedule_tx_packet (p , send_after );
248+ mdns_priv_send_after (p , send_after );
246249 pcb -> state = (mdns_pcb_state_t )((uint8_t )(pcb -> state ) + 1 );
247250 break ;
248251 case PCB_ANNOUNCE_3 :
249252 pcb -> state = PCB_RUNNING ;
250- _mdns_free_tx_packet (p );
253+ mdns_priv_free_tx_packet (p );
251254 break ;
252255 default :
253- _mdns_free_tx_packet (p );
256+ mdns_priv_free_tx_packet (p );
254257 break ;
255258 }
256259}
@@ -368,7 +371,8 @@ static void init_probe_new_service(mdns_if_t tcpip_if, mdns_ip_protocol_t ip_pro
368371 pcb -> probe_services_len = 0 ;
369372 pcb -> probe_running = false;
370373
371- mdns_tx_packet_t * packet = _mdns_create_probe_packet (tcpip_if , ip_protocol , s , services_final_len , true, probe_ip );
374+ mdns_tx_packet_t * packet = mdns_priv_create_probe_packet (tcpip_if , ip_protocol , s , services_final_len , true,
375+ probe_ip );
372376 if (!packet ) {
373377 mdns_mem_free (s );
374378 return ;
@@ -378,15 +382,15 @@ static void init_probe_new_service(mdns_if_t tcpip_if, mdns_ip_protocol_t ip_pro
378382 pcb -> probe_services = s ;
379383 pcb -> probe_services_len = services_final_len ;
380384 pcb -> probe_running = true;
381- mdns_send_schedule_tx_packet (packet , ((pcb -> failed_probes > 5 ) ? 1000 : 120 ) + (esp_random () & 0x7F ));
385+ mdns_priv_send_after (packet , ((pcb -> failed_probes > 5 ) ? 1000 : 120 ) + (esp_random () & 0x7F ));
382386 pcb -> state = PCB_PROBE_1 ;
383387}
384388
385389void mdns_priv_init_pcb_probe (mdns_if_t tcpip_if , mdns_ip_protocol_t ip_protocol , mdns_srv_item_t * * services , size_t len , bool probe_ip )
386390{
387391 mdns_pcb_t * pcb = & s_pcbs [tcpip_if ][ip_protocol ];
388392
389- _mdns_clear_pcb_tx_queue_head (tcpip_if , ip_protocol );
393+ mdns_priv_clear_tx_queue_if (tcpip_if , ip_protocol );
390394
391395 if (mdns_utils_str_null_or_empty (mdns_priv_get_global_hostname ())) {
392396 pcb -> state = PCB_RUNNING ;
@@ -432,7 +436,7 @@ void mdns_priv_pcb_send_bye_service(mdns_srv_item_t **services, size_t len, bool
432436 for (i = 0 ; i < MDNS_MAX_INTERFACES ; i ++ ) {
433437 for (j = 0 ; j < MDNS_IP_PROTOCOL_MAX ; j ++ ) {
434438 if (mdns_priv_if_ready (i , j ) && s_pcbs [i ][j ].state == PCB_RUNNING ) {
435- mdns_send_bye_pcb ((mdns_if_t ) i , (mdns_ip_protocol_t ) j , services , len , include_ip );
439+ mdns_priv_send_bye ((mdns_if_t ) i , (mdns_ip_protocol_t ) j , services , len , include_ip );
436440 }
437441 }
438442 }
0 commit comments