Add support for IPv6 in WAMR (#1411)
For now this implementation only covers posix platforms, as defined in MVP #1336
This commit is contained in:
@ -296,12 +296,13 @@ os_sem_unlink(const char *name);
|
||||
* Create a socket
|
||||
*
|
||||
* @param sock [OUTPUT] the pointer of socket
|
||||
* @param tcp_or_udp 1 for tcp, 0 for udp
|
||||
* @param is_ipv4 true for IPv4, false for IPv6
|
||||
* @param is_tcp true for tcp, false for udp
|
||||
*
|
||||
* @return 0 if success, -1 otherwise
|
||||
*/
|
||||
int
|
||||
os_socket_create(bh_socket_t *sock, int tcp_or_udp);
|
||||
os_socket_create(bh_socket_t *sock, bool is_ipv4, bool is_tcp);
|
||||
|
||||
/**
|
||||
* Assign the address and port to the socket
|
||||
@ -412,17 +413,30 @@ os_socket_close(bh_socket_t socket);
|
||||
int
|
||||
os_socket_shutdown(bh_socket_t socket);
|
||||
|
||||
typedef union {
|
||||
uint32 ipv4;
|
||||
uint16 ipv6[8];
|
||||
uint8_t data[0];
|
||||
} bh_inet_network_output_t;
|
||||
|
||||
/**
|
||||
* converts cp into a number in host byte order suitable for use as
|
||||
* an Internet network address
|
||||
*
|
||||
* @param cp a string in IPv4 numbers-and-dots notation
|
||||
* @param is_ipv4 a flag that indicates whether the string is an IPv4 or
|
||||
* IPv6 address
|
||||
*
|
||||
* @return On success, the converted address is returned.
|
||||
* @param cp a string in IPv4 numbers-and-dots notation or IPv6
|
||||
* numbers-and-colons notation
|
||||
*
|
||||
* @param out an output buffer to store binary address
|
||||
*
|
||||
* @return On success, the function returns 0.
|
||||
* If the input is invalid, -1 is returned
|
||||
*/
|
||||
int
|
||||
os_socket_inet_network(const char *cp, uint32 *out);
|
||||
os_socket_inet_network(bool is_ipv4, const char *cp,
|
||||
bh_inet_network_output_t *out);
|
||||
|
||||
typedef struct {
|
||||
uint8_t addr[16];
|
||||
|
||||
Reference in New Issue
Block a user