| 
									
										
										
										
											2021-09-30 15:18:16 +08:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2025-01-10 10:33:02 +01:00
										 |  |  |  * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD | 
					
						
							| 
									
										
										
										
											2021-09-30 15:18:16 +08:00
										 |  |  |  * | 
					
						
							|  |  |  |  * SPDX-License-Identifier: Apache-2.0 | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  | #ifndef ESP_MDNS_H_
 | 
					
						
							|  |  |  | #define ESP_MDNS_H_
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifdef __cplusplus
 | 
					
						
							|  |  |  | extern "C" { | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-10 10:33:02 +01:00
										 |  |  | #include "sdkconfig.h"
 | 
					
						
							| 
									
										
										
										
											2019-08-31 19:06:54 +02:00
										 |  |  | #include <esp_netif.h>
 | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  | #define MDNS_TYPE_A                 0x0001
 | 
					
						
							|  |  |  | #define MDNS_TYPE_PTR               0x000C
 | 
					
						
							|  |  |  | #define MDNS_TYPE_TXT               0x0010
 | 
					
						
							|  |  |  | #define MDNS_TYPE_AAAA              0x001C
 | 
					
						
							|  |  |  | #define MDNS_TYPE_SRV               0x0021
 | 
					
						
							|  |  |  | #define MDNS_TYPE_OPT               0x0029
 | 
					
						
							|  |  |  | #define MDNS_TYPE_NSEC              0x002F
 | 
					
						
							|  |  |  | #define MDNS_TYPE_ANY               0x00FF
 | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-10 10:33:02 +01:00
										 |  |  | #if defined(CONFIG_LWIP_IPV6) && defined(CONFIG_MDNS_RESPOND_REVERSE_QUERIES)
 | 
					
						
							|  |  |  | #define MDNS_NAME_MAX_LEN           (64+4)                  // Need to account for IPv6 reverse queries (64 char address  + ".ip6" )
 | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | #define MDNS_NAME_MAX_LEN           64                      // Maximum string length of hostname, instance, service and proto
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | #define MDNS_NAME_BUF_LEN           (MDNS_NAME_MAX_LEN+1)   // Maximum char buffer size to hold hostname, instance, service or proto
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-03 16:56:12 +02:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * @brief   Asynchronous query handle | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | typedef struct mdns_search_once_s mdns_search_once_t; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-06 17:39:10 +08:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * @brief   Daemon query handle | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | typedef struct mdns_browse_s mdns_browse_t; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-12-13 17:15:54 +01:00
										 |  |  | typedef enum { | 
					
						
							|  |  |  |     MDNS_EVENT_ENABLE_IP4                   = 1 << 1, | 
					
						
							|  |  |  |     MDNS_EVENT_ENABLE_IP6                   = 1 << 2, | 
					
						
							|  |  |  |     MDNS_EVENT_ANNOUNCE_IP4                 = 1 << 3, | 
					
						
							|  |  |  |     MDNS_EVENT_ANNOUNCE_IP6                 = 1 << 4, | 
					
						
							|  |  |  |     MDNS_EVENT_DISABLE_IP4                  = 1 << 5, | 
					
						
							|  |  |  |     MDNS_EVENT_DISABLE_IP6                  = 1 << 6, | 
					
						
							| 
									
										
										
										
											2023-01-16 23:13:11 +01:00
										 |  |  |     MDNS_EVENT_IP4_REVERSE_LOOKUP           = 1 << 7, | 
					
						
							|  |  |  |     MDNS_EVENT_IP6_REVERSE_LOOKUP           = 1 << 8, | 
					
						
							| 
									
										
										
										
											2021-12-13 17:15:54 +01:00
										 |  |  | } mdns_event_actions_t; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  | /**
 | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  |  * @brief   mDNS enum to specify the ip_protocol type | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | typedef enum { | 
					
						
							|  |  |  |     MDNS_IP_PROTOCOL_V4, | 
					
						
							|  |  |  |     MDNS_IP_PROTOCOL_V6, | 
					
						
							|  |  |  |     MDNS_IP_PROTOCOL_MAX | 
					
						
							|  |  |  | } mdns_ip_protocol_t; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * @brief   mDNS basic text item structure | 
					
						
							|  |  |  |  *          Used in mdns_service_add() | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | typedef struct { | 
					
						
							| 
									
										
										
										
											2019-05-03 16:31:11 +02:00
										 |  |  |     const char *key;                        /*!< item key name */ | 
					
						
							|  |  |  |     const char *value;                      /*!< item value string */ | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  | } mdns_txt_item_t; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-12 15:43:06 +08:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * @brief   mDNS basic subtype item structure | 
					
						
							|  |  |  |  *          Used in mdns_service_subtype_xxx() APIs | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | typedef struct { | 
					
						
							|  |  |  |     const char *subtype;                        /*!< subtype name */ | 
					
						
							|  |  |  | } mdns_subtype_item_t; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * @brief   mDNS query linked list IP item | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | typedef struct mdns_ip_addr_s { | 
					
						
							| 
									
										
										
										
											2019-08-31 19:06:54 +02:00
										 |  |  |     esp_ip_addr_t addr;                     /*!< IP address */ | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  |     struct mdns_ip_addr_s *next;            /*!< next IP, or NULL for the last IP in the list */ | 
					
						
							|  |  |  | } mdns_ip_addr_t; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-10 09:16:10 +01:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * @brief mDNS query type to be explicitly set to either Unicast or Multicast | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | typedef enum { | 
					
						
							|  |  |  |     MDNS_QUERY_UNICAST, | 
					
						
							|  |  |  |     MDNS_QUERY_MULTICAST, | 
					
						
							|  |  |  | } mdns_query_transmission_type_t; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * @brief   mDNS query result structure | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  |  */ | 
					
						
							|  |  |  | typedef struct mdns_result_s { | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  |     struct mdns_result_s *next;             /*!< next result, or NULL for the last result in the list */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-12-14 16:14:21 +01:00
										 |  |  |     esp_netif_t *esp_netif;                 /*!< ptr to corresponding esp-netif */ | 
					
						
							| 
									
										
										
										
											2021-04-21 15:34:22 +08:00
										 |  |  |     uint32_t ttl;                           /*!< time to live */ | 
					
						
							| 
									
										
										
										
											2019-08-31 19:06:54 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  |     mdns_ip_protocol_t ip_protocol;         /*!< ip_protocol type of the interface (v4/v6) */ | 
					
						
							|  |  |  |     // PTR
 | 
					
						
							|  |  |  |     char *instance_name;                    /*!< instance name */ | 
					
						
							| 
									
										
										
										
											2021-04-21 15:34:22 +08:00
										 |  |  |     char *service_type;                     /*!< service type */ | 
					
						
							|  |  |  |     char *proto;                            /*!< srevice protocol */ | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  |     // SRV
 | 
					
						
							|  |  |  |     char *hostname;                         /*!< hostname */ | 
					
						
							|  |  |  |     uint16_t port;                          /*!< service port */ | 
					
						
							|  |  |  |     // TXT
 | 
					
						
							|  |  |  |     mdns_txt_item_t *txt;                   /*!< txt record */ | 
					
						
							| 
									
										
										
										
											2021-06-15 20:13:00 +08:00
										 |  |  |     uint8_t *txt_value_len;                 /*!< array of txt value len of each record */ | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  |     size_t txt_count;                       /*!< number of txt items */ | 
					
						
							|  |  |  |     // A and AAAA
 | 
					
						
							| 
									
										
										
										
											2019-12-19 10:31:02 +01:00
										 |  |  |     mdns_ip_addr_t *addr;                   /*!< linked list of IP addresses found */ | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  | } mdns_result_t; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-05 16:59:04 +08:00
										 |  |  | typedef void (*mdns_query_notify_t)(mdns_search_once_t *search); | 
					
						
							| 
									
										
										
										
											2024-03-06 17:39:10 +08:00
										 |  |  | typedef void (*mdns_browse_notify_t)(mdns_result_t *result); | 
					
						
							| 
									
										
										
										
											2021-08-05 16:59:04 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * @brief  Initialize mDNS on given interface | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  *     - ESP_OK on success | 
					
						
							| 
									
										
										
										
											2019-03-22 08:49:12 +01:00
										 |  |  |  *     - ESP_ERR_INVALID_STATE when failed to register event handler | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  |  *     - ESP_ERR_NO_MEM on memory error | 
					
						
							| 
									
										
										
										
											2019-03-22 08:49:12 +01:00
										 |  |  |  *     - ESP_FAIL when failed to start mdns task | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2019-07-16 16:33:30 +07:00
										 |  |  | esp_err_t mdns_init(void); | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * @brief  Stop and free mDNS server | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2019-07-16 16:33:30 +07:00
										 |  |  | void mdns_free(void); | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * @brief  Set the hostname for mDNS server | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  |  *         required if you want to advertise services | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  |  * | 
					
						
							|  |  |  |  * @param  hostname     Hostname to set | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  *     - ESP_OK success | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_ARG Parameter error | 
					
						
							|  |  |  |  *     - ESP_ERR_NO_MEM memory error | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  | esp_err_t mdns_hostname_set(const char *hostname); | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-18 12:22:21 +08:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * @brief Get the hostname for mDNS server | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @param hostname      pointer to the hostname, it should be allocated | 
					
						
							|  |  |  |  *                      and hold at least MDNS_NAME_BUF_LEN chars | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  *     - ESP_OK success | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_ARG Parameter error | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_STATE when mdns is not initialized | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | esp_err_t mdns_hostname_get(char *hostname); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-04-07 16:21:16 +08:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * @brief  Adds a hostname and address to be delegated | 
					
						
							|  |  |  |  *         A/AAAA queries will be replied for the hostname and | 
					
						
							|  |  |  |  *         services can be added to this host. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @param  hostname     Hostname to add | 
					
						
							|  |  |  |  * @param  address_list The IP address list of the host | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  *     - ESP_OK success | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_STATE mDNS is not running | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_ARG Parameter error | 
					
						
							|  |  |  |  *     - ESP_ERR_NO_MEM memory error | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | esp_err_t mdns_delegate_hostname_add(const char *hostname, const mdns_ip_addr_t *address_list); | 
					
						
							| 
									
										
										
										
											2021-03-30 13:19:01 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-27 16:14:52 +08:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * @brief  Set the address to a delegated hostname | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @param  hostname     Hostname to set | 
					
						
							|  |  |  |  * @param  address_list The IP address list of the host | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  *     - ESP_OK success | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_STATE mDNS is not running | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_ARG Parameter error | 
					
						
							|  |  |  |  *     - ESP_ERR_NO_MEM memory error | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | esp_err_t mdns_delegate_hostname_set_address(const char *hostname, const mdns_ip_addr_t *address_list); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-04-07 16:21:16 +08:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * @brief  Remove a delegated hostname | 
					
						
							|  |  |  |  *         All the services added to this host will also be removed. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @param  hostname     Hostname to remove | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  *     - ESP_OK success | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_STATE mDNS is not running | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_ARG Parameter error | 
					
						
							|  |  |  |  *     - ESP_ERR_NO_MEM memory error | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2021-04-02 18:06:10 +08:00
										 |  |  | esp_err_t mdns_delegate_hostname_remove(const char *hostname); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-04-07 16:21:16 +08:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * @brief  Query whether a hostname has been added | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @param  hostname     Hostname to query | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  *     - true   The hostname has been added. | 
					
						
							|  |  |  |  *     - false  The hostname has not been added. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | bool mdns_hostname_exists(const char *hostname); | 
					
						
							| 
									
										
										
										
											2021-03-30 13:19:01 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * @brief  Set the default instance name for mDNS server | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  |  * @param  instance_name     Instance name to set | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  |  * | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  *     - ESP_OK success | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_ARG Parameter error | 
					
						
							|  |  |  |  *     - ESP_ERR_NO_MEM memory error | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  | esp_err_t mdns_instance_name_set(const char *instance_name); | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * @brief  Add service to mDNS server | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2021-06-15 20:13:00 +08:00
										 |  |  |  * @note The value length of txt items will be automatically decided by strlen | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  |  * @param  instance_name    instance name to set. If NULL, | 
					
						
							| 
									
										
										
										
											2021-09-13 19:33:02 +08:00
										 |  |  |  *                          global instance name or hostname will be used. | 
					
						
							|  |  |  |  *                          Note that MDNS_MULTIPLE_INSTANCE config option | 
					
						
							|  |  |  |  *                          needs to be enabled for adding multiple instances | 
					
						
							|  |  |  |  *                          with the same instance type. | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  |  * @param  service_type     service type (_http, _ftp, etc) | 
					
						
							|  |  |  |  * @param  proto            service protocol (_tcp, _udp) | 
					
						
							|  |  |  |  * @param  port             service port | 
					
						
							|  |  |  |  * @param  txt              string array of TXT data (eg. {{"var","val"},{"other","2"}}) | 
					
						
							| 
									
										
										
										
											2019-03-22 08:49:12 +01:00
										 |  |  |  * @param  num_items        number of items in TXT data | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  |  * | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  *     - ESP_OK success | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_ARG Parameter error | 
					
						
							|  |  |  |  *     - ESP_ERR_NO_MEM memory error | 
					
						
							| 
									
										
										
										
											2019-12-19 10:31:02 +01:00
										 |  |  |  *     - ESP_FAIL failed to add service | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  | esp_err_t mdns_service_add(const char *instance_name, const char *service_type, const char *proto, uint16_t port, mdns_txt_item_t txt[], size_t num_items); | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-04-07 16:21:16 +08:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * @brief  Add service to mDNS server with a delegated hostname | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2021-06-15 20:13:00 +08:00
										 |  |  |  * @note The value length of txt items will be automatically decided by strlen | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2021-04-07 16:21:16 +08:00
										 |  |  |  * @param  instance_name    instance name to set. If NULL, | 
					
						
							|  |  |  |  *                          global instance name or hostname will be used | 
					
						
							| 
									
										
										
										
											2021-09-13 19:33:02 +08:00
										 |  |  |  *                          Note that MDNS_MULTIPLE_INSTANCE config option | 
					
						
							|  |  |  |  *                          needs to be enabled for adding multiple instances | 
					
						
							|  |  |  |  *                          with the same instance type. | 
					
						
							| 
									
										
										
										
											2021-04-07 16:21:16 +08:00
										 |  |  |  * @param  service_type     service type (_http, _ftp, etc) | 
					
						
							|  |  |  |  * @param  proto            service protocol (_tcp, _udp) | 
					
						
							|  |  |  |  * @param  hostname         service hostname. If NULL, local hostname will be used. | 
					
						
							|  |  |  |  * @param  port             service port | 
					
						
							|  |  |  |  * @param  txt              string array of TXT data (eg. {{"var","val"},{"other","2"}}) | 
					
						
							|  |  |  |  * @param  num_items        number of items in TXT data | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  *     - ESP_OK success | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_ARG Parameter error | 
					
						
							|  |  |  |  *     - ESP_ERR_NO_MEM memory error | 
					
						
							|  |  |  |  *     - ESP_FAIL failed to add service | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | esp_err_t mdns_service_add_for_host(const char *instance_name, const char *service_type, const char *proto, | 
					
						
							|  |  |  |                                     const char *hostname, uint16_t port, mdns_txt_item_t txt[], size_t num_items); | 
					
						
							| 
									
										
										
										
											2021-03-30 13:19:01 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-04-07 16:21:16 +08:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * @brief  Check whether a service has been added. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @param  service_type     service type (_http, _ftp, etc) | 
					
						
							|  |  |  |  * @param  proto            service protocol (_tcp, _udp) | 
					
						
							|  |  |  |  * @param  hostname         service hostname. If NULL, checks for the local hostname. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  *     - true   Correspondding service has been added. | 
					
						
							|  |  |  |  *     - false  Service not found. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | bool mdns_service_exists(const char *service_type, const char *proto, const char *hostname); | 
					
						
							| 
									
										
										
										
											2021-03-30 13:19:01 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-13 19:33:02 +08:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * @brief  Check whether a service has been added. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @param  instance         instance name | 
					
						
							|  |  |  |  * @param  service_type     service type (_http, _ftp, etc) | 
					
						
							|  |  |  |  * @param  proto            service protocol (_tcp, _udp) | 
					
						
							|  |  |  |  * @param  hostname         service hostname. If NULL, checks for the local hostname. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  *     - true   Correspondding service has been added. | 
					
						
							|  |  |  |  *     - false  Service not found. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | bool mdns_service_exists_with_instance(const char *instance, const char *service_type, const char *proto, | 
					
						
							|  |  |  |                                        const char *hostname); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * @brief  Remove service from mDNS server | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  |  * @param  service_type service type (_http, _ftp, etc) | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  |  * @param  proto        service protocol (_tcp, _udp) | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  *     - ESP_OK success | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_ARG Parameter error | 
					
						
							|  |  |  |  *     - ESP_ERR_NOT_FOUND Service not found | 
					
						
							| 
									
										
										
										
											2019-03-22 08:49:12 +01:00
										 |  |  |  *     - ESP_ERR_NO_MEM memory error | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  | esp_err_t mdns_service_remove(const char *service_type, const char *proto); | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-04-07 16:21:16 +08:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * @brief  Remove service from mDNS server with hostname | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2021-11-26 17:27:18 +08:00
										 |  |  |  * @param  instance     instance name | 
					
						
							| 
									
										
										
										
											2021-04-07 16:21:16 +08:00
										 |  |  |  * @param  service_type service type (_http, _ftp, etc) | 
					
						
							|  |  |  |  * @param  proto        service protocol (_tcp, _udp) | 
					
						
							|  |  |  |  * @param  hostname     service hostname. If NULL, local hostname will be used. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  *     - ESP_OK success | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_ARG Parameter error | 
					
						
							|  |  |  |  *     - ESP_ERR_NOT_FOUND Service not found | 
					
						
							|  |  |  |  *     - ESP_ERR_NO_MEM memory error | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2021-11-26 17:27:18 +08:00
										 |  |  | esp_err_t mdns_service_remove_for_host(const char *instance, const char *service_type, const char *proto, const char *hostname); | 
					
						
							| 
									
										
										
										
											2021-03-30 13:19:01 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * @brief  Set instance name for service | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  |  * @param  service_type     service type (_http, _ftp, etc) | 
					
						
							|  |  |  |  * @param  proto            service protocol (_tcp, _udp) | 
					
						
							|  |  |  |  * @param  instance_name    instance name to set | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  |  * | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  *     - ESP_OK success | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_ARG Parameter error | 
					
						
							|  |  |  |  *     - ESP_ERR_NOT_FOUND Service not found | 
					
						
							|  |  |  |  *     - ESP_ERR_NO_MEM memory error | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  | esp_err_t mdns_service_instance_name_set(const char *service_type, const char *proto, const char *instance_name); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-04-07 16:21:16 +08:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * @brief  Set instance name for service with hostname | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2021-11-26 17:27:18 +08:00
										 |  |  |  * @param  instance_old     original instance name | 
					
						
							| 
									
										
										
										
											2021-04-07 16:21:16 +08:00
										 |  |  |  * @param  service_type     service type (_http, _ftp, etc) | 
					
						
							|  |  |  |  * @param  proto            service protocol (_tcp, _udp) | 
					
						
							|  |  |  |  * @param  hostname         service hostname. If NULL, local hostname will be used. | 
					
						
							|  |  |  |  * @param  instance_name    instance name to set | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  *     - ESP_OK success | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_ARG Parameter error | 
					
						
							|  |  |  |  *     - ESP_ERR_NOT_FOUND Service not found | 
					
						
							|  |  |  |  *     - ESP_ERR_NO_MEM memory error | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2021-11-26 17:27:18 +08:00
										 |  |  | esp_err_t mdns_service_instance_name_set_for_host(const char *instance_old, const char *service_type, const char *proto, const char *hostname, | 
					
						
							| 
									
										
										
										
											2025-02-27 10:42:03 +01:00
										 |  |  |                                                   const char *instance_name); | 
					
						
							| 
									
										
										
										
											2021-03-30 13:19:01 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * @brief  Set service port | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @param  service_type service type (_http, _ftp, etc) | 
					
						
							|  |  |  |  * @param  proto        service protocol (_tcp, _udp) | 
					
						
							|  |  |  |  * @param  port         service port | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  *     - ESP_OK success | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_ARG Parameter error | 
					
						
							|  |  |  |  *     - ESP_ERR_NOT_FOUND Service not found | 
					
						
							| 
									
										
										
										
											2019-03-22 08:49:12 +01:00
										 |  |  |  *     - ESP_ERR_NO_MEM memory error | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  |  */ | 
					
						
							|  |  |  | esp_err_t mdns_service_port_set(const char *service_type, const char *proto, uint16_t port); | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-30 13:19:01 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-04-07 16:21:16 +08:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * @brief  Set service port with hostname | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2021-11-26 17:27:18 +08:00
										 |  |  |  * @param  instance     instance name | 
					
						
							| 
									
										
										
										
											2021-04-07 16:21:16 +08:00
										 |  |  |  * @param  service_type service type (_http, _ftp, etc) | 
					
						
							|  |  |  |  * @param  proto        service protocol (_tcp, _udp) | 
					
						
							|  |  |  |  * @param  hostname     service hostname. If NULL, local hostname will be used. | 
					
						
							|  |  |  |  * @param  port         service port | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  *     - ESP_OK success | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_ARG Parameter error | 
					
						
							|  |  |  |  *     - ESP_ERR_NOT_FOUND Service not found | 
					
						
							|  |  |  |  *     - ESP_ERR_NO_MEM memory error | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2021-11-26 17:27:18 +08:00
										 |  |  | esp_err_t mdns_service_port_set_for_host(const char *instance, const char *service_type, const char *proto, const char *hostname, | 
					
						
							| 
									
										
										
										
											2025-02-27 10:42:03 +01:00
										 |  |  |                                          uint16_t port); | 
					
						
							| 
									
										
										
										
											2021-03-30 13:19:01 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  | /**
 | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  |  * @brief  Replace all TXT items for service | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2021-06-15 20:13:00 +08:00
										 |  |  |  * @note The value length of txt items will be automatically decided by strlen | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  |  * @param  service_type service type (_http, _ftp, etc) | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  |  * @param  proto        service protocol (_tcp, _udp) | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  |  * @param  txt          array of TXT data (eg. {{"var","val"},{"other","2"}}) | 
					
						
							| 
									
										
										
										
											2019-03-22 08:49:12 +01:00
										 |  |  |  * @param  num_items    number of items in TXT data | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  |  * | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  *     - ESP_OK success | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_ARG Parameter error | 
					
						
							|  |  |  |  *     - ESP_ERR_NOT_FOUND Service not found | 
					
						
							|  |  |  |  *     - ESP_ERR_NO_MEM memory error | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  | esp_err_t mdns_service_txt_set(const char *service_type, const char *proto, mdns_txt_item_t txt[], uint8_t num_items); | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-04-07 16:21:16 +08:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * @brief  Replace all TXT items for service with hostname | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2021-06-15 20:13:00 +08:00
										 |  |  |  * @note The value length of txt items will be automatically decided by strlen | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2021-11-26 17:27:18 +08:00
										 |  |  |  * @param  instance     instance name | 
					
						
							| 
									
										
										
										
											2021-04-07 16:21:16 +08:00
										 |  |  |  * @param  service_type service type (_http, _ftp, etc) | 
					
						
							|  |  |  |  * @param  proto        service protocol (_tcp, _udp) | 
					
						
							|  |  |  |  * @param  hostname     service hostname. If NULL, local hostname will be used. | 
					
						
							|  |  |  |  * @param  txt          array of TXT data (eg. {{"var","val"},{"other","2"}}) | 
					
						
							|  |  |  |  * @param  num_items    number of items in TXT data | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  *     - ESP_OK success | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_ARG Parameter error | 
					
						
							|  |  |  |  *     - ESP_ERR_NOT_FOUND Service not found | 
					
						
							|  |  |  |  *     - ESP_ERR_NO_MEM memory error | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2021-11-26 17:27:18 +08:00
										 |  |  | esp_err_t mdns_service_txt_set_for_host(const char *instance, const char *service_type, const char *proto, const char *hostname, | 
					
						
							| 
									
										
										
										
											2021-03-30 13:19:01 +08:00
										 |  |  |                                         mdns_txt_item_t txt[], uint8_t num_items); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  | /**
 | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  |  * @brief  Set/Add TXT item for service TXT record | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2021-06-15 20:13:00 +08:00
										 |  |  |  * @note The value length will be automatically decided by strlen | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  |  * @param  service_type service type (_http, _ftp, etc) | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  |  * @param  proto        service protocol (_tcp, _udp) | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  |  * @param  key          the key that you want to add/update | 
					
						
							|  |  |  |  * @param  value        the new value of the key | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  |  * | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  *     - ESP_OK success | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_ARG Parameter error | 
					
						
							|  |  |  |  *     - ESP_ERR_NOT_FOUND Service not found | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  |  *     - ESP_ERR_NO_MEM memory error | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  | esp_err_t mdns_service_txt_item_set(const char *service_type, const char *proto, const char *key, const char *value); | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-15 20:13:00 +08:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * @brief  Set/Add TXT item for service TXT record | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @param  service_type service type (_http, _ftp, etc) | 
					
						
							|  |  |  |  * @param  proto        service protocol (_tcp, _udp) | 
					
						
							|  |  |  |  * @param  key          the key that you want to add/update | 
					
						
							|  |  |  |  * @param  value        the new value of the key | 
					
						
							|  |  |  |  * @param  value_len    the length of the value | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  *     - ESP_OK success | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_ARG Parameter error | 
					
						
							|  |  |  |  *     - ESP_ERR_NOT_FOUND Service not found | 
					
						
							|  |  |  |  *     - ESP_ERR_NO_MEM memory error | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | esp_err_t mdns_service_txt_item_set_with_explicit_value_len(const char *service_type, const char *proto, | 
					
						
							| 
									
										
										
										
											2025-02-27 10:42:03 +01:00
										 |  |  |                                                             const char *key, const char *value, uint8_t value_len); | 
					
						
							| 
									
										
										
										
											2021-03-30 13:19:01 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-04-07 16:21:16 +08:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * @brief  Set/Add TXT item for service TXT record with hostname | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2021-06-15 20:13:00 +08:00
										 |  |  |  * @note The value length will be automatically decided by strlen | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2021-11-26 17:27:18 +08:00
										 |  |  |  * @param  instance     instance name | 
					
						
							| 
									
										
										
										
											2021-04-07 16:21:16 +08:00
										 |  |  |  * @param  service_type service type (_http, _ftp, etc) | 
					
						
							|  |  |  |  * @param  proto        service protocol (_tcp, _udp) | 
					
						
							|  |  |  |  * @param  hostname     service hostname. If NULL, local hostname will be used. | 
					
						
							|  |  |  |  * @param  key          the key that you want to add/update | 
					
						
							|  |  |  |  * @param  value        the new value of the key | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  *     - ESP_OK success | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_ARG Parameter error | 
					
						
							|  |  |  |  *     - ESP_ERR_NOT_FOUND Service not found | 
					
						
							|  |  |  |  *     - ESP_ERR_NO_MEM memory error | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2021-11-26 17:27:18 +08:00
										 |  |  | esp_err_t mdns_service_txt_item_set_for_host(const char *instance, const char *service_type, const char *proto, const char *hostname, | 
					
						
							| 
									
										
										
										
											2025-02-27 10:42:03 +01:00
										 |  |  |                                              const char *key, const char *value); | 
					
						
							| 
									
										
										
										
											2021-03-30 13:19:01 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-15 20:13:00 +08:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * @brief  Set/Add TXT item for service TXT record with hostname and txt value length | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2021-11-26 17:27:18 +08:00
										 |  |  |  * @param  instance     instance name | 
					
						
							| 
									
										
										
										
											2021-06-15 20:13:00 +08:00
										 |  |  |  * @param  service_type service type (_http, _ftp, etc) | 
					
						
							|  |  |  |  * @param  proto        service protocol (_tcp, _udp) | 
					
						
							|  |  |  |  * @param  hostname     service hostname. If NULL, local hostname will be used. | 
					
						
							|  |  |  |  * @param  key          the key that you want to add/update | 
					
						
							|  |  |  |  * @param  value        the new value of the key | 
					
						
							|  |  |  |  * @param  value_len    the length of the value | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  *     - ESP_OK success | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_ARG Parameter error | 
					
						
							|  |  |  |  *     - ESP_ERR_NOT_FOUND Service not found | 
					
						
							|  |  |  |  *     - ESP_ERR_NO_MEM memory error | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2021-11-26 17:27:18 +08:00
										 |  |  | esp_err_t mdns_service_txt_item_set_for_host_with_explicit_value_len(const char *instance, const char *service_type, const char *proto, | 
					
						
							| 
									
										
										
										
											2025-02-27 10:42:03 +01:00
										 |  |  |                                                                      const char *hostname, const char *key, | 
					
						
							|  |  |  |                                                                      const char *value, uint8_t value_len); | 
					
						
							| 
									
										
										
										
											2021-06-15 20:13:00 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  | /**
 | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  |  * @brief  Remove TXT item for service TXT record | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  |  * @param  service_type service type (_http, _ftp, etc) | 
					
						
							|  |  |  |  * @param  proto        service protocol (_tcp, _udp) | 
					
						
							|  |  |  |  * @param  key          the key that you want to remove | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  *     - ESP_OK success | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_ARG Parameter error | 
					
						
							|  |  |  |  *     - ESP_ERR_NOT_FOUND Service not found | 
					
						
							|  |  |  |  *     - ESP_ERR_NO_MEM memory error | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | esp_err_t mdns_service_txt_item_remove(const char *service_type, const char *proto, const char *key); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-04-07 16:21:16 +08:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * @brief  Remove TXT item for service TXT record with hostname | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2021-11-26 17:27:18 +08:00
										 |  |  |  * @param  instance     instance name | 
					
						
							| 
									
										
										
										
											2021-04-07 16:21:16 +08:00
										 |  |  |  * @param  service_type service type (_http, _ftp, etc) | 
					
						
							|  |  |  |  * @param  proto        service protocol (_tcp, _udp) | 
					
						
							|  |  |  |  * @param  hostname     service hostname. If NULL, local hostname will be used. | 
					
						
							|  |  |  |  * @param  key          the key that you want to remove | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  *     - ESP_OK success | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_ARG Parameter error | 
					
						
							|  |  |  |  *     - ESP_ERR_NOT_FOUND Service not found | 
					
						
							|  |  |  |  *     - ESP_ERR_NO_MEM memory error | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2021-11-26 17:27:18 +08:00
										 |  |  | esp_err_t mdns_service_txt_item_remove_for_host(const char *instance, const char *service_type, const char *proto, const char *hostname, | 
					
						
							| 
									
										
										
										
											2025-02-27 10:42:03 +01:00
										 |  |  |                                                 const char *key); | 
					
						
							| 
									
										
										
										
											2021-03-30 13:19:01 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-30 15:18:16 +08:00
										 |  |  | /**
 | 
					
						
							| 
									
										
										
										
											2024-11-12 15:43:06 +08:00
										 |  |  |  * @brief  Add a subtype for service. | 
					
						
							| 
									
										
										
										
											2021-09-30 15:18:16 +08:00
										 |  |  |  * | 
					
						
							|  |  |  |  * @param  instance_name    instance name. If NULL, will find the first service with the same service type and protocol. | 
					
						
							|  |  |  |  * @param  service_type     service type (_http, _ftp, etc) | 
					
						
							|  |  |  |  * @param  proto            service protocol (_tcp, _udp) | 
					
						
							|  |  |  |  * @param  hostname         service hostname. If NULL, local hostname will be used. | 
					
						
							|  |  |  |  * @param  subtype          The subtype to add. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  *     - ESP_OK success | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_ARG Parameter error | 
					
						
							|  |  |  |  *     - ESP_ERR_NOT_FOUND Service not found | 
					
						
							|  |  |  |  *     - ESP_ERR_NO_MEM memory error | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | esp_err_t mdns_service_subtype_add_for_host(const char *instance_name, const char *service_type, const char *proto, | 
					
						
							| 
									
										
										
										
											2025-02-27 10:42:03 +01:00
										 |  |  |                                             const char *hostname, const char *subtype); | 
					
						
							| 
									
										
										
										
											2021-09-30 15:18:16 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-12 15:43:06 +08:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * @brief  Remove a subtype for service. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @param  instance_name    instance name. If NULL, will find the first service with the same service type and protocol. | 
					
						
							|  |  |  |  * @param  service_type     service type (_http, _ftp, etc) | 
					
						
							|  |  |  |  * @param  proto            service protocol (_tcp, _udp) | 
					
						
							|  |  |  |  * @param  hostname         service hostname. If NULL, local hostname will be used. | 
					
						
							|  |  |  |  * @param  subtype          The subtype to remove. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  *     - ESP_OK success | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_ARG Parameter error | 
					
						
							|  |  |  |  *     - ESP_ERR_NOT_FOUND Service not found | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | esp_err_t mdns_service_subtype_remove_for_host(const char *instance_name, const char *service_type, const char *proto, | 
					
						
							| 
									
										
										
										
											2025-02-27 10:42:03 +01:00
										 |  |  |                                                const char *hostname, const char *subtype); | 
					
						
							| 
									
										
										
										
											2024-11-12 15:43:06 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * @brief  Add multiple subtypes for service at once. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @param  instance_name    instance name. If NULL, will find the first service with the same service type and protocol. | 
					
						
							|  |  |  |  * @param  service_type     service type (_http, _ftp, etc) | 
					
						
							|  |  |  |  * @param  proto            service protocol (_tcp, _udp) | 
					
						
							|  |  |  |  * @param  hostname         service hostname. If NULL, local hostname will be used. | 
					
						
							|  |  |  |  * @param  subtype          the pointer of subtype array to add. | 
					
						
							|  |  |  |  * @param  num_items        number of items in subtype array | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  *     - ESP_OK success | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_ARG Parameter error | 
					
						
							|  |  |  |  *     - ESP_ERR_NOT_FOUND Service not found | 
					
						
							|  |  |  |  *     - ESP_ERR_NO_MEM memory error | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | esp_err_t mdns_service_subtype_add_multiple_items_for_host(const char *instance_name, const char *service_type, const char *proto, | 
					
						
							| 
									
										
										
										
											2025-02-27 10:42:03 +01:00
										 |  |  |                                                            const char *hostname, mdns_subtype_item_t subtype[], uint8_t num_items); | 
					
						
							| 
									
										
										
										
											2024-11-12 15:43:06 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * @brief  Update subtype for service. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @param  instance_name    instance name. If NULL, will find the first service with the same service type and protocol. | 
					
						
							|  |  |  |  * @param  service_type     service type (_http, _ftp, etc) | 
					
						
							|  |  |  |  * @param  proto            service protocol (_tcp, _udp) | 
					
						
							|  |  |  |  * @param  hostname         service hostname. If NULL, local hostname will be used. | 
					
						
							|  |  |  |  * @param  subtype          the pointer of subtype array to add. | 
					
						
							|  |  |  |  * @param  num_items        number of items in subtype array | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2025-01-06 20:00:50 +08:00
										 |  |  |  * @note  If `num_items` is 0, then remove all subtypes. | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2024-11-12 15:43:06 +08:00
										 |  |  |  * @return | 
					
						
							|  |  |  |  *     - ESP_OK success | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_ARG Parameter error | 
					
						
							|  |  |  |  *     - ESP_ERR_NOT_FOUND Service not found | 
					
						
							|  |  |  |  *     - ESP_ERR_NO_MEM memory error | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | esp_err_t mdns_service_subtype_update_multiple_items_for_host(const char *instance_name, const char *service_type, const char *proto, | 
					
						
							| 
									
										
										
										
											2025-02-27 10:42:03 +01:00
										 |  |  |                                                               const char *hostname, mdns_subtype_item_t subtype[], uint8_t num_items); | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * @brief  Remove and free all services from mDNS server | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  |  * | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  *     - ESP_OK success | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_ARG Parameter error | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2019-07-16 16:33:30 +07:00
										 |  |  | esp_err_t mdns_service_remove_all(void); | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-03 16:56:12 +02:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * @brief Deletes the finished query. Call this only after the search has ended! | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @param search pointer to search object | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  *     - ESP_OK success | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_STATE  search has not finished | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_ARG    pointer to search object is NULL | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | esp_err_t mdns_query_async_delete(mdns_search_once_t *search); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * @brief Get results from search pointer. Results available as a pointer to the output parameter. | 
					
						
							|  |  |  |  *        Pointer to search object has to be deleted via `mdns_query_async_delete` once the query has finished. | 
					
						
							|  |  |  |  *        The results although have to be freed manually. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @param search pointer to search object | 
					
						
							|  |  |  |  * @param timeout time in milliseconds to wait for answers | 
					
						
							|  |  |  |  * @param results pointer to the results of the query | 
					
						
							| 
									
										
										
										
											2021-12-10 10:30:13 +01:00
										 |  |  |  * @param num_results pointer to the number of the actual result items (set to NULL to ignore this return value) | 
					
						
							| 
									
										
										
										
											2021-06-03 16:56:12 +02:00
										 |  |  |  * | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  *      True if search has finished before or at timeout | 
					
						
							|  |  |  |  *      False if search timeout is over | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2021-12-02 12:33:10 +01:00
										 |  |  | bool mdns_query_async_get_results(mdns_search_once_t *search, uint32_t timeout, mdns_result_t **results, uint8_t *num_results); | 
					
						
							| 
									
										
										
										
											2021-06-03 16:56:12 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * @brief  Query mDNS for host or service asynchronousely. | 
					
						
							|  |  |  |  *         Search has to be tested for progress and deleted manually! | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @param  name         service instance or host name (NULL for PTR queries) | 
					
						
							|  |  |  |  * @param  service_type service type (_http, _arduino, _ftp etc.) (NULL for host queries) | 
					
						
							|  |  |  |  * @param  proto        service protocol (_tcp, _udp, etc.) (NULL for host queries) | 
					
						
							|  |  |  |  * @param  type         type of query (MDNS_TYPE_*) | 
					
						
							|  |  |  |  * @param  timeout      time in milliseconds during which mDNS query is active | 
					
						
							|  |  |  |  * @param  max_results  maximum results to be collected | 
					
						
							| 
									
										
										
										
											2021-08-05 16:59:04 +08:00
										 |  |  |  * @param  notifier     Notification function to be called when the result is ready, can be NULL | 
					
						
							| 
									
										
										
										
											2021-06-03 16:56:12 +02:00
										 |  |  |  * | 
					
						
							|  |  |  |  * @return mdns_search_once_s pointer to new search object if query initiated successfully. | 
					
						
							|  |  |  |  *         NULL otherwise. | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2021-08-05 16:59:04 +08:00
										 |  |  | mdns_search_once_t *mdns_query_async_new(const char *name, const char *service_type, const char *proto, uint16_t type, | 
					
						
							| 
									
										
										
										
											2025-02-27 10:42:03 +01:00
										 |  |  |                                          uint32_t timeout, size_t max_results, mdns_query_notify_t notifier); | 
					
						
							| 
									
										
										
										
											2021-06-03 16:56:12 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  | /**
 | 
					
						
							| 
									
										
										
										
											2021-12-17 15:40:52 +01:00
										 |  |  |  * @brief  Generic mDNS query | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  |  *         All following query methods are derived from this one | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  |  * @param  name         service instance or host name (NULL for PTR queries) | 
					
						
							|  |  |  |  * @param  service_type service type (_http, _arduino, _ftp etc.) (NULL for host queries) | 
					
						
							|  |  |  |  * @param  proto        service protocol (_tcp, _udp, etc.) (NULL for host queries) | 
					
						
							|  |  |  |  * @param  type         type of query (MDNS_TYPE_*) | 
					
						
							| 
									
										
										
										
											2022-01-10 09:16:10 +01:00
										 |  |  |  * @param  transmission_type      either Unicast query, or Multicast query | 
					
						
							| 
									
										
										
										
											2021-12-17 15:40:52 +01:00
										 |  |  |  * @param  timeout      time in milliseconds to wait for answers. | 
					
						
							|  |  |  |  * @param  max_results  maximum results to be collected | 
					
						
							|  |  |  |  * @param  results      pointer to the results of the query | 
					
						
							|  |  |  |  *                      results must be freed using mdns_query_results_free below | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  *     - ESP_OK success | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_STATE  mDNS is not running | 
					
						
							|  |  |  |  *     - ESP_ERR_NO_MEM         memory error | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_ARG    timeout was not given | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2022-01-10 09:16:10 +01:00
										 |  |  | esp_err_t mdns_query_generic(const char *name, const char *service_type, const char *proto, uint16_t type, | 
					
						
							|  |  |  |                              mdns_query_transmission_type_t transmission_type, uint32_t timeout, size_t max_results, mdns_result_t **results); | 
					
						
							| 
									
										
										
										
											2021-12-17 15:40:52 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * @brief  Query mDNS for host or service | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Note that querying PTR types sends Multicast query, all other types send Unicast queries | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @param  name         service instance or host name (NULL for PTR queries) | 
					
						
							|  |  |  |  * @param  service_type service type (_http, _arduino, _ftp etc.) (NULL for host queries) | 
					
						
							|  |  |  |  * @param  proto        service protocol (_tcp, _udp, etc.) (NULL for host queries) | 
					
						
							|  |  |  |  * @param  type         type of query (MDNS_TYPE_*) | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  |  * @param  timeout      time in milliseconds to wait for answers. | 
					
						
							|  |  |  |  * @param  max_results  maximum results to be collected | 
					
						
							|  |  |  |  * @param  results      pointer to the results of the query | 
					
						
							|  |  |  |  *                      results must be freed using mdns_query_results_free below | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  |  * @return | 
					
						
							|  |  |  |  *     - ESP_OK success | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_STATE  mDNS is not running | 
					
						
							|  |  |  |  *     - ESP_ERR_NO_MEM         memory error | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_ARG    timeout was not given | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | esp_err_t mdns_query(const char *name, const char *service_type, const char *proto, uint16_t type, uint32_t timeout, size_t max_results, mdns_result_t **results); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * @brief  Free query results | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @param  results      linked list of results to be freed | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  | void mdns_query_results_free(mdns_result_t *results); | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  |  * @brief  Query mDNS for service | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  |  * @param  service_type service type (_http, _arduino, _ftp etc.) | 
					
						
							|  |  |  |  * @param  proto        service protocol (_tcp, _udp, etc.) | 
					
						
							|  |  |  |  * @param  timeout      time in milliseconds to wait for answer. | 
					
						
							|  |  |  |  * @param  max_results  maximum results to be collected | 
					
						
							|  |  |  |  * @param  results      pointer to the results of the query | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  |  * @return | 
					
						
							|  |  |  |  *     - ESP_OK success | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_STATE  mDNS is not running | 
					
						
							|  |  |  |  *     - ESP_ERR_NO_MEM         memory error | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_ARG    parameter error | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  | esp_err_t mdns_query_ptr(const char *service_type, const char *proto, uint32_t timeout, size_t max_results, mdns_result_t **results); | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  |  * @brief  Query mDNS for SRV record | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  |  * @param  instance_name    service instance name | 
					
						
							|  |  |  |  * @param  service_type     service type (_http, _arduino, _ftp etc.) | 
					
						
							|  |  |  |  * @param  proto            service protocol (_tcp, _udp, etc.) | 
					
						
							|  |  |  |  * @param  timeout          time in milliseconds to wait for answer. | 
					
						
							|  |  |  |  * @param  result           pointer to the result of the query | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  |  * @return | 
					
						
							|  |  |  |  *     - ESP_OK success | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_STATE  mDNS is not running | 
					
						
							|  |  |  |  *     - ESP_ERR_NO_MEM         memory error | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_ARG    parameter error | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  | esp_err_t mdns_query_srv(const char *instance_name, const char *service_type, const char *proto, uint32_t timeout, mdns_result_t **result); | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  |  * @brief  Query mDNS for TXT record | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  |  * @param  instance_name    service instance name | 
					
						
							|  |  |  |  * @param  service_type     service type (_http, _arduino, _ftp etc.) | 
					
						
							|  |  |  |  * @param  proto            service protocol (_tcp, _udp, etc.) | 
					
						
							|  |  |  |  * @param  timeout          time in milliseconds to wait for answer. | 
					
						
							|  |  |  |  * @param  result           pointer to the result of the query | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  |  * @return | 
					
						
							|  |  |  |  *     - ESP_OK success | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_STATE  mDNS is not running | 
					
						
							|  |  |  |  *     - ESP_ERR_NO_MEM         memory error | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_ARG    parameter error | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  | esp_err_t mdns_query_txt(const char *instance_name, const char *service_type, const char *proto, uint32_t timeout, mdns_result_t **result); | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-10 13:16:29 +08:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * @brief Look up delegated services. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @param  instance         instance name (NULL for uncertain instance) | 
					
						
							|  |  |  |  * @param  service_type     service type (_http, _ftp, etc) | 
					
						
							|  |  |  |  * @param  proto            service protocol (_tcp, _udp) | 
					
						
							|  |  |  |  * @param  max_results      maximum results to be collected | 
					
						
							|  |  |  |  * @param  result           pointer to the result of the search | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  *     - ESP_OK success | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_STATE  mDNS is not running | 
					
						
							|  |  |  |  *     - ESP_ERR_NO_MEM         memory error | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_ARG    parameter error | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | esp_err_t mdns_lookup_delegated_service(const char *instance, const char *service_type, const char *proto, size_t max_results, | 
					
						
							|  |  |  |                                         mdns_result_t **result); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-18 12:22:21 +08:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * @brief Look up self hosted services. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @param  instance         instance name (NULL for uncertain instance) | 
					
						
							|  |  |  |  * @param  service_type     service type (_http, _ftp, etc) | 
					
						
							|  |  |  |  * @param  proto            service protocol (_tcp, _udp) | 
					
						
							|  |  |  |  * @param  max_results      maximum results to be collected | 
					
						
							|  |  |  |  * @param  result           pointer to the result of the search | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  *     - ESP_OK success | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_STATE  mDNS is not running | 
					
						
							|  |  |  |  *     - ESP_ERR_NO_MEM         memory error | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_ARG    parameter error | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | esp_err_t mdns_lookup_selfhosted_service(const char *instance, const char *service_type, const char *proto, size_t max_results, | 
					
						
							| 
									
										
										
										
											2025-02-27 10:42:03 +01:00
										 |  |  |                                          mdns_result_t **result); | 
					
						
							| 
									
										
										
										
											2023-05-18 12:22:21 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  | /**
 | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  |  * @brief  Query mDNS for A record | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  |  * @param  host_name    host name to look for | 
					
						
							|  |  |  |  * @param  timeout      time in milliseconds to wait for answer. | 
					
						
							|  |  |  |  * @param  addr         pointer to the resulting IP4 address | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  |  * | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  *     - ESP_OK success | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  |  *     - ESP_ERR_INVALID_STATE  mDNS is not running | 
					
						
							|  |  |  |  *     - ESP_ERR_NO_MEM         memory error | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_ARG    parameter error | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2019-08-31 19:06:54 +02:00
										 |  |  | esp_err_t mdns_query_a(const char *host_name, uint32_t timeout, esp_ip4_addr_t *addr); | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-18 19:14:51 +08:00
										 |  |  | #if CONFIG_LWIP_IPV6
 | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * @brief  Query mDNS for A record | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2021-02-26 18:28:57 +04:00
										 |  |  |  * Please note that hostname must not contain domain name, as mDNS uses '.local' domain. | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  |  * @param  host_name    host name to look for | 
					
						
							|  |  |  |  * @param  timeout      time in milliseconds to wait for answer. If 0, max_results needs to be defined | 
					
						
							|  |  |  |  * @param  addr         pointer to the resulting IP6 address | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  *     - ESP_OK success | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_STATE  mDNS is not running | 
					
						
							|  |  |  |  *     - ESP_ERR_NO_MEM         memory error | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_ARG    parameter error | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2019-08-31 19:06:54 +02:00
										 |  |  | esp_err_t mdns_query_aaaa(const char *host_name, uint32_t timeout, esp_ip6_addr_t *addr); | 
					
						
							| 
									
										
										
										
											2021-01-18 19:14:51 +08:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2017-12-07 14:21:40 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-12-14 18:07:23 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-12-20 13:59:11 +01:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * @brief   Register custom esp_netif with mDNS functionality | 
					
						
							| 
									
										
										
										
											2022-01-03 16:36:08 +01:00
										 |  |  |  *          mDNS service runs by default on preconfigured interfaces (STA, AP, ETH). | 
					
						
							|  |  |  |  *          This API enables running the service on any customized interface, | 
					
						
							|  |  |  |  *          either using standard WiFi or Ethernet driver or any kind of user defined driver. | 
					
						
							| 
									
										
										
										
											2021-12-20 13:59:11 +01:00
										 |  |  |  * | 
					
						
							|  |  |  |  * @param   esp_netif Pointer to esp-netif interface | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  *     - ESP_OK success | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_STATE  mDNS is not running or this netif is already registered | 
					
						
							|  |  |  |  *     - ESP_ERR_NO_MEM         not enough memory for this in interface in the netif list (see CONFIG_MDNS_MAX_INTERFACES) | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2022-01-03 16:36:08 +01:00
										 |  |  | esp_err_t mdns_register_netif(esp_netif_t *esp_netif); | 
					
						
							| 
									
										
										
										
											2021-12-20 13:59:11 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * @brief   Unregister esp-netif already registered in mDNS service | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @param   esp_netif Pointer to esp-netif interface | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  *     - ESP_OK success | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_STATE  mDNS is not running | 
					
						
							|  |  |  |  *     - ESP_ERR_NOT_FOUND      this esp-netif was not registered in mDNS service | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2022-01-03 16:36:08 +01:00
										 |  |  | esp_err_t mdns_unregister_netif(esp_netif_t *esp_netif); | 
					
						
							| 
									
										
										
										
											2021-12-20 13:59:11 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * @brief   Set esp_netif to a desired state, or perform a desired action, such as enable/disable this interface | 
					
						
							|  |  |  |  *          or send announcement packets to this netif | 
					
						
							| 
									
										
										
										
											2022-01-03 16:36:08 +01:00
										 |  |  |  * | 
					
						
							|  |  |  |  *  * This function is used to enable (probe, resolve conflicts and announce), announce, or disable (send bye) mDNS | 
					
						
							|  |  |  |  *  services on the specified network interface. | 
					
						
							|  |  |  |  *  * This function must be called if users registers a specific interface using mdns_register_netif() | 
					
						
							|  |  |  |  *  to enable mDNS services on that interface. | 
					
						
							|  |  |  |  *  * This function could be used in IP/connection event handlers to automatically enable/announce mDNS services | 
					
						
							|  |  |  |  *  when network properties change and/or disable them on disconnection. | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2021-12-20 13:59:11 +01:00
										 |  |  |  * @param esp_netif  Pointer to esp-netif interface | 
					
						
							|  |  |  |  * @param event_action  Disable/Enable/Announce on this interface over IPv4/IPv6 protocol. | 
					
						
							|  |  |  |  *                      Actions enumerated in mdns_event_actions_t type. | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  *     - ESP_OK success | 
					
						
							|  |  |  |  *     - ESP_ERR_INVALID_STATE  mDNS is not running or this netif is not registered | 
					
						
							|  |  |  |  *     - ESP_ERR_NO_MEM         memory error | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2022-01-03 16:36:08 +01:00
										 |  |  | esp_err_t mdns_netif_action(esp_netif_t *esp_netif, mdns_event_actions_t event_action); | 
					
						
							| 
									
										
										
										
											2021-12-14 18:07:23 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-06 17:39:10 +08:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * @brief   Browse mDNS for a service `_service._proto`. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @param service  Pointer to the `_service` which will be browsed. | 
					
						
							|  |  |  |  * @param proto    Pointer to the `_proto` which will be browsed. | 
					
						
							|  |  |  |  * @param notifier The callback which will be called when the browsing service changed. | 
					
						
							|  |  |  |  * @return mdns_browse_t pointer to new browse object if initiated successfully. | 
					
						
							|  |  |  |  *         NULL otherwise. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | mdns_browse_t *mdns_browse_new(const char *service, const char *proto, mdns_browse_notify_t notifier); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * @brief   Stop the `_service._proto` browse. | 
					
						
							|  |  |  |  * @param service  Pointer to the `_service` which will be browsed. | 
					
						
							|  |  |  |  * @param proto    Pointer to the `_proto` which will be browsed. | 
					
						
							|  |  |  |  * @return | 
					
						
							|  |  |  |  *     - ESP_OK                 success. | 
					
						
							|  |  |  |  *     - ESP_ERR_FAIL           mDNS is not running or the browsing of `_service._proto` is never started. | 
					
						
							|  |  |  |  *     - ESP_ERR_NO_MEM         memory error. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | esp_err_t mdns_browse_delete(const char *service, const char *proto); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-04 18:54:07 +02:00
										 |  |  | #ifdef __cplusplus
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif /* ESP_MDNS_H_ */
 |