Skip to content
Snippets Groups Projects
Select Git revision
  • 71be1ddeb128e6068d2f1df605ec9c8c10f67091
  • master default protected
  • schneider/ir
  • rahix/user-space-ctx
  • schneider/iaq-python
  • schneider/ble-mini-demo
  • schneider/ble-ecg-stream-visu
  • schneider/mp-exception-print
  • schneider/sleep-display
  • schneider/deepsleep4
  • schneider/deepsleep2
  • schneider/deepsleep
  • schneider/ble-central
  • rahix/bluetooth-app-favorite
  • schneider/v1.17-changelog
  • schneider/ancs
  • schneider/png
  • schneider/freertos-list-debug
  • schneider/212-reset-hardware-when-entering-repl
  • schneider/bonding-fail-if-full
  • schneider/ble-fixes-2020-3
  • v1.18
  • v1.17
  • v1.16
  • v1.15
  • v1.14
  • v1.13
  • v1.12
  • v1.11
  • v1.10
  • v1.9
  • v1.8
  • v1.7
  • v1.6
  • v1.5
  • v1.4
  • v1.3
  • v1.2
  • v1.1
  • v1.0
  • release-1
41 results

FreeRTOS_DNS.c

Blame
  • FreeRTOS_DNS.c 44.99 KiB
    /*
     * FreeRTOS+TCP V2.0.11
     * Copyright (C) 2017 Amazon.com, Inc. or its affiliates.  All Rights Reserved.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy of
     * this software and associated documentation files (the "Software"), to deal in
     * the Software without restriction, including without limitation the rights to
     * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
     * the Software, and to permit persons to whom the Software is furnished to do so,
     * subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in all
     * copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
     * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
     * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
     * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
     * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
     *
     * http://aws.amazon.com/freertos
     * http://www.FreeRTOS.org
     */
    
    /* Standard includes. */
    #include <stdint.h>
    
    /* FreeRTOS includes. */
    #include "FreeRTOS.h"
    #include "task.h"
    #include "queue.h"
    #include "list.h"
    #include "semphr.h"
    
    /* FreeRTOS+TCP includes. */
    #include "FreeRTOS_IP.h"
    #include "FreeRTOS_Sockets.h"
    #include "FreeRTOS_IP_Private.h"
    #include "FreeRTOS_UDP_IP.h"
    #include "FreeRTOS_DNS.h"
    #include "NetworkBufferManagement.h"
    #include "NetworkInterface.h"
    #include "IPTraceMacroDefaults.h"
    
    /* Exclude the entire file if DNS is not enabled. */
    #if( ipconfigUSE_DNS != 0 )
    
    #if( ipconfigBYTE_ORDER == pdFREERTOS_LITTLE_ENDIAN )
    	#define dnsDNS_PORT						0x3500
    	#define dnsONE_QUESTION					0x0100
    	#define dnsOUTGOING_FLAGS				0x0001 /* Standard query. */
    	#define dnsRX_FLAGS_MASK				0x0f80 /* The bits of interest in the flags field of incoming DNS messages. */
    	#define dnsEXPECTED_RX_FLAGS			0x0080 /* Should be a response, without any errors. */
    #else
    	#define dnsDNS_PORT						0x0035
    	#define dnsONE_QUESTION					0x0001
    	#define dnsOUTGOING_FLAGS				0x0100 /* Standard query. */
    	#define dnsRX_FLAGS_MASK				0x800f /* The bits of interest in the flags field of incoming DNS messages. */
    	#define dnsEXPECTED_RX_FLAGS			0x8000 /* Should be a response, without any errors. */
    
    #endif /* ipconfigBYTE_ORDER */
    
    /* The maximum number of times a DNS request should be sent out if a response
    is not received, before giving up. */
    #ifndef ipconfigDNS_REQUEST_ATTEMPTS
    	#define ipconfigDNS_REQUEST_ATTEMPTS		5
    #endif
    
    /* If the top two bits in the first character of a name field are set then the