mirror of
https://github.com/espressif/esp-idf.git
synced 2025-11-22 19:32:15 +00:00
feat(lwip): Added wrapper for getaddrinfo to handle AF_UNSPEC
This commit is contained in:
39
components/lwip/include/apps/esp_netdb.h
Normal file
39
components/lwip/include/apps/esp_netdb.h
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef __ESP_NETDB_H__
|
||||
#define __ESP_NETDB_H__
|
||||
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Custom getaddrinfo() wrapper for lwIP that handles AF_UNSPEC correctly.
|
||||
*
|
||||
* Resolves both IPv4 and IPv6 addresses when AF_UNSPEC is specified. Works
|
||||
* even if only one protocol (IPv4 or IPv6) is enabled in lwIP. Merges results
|
||||
* if both protocols are available.
|
||||
*
|
||||
* @return 0 on success, or an error code on failure.
|
||||
* - `EAI_FAMILY`: Address family not supported.
|
||||
*
|
||||
* @note Caller must free the result list with freeaddrinfo().
|
||||
*
|
||||
* @see getaddrinfo(), freeaddrinfo()
|
||||
*/
|
||||
#if CONFIG_LWIP_USE_ESP_GETADDRINFO
|
||||
int esp_getaddrinfo(const char *nodename, const char *servname,
|
||||
const struct addrinfo *hints, struct addrinfo **res);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __ESP_NETDB_H__
|
||||
Reference in New Issue
Block a user