Run-time Configuration
All µC/DNSc require a run-time configuration that must be passed during the initialization. DNS run-time configuration template files are provided (see µC/DNSc Directories and Files). The run-time configuration template file (dns-c_cfg.*
)
should be copied into application folder and modified following your requirements.
Micrium provides sample configuration code free of charge; however, most sample code will likely require modification depending on the combination feature requirements and memory limitation.
Structure Fields
µC/DNSc run-time configuration is based on a structure that contains different configuration sections with many parameter settings. This section describes the run-time configuration settings, and should provide you an in-depth understanding of all parameters configuration. You will also discover which settings to modify in order to enhance the functionalities and the performances. Refer to the configuration field description section for further details.
DNSc Run-time Configuration Structure
const DNSc_CFG DNSc_Cfg = { /* ---------------- MEMORY ALLOCATION ---------------- */ DEF_NULL, /* .MemSegPtr */ /* ----------------- DEFAULT SERVER ------------------ */ "8.8.8.8", /* .ServerDfltPtr */ /* --------------- CACHE CONFIGURATION --------------- */ 255, /* .HostNameLenMax */ 2, /* .CacheEntriesMaxNbr */ 1, /* .AddrIPv4MaxPerHost */ 1, /* .AddrIPv6MaxPerHost */ /* -------------- REQUEST CONFIGURATION -------------- */ DNSc_DFLT_TASK_DLY_MS, /* .TaskDly_ms */ DNSc_DFLT_REQ_RETRY_NBR_MAX, /* .ReqRetryNbrMax */ DNSc_DFLT_REQ_RETRY_TIMEOUT_MS, /* .ReqRetryTimeout_ms */ };
Memory allocation configuration
Structure Field | Type | Description | Possible Values |
---|---|---|---|
MemSegPtr | MEM_SEG | It is possible allocate all the memory used by the DNS client in a specific memory location by setting a memory segment in the configuration | DEF_NULL to allocate the memory from the HEAP Pointer to a memory segment to allocate from (see µC/LIB - Memory Segments) |
Default DNS server configuration
Structure Field | Type | Description | Possible Values |
---|---|---|---|
ServerDfltPtr | CPU_CHAR | The default server used by the DNS client. | Pointer to a string that contains the IP address. |
Cache configuration
Structure Field | Type | Description | Possible Values |
---|---|---|---|
HostNameLenMax | CPU_INT16U | Maximum host name length that can be requested. | MUST be >= 2 |
CacheEntriesMaxNbr | CPU_INT08U | Number of entries the cache can contains. | MUST be >= 1 |
AddrIPv4MaxPerHost | CPU_INT08U | Maximum number of IPv4 addresses that can be stored by a host in the cache. Only valid if IPv4 is enabled (see Network Stack Configuration) | MUST be >= 0 |
AddrIPv6MaxPerHost | CPU_INT08U | Maximum number of IPv6 addresses that can be stored by a host in the cache. Only valid if IPv4 is enabled (see Network Stack Configuration) | MUST be >= 0 |
Request configuration
Structure Field | Type | Description | Possible Values |
---|---|---|---|
TaskDly_ms | CPU_INT08U | Configure task delay in integer milliseconds When asynchronous mode is enabled the task can be periodically to allow other task with lower priority to run. | Default value: [DNSc_DFLT_TASK_DLY_MS] = 50ms MUST be >= 1 |
ReqRetryNbrMax | CPU_INT08U | Configure maximum of request resolution retry. | Default value: [DNSc_DFLT_REQ_RETRY_NBR_MAX] = 2 MUST be >= 1 |
ReqRetryTimeout_ms | CPU_INT16U | Configure timeout before a request resolution retry | Default value: [DNSc_DFLT_REQ_RETRY_TIMEOUT_MS] = 1000ms MUST be >= 100 |