1- @since (version = 0.2.0 )
1+ @since (version = 0.3.0
22interface tcp {
3- @since (version = 0.2.0 )
3+ @since(version = 0.3.0
44 use wasi:clocks/
[email protected] .{duration};
5- @since (version = 0.2.0 )
5+ @since(version = 0.3.0
66 use network.{network, error-code, ip-socket-address, ip-address-family};
77
8- @since (version = 0.2.0 )
8+ @since(version = 0.3.0
99 enum shutdown-type {
1010 /// Similar to `SHUT_RD` in POSIX.
1111 receive,
@@ -38,7 +38,7 @@ interface tcp {
3838 /// In addition to the general error codes documented on the
3939 /// `network::error-code` type, TCP socket methods may always return
4040 /// `error(invalid-state)` when in the `closed` state.
41- @since (version = 0.2.0 )
41+ @since(version = 0.3.0
4242 resource tcp-socket {
4343 /// Bind the socket to a specific network on the provided IP address and port.
4444 ///
@@ -183,7 +183,7 @@ interface tcp {
183183 /// - <https://man7.org/linux/man-pages/man2/getsockname.2.html>
184184 /// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-getsockname>
185185 /// - <https://man.freebsd.org/cgi/man.cgi?getsockname>
186- @since (version = 0.2.0 )
186+ @since (version = 0.3.0
187187 local-address: func() -> result<ip-socket-address, error-code>;
188188
189189 /// Get the remote address.
@@ -196,19 +196,19 @@ interface tcp {
196196 /// - <https://man7.org/linux/man-pages/man2/getpeername.2.html>
197197 /// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-getpeername>
198198 /// - <https://man.freebsd.org/cgi/man.cgi?query=getpeername&sektion=2&n=1>
199- @since (version = 0.2.0 )
199+ @since (version = 0.3.0
200200 remote-address: func() -> result<ip-socket-address, error-code>;
201201
202202 /// Whether the socket is in the `listening` state.
203203 ///
204204 /// Equivalent to the SO_ACCEPTCONN socket option.
205- @since (version = 0.2.0 )
205+ @since (version = 0.3.0
206206 is-listening: func() -> bool;
207207
208208 /// Whether this is a IPv4 or IPv6 socket.
209209 ///
210210 /// Equivalent to the SO_DOMAIN socket option.
211- @since (version = 0.2.0 )
211+ @since (version = 0.3.0
212212 address-family: func() -> ip-address-family;
213213
214214 /// Hints the desired listen queue size. Implementations are free to ignore this.
@@ -220,7 +220,7 @@ interface tcp {
220220 /// - `not-supported` : (set) The platform does not support changing the backlog size after the initial listen.
221221 /// - `invalid-argument` : (set) The provided value was 0.
222222 /// - `invalid-state` : (set) The socket is in the `connect-in-progress` or `connected` state.
223- @since (version = 0.2.0 )
223+ @since (version = 0.3.0
224224 set-listen-backlog-size: func(value: u64) -> result<_, error-code>;
225225
226226 /// Enables or disables keepalive.
@@ -232,9 +232,9 @@ interface tcp {
232232 /// These properties can be configured while `keep-alive-enabled` is false, but only come into effect when `keep-alive-enabled` is true.
233233 ///
234234 /// Equivalent to the SO_KEEPALIVE socket option.
235- @since (version = 0.2.0 )
235+ @since (version = 0.3.0
236236 keep-alive-enabled: func() -> result<bool, error-code>;
237- @since (version = 0.2.0 )
237+ @since (version = 0.3.0
238238 set-keep-alive-enabled: func(value: bool) -> result<_, error-code>;
239239
240240 /// Amount of time the connection has to be idle before TCP starts sending keepalive packets.
@@ -247,9 +247,9 @@ interface tcp {
247247 ///
248248 /// # Typical errors
249249 /// - `invalid-argument` : (set) The provided value was 0.
250- @since (version = 0.2.0 )
250+ @since (version = 0.3.0
251251 keep-alive-idle-time: func() -> result<duration, error-code>;
252- @since (version = 0.2.0 )
252+ @since (version = 0.3.0
253253 set-keep-alive-idle-time: func(value: duration) -> result<_, error-code>;
254254
255255 /// The time between keepalive packets.
@@ -262,9 +262,9 @@ interface tcp {
262262 ///
263263 /// # Typical errors
264264 /// - `invalid-argument` : (set) The provided value was 0.
265- @since (version = 0.2.0 )
265+ @since (version = 0.3.0
266266 keep-alive-interval: func() -> result<duration, error-code>;
267- @since (version = 0.2.0 )
267+ @since (version = 0.3.0
268268 set-keep-alive-interval: func(value: duration) -> result<_, error-code>;
269269
270270 /// The maximum amount of keepalive packets TCP should send before aborting the connection.
@@ -277,9 +277,9 @@ interface tcp {
277277 ///
278278 /// # Typical errors
279279 /// - `invalid-argument` : (set) The provided value was 0.
280- @since (version = 0.2.0 )
280+ @since (version = 0.3.0
281281 keep-alive-count: func() -> result<u32, error-code>;
282- @since (version = 0.2.0 )
282+ @since (version = 0.3.0
283283 set-keep-alive-count: func(value: u32) -> result<_, error-code>;
284284
285285 /// Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options.
@@ -288,9 +288,9 @@ interface tcp {
288288 ///
289289 /// # Typical errors
290290 /// - `invalid-argument` : (set) The TTL value must be 1 or higher.
291- @since (version = 0.2.0 )
291+ @since (version = 0.3.0
292292 hop-limit: func() -> result<u8, error-code>;
293- @since (version = 0.2.0 )
293+ @since (version = 0.3.0
294294 set-hop-limit: func(value: u8) -> result<_, error-code>;
295295
296296 /// The kernel buffer space reserved for sends/receives on this socket.
@@ -303,13 +303,13 @@ interface tcp {
303303 ///
304304 /// # Typical errors
305305 /// - `invalid-argument` : (set) The provided value was 0.
306- @since (version = 0.2.0 )
306+ @since (version = 0.3.0
307307 receive-buffer-size: func() -> result<u64, error-code>;
308- @since (version = 0.2.0 )
308+ @since (version = 0.3.0
309309 set-receive-buffer-size: func(value: u64) -> result<_, error-code>;
310- @since (version = 0.2.0 )
310+ @since (version = 0.3.0
311311 send-buffer-size: func() -> result<u64, error-code>;
312- @since (version = 0.2.0 )
312+ @since (version = 0.3.0
313313 set-send-buffer-size: func(value: u64) -> result<_, error-code>;
314314
315315 /// Initiate a graceful shutdown.
@@ -335,7 +335,7 @@ interface tcp {
335335 /// - <https://man7.org/linux/man-pages/man2/shutdown.2.html>
336336 /// - <https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-shutdown>
337337 /// - <https://man.freebsd.org/cgi/man.cgi?query=shutdown&sektion=2>
338- @since (version = 0.2.0 )
338+ @since (version = 0.3.0
339339 shutdown: func(shutdown-type: shutdown-type) -> result<_, error-code>;
340340 }
341341}
0 commit comments