Zephyr API Documentation
2.7.0-rc2
A Scalable Open Source RTOS
dns_sd.h
Go to the documentation of this file.
1
5
/*
6
* Copyright (c) 2020 Friedt Professional Engineering Services, Inc
7
*
8
* SPDX-License-Identifier: Apache-2.0
9
*/
10
11
#ifndef ZEPHYR_INCLUDE_NET_DNS_SD_H_
12
#define ZEPHYR_INCLUDE_NET_DNS_SD_H_
13
14
#include <
stdint.h
>
15
#include <
sys/byteorder.h
>
16
17
#ifdef __cplusplus
18
extern
"C"
{
19
#endif
20
37
#define DNS_SD_INSTANCE_MIN_SIZE 1
39
#define DNS_SD_INSTANCE_MAX_SIZE 63
41
#define DNS_SD_SERVICE_MIN_SIZE 2
43
#define DNS_SD_SERVICE_MAX_SIZE 16
45
#define DNS_SD_SERVICE_PREFIX '_'
47
#define DNS_SD_PROTO_SIZE 4
49
#define DNS_SD_DOMAIN_MIN_SIZE 2
51
#define DNS_SD_DOMAIN_MAX_SIZE 63
52
77
#define DNS_SD_REGISTER_SERVICE(id, instance, service, proto, domain, \
78
text, port) \
79
static const STRUCT_SECTION_ITERABLE(dns_sd_rec, id) = { \
80
instance, \
81
service, \
82
proto, \
83
domain, \
84
(const char *)text, \
85
sizeof(text) - 1, \
86
port \
87
}
88
129
#define DNS_SD_REGISTER_TCP_SERVICE(id, instance, service, domain, text, \
130
port) \
131
static const uint16_t id ## _port = sys_cpu_to_be16(port); \
132
DNS_SD_REGISTER_SERVICE(id, instance, service, "_tcp"
, domain, \
133
text, &id ## _port)
134
160
#define DNS_SD_REGISTER_UDP_SERVICE(id, instance, service, domain, text, \
161
port) \
162
static const uint16_t id ## _port = sys_cpu_to_be16(port); \
163
DNS_SD_REGISTER_SERVICE(id, instance, service, "_udp"
, domain, \
164
text, &id ## _port)
165
167
#define DNS_SD_EMPTY_TXT dns_sd_empty_txt
168
189
struct
dns_sd_rec {
191
const
char
*instance;
193
const
char
*service;
195
const
char
*proto;
197
const
char
*domain;
199
const
char
*text;
201
size_t
text_size;
203
const
uint16_t
*port;
204
};
205
211
extern
const
char
dns_sd_empty_txt[1];
212
221
static
inline
size_t
dns_sd_txt_size
(
const
struct
dns_sd_rec *rec)
222
{
223
return
rec->text_size;
224
}
225
230
#ifdef __cplusplus
231
};
232
#endif
233
234
#endif
/* ZEPHYR_INCLUDE_NET_DNS_SD_H_ */
byteorder.h
Byte order helpers.
dns_sd_txt_size
static size_t dns_sd_txt_size(const struct dns_sd_rec *rec)
Obtain the size of DNS-SD TXT data.
Definition:
dns_sd.h:221
stdint.h
uint16_t
__UINT16_TYPE__ uint16_t
Definition:
stdint.h:59
include
net
dns_sd.h
Generated on Sun Oct 9 2022 09:21:56 for Zephyr API Documentation by
1.9.4