]> git.sur5r.net Git - freertos/blob - FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_DNS.h
Added +TCP code to main repo.
[freertos] / FreeRTOS-Plus / Source / FreeRTOS-Plus-TCP / include / FreeRTOS_DNS.h
1 /*\r
2  * FreeRTOS+TCP Labs Build 160919 (C) 2016 Real Time Engineers ltd.\r
3  * Authors include Hein Tibosch and Richard Barry\r
4  *\r
5  *******************************************************************************\r
6  ***** NOTE ******* NOTE ******* NOTE ******* NOTE ******* NOTE ******* NOTE ***\r
7  ***                                                                         ***\r
8  ***                                                                         ***\r
9  ***   FREERTOS+TCP IS STILL IN THE LAB (mainly because the FTP and HTTP     ***\r
10  ***   demos have a dependency on FreeRTOS+FAT, which is only in the Labs    ***\r
11  ***   download):                                                            ***\r
12  ***                                                                         ***\r
13  ***   FreeRTOS+TCP is functional and has been used in commercial products   ***\r
14  ***   for some time.  Be aware however that we are still refining its       ***\r
15  ***   design, the source code does not yet quite conform to the strict      ***\r
16  ***   coding and style standards mandated by Real Time Engineers ltd., and  ***\r
17  ***   the documentation and testing is not necessarily complete.            ***\r
18  ***                                                                         ***\r
19  ***   PLEASE REPORT EXPERIENCES USING THE SUPPORT RESOURCES FOUND ON THE    ***\r
20  ***   URL: http://www.FreeRTOS.org/contact  Active early adopters may, at   ***\r
21  ***   the sole discretion of Real Time Engineers Ltd., be offered versions  ***\r
22  ***   under a license other than that described below.                      ***\r
23  ***                                                                         ***\r
24  ***                                                                         ***\r
25  ***** NOTE ******* NOTE ******* NOTE ******* NOTE ******* NOTE ******* NOTE ***\r
26  *******************************************************************************\r
27  *\r
28  * FreeRTOS+TCP can be used under two different free open source licenses.  The\r
29  * license that applies is dependent on the processor on which FreeRTOS+TCP is\r
30  * executed, as follows:\r
31  *\r
32  * If FreeRTOS+TCP is executed on one of the processors listed under the Special\r
33  * License Arrangements heading of the FreeRTOS+TCP license information web\r
34  * page, then it can be used under the terms of the FreeRTOS Open Source\r
35  * License.  If FreeRTOS+TCP is used on any other processor, then it can be used\r
36  * under the terms of the GNU General Public License V2.  Links to the relevant\r
37  * licenses follow:\r
38  *\r
39  * The FreeRTOS+TCP License Information Page: http://www.FreeRTOS.org/tcp_license\r
40  * The FreeRTOS Open Source License: http://www.FreeRTOS.org/license\r
41  * The GNU General Public License Version 2: http://www.FreeRTOS.org/gpl-2.0.txt\r
42  *\r
43  * FreeRTOS+TCP is distributed in the hope that it will be useful.  You cannot\r
44  * use FreeRTOS+TCP unless you agree that you use the software 'as is'.\r
45  * FreeRTOS+TCP is provided WITHOUT ANY WARRANTY; without even the implied\r
46  * warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
47  * PURPOSE. Real Time Engineers Ltd. disclaims all conditions and terms, be they\r
48  * implied, expressed, or statutory.\r
49  *\r
50  * 1 tab == 4 spaces!\r
51  *\r
52  * http://www.FreeRTOS.org\r
53  * http://www.FreeRTOS.org/plus\r
54  * http://www.FreeRTOS.org/labs\r
55  *\r
56  */\r
57 \r
58 #ifndef FREERTOS_DNS_H\r
59 #define FREERTOS_DNS_H\r
60 \r
61 #ifdef __cplusplus\r
62 extern "C" {\r
63 #endif\r
64 \r
65 /* Application level configuration options. */\r
66 #include "FreeRTOSIPConfig.h"\r
67 #include "IPTraceMacroDefaults.h"\r
68 \r
69 \r
70 /* The Link-local Multicast Name Resolution (LLMNR)\r
71  * is included.\r
72  * Note that a special MAC address is required in addition to the NIC's actual\r
73  * MAC address: 01:00:5E:00:00:FC\r
74  *\r
75  * The target IP address will be 224.0.0.252\r
76  */\r
77 #if( ipconfigBYTE_ORDER == pdFREERTOS_BIG_ENDIAN )\r
78         #define ipLLMNR_IP_ADDR                 0xE00000FC\r
79 #else\r
80         #define ipLLMNR_IP_ADDR                 0xFC0000E0\r
81 #endif /* ipconfigBYTE_ORDER == pdFREERTOS_BIG_ENDIAN */\r
82 \r
83 #define ipLLMNR_PORT    5355 /* Standard LLMNR port. */\r
84 #define ipDNS_PORT              53      /* Standard DNS port. */\r
85 #define ipDHCP_CLIENT   67\r
86 #define ipDHCP_SERVER   68\r
87 #define ipNBNS_PORT             137     /* NetBIOS Name Service. */\r
88 #define ipNBDGM_PORT    138 /* Datagram Service, not included. */\r
89 \r
90 /*\r
91  * The following function should be provided by the user and return true if it\r
92  * matches the domain name.\r
93  */\r
94 extern BaseType_t xApplicationDNSQueryHook( const char *pcName );\r
95 \r
96 /*\r
97  * LLMNR is very similar to DNS, so is handled by the DNS routines.\r
98  */\r
99 uint32_t ulDNSHandlePacket( NetworkBufferDescriptor_t *pxNetworkBuffer );\r
100 \r
101 #if( ipconfigUSE_LLMNR == 1 )\r
102         extern const MACAddress_t xLLMNR_MacAdress;\r
103 #endif /* ipconfigUSE_LLMNR */\r
104 \r
105 #if( ipconfigUSE_NBNS != 0 )\r
106 \r
107         /*\r
108          * Inspect a NetBIOS Names-Service message.  If the name matches with ours\r
109          * (xApplicationDNSQueryHook returns true) an answer will be sent back.\r
110          * Note that LLMNR is a better protocol for name services on a LAN as it is\r
111          * less polluted\r
112          */\r
113         uint32_t ulNBNSHandlePacket (NetworkBufferDescriptor_t *pxNetworkBuffer );\r
114 \r
115 #endif /* ipconfigUSE_NBNS */\r
116 \r
117 #if( ipconfigUSE_DNS_CACHE != 0 )\r
118 \r
119         uint32_t FreeRTOS_dnslookup( const char *pcHostName );\r
120 \r
121 #endif /* ipconfigUSE_DNS_CACHE != 0 */\r
122 \r
123 #if( ipconfigDNS_USE_CALLBACKS != 0 )\r
124 \r
125         /*\r
126          * Users may define this type of function as a callback.\r
127          * It will be called when a DNS reply is received or when a timeout has been reached.\r
128          */\r
129         typedef void (* FOnDNSEvent ) ( const char * /* pcName */, void * /* pvSearchID */, uint32_t /* ulIPAddress */ );\r
130 \r
131         /*\r
132          * Asynchronous version of gethostbyname()\r
133          * xTimeout is in units of ms.\r
134          */\r
135         uint32_t FreeRTOS_gethostbyname_a( const char *pcHostName, FOnDNSEvent pCallback, void *pvSearchID, TickType_t xTimeout );\r
136         void FreeRTOS_gethostbyname_cancel( void *pvSearchID );\r
137 \r
138 #endif\r
139 \r
140 /*\r
141  * FULL, UP-TO-DATE AND MAINTAINED REFERENCE DOCUMENTATION FOR ALL THESE\r
142  * FUNCTIONS IS AVAILABLE ON THE FOLLOWING URL:\r
143  * _TBD_ Add URL\r
144  */\r
145 uint32_t FreeRTOS_gethostbyname( const char *pcHostName );\r
146 \r
147 \r
148 #ifdef __cplusplus\r
149 }       /* extern "C" */\r
150 #endif\r
151 \r
152 #endif /* FREERTOS_DNS_H */\r
153 \r
154 \r
155 \r
156 \r
157 \r
158 \r
159 \r
160 \r
161 \r
162 \r
163 \r
164 \r
165 \r