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-2019 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 1.9.2
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
84 
86 
87 void llmnrProcessResponse(NetInterface *interface, const IpPseudoHeader *pseudoHeader,
88  const UdpHeader *udpHeader, const LlmnrHeader *message, size_t length);
89 
90 //C++ guard
91 #ifdef __cplusplus
92  }
93 #endif
94 
95 #endif
char char_t
Definition: compiler_port.h:43
TCP/IP stack core.
error_t llmnrResolve(NetInterface *interface, const char_t *name, IpAddr *ipAddr)
Resolve a host name using LLMNR.
Definition: llmnr_client.c:53
uint8_t message[]
Definition: chap.h:152
DNS cache management.
IP network address.
Definition: ip.h:59
uint8_t ipAddr[4]
Definition: mib_common.h:187
DNS cache entry.
Definition: dns_cache.h:96
char_t name[]
__start_packed struct @126 UdpHeader
UDP header.
error_t
Error codes.
Definition: error.h:42
#define NetInterface
Definition: net.h:36
__start_packed struct @208 LlmnrHeader
LLMNR message header.
IP pseudo header.
Definition: ip.h:78
Definitions common to LLMNR client and responder.
void llmnrProcessResponse(NetInterface *interface, const IpPseudoHeader *pseudoHeader, const UdpHeader *udpHeader, const LlmnrHeader *message, size_t length)
Process LLMNR response message.
Definition: llmnr_client.c:277
error_t llmnrSendQuery(DnsCacheEntry *entry)
Send a LLMNR query message.
Definition: llmnr_client.c:193
Socket API.
uint8_t length
Definition: dtls_misc.h:142
Common DNS routines.
UDP (User Datagram Protocol)