mdns_client.h
Go to the documentation of this file.
1 /**
2  * @file mdns_client.h
3  * @brief mDNS client (Multicast DNS)
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 _MDNS_CLIENT_H
32 #define _MDNS_CLIENT_H
33 
34 //Dependencies
35 #include "core/net.h"
36 #include "core/socket.h"
37 #include "core/udp.h"
38 #include "dns/dns_cache.h"
39 #include "dns/dns_common.h"
40 
41 //mDNS client support
42 #ifndef MDNS_CLIENT_SUPPORT
43  #define MDNS_CLIENT_SUPPORT DISABLED
44 #elif (MDNS_CLIENT_SUPPORT != ENABLED && MDNS_CLIENT_SUPPORT != DISABLED)
45  #error MDNS_CLIENT_SUPPORT parameter is not valid
46 #endif
47 
48 //Maximum number of retransmissions of mDNS queries
49 #ifndef MDNS_CLIENT_MAX_RETRIES
50  #define MDNS_CLIENT_MAX_RETRIES 3
51 #elif (MDNS_CLIENT_MAX_RETRIES < 1)
52  #error MDNS_CLIENT_MAX_RETRIES parameter is not valid
53 #endif
54 
55 //Initial retransmission timeout
56 #ifndef MDNS_CLIENT_INIT_TIMEOUT
57  #define MDNS_CLIENT_INIT_TIMEOUT 1000
58 #elif (MDNS_CLIENT_INIT_TIMEOUT < 1000)
59  #error MDNS_CLIENT_INIT_TIMEOUT parameter is not valid
60 #endif
61 
62 //Maximum retransmission timeout
63 #ifndef MDNS_CLIENT_MAX_TIMEOUT
64  #define MDNS_CLIENT_MAX_TIMEOUT 1000
65 #elif (MDNS_CLIENT_MAX_TIMEOUT < 1000)
66  #error MDNS_CLIENT_MAX_TIMEOUT parameter is not valid
67 #endif
68 
69 //Maximum cache lifetime for mDNS entries
70 #ifndef MDNS_MAX_LIFETIME
71  #define MDNS_MAX_LIFETIME 60000
72 #elif (MDNS_MAX_LIFETIME < 1000)
73  #error MDNS_MAX_LIFETIME parameter is not valid
74 #endif
75 
76 //C++ guard
77 #ifdef __cplusplus
78 extern "C" {
79 #endif
80 
81 //mDNS related functions
84 
86 
88  const MdnsMessage *message, size_t offset, const DnsResourceRecord *record);
89 
90 //C++ guard
91 #ifdef __cplusplus
92 }
93 #endif
94 
95 #endif
uint8_t message[]
Definition: chap.h:154
uint8_t type
Definition: coap_common.h:176
char char_t
Definition: compiler_port.h:48
DNS cache management.
Common DNS routines.
DnsResourceRecord
Definition: dns_common.h:224
error_t
Error codes.
Definition: error.h:43
Ipv4Addr ipAddr
Definition: ipcp.h:105
error_t mdnsClientResolve(NetInterface *interface, const char_t *name, HostType type, IpAddr *ipAddr)
Resolve a host name using mDNS.
Definition: mdns_client.c:55
error_t mdnsClientSendQuery(DnsCacheEntry *entry)
Send a mDNS query message.
Definition: mdns_client.c:196
void mdnsClientParseAnRecord(NetInterface *interface, const MdnsMessage *message, size_t offset, const DnsResourceRecord *record)
Parse a resource record from the Answer Section.
Definition: mdns_client.c:257
TCP/IP stack core.
#define NetInterface
Definition: net.h:36
char_t name[]
Socket API.
HostType
Host types.
Definition: socket.h:204
DNS cache entry.
Definition: dns_cache.h:97
IP network address.
Definition: ip.h:79
mDNS message
Definition: mdns_common.h:78
UDP (User Datagram Protocol)