1 /* 2 * FreeRTOS+TCP V3.1.0 3 * Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 * 5 * SPDX-License-Identifier: MIT 6 * 7 * Permission is hereby granted, free of charge, to any person obtaining a copy of 8 * this software and associated documentation files (the "Software"), to deal in 9 * the Software without restriction, including without limitation the rights to 10 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 * the Software, and to permit persons to whom the Software is furnished to do so, 12 * subject to the following conditions: 13 * 14 * The above copyright notice and this permission notice shall be included in all 15 * copies or substantial portions of the Software. 16 * 17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 * 24 * https://github.com/FreeRTOS 25 * https://www.FreeRTOS.org 26 */ 27 28 #ifndef FREERTOS_DNS_H 29 #define FREERTOS_DNS_H 30 31 /* *INDENT-OFF* */ 32 #ifdef __cplusplus 33 extern "C" { 34 #endif 35 /* *INDENT-ON* */ 36 37 /* Application level configuration options. */ 38 #include "FreeRTOS_DNS_Globals.h" 39 #include "FreeRTOS_DNS_Callback.h" 40 #include "FreeRTOS_DNS_Cache.h" 41 42 /* 43 * LLMNR is very similar to DNS, so is handled by the DNS routines. 44 */ 45 uint32_t ulDNSHandlePacket( const NetworkBufferDescriptor_t * pxNetworkBuffer ); 46 47 #if ( ipconfigUSE_LLMNR == 1 ) 48 /* The LLMNR MAC address is 01:00:5e:00:00:fc */ 49 extern const MACAddress_t xLLMNR_MacAdress; 50 #endif /* ipconfigUSE_LLMNR */ 51 52 #if ( ipconfigUSE_NBNS != 0 ) 53 54 /* 55 * Inspect a NetBIOS Names-Service message. If the name matches with ours 56 * (xApplicationDNSQueryHook returns true) an answer will be sent back. 57 * Note that LLMNR is a better protocol for name services on a LAN as it is 58 * less polluted 59 */ 60 uint32_t ulNBNSHandlePacket( NetworkBufferDescriptor_t * pxNetworkBuffer ); 61 62 #endif /* ipconfigUSE_NBNS */ 63 64 65 #if ( ipconfigDNS_USE_CALLBACKS != 0 ) 66 67 /* 68 * Asynchronous version of gethostbyname() 69 * xTimeout is in units of ms. 70 */ 71 uint32_t FreeRTOS_gethostbyname_a( const char * pcHostName, 72 FOnDNSEvent pCallback, 73 void * pvSearchID, 74 TickType_t uxTimeout ); 75 void FreeRTOS_gethostbyname_cancel( void * pvSearchID ); 76 77 78 #endif /* if ( ipconfigDNS_USE_CALLBACKS != 0 ) */ 79 80 /* 81 * Lookup a IPv4 node in a blocking-way. 82 * It returns a 32-bit IP-address, 0 when not found. 83 * gethostbyname() is already deprecated. 84 */ 85 uint32_t FreeRTOS_gethostbyname( const char * pcHostName ); 86 87 #if ( ipconfigDNS_USE_CALLBACKS == 1 ) 88 89 /* 90 * The function vDNSInitialise() initialises the DNS module. 91 * It will be called "internally", by the IP-task. 92 */ 93 void vDNSInitialise( void ); 94 #endif /* ( ipconfigDNS_USE_CALLBACKS == 1 ) */ 95 96 /* *INDENT-OFF* */ 97 #ifdef __cplusplus 98 } /* extern "C" */ 99 #endif 100 /* *INDENT-ON* */ 101 102 #endif /* FREERTOS_DNS_H */ 103