@@ -250,30 +250,30 @@ static mdns_host_item_t *get_host_item(const char *hostname)
250
250
}
251
251
252
252
static bool create_answer_from_service (mdns_tx_packet_t * packet , mdns_service_t * service ,
253
- mdns_parsed_question_t * question , bool shared , bool send_flush )
253
+ mdns_parsed_question_t * question , bool shared , bool send_flush )
254
254
{
255
255
mdns_host_item_t * host = get_host_item (service -> hostname );
256
256
bool is_delegated = (host != mdns_priv_get_self_host ());
257
257
if (question -> type == MDNS_TYPE_PTR || question -> type == MDNS_TYPE_ANY ) {
258
258
// According to RFC6763-section12.1, for DNS-SD, SRV, TXT and all address records
259
259
// should be included in additional records.
260
260
if (!mdns_priv_create_answer (& packet -> answers , MDNS_TYPE_PTR , service , NULL , false, false) ||
261
- !mdns_priv_create_answer (is_delegated ? & packet -> additional : & packet -> answers , MDNS_TYPE_SRV , service ,
262
- NULL , send_flush , false) ||
263
- !mdns_priv_create_answer (is_delegated ? & packet -> additional : & packet -> answers , MDNS_TYPE_TXT , service ,
264
- NULL , send_flush , false) ||
265
- !mdns_priv_create_answer ((shared || is_delegated ) ? & packet -> additional : & packet -> answers , MDNS_TYPE_A ,
261
+ !mdns_priv_create_answer (is_delegated ? & packet -> additional : & packet -> answers , MDNS_TYPE_SRV , service ,
262
+ NULL , send_flush , false) ||
263
+ !mdns_priv_create_answer (is_delegated ? & packet -> additional : & packet -> answers , MDNS_TYPE_TXT , service ,
264
+ NULL , send_flush , false) ||
265
+ !mdns_priv_create_answer ((shared || is_delegated ) ? & packet -> additional : & packet -> answers , MDNS_TYPE_A ,
266
266
service , host , send_flush ,
267
267
false) ||
268
- !mdns_priv_create_answer ((shared || is_delegated ) ? & packet -> additional : & packet -> answers ,
268
+ !mdns_priv_create_answer ((shared || is_delegated ) ? & packet -> additional : & packet -> answers ,
269
269
MDNS_TYPE_AAAA , service , host ,
270
270
send_flush , false)) {
271
271
return false;
272
272
}
273
273
} else if (question -> type == MDNS_TYPE_SRV ) {
274
274
if (!mdns_priv_create_answer (& packet -> answers , MDNS_TYPE_SRV , service , NULL , send_flush , false) ||
275
- !mdns_priv_create_answer (& packet -> additional , MDNS_TYPE_A , service , host , send_flush , false) ||
276
- !mdns_priv_create_answer (& packet -> additional , MDNS_TYPE_AAAA , service , host , send_flush , false)) {
275
+ !mdns_priv_create_answer (& packet -> additional , MDNS_TYPE_A , service , host , send_flush , false) ||
276
+ !mdns_priv_create_answer (& packet -> additional , MDNS_TYPE_AAAA , service , host , send_flush , false)) {
277
277
return false;
278
278
}
279
279
} else if (question -> type == MDNS_TYPE_TXT ) {
@@ -292,7 +292,7 @@ static bool create_answer_from_hostname(mdns_tx_packet_t *packet, const char *ho
292
292
{
293
293
mdns_host_item_t * host = get_host_item (hostname );
294
294
if (!mdns_priv_create_answer (& packet -> answers , MDNS_TYPE_A , NULL , host , send_flush , false) ||
295
- !mdns_priv_create_answer (& packet -> answers , MDNS_TYPE_AAAA , NULL , host , send_flush , false)) {
295
+ !mdns_priv_create_answer (& packet -> answers , MDNS_TYPE_AAAA , NULL , host , send_flush , false)) {
296
296
return false;
297
297
}
298
298
return true;
@@ -411,7 +411,7 @@ static bool append_host_question(mdns_out_question_t **questions, const char *ho
411
411
}
412
412
413
413
static bool append_host_questions_for_services (mdns_out_question_t * * questions , mdns_srv_item_t * services [],
414
- size_t len , bool unicast )
414
+ size_t len , bool unicast )
415
415
{
416
416
if (!mdns_utils_str_null_or_empty (mdns_priv_get_global_hostname ()) &&
417
417
!append_host_question (questions , mdns_priv_get_global_hostname (), unicast )) {
@@ -491,12 +491,12 @@ static uint8_t append_reverse_ptr_record(uint8_t *packet, uint16_t *index, const
491
491
return 0 ;
492
492
}
493
493
494
- if (!_mdns_append_type (packet , index , MDNS_ANSWER_PTR , false, 10 /* TTL set to 10s*/ )) {
494
+ if (!append_type (packet , index , MDNS_ANSWER_PTR , false, 10 /* TTL set to 10s*/ )) {
495
495
return 0 ;
496
496
}
497
497
498
498
uint16_t data_len_location = * index - 2 ; /* store the position of size (2=16bis) of this record */
499
- const char * str [2 ] = {priv_get_self_host ()-> hostname , MDNS_UTILS_DEFAULT_DOMAIN };
499
+ const char * str [2 ] = {mdns_priv_get_self_host ()-> hostname , MDNS_UTILS_DEFAULT_DOMAIN };
500
500
501
501
int part_length = append_fqdn (packet , index , str , 2 , MDNS_MAX_PACKET_SIZE );
502
502
if (!part_length ) {
@@ -588,8 +588,7 @@ void mdns_priv_create_answer_from_parsed_packet(mdns_parsed_packet_t *parsed_pac
588
588
#ifdef CONFIG_MDNS_RESPOND_REVERSE_QUERIES
589
589
} else if (q -> type == MDNS_TYPE_PTR ) {
590
590
mdns_host_item_t * host = get_host_item (q -> host );
591
- #error
592
- if (!_mdns_alloc_answer (& packet -> answers , MDNS_TYPE_PTR , NULL , host , send_flush , false)) {
591
+ if (!mdns_priv_create_answer (& packet -> answers , MDNS_TYPE_PTR , NULL , host , send_flush , false)) {
593
592
mdns_priv_free_tx_packet (packet );
594
593
return ;
595
594
} else {
@@ -829,8 +828,8 @@ static uint16_t append_ptr_record(uint8_t *packet, uint16_t *index, const char *
829
828
* @return length of added data: 0 on error or length on success
830
829
*/
831
830
static uint16_t append_subtype_ptr_record (uint8_t * packet , uint16_t * index , const char * instance ,
832
- const char * subtype , const char * service , const char * proto , bool flush ,
833
- bool bye )
831
+ const char * subtype , const char * service , const char * proto , bool flush ,
832
+ bool bye )
834
833
{
835
834
const char * subtype_str [5 ] = {subtype , MDNS_SUB_STR , service , proto , MDNS_UTILS_DEFAULT_DOMAIN };
836
835
const char * instance_str [4 ] = {instance , service , proto , MDNS_UTILS_DEFAULT_DOMAIN };
@@ -868,12 +867,12 @@ static uint16_t append_subtype_ptr_record(uint8_t *packet, uint16_t *index, cons
868
867
* @return number of answers added to the packet
869
868
*/
870
869
static uint8_t append_service_ptr_answers (uint8_t * packet , uint16_t * index , mdns_service_t * service , bool flush ,
871
- bool bye )
870
+ bool bye )
872
871
{
873
872
uint8_t appended_answers = 0 ;
874
873
875
874
if (append_ptr_record (packet , index , mdns_utils_get_service_instance_name (service ), service -> service ,
876
- service -> proto , flush , bye ) <= 0 ) {
875
+ service -> proto , flush , bye ) <= 0 ) {
877
876
return appended_answers ;
878
877
}
879
878
appended_answers ++ ;
@@ -882,7 +881,7 @@ static uint8_t append_service_ptr_answers(uint8_t *packet, uint16_t *index, mdns
882
881
while (subtype ) {
883
882
appended_answers +=
884
883
(append_subtype_ptr_record (packet , index , mdns_utils_get_service_instance_name (service ), subtype -> subtype ,
885
- service -> service , service -> proto , flush , bye ) > 0 );
884
+ service -> service , service -> proto , flush , bye ) > 0 );
886
885
subtype = subtype -> next ;
887
886
}
888
887
@@ -1180,7 +1179,7 @@ static uint16_t append_aaaa_record(uint8_t *packet, uint16_t *index, const char
1180
1179
#endif
1181
1180
1182
1181
static uint8_t append_host_answer (uint8_t * packet , uint16_t * index , mdns_host_item_t * host ,
1183
- uint8_t address_type , bool flush , bool bye )
1182
+ uint8_t address_type , bool flush , bool bye )
1184
1183
{
1185
1184
mdns_ip_addr_t * addr = host -> address_list ;
1186
1185
uint8_t num_records = 0 ;
@@ -1196,7 +1195,7 @@ static uint8_t append_host_answer(uint8_t *packet, uint16_t *index, mdns_host_it
1196
1195
#ifdef CONFIG_LWIP_IPV6
1197
1196
if (address_type == ESP_IPADDR_TYPE_V6 &&
1198
1197
append_aaaa_record (packet , index , host -> hostname , (uint8_t * )addr -> addr .u_addr .ip6 .addr , flush ,
1199
- bye ) <= 0 ) {
1198
+ bye ) <= 0 ) {
1200
1199
break ;
1201
1200
}
1202
1201
#endif /* CONFIG_LWIP_IPV6 */
@@ -1238,8 +1237,8 @@ static uint8_t append_answer(uint8_t *packet, uint16_t *index, mdns_out_answer_t
1238
1237
#endif /* CONFIG_MDNS_RESPOND_REVERSE_QUERIES */
1239
1238
} else {
1240
1239
return append_ptr_record (packet , index ,
1241
- answer -> custom_instance , answer -> custom_service , answer -> custom_proto ,
1242
- answer -> flush , answer -> bye ) > 0 ;
1240
+ answer -> custom_instance , answer -> custom_service , answer -> custom_proto ,
1241
+ answer -> flush , answer -> bye ) > 0 ;
1243
1242
}
1244
1243
} else if (answer -> type == MDNS_TYPE_SRV ) {
1245
1244
return append_srv_record (packet , index , answer -> service , answer -> flush , answer -> bye ) > 0 ;
@@ -1294,7 +1293,7 @@ static uint8_t append_answer(uint8_t *packet, uint16_t *index, mdns_out_answer_t
1294
1293
return 0 ;
1295
1294
}
1296
1295
if (append_aaaa_record (packet , index , mdns_priv_get_global_hostname (), (uint8_t * )if_ip6s [i ].addr ,
1297
- answer -> flush , answer -> bye ) <= 0 ) {
1296
+ answer -> flush , answer -> bye ) <= 0 ) {
1298
1297
return 0 ;
1299
1298
}
1300
1299
}
@@ -1308,13 +1307,13 @@ static uint8_t append_answer(uint8_t *packet, uint16_t *index, mdns_out_answer_t
1308
1307
return count ;
1309
1308
}
1310
1309
if (append_aaaa_record (packet , index , mdns_priv_get_global_hostname (), (uint8_t * )other_ip6 .addr ,
1311
- answer -> flush , answer -> bye ) > 0 ) {
1310
+ answer -> flush , answer -> bye ) > 0 ) {
1312
1311
return 1 + count ;
1313
1312
}
1314
1313
return count ;
1315
1314
} else if (answer -> host != NULL ) {
1316
1315
return append_host_answer (packet , index , answer -> host , ESP_IPADDR_TYPE_V6 , answer -> flush ,
1317
- answer -> bye );
1316
+ answer -> bye );
1318
1317
}
1319
1318
}
1320
1319
#endif /* CONFIG_LWIP_IPV6 */
0 commit comments