mdns_responder_misc.h
Go to the documentation of this file.
1 /**
2  * @file mdns_responder_misc.h
3  * @brief Helper functions for mDNS 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 _MDNS_RESPONDER_MISC_H
32 #define _MDNS_RESPONDER_MISC_H
33 
34 //Dependencies
35 //Dependencies
36 #include "core/net.h"
37 #include "mdns/mdns_client.h"
38 
39 //C++ guard
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 //mDNS related functions
46  MdnsState newState, systime_t delay);
47 
49 
53 
54 void mdnsResponderProcessQuery(NetInterface *interface, MdnsMessage *query);
55 
57  const MdnsMessage *query, size_t offset, const DnsQuestion *question,
58  MdnsMessage *response);
59 
61  const MdnsMessage *query, size_t queryOffset,
62  const DnsResourceRecord *queryRecord, MdnsMessage *response);
63 
65  const MdnsMessage *response, size_t offset, const DnsResourceRecord *record);
66 
68  const MdnsMessage *query, size_t offset);
69 
71  MdnsMessage *response, bool_t legacyUnicast);
72 
74  MdnsMessage *message, bool_t cacheFlush, uint32_t ttl);
75 
77  MdnsMessage *message, bool_t cacheFlush, uint32_t ttl);
78 
80  MdnsMessage *message, bool_t cacheFlush, uint32_t ttl);
81 
83  MdnsMessage *message, bool_t cacheFlush, uint32_t ttl);
84 
86  MdnsMessage *message, const uint8_t *ipv4Addr, bool_t cacheFlush,
87  uint32_t ttl);
88 
90  MdnsMessage *message, const uint8_t *ipv6Addr, bool_t cacheFlush,
91  uint32_t ttl);
92 
94  MdnsMessage *message, const char_t *reverseName, bool_t cacheFlush,
95  uint32_t ttl);
96 
98  MdnsMessage *message, const char_t *reverseName, bool_t cacheFlush,
99  uint32_t ttl);
100 
102  MdnsMessage *message, bool_t cacheFlush, uint32_t ttl);
103 
105  DnsResourceRecord *record);
106 
108  const MdnsMessage *query, size_t offset, DnsResourceRecord *record);
109 
110 //C++ guard
111 #ifdef __cplusplus
112 }
113 #endif
114 
115 #endif
void mdnsResponderGenerateAdditionalRecords(MdnsResponderContext *context, MdnsMessage *response, bool_t legacyUnicast)
Generate additional records.
#define MdnsResponderContext
error_t mdnsResponderGenerateIpv6PtrRecords(MdnsResponderContext *context, MdnsMessage *message, bool_t cacheFlush, uint32_t ttl)
Generate reverse address mapping PTR resource record (IPv6)
int bool_t
Definition: compiler_port.h:53
void mdnsResponderChangeHostname(MdnsResponderContext *context)
Programmatically change the host name.
void mdnsResponderParseAnRecord(NetInterface *interface, const MdnsMessage *response, size_t offset, const DnsResourceRecord *record)
Parse a resource record from the Answer Section.
uint8_t message[]
Definition: chap.h:154
void mdnsResponderProcessQuery(NetInterface *interface, MdnsMessage *query)
Process mDNS query message.
error_t mdnsResponderGenerateIpv6AddrRecords(MdnsResponderContext *context, MdnsMessage *message, bool_t cacheFlush, uint32_t ttl)
Generate AAAA resource records.
error_t mdnsResponderParseQuestion(NetInterface *interface, const MdnsMessage *query, size_t offset, const DnsQuestion *question, MdnsMessage *response)
Parse a question.
error_t mdnsResponderFormatNsecRecord(MdnsResponderContext *context, MdnsMessage *message, bool_t cacheFlush, uint32_t ttl)
Format NSEC resource record.
error_t mdnsResponderFormatIpv6AddrRecord(MdnsResponderContext *context, MdnsMessage *message, const uint8_t *ipv6Addr, bool_t cacheFlush, uint32_t ttl)
Format AAAA resource record.
void mdnsResponderParseNsRecords(MdnsResponderContext *context, const MdnsMessage *query, size_t offset)
Parse the Authority Section.
error_t mdnsResponderGenerateIpv4AddrRecords(MdnsResponderContext *context, MdnsMessage *message, bool_t cacheFlush, uint32_t ttl)
Generate A resource records.
MdnsState
mDNS responder states
error_t mdnsResponderFormatIpv4AddrRecord(MdnsResponderContext *context, MdnsMessage *message, const uint8_t *ipv4Addr, bool_t cacheFlush, uint32_t ttl)
Format A resource record.
error_t mdnsResponderSendProbe(MdnsResponderContext *context)
Send probe packet.
error_t
Error codes.
Definition: error.h:43
error_t mdnsResponderSendGoodbye(MdnsResponderContext *context)
Send goodbye packet.
error_t mdnsResponderFormatIpv6PtrRecord(MdnsResponderContext *context, MdnsMessage *message, const char_t *reverseName, bool_t cacheFlush, uint32_t ttl)
Format reverse address mapping PTR resource record (IPv6)
#define NetInterface
Definition: net.h:36
void mdnsResponderParseKnownAnRecord(NetInterface *interface, const MdnsMessage *query, size_t queryOffset, const DnsResourceRecord *queryRecord, MdnsMessage *response)
Parse a resource record from the Known-Answer Section.
error_t mdnsResponderGenerateIpv4PtrRecords(MdnsResponderContext *context, MdnsMessage *message, bool_t cacheFlush, uint32_t ttl)
Generate reverse address mapping PTR resource record (IPv4)
mDNS client (Multicast DNS)
void mdnsResponderChangeState(MdnsResponderContext *context, MdnsState newState, systime_t delay)
Update FSM state.
uint32_t systime_t
System time.
mDNS message
Definition: mdns_common.h:78
char char_t
Definition: compiler_port.h:48
DnsQuestion
Definition: dns_common.h:210
DnsResourceRecord * mdnsResponderGetNextTiebreakerRecord(MdnsResponderContext *context, const MdnsMessage *query, size_t offset, DnsResourceRecord *record)
Sort the tiebreaker records in lexicographical order.
error_t mdnsResponderFormatIpv4PtrRecord(MdnsResponderContext *context, MdnsMessage *message, const char_t *reverseName, bool_t cacheFlush, uint32_t ttl)
Format reverse address mapping PTR resource record (IPv4)
DnsResourceRecord * mdnsResponderGetNextHostRecord(MdnsResponderContext *context, DnsResourceRecord *record)
Sort the host records in lexicographical order.
uint32_t ttl
Definition: dns_common.h:221
TCP/IP stack core.
DnsResourceRecord
Definition: dns_common.h:224
error_t mdnsResponderSendAnnouncement(MdnsResponderContext *context)
Send announcement packet.