Advanced request configuration
It is possible to not use the default DNS configuration when resolving a specific host such as specifying a particular DNS server, different number of request retries and so on. When calling DNSc_GetHost() it is possible to specify a request configuration in the parameter p_cfg.
µC/DNSc request configuration is based on a structure that contains different configuration sections with many parameter settings.This section describes the request 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. Refer to the configuration field description section for further details.
Request Configuration
µC/DNS uses the following structure to configure requests:
typedef struct DNSc_req_cfg { DNSc_ADDR_OBJ *ServerAddrPtr; NET_PORT_NBR ServerPort; CPU_INT16U TaskDly_ms; CPU_INT16U ReqTimeout_ms; CPU_INT08U ReqRetry; DNSc_REQ_TYPE ReqType; DNSc_FLAGS ReqFlags; } DNSc_REQ_CFG;
Structure Fields
Structure Field | Type | Description | Possible Values |
---|---|---|---|
ServerAddrPtr | CPU_CHAR | Server IP address | DEF_NULL to use the default server Pointer to a string that contains the IP address. |
ServerPort | NET_PORT_NBR | Port number | NET_PORT_NBR_NONE Default DNS port MUST be >= NET_PORT_NBR_MIN Must be <= NET_PORT_NBR_MAX |
TaskDly_ms | CPU_INT16U | Configure task delay in integer milliseconds | Default value: [DNSc_DFLT_TASK_DLY_MS] = 50ms MUST be >= 1 |
ReqTimeout_ms | CPU_INT16U | Configure timeout before a request resolution retry | Default value: [DNSc_DFLT_REQ_RETRY_TIMEOUT_MS] = 1000ms MUST be >= 100 |
ReqRetry | CPU_INT08U | Configure maximum of request resolution retry. | Default value: [DNSc_DFLT_REQ_RETRY_NBR_MAX] = 2 MUST be >= 1 |
ReqType | DNSc_REQ_TYPE | Instructs the DNS request state machine if the request is a forward request (type A, AAAA), or a reverse request (type PTR IPv4 or PTR IPv6). | Meant for internal use by uC/DNSc. Any values passed are ignored. |
ReqFlags | DNSc_FLAGS | Contains a copy of DNSc_GetHost()'s 'flags' argument to keep track of them internally. Enables DNSc to use its internal flags DNSc_FLAG_UPDATE_PREF and DNSc_FLAG_RESET_REQ without modifying the 'flags' argument. | Meant for internal use by uC/DNSc. Any values passed are ignored. |