Domain Name System

group ESP_DNS

Domain name server.

Functions

espr_t esp_dns_gethostbyname(const char *host, esp_ip_t *const ip, const esp_api_cmd_evt_fn evt_fn, void *const evt_arg, const uint32_t blocking)

Get IP address from host name.

Return

espOK on success, member of espr_t enumeration otherwise

Parameters
  • [in] host: Pointer to host name to get IP for

  • [out] ip: Pointer to esp_ip_t variable to save IP

  • [in] evt_fn: Callback function called when command has finished. Set to NULL when not used

  • [in] evt_arg: Custom argument for event callback function

  • [in] blocking: Status whether command should be blocking or not

espr_t esp_dns_get_config(esp_ip_t *s1, esp_ip_t *s2, const esp_api_cmd_evt_fn evt_fn, void *const evt_arg, const uint32_t blocking)

Get the DNS server configuration.

Retrive configuration saved in the NVS area of ESP device.

Return

espOK on success, member of espr_t enumeration otherwise

Parameters
  • [out] s1: First server IP address in esp_ip_t format, set to 0.0.0.0 if not used

  • [out] s2: Second server IP address in esp_ip_t format, set to to 0.0.0.0 if not used. Address s1 cannot be the same as s2

  • [in] evt_fn: Callback function called when command has finished. Set to NULL when not used

  • [in] evt_arg: Custom argument for event callback function

  • [in] blocking: Status whether command should be blocking or not

espr_t esp_dns_set_config(uint8_t en, const char *s1, const char *s2, const esp_api_cmd_evt_fn evt_fn, void *const evt_arg, const uint32_t blocking)

Enable or disable custom DNS server configuration.

Configuration changes will be saved in the NVS area of ESP device.

Return

espOK on success, member of espr_t enumeration otherwise

Parameters
  • [in] en: Set to 1 to enable, 0 to disable custom DNS configuration. When disabled, default DNS servers are used as proposed by ESP AT commands firmware

  • [in] s1: First server IP address in string format, set to NULL if not used

  • [in] s2: Second server IP address in string format, set to NULL if not used. Address s1 cannot be the same as s2

  • [in] evt_fn: Callback function called when command has finished. Set to NULL when not used

  • [in] evt_arg: Custom argument for event callback function

  • [in] blocking: Status whether command should be blocking or not