dns_sd_responder_misc.h
Go to the documentation of this file.
1 /**
2  * @file dns_sd_responder_misc.h
3  * @brief Helper functions for DNS-SD responder
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.4
29  **/
30 
31 #ifndef _DNS_SD_RESPONDER_MISC_H
32 #define _DNS_SD_RESPONDER_MISC_H
33 
34 //Dependencies
35 #include "core/net.h"
37 
38 //C++ guard
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 //DNS-SD responder related functions
45  MdnsState newState, systime_t delay);
46 
48 
52 
54  const MdnsMessage *query, size_t offset, const DnsQuestion *question,
55  MdnsMessage *response);
56 
58  const MdnsMessage *query, size_t offset);
59 
61  const MdnsMessage *response, size_t offset, const DnsResourceRecord *record);
62 
64  MdnsMessage *response, bool_t legacyUnicast);
65 
67  MdnsMessage *message, const DnsSdResponderService *service, uint32_t ttl);
68 
70  MdnsMessage *message, const DnsSdResponderService *service, uint32_t ttl);
71 
73  MdnsMessage *message, const DnsSdResponderService *service,
74  bool_t cacheFlush, uint32_t ttl);
75 
77  MdnsMessage *message, const DnsSdResponderService *service,
78  bool_t cacheFlush, uint32_t ttl);
79 
81  MdnsMessage *message, const DnsSdResponderService *service,
82  bool_t cacheFlush, uint32_t ttl);
83 
85  DnsSdResponderService *service, const MdnsMessage *query, size_t offset,
86  DnsResourceRecord *record);
87 
89  DnsSdResponderService *service, const MdnsMessage *message,
90  const DnsResourceRecord *record);
91 
93  const MdnsMessage *message, const DnsResourceRecord *record);
94 
95 //C++ guard
96 #ifdef __cplusplus
97 }
98 #endif
99 
100 #endif
error_t dnsSdResponderFormatServiceEnumPtrRecord(NetInterface *interface, MdnsMessage *message, const DnsSdResponderService *service, uint32_t ttl)
Format PTR resource record (in response to a meta-query)
error_t dnsSdResponderSendProbe(DnsSdResponderService *service)
Send probe packet.
int bool_t
Definition: compiler_port.h:53
void dnsSdResponderChangeState(DnsSdResponderService *service, MdnsState newState, systime_t delay)
Update FSM state.
signed int int_t
Definition: compiler_port.h:49
int_t dnsSdResponderCompareTxtRecord(DnsSdResponderService *service, const MdnsMessage *message, const DnsResourceRecord *record)
Compare TXT resource records.
uint8_t message[]
Definition: chap.h:154
error_t dnsSdResponderParseQuestion(NetInterface *interface, const MdnsMessage *query, size_t offset, const DnsQuestion *question, MdnsMessage *response)
Parse a question.
void dnsSdResponderParseNsRecords(NetInterface *interface, const MdnsMessage *query, size_t offset)
Parse the Authority Section.
error_t dnsSdResponderSendAnnouncement(DnsSdResponderService *service)
Send announcement packet.
void dnsSdResponderParseAnRecord(NetInterface *interface, const MdnsMessage *response, size_t offset, const DnsResourceRecord *record)
Parse a resource record from the Answer Section.
MdnsState
mDNS responder states
error_t
Error codes.
Definition: error.h:43
error_t dnsSdResponderFormatNsecRecord(NetInterface *interface, MdnsMessage *message, const DnsSdResponderService *service, bool_t cacheFlush, uint32_t ttl)
Format NSEC resource record.
DNS-SD responder (DNS-Based Service Discovery)
error_t dnsSdResponderSendGoodbye(DnsSdResponderService *service)
Send goodbye packet.
void dnsSdResponderGenerateAdditionalRecords(NetInterface *interface, MdnsMessage *response, bool_t legacyUnicast)
Additional record generation.
error_t dnsSdResponderFormatSrvRecord(NetInterface *interface, MdnsMessage *message, const DnsSdResponderService *service, bool_t cacheFlush, uint32_t ttl)
Format SRV resource record.
#define NetInterface
Definition: net.h:36
#define DnsSdResponderService
uint32_t systime_t
System time.
mDNS message
Definition: mdns_common.h:78
DnsResourceRecord * dnsSdResponderGetNextTiebreakerRecord(DnsSdResponderService *service, const MdnsMessage *query, size_t offset, DnsResourceRecord *record)
Sort the tiebreaker records in lexicographical order.
error_t dnsSdResponderFormatTxtRecord(NetInterface *interface, MdnsMessage *message, const DnsSdResponderService *service, bool_t cacheFlush, uint32_t ttl)
Format TXT resource record.
DnsQuestion
Definition: dns_common.h:210
void dnsSdResponderChangeInstanceName(DnsSdResponderService *service)
Programmatically change the service instance name.
error_t dnsSdResponderFormatPtrRecord(NetInterface *interface, MdnsMessage *message, const DnsSdResponderService *service, uint32_t ttl)
Format PTR resource record.
uint32_t ttl
Definition: dns_common.h:221
int_t dnsSdResponderCompareSrvRecord(NetInterface *interface, DnsSdResponderService *service, const MdnsMessage *message, const DnsResourceRecord *record)
Compare SRV resource records.
TCP/IP stack core.
DnsResourceRecord
Definition: dns_common.h:224