@bytecodealliance/preview2-shim 0.0.17 → 0.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,13 @@
1
1
  export namespace WasiIoStreams {
2
+ /**
3
+ * Returns a string that's suitable to assist humans in debugging this
4
+ * error.
5
+ *
6
+ * The returned string will change across platforms and hosts which
7
+ * means that parsing it, for example, would be a
8
+ * platform-compatibility hazard.
9
+ */
10
+ export { Error };
2
11
  /**
3
12
  * Perform a non-blocking read from the stream.
4
13
  *
@@ -7,8 +16,8 @@ export namespace WasiIoStreams {
7
16
  * reads are expected to produce data. The returned list will contain up to
8
17
  * `len` bytes; it may return fewer than requested, but not more. An
9
18
  * empty list and `stream-status:open` indicates no more data is
10
- * available at this time, and that the pollable given by
11
- * `subscribe-to-input-stream` will be ready when more data is available.
19
+ * available at this time, and that the pollable given by `subscribe`
20
+ * will be ready when more data is available.
12
21
  *
13
22
  * Once a stream has reached the end, subsequent calls to `read` or
14
23
  * `skip` will always report `stream-status:ended` rather than producing more
@@ -23,12 +32,11 @@ export namespace WasiIoStreams {
23
32
  * as a return value by the callee. The callee may return a list of bytes
24
33
  * less than `len` in size while more bytes are available for reading.
25
34
  */
26
- export function read(this_: InputStream, len: bigint): [Uint8Array, StreamStatus];
35
+ export { InputStream };
27
36
  /**
28
37
  * Read bytes from a stream, after blocking until at least one byte can
29
38
  * be read. Except for blocking, identical to `read`.
30
39
  */
31
- export function blockingRead(this_: InputStream, len: bigint): [Uint8Array, StreamStatus];
32
40
  /**
33
41
  * Skip bytes from a stream.
34
42
  *
@@ -43,12 +51,10 @@ export namespace WasiIoStreams {
43
51
  * `stream-status` indicating whether the end of the stream was
44
52
  * reached. The returned value will be at most `len`; it may be less.
45
53
  */
46
- export function skip(this_: InputStream, len: bigint): [bigint, StreamStatus];
47
54
  /**
48
55
  * Skip bytes from a stream, after blocking until at least one byte
49
56
  * can be skipped. Except for blocking behavior, identical to `skip`.
50
57
  */
51
- export function blockingSkip(this_: InputStream, len: bigint): [bigint, StreamStatus];
52
58
  /**
53
59
  * Create a `pollable` which will resolve once either the specified stream
54
60
  * has bytes available to read or the other end of the stream has been
@@ -57,16 +63,6 @@ export namespace WasiIoStreams {
57
63
  * Implementations may trap if the `input-stream` is dropped before
58
64
  * all derived `pollable`s created with this function are dropped.
59
65
  */
60
- export function subscribeToInputStream(this_: InputStream): Pollable;
61
- /**
62
- * Dispose of the specified `input-stream`, after which it may no longer
63
- * be used.
64
- * Implementations may trap if this `input-stream` is dropped while child
65
- * `pollable` resources are still alive.
66
- * After this `input-stream` is dropped, implementations may report any
67
- * corresponding `output-stream` has `stream-state.closed`.
68
- */
69
- export function dropInputStream(this_: InputStream): void;
70
66
  /**
71
67
  * Check readiness for writing. This function never blocks.
72
68
  *
@@ -74,11 +70,11 @@ export namespace WasiIoStreams {
74
70
  * or an error. Calling `write` with more bytes than this function has
75
71
  * permitted will trap.
76
72
  *
77
- * When this function returns 0 bytes, the `subscribe-to-output-stream`
78
- * pollable will become ready when this function will report at least
79
- * 1 byte, or an error.
73
+ * When this function returns 0 bytes, the `subscribe` pollable will
74
+ * become ready when this function will report at least 1 byte, or an
75
+ * error.
80
76
  */
81
- export function checkWrite(this_: OutputStream): bigint;
77
+ export { OutputStream };
82
78
  /**
83
79
  * Perform a write. This function never blocks.
84
80
  *
@@ -88,34 +84,32 @@ export namespace WasiIoStreams {
88
84
  * returns Err(closed) without writing if the stream has closed since
89
85
  * the last call to check-write provided a permit.
90
86
  */
91
- export function write(this_: OutputStream, contents: Uint8Array): void;
92
87
  /**
93
88
  * Perform a write of up to 4096 bytes, and then flush the stream. Block
94
89
  * until all of these operations are complete, or an error occurs.
95
90
  *
96
91
  * This is a convenience wrapper around the use of `check-write`,
97
- * `subscribe-to-output-stream`, `write`, and `flush`, and is implemented
98
- * with the following pseudo-code:
92
+ * `subscribe`, `write`, and `flush`, and is implemented with the
93
+ * following pseudo-code:
99
94
  *
100
95
  * ```text
101
- * let pollable = subscribe-to-output-stream(this);
96
+ * let pollable = this.subscribe();
102
97
  * while !contents.is_empty() {
103
98
  * // Wait for the stream to become writable
104
- * poll-oneoff(pollable);
105
- * let Ok(n) = check-write(this); // eliding error handling
99
+ * poll-one(pollable);
100
+ * let Ok(n) = this.check-write(); // eliding error handling
106
101
  * let len = min(n, contents.len());
107
102
  * let (chunk, rest) = contents.split_at(len);
108
- * write(this, chunk); // eliding error handling
103
+ * this.write(chunk ); // eliding error handling
109
104
  * contents = rest;
110
105
  * }
111
- * flush(this);
106
+ * this.flush();
112
107
  * // Wait for completion of `flush`
113
- * poll-oneoff(pollable);
108
+ * poll-one(pollable);
114
109
  * // Check for any errors that arose during `flush`
115
- * let _ = check-write(this); // eliding error handling
110
+ * let _ = this.check-write(); // eliding error handling
116
111
  * ```
117
112
  */
118
- export function blockingWriteAndFlush(this_: OutputStream, contents: Uint8Array): void;
119
113
  /**
120
114
  * Request to flush buffered output. This function never blocks.
121
115
  *
@@ -125,15 +119,13 @@ export namespace WasiIoStreams {
125
119
  *
126
120
  * Upon calling this function, the `output-stream` will not accept any
127
121
  * writes (`check-write` will return `ok(0)`) until the flush has
128
- * completed. The `subscribe-to-output-stream` pollable will become ready
129
- * when the flush has completed and the stream can accept more writes.
122
+ * completed. The `subscribe` pollable will become ready when the
123
+ * flush has completed and the stream can accept more writes.
130
124
  */
131
- export function flush(this_: OutputStream): void;
132
125
  /**
133
126
  * Request to flush buffered output, and block until flush completes
134
127
  * and stream is ready for writing again.
135
128
  */
136
- export function blockingFlush(this_: OutputStream): void;
137
129
  /**
138
130
  * Create a `pollable` which will resolve once the output-stream
139
131
  * is ready for more writing, or an error has occured. When this
@@ -146,7 +138,6 @@ export namespace WasiIoStreams {
146
138
  * Implementations may trap if the `output-stream` is dropped before
147
139
  * all derived `pollable`s created with this function are dropped.
148
140
  */
149
- export function subscribeToOutputStream(this_: OutputStream): Pollable;
150
141
  /**
151
142
  * Write zeroes to a stream.
152
143
  *
@@ -155,120 +146,109 @@ export namespace WasiIoStreams {
155
146
  * passing a list of bytes, you simply pass the number of zero-bytes
156
147
  * that should be written.
157
148
  */
158
- export function writeZeroes(this_: OutputStream, len: bigint): void;
159
149
  /**
160
- * Read from one stream and write to another.
150
+ * Perform a write of up to 4096 zeroes, and then flush the stream.
151
+ * Block until all of these operations are complete, or an error
152
+ * occurs.
161
153
  *
162
- * This function returns the number of bytes transferred; it may be less
163
- * than `len`.
154
+ * This is a convenience wrapper around the use of `check-write`,
155
+ * `subscribe`, `write-zeroes`, and `flush`, and is implemented with
156
+ * the following pseudo-code:
164
157
  *
165
- * Unlike other I/O functions, this function blocks until all the data
166
- * read from the input stream has been written to the output stream.
167
- */
168
- export function splice(this_: OutputStream, src: InputStream, len: bigint): [bigint, StreamStatus];
158
+ * ```text
159
+ * let pollable = this.subscribe();
160
+ * while num_zeroes != 0 {
161
+ * // Wait for the stream to become writable
162
+ * poll-one(pollable);
163
+ * let Ok(n) = this.check-write(); // eliding error handling
164
+ * let len = min(n, num_zeroes);
165
+ * this.write-zeroes(len); // eliding error handling
166
+ * num_zeroes -= len;
167
+ * }
168
+ * this.flush();
169
+ * // Wait for completion of `flush`
170
+ * poll-one(pollable);
171
+ * // Check for any errors that arose during `flush`
172
+ * let _ = this.check-write(); // eliding error handling
173
+ * ```
174
+ */
175
+ /**
176
+ * Read from one stream and write to another.
177
+ *
178
+ * This function returns the number of bytes transferred; it may be less
179
+ * than `len`.
180
+ *
181
+ * Unlike other I/O functions, this function blocks until all the data
182
+ * read from the input stream has been written to the output stream.
183
+ */
184
+ /**
185
+ * Read from one stream and write to another, with blocking.
186
+ *
187
+ * This is similar to `splice`, except that it blocks until at least
188
+ * one byte can be read.
189
+ */
190
+ /**
191
+ * Forward the entire contents of an input stream to an output stream.
192
+ *
193
+ * This function repeatedly reads from the input stream and writes
194
+ * the data to the output stream, until the end of the input stream
195
+ * is reached, or an error is encountered.
196
+ *
197
+ * Unlike other I/O functions, this function blocks until the end
198
+ * of the input stream is seen and all the data has been written to
199
+ * the output stream.
200
+ *
201
+ * This function returns the number of bytes transferred, and the status of
202
+ * the output stream.
203
+ */
204
+ }
205
+ import type { Pollable } from '../interfaces/wasi-io-poll';
206
+ export { Pollable };
169
207
  /**
170
- * Read from one stream and write to another, with blocking.
171
- *
172
- * This is similar to `splice`, except that it blocks until at least
173
- * one byte can be read.
208
+ * An error for input-stream and output-stream operations.
174
209
  */
175
- export function blockingSplice(this_: OutputStream, src: InputStream, len: bigint): [bigint, StreamStatus];
210
+ export type StreamError = StreamErrorLastOperationFailed | StreamErrorClosed;
176
211
  /**
177
- * Forward the entire contents of an input stream to an output stream.
178
- *
179
- * This function repeatedly reads from the input stream and writes
180
- * the data to the output stream, until the end of the input stream
181
- * is reached, or an error is encountered.
212
+ * The last operation (a write or flush) failed before completion.
182
213
  *
183
- * Unlike other I/O functions, this function blocks until the end
184
- * of the input stream is seen and all the data has been written to
185
- * the output stream.
186
- *
187
- * This function returns the number of bytes transferred, and the status of
188
- * the output stream.
214
+ * More information is available in the `error` payload.
189
215
  */
190
- export function forward(this_: OutputStream, src: InputStream): [bigint, StreamStatus];
216
+ export interface StreamErrorLastOperationFailed {
217
+ tag: 'last-operation-failed',
218
+ val: Error,
219
+ }
191
220
  /**
192
- * Dispose of the specified `output-stream`, after which it may no longer
193
- * be used.
194
- * Implementations may trap if this `output-stream` is dropped while
195
- * child `pollable` resources are still alive.
196
- * After this `output-stream` is dropped, implementations may report any
197
- * corresponding `input-stream` has `stream-state.closed`.
221
+ * The stream is closed: no more input will be accepted by the
222
+ * stream. A closed output-stream will return this error on all
223
+ * future operations.
198
224
  */
199
- export function dropOutputStream(this_: OutputStream): void;
200
- }
201
- import type { Pollable } from '../interfaces/wasi-poll-poll';
202
- export { Pollable };
203
- /**
204
- * Streams provide a sequence of data and then end; once they end, they
205
- * no longer provide any further data.
206
- *
207
- * For example, a stream reading from a file ends when the stream reaches
208
- * the end of the file. For another example, a stream reading from a
209
- * socket ends when the socket is closed.
210
- * # Variants
211
- *
212
- * ## `"open"`
213
- *
214
- * The stream is open and may produce further data.
215
- * ## `"ended"`
216
- *
217
- * When reading, this indicates that the stream will not produce
218
- * further data.
219
- * When writing, this indicates that the stream will no longer be read.
220
- * Further writes are still permitted.
221
- */
222
- export type StreamStatus = 'open' | 'ended';
223
- /**
224
- * An input bytestream. In the future, this will be replaced by handle
225
- * types.
226
- *
227
- * `input-stream`s are *non-blocking* to the extent practical on underlying
228
- * platforms. I/O operations always return promptly; if fewer bytes are
229
- * promptly available than requested, they return the number of bytes promptly
230
- * available, which could even be zero. To wait for data to be available,
231
- * use the `subscribe-to-input-stream` function to obtain a `pollable` which
232
- * can be polled for using `wasi:poll/poll.poll_oneoff`.
233
- *
234
- * And at present, it is a `u32` instead of being an actual handle, until
235
- * the wit-bindgen implementation of handles and resources is ready.
236
- *
237
- * This [represents a resource](https://github.com/WebAssembly/WASI/blob/main/docs/WitInWasi.md#Resources).
238
- */
239
- export type InputStream = number;
240
- /**
241
- * An output bytestream. In the future, this will be replaced by handle
242
- * types.
243
- *
244
- * `output-stream`s are *non-blocking* to the extent practical on
245
- * underlying platforms. Except where specified otherwise, I/O operations also
246
- * always return promptly, after the number of bytes that can be written
247
- * promptly, which could even be zero. To wait for the stream to be ready to
248
- * accept data, the `subscribe-to-output-stream` function to obtain a
249
- * `pollable` which can be polled for using `wasi:poll`.
250
- *
251
- * And at present, it is a `u32` instead of being an actual handle, until
252
- * the wit-bindgen implementation of handles and resources is ready.
253
- *
254
- * This [represents a resource](https://github.com/WebAssembly/WASI/blob/main/docs/WitInWasi.md#Resources).
255
- */
256
- export type OutputStream = number;
257
- /**
258
- * An error for output-stream operations.
259
- *
260
- * Contrary to input-streams, a closed output-stream is reported using
261
- * an error.
262
- * # Variants
263
- *
264
- * ## `"last-operation-failed"`
265
- *
266
- * The last operation (a write or flush) failed before completion.
267
- * ## `"closed"`
268
- *
269
- * The stream is closed: no more input will be accepted by the
270
- * stream. A closed output-stream will return this error on all
271
- * future operations.
272
- */
273
- export type WriteError = 'last-operation-failed' | 'closed';
274
-
225
+ export interface StreamErrorClosed {
226
+ tag: 'closed',
227
+ }
228
+
229
+ export class OutputStream {
230
+ checkWrite(): bigint;
231
+ write(contents: Uint8Array): void;
232
+ blockingWriteAndFlush(contents: Uint8Array): void;
233
+ flush(): void;
234
+ blockingFlush(): void;
235
+ subscribe(): Pollable;
236
+ writeZeroes(len: bigint): void;
237
+ blockingWriteZeroesAndFlush(len: bigint): void;
238
+ splice(src: InputStream, len: bigint): bigint;
239
+ blockingSplice(src: InputStream, len: bigint): bigint;
240
+ forward(src: InputStream): bigint;
241
+ }
242
+
243
+ export class Error {
244
+ toDebugString(): string;
245
+ }
246
+
247
+ export class InputStream {
248
+ read(len: bigint): Uint8Array;
249
+ blockingRead(len: bigint): Uint8Array;
250
+ skip(len: bigint): bigint;
251
+ blockingSkip(len: bigint): bigint;
252
+ subscribe(): Pollable;
253
+ }
254
+
@@ -1,22 +1,24 @@
1
1
  export namespace WasiRandomRandom {
2
2
  /**
3
- * Return `len` cryptographically-secure pseudo-random bytes.
3
+ * Return `len` cryptographically-secure random or pseudo-random bytes.
4
4
  *
5
- * This function must produce data from an adequately seeded
6
- * cryptographically-secure pseudo-random number generator (CSPRNG), so it
7
- * must not block, from the perspective of the calling program, and the
8
- * returned data is always unpredictable.
5
+ * This function must produce data at least as cryptographically secure and
6
+ * fast as an adequately seeded cryptographically-secure pseudo-random
7
+ * number generator (CSPRNG). It must not block, from the perspective of
8
+ * the calling program, under any circumstances, including on the first
9
+ * request and on requests for numbers of bytes. The returned data must
10
+ * always be unpredictable.
9
11
  *
10
- * This function must always return fresh pseudo-random data. Deterministic
11
- * environments must omit this function, rather than implementing it with
12
- * deterministic data.
12
+ * This function must always return fresh data. Deterministic environments
13
+ * must omit this function, rather than implementing it with deterministic
14
+ * data.
13
15
  */
14
16
  export function getRandomBytes(len: bigint): Uint8Array;
15
17
  /**
16
- * Return a cryptographically-secure pseudo-random `u64` value.
18
+ * Return a cryptographically-secure random or pseudo-random `u64` value.
17
19
  *
18
- * This function returns the same type of pseudo-random data as
19
- * `get-random-bytes`, represented as a `u64`.
20
+ * This function returns the same type of data as `get-random-bytes`,
21
+ * represented as a `u64`.
20
22
  */
21
23
  export function getRandomU64(): bigint;
22
24
  }
@@ -21,9 +21,9 @@ export namespace WasiSocketsIpNameLookup {
21
21
  * to `resolve-next-address` never returns `ok(none)`. This may change in the future.
22
22
  *
23
23
  * # Typical errors
24
- * - `invalid-name`: `name` is a syntactically invalid domain name.
25
- * - `invalid-name`: `name` is an IP address.
26
- * - `address-family-not-supported`: The specified `address-family` is not supported. (EAI_FAMILY)
24
+ * - `invalid-argument`: `name` is a syntactically invalid domain name.
25
+ * - `invalid-argument`: `name` is an IP address.
26
+ * - `not-supported`: The specified `address-family` is not supported. (EAI_FAMILY)
27
27
  *
28
28
  * # References:
29
29
  * - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getaddrinfo.html>
@@ -38,7 +38,6 @@ export namespace WasiSocketsIpNameLookup {
38
38
  * This function should be called multiple times. On each call, it will
39
39
  * return the next address in connection order preference. If all
40
40
  * addresses have been exhausted, this function returns `none`.
41
- * After which, you should release the stream with `drop-resolve-address-stream`.
42
41
  *
43
42
  * This function never returns IPv4-mapped IPv6 addresses.
44
43
  *
@@ -48,22 +47,15 @@ export namespace WasiSocketsIpNameLookup {
48
47
  * - `permanent-resolver-failure`: A permanent failure in name resolution occurred. (EAI_FAIL)
49
48
  * - `would-block`: A result is not available yet. (EWOULDBLOCK, EAGAIN)
50
49
  */
51
- export function resolveNextAddress(this_: ResolveAddressStream): IpAddress | undefined;
52
- /**
53
- * Dispose of the specified `resolve-address-stream`, after which it may no longer be used.
54
- *
55
- * Note: this function is scheduled to be removed when Resources are natively supported in Wit.
56
- */
57
- export function dropResolveAddressStream(this_: ResolveAddressStream): void;
50
+ export { ResolveAddressStream };
58
51
  /**
59
52
  * Create a `pollable` which will resolve once the stream is ready for I/O.
60
53
  *
61
54
  * Note: this function is here for WASI Preview2 only.
62
55
  * It's planned to be removed when `future` is natively supported in Preview3.
63
56
  */
64
- export function subscribe(this_: ResolveAddressStream): Pollable;
65
57
  }
66
- import type { Pollable } from '../interfaces/wasi-poll-poll';
58
+ import type { Pollable } from '../interfaces/wasi-io-poll';
67
59
  export { Pollable };
68
60
  import type { Network } from '../interfaces/wasi-sockets-network';
69
61
  export { Network };
@@ -73,4 +65,8 @@ import type { IpAddress } from '../interfaces/wasi-sockets-network';
73
65
  export { IpAddress };
74
66
  import type { IpAddressFamily } from '../interfaces/wasi-sockets-network';
75
67
  export { IpAddressFamily };
76
- export type ResolveAddressStream = number;
68
+
69
+ export class ResolveAddressStream {
70
+ resolveNextAddress(): IpAddress | undefined;
71
+ subscribe(): Pollable;
72
+ }
@@ -1,19 +1,5 @@
1
1
  export namespace WasiSocketsNetwork {
2
- /**
3
- * Dispose of the specified `network`, after which it may no longer be used.
4
- *
5
- * Note: this function is scheduled to be removed when Resources are natively supported in Wit.
6
- */
7
- export function dropNetwork(this_: Network): void;
8
2
  }
9
- /**
10
- * An opaque resource that represents access to (a subset of) the network.
11
- * This enables context-based security for networking.
12
- * There is no need for this to map 1:1 to a physical network interface.
13
- *
14
- * FYI, In the future this will be replaced by handle types.
15
- */
16
- export type Network = number;
17
3
  /**
18
4
  * Error codes.
19
5
  *
@@ -24,6 +10,7 @@ export type Network = number;
24
10
  * - `access-denied`
25
11
  * - `not-supported`
26
12
  * - `out-of-memory`
13
+ * - `concurrency-conflict`
27
14
  *
28
15
  * See each individual API for what the POSIX equivalents are. They sometimes differ per API.
29
16
  * # Variants
@@ -41,6 +28,11 @@ export type Network = number;
41
28
  * The operation is not supported.
42
29
  *
43
30
  * POSIX equivalent: EOPNOTSUPP
31
+ * ## `"invalid-argument"`
32
+ *
33
+ * One of the arguments is invalid.
34
+ *
35
+ * POSIX equivalent: EINVAL
44
36
  * ## `"out-of-memory"`
45
37
  *
46
38
  * Not enough memory to complete the operation.
@@ -52,6 +44,8 @@ export type Network = number;
52
44
  * ## `"concurrency-conflict"`
53
45
  *
54
46
  * This operation is incompatible with another asynchronous operation that is already in progress.
47
+ *
48
+ * POSIX equivalent: EALREADY
55
49
  * ## `"not-in-progress"`
56
50
  *
57
51
  * Trying to finish an asynchronous operation that:
@@ -64,68 +58,32 @@ export type Network = number;
64
58
  * The operation has been aborted because it could not be completed immediately.
65
59
  *
66
60
  * Note: this is scheduled to be removed when `future`s are natively supported.
67
- * ## `"address-family-not-supported"`
68
- *
69
- * The specified address-family is not supported.
70
- * ## `"address-family-mismatch"`
71
- *
72
- * An IPv4 address was passed to an IPv6 resource, or vice versa.
73
- * ## `"invalid-remote-address"`
74
- *
75
- * The socket address is not a valid remote address. E.g. the IP address is set to INADDR_ANY, or the port is set to 0.
76
- * ## `"ipv4-only-operation"`
77
- *
78
- * The operation is only supported on IPv4 resources.
79
- * ## `"ipv6-only-operation"`
61
+ * ## `"invalid-state"`
80
62
  *
81
- * The operation is only supported on IPv6 resources.
63
+ * The operation is not valid in the socket's current state.
82
64
  * ## `"new-socket-limit"`
83
65
  *
84
66
  * A new socket resource could not be created because of a system limit.
85
- * ## `"already-attached"`
86
- *
87
- * The socket is already attached to another network.
88
- * ## `"already-bound"`
89
- *
90
- * The socket is already bound.
91
- * ## `"already-connected"`
92
- *
93
- * The socket is already in the Connection state.
94
- * ## `"not-bound"`
95
- *
96
- * The socket is not bound to any local address.
97
- * ## `"not-connected"`
98
- *
99
- * The socket is not in the Connection state.
100
67
  * ## `"address-not-bindable"`
101
68
  *
102
69
  * A bind operation failed because the provided address is not an address that the `network` can bind to.
103
70
  * ## `"address-in-use"`
104
71
  *
105
- * A bind operation failed because the provided address is already in use.
106
- * ## `"ephemeral-ports-exhausted"`
107
- *
108
- * A bind operation failed because there are no ephemeral ports available.
72
+ * A bind operation failed because the provided address is already in use or because there are no ephemeral ports available.
109
73
  * ## `"remote-unreachable"`
110
74
  *
111
75
  * The remote address is not reachable
112
- * ## `"already-listening"`
113
- *
114
- * The socket is already in the Listener state.
115
- * ## `"not-listening"`
116
- *
117
- * The socket is already in the Listener state.
118
76
  * ## `"connection-refused"`
119
77
  *
120
78
  * The connection was forcefully rejected
121
79
  * ## `"connection-reset"`
122
80
  *
123
81
  * The connection was reset.
124
- * ## `"datagram-too-large"`
82
+ * ## `"connection-aborted"`
125
83
  *
126
- * ## `"invalid-name"`
84
+ * A connection was aborted.
85
+ * ## `"datagram-too-large"`
127
86
  *
128
- * The provided name is a syntactically invalid domain name.
129
87
  * ## `"name-unresolvable"`
130
88
  *
131
89
  * Name does not exist or has no suitable associated IP addresses.
@@ -136,7 +94,7 @@ export type Network = number;
136
94
  *
137
95
  * A permanent failure in name resolution occurred.
138
96
  */
139
- export type ErrorCode = 'unknown' | 'access-denied' | 'not-supported' | 'out-of-memory' | 'timeout' | 'concurrency-conflict' | 'not-in-progress' | 'would-block' | 'address-family-not-supported' | 'address-family-mismatch' | 'invalid-remote-address' | 'ipv4-only-operation' | 'ipv6-only-operation' | 'new-socket-limit' | 'already-attached' | 'already-bound' | 'already-connected' | 'not-bound' | 'not-connected' | 'address-not-bindable' | 'address-in-use' | 'ephemeral-ports-exhausted' | 'remote-unreachable' | 'already-listening' | 'not-listening' | 'connection-refused' | 'connection-reset' | 'datagram-too-large' | 'invalid-name' | 'name-unresolvable' | 'temporary-resolver-failure' | 'permanent-resolver-failure';
97
+ export type ErrorCode = 'unknown' | 'access-denied' | 'not-supported' | 'invalid-argument' | 'out-of-memory' | 'timeout' | 'concurrency-conflict' | 'not-in-progress' | 'would-block' | 'invalid-state' | 'new-socket-limit' | 'address-not-bindable' | 'address-in-use' | 'remote-unreachable' | 'connection-refused' | 'connection-reset' | 'connection-aborted' | 'datagram-too-large' | 'name-unresolvable' | 'temporary-resolver-failure' | 'permanent-resolver-failure';
140
98
  /**
141
99
  * # Variants
142
100
  *
@@ -11,9 +11,8 @@ export namespace WasiSocketsTcpCreateSocket {
11
11
  * All sockets are non-blocking. Use the wasi-poll interface to block on asynchronous operations.
12
12
  *
13
13
  * # Typical errors
14
- * - `not-supported`: The host does not support TCP sockets. (EOPNOTSUPP)
15
- * - `address-family-not-supported`: The specified `address-family` is not supported. (EAFNOSUPPORT)
16
- * - `new-socket-limit`: The new socket resource could not be created because of a system limit. (EMFILE, ENFILE)
14
+ * - `not-supported`: The specified `address-family` is not supported. (EAFNOSUPPORT)
15
+ * - `new-socket-limit`: The new socket resource could not be created because of a system limit. (EMFILE, ENFILE)
17
16
  *
18
17
  * # References
19
18
  * - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/socket.html>