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