@@ -48,23 +48,20 @@ void mdns_priv_pcb_announce(mdns_if_t tcpip_if, mdns_ip_protocol_t ip_protocol,
48
48
if (PCB_STATE_IS_PROBING (_pcb )) {
49
49
mdns_priv_init_pcb_probe (tcpip_if , ip_protocol , services , len , include_ip );
50
50
} else if (PCB_STATE_IS_ANNOUNCING (_pcb )) {
51
- mdns_tx_packet_t * p = mdns_priv_get_next_packet (tcpip_if , ip_protocol );
51
+ mdns_tx_packet_t * p = _mdns_get_next_pcb_packet (tcpip_if , ip_protocol );
52
52
if (p ) {
53
53
for (i = 0 ; i < len ; i ++ ) {
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)) {
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)) {
61
58
break ;
62
59
}
63
60
}
64
61
if (include_ip ) {
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);
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);
68
65
}
69
66
_pcb -> state = PCB_ANNOUNCE_1 ;
70
67
}
@@ -75,9 +72,9 @@ void mdns_priv_pcb_announce(mdns_if_t tcpip_if, mdns_ip_protocol_t ip_protocol,
75
72
}
76
73
77
74
_pcb -> state = PCB_ANNOUNCE_1 ;
78
- mdns_tx_packet_t * p = mdns_priv_create_announce_packet (tcpip_if , ip_protocol , services , len , include_ip );
75
+ mdns_tx_packet_t * p = _mdns_create_announce_packet (tcpip_if , ip_protocol , services , len , include_ip );
79
76
if (p ) {
80
- mdns_priv_send_after (p , 0 );
77
+ mdns_send_schedule_tx_packet (p , 0 );
81
78
}
82
79
}
83
80
}
@@ -155,7 +152,7 @@ void mdns_priv_pcb_disable(mdns_if_t tcpip_if, mdns_ip_protocol_t ip_protocol)
155
152
mdns_priv_netif_disable (tcpip_if );
156
153
157
154
if (mdns_priv_if_ready (tcpip_if , ip_protocol )) {
158
- mdns_priv_clear_tx_queue_if (tcpip_if , ip_protocol );
155
+ _mdns_clear_pcb_tx_queue_head (tcpip_if , ip_protocol );
159
156
deinit_pcb (tcpip_if , ip_protocol );
160
157
mdns_if_t other_if = mdns_priv_netif_get_other_interface (tcpip_if );
161
158
if (other_if != MDNS_MAX_INTERFACES && s_pcbs [other_if ][ip_protocol ].state == PCB_DUP ) {
@@ -194,7 +191,7 @@ void mdns_priv_pcb_set_duplicate(mdns_if_t tcpip_if)
194
191
if (mdns_priv_if_ready (other_if , i )) {
195
192
//stop this interface and mark as dup
196
193
if (mdns_priv_if_ready (tcpip_if , i )) {
197
- mdns_priv_clear_tx_queue_if (tcpip_if , i );
194
+ _mdns_clear_pcb_tx_queue_head (tcpip_if , i );
198
195
deinit_pcb (tcpip_if , i );
199
196
}
200
197
s_pcbs [tcpip_if ][i ].state = PCB_DUP ;
@@ -223,13 +220,13 @@ void mdns_priv_pcb_schedule_tx_packet(mdns_tx_packet_t *p)
223
220
}
224
221
//fallthrough
225
222
case PCB_PROBE_2 :
226
- mdns_priv_send_after (p , 250 );
223
+ mdns_send_schedule_tx_packet (p , 250 );
227
224
pcb -> state = (mdns_pcb_state_t )((uint8_t )(pcb -> state ) + 1 );
228
225
break ;
229
226
case PCB_PROBE_3 :
230
- a = mdns_priv_create_announce_from_probe (p );
227
+ a = _mdns_create_announce_from_probe (p );
231
228
if (!a ) {
232
- mdns_priv_send_after (p , 250 );
229
+ mdns_send_schedule_tx_packet (p , 250 );
233
230
break ;
234
231
}
235
232
pcb -> probe_running = false;
@@ -238,22 +235,22 @@ void mdns_priv_pcb_schedule_tx_packet(mdns_tx_packet_t *p)
238
235
pcb -> failed_probes = 0 ;
239
236
mdns_mem_free (pcb -> probe_services );
240
237
pcb -> probe_services = NULL ;
241
- mdns_priv_free_tx_packet (p );
238
+ _mdns_free_tx_packet (p );
242
239
p = a ;
243
240
send_after = 250 ;
244
241
//fallthrough
245
242
case PCB_ANNOUNCE_1 :
246
243
//fallthrough
247
244
case PCB_ANNOUNCE_2 :
248
- mdns_priv_send_after (p , send_after );
245
+ mdns_send_schedule_tx_packet (p , send_after );
249
246
pcb -> state = (mdns_pcb_state_t )((uint8_t )(pcb -> state ) + 1 );
250
247
break ;
251
248
case PCB_ANNOUNCE_3 :
252
249
pcb -> state = PCB_RUNNING ;
253
- mdns_priv_free_tx_packet (p );
250
+ _mdns_free_tx_packet (p );
254
251
break ;
255
252
default :
256
- mdns_priv_free_tx_packet (p );
253
+ _mdns_free_tx_packet (p );
257
254
break ;
258
255
}
259
256
}
@@ -371,8 +368,7 @@ static void init_probe_new_service(mdns_if_t tcpip_if, mdns_ip_protocol_t ip_pro
371
368
pcb -> probe_services_len = 0 ;
372
369
pcb -> probe_running = false;
373
370
374
- mdns_tx_packet_t * packet = mdns_priv_create_probe_packet (tcpip_if , ip_protocol , s , services_final_len , true,
375
- probe_ip );
371
+ mdns_tx_packet_t * packet = _mdns_create_probe_packet (tcpip_if , ip_protocol , s , services_final_len , true, probe_ip );
376
372
if (!packet ) {
377
373
mdns_mem_free (s );
378
374
return ;
@@ -382,15 +378,15 @@ static void init_probe_new_service(mdns_if_t tcpip_if, mdns_ip_protocol_t ip_pro
382
378
pcb -> probe_services = s ;
383
379
pcb -> probe_services_len = services_final_len ;
384
380
pcb -> probe_running = true;
385
- mdns_priv_send_after (packet , ((pcb -> failed_probes > 5 ) ? 1000 : 120 ) + (esp_random () & 0x7F ));
381
+ mdns_send_schedule_tx_packet (packet , ((pcb -> failed_probes > 5 ) ? 1000 : 120 ) + (esp_random () & 0x7F ));
386
382
pcb -> state = PCB_PROBE_1 ;
387
383
}
388
384
389
385
void 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 )
390
386
{
391
387
mdns_pcb_t * pcb = & s_pcbs [tcpip_if ][ip_protocol ];
392
388
393
- mdns_priv_clear_tx_queue_if (tcpip_if , ip_protocol );
389
+ _mdns_clear_pcb_tx_queue_head (tcpip_if , ip_protocol );
394
390
395
391
if (mdns_utils_str_null_or_empty (mdns_priv_get_global_hostname ())) {
396
392
pcb -> state = PCB_RUNNING ;
@@ -436,7 +432,7 @@ void mdns_priv_pcb_send_bye_service(mdns_srv_item_t **services, size_t len, bool
436
432
for (i = 0 ; i < MDNS_MAX_INTERFACES ; i ++ ) {
437
433
for (j = 0 ; j < MDNS_IP_PROTOCOL_MAX ; j ++ ) {
438
434
if (mdns_priv_if_ready (i , j ) && s_pcbs [i ][j ].state == PCB_RUNNING ) {
439
- mdns_priv_send_bye ((mdns_if_t ) i , (mdns_ip_protocol_t ) j , services , len , include_ip );
435
+ mdns_send_bye_pcb ((mdns_if_t ) i , (mdns_ip_protocol_t ) j , services , len , include_ip );
440
436
}
441
437
}
442
438
}
0 commit comments