]> git.sur5r.net Git - freertos/blobdiff - 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
diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_DNS.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include/FreeRTOS_DNS.h
new file mode 100644 (file)
index 0000000..4514491
--- /dev/null
@@ -0,0 +1,165 @@
+/*\r
+ * FreeRTOS+TCP Labs Build 160919 (C) 2016 Real Time Engineers ltd.\r
+ * Authors include Hein Tibosch and Richard Barry\r
+ *\r
+ *******************************************************************************\r
+ ***** NOTE ******* NOTE ******* NOTE ******* NOTE ******* NOTE ******* NOTE ***\r
+ ***                                                                         ***\r
+ ***                                                                         ***\r
+ ***   FREERTOS+TCP IS STILL IN THE LAB (mainly because the FTP and HTTP     ***\r
+ ***   demos have a dependency on FreeRTOS+FAT, which is only in the Labs    ***\r
+ ***   download):                                                            ***\r
+ ***                                                                         ***\r
+ ***   FreeRTOS+TCP is functional and has been used in commercial products   ***\r
+ ***   for some time.  Be aware however that we are still refining its       ***\r
+ ***   design, the source code does not yet quite conform to the strict      ***\r
+ ***   coding and style standards mandated by Real Time Engineers ltd., and  ***\r
+ ***   the documentation and testing is not necessarily complete.            ***\r
+ ***                                                                         ***\r
+ ***   PLEASE REPORT EXPERIENCES USING THE SUPPORT RESOURCES FOUND ON THE    ***\r
+ ***   URL: http://www.FreeRTOS.org/contact  Active early adopters may, at   ***\r
+ ***   the sole discretion of Real Time Engineers Ltd., be offered versions  ***\r
+ ***   under a license other than that described below.                      ***\r
+ ***                                                                         ***\r
+ ***                                                                         ***\r
+ ***** NOTE ******* NOTE ******* NOTE ******* NOTE ******* NOTE ******* NOTE ***\r
+ *******************************************************************************\r
+ *\r
+ * FreeRTOS+TCP can be used under two different free open source licenses.  The\r
+ * license that applies is dependent on the processor on which FreeRTOS+TCP is\r
+ * executed, as follows:\r
+ *\r
+ * If FreeRTOS+TCP is executed on one of the processors listed under the Special\r
+ * License Arrangements heading of the FreeRTOS+TCP license information web\r
+ * page, then it can be used under the terms of the FreeRTOS Open Source\r
+ * License.  If FreeRTOS+TCP is used on any other processor, then it can be used\r
+ * under the terms of the GNU General Public License V2.  Links to the relevant\r
+ * licenses follow:\r
+ *\r
+ * The FreeRTOS+TCP License Information Page: http://www.FreeRTOS.org/tcp_license\r
+ * The FreeRTOS Open Source License: http://www.FreeRTOS.org/license\r
+ * The GNU General Public License Version 2: http://www.FreeRTOS.org/gpl-2.0.txt\r
+ *\r
+ * FreeRTOS+TCP is distributed in the hope that it will be useful.  You cannot\r
+ * use FreeRTOS+TCP unless you agree that you use the software 'as is'.\r
+ * FreeRTOS+TCP is provided WITHOUT ANY WARRANTY; without even the implied\r
+ * warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
+ * PURPOSE. Real Time Engineers Ltd. disclaims all conditions and terms, be they\r
+ * implied, expressed, or statutory.\r
+ *\r
+ * 1 tab == 4 spaces!\r
+ *\r
+ * http://www.FreeRTOS.org\r
+ * http://www.FreeRTOS.org/plus\r
+ * http://www.FreeRTOS.org/labs\r
+ *\r
+ */\r
+\r
+#ifndef FREERTOS_DNS_H\r
+#define FREERTOS_DNS_H\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+/* Application level configuration options. */\r
+#include "FreeRTOSIPConfig.h"\r
+#include "IPTraceMacroDefaults.h"\r
+\r
+\r
+/* The Link-local Multicast Name Resolution (LLMNR)\r
+ * is included.\r
+ * Note that a special MAC address is required in addition to the NIC's actual\r
+ * MAC address: 01:00:5E:00:00:FC\r
+ *\r
+ * The target IP address will be 224.0.0.252\r
+ */\r
+#if( ipconfigBYTE_ORDER == pdFREERTOS_BIG_ENDIAN )\r
+       #define ipLLMNR_IP_ADDR                 0xE00000FC\r
+#else\r
+       #define ipLLMNR_IP_ADDR                 0xFC0000E0\r
+#endif /* ipconfigBYTE_ORDER == pdFREERTOS_BIG_ENDIAN */\r
+\r
+#define        ipLLMNR_PORT    5355 /* Standard LLMNR port. */\r
+#define        ipDNS_PORT              53      /* Standard DNS port. */\r
+#define        ipDHCP_CLIENT   67\r
+#define        ipDHCP_SERVER   68\r
+#define        ipNBNS_PORT             137     /* NetBIOS Name Service. */\r
+#define        ipNBDGM_PORT    138 /* Datagram Service, not included. */\r
+\r
+/*\r
+ * The following function should be provided by the user and return true if it\r
+ * matches the domain name.\r
+ */\r
+extern BaseType_t xApplicationDNSQueryHook( const char *pcName );\r
+\r
+/*\r
+ * LLMNR is very similar to DNS, so is handled by the DNS routines.\r
+ */\r
+uint32_t ulDNSHandlePacket( NetworkBufferDescriptor_t *pxNetworkBuffer );\r
+\r
+#if( ipconfigUSE_LLMNR == 1 )\r
+       extern const MACAddress_t xLLMNR_MacAdress;\r
+#endif /* ipconfigUSE_LLMNR */\r
+\r
+#if( ipconfigUSE_NBNS != 0 )\r
+\r
+       /*\r
+        * Inspect a NetBIOS Names-Service message.  If the name matches with ours\r
+        * (xApplicationDNSQueryHook returns true) an answer will be sent back.\r
+        * Note that LLMNR is a better protocol for name services on a LAN as it is\r
+        * less polluted\r
+        */\r
+       uint32_t ulNBNSHandlePacket (NetworkBufferDescriptor_t *pxNetworkBuffer );\r
+\r
+#endif /* ipconfigUSE_NBNS */\r
+\r
+#if( ipconfigUSE_DNS_CACHE != 0 )\r
+\r
+       uint32_t FreeRTOS_dnslookup( const char *pcHostName );\r
+\r
+#endif /* ipconfigUSE_DNS_CACHE != 0 */\r
+\r
+#if( ipconfigDNS_USE_CALLBACKS != 0 )\r
+\r
+       /*\r
+        * Users may define this type of function as a callback.\r
+        * It will be called when a DNS reply is received or when a timeout has been reached.\r
+        */\r
+       typedef void (* FOnDNSEvent ) ( const char * /* pcName */, void * /* pvSearchID */, uint32_t /* ulIPAddress */ );\r
+\r
+       /*\r
+        * Asynchronous version of gethostbyname()\r
+        * xTimeout is in units of ms.\r
+        */\r
+       uint32_t FreeRTOS_gethostbyname_a( const char *pcHostName, FOnDNSEvent pCallback, void *pvSearchID, TickType_t xTimeout );\r
+       void FreeRTOS_gethostbyname_cancel( void *pvSearchID );\r
+\r
+#endif\r
+\r
+/*\r
+ * FULL, UP-TO-DATE AND MAINTAINED REFERENCE DOCUMENTATION FOR ALL THESE\r
+ * FUNCTIONS IS AVAILABLE ON THE FOLLOWING URL:\r
+ * _TBD_ Add URL\r
+ */\r
+uint32_t FreeRTOS_gethostbyname( const char *pcHostName );\r
+\r
+\r
+#ifdef __cplusplus\r
+}      /* extern "C" */\r
+#endif\r
+\r
+#endif /* FREERTOS_DNS_H */\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r