Skip to content

Commit

Permalink
chore: bump @since to 0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rvolosatovs committed Jan 14, 2025
1 parent 8cc04c8 commit dfc429e
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 73 deletions.
6 changes: 3 additions & 3 deletions wit-0.3.0-draft/instance-network.wit
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@

/// This interface provides a value-export of the default network handle..
@since(version = 0.2.0)
@since(version = 0.3.0
interface instance-network {
@since(version = 0.2.0)
@since(version = 0.3.0
use network.{network};

/// Get a handle to the default network.
@since(version = 0.2.0)
@since(version = 0.3.0
instance-network: func() -> network;
}
10 changes: 5 additions & 5 deletions wit-0.3.0-draft/ip-name-lookup.wit
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@since(version = 0.2.0)
@since(version = 0.3.0
interface ip-name-lookup {
@since(version = 0.2.0)
@since(version = 0.3.0
use network.{network, error-code, ip-address};

/// Resolve an internet host name to a list of IP addresses.
Expand All @@ -23,10 +23,10 @@ interface ip-name-lookup {
/// - <https://man7.org/linux/man-pages/man3/getaddrinfo.3.html>
/// - <https://learn.microsoft.com/en-us/windows/win32/api/ws2tcpip/nf-ws2tcpip-getaddrinfo>
/// - <https://man.freebsd.org/cgi/man.cgi?query=getaddrinfo&sektion=3>
@since(version = 0.2.0)
@since(version = 0.3.0
resolve-addresses: func(network: borrow<network>, name: string) -> result<resolve-address-stream, error-code>;

@since(version = 0.2.0)
@since(version = 0.3.0
resource resolve-address-stream {
/// Returns the next address from the resolver.
///
Expand All @@ -40,7 +40,7 @@ interface ip-name-lookup {
/// - `name-unresolvable`: Name does not exist or has no suitable associated IP addresses. (EAI_NONAME, EAI_NODATA, EAI_ADDRFAMILY)
/// - `temporary-resolver-failure`: A temporary failure in name resolution occurred. (EAI_AGAIN)
/// - `permanent-resolver-failure`: A permanent failure in name resolution occurred. (EAI_FAIL)
@since(version = 0.2.0)
@since(version = 0.3.0
resolve-next-address: func() -> result<option<ip-address>, error-code>;
}
}
20 changes: 10 additions & 10 deletions wit-0.3.0-draft/network.wit
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
@since(version = 0.2.0)
@since(version = 0.3.0
interface network {
/// An opaque resource that represents access to (a subset of) the network.
/// This enables context-based security for networking.
/// There is no need for this to map 1:1 to a physical network interface.
@since(version = 0.2.0)
@since(version = 0.3.0
resource network;

/// Error codes.
Expand All @@ -18,7 +18,7 @@ interface network {
/// - `concurrency-conflict`
///
/// See each individual API for what the POSIX equivalents are. They sometimes differ per API.
@since(version = 0.2.0)
@since(version = 0.3.0
enum error-code {
/// Unknown error
unknown,
Expand Down Expand Up @@ -92,7 +92,7 @@ interface network {
permanent-resolver-failure,
}

@since(version = 0.2.0)
@since(version = 0.3.0
enum ip-address-family {
/// Similar to `AF_INET` in POSIX.
ipv4,
Expand All @@ -101,26 +101,26 @@ interface network {
ipv6,
}

@since(version = 0.2.0)
@since(version = 0.3.0
type ipv4-address = tuple<u8, u8, u8, u8>;
@since(version = 0.2.0)
@since(version = 0.3.0
type ipv6-address = tuple<u16, u16, u16, u16, u16, u16, u16, u16>;

@since(version = 0.2.0)
@since(version = 0.3.0
variant ip-address {
ipv4(ipv4-address),
ipv6(ipv6-address),
}

@since(version = 0.2.0)
@since(version = 0.3.0
record ipv4-socket-address {
/// sin_port
port: u16,
/// sin_addr
address: ipv4-address,
}

@since(version = 0.2.0)
@since(version = 0.3.0
record ipv6-socket-address {
/// sin6_port
port: u16,
Expand All @@ -132,7 +132,7 @@ interface network {
scope-id: u32,
}

@since(version = 0.2.0)
@since(version = 0.3.0
variant ip-socket-address {
ipv4(ipv4-socket-address),
ipv6(ipv6-socket-address),
Expand Down
8 changes: 4 additions & 4 deletions wit-0.3.0-draft/tcp-create-socket.wit
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
@since(version = 0.2.0)
@since(version = 0.3.0
interface tcp-create-socket {
@since(version = 0.2.0)
@since(version = 0.3.0
use network.{network, error-code, ip-address-family};
@since(version = 0.2.0)
@since(version = 0.3.0
use tcp.{tcp-socket};

/// Create a new TCP socket.
Expand All @@ -25,6 +25,6 @@ interface tcp-create-socket {
/// - <https://man7.org/linux/man-pages/man2/socket.2.html>
/// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsasocketw>
/// - <https://man.freebsd.org/cgi/man.cgi?query=socket&sektion=2>
@since(version = 0.2.0)
@since(version = 0.3.0
create-tcp-socket: func(address-family: ip-address-family) -> result<tcp-socket, error-code>;
}
50 changes: 25 additions & 25 deletions wit-0.3.0-draft/tcp.wit
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
@since(version = 0.2.0)
@since(version = 0.3.0
interface tcp {
@since(version = 0.2.0)
@since(version = 0.3.0
use wasi:clocks/monotonic-clock@0.3.0.{duration};
@since(version = 0.2.0)
@since(version = 0.3.0
use network.{network, error-code, ip-socket-address, ip-address-family};

@since(version = 0.2.0)
@since(version = 0.3.0
enum shutdown-type {
/// Similar to `SHUT_RD` in POSIX.
receive,
Expand Down Expand Up @@ -38,7 +38,7 @@ interface tcp {
/// In addition to the general error codes documented on the
/// `network::error-code` type, TCP socket methods may always return
/// `error(invalid-state)` when in the `closed` state.
@since(version = 0.2.0)
@since(version = 0.3.0
resource tcp-socket {
/// Bind the socket to a specific network on the provided IP address and port.
///
Expand Down Expand Up @@ -183,7 +183,7 @@ interface tcp {
/// - <https://man7.org/linux/man-pages/man2/getsockname.2.html>
/// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-getsockname>
/// - <https://man.freebsd.org/cgi/man.cgi?getsockname>
@since(version = 0.2.0)
@since(version = 0.3.0
local-address: func() -> result<ip-socket-address, error-code>;

/// Get the remote address.
Expand All @@ -196,19 +196,19 @@ interface tcp {
/// - <https://man7.org/linux/man-pages/man2/getpeername.2.html>
/// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-getpeername>
/// - <https://man.freebsd.org/cgi/man.cgi?query=getpeername&sektion=2&n=1>
@since(version = 0.2.0)
@since(version = 0.3.0
remote-address: func() -> result<ip-socket-address, error-code>;

/// Whether the socket is in the `listening` state.
///
/// Equivalent to the SO_ACCEPTCONN socket option.
@since(version = 0.2.0)
@since(version = 0.3.0
is-listening: func() -> bool;

/// Whether this is a IPv4 or IPv6 socket.
///
/// Equivalent to the SO_DOMAIN socket option.
@since(version = 0.2.0)
@since(version = 0.3.0
address-family: func() -> ip-address-family;

/// Hints the desired listen queue size. Implementations are free to ignore this.
Expand All @@ -220,7 +220,7 @@ interface tcp {
/// - `not-supported`: (set) The platform does not support changing the backlog size after the initial listen.
/// - `invalid-argument`: (set) The provided value was 0.
/// - `invalid-state`: (set) The socket is in the `connect-in-progress` or `connected` state.
@since(version = 0.2.0)
@since(version = 0.3.0
set-listen-backlog-size: func(value: u64) -> result<_, error-code>;

/// Enables or disables keepalive.
Expand All @@ -232,9 +232,9 @@ interface tcp {
/// These properties can be configured while `keep-alive-enabled` is false, but only come into effect when `keep-alive-enabled` is true.
///
/// Equivalent to the SO_KEEPALIVE socket option.
@since(version = 0.2.0)
@since(version = 0.3.0
keep-alive-enabled: func() -> result<bool, error-code>;
@since(version = 0.2.0)
@since(version = 0.3.0
set-keep-alive-enabled: func(value: bool) -> result<_, error-code>;

/// Amount of time the connection has to be idle before TCP starts sending keepalive packets.
Expand All @@ -247,9 +247,9 @@ interface tcp {
///
/// # Typical errors
/// - `invalid-argument`: (set) The provided value was 0.
@since(version = 0.2.0)
@since(version = 0.3.0
keep-alive-idle-time: func() -> result<duration, error-code>;
@since(version = 0.2.0)
@since(version = 0.3.0
set-keep-alive-idle-time: func(value: duration) -> result<_, error-code>;

/// The time between keepalive packets.
Expand All @@ -262,9 +262,9 @@ interface tcp {
///
/// # Typical errors
/// - `invalid-argument`: (set) The provided value was 0.
@since(version = 0.2.0)
@since(version = 0.3.0
keep-alive-interval: func() -> result<duration, error-code>;
@since(version = 0.2.0)
@since(version = 0.3.0
set-keep-alive-interval: func(value: duration) -> result<_, error-code>;

/// The maximum amount of keepalive packets TCP should send before aborting the connection.
Expand All @@ -277,9 +277,9 @@ interface tcp {
///
/// # Typical errors
/// - `invalid-argument`: (set) The provided value was 0.
@since(version = 0.2.0)
@since(version = 0.3.0
keep-alive-count: func() -> result<u32, error-code>;
@since(version = 0.2.0)
@since(version = 0.3.0
set-keep-alive-count: func(value: u32) -> result<_, error-code>;

/// Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options.
Expand All @@ -288,9 +288,9 @@ interface tcp {
///
/// # Typical errors
/// - `invalid-argument`: (set) The TTL value must be 1 or higher.
@since(version = 0.2.0)
@since(version = 0.3.0
hop-limit: func() -> result<u8, error-code>;
@since(version = 0.2.0)
@since(version = 0.3.0
set-hop-limit: func(value: u8) -> result<_, error-code>;

/// The kernel buffer space reserved for sends/receives on this socket.
Expand All @@ -303,13 +303,13 @@ interface tcp {
///
/// # Typical errors
/// - `invalid-argument`: (set) The provided value was 0.
@since(version = 0.2.0)
@since(version = 0.3.0
receive-buffer-size: func() -> result<u64, error-code>;
@since(version = 0.2.0)
@since(version = 0.3.0
set-receive-buffer-size: func(value: u64) -> result<_, error-code>;
@since(version = 0.2.0)
@since(version = 0.3.0
send-buffer-size: func() -> result<u64, error-code>;
@since(version = 0.2.0)
@since(version = 0.3.0
set-send-buffer-size: func(value: u64) -> result<_, error-code>;

/// Initiate a graceful shutdown.
Expand All @@ -335,7 +335,7 @@ interface tcp {
/// - <https://man7.org/linux/man-pages/man2/shutdown.2.html>
/// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-shutdown>
/// - <https://man.freebsd.org/cgi/man.cgi?query=shutdown&sektion=2>
@since(version = 0.2.0)
@since(version = 0.3.0
shutdown: func(shutdown-type: shutdown-type) -> result<_, error-code>;
}
}
8 changes: 4 additions & 4 deletions wit-0.3.0-draft/udp-create-socket.wit
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
@since(version = 0.2.0)
@since(version = 0.3.0
interface udp-create-socket {
@since(version = 0.2.0)
@since(version = 0.3.0
use network.{network, error-code, ip-address-family};
@since(version = 0.2.0)
@since(version = 0.3.0
use udp.{udp-socket};

/// Create a new UDP socket.
Expand All @@ -25,6 +25,6 @@ interface udp-create-socket {
/// - <https://man7.org/linux/man-pages/man2/socket.2.html>
/// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsasocketw>
/// - <https://man.freebsd.org/cgi/man.cgi?query=socket&sektion=2>
@since(version = 0.2.0)
@since(version = 0.3.0
create-udp-socket: func(address-family: ip-address-family) -> result<udp-socket, error-code>;
}
28 changes: 14 additions & 14 deletions wit-0.3.0-draft/udp.wit
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
@since(version = 0.2.0)
@since(version = 0.3.0
interface udp {
@since(version = 0.2.0)
@since(version = 0.3.0
use network.{network, error-code, ip-socket-address, ip-address-family};

/// A received datagram.
@since(version = 0.2.0)
@since(version = 0.3.0
record incoming-datagram {
/// The payload.
///
Expand All @@ -20,7 +20,7 @@ interface udp {
}

/// A datagram to be sent out.
@since(version = 0.2.0)
@since(version = 0.3.0
record outgoing-datagram {
/// The payload.
data: list<u8>,
Expand All @@ -36,7 +36,7 @@ interface udp {
}

/// A UDP socket handle.
@since(version = 0.2.0)
@since(version = 0.3.0
resource udp-socket {
/// Bind the socket to a specific network on the provided IP address and port.
///
Expand Down Expand Up @@ -153,7 +153,7 @@ interface udp {
/// - <https://man7.org/linux/man-pages/man2/getsockname.2.html>
/// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-getsockname>
/// - <https://man.freebsd.org/cgi/man.cgi?getsockname>
@since(version = 0.2.0)
@since(version = 0.3.0
local-address: func() -> result<ip-socket-address, error-code>;

/// Get the address the socket is currently streaming to.
Expand All @@ -166,13 +166,13 @@ interface udp {
/// - <https://man7.org/linux/man-pages/man2/getpeername.2.html>
/// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-getpeername>
/// - <https://man.freebsd.org/cgi/man.cgi?query=getpeername&sektion=2&n=1>
@since(version = 0.2.0)
@since(version = 0.3.0
remote-address: func() -> result<ip-socket-address, error-code>;

/// Whether this is a IPv4 or IPv6 socket.
///
/// Equivalent to the SO_DOMAIN socket option.
@since(version = 0.2.0)
@since(version = 0.3.0
address-family: func() -> ip-address-family;

/// Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options.
Expand All @@ -181,9 +181,9 @@ interface udp {
///
/// # Typical errors
/// - `invalid-argument`: (set) The TTL value must be 1 or higher.
@since(version = 0.2.0)
@since(version = 0.3.0
unicast-hop-limit: func() -> result<u8, error-code>;
@since(version = 0.2.0)
@since(version = 0.3.0
set-unicast-hop-limit: func(value: u8) -> result<_, error-code>;

/// The kernel buffer space reserved for sends/receives on this socket.
Expand All @@ -196,13 +196,13 @@ interface udp {
///
/// # Typical errors
/// - `invalid-argument`: (set) The provided value was 0.
@since(version = 0.2.0)
@since(version = 0.3.0
receive-buffer-size: func() -> result<u64, error-code>;
@since(version = 0.2.0)
@since(version = 0.3.0
set-receive-buffer-size: func(value: u64) -> result<_, error-code>;
@since(version = 0.2.0)
@since(version = 0.3.0
send-buffer-size: func() -> result<u64, error-code>;
@since(version = 0.2.0)
@since(version = 0.3.0
set-send-buffer-size: func(value: u64) -> result<_, error-code>;
}
}
Loading

0 comments on commit dfc429e

Please sign in to comment.