dns_sd_misc.h
Go to the documentation of this file.
1 /**
2  * @file dns_sd_misc.h
3  * @brief Helper functions for DNS-SD
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneTCP Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.4.0
29  **/
30 
31 #ifndef _DNS_SD_MISC_H
32 #define _DNS_SD_MISC_H
33 
34 //Dependencies
35 #include "core/net.h"
36 #include "dns_sd/dns_sd.h"
37 
38 //C++ guard
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 //DNS-SD related functions
44 void dnsSdChangeState(DnsSdContext *context, MdnsState newState,
45  systime_t delay);
46 
48 
51 error_t dnsSdSendGoodbye(DnsSdContext *context, const DnsSdService *service);
52 
53 error_t dnsSdParseQuestion(NetInterface *interface, const MdnsMessage *query,
54  size_t offset, const DnsQuestion *question, MdnsMessage *response);
55 
56 void dnsSdParseNsRecord(NetInterface *interface, const MdnsMessage *query,
57  size_t offset, const DnsResourceRecord *record);
58 
59 void dnsSdParseAnRecord(NetInterface *interface, const MdnsMessage *response,
60  size_t offset, const DnsResourceRecord *record);
61 
63  MdnsMessage *response, bool_t legacyUnicast);
64 
66  MdnsMessage *message, const DnsSdService *service, uint32_t ttl);
67 
69  const DnsSdService *service, uint32_t ttl);
70 
72  const DnsSdService *service, bool_t cacheFlush, uint32_t ttl);
73 
75  const DnsSdService *service, bool_t cacheFlush, uint32_t ttl);
76 
78  const DnsSdService *service, bool_t cacheFlush, uint32_t ttl);
79 
80 //C++ guard
81 #ifdef __cplusplus
82 }
83 #endif
84 
85 #endif
uint8_t message[]
Definition: chap.h:154
int bool_t
Definition: compiler_port.h:53
uint32_t ttl
Definition: dns_common.h:221
DnsResourceRecord
Definition: dns_common.h:224
DnsQuestion
Definition: dns_common.h:210
DNS-SD (DNS-Based Service Discovery)
#define DnsSdContext
Definition: dns_sd.h:90
error_t dnsSdParseQuestion(NetInterface *interface, const MdnsMessage *query, size_t offset, const DnsQuestion *question, MdnsMessage *response)
Parse a question.
Definition: dns_sd_misc.c:448
void dnsSdChangeInstanceName(DnsSdContext *context)
Programmatically change the service instance name.
Definition: dns_sd_misc.c:88
void dnsSdChangeState(DnsSdContext *context, MdnsState newState, systime_t delay)
Update FSM state.
Definition: dns_sd_misc.c:53
error_t dnsSdSendGoodbye(DnsSdContext *context, const DnsSdService *service)
Send goodbye packet.
Definition: dns_sd_misc.c:368
error_t dnsSdFormatTxtRecord(NetInterface *interface, MdnsMessage *message, const DnsSdService *service, bool_t cacheFlush, uint32_t ttl)
Format TXT resource record.
Definition: dns_sd_misc.c:1188
error_t dnsSdFormatServiceEnumPtrRecord(NetInterface *interface, MdnsMessage *message, const DnsSdService *service, uint32_t ttl)
Format PTR resource record (in response to a meta-query)
Definition: dns_sd_misc.c:925
error_t dnsSdSendAnnouncement(DnsSdContext *context)
Send announcement packet.
Definition: dns_sd_misc.c:279
void dnsSdParseAnRecord(NetInterface *interface, const MdnsMessage *response, size_t offset, const DnsResourceRecord *record)
Parse a resource record from the Answer Section.
Definition: dns_sd_misc.c:701
void dnsSdGenerateAdditionalRecords(NetInterface *interface, MdnsMessage *response, bool_t legacyUnicast)
Additional record generation.
Definition: dns_sd_misc.c:771
error_t dnsSdFormatPtrRecord(NetInterface *interface, MdnsMessage *message, const DnsSdService *service, uint32_t ttl)
Format PTR resource record.
Definition: dns_sd_misc.c:1004
void dnsSdParseNsRecord(NetInterface *interface, const MdnsMessage *query, size_t offset, const DnsResourceRecord *record)
Parse a resource record from the Authority Section.
Definition: dns_sd_misc.c:606
error_t dnsSdFormatSrvRecord(NetInterface *interface, MdnsMessage *message, const DnsSdService *service, bool_t cacheFlush, uint32_t ttl)
Format SRV resource record.
Definition: dns_sd_misc.c:1089
error_t dnsSdFormatNsecRecord(NetInterface *interface, MdnsMessage *message, const DnsSdService *service, bool_t cacheFlush, uint32_t ttl)
Format NSEC resource record.
Definition: dns_sd_misc.c:1273
error_t dnsSdSendProbe(DnsSdContext *context)
Send probe packet.
Definition: dns_sd_misc.c:163
error_t
Error codes.
Definition: error.h:43
MdnsState
mDNS responder states
TCP/IP stack core.
#define NetInterface
Definition: net.h:36
uint32_t systime_t
System time.
DNS-SD service descriptor.
Definition: dns_sd.h:124
mDNS message
Definition: mdns_common.h:78