Skip to content

Commit 907087c

Browse files
committed
fix(mdns): Move MDNS_NAME_BUF_LEN to public headers
Since it's used by public API as maximum length of user buffer Closes #724
1 parent 68a9e14 commit 907087c

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

components/mdns/include/mdns.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -10,6 +10,7 @@
1010
extern "C" {
1111
#endif
1212

13+
#include "sdkconfig.h"
1314
#include <esp_netif.h>
1415

1516
#define MDNS_TYPE_A 0x0001
@@ -21,6 +22,13 @@ extern "C" {
2122
#define MDNS_TYPE_NSEC 0x002F
2223
#define MDNS_TYPE_ANY 0x00FF
2324

25+
#if defined(CONFIG_LWIP_IPV6) && defined(CONFIG_MDNS_RESPOND_REVERSE_QUERIES)
26+
#define MDNS_NAME_MAX_LEN (64+4) // Need to account for IPv6 reverse queries (64 char address + ".ip6" )
27+
#else
28+
#define MDNS_NAME_MAX_LEN 64 // Maximum string length of hostname, instance, service and proto
29+
#endif
30+
#define MDNS_NAME_BUF_LEN (MDNS_NAME_MAX_LEN+1) // Maximum char buffer size to hold hostname, instance, service or proto
31+
2432
/**
2533
* @brief Asynchronous query handle
2634
*/

components/mdns/private_include/mdns_private.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -103,12 +103,6 @@
103103
#define MDNS_PACKET_QUEUE_LEN 16 // Maximum packets that can be queued for parsing
104104
#define MDNS_ACTION_QUEUE_LEN CONFIG_MDNS_ACTION_QUEUE_LEN // Maximum actions pending to the server
105105
#define MDNS_TXT_MAX_LEN 1024 // Maximum string length of text data in TXT record
106-
#if defined(CONFIG_LWIP_IPV6) && defined(CONFIG_MDNS_RESPOND_REVERSE_QUERIES)
107-
#define MDNS_NAME_MAX_LEN (64+4) // Need to account for IPv6 reverse queries (64 char address + ".ip6" )
108-
#else
109-
#define MDNS_NAME_MAX_LEN 64 // Maximum string length of hostname, instance, service and proto
110-
#endif
111-
#define MDNS_NAME_BUF_LEN (MDNS_NAME_MAX_LEN+1) // Maximum char buffer size to hold hostname, instance, service or proto
112106
#define MDNS_MAX_PACKET_SIZE 1460 // Maximum size of mDNS outgoing packet
113107

114108
#define MDNS_HEAD_LEN 12

0 commit comments

Comments
 (0)