llmnr_client.h
Go to the documentation of this file.
1 /**
2  * @file llmnr_client.h
3  * @brief LLMNR client (Link-Local Multicast Name Resolution)
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 _LLMNR_CLIENT_H
32 #define _LLMNR_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 #include "llmnr/llmnr_common.h"
41 
42 //LLMNR client support
43 #ifndef LLMNR_CLIENT_SUPPORT
44  #define LLMNR_CLIENT_SUPPORT DISABLED
45 #elif (LLMNR_CLIENT_SUPPORT != ENABLED && LLMNR_CLIENT_SUPPORT != DISABLED)
46  #error LLMNR_CLIENT_SUPPORT parameter is not valid
47 #endif
48 
49 //Maximum number of retransmissions of LLMNR queries
50 #ifndef LLMNR_CLIENT_MAX_RETRIES
51  #define LLMNR_CLIENT_MAX_RETRIES 3
52 #elif (LLMNR_CLIENT_MAX_RETRIES < 1)
53  #error LLMNR_CLIENT_MAX_RETRIES parameter is not valid
54 #endif
55 
56 //Initial retransmission timeout
57 #ifndef LLMNR_CLIENT_INIT_TIMEOUT
58  #define LLMNR_CLIENT_INIT_TIMEOUT 1000
59 #elif (LLMNR_CLIENT_INIT_TIMEOUT < 1000)
60  #error LLMNR_CLIENT_INIT_TIMEOUT parameter is not valid
61 #endif
62 
63 //Maximum retransmission timeout
64 #ifndef LLMNR_CLIENT_MAX_TIMEOUT
65  #define LLMNR_CLIENT_MAX_TIMEOUT 1000
66 #elif (LLMNR_CLIENT_MAX_TIMEOUT < 1000)
67  #error LLMNR_CLIENT_MAX_TIMEOUT parameter is not valid
68 #endif
69 
70 //Maximum cache lifetime for LLMNR entries
71 #ifndef LLMNR_MAX_LIFETIME
72  #define LLMNR_MAX_LIFETIME 60000
73 #elif (LLMNR_MAX_LIFETIME < 1000)
74  #error LLMNR_MAX_LIFETIME parameter is not valid
75 #endif
76 
77 //C++ guard
78 #ifdef __cplusplus
79 extern "C" {
80 #endif
81 
82 //LLMNR related functions
83 error_t llmnrResolve(NetInterface *interface, const char_t *name,
85 
87 
88 void llmnrProcessResponse(NetInterface *interface,
89  const IpPseudoHeader *pseudoHeader, const UdpHeader *udpHeader,
90  const NetBuffer *buffer, size_t offset, const NetRxAncillary *ancillary,
91  void *param);
92 
93 //C++ guard
94 #ifdef __cplusplus
95 }
96 #endif
97 
98 #endif
HostType
Host types.
Definition: socket.h:215
void llmnrProcessResponse(NetInterface *interface, const IpPseudoHeader *pseudoHeader, const UdpHeader *udpHeader, const NetBuffer *buffer, size_t offset, const NetRxAncillary *ancillary, void *param)
Process LLMNR response message.
Definition: llmnr_client.c:350
IP network address.
Definition: ip.h:90
Structure describing a buffer that spans multiple chunks.
Definition: net_mem.h:89
uint8_t type
Definition: coap_common.h:176
error_t llmnrSendQuery(DnsCacheEntry *entry)
Send a LLMNR query message.
Definition: llmnr_client.c:214
char_t name[]
IP pseudo header.
Definition: ip.h:110
error_t
Error codes.
Definition: error.h:43
#define NetRxAncillary
Definition: net_misc.h:40
#define NetInterface
Definition: net.h:36
DNS cache entry.
Definition: dns_cache.h:97
UdpHeader
Definition: udp.h:85
char char_t
Definition: compiler_port.h:48
DNS cache management.
UDP (User Datagram Protocol)
Socket API.
Ipv4Addr ipAddr
Definition: ipcp.h:105
error_t llmnrResolve(NetInterface *interface, const char_t *name, HostType type, IpAddr *ipAddr)
Resolve a host name using LLMNR.
Definition: llmnr_client.c:53
Definitions common to LLMNR client and responder.
TCP/IP stack core.
Common DNS routines.