Domain Name System

group LWESP_DNS

Domain name server.

Functions

lwespr_t lwesp_dns_gethostbyname(const char *host, lwesp_ip_t *const ip, const lwesp_api_cmd_evt_fn evt_fn, void *const evt_arg, const uint32_t blocking)

Get IP address from host name.

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

  • ip[out] Pointer to lwesp_ip_t variable to save IP

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

  • evt_arg[in] Custom argument for event callback function

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

Returns

lwespOK on success, member of lwespr_t enumeration otherwise

lwespr_t lwesp_dns_get_config(lwesp_ip_t *s1, lwesp_ip_t *s2, const lwesp_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.

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

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

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

  • evt_arg[in] Custom argument for event callback function

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

Returns

lwespOK on success, member of lwespr_t enumeration otherwise

lwespr_t lwesp_dns_set_config(uint8_t en, const char *s1, const char *s2, const lwesp_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.

Parameters
  • en[in] 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

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

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

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

  • evt_arg[in] Custom argument for event callback function

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

Returns

lwespOK on success, member of lwespr_t enumeration otherwise