Implement wasi_addr_resolve function (#1319)

Implement wasi_addr_resolve function.
    
Also slightly modify the interface to make it more accessible for the end user:
- replace port argument with the service - so the user can actually get the port for a given service if unknown
- introduce __wasi_addr_info_t and use it as a buffer for addresses, instead of generic buffer
- introduce __wasi_addr_info_hints_t so user can enable filtering on the syscall level (and therefore use smaller buffers for addresses)
- add max_size parameter for the API as an output - in case the number of addresses is bigger than the buffer size, user can repeat the call with bigger buffer

This change is very minimalistic, and it doesn't include the followings:
 1. implementation of getaddrinfo in the lib-socket
 2. sample application
Which are to be added in the following change #1336
This commit is contained in:
Marcin Kolny
2022-07-28 05:25:05 +01:00
committed by GitHub
parent ab752cd5c3
commit f6bbeade2a
8 changed files with 306 additions and 17 deletions

View File

@ -4,6 +4,7 @@
*/
#include "platform_api_vmcore.h"
#include "platform_api_extension.h"
#ifndef SGX_DISABLE_WASI
@ -620,4 +621,15 @@ os_socket_shutdown(bh_socket_t socket)
return shutdown(socket, O_RDWR);
}
int
os_socket_addr_resolve(const char *host, const char *service,
uint8_t *hint_is_tcp, uint8_t *hint_is_ipv4,
bh_addr_info_t *addr_info, size_t addr_info_size,
size_t *max_info_size)
{
errno = ENOSYS;
return BHT_ERROR;
}
#endif