@@ -79,6 +79,7 @@ typedef struct mdns_result_s {
79
79
uint16_t port ; /*!< service port */
80
80
// TXT
81
81
mdns_txt_item_t * txt ; /*!< txt record */
82
+ uint8_t * txt_value_len ; /*!< array of txt value len of each record */
82
83
size_t txt_count ; /*!< number of txt items */
83
84
// A and AAAA
84
85
mdns_ip_addr_t * addr ; /*!< linked list of IP addresses found */
@@ -173,6 +174,8 @@ esp_err_t mdns_instance_name_set(const char * instance_name);
173
174
/**
174
175
* @brief Add service to mDNS server
175
176
*
177
+ * @note The value length of txt items will be automatically decided by strlen
178
+ *
176
179
* @param instance_name instance name to set. If NULL,
177
180
* global instance name or hostname will be used
178
181
* @param service_type service type (_http, _ftp, etc)
@@ -189,10 +192,11 @@ esp_err_t mdns_instance_name_set(const char * instance_name);
189
192
*/
190
193
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 );
191
194
192
-
193
195
/**
194
196
* @brief Add service to mDNS server with a delegated hostname
195
197
*
198
+ * @note The value length of txt items will be automatically decided by strlen
199
+ *
196
200
* @param instance_name instance name to set. If NULL,
197
201
* global instance name or hostname will be used
198
202
* @param service_type service type (_http, _ftp, etc)
@@ -321,6 +325,8 @@ esp_err_t mdns_service_port_set_for_host(const char * service_type, const char *
321
325
/**
322
326
* @brief Replace all TXT items for service
323
327
*
328
+ * @note The value length of txt items will be automatically decided by strlen
329
+ *
324
330
* @param service_type service type (_http, _ftp, etc)
325
331
* @param proto service protocol (_tcp, _udp)
326
332
* @param txt array of TXT data (eg. {{"var","val"},{"other","2"}})
@@ -337,6 +343,8 @@ esp_err_t mdns_service_txt_set(const char * service_type, const char * proto, md
337
343
/**
338
344
* @brief Replace all TXT items for service with hostname
339
345
*
346
+ * @note The value length of txt items will be automatically decided by strlen
347
+ *
340
348
* @param service_type service type (_http, _ftp, etc)
341
349
* @param proto service protocol (_tcp, _udp)
342
350
* @param hostname service hostname. If NULL, local hostname will be used.
@@ -355,6 +363,8 @@ esp_err_t mdns_service_txt_set_for_host(const char * service_type, const char *
355
363
/**
356
364
* @brief Set/Add TXT item for service TXT record
357
365
*
366
+ * @note The value length will be automatically decided by strlen
367
+ *
358
368
* @param service_type service type (_http, _ftp, etc)
359
369
* @param proto service protocol (_tcp, _udp)
360
370
* @param key the key that you want to add/update
@@ -368,10 +378,29 @@ esp_err_t mdns_service_txt_set_for_host(const char * service_type, const char *
368
378
*/
369
379
esp_err_t mdns_service_txt_item_set (const char * service_type , const char * proto , const char * key , const char * value );
370
380
381
+ /**
382
+ * @brief Set/Add TXT item for service TXT record
383
+ *
384
+ * @param service_type service type (_http, _ftp, etc)
385
+ * @param proto service protocol (_tcp, _udp)
386
+ * @param key the key that you want to add/update
387
+ * @param value the new value of the key
388
+ * @param value_len the length of the value
389
+ *
390
+ * @return
391
+ * - ESP_OK success
392
+ * - ESP_ERR_INVALID_ARG Parameter error
393
+ * - ESP_ERR_NOT_FOUND Service not found
394
+ * - ESP_ERR_NO_MEM memory error
395
+ */
396
+ esp_err_t mdns_service_txt_item_set_with_explicit_value_len (const char * service_type , const char * proto ,
397
+ const char * key , const char * value , uint8_t value_len );
371
398
372
399
/**
373
400
* @brief Set/Add TXT item for service TXT record with hostname
374
401
*
402
+ * @note The value length will be automatically decided by strlen
403
+ *
375
404
* @param service_type service type (_http, _ftp, etc)
376
405
* @param proto service protocol (_tcp, _udp)
377
406
* @param hostname service hostname. If NULL, local hostname will be used.
@@ -387,6 +416,26 @@ esp_err_t mdns_service_txt_item_set(const char * service_type, const char * prot
387
416
esp_err_t mdns_service_txt_item_set_for_host (const char * service_type , const char * proto , const char * hostname ,
388
417
const char * key , const char * value );
389
418
419
+ /**
420
+ * @brief Set/Add TXT item for service TXT record with hostname and txt value length
421
+ *
422
+ * @param service_type service type (_http, _ftp, etc)
423
+ * @param proto service protocol (_tcp, _udp)
424
+ * @param hostname service hostname. If NULL, local hostname will be used.
425
+ * @param key the key that you want to add/update
426
+ * @param value the new value of the key
427
+ * @param value_len the length of the value
428
+ *
429
+ * @return
430
+ * - ESP_OK success
431
+ * - ESP_ERR_INVALID_ARG Parameter error
432
+ * - ESP_ERR_NOT_FOUND Service not found
433
+ * - ESP_ERR_NO_MEM memory error
434
+ */
435
+ esp_err_t mdns_service_txt_item_set_for_host_with_explicit_value_len (const char * service_type , const char * proto ,
436
+ const char * hostname , const char * key ,
437
+ const char * value , uint8_t value_len );
438
+
390
439
/**
391
440
* @brief Remove TXT item for service TXT record
392
441
*
0 commit comments