Enhance sock_addr_local syscall (#1320)

Slightly change the __wasi_sock_addr_local interface - since we already have
a `__wasi_addr_t` structure which is an union, there's no need for passing the
length around - the address buffer will always have the right length (i.e. max
of all address families).
This commit is contained in:
Marcin Kolny
2022-08-01 09:15:33 +02:00
committed by GitHub
parent 08fd714551
commit 3e77b053c3
11 changed files with 195 additions and 40 deletions

View File

@ -374,6 +374,25 @@ os_socket_addr_resolve(const char *host, const char *service,
bh_addr_info_t *addr_info, size_t addr_info_size,
size_t *max_info_size);
/**
* Returns an binary address and a port of the local socket
*
* @param socket the local socket
*
* @param buf buffer to store the address
*
* @param buflen length of the buf buffer
*
* @param port a buffer for storing socket's port
*
* @param is_ipv4 a buffer for storing information about the address family
*
* @return On success, returns 0; otherwise, it returns -1.
*/
int
os_socket_addr_local(bh_socket_t socket, uint8_t *buf, size_t buflen,
uint16_t *port, uint8_t *is_ipv4);
#ifdef __cplusplus
}
#endif