Chapter 2. API Reference
• [out] if_ip6: IPv6 information will be returned in this argument if successful.
esp_err_t esp_netif_get_ip6_global(esp_netif_t *esp_netif, esp_ip6_addr_t *if_ip6)
Get interface global IPv6 address.
If the specified interface is up and a preferred global IPv6 address has been created for the interface, return a
copy of it.
Return
• ESP_OK
• ESP_FAIL If interface is down, does not have a global IPv6 address, or the global IPv6 address is
not a preferred address.
Parameters
• [in] esp_netif: Handle to esp-netif instance
• [out] if_ip6: IPv6 information will be returned in this argument if successful.
int esp_netif_get_all_ip6(esp_netif_t *esp_netif, esp_ip6_addr_t if_ip6[])
Get all IPv6 addresses of the specified interface.
Return number of returned IPv6 addresses
Parameters
• [in] esp_netif: Handle to esp-netif instance
• [out] if_ip6: Array of IPv6 addresses will be copied to the argument
void esp_netif_set_ip4_addr(esp_ip4_addr_t *addr, uint8_t a, uint8_t b, uint8_t c, uint8_t d)
Sets IPv4 address to the specified octets.
Parameters
• [out] addr: IP address to be set
• a: the first octet (127 for IP 127.0.0.1)
• b:
• c:
• d:
char *esp_ip4addr_ntoa(const esp_ip4_addr_t *addr, char *buf, int buflen)
Converts numeric IP address into decimal dotted ASCII representation.
Return either pointer to buf which now holds the ASCII representation of addr or NULL if buf was too small
Parameters
• addr: ip address in network order to convert
• buf: target buffer where the string is stored
• buflen: length of buf
uint32_t esp_ip4addr_aton(const char *addr)
Ascii internet address interpretation routine The value returned is in network order.
Return ip address in network order
Parameters
• addr: IP address in ascii representation (e.g. “127.0.0.1”)
esp_err_t esp_netif_str_to_ip4(const char *src, esp_ip4_addr_t *dst)
Converts Ascii internet IPv4 address into esp_ip4_addr_t.
Return
• ESP_OK on success
• ESP_FAIL if conversion failed
• ESP_ERR_INVALID_ARG if invalid parameter is passed into
Parameters
• [in] src: IPv4 address in ascii representation (e.g. “127.0.0.1”)
• [out] dst: Address of the target esp_ip4_addr_t structure to receive converted address
esp_err_t esp_netif_str_to_ip6(const char *src, esp_ip6_addr_t *dst)
Converts Ascii internet IPv6 address into esp_ip4_addr_t Zeros in the IP address can be stripped or completely
ommited: “2001:db8:85a3:0:0:0:2:1”or “2001:db8::2:1”)
Return
Espressif Systems 207
Submit Document Feedback
Release v4.4