wasi_p2_sockets (wasm v0.16.0)
View SourceThe wasi:sockets slice of the WASI 0.2 host: sockets/1 builds the network,
name lookup, TCP and UDP imports over wasi_sock2, gated by a wasi_net grant.
Read it when you change a socket method, an option, or an address check. The
streams a connection opens are the stream resources wasi_preview2 serves, and
that module calls in here for the socket side of them: udp_pump/4 fills a
datagram stream and sock2_errno/1 names a send failure. This module never
calls back into wasi_preview2. datagram_allowed/3 and peer_matches/3 are
the UDP grant and peer checks.
Summary
Functions
wasi:sockets: the network foundation, ip-name-lookup, TCP and UDP, the
sockets themselves over wasi_sock2. instance-network mints a network resource carrying the grant; resolve-addresses
resolves a name (gated by wasi_net:resolves/1, so a component with no grant
resolves nothing) into a stream of addresses; resolve-next-address pops each as
an ipv4/ipv6 value. The address decision is wasi_net, not a second copy of
it, so a p2 guest reaches only what a p1 grant permits.
Functions
wasi:sockets: the network foundation, ip-name-lookup, TCP and UDP, the
sockets themselves over wasi_sock2. instance-network mints a network resource carrying the grant; resolve-addresses
resolves a name (gated by wasi_net:resolves/1, so a component with no grant
resolves nothing) into a stream of addresses; resolve-next-address pops each as
an ipv4/ipv6 value. The address decision is wasi_net, not a second copy of
it, so a p2 guest reaches only what a p1 grant permits.