]> git.sur5r.net Git - freertos/blob - FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_DNS.h
Update version number in readiness for V10.3.0 release. Sync SVN with reviewed releas...
[freertos] / FreeRTOS-Plus / Source / FreeRTOS-Plus-TCP / include / FreeRTOS_DNS.h
1 /*
2  * FreeRTOS+TCP V2.2.0
3  * Copyright (C) 2017 Amazon.com, Inc. or its affiliates.  All Rights Reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a copy of
6  * this software and associated documentation files (the "Software"), to deal in
7  * the Software without restriction, including without limitation the rights to
8  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9  * the Software, and to permit persons to whom the Software is furnished to do so,
10  * subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in all
13  * copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  *
22  * http://aws.amazon.com/freertos
23  * http://www.FreeRTOS.org
24  */
25
26 #ifndef FREERTOS_DNS_H
27 #define FREERTOS_DNS_H
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32
33 /* Application level configuration options. */
34 #include "FreeRTOSIPConfig.h"
35 #include "IPTraceMacroDefaults.h"
36
37
38 /* The Link-local Multicast Name Resolution (LLMNR)
39  * is included.
40  * Note that a special MAC address is required in addition to the NIC's actual
41  * MAC address: 01:00:5E:00:00:FC
42  *
43  * The target IP address will be 224.0.0.252
44  */
45 #if( ipconfigBYTE_ORDER == pdFREERTOS_BIG_ENDIAN )
46         #define ipLLMNR_IP_ADDR                 0xE00000FC
47 #else
48         #define ipLLMNR_IP_ADDR                 0xFC0000E0
49 #endif /* ipconfigBYTE_ORDER == pdFREERTOS_BIG_ENDIAN */
50
51 #define ipLLMNR_PORT    5355 /* Standard LLMNR port. */
52 #define ipDNS_PORT              53      /* Standard DNS port. */
53 #define ipDHCP_CLIENT   67
54 #define ipDHCP_SERVER   68
55 #define ipNBNS_PORT             137     /* NetBIOS Name Service. */
56 #define ipNBDGM_PORT    138 /* Datagram Service, not included. */
57
58 /*
59  * The following function should be provided by the user and return true if it
60  * matches the domain name.
61  */
62 extern BaseType_t xApplicationDNSQueryHook( const char *pcName );
63
64 /*
65  * LLMNR is very similar to DNS, so is handled by the DNS routines.
66  */
67 uint32_t ulDNSHandlePacket( NetworkBufferDescriptor_t *pxNetworkBuffer );
68
69 #if( ipconfigUSE_LLMNR == 1 )
70         extern const MACAddress_t xLLMNR_MacAdress;
71 #endif /* ipconfigUSE_LLMNR */
72
73 #if( ipconfigUSE_NBNS != 0 )
74
75         /*
76          * Inspect a NetBIOS Names-Service message.  If the name matches with ours
77          * (xApplicationDNSQueryHook returns true) an answer will be sent back.
78          * Note that LLMNR is a better protocol for name services on a LAN as it is
79          * less polluted
80          */
81         uint32_t ulNBNSHandlePacket (NetworkBufferDescriptor_t *pxNetworkBuffer );
82
83 #endif /* ipconfigUSE_NBNS */
84
85 #if( ipconfigUSE_DNS_CACHE != 0 )
86
87     /* Look for the indicated host name in the DNS cache. Returns the IPv4 
88     address if present, or 0x0 otherwise. */
89         uint32_t FreeRTOS_dnslookup( const char *pcHostName );
90
91     /* Remove all entries from the DNS cache. */
92     void FreeRTOS_dnsclear();
93 #endif /* ipconfigUSE_DNS_CACHE != 0 */
94
95 #if( ipconfigDNS_USE_CALLBACKS != 0 )
96
97         /*
98          * Users may define this type of function as a callback.
99          * It will be called when a DNS reply is received or when a timeout has been reached.
100          */
101         typedef void (* FOnDNSEvent ) ( const char * /* pcName */, void * /* pvSearchID */, uint32_t /* ulIPAddress */ );
102
103         /*
104          * Asynchronous version of gethostbyname()
105          * xTimeout is in units of ms.
106          */
107         uint32_t FreeRTOS_gethostbyname_a( const char *pcHostName, FOnDNSEvent pCallback, void *pvSearchID, TickType_t xTimeout );
108         void FreeRTOS_gethostbyname_cancel( void *pvSearchID );
109
110 #endif
111
112 /*
113  * FULL, UP-TO-DATE AND MAINTAINED REFERENCE DOCUMENTATION FOR ALL THESE
114  * FUNCTIONS IS AVAILABLE ON THE FOLLOWING URL:
115  * _TBD_ Add URL
116  */
117 uint32_t FreeRTOS_gethostbyname( const char *pcHostName );
118
119
120 #ifdef __cplusplus
121 }       /* extern "C" */
122 #endif
123
124 #endif /* FREERTOS_DNS_H */
125
126
127
128
129
130
131
132
133
134
135
136
137