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.

Return

lwespOK on success, member of lwespr_t enumeration otherwise

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

  • [out] ip: Pointer to lwesp_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

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.

Return

lwespOK on success, member of lwespr_t enumeration otherwise

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

  • [out] s2: 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

  • [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

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.

Return

lwespOK on success, member of lwespr_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