diff --git a/command.md b/command.md index 2159bd3..263c2ac 100644 --- a/command.md +++ b/command.md @@ -2,30 +2,30 @@
wasi:cli/environment@0.2.0-rc-2023-12-05
wasi:cli/exit@0.2.0-rc-2023-12-05
wasi:cli/environment@0.2.0-rc-2024-01-16
wasi:cli/exit@0.2.0-rc-2024-01-16
wasi:io/error@0.2.0-rc-2023-11-10
wasi:io/poll@0.2.0-rc-2023-11-10
wasi:io/streams@0.2.0-rc-2023-11-10
wasi:cli/stdin@0.2.0-rc-2023-12-05
wasi:cli/stdout@0.2.0-rc-2023-12-05
wasi:cli/stderr@0.2.0-rc-2023-12-05
wasi:cli/terminal-input@0.2.0-rc-2023-12-05
wasi:cli/terminal-output@0.2.0-rc-2023-12-05
wasi:cli/terminal-stdin@0.2.0-rc-2023-12-05
wasi:cli/terminal-stdout@0.2.0-rc-2023-12-05
wasi:cli/terminal-stderr@0.2.0-rc-2023-12-05
wasi:cli/stdin@0.2.0-rc-2024-01-16
wasi:cli/stdout@0.2.0-rc-2024-01-16
wasi:cli/stderr@0.2.0-rc-2024-01-16
wasi:cli/terminal-input@0.2.0-rc-2024-01-16
wasi:cli/terminal-output@0.2.0-rc-2024-01-16
wasi:cli/terminal-stdin@0.2.0-rc-2024-01-16
wasi:cli/terminal-stdout@0.2.0-rc-2024-01-16
wasi:cli/terminal-stderr@0.2.0-rc-2024-01-16
wasi:clocks/monotonic-clock@0.2.0-rc-2023-11-10
wasi:clocks/wall-clock@0.2.0-rc-2023-11-10
wasi:filesystem/types@0.2.0-rc-2023-11-10
wasi:filesystem/preopens@0.2.0-rc-2023-11-10
wasi:sockets/network@0.2.0-rc-2023-11-10
wasi:sockets/instance-network@0.2.0-rc-2023-11-10
wasi:sockets/udp@0.2.0-rc-2023-11-10
wasi:sockets/udp-create-socket@0.2.0-rc-2023-11-10
wasi:sockets/tcp@0.2.0-rc-2023-11-10
wasi:sockets/tcp-create-socket@0.2.0-rc-2023-11-10
wasi:sockets/ip-name-lookup@0.2.0-rc-2023-11-10
wasi:sockets/network@0.2.0-rc-2024-01-16
wasi:sockets/instance-network@0.2.0-rc-2024-01-16
wasi:sockets/udp@0.2.0-rc-2024-01-16
wasi:sockets/udp-create-socket@0.2.0-rc-2024-01-16
wasi:sockets/tcp@0.2.0-rc-2024-01-16
wasi:sockets/tcp-create-socket@0.2.0-rc-2024-01-16
wasi:sockets/ip-name-lookup@0.2.0-rc-2024-01-16
wasi:random/random@0.2.0-rc-2023-11-10
wasi:random/insecure@0.2.0-rc-2023-11-10
wasi:random/insecure-seed@0.2.0-rc-2023-11-10
wasi:cli/run@0.2.0-rc-2023-12-05
wasi:cli/run@0.2.0-rc-2024-01-16
get-environment: func
.
as shorthand for this.
-exit: func
splice
.
u64
, stream-error
>type input-stream
splice
.
input-stream
>type output-stream
splice
.
output-stream
>type output-stream
splice
.
output-stream
>Terminal input.
In the future, this may include functions for disabling echoing, disabling input buffering so that keyboard events are sent through @@ -531,7 +531,7 @@ immediately, querying supported features, and so on.
resource terminal-input
The input side of a terminal.
-Terminal output.
In the future, this may include functions for querying the terminal size, being notified of terminal size changes, querying supported @@ -540,7 +540,7 @@ features, and so on.
resource terminal-output
The output side of a terminal.
-An interface providing an optional terminal-input
for stdin as a
link-time authority.
terminal-input
>>An interface providing an optional terminal-output
for stdout as a
link-time authority.
terminal-output
>>An interface providing an optional terminal-output
for stderr as a
link-time authority.
descriptor
>, string
)>resource network
ipv4
: ipv4-socket-address
ipv6
: ipv6-socket-address
This interface provides a value-export of the default network handle..
network
>type pollable
invalid-argument
: The remote-address
has the wrong address family. (EAFNOSUPPORT)invalid-argument
: remote-address
is a non-IPv4-mapped IPv6 address, but the socket was bound to a specific IPv4-mapped IPv6 address. (or vice versa)invalid-argument
: The IP address in remote-address
is set to INADDR_ANY (0.0.0.0
/ ::
). (EDESTADDRREQ, EADDRNOTAVAIL)invalid-argument
: The port in remote-address
is set to 0. (EDESTADDRREQ, EADDRNOTAVAIL)invalid-state
: The socket is not bound.address
is unspecified.
-[method]udp-socket.ipv6-only: func
Whether IPv4 compatibility (dual-stack) mode is disabled or not.
-Equivalent to the IPV6_V6ONLY socket option.
-not-supported
: (get/set) this
socket is an IPv4 socket.invalid-state
: (set) The socket is already bound.not-supported
: (set) Host does not support dual-stack sockets. (Implementations are not required to.)self
: borrow<udp-socket
>bool
, error-code
>[method]udp-socket.set-ipv6-only: func
self
: borrow<udp-socket
>value
: bool
error-code
>[method]udp-socket.unicast-hop-limit: func
Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options.
If the provided value is 0, an invalid-argument
error is returned.
check-send
was not called or datagrams
contains
invalid-argument
: The remote-address
has the wrong address family. (EAFNOSUPPORT)invalid-argument
: remote-address
is a non-IPv4-mapped IPv6 address, but the socket was bound to a specific IPv4-mapped IPv6 address. (or vice versa)invalid-argument
: The IP address in remote-address
is set to INADDR_ANY (0.0.0.0
/ ::
). (EDESTADDRREQ, EADDRNOTAVAIL)invalid-argument
: The port in remote-address
is set to 0. (EDESTADDRREQ, EADDRNOTAVAIL)invalid-argument
: The socket is in "connected" mode and remote-address
is some
value that does not match the address passed to stream
. (EISCONN)future
is natively supported in Pre
pollable
>type network
future
is natively supported in Pre
create-udp-socket: func
Create a new UDP socket.
-Similar to socket(AF_INET or AF_INET6, SOCK_DGRAM, IPPROTO_UDP)
in POSIX.
Similar to socket(AF_INET or AF_INET6, SOCK_DGRAM, IPPROTO_UDP)
in POSIX.
+On IPv6 sockets, IPV6_V6ONLY is enabled by default and can't be configured otherwise.
This function does not require a network capability handle. This is considered to be safe because
at time of creation, the socket is not bound to any network
yet. Up to the moment bind
is called,
the socket is effectively an in-memory configuration object, unable to communicate with the outside world.
udp-socket
>, error-code
>type input-stream
If the IP address is zero (0.0.0.0
in IPv4, ::
in IPv6), it is left to the implementation to decide which
network interface(s) to bind to.
If the TCP/UDP port is zero, the socket will be bound to a random free port.
When a socket is not explicitly bound, the first invocation to a listen or connect operation will -implicitly bind the socket.
Unlike in POSIX, this function is async. This enables interactive WASI hosts to inject permission prompts.
start
errorsinvalid-argument
: The local-address
has the wrong address family. (EAFNOSUPPORT, EFAULT on Windows)invalid-argument
: local-address
is not a unicast address. (EINVAL)invalid-argument
: local-address
is an IPv4-mapped IPv6 address, but the socket has ipv6-only
enabled. (EINVAL)invalid-argument
: local-address
is an IPv4-mapped IPv6 address. (EINVAL)invalid-state
: The socket is already bound. (EINVAL)finish
errorsPOSIX mentions:
---If connect() fails, the state of the socket is unspecified. Conforming applications should -close the file descriptor and create a new socket before attempting to reconnect.
-
WASI prescribes the following behavior:
-connect
fails because an input/state validation error, the socket should remain usable.drop
, any method after such a failure may return an error.After a failed connection attempt, the only valid action left is to
+drop
the socket. A single socket can not be used to connect more than once.
start
errorsinvalid-argument
: The remote-address
has the wrong address family. (EAFNOSUPPORT)invalid-argument
: remote-address
is not a unicast address. (EINVAL, ENETUNREACH on Linux, EAFNOSUPPORT on MacOS)invalid-argument
: remote-address
is an IPv4-mapped IPv6 address, but the socket has ipv6-only
enabled. (EINVAL, EADDRNOTAVAIL on Illumos)invalid-argument
: remote-address
is a non-IPv4-mapped IPv6 address, but the socket was bound to a specific IPv4-mapped IPv6 address. (or vice versa)invalid-argument
: remote-address
is an IPv4-mapped IPv6 address. (EINVAL, EADDRNOTAVAIL on Illumos)invalid-argument
: The IP address in remote-address
is set to INADDR_ANY (0.0.0.0
/ ::
). (EADDRNOTAVAIL on Windows)invalid-argument
: The port in remote-address
is set to 0. (EADDRNOTAVAIL on Windows)invalid-argument
: The socket is already attached to a different network. The network
passed to connect
must be identical to the one passed to bind
.drop
, any method after such a failure may return an error.<
The returned socket is bound and in the Connection state. The following properties are inherited from the listener socket:
address-family
ipv6-only
keep-alive-enabled
keep-alive-idle-time
keep-alive-interval
address
is unspecified.
-[method]tcp-socket.ipv6-only: func
Whether IPv4 compatibility (dual-stack) mode is disabled or not.
-Equivalent to the IPV6_V6ONLY socket option.
-invalid-state
: (set) The socket is already bound.not-supported
: (get/set) this
socket is an IPv4 socket.not-supported
: (set) Host does not support dual-stack sockets. (Implementations are not required to.)self
: borrow<tcp-socket
>bool
, error-code
>[method]tcp-socket.set-ipv6-only: func
self
: borrow<tcp-socket
>value
: bool
error-code
>[method]tcp-socket.set-listen-backlog-size: func
Hints the desired listen queue size. Implementations are free to ignore this.
If the provided value is 0, an invalid-argument
error is returned.
@@ -2849,13 +2781,16 @@ It's planned to be removed when future
is natively supported in Pre
[method]tcp-socket.shutdown: func
Initiate a graceful shutdown.
input-stream
associated with this socket will return an End Of Stream indication.
-Any data still in the receive queue at time of calling shutdown
will be discarded.output-stream
associated with this socket will return an error.receive
: The socket is not expecting to receive any data from
+the peer. The input-stream
associated with this socket will be
+closed. Any data still in the receive queue at time of calling
+this method will be discarded.send
: The socket has no more data to send to the peer. The output-stream
+associated with this socket will be closed and a FIN packet will be sent.both
: Same effect as receive
& send
combined.This function is idempotent. Shutting a down a direction more than once
+has no effect and returns ok
.
The shutdown function does not close (drop) the socket.
output-stream
associ
error-code
>type network
output-stream
associ
create-tcp-socket: func
Create a new TCP socket.
-Similar to socket(AF_INET or AF_INET6, SOCK_STREAM, IPPROTO_TCP)
in POSIX.
Similar to socket(AF_INET or AF_INET6, SOCK_STREAM, IPPROTO_TCP)
in POSIX.
+On IPv6 sockets, IPV6_V6ONLY is enabled by default and can't be configured otherwise.
This function does not require a network capability handle. This is considered to be safe because
-at time of creation, the socket is not bound to any network
yet. Up to the moment bind
/listen
/connect
+at time of creation, the socket is not bound to any network
yet. Up to the moment bind
/connect
is called, the socket is effectively an in-memory configuration object, unable to communicate with the outside world.
All sockets are non-blocking. Use the wasi-poll interface to block on asynchronous operations.
tcp-socket
>, error-code
>type pollable
run: func
wasi:cli/environment@0.2.0-rc-2023-12-05
wasi:cli/exit@0.2.0-rc-2023-12-05
wasi:cli/environment@0.2.0-rc-2024-01-16
wasi:cli/exit@0.2.0-rc-2024-01-16
wasi:io/error@0.2.0-rc-2023-11-10
wasi:io/poll@0.2.0-rc-2023-11-10
wasi:io/streams@0.2.0-rc-2023-11-10
wasi:cli/stdin@0.2.0-rc-2023-12-05
wasi:cli/stdout@0.2.0-rc-2023-12-05
wasi:cli/stderr@0.2.0-rc-2023-12-05
wasi:cli/terminal-input@0.2.0-rc-2023-12-05
wasi:cli/terminal-output@0.2.0-rc-2023-12-05
wasi:cli/terminal-stdin@0.2.0-rc-2023-12-05
wasi:cli/terminal-stdout@0.2.0-rc-2023-12-05
wasi:cli/terminal-stderr@0.2.0-rc-2023-12-05
wasi:cli/stdin@0.2.0-rc-2024-01-16
wasi:cli/stdout@0.2.0-rc-2024-01-16
wasi:cli/stderr@0.2.0-rc-2024-01-16
wasi:cli/terminal-input@0.2.0-rc-2024-01-16
wasi:cli/terminal-output@0.2.0-rc-2024-01-16
wasi:cli/terminal-stdin@0.2.0-rc-2024-01-16
wasi:cli/terminal-stdout@0.2.0-rc-2024-01-16
wasi:cli/terminal-stderr@0.2.0-rc-2024-01-16
wasi:clocks/monotonic-clock@0.2.0-rc-2023-11-10
wasi:clocks/wall-clock@0.2.0-rc-2023-11-10
wasi:filesystem/types@0.2.0-rc-2023-11-10
wasi:filesystem/preopens@0.2.0-rc-2023-11-10
wasi:sockets/network@0.2.0-rc-2023-11-10
wasi:sockets/instance-network@0.2.0-rc-2023-11-10
wasi:sockets/udp@0.2.0-rc-2023-11-10
wasi:sockets/udp-create-socket@0.2.0-rc-2023-11-10
wasi:sockets/tcp@0.2.0-rc-2023-11-10
wasi:sockets/tcp-create-socket@0.2.0-rc-2023-11-10
wasi:sockets/ip-name-lookup@0.2.0-rc-2023-11-10
wasi:sockets/network@0.2.0-rc-2024-01-16
wasi:sockets/instance-network@0.2.0-rc-2024-01-16
wasi:sockets/udp@0.2.0-rc-2024-01-16
wasi:sockets/udp-create-socket@0.2.0-rc-2024-01-16
wasi:sockets/tcp@0.2.0-rc-2024-01-16
wasi:sockets/tcp-create-socket@0.2.0-rc-2024-01-16
wasi:sockets/ip-name-lookup@0.2.0-rc-2024-01-16
wasi:random/random@0.2.0-rc-2023-11-10
wasi:random/insecure@0.2.0-rc-2023-11-10
wasi:random/insecure-seed@0.2.0-rc-2023-11-10
get-environment: func
.
as shorthand for this.
-exit: func
splice
.
u64
, stream-error
>type input-stream
splice
.
input-stream
>type output-stream
splice
.
output-stream
>type output-stream
splice
.
output-stream
>Terminal input.
In the future, this may include functions for disabling echoing, disabling input buffering so that keyboard events are sent through @@ -526,7 +526,7 @@ immediately, querying supported features, and so on.
resource terminal-input
The input side of a terminal.
-Terminal output.
In the future, this may include functions for querying the terminal size, being notified of terminal size changes, querying supported @@ -535,7 +535,7 @@ features, and so on.
resource terminal-output
The output side of a terminal.
-An interface providing an optional terminal-input
for stdin as a
link-time authority.
terminal-input
>>An interface providing an optional terminal-output
for stdout as a
link-time authority.
terminal-output
>>An interface providing an optional terminal-output
for stderr as a
link-time authority.
descriptor
>, string
)>resource network
ipv4
: ipv4-socket-address
ipv6
: ipv6-socket-address
This interface provides a value-export of the default network handle..
network
>type pollable
invalid-argument
: The remote-address
has the wrong address family. (EAFNOSUPPORT)invalid-argument
: remote-address
is a non-IPv4-mapped IPv6 address, but the socket was bound to a specific IPv4-mapped IPv6 address. (or vice versa)invalid-argument
: The IP address in remote-address
is set to INADDR_ANY (0.0.0.0
/ ::
). (EDESTADDRREQ, EADDRNOTAVAIL)invalid-argument
: The port in remote-address
is set to 0. (EDESTADDRREQ, EADDRNOTAVAIL)invalid-state
: The socket is not bound.address
is unspecified.
-[method]udp-socket.ipv6-only: func
Whether IPv4 compatibility (dual-stack) mode is disabled or not.
-Equivalent to the IPV6_V6ONLY socket option.
-not-supported
: (get/set) this
socket is an IPv4 socket.invalid-state
: (set) The socket is already bound.not-supported
: (set) Host does not support dual-stack sockets. (Implementations are not required to.)self
: borrow<udp-socket
>bool
, error-code
>[method]udp-socket.set-ipv6-only: func
self
: borrow<udp-socket
>value
: bool
error-code
>[method]udp-socket.unicast-hop-limit: func
Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options.
If the provided value is 0, an invalid-argument
error is returned.
check-send
was not called or datagrams
contains
invalid-argument
: The remote-address
has the wrong address family. (EAFNOSUPPORT)invalid-argument
: remote-address
is a non-IPv4-mapped IPv6 address, but the socket was bound to a specific IPv4-mapped IPv6 address. (or vice versa)invalid-argument
: The IP address in remote-address
is set to INADDR_ANY (0.0.0.0
/ ::
). (EDESTADDRREQ, EADDRNOTAVAIL)invalid-argument
: The port in remote-address
is set to 0. (EDESTADDRREQ, EADDRNOTAVAIL)invalid-argument
: The socket is in "connected" mode and remote-address
is some
value that does not match the address passed to stream
. (EISCONN)future
is natively supported in Pre
pollable
>type network
future
is natively supported in Pre
create-udp-socket: func
Create a new UDP socket.
-Similar to socket(AF_INET or AF_INET6, SOCK_DGRAM, IPPROTO_UDP)
in POSIX.
Similar to socket(AF_INET or AF_INET6, SOCK_DGRAM, IPPROTO_UDP)
in POSIX.
+On IPv6 sockets, IPV6_V6ONLY is enabled by default and can't be configured otherwise.
This function does not require a network capability handle. This is considered to be safe because
at time of creation, the socket is not bound to any network
yet. Up to the moment bind
is called,
the socket is effectively an in-memory configuration object, unable to communicate with the outside world.
udp-socket
>, error-code
>type input-stream
If the IP address is zero (0.0.0.0
in IPv4, ::
in IPv6), it is left to the implementation to decide which
network interface(s) to bind to.
If the TCP/UDP port is zero, the socket will be bound to a random free port.
When a socket is not explicitly bound, the first invocation to a listen or connect operation will -implicitly bind the socket.
Unlike in POSIX, this function is async. This enables interactive WASI hosts to inject permission prompts.
start
errorsinvalid-argument
: The local-address
has the wrong address family. (EAFNOSUPPORT, EFAULT on Windows)invalid-argument
: local-address
is not a unicast address. (EINVAL)invalid-argument
: local-address
is an IPv4-mapped IPv6 address, but the socket has ipv6-only
enabled. (EINVAL)invalid-argument
: local-address
is an IPv4-mapped IPv6 address. (EINVAL)invalid-state
: The socket is already bound. (EINVAL)finish
errorsPOSIX mentions:
---If connect() fails, the state of the socket is unspecified. Conforming applications should -close the file descriptor and create a new socket before attempting to reconnect.
-
WASI prescribes the following behavior:
-connect
fails because an input/state validation error, the socket should remain usable.drop
, any method after such a failure may return an error.After a failed connection attempt, the only valid action left is to
+drop
the socket. A single socket can not be used to connect more than once.
start
errorsinvalid-argument
: The remote-address
has the wrong address family. (EAFNOSUPPORT)invalid-argument
: remote-address
is not a unicast address. (EINVAL, ENETUNREACH on Linux, EAFNOSUPPORT on MacOS)invalid-argument
: remote-address
is an IPv4-mapped IPv6 address, but the socket has ipv6-only
enabled. (EINVAL, EADDRNOTAVAIL on Illumos)invalid-argument
: remote-address
is a non-IPv4-mapped IPv6 address, but the socket was bound to a specific IPv4-mapped IPv6 address. (or vice versa)invalid-argument
: remote-address
is an IPv4-mapped IPv6 address. (EINVAL, EADDRNOTAVAIL on Illumos)invalid-argument
: The IP address in remote-address
is set to INADDR_ANY (0.0.0.0
/ ::
). (EADDRNOTAVAIL on Windows)invalid-argument
: The port in remote-address
is set to 0. (EADDRNOTAVAIL on Windows)invalid-argument
: The socket is already attached to a different network. The network
passed to connect
must be identical to the one passed to bind
.drop
, any method after such a failure may return an error.<
The returned socket is bound and in the Connection state. The following properties are inherited from the listener socket:
address-family
ipv6-only
keep-alive-enabled
keep-alive-idle-time
keep-alive-interval
address
is unspecified.
-[method]tcp-socket.ipv6-only: func
Whether IPv4 compatibility (dual-stack) mode is disabled or not.
-Equivalent to the IPV6_V6ONLY socket option.
-invalid-state
: (set) The socket is already bound.not-supported
: (get/set) this
socket is an IPv4 socket.not-supported
: (set) Host does not support dual-stack sockets. (Implementations are not required to.)self
: borrow<tcp-socket
>bool
, error-code
>[method]tcp-socket.set-ipv6-only: func
self
: borrow<tcp-socket
>value
: bool
error-code
>[method]tcp-socket.set-listen-backlog-size: func
Hints the desired listen queue size. Implementations are free to ignore this.
If the provided value is 0, an invalid-argument
error is returned.
@@ -2844,13 +2776,16 @@ It's planned to be removed when future
is natively supported in Pre
[method]tcp-socket.shutdown: func
Initiate a graceful shutdown.
input-stream
associated with this socket will return an End Of Stream indication.
-Any data still in the receive queue at time of calling shutdown
will be discarded.output-stream
associated with this socket will return an error.receive
: The socket is not expecting to receive any data from
+the peer. The input-stream
associated with this socket will be
+closed. Any data still in the receive queue at time of calling
+this method will be discarded.send
: The socket has no more data to send to the peer. The output-stream
+associated with this socket will be closed and a FIN packet will be sent.both
: Same effect as receive
& send
combined.This function is idempotent. Shutting a down a direction more than once
+has no effect and returns ok
.
The shutdown function does not close (drop) the socket.
output-stream
associ
error-code
>type network
output-stream
associ
create-tcp-socket: func
Create a new TCP socket.
-Similar to socket(AF_INET or AF_INET6, SOCK_STREAM, IPPROTO_TCP)
in POSIX.
Similar to socket(AF_INET or AF_INET6, SOCK_STREAM, IPPROTO_TCP)
in POSIX.
+On IPv6 sockets, IPV6_V6ONLY is enabled by default and can't be configured otherwise.
This function does not require a network capability handle. This is considered to be safe because
-at time of creation, the socket is not bound to any network
yet. Up to the moment bind
/listen
/connect
+at time of creation, the socket is not bound to any network
yet. Up to the moment bind
/connect
is called, the socket is effectively an in-memory configuration object, unable to communicate with the outside world.
All sockets are non-blocking. Use the wasi-poll interface to block on asynchronous operations.
tcp-socket
>, error-code
>type pollable