From d28080e277b26f0084a289b3996d6a2c67339cd7 Mon Sep 17 00:00:00 2001 From: Matt Rodgers Date: Tue, 6 Aug 2024 16:10:33 +0100 Subject: [PATCH] doc: fix code samples in dns_sd documentation so that they compile Macros for registering TCP and UDP services accept a port as a number, not a pointer. Also added missing parameter to UDP service macro, and missing type of bar_txt Signed-off-by: Matt Rodgers --- include/zephyr/net/dns_sd.h | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/include/zephyr/net/dns_sd.h b/include/zephyr/net/dns_sd.h index 0869c6bd4b0..97548199dc9 100644 --- a/include/zephyr/net/dns_sd.h +++ b/include/zephyr/net/dns_sd.h @@ -131,18 +131,15 @@ extern "C" { * Example (with TXT): * @code{.c} * #include - * static const bar_txt[] = { + * static const char bar_txt[] = { * "\x06" "path=/" * "\x0f" "this=is the way" * "\x0e" "foo or=foo not" * "\x17" "this=has\0embedded\0nulls" * "\x04" "true" * }; - * // Possibly use an ephemeral port - * // Possibly only assign bar_port when the service is running - * static uint16_t bar_port; * DNS_SD_REGISTER_TCP_SERVICE(bar, CONFIG_NET_HOSTNAME, - * "_bar", "local", bar_txt, &bar_port); + * "_bar", "local", bar_txt, 4242); * @endcode * * TXT records begin with a single length byte (hex-encoded) @@ -177,10 +174,8 @@ extern "C" { * Example (no TXT): * @code{.c} * #include - * #include - * static const foo_port = sys_cpu_to_be16(4242); * DNS_SD_REGISTER_UDP_SERVICE(foo, CONFIG_NET_HOSTNAME, - * "_foo", DNS_SD_EMPTY_TXT, &foo_port); + * "_foo", "local", DNS_SD_EMPTY_TXT, 4242); * @endcode * * @param id variable name for the DNS-SD service record