WasmEdge
WasmEdge copied to clipboard
feat: WASI-Socket: Handle IPv4, IPv6, and more protocols
Motivation
In the current design of the WASI socket, we use sockaddr_in and sockaddr_in6 to handle the IPv4 and IPv6. However, it's a big problem to deal with the structure size in WASM memory. The sockaddr_in uses 16 bytes whereas sockaddr_in6 uses 28 bytes.
To simply the situation and increase the compatibility, using sockaddr_storage as the new interface type is a better way.
Details
To enable this feature, there are several things need to do:
- Handle the conversion between
sockaddr_storageandsockaddr_in | sockaddr_in6in the host function implementation details. - Define the corresponding data structure on Rust Crates Side.
UP UP UP UP UP
Can be replaced by #2939