diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index de74cdd..690c26c 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -15,7 +15,7 @@ git submodule update --recursive --init Software that needs installing to work with this library: - Rust - ``` + ```sh curl -so rust.sh https://sh.rustup.rs && sh rust.sh -y restart shell or run source $HOME/.cargo/env ``` diff --git a/create-wit-bindings.sh b/create-wit-bindings.sh new file mode 100755 index 0000000..b4788e5 --- /dev/null +++ b/create-wit-bindings.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +~/.cargo/bin/wit-bindgen c --out-dir runtime/fastedge/host-api/bindings --world bindings runtime/fastedge/host-api/wit diff --git a/docs/examples/variables-and-secrets.js b/docs/examples/variables-and-secrets.js new file mode 100644 index 0000000..902d7b3 --- /dev/null +++ b/docs/examples/variables-and-secrets.js @@ -0,0 +1,13 @@ +import { getEnv } from 'fastedge::env'; +import { getSecret } from 'fastedge::secret'; + +async function eventHandler(event) { + const username = getEnv('USERNAME'); + const password = getSecret('PASSWORD'); + + return new Response(`Username: ${username}, Password: ${password}`); +} + +addEventListener('fetch', (event) => { + event.respondWith(eventHandler(event)); +}); diff --git a/docs/src/content/docs/examples/main-examples.mdx b/docs/src/content/docs/examples/main-examples.mdx index f8694bf..f57a563 100644 --- a/docs/src/content/docs/examples/main-examples.mdx +++ b/docs/src/content/docs/examples/main-examples.mdx @@ -7,14 +7,13 @@ import { LinkCard, CardGrid } from '@astrojs/starlight/components'; This is a brief list of examples, demonstrating the basic usage of FastEdge compute. -More examples will be added to the +More examples will be added to the examples-repo as we build out more functionality. - - repo + + examples-repo -as we build out more functionality. -## Some Examples +## Some Basic Examples @@ -27,4 +26,8 @@ as we build out more functionality. title='Header manipulation with environment variables' href='/FastEdge-sdk-js/examples/headers/' /> + diff --git a/docs/src/content/docs/examples/variables-and-secrets.mdx b/docs/src/content/docs/examples/variables-and-secrets.mdx new file mode 100644 index 0000000..57cf326 --- /dev/null +++ b/docs/src/content/docs/examples/variables-and-secrets.mdx @@ -0,0 +1,12 @@ +--- +title: Environment Variables and Secrets +description: An example using environment variables and secrets. +prev: + link: /FastEdge-sdk-js/examples/main-examples/ + label: Back to examples +--- + +import { Code } from '@astrojs/starlight/components'; +import importedCode from '/examples/variables-and-secrets.js?raw'; + + diff --git a/docs/src/content/docs/reference/env.md b/docs/src/content/docs/reference/fastedge-env.md similarity index 100% rename from docs/src/content/docs/reference/env.md rename to docs/src/content/docs/reference/fastedge-env.md diff --git a/docs/src/content/docs/reference/fastedge::secret/getSecret.md b/docs/src/content/docs/reference/fastedge::secret/getSecret.md new file mode 100644 index 0000000..6e0acd6 --- /dev/null +++ b/docs/src/content/docs/reference/fastedge::secret/getSecret.md @@ -0,0 +1,38 @@ +--- +title: getSecret +description: How to use FastEdge secret variables. +--- + +### Secret Variables + +To access secret variables, set during deployment on the FastEdge network. + +```js +import { getSecret } from 'fastedge::secret'; + +async function eventHandler(event) { + const secretToken = getSecret('MY_SECRET_TOKEN'); + return new Response({ secretToken }); +} + +addEventListener('fetch', (event) => { + event.respondWith(eventHandler(event)); +}); +``` + +```js title="SYNTAX" +getSecret(secretName); +``` + +##### Parameters + +- `secretName` (required) + + A string containing the name of the key you want to retrieve the value of. + +##### Return Value + +A string containing the value of the key. If the key does not exist, null is returned. + +**Note**: If the secret contains multiple `secret_slots` you will always receive the MAX `slot` +value. diff --git a/docs/src/content/docs/reference/fastedge::secret/getSecretEffectiveAt.md b/docs/src/content/docs/reference/fastedge::secret/getSecretEffectiveAt.md new file mode 100644 index 0000000..dee69bd --- /dev/null +++ b/docs/src/content/docs/reference/fastedge::secret/getSecretEffectiveAt.md @@ -0,0 +1,117 @@ +--- +title: getSecretEffectiveAt +description: How to use FastEdge secret variables. +--- + +### Secret Variables + +To access slot specific secret variables, set during deployment on the FastEdge network. + +```js +import { getSecretEffectiveAt } from 'fastedge::secret'; + +async function eventHandler(event) { + const secretToken = getSecretEffectiveAt('MY_SECRET_TOKEN', 1); + return new Response({ secretToken }); +} + +addEventListener('fetch', (event) => { + event.respondWith(eventHandler(event)); +}); +``` + +```js title="SYNTAX" +getSecretEffectiveAt(secretName, 0); +``` + +##### Parameters + +- `secretName` (required) + + A string containing the name of the key you want to retrieve the value of. + +- `effectiveAt` (required) + + A number representing the slot you wish to access. + +##### Return Value + +A string containing the value of the key. If the key does not exist, null is returned. + +### Slots and secret rollover + +Using `getSecretEffectiveAt()` to access different slots within a given secret and how to use slots. + +The concept of slots allows you to manage secret rollover within your own applications in many +different ways. + +##### Example 1 (Slots as indices) + +Validating a token against a specific version of a secret. + +Having created a secret: + +```json +{ + "secret": { + "comment": "The password to validate the token has been signed with", + "id": 168, + "name": "token-secret", + "secret_slots": [ + { + "slot": 0, + "value": "original_password" + }, + { + "slot": 5, + "value": "updated_password" + } + ] + } +} +``` + +It would now be easy enough to also provide the `slot` value within the tokens claims as to which +password it should validate against. This would allow you to slowly rollover from one password to +another and keep all users able to refresh their tokens without issues, as each users token also +carries the data to know which password was still in use when it was issued. + +It always returns `effectiveAt >= secret_slots.slot` + +So a request to: + +- `getSecretEffectiveAt("token-secret", 0)` would return `original_password` +- `getSecretEffectiveAt("token-secret", 3)` would return `original_password` +- `getSecretEffectiveAt("token-secret", 5)` would return `updated_password` +- `getSecretEffectiveAt("token-secret", 7)` would return `updated_password` + +This `>=` logic makes it very easy to implement the following example. + +##### Example 2 (Slots as timestamps) + +Validating a token against a specific version of a secret using timestamps: + +```json +{ + "secret": { + "comment": "The password to validate the token has been signed with", + "id": 168, + "name": "token-secret", + "secret_slots": [ + { + "slot": 0, + "value": "original_password" + }, + { + "slot": 1741790697, // Wed Mar 12 2025 14:44:57 + "value": "new_password" + } + ] + } +} +``` + +As you can see any token being validated with an `iat` claim time before 1741790697 would use the +`original_password` and any token after this time would start to use the `new_password` + +This is as simple as using `getSecretEffectiveAt("token-secret", claims.iat)` diff --git a/docs/src/content/docs/reference/headers.md b/docs/src/content/docs/reference/headers.md new file mode 100644 index 0000000..542993c --- /dev/null +++ b/docs/src/content/docs/reference/headers.md @@ -0,0 +1,28 @@ +--- +title: Headers +description: Response / Request Headers. +--- + +TThe Headers() constructor creates a new Headers object. + +```js +new Headers(); +new Headers(init); +``` + +##### Parameters + +- `init` (optional) + + An object containing any HTTP headers you want to prepopulate your `Headers` object with. This can + be a simple object literal with String values, an array of name-value pairs, where each pair is a + 2-element string array; or an existing Headers object. In the last case, the new Headers object + copies its data from the existing Headers object. + +:::note[INFO] + +Request and Response Headers are immutable. This means, if you need to modify Request headers for +downstream fetch requests, or modify Response headers prior to returning a Response. You will need +to create a `new Headers()` object. + +::: diff --git a/docs/src/content/docs/reference/overview.md b/docs/src/content/docs/reference/overview.md index 1c4099b..6d580be 100644 --- a/docs/src/content/docs/reference/overview.md +++ b/docs/src/content/docs/reference/overview.md @@ -18,7 +18,7 @@ This Javascript SDK is not yet fully fledged, but it is growing quickly. As we test and write more functionality we will endeavour to keep adding to this reference guide. At present there is all the basic javascript functionality provided by -SpiderMonkey. This is the engine our -Javascript product is embedded with. +StarlingMonkey. +This is the engine our Javascript product is embedded with. We will continue to add more, so please check back often! diff --git a/docs/src/content/docs/reference/request.md b/docs/src/content/docs/reference/request.md new file mode 100644 index 0000000..be6e22c --- /dev/null +++ b/docs/src/content/docs/reference/request.md @@ -0,0 +1,37 @@ +--- +title: Request +description: Request object definition. +--- + +The Request() constructor creates a new Request object. + +```js +new Request(input); +new Request(input, options); +``` + +##### Parameters + +- `input` + + Defines the resource you wish to fetch. Can be one of the following: + + - A string containing the resource you wish to fetch. + - `Request` object, effectively creating a copy. + +- `options` (optional) + + An options object containing any other data to associate with the Request + + - method: (optional) + + e.g. `GET`, `POST`, `PUT`, `DELETE`. (Default is `GET`) + + - headers: (optional) + + An object: containing either a `Headers` object or object literal with `String` key/value pairs. + + - body: (optional) + + Any body that you want to add to your request: this can be an `ArrayBuffer`, a `TypedArray`, a + `DataView`, a `URLSearchParams`, string object or literal, or a `ReadableStream` object. diff --git a/docs/src/content/docs/reference/response.md b/docs/src/content/docs/reference/response.md index 2075fc7..deb32ce 100644 --- a/docs/src/content/docs/reference/response.md +++ b/docs/src/content/docs/reference/response.md @@ -15,7 +15,16 @@ new Response(body, options); - `body` (optional) - A string defining the body of a response. This can be `null` that is the default. + A object defining the body of a response. This can be `null` (which is the default) or one of the + following: + + - ArrayBuffer + - TypedArray + - DataView + - ReadableStream + - URLSearchParams + - String + - string literal - `options` (optional) @@ -25,6 +34,10 @@ new Response(body, options); A number representing the http status code. e.g. `200` + - statusText: (optional) + + The status message associated with the status code, e.g. `OK`. + - headers: (optional) An object: containing either a `Headers` object or object literal with `String` key/value pairs. diff --git a/package-lock.json b/package-lock.json index 53b8350..6995cfa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@gcoredev/fastedge-sdk-js", - "version": "0.0.1", + "version": "1.0.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@gcoredev/fastedge-sdk-js", - "version": "0.0.1", + "version": "1.0.1", "license": "Apache-2.0", "dependencies": { "@bytecodealliance/jco": "^1.2.4", diff --git a/package.json b/package.json index 463204a..1a22e9f 100644 --- a/package.json +++ b/package.json @@ -38,8 +38,7 @@ "build:monkey:prod": "./runtime/fastedge/build.sh", "build:libs": "node esbuild/fastedge-libs.js", "build:types": "tsc -p ./src/static-server/tsconfig.json", - "FIX:build:wasm": "node build-examples-config.js", - "FIX:generate:wit-world": "make -j8 -C fastedge-runtime/cbindings generate-wit-bindgen", + "generate:wit-world": "./create-wit-bindings.sh", "lint": "npx eslint -c ./config/eslint/repo/.eslintrc.cjs .", "semantic-release": "semantic-release", "test:solo": "NODE_ENV=test jest -c ./config/jest/jest.config.js --", diff --git a/runtime/StarlingMonkey b/runtime/StarlingMonkey index c83e718..aa18177 160000 --- a/runtime/StarlingMonkey +++ b/runtime/StarlingMonkey @@ -1 +1 @@ -Subproject commit c83e718d5aa9db921ec8da9be36bb65a0ac655d4 +Subproject commit aa181774e6f182acdf9196e998b29d98b7c95f7b diff --git a/runtime/fastedge/build.sh b/runtime/fastedge/build.sh index 6211f73..f8a1f74 100755 --- a/runtime/fastedge/build.sh +++ b/runtime/fastedge/build.sh @@ -26,5 +26,5 @@ HOST_API=$(realpath host-api) cmake -B $BUILD_PATH -DCMAKE_BUILD_TYPE=$BUILD_TYP # cmake --build $BUILD_PATH --parallel 16 cmake --build $BUILD_PATH --parallel 8 # Copy the built WebAssembly module to the parent directory -mv $BUILD_PATH/starling.wasm/starling.wasm ../../lib/fastedge-runtime.wasm -mv $BUILD_PATH/starling.wasm/preview1-adapter.wasm ../../lib/preview1-adapter.wasm +mv $BUILD_PATH/starling-raw.wasm/starling-raw.wasm ../../lib/fastedge-runtime.wasm +mv $BUILD_PATH/starling-raw.wasm/preview1-adapter.wasm ../../lib/preview1-adapter.wasm diff --git a/runtime/fastedge/builtins/fastedge.cpp b/runtime/fastedge/builtins/fastedge.cpp index ad90df2..c61b7ea 100644 --- a/runtime/fastedge/builtins/fastedge.cpp +++ b/runtime/fastedge/builtins/fastedge.cpp @@ -25,6 +25,7 @@ namespace fastedge::fastedge { JS::PersistentRooted FastEdge::env; JS::PersistentRooted FastEdge::fs; +JS::PersistentRooted FastEdge::secret; bool FastEdge::getEnv(JSContext* cx, unsigned argc, JS::Value* vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -96,6 +97,71 @@ bool FastEdge::readFileSync(JSContext *cx, unsigned argc, JS::Value *vp) { return true; } +bool FastEdge::getSecret(JSContext* cx, unsigned argc, JS::Value* vp) { + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + if (!args.requireAtLeast(cx, "getSecret", 1)) { + JS_ReportErrorUTF8(cx, "getSecret() -> requires at least 1 argument"); + return false; + } + // Convert the first argument to a string + JS::RootedString jsKey(cx, JS::ToString(cx, args[0])); + if (!jsKey) { + return false; + } + // Encode the JS string to a C++ string + JS::UniqueChars keyChars = JS_EncodeStringToUTF8(cx, jsKey); + if (!keyChars) { + return false; + } + auto secretValue = host_api::get_secret_vars(keyChars.get()); + if (!secretValue.size()) { + args.rval().setNull(); + return true; + } + + JS::RootedString secretValueStr(cx, JS_NewStringCopyUTF8N(cx, JS::UTF8Chars(secretValue.begin(), secretValue.size()))); + args.rval().setString(secretValueStr); + return true; +} + +bool FastEdge::getSecretEffectiveAt(JSContext* cx, unsigned argc, JS::Value* vp) { + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + if (!args.requireAtLeast(cx, "getSecretEffectiveAt", 2)) { + JS_ReportErrorUTF8(cx, "getSecretEffectiveAt() -> requires at least 2 arguments"); + return false; + } + // Convert the first argument to a string + JS::RootedString jsKey(cx, JS::ToString(cx, args[0])); + if (!jsKey) { + return false; + } + // Encode the JS string to a C++ string + JS::UniqueChars keyChars = JS_EncodeStringToUTF8(cx, jsKey); + if (!keyChars) { + return false; + } + + // Convert the second argument to a number + int32_t effective_at = 0; + if (args.length() > 1 && !JS::ToInt32(cx, args.get(1), &effective_at)) { + return false; + } + if (effective_at < 0) { + effective_at = 0; + } + + auto secretValue = host_api::get_secret_vars_effective_at(keyChars.get(), effective_at); + if (!secretValue.size()) { + args.rval().setNull(); + return true; + } + + JS::RootedString secretValueStr(cx, JS_NewStringCopyUTF8N(cx, JS::UTF8Chars(secretValue.begin(), secretValue.size()))); + args.rval().setString(secretValueStr); + return true; +} + + const JSPropertySpec FastEdge::properties[] = { JS_PSG("env", getEnv, JSPROP_ENUMERATE), JS_PS_END @@ -118,6 +184,8 @@ bool install(api::Engine *engine) { const JSFunctionSpec methods[] = { JS_FN("getEnv", FastEdge::getEnv, 1, JSPROP_ENUMERATE), JS_FN("readFileSync", FastEdge::readFileSync, 1, JSPROP_ENUMERATE), + JS_FN("getSecret", FastEdge::getSecret, 1, JSPROP_ENUMERATE), + JS_FN("getSecretEffectiveAt", FastEdge::getSecretEffectiveAt, 1, JSPROP_ENUMERATE), JS_FS_END }; @@ -156,6 +224,29 @@ bool install(api::Engine *engine) { return false; } + // fastedge:secret + RootedValue get_secret_val(engine->cx()); + if (!JS_GetProperty(engine->cx(), fastedge, "getSecret", &get_secret_val)) { + return false; + } + RootedValue get_secret_val_effective_at(engine->cx()); + if (!JS_GetProperty(engine->cx(), fastedge, "getSecretEffectiveAt", &get_secret_val_effective_at)) { + return false; + } + + RootedObject secret_builtin(engine->cx(), JS_NewObject(engine->cx(), nullptr)); + if (!JS_SetProperty(engine->cx(), secret_builtin, "getSecret", get_secret_val)) { + return false; + } + if (!JS_SetProperty(engine->cx(), secret_builtin, "getSecretEffectiveAt", get_secret_val_effective_at)) { + return false; + } + + RootedValue secret_builtin_val(engine->cx(), JS::ObjectValue(*secret_builtin)); + if (!engine->define_builtin_module("fastedge::secret", secret_builtin_val)) { + return false; + } + return true; } diff --git a/runtime/fastedge/builtins/fastedge.h b/runtime/fastedge/builtins/fastedge.h index beb6f03..bc785d8 100644 --- a/runtime/fastedge/builtins/fastedge.h +++ b/runtime/fastedge/builtins/fastedge.h @@ -23,11 +23,14 @@ class FastEdge : public builtins::BuiltinNoConstructor { static JS::PersistentRooted env; static JS::PersistentRooted fs; + static JS::PersistentRooted secret; static const JSPropertySpec properties[]; static bool readFileSync(JSContext *cx, unsigned argc, JS::Value *vp); static bool getEnv(JSContext *cx, unsigned argc, JS::Value *vp); + static bool getSecret(JSContext *cx, unsigned argc, JS::Value *vp); + static bool getSecretEffectiveAt(JSContext *cx, unsigned argc, JS::Value *vp); }; diff --git a/runtime/fastedge/host-api/bindings/bindings.c b/runtime/fastedge/host-api/bindings/bindings.c index ce7a926..8649c7c 100644 --- a/runtime/fastedge/host-api/bindings/bindings.c +++ b/runtime/fastedge/host-api/bindings/bindings.c @@ -1,531 +1,602 @@ -// Generated by `wit-bindgen` 0.16.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.30.0. DO NOT EDIT! #include "bindings.h" +#include +#include +// Imported Functions from `gcore:fastedge/dictionary` __attribute__((__import_module__("gcore:fastedge/dictionary"), __import_name__("get"))) -extern void __wasm_import_gcore_fastedge_dictionary_get(int32_t, int32_t, int32_t); +extern void __wasm_import_gcore_fastedge_dictionary_get(uint8_t *, size_t, uint8_t *); + +// Imported Functions from `gcore:fastedge/secret` + +__attribute__((__import_module__("gcore:fastedge/secret"), __import_name__("get"))) +extern void __wasm_import_gcore_fastedge_secret_get(uint8_t *, size_t, uint8_t *); + +__attribute__((__import_module__("gcore:fastedge/secret"), __import_name__("get-effective-at"))) +extern void __wasm_import_gcore_fastedge_secret_get_effective_at(uint8_t *, size_t, int32_t, uint8_t *); + +// Imported Functions from `wasi:cli/environment@0.2.0` __attribute__((__import_module__("wasi:cli/environment@0.2.0"), __import_name__("get-environment"))) -extern void __wasm_import_wasi_cli_0_2_0_environment_get_environment(int32_t); +extern void __wasm_import_wasi_cli_environment_get_environment(uint8_t *); __attribute__((__import_module__("wasi:cli/environment@0.2.0"), __import_name__("get-arguments"))) -extern void __wasm_import_wasi_cli_0_2_0_environment_get_arguments(int32_t); +extern void __wasm_import_wasi_cli_environment_get_arguments(uint8_t *); __attribute__((__import_module__("wasi:cli/environment@0.2.0"), __import_name__("initial-cwd"))) -extern void __wasm_import_wasi_cli_0_2_0_environment_initial_cwd(int32_t); +extern void __wasm_import_wasi_cli_environment_initial_cwd(uint8_t *); + +// Imported Functions from `wasi:cli/exit@0.2.0` __attribute__((__import_module__("wasi:cli/exit@0.2.0"), __import_name__("exit"))) -extern void __wasm_import_wasi_cli_0_2_0_exit_exit(int32_t); +extern void __wasm_import_wasi_cli_exit_exit(int32_t); + +// Imported Functions from `wasi:io/error@0.2.0` __attribute__((__import_module__("wasi:io/error@0.2.0"), __import_name__("[method]error.to-debug-string"))) -extern void __wasm_import_wasi_io_0_2_0_error_method_error_to_debug_string(int32_t, int32_t); +extern void __wasm_import_wasi_io_error_method_error_to_debug_string(int32_t, uint8_t *); + +// Imported Functions from `wasi:io/poll@0.2.0` __attribute__((__import_module__("wasi:io/poll@0.2.0"), __import_name__("[method]pollable.ready"))) -extern int32_t __wasm_import_wasi_io_0_2_0_poll_method_pollable_ready(int32_t); +extern int32_t __wasm_import_wasi_io_poll_method_pollable_ready(int32_t); __attribute__((__import_module__("wasi:io/poll@0.2.0"), __import_name__("[method]pollable.block"))) -extern void __wasm_import_wasi_io_0_2_0_poll_method_pollable_block(int32_t); +extern void __wasm_import_wasi_io_poll_method_pollable_block(int32_t); __attribute__((__import_module__("wasi:io/poll@0.2.0"), __import_name__("poll"))) -extern void __wasm_import_wasi_io_0_2_0_poll_poll(int32_t, int32_t, int32_t); +extern void __wasm_import_wasi_io_poll_poll(uint8_t *, size_t, uint8_t *); + +// Imported Functions from `wasi:io/streams@0.2.0` __attribute__((__import_module__("wasi:io/streams@0.2.0"), __import_name__("[method]input-stream.read"))) -extern void __wasm_import_wasi_io_0_2_0_streams_method_input_stream_read(int32_t, int64_t, int32_t); +extern void __wasm_import_wasi_io_streams_method_input_stream_read(int32_t, int64_t, uint8_t *); __attribute__((__import_module__("wasi:io/streams@0.2.0"), __import_name__("[method]input-stream.blocking-read"))) -extern void __wasm_import_wasi_io_0_2_0_streams_method_input_stream_blocking_read(int32_t, int64_t, int32_t); +extern void __wasm_import_wasi_io_streams_method_input_stream_blocking_read(int32_t, int64_t, uint8_t *); __attribute__((__import_module__("wasi:io/streams@0.2.0"), __import_name__("[method]input-stream.skip"))) -extern void __wasm_import_wasi_io_0_2_0_streams_method_input_stream_skip(int32_t, int64_t, int32_t); +extern void __wasm_import_wasi_io_streams_method_input_stream_skip(int32_t, int64_t, uint8_t *); __attribute__((__import_module__("wasi:io/streams@0.2.0"), __import_name__("[method]input-stream.blocking-skip"))) -extern void __wasm_import_wasi_io_0_2_0_streams_method_input_stream_blocking_skip(int32_t, int64_t, int32_t); +extern void __wasm_import_wasi_io_streams_method_input_stream_blocking_skip(int32_t, int64_t, uint8_t *); __attribute__((__import_module__("wasi:io/streams@0.2.0"), __import_name__("[method]input-stream.subscribe"))) -extern int32_t __wasm_import_wasi_io_0_2_0_streams_method_input_stream_subscribe(int32_t); +extern int32_t __wasm_import_wasi_io_streams_method_input_stream_subscribe(int32_t); __attribute__((__import_module__("wasi:io/streams@0.2.0"), __import_name__("[method]output-stream.check-write"))) -extern void __wasm_import_wasi_io_0_2_0_streams_method_output_stream_check_write(int32_t, int32_t); +extern void __wasm_import_wasi_io_streams_method_output_stream_check_write(int32_t, uint8_t *); __attribute__((__import_module__("wasi:io/streams@0.2.0"), __import_name__("[method]output-stream.write"))) -extern void __wasm_import_wasi_io_0_2_0_streams_method_output_stream_write(int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_wasi_io_streams_method_output_stream_write(int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("wasi:io/streams@0.2.0"), __import_name__("[method]output-stream.blocking-write-and-flush"))) -extern void __wasm_import_wasi_io_0_2_0_streams_method_output_stream_blocking_write_and_flush(int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_wasi_io_streams_method_output_stream_blocking_write_and_flush(int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("wasi:io/streams@0.2.0"), __import_name__("[method]output-stream.flush"))) -extern void __wasm_import_wasi_io_0_2_0_streams_method_output_stream_flush(int32_t, int32_t); +extern void __wasm_import_wasi_io_streams_method_output_stream_flush(int32_t, uint8_t *); __attribute__((__import_module__("wasi:io/streams@0.2.0"), __import_name__("[method]output-stream.blocking-flush"))) -extern void __wasm_import_wasi_io_0_2_0_streams_method_output_stream_blocking_flush(int32_t, int32_t); +extern void __wasm_import_wasi_io_streams_method_output_stream_blocking_flush(int32_t, uint8_t *); __attribute__((__import_module__("wasi:io/streams@0.2.0"), __import_name__("[method]output-stream.subscribe"))) -extern int32_t __wasm_import_wasi_io_0_2_0_streams_method_output_stream_subscribe(int32_t); +extern int32_t __wasm_import_wasi_io_streams_method_output_stream_subscribe(int32_t); __attribute__((__import_module__("wasi:io/streams@0.2.0"), __import_name__("[method]output-stream.write-zeroes"))) -extern void __wasm_import_wasi_io_0_2_0_streams_method_output_stream_write_zeroes(int32_t, int64_t, int32_t); +extern void __wasm_import_wasi_io_streams_method_output_stream_write_zeroes(int32_t, int64_t, uint8_t *); __attribute__((__import_module__("wasi:io/streams@0.2.0"), __import_name__("[method]output-stream.blocking-write-zeroes-and-flush"))) -extern void __wasm_import_wasi_io_0_2_0_streams_method_output_stream_blocking_write_zeroes_and_flush(int32_t, int64_t, int32_t); +extern void __wasm_import_wasi_io_streams_method_output_stream_blocking_write_zeroes_and_flush(int32_t, int64_t, uint8_t *); __attribute__((__import_module__("wasi:io/streams@0.2.0"), __import_name__("[method]output-stream.splice"))) -extern void __wasm_import_wasi_io_0_2_0_streams_method_output_stream_splice(int32_t, int32_t, int64_t, int32_t); +extern void __wasm_import_wasi_io_streams_method_output_stream_splice(int32_t, int32_t, int64_t, uint8_t *); __attribute__((__import_module__("wasi:io/streams@0.2.0"), __import_name__("[method]output-stream.blocking-splice"))) -extern void __wasm_import_wasi_io_0_2_0_streams_method_output_stream_blocking_splice(int32_t, int32_t, int64_t, int32_t); +extern void __wasm_import_wasi_io_streams_method_output_stream_blocking_splice(int32_t, int32_t, int64_t, uint8_t *); + +// Imported Functions from `wasi:cli/stdin@0.2.0` __attribute__((__import_module__("wasi:cli/stdin@0.2.0"), __import_name__("get-stdin"))) -extern int32_t __wasm_import_wasi_cli_0_2_0_stdin_get_stdin(void); +extern int32_t __wasm_import_wasi_cli_stdin_get_stdin(void); + +// Imported Functions from `wasi:cli/stdout@0.2.0` __attribute__((__import_module__("wasi:cli/stdout@0.2.0"), __import_name__("get-stdout"))) -extern int32_t __wasm_import_wasi_cli_0_2_0_stdout_get_stdout(void); +extern int32_t __wasm_import_wasi_cli_stdout_get_stdout(void); + +// Imported Functions from `wasi:cli/stderr@0.2.0` __attribute__((__import_module__("wasi:cli/stderr@0.2.0"), __import_name__("get-stderr"))) -extern int32_t __wasm_import_wasi_cli_0_2_0_stderr_get_stderr(void); +extern int32_t __wasm_import_wasi_cli_stderr_get_stderr(void); + +// Imported Functions from `wasi:cli/terminal-stdin@0.2.0` __attribute__((__import_module__("wasi:cli/terminal-stdin@0.2.0"), __import_name__("get-terminal-stdin"))) -extern void __wasm_import_wasi_cli_0_2_0_terminal_stdin_get_terminal_stdin(int32_t); +extern void __wasm_import_wasi_cli_terminal_stdin_get_terminal_stdin(uint8_t *); + +// Imported Functions from `wasi:cli/terminal-stdout@0.2.0` __attribute__((__import_module__("wasi:cli/terminal-stdout@0.2.0"), __import_name__("get-terminal-stdout"))) -extern void __wasm_import_wasi_cli_0_2_0_terminal_stdout_get_terminal_stdout(int32_t); +extern void __wasm_import_wasi_cli_terminal_stdout_get_terminal_stdout(uint8_t *); + +// Imported Functions from `wasi:cli/terminal-stderr@0.2.0` __attribute__((__import_module__("wasi:cli/terminal-stderr@0.2.0"), __import_name__("get-terminal-stderr"))) -extern void __wasm_import_wasi_cli_0_2_0_terminal_stderr_get_terminal_stderr(int32_t); +extern void __wasm_import_wasi_cli_terminal_stderr_get_terminal_stderr(uint8_t *); + +// Imported Functions from `wasi:clocks/monotonic-clock@0.2.0` __attribute__((__import_module__("wasi:clocks/monotonic-clock@0.2.0"), __import_name__("now"))) -extern int64_t __wasm_import_wasi_clocks_0_2_0_monotonic_clock_now(void); +extern int64_t __wasm_import_wasi_clocks_monotonic_clock_now(void); __attribute__((__import_module__("wasi:clocks/monotonic-clock@0.2.0"), __import_name__("resolution"))) -extern int64_t __wasm_import_wasi_clocks_0_2_0_monotonic_clock_resolution(void); +extern int64_t __wasm_import_wasi_clocks_monotonic_clock_resolution(void); __attribute__((__import_module__("wasi:clocks/monotonic-clock@0.2.0"), __import_name__("subscribe-instant"))) -extern int32_t __wasm_import_wasi_clocks_0_2_0_monotonic_clock_subscribe_instant(int64_t); +extern int32_t __wasm_import_wasi_clocks_monotonic_clock_subscribe_instant(int64_t); __attribute__((__import_module__("wasi:clocks/monotonic-clock@0.2.0"), __import_name__("subscribe-duration"))) -extern int32_t __wasm_import_wasi_clocks_0_2_0_monotonic_clock_subscribe_duration(int64_t); +extern int32_t __wasm_import_wasi_clocks_monotonic_clock_subscribe_duration(int64_t); + +// Imported Functions from `wasi:clocks/wall-clock@0.2.0` __attribute__((__import_module__("wasi:clocks/wall-clock@0.2.0"), __import_name__("now"))) -extern void __wasm_import_wasi_clocks_0_2_0_wall_clock_now(int32_t); +extern void __wasm_import_wasi_clocks_wall_clock_now(uint8_t *); __attribute__((__import_module__("wasi:clocks/wall-clock@0.2.0"), __import_name__("resolution"))) -extern void __wasm_import_wasi_clocks_0_2_0_wall_clock_resolution(int32_t); +extern void __wasm_import_wasi_clocks_wall_clock_resolution(uint8_t *); + +// Imported Functions from `wasi:filesystem/types@0.2.0` __attribute__((__import_module__("wasi:filesystem/types@0.2.0"), __import_name__("[method]descriptor.read-via-stream"))) -extern void __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_read_via_stream(int32_t, int64_t, int32_t); +extern void __wasm_import_wasi_filesystem_types_method_descriptor_read_via_stream(int32_t, int64_t, uint8_t *); __attribute__((__import_module__("wasi:filesystem/types@0.2.0"), __import_name__("[method]descriptor.write-via-stream"))) -extern void __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_write_via_stream(int32_t, int64_t, int32_t); +extern void __wasm_import_wasi_filesystem_types_method_descriptor_write_via_stream(int32_t, int64_t, uint8_t *); __attribute__((__import_module__("wasi:filesystem/types@0.2.0"), __import_name__("[method]descriptor.append-via-stream"))) -extern void __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_append_via_stream(int32_t, int32_t); +extern void __wasm_import_wasi_filesystem_types_method_descriptor_append_via_stream(int32_t, uint8_t *); __attribute__((__import_module__("wasi:filesystem/types@0.2.0"), __import_name__("[method]descriptor.advise"))) -extern void __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_advise(int32_t, int64_t, int64_t, int32_t, int32_t); +extern void __wasm_import_wasi_filesystem_types_method_descriptor_advise(int32_t, int64_t, int64_t, int32_t, uint8_t *); __attribute__((__import_module__("wasi:filesystem/types@0.2.0"), __import_name__("[method]descriptor.sync-data"))) -extern void __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_sync_data(int32_t, int32_t); +extern void __wasm_import_wasi_filesystem_types_method_descriptor_sync_data(int32_t, uint8_t *); __attribute__((__import_module__("wasi:filesystem/types@0.2.0"), __import_name__("[method]descriptor.get-flags"))) -extern void __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_get_flags(int32_t, int32_t); +extern void __wasm_import_wasi_filesystem_types_method_descriptor_get_flags(int32_t, uint8_t *); __attribute__((__import_module__("wasi:filesystem/types@0.2.0"), __import_name__("[method]descriptor.get-type"))) -extern void __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_get_type(int32_t, int32_t); +extern void __wasm_import_wasi_filesystem_types_method_descriptor_get_type(int32_t, uint8_t *); __attribute__((__import_module__("wasi:filesystem/types@0.2.0"), __import_name__("[method]descriptor.set-size"))) -extern void __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_set_size(int32_t, int64_t, int32_t); +extern void __wasm_import_wasi_filesystem_types_method_descriptor_set_size(int32_t, int64_t, uint8_t *); __attribute__((__import_module__("wasi:filesystem/types@0.2.0"), __import_name__("[method]descriptor.set-times"))) -extern void __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_set_times(int32_t, int32_t, int64_t, int32_t, int32_t, int64_t, int32_t, int32_t); +extern void __wasm_import_wasi_filesystem_types_method_descriptor_set_times(int32_t, int32_t, int64_t, int32_t, int32_t, int64_t, int32_t, uint8_t *); __attribute__((__import_module__("wasi:filesystem/types@0.2.0"), __import_name__("[method]descriptor.read"))) -extern void __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_read(int32_t, int64_t, int64_t, int32_t); +extern void __wasm_import_wasi_filesystem_types_method_descriptor_read(int32_t, int64_t, int64_t, uint8_t *); __attribute__((__import_module__("wasi:filesystem/types@0.2.0"), __import_name__("[method]descriptor.write"))) -extern void __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_write(int32_t, int32_t, int32_t, int64_t, int32_t); +extern void __wasm_import_wasi_filesystem_types_method_descriptor_write(int32_t, uint8_t *, size_t, int64_t, uint8_t *); __attribute__((__import_module__("wasi:filesystem/types@0.2.0"), __import_name__("[method]descriptor.read-directory"))) -extern void __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_read_directory(int32_t, int32_t); +extern void __wasm_import_wasi_filesystem_types_method_descriptor_read_directory(int32_t, uint8_t *); __attribute__((__import_module__("wasi:filesystem/types@0.2.0"), __import_name__("[method]descriptor.sync"))) -extern void __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_sync(int32_t, int32_t); +extern void __wasm_import_wasi_filesystem_types_method_descriptor_sync(int32_t, uint8_t *); __attribute__((__import_module__("wasi:filesystem/types@0.2.0"), __import_name__("[method]descriptor.create-directory-at"))) -extern void __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_create_directory_at(int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_wasi_filesystem_types_method_descriptor_create_directory_at(int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("wasi:filesystem/types@0.2.0"), __import_name__("[method]descriptor.stat"))) -extern void __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_stat(int32_t, int32_t); +extern void __wasm_import_wasi_filesystem_types_method_descriptor_stat(int32_t, uint8_t *); __attribute__((__import_module__("wasi:filesystem/types@0.2.0"), __import_name__("[method]descriptor.stat-at"))) -extern void __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_stat_at(int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_wasi_filesystem_types_method_descriptor_stat_at(int32_t, int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("wasi:filesystem/types@0.2.0"), __import_name__("[method]descriptor.set-times-at"))) -extern void __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_set_times_at(int32_t, int32_t, int32_t, int32_t, int32_t, int64_t, int32_t, int32_t, int64_t, int32_t, int32_t); +extern void __wasm_import_wasi_filesystem_types_method_descriptor_set_times_at(int32_t, int32_t, uint8_t *, size_t, int32_t, int64_t, int32_t, int32_t, int64_t, int32_t, uint8_t *); __attribute__((__import_module__("wasi:filesystem/types@0.2.0"), __import_name__("[method]descriptor.link-at"))) -extern void __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_link_at(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_wasi_filesystem_types_method_descriptor_link_at(int32_t, int32_t, uint8_t *, size_t, int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("wasi:filesystem/types@0.2.0"), __import_name__("[method]descriptor.open-at"))) -extern void __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_open_at(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_wasi_filesystem_types_method_descriptor_open_at(int32_t, int32_t, uint8_t *, size_t, int32_t, int32_t, uint8_t *); __attribute__((__import_module__("wasi:filesystem/types@0.2.0"), __import_name__("[method]descriptor.readlink-at"))) -extern void __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_readlink_at(int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_wasi_filesystem_types_method_descriptor_readlink_at(int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("wasi:filesystem/types@0.2.0"), __import_name__("[method]descriptor.remove-directory-at"))) -extern void __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_remove_directory_at(int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_wasi_filesystem_types_method_descriptor_remove_directory_at(int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("wasi:filesystem/types@0.2.0"), __import_name__("[method]descriptor.rename-at"))) -extern void __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_rename_at(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_wasi_filesystem_types_method_descriptor_rename_at(int32_t, uint8_t *, size_t, int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("wasi:filesystem/types@0.2.0"), __import_name__("[method]descriptor.symlink-at"))) -extern void __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_symlink_at(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_wasi_filesystem_types_method_descriptor_symlink_at(int32_t, uint8_t *, size_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("wasi:filesystem/types@0.2.0"), __import_name__("[method]descriptor.unlink-file-at"))) -extern void __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_unlink_file_at(int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_wasi_filesystem_types_method_descriptor_unlink_file_at(int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("wasi:filesystem/types@0.2.0"), __import_name__("[method]descriptor.is-same-object"))) -extern int32_t __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_is_same_object(int32_t, int32_t); +extern int32_t __wasm_import_wasi_filesystem_types_method_descriptor_is_same_object(int32_t, int32_t); __attribute__((__import_module__("wasi:filesystem/types@0.2.0"), __import_name__("[method]descriptor.metadata-hash"))) -extern void __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_metadata_hash(int32_t, int32_t); +extern void __wasm_import_wasi_filesystem_types_method_descriptor_metadata_hash(int32_t, uint8_t *); __attribute__((__import_module__("wasi:filesystem/types@0.2.0"), __import_name__("[method]descriptor.metadata-hash-at"))) -extern void __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_metadata_hash_at(int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_wasi_filesystem_types_method_descriptor_metadata_hash_at(int32_t, int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("wasi:filesystem/types@0.2.0"), __import_name__("[method]directory-entry-stream.read-directory-entry"))) -extern void __wasm_import_wasi_filesystem_0_2_0_types_method_directory_entry_stream_read_directory_entry(int32_t, int32_t); +extern void __wasm_import_wasi_filesystem_types_method_directory_entry_stream_read_directory_entry(int32_t, uint8_t *); __attribute__((__import_module__("wasi:filesystem/types@0.2.0"), __import_name__("filesystem-error-code"))) -extern void __wasm_import_wasi_filesystem_0_2_0_types_filesystem_error_code(int32_t, int32_t); +extern void __wasm_import_wasi_filesystem_types_filesystem_error_code(int32_t, uint8_t *); + +// Imported Functions from `wasi:filesystem/preopens@0.2.0` __attribute__((__import_module__("wasi:filesystem/preopens@0.2.0"), __import_name__("get-directories"))) -extern void __wasm_import_wasi_filesystem_0_2_0_preopens_get_directories(int32_t); +extern void __wasm_import_wasi_filesystem_preopens_get_directories(uint8_t *); + +// Imported Functions from `wasi:sockets/instance-network@0.2.0` __attribute__((__import_module__("wasi:sockets/instance-network@0.2.0"), __import_name__("instance-network"))) -extern int32_t __wasm_import_wasi_sockets_0_2_0_instance_network_instance_network(void); +extern int32_t __wasm_import_wasi_sockets_instance_network_instance_network(void); + +// Imported Functions from `wasi:sockets/udp@0.2.0` __attribute__((__import_module__("wasi:sockets/udp@0.2.0"), __import_name__("[method]udp-socket.start-bind"))) -extern void __wasm_import_wasi_sockets_0_2_0_udp_method_udp_socket_start_bind(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_wasi_sockets_udp_method_udp_socket_start_bind(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, uint8_t *); __attribute__((__import_module__("wasi:sockets/udp@0.2.0"), __import_name__("[method]udp-socket.finish-bind"))) -extern void __wasm_import_wasi_sockets_0_2_0_udp_method_udp_socket_finish_bind(int32_t, int32_t); +extern void __wasm_import_wasi_sockets_udp_method_udp_socket_finish_bind(int32_t, uint8_t *); __attribute__((__import_module__("wasi:sockets/udp@0.2.0"), __import_name__("[method]udp-socket.stream"))) -extern void __wasm_import_wasi_sockets_0_2_0_udp_method_udp_socket_stream(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_wasi_sockets_udp_method_udp_socket_stream(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, uint8_t *); __attribute__((__import_module__("wasi:sockets/udp@0.2.0"), __import_name__("[method]udp-socket.local-address"))) -extern void __wasm_import_wasi_sockets_0_2_0_udp_method_udp_socket_local_address(int32_t, int32_t); +extern void __wasm_import_wasi_sockets_udp_method_udp_socket_local_address(int32_t, uint8_t *); __attribute__((__import_module__("wasi:sockets/udp@0.2.0"), __import_name__("[method]udp-socket.remote-address"))) -extern void __wasm_import_wasi_sockets_0_2_0_udp_method_udp_socket_remote_address(int32_t, int32_t); +extern void __wasm_import_wasi_sockets_udp_method_udp_socket_remote_address(int32_t, uint8_t *); __attribute__((__import_module__("wasi:sockets/udp@0.2.0"), __import_name__("[method]udp-socket.address-family"))) -extern int32_t __wasm_import_wasi_sockets_0_2_0_udp_method_udp_socket_address_family(int32_t); +extern int32_t __wasm_import_wasi_sockets_udp_method_udp_socket_address_family(int32_t); __attribute__((__import_module__("wasi:sockets/udp@0.2.0"), __import_name__("[method]udp-socket.unicast-hop-limit"))) -extern void __wasm_import_wasi_sockets_0_2_0_udp_method_udp_socket_unicast_hop_limit(int32_t, int32_t); +extern void __wasm_import_wasi_sockets_udp_method_udp_socket_unicast_hop_limit(int32_t, uint8_t *); __attribute__((__import_module__("wasi:sockets/udp@0.2.0"), __import_name__("[method]udp-socket.set-unicast-hop-limit"))) -extern void __wasm_import_wasi_sockets_0_2_0_udp_method_udp_socket_set_unicast_hop_limit(int32_t, int32_t, int32_t); +extern void __wasm_import_wasi_sockets_udp_method_udp_socket_set_unicast_hop_limit(int32_t, int32_t, uint8_t *); __attribute__((__import_module__("wasi:sockets/udp@0.2.0"), __import_name__("[method]udp-socket.receive-buffer-size"))) -extern void __wasm_import_wasi_sockets_0_2_0_udp_method_udp_socket_receive_buffer_size(int32_t, int32_t); +extern void __wasm_import_wasi_sockets_udp_method_udp_socket_receive_buffer_size(int32_t, uint8_t *); __attribute__((__import_module__("wasi:sockets/udp@0.2.0"), __import_name__("[method]udp-socket.set-receive-buffer-size"))) -extern void __wasm_import_wasi_sockets_0_2_0_udp_method_udp_socket_set_receive_buffer_size(int32_t, int64_t, int32_t); +extern void __wasm_import_wasi_sockets_udp_method_udp_socket_set_receive_buffer_size(int32_t, int64_t, uint8_t *); __attribute__((__import_module__("wasi:sockets/udp@0.2.0"), __import_name__("[method]udp-socket.send-buffer-size"))) -extern void __wasm_import_wasi_sockets_0_2_0_udp_method_udp_socket_send_buffer_size(int32_t, int32_t); +extern void __wasm_import_wasi_sockets_udp_method_udp_socket_send_buffer_size(int32_t, uint8_t *); __attribute__((__import_module__("wasi:sockets/udp@0.2.0"), __import_name__("[method]udp-socket.set-send-buffer-size"))) -extern void __wasm_import_wasi_sockets_0_2_0_udp_method_udp_socket_set_send_buffer_size(int32_t, int64_t, int32_t); +extern void __wasm_import_wasi_sockets_udp_method_udp_socket_set_send_buffer_size(int32_t, int64_t, uint8_t *); __attribute__((__import_module__("wasi:sockets/udp@0.2.0"), __import_name__("[method]udp-socket.subscribe"))) -extern int32_t __wasm_import_wasi_sockets_0_2_0_udp_method_udp_socket_subscribe(int32_t); +extern int32_t __wasm_import_wasi_sockets_udp_method_udp_socket_subscribe(int32_t); __attribute__((__import_module__("wasi:sockets/udp@0.2.0"), __import_name__("[method]incoming-datagram-stream.receive"))) -extern void __wasm_import_wasi_sockets_0_2_0_udp_method_incoming_datagram_stream_receive(int32_t, int64_t, int32_t); +extern void __wasm_import_wasi_sockets_udp_method_incoming_datagram_stream_receive(int32_t, int64_t, uint8_t *); __attribute__((__import_module__("wasi:sockets/udp@0.2.0"), __import_name__("[method]incoming-datagram-stream.subscribe"))) -extern int32_t __wasm_import_wasi_sockets_0_2_0_udp_method_incoming_datagram_stream_subscribe(int32_t); +extern int32_t __wasm_import_wasi_sockets_udp_method_incoming_datagram_stream_subscribe(int32_t); __attribute__((__import_module__("wasi:sockets/udp@0.2.0"), __import_name__("[method]outgoing-datagram-stream.check-send"))) -extern void __wasm_import_wasi_sockets_0_2_0_udp_method_outgoing_datagram_stream_check_send(int32_t, int32_t); +extern void __wasm_import_wasi_sockets_udp_method_outgoing_datagram_stream_check_send(int32_t, uint8_t *); __attribute__((__import_module__("wasi:sockets/udp@0.2.0"), __import_name__("[method]outgoing-datagram-stream.send"))) -extern void __wasm_import_wasi_sockets_0_2_0_udp_method_outgoing_datagram_stream_send(int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_wasi_sockets_udp_method_outgoing_datagram_stream_send(int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("wasi:sockets/udp@0.2.0"), __import_name__("[method]outgoing-datagram-stream.subscribe"))) -extern int32_t __wasm_import_wasi_sockets_0_2_0_udp_method_outgoing_datagram_stream_subscribe(int32_t); +extern int32_t __wasm_import_wasi_sockets_udp_method_outgoing_datagram_stream_subscribe(int32_t); + +// Imported Functions from `wasi:sockets/udp-create-socket@0.2.0` __attribute__((__import_module__("wasi:sockets/udp-create-socket@0.2.0"), __import_name__("create-udp-socket"))) -extern void __wasm_import_wasi_sockets_0_2_0_udp_create_socket_create_udp_socket(int32_t, int32_t); +extern void __wasm_import_wasi_sockets_udp_create_socket_create_udp_socket(int32_t, uint8_t *); + +// Imported Functions from `wasi:sockets/tcp@0.2.0` __attribute__((__import_module__("wasi:sockets/tcp@0.2.0"), __import_name__("[method]tcp-socket.start-bind"))) -extern void __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_start_bind(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_wasi_sockets_tcp_method_tcp_socket_start_bind(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, uint8_t *); __attribute__((__import_module__("wasi:sockets/tcp@0.2.0"), __import_name__("[method]tcp-socket.finish-bind"))) -extern void __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_finish_bind(int32_t, int32_t); +extern void __wasm_import_wasi_sockets_tcp_method_tcp_socket_finish_bind(int32_t, uint8_t *); __attribute__((__import_module__("wasi:sockets/tcp@0.2.0"), __import_name__("[method]tcp-socket.start-connect"))) -extern void __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_start_connect(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_wasi_sockets_tcp_method_tcp_socket_start_connect(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, uint8_t *); __attribute__((__import_module__("wasi:sockets/tcp@0.2.0"), __import_name__("[method]tcp-socket.finish-connect"))) -extern void __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_finish_connect(int32_t, int32_t); +extern void __wasm_import_wasi_sockets_tcp_method_tcp_socket_finish_connect(int32_t, uint8_t *); __attribute__((__import_module__("wasi:sockets/tcp@0.2.0"), __import_name__("[method]tcp-socket.start-listen"))) -extern void __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_start_listen(int32_t, int32_t); +extern void __wasm_import_wasi_sockets_tcp_method_tcp_socket_start_listen(int32_t, uint8_t *); __attribute__((__import_module__("wasi:sockets/tcp@0.2.0"), __import_name__("[method]tcp-socket.finish-listen"))) -extern void __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_finish_listen(int32_t, int32_t); +extern void __wasm_import_wasi_sockets_tcp_method_tcp_socket_finish_listen(int32_t, uint8_t *); __attribute__((__import_module__("wasi:sockets/tcp@0.2.0"), __import_name__("[method]tcp-socket.accept"))) -extern void __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_accept(int32_t, int32_t); +extern void __wasm_import_wasi_sockets_tcp_method_tcp_socket_accept(int32_t, uint8_t *); __attribute__((__import_module__("wasi:sockets/tcp@0.2.0"), __import_name__("[method]tcp-socket.local-address"))) -extern void __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_local_address(int32_t, int32_t); +extern void __wasm_import_wasi_sockets_tcp_method_tcp_socket_local_address(int32_t, uint8_t *); __attribute__((__import_module__("wasi:sockets/tcp@0.2.0"), __import_name__("[method]tcp-socket.remote-address"))) -extern void __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_remote_address(int32_t, int32_t); +extern void __wasm_import_wasi_sockets_tcp_method_tcp_socket_remote_address(int32_t, uint8_t *); __attribute__((__import_module__("wasi:sockets/tcp@0.2.0"), __import_name__("[method]tcp-socket.is-listening"))) -extern int32_t __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_is_listening(int32_t); +extern int32_t __wasm_import_wasi_sockets_tcp_method_tcp_socket_is_listening(int32_t); __attribute__((__import_module__("wasi:sockets/tcp@0.2.0"), __import_name__("[method]tcp-socket.address-family"))) -extern int32_t __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_address_family(int32_t); +extern int32_t __wasm_import_wasi_sockets_tcp_method_tcp_socket_address_family(int32_t); __attribute__((__import_module__("wasi:sockets/tcp@0.2.0"), __import_name__("[method]tcp-socket.set-listen-backlog-size"))) -extern void __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_set_listen_backlog_size(int32_t, int64_t, int32_t); +extern void __wasm_import_wasi_sockets_tcp_method_tcp_socket_set_listen_backlog_size(int32_t, int64_t, uint8_t *); __attribute__((__import_module__("wasi:sockets/tcp@0.2.0"), __import_name__("[method]tcp-socket.keep-alive-enabled"))) -extern void __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_keep_alive_enabled(int32_t, int32_t); +extern void __wasm_import_wasi_sockets_tcp_method_tcp_socket_keep_alive_enabled(int32_t, uint8_t *); __attribute__((__import_module__("wasi:sockets/tcp@0.2.0"), __import_name__("[method]tcp-socket.set-keep-alive-enabled"))) -extern void __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_set_keep_alive_enabled(int32_t, int32_t, int32_t); +extern void __wasm_import_wasi_sockets_tcp_method_tcp_socket_set_keep_alive_enabled(int32_t, int32_t, uint8_t *); __attribute__((__import_module__("wasi:sockets/tcp@0.2.0"), __import_name__("[method]tcp-socket.keep-alive-idle-time"))) -extern void __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_keep_alive_idle_time(int32_t, int32_t); +extern void __wasm_import_wasi_sockets_tcp_method_tcp_socket_keep_alive_idle_time(int32_t, uint8_t *); __attribute__((__import_module__("wasi:sockets/tcp@0.2.0"), __import_name__("[method]tcp-socket.set-keep-alive-idle-time"))) -extern void __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_set_keep_alive_idle_time(int32_t, int64_t, int32_t); +extern void __wasm_import_wasi_sockets_tcp_method_tcp_socket_set_keep_alive_idle_time(int32_t, int64_t, uint8_t *); __attribute__((__import_module__("wasi:sockets/tcp@0.2.0"), __import_name__("[method]tcp-socket.keep-alive-interval"))) -extern void __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_keep_alive_interval(int32_t, int32_t); +extern void __wasm_import_wasi_sockets_tcp_method_tcp_socket_keep_alive_interval(int32_t, uint8_t *); __attribute__((__import_module__("wasi:sockets/tcp@0.2.0"), __import_name__("[method]tcp-socket.set-keep-alive-interval"))) -extern void __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_set_keep_alive_interval(int32_t, int64_t, int32_t); +extern void __wasm_import_wasi_sockets_tcp_method_tcp_socket_set_keep_alive_interval(int32_t, int64_t, uint8_t *); __attribute__((__import_module__("wasi:sockets/tcp@0.2.0"), __import_name__("[method]tcp-socket.keep-alive-count"))) -extern void __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_keep_alive_count(int32_t, int32_t); +extern void __wasm_import_wasi_sockets_tcp_method_tcp_socket_keep_alive_count(int32_t, uint8_t *); __attribute__((__import_module__("wasi:sockets/tcp@0.2.0"), __import_name__("[method]tcp-socket.set-keep-alive-count"))) -extern void __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_set_keep_alive_count(int32_t, int32_t, int32_t); +extern void __wasm_import_wasi_sockets_tcp_method_tcp_socket_set_keep_alive_count(int32_t, int32_t, uint8_t *); __attribute__((__import_module__("wasi:sockets/tcp@0.2.0"), __import_name__("[method]tcp-socket.hop-limit"))) -extern void __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_hop_limit(int32_t, int32_t); +extern void __wasm_import_wasi_sockets_tcp_method_tcp_socket_hop_limit(int32_t, uint8_t *); __attribute__((__import_module__("wasi:sockets/tcp@0.2.0"), __import_name__("[method]tcp-socket.set-hop-limit"))) -extern void __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_set_hop_limit(int32_t, int32_t, int32_t); +extern void __wasm_import_wasi_sockets_tcp_method_tcp_socket_set_hop_limit(int32_t, int32_t, uint8_t *); __attribute__((__import_module__("wasi:sockets/tcp@0.2.0"), __import_name__("[method]tcp-socket.receive-buffer-size"))) -extern void __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_receive_buffer_size(int32_t, int32_t); +extern void __wasm_import_wasi_sockets_tcp_method_tcp_socket_receive_buffer_size(int32_t, uint8_t *); __attribute__((__import_module__("wasi:sockets/tcp@0.2.0"), __import_name__("[method]tcp-socket.set-receive-buffer-size"))) -extern void __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_set_receive_buffer_size(int32_t, int64_t, int32_t); +extern void __wasm_import_wasi_sockets_tcp_method_tcp_socket_set_receive_buffer_size(int32_t, int64_t, uint8_t *); __attribute__((__import_module__("wasi:sockets/tcp@0.2.0"), __import_name__("[method]tcp-socket.send-buffer-size"))) -extern void __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_send_buffer_size(int32_t, int32_t); +extern void __wasm_import_wasi_sockets_tcp_method_tcp_socket_send_buffer_size(int32_t, uint8_t *); __attribute__((__import_module__("wasi:sockets/tcp@0.2.0"), __import_name__("[method]tcp-socket.set-send-buffer-size"))) -extern void __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_set_send_buffer_size(int32_t, int64_t, int32_t); +extern void __wasm_import_wasi_sockets_tcp_method_tcp_socket_set_send_buffer_size(int32_t, int64_t, uint8_t *); __attribute__((__import_module__("wasi:sockets/tcp@0.2.0"), __import_name__("[method]tcp-socket.subscribe"))) -extern int32_t __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_subscribe(int32_t); +extern int32_t __wasm_import_wasi_sockets_tcp_method_tcp_socket_subscribe(int32_t); __attribute__((__import_module__("wasi:sockets/tcp@0.2.0"), __import_name__("[method]tcp-socket.shutdown"))) -extern void __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_shutdown(int32_t, int32_t, int32_t); +extern void __wasm_import_wasi_sockets_tcp_method_tcp_socket_shutdown(int32_t, int32_t, uint8_t *); + +// Imported Functions from `wasi:sockets/tcp-create-socket@0.2.0` __attribute__((__import_module__("wasi:sockets/tcp-create-socket@0.2.0"), __import_name__("create-tcp-socket"))) -extern void __wasm_import_wasi_sockets_0_2_0_tcp_create_socket_create_tcp_socket(int32_t, int32_t); +extern void __wasm_import_wasi_sockets_tcp_create_socket_create_tcp_socket(int32_t, uint8_t *); + +// Imported Functions from `wasi:sockets/ip-name-lookup@0.2.0` __attribute__((__import_module__("wasi:sockets/ip-name-lookup@0.2.0"), __import_name__("resolve-addresses"))) -extern void __wasm_import_wasi_sockets_0_2_0_ip_name_lookup_resolve_addresses(int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_wasi_sockets_ip_name_lookup_resolve_addresses(int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("wasi:sockets/ip-name-lookup@0.2.0"), __import_name__("[method]resolve-address-stream.resolve-next-address"))) -extern void __wasm_import_wasi_sockets_0_2_0_ip_name_lookup_method_resolve_address_stream_resolve_next_address(int32_t, int32_t); +extern void __wasm_import_wasi_sockets_ip_name_lookup_method_resolve_address_stream_resolve_next_address(int32_t, uint8_t *); __attribute__((__import_module__("wasi:sockets/ip-name-lookup@0.2.0"), __import_name__("[method]resolve-address-stream.subscribe"))) -extern int32_t __wasm_import_wasi_sockets_0_2_0_ip_name_lookup_method_resolve_address_stream_subscribe(int32_t); +extern int32_t __wasm_import_wasi_sockets_ip_name_lookup_method_resolve_address_stream_subscribe(int32_t); + +// Imported Functions from `wasi:random/random@0.2.0` __attribute__((__import_module__("wasi:random/random@0.2.0"), __import_name__("get-random-bytes"))) -extern void __wasm_import_wasi_random_0_2_0_random_get_random_bytes(int64_t, int32_t); +extern void __wasm_import_wasi_random_random_get_random_bytes(int64_t, uint8_t *); __attribute__((__import_module__("wasi:random/random@0.2.0"), __import_name__("get-random-u64"))) -extern int64_t __wasm_import_wasi_random_0_2_0_random_get_random_u64(void); +extern int64_t __wasm_import_wasi_random_random_get_random_u64(void); + +// Imported Functions from `wasi:random/insecure@0.2.0` __attribute__((__import_module__("wasi:random/insecure@0.2.0"), __import_name__("get-insecure-random-bytes"))) -extern void __wasm_import_wasi_random_0_2_0_insecure_get_insecure_random_bytes(int64_t, int32_t); +extern void __wasm_import_wasi_random_insecure_get_insecure_random_bytes(int64_t, uint8_t *); __attribute__((__import_module__("wasi:random/insecure@0.2.0"), __import_name__("get-insecure-random-u64"))) -extern int64_t __wasm_import_wasi_random_0_2_0_insecure_get_insecure_random_u64(void); +extern int64_t __wasm_import_wasi_random_insecure_get_insecure_random_u64(void); + +// Imported Functions from `wasi:random/insecure-seed@0.2.0` __attribute__((__import_module__("wasi:random/insecure-seed@0.2.0"), __import_name__("insecure-seed"))) -extern void __wasm_import_wasi_random_0_2_0_insecure_seed_insecure_seed(int32_t); +extern void __wasm_import_wasi_random_insecure_seed_insecure_seed(uint8_t *); + +// Imported Functions from `wasi:http/types@0.2.0` __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("http-error-code"))) -extern void __wasm_import_wasi_http_0_2_0_types_http_error_code(int32_t, int32_t); +extern void __wasm_import_wasi_http_types_http_error_code(int32_t, uint8_t *); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[constructor]fields"))) -extern int32_t __wasm_import_wasi_http_0_2_0_types_constructor_fields(void); +extern int32_t __wasm_import_wasi_http_types_constructor_fields(void); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[static]fields.from-list"))) -extern void __wasm_import_wasi_http_0_2_0_types_static_fields_from_list(int32_t, int32_t, int32_t); +extern void __wasm_import_wasi_http_types_static_fields_from_list(uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[method]fields.get"))) -extern void __wasm_import_wasi_http_0_2_0_types_method_fields_get(int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_wasi_http_types_method_fields_get(int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[method]fields.has"))) -extern int32_t __wasm_import_wasi_http_0_2_0_types_method_fields_has(int32_t, int32_t, int32_t); +extern int32_t __wasm_import_wasi_http_types_method_fields_has(int32_t, uint8_t *, size_t); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[method]fields.set"))) -extern void __wasm_import_wasi_http_0_2_0_types_method_fields_set(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_wasi_http_types_method_fields_set(int32_t, uint8_t *, size_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[method]fields.delete"))) -extern void __wasm_import_wasi_http_0_2_0_types_method_fields_delete(int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_wasi_http_types_method_fields_delete(int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[method]fields.append"))) -extern void __wasm_import_wasi_http_0_2_0_types_method_fields_append(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_wasi_http_types_method_fields_append(int32_t, uint8_t *, size_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[method]fields.entries"))) -extern void __wasm_import_wasi_http_0_2_0_types_method_fields_entries(int32_t, int32_t); +extern void __wasm_import_wasi_http_types_method_fields_entries(int32_t, uint8_t *); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[method]fields.clone"))) -extern int32_t __wasm_import_wasi_http_0_2_0_types_method_fields_clone(int32_t); +extern int32_t __wasm_import_wasi_http_types_method_fields_clone(int32_t); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[method]incoming-request.method"))) -extern void __wasm_import_wasi_http_0_2_0_types_method_incoming_request_method(int32_t, int32_t); +extern void __wasm_import_wasi_http_types_method_incoming_request_method(int32_t, uint8_t *); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[method]incoming-request.path-with-query"))) -extern void __wasm_import_wasi_http_0_2_0_types_method_incoming_request_path_with_query(int32_t, int32_t); +extern void __wasm_import_wasi_http_types_method_incoming_request_path_with_query(int32_t, uint8_t *); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[method]incoming-request.scheme"))) -extern void __wasm_import_wasi_http_0_2_0_types_method_incoming_request_scheme(int32_t, int32_t); +extern void __wasm_import_wasi_http_types_method_incoming_request_scheme(int32_t, uint8_t *); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[method]incoming-request.authority"))) -extern void __wasm_import_wasi_http_0_2_0_types_method_incoming_request_authority(int32_t, int32_t); +extern void __wasm_import_wasi_http_types_method_incoming_request_authority(int32_t, uint8_t *); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[method]incoming-request.headers"))) -extern int32_t __wasm_import_wasi_http_0_2_0_types_method_incoming_request_headers(int32_t); +extern int32_t __wasm_import_wasi_http_types_method_incoming_request_headers(int32_t); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[method]incoming-request.consume"))) -extern void __wasm_import_wasi_http_0_2_0_types_method_incoming_request_consume(int32_t, int32_t); +extern void __wasm_import_wasi_http_types_method_incoming_request_consume(int32_t, uint8_t *); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[constructor]outgoing-request"))) -extern int32_t __wasm_import_wasi_http_0_2_0_types_constructor_outgoing_request(int32_t); +extern int32_t __wasm_import_wasi_http_types_constructor_outgoing_request(int32_t); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[method]outgoing-request.body"))) -extern void __wasm_import_wasi_http_0_2_0_types_method_outgoing_request_body(int32_t, int32_t); +extern void __wasm_import_wasi_http_types_method_outgoing_request_body(int32_t, uint8_t *); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[method]outgoing-request.method"))) -extern void __wasm_import_wasi_http_0_2_0_types_method_outgoing_request_method(int32_t, int32_t); +extern void __wasm_import_wasi_http_types_method_outgoing_request_method(int32_t, uint8_t *); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[method]outgoing-request.set-method"))) -extern int32_t __wasm_import_wasi_http_0_2_0_types_method_outgoing_request_set_method(int32_t, int32_t, int32_t, int32_t); +extern int32_t __wasm_import_wasi_http_types_method_outgoing_request_set_method(int32_t, int32_t, uint8_t *, size_t); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[method]outgoing-request.path-with-query"))) -extern void __wasm_import_wasi_http_0_2_0_types_method_outgoing_request_path_with_query(int32_t, int32_t); +extern void __wasm_import_wasi_http_types_method_outgoing_request_path_with_query(int32_t, uint8_t *); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[method]outgoing-request.set-path-with-query"))) -extern int32_t __wasm_import_wasi_http_0_2_0_types_method_outgoing_request_set_path_with_query(int32_t, int32_t, int32_t, int32_t); +extern int32_t __wasm_import_wasi_http_types_method_outgoing_request_set_path_with_query(int32_t, int32_t, uint8_t *, size_t); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[method]outgoing-request.scheme"))) -extern void __wasm_import_wasi_http_0_2_0_types_method_outgoing_request_scheme(int32_t, int32_t); +extern void __wasm_import_wasi_http_types_method_outgoing_request_scheme(int32_t, uint8_t *); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[method]outgoing-request.set-scheme"))) -extern int32_t __wasm_import_wasi_http_0_2_0_types_method_outgoing_request_set_scheme(int32_t, int32_t, int32_t, int32_t, int32_t); +extern int32_t __wasm_import_wasi_http_types_method_outgoing_request_set_scheme(int32_t, int32_t, int32_t, uint8_t *, size_t); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[method]outgoing-request.authority"))) -extern void __wasm_import_wasi_http_0_2_0_types_method_outgoing_request_authority(int32_t, int32_t); +extern void __wasm_import_wasi_http_types_method_outgoing_request_authority(int32_t, uint8_t *); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[method]outgoing-request.set-authority"))) -extern int32_t __wasm_import_wasi_http_0_2_0_types_method_outgoing_request_set_authority(int32_t, int32_t, int32_t, int32_t); +extern int32_t __wasm_import_wasi_http_types_method_outgoing_request_set_authority(int32_t, int32_t, uint8_t *, size_t); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[method]outgoing-request.headers"))) -extern int32_t __wasm_import_wasi_http_0_2_0_types_method_outgoing_request_headers(int32_t); +extern int32_t __wasm_import_wasi_http_types_method_outgoing_request_headers(int32_t); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[constructor]request-options"))) -extern int32_t __wasm_import_wasi_http_0_2_0_types_constructor_request_options(void); +extern int32_t __wasm_import_wasi_http_types_constructor_request_options(void); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[method]request-options.connect-timeout"))) -extern void __wasm_import_wasi_http_0_2_0_types_method_request_options_connect_timeout(int32_t, int32_t); +extern void __wasm_import_wasi_http_types_method_request_options_connect_timeout(int32_t, uint8_t *); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[method]request-options.set-connect-timeout"))) -extern int32_t __wasm_import_wasi_http_0_2_0_types_method_request_options_set_connect_timeout(int32_t, int32_t, int64_t); +extern int32_t __wasm_import_wasi_http_types_method_request_options_set_connect_timeout(int32_t, int32_t, int64_t); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[method]request-options.first-byte-timeout"))) -extern void __wasm_import_wasi_http_0_2_0_types_method_request_options_first_byte_timeout(int32_t, int32_t); +extern void __wasm_import_wasi_http_types_method_request_options_first_byte_timeout(int32_t, uint8_t *); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[method]request-options.set-first-byte-timeout"))) -extern int32_t __wasm_import_wasi_http_0_2_0_types_method_request_options_set_first_byte_timeout(int32_t, int32_t, int64_t); +extern int32_t __wasm_import_wasi_http_types_method_request_options_set_first_byte_timeout(int32_t, int32_t, int64_t); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[method]request-options.between-bytes-timeout"))) -extern void __wasm_import_wasi_http_0_2_0_types_method_request_options_between_bytes_timeout(int32_t, int32_t); +extern void __wasm_import_wasi_http_types_method_request_options_between_bytes_timeout(int32_t, uint8_t *); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[method]request-options.set-between-bytes-timeout"))) -extern int32_t __wasm_import_wasi_http_0_2_0_types_method_request_options_set_between_bytes_timeout(int32_t, int32_t, int64_t); +extern int32_t __wasm_import_wasi_http_types_method_request_options_set_between_bytes_timeout(int32_t, int32_t, int64_t); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[static]response-outparam.set"))) -extern void __wasm_import_wasi_http_0_2_0_types_static_response_outparam_set(int32_t, int32_t, int32_t, int32_t, int64_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_wasi_http_types_static_response_outparam_set(int32_t, int32_t, int32_t, int32_t, int64_t, uint8_t *, uint8_t *, size_t, int32_t); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[method]incoming-response.status"))) -extern int32_t __wasm_import_wasi_http_0_2_0_types_method_incoming_response_status(int32_t); +extern int32_t __wasm_import_wasi_http_types_method_incoming_response_status(int32_t); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[method]incoming-response.headers"))) -extern int32_t __wasm_import_wasi_http_0_2_0_types_method_incoming_response_headers(int32_t); +extern int32_t __wasm_import_wasi_http_types_method_incoming_response_headers(int32_t); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[method]incoming-response.consume"))) -extern void __wasm_import_wasi_http_0_2_0_types_method_incoming_response_consume(int32_t, int32_t); +extern void __wasm_import_wasi_http_types_method_incoming_response_consume(int32_t, uint8_t *); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[method]incoming-body.stream"))) -extern void __wasm_import_wasi_http_0_2_0_types_method_incoming_body_stream(int32_t, int32_t); +extern void __wasm_import_wasi_http_types_method_incoming_body_stream(int32_t, uint8_t *); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[static]incoming-body.finish"))) -extern int32_t __wasm_import_wasi_http_0_2_0_types_static_incoming_body_finish(int32_t); +extern int32_t __wasm_import_wasi_http_types_static_incoming_body_finish(int32_t); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[method]future-trailers.subscribe"))) -extern int32_t __wasm_import_wasi_http_0_2_0_types_method_future_trailers_subscribe(int32_t); +extern int32_t __wasm_import_wasi_http_types_method_future_trailers_subscribe(int32_t); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[method]future-trailers.get"))) -extern void __wasm_import_wasi_http_0_2_0_types_method_future_trailers_get(int32_t, int32_t); +extern void __wasm_import_wasi_http_types_method_future_trailers_get(int32_t, uint8_t *); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[constructor]outgoing-response"))) -extern int32_t __wasm_import_wasi_http_0_2_0_types_constructor_outgoing_response(int32_t); +extern int32_t __wasm_import_wasi_http_types_constructor_outgoing_response(int32_t); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[method]outgoing-response.status-code"))) -extern int32_t __wasm_import_wasi_http_0_2_0_types_method_outgoing_response_status_code(int32_t); +extern int32_t __wasm_import_wasi_http_types_method_outgoing_response_status_code(int32_t); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[method]outgoing-response.set-status-code"))) -extern int32_t __wasm_import_wasi_http_0_2_0_types_method_outgoing_response_set_status_code(int32_t, int32_t); +extern int32_t __wasm_import_wasi_http_types_method_outgoing_response_set_status_code(int32_t, int32_t); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[method]outgoing-response.headers"))) -extern int32_t __wasm_import_wasi_http_0_2_0_types_method_outgoing_response_headers(int32_t); +extern int32_t __wasm_import_wasi_http_types_method_outgoing_response_headers(int32_t); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[method]outgoing-response.body"))) -extern void __wasm_import_wasi_http_0_2_0_types_method_outgoing_response_body(int32_t, int32_t); +extern void __wasm_import_wasi_http_types_method_outgoing_response_body(int32_t, uint8_t *); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[method]outgoing-body.write"))) -extern void __wasm_import_wasi_http_0_2_0_types_method_outgoing_body_write(int32_t, int32_t); +extern void __wasm_import_wasi_http_types_method_outgoing_body_write(int32_t, uint8_t *); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[static]outgoing-body.finish"))) -extern void __wasm_import_wasi_http_0_2_0_types_static_outgoing_body_finish(int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_wasi_http_types_static_outgoing_body_finish(int32_t, int32_t, int32_t, uint8_t *); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[method]future-incoming-response.subscribe"))) -extern int32_t __wasm_import_wasi_http_0_2_0_types_method_future_incoming_response_subscribe(int32_t); +extern int32_t __wasm_import_wasi_http_types_method_future_incoming_response_subscribe(int32_t); __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[method]future-incoming-response.get"))) -extern void __wasm_import_wasi_http_0_2_0_types_method_future_incoming_response_get(int32_t, int32_t); +extern void __wasm_import_wasi_http_types_method_future_incoming_response_get(int32_t, uint8_t *); + +// Imported Functions from `wasi:http/outgoing-handler@0.2.0` __attribute__((__import_module__("wasi:http/outgoing-handler@0.2.0"), __import_name__("handle"))) -extern void __wasm_import_wasi_http_0_2_0_outgoing_handler_handle(int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_wasi_http_outgoing_handler_handle(int32_t, int32_t, int32_t, uint8_t *); + +// Exported Functions from `wasi:cli/run@0.2.0` + + +// Exported Functions from `wasi:http/incoming-handler@0.2.0` + + +// Canonical ABI intrinsics __attribute__((__weak__, __export_name__("cabi_realloc"))) void *cabi_realloc(void *ptr, size_t old_size, size_t align, size_t new_size) { @@ -538,93 +609,104 @@ void *cabi_realloc(void *ptr, size_t old_size, size_t align, size_t new_size) { // Helper Functions -void gcore_fastedge_dictionary_option_string_free(gcore_fastedge_dictionary_option_string_t *ptr) { +void bindings_option_string_free(bindings_option_string_t *ptr) { if (ptr->is_some) { bindings_string_free(&ptr->val); } } -void wasi_cli_0_2_0_environment_tuple2_string_string_free(wasi_cli_0_2_0_environment_tuple2_string_string_t *ptr) { - bindings_string_free(&ptr->f0); - bindings_string_free(&ptr->f1); +void gcore_fastedge_secret_error_free(gcore_fastedge_secret_error_t *ptr) { + switch ((int32_t) ptr->tag) { + case 2: { + bindings_string_free(&ptr->val.other); + break; + } + } } -void wasi_cli_0_2_0_environment_list_tuple2_string_string_free(wasi_cli_0_2_0_environment_list_tuple2_string_string_t *ptr) { - for (size_t i = 0; i < ptr->len; i++) { - wasi_cli_0_2_0_environment_tuple2_string_string_free(&ptr->ptr[i]); - } - if (ptr->len > 0) { - free(ptr->ptr); +void gcore_fastedge_secret_result_option_string_error_free(gcore_fastedge_secret_result_option_string_error_t *ptr) { + if (!ptr->is_err) { + bindings_option_string_free(&ptr->val.ok); + } else { + gcore_fastedge_secret_error_free(&ptr->val.err); } } -void wasi_cli_0_2_0_environment_list_string_free(wasi_cli_0_2_0_environment_list_string_t *ptr) { - for (size_t i = 0; i < ptr->len; i++) { - bindings_string_free(&ptr->ptr[i]); - } - if (ptr->len > 0) { - free(ptr->ptr); +void bindings_tuple2_string_string_free(bindings_tuple2_string_string_t *ptr) { + bindings_string_free(&ptr->f0); + bindings_string_free(&ptr->f1); +} + +void bindings_list_tuple2_string_string_free(bindings_list_tuple2_string_string_t *ptr) { + size_t list_len = ptr->len; + if (list_len > 0) { + bindings_tuple2_string_string_t *list_ptr = ptr->ptr; + for (size_t i = 0; i < list_len; i++) { + bindings_tuple2_string_string_free(&list_ptr[i]); + } + free(list_ptr); } } -void wasi_cli_0_2_0_environment_option_string_free(wasi_cli_0_2_0_environment_option_string_t *ptr) { - if (ptr->is_some) { - bindings_string_free(&ptr->val); +void bindings_list_string_free(bindings_list_string_t *ptr) { + size_t list_len = ptr->len; + if (list_len > 0) { + bindings_string_t *list_ptr = ptr->ptr; + for (size_t i = 0; i < list_len; i++) { + bindings_string_free(&list_ptr[i]); + } + free(list_ptr); } } -void wasi_cli_0_2_0_exit_result_void_void_free(wasi_cli_0_2_0_exit_result_void_void_t *ptr) { +void wasi_cli_exit_result_void_void_free(wasi_cli_exit_result_void_void_t *ptr) { if (!ptr->is_err) { } } __attribute__((__import_module__("wasi:io/error@0.2.0"), __import_name__("[resource-drop]error"))) -extern void __wasm_import_wasi_io_0_2_0_error_error_drop(int32_t handle); - -void wasi_io_0_2_0_error_error_drop_own(wasi_io_0_2_0_error_own_error_t handle) { - __wasm_import_wasi_io_0_2_0_error_error_drop(handle.__handle); -} +extern void __wasm_import_wasi_io_error_error_drop(int32_t handle); -void wasi_io_0_2_0_error_error_drop_borrow(wasi_io_0_2_0_error_own_error_t handle) { - __wasm_import_wasi_io_0_2_0_error_error_drop(handle.__handle); +void wasi_io_error_error_drop_own(wasi_io_error_own_error_t handle) { + __wasm_import_wasi_io_error_error_drop(handle.__handle); } -wasi_io_0_2_0_error_borrow_error_t wasi_io_0_2_0_error_borrow_error(wasi_io_0_2_0_error_own_error_t arg) { - return (wasi_io_0_2_0_error_borrow_error_t) { arg.__handle }; +wasi_io_error_borrow_error_t wasi_io_error_borrow_error(wasi_io_error_own_error_t arg) { + return (wasi_io_error_borrow_error_t) { arg.__handle }; } __attribute__((__import_module__("wasi:io/poll@0.2.0"), __import_name__("[resource-drop]pollable"))) -extern void __wasm_import_wasi_io_0_2_0_poll_pollable_drop(int32_t handle); - -void wasi_io_0_2_0_poll_pollable_drop_own(wasi_io_0_2_0_poll_own_pollable_t handle) { - __wasm_import_wasi_io_0_2_0_poll_pollable_drop(handle.__handle); -} +extern void __wasm_import_wasi_io_poll_pollable_drop(int32_t handle); -void wasi_io_0_2_0_poll_pollable_drop_borrow(wasi_io_0_2_0_poll_own_pollable_t handle) { - __wasm_import_wasi_io_0_2_0_poll_pollable_drop(handle.__handle); +void wasi_io_poll_pollable_drop_own(wasi_io_poll_own_pollable_t handle) { + __wasm_import_wasi_io_poll_pollable_drop(handle.__handle); } -wasi_io_0_2_0_poll_borrow_pollable_t wasi_io_0_2_0_poll_borrow_pollable(wasi_io_0_2_0_poll_own_pollable_t arg) { - return (wasi_io_0_2_0_poll_borrow_pollable_t) { arg.__handle }; +wasi_io_poll_borrow_pollable_t wasi_io_poll_borrow_pollable(wasi_io_poll_own_pollable_t arg) { + return (wasi_io_poll_borrow_pollable_t) { arg.__handle }; } -void wasi_io_0_2_0_poll_list_borrow_pollable_free(wasi_io_0_2_0_poll_list_borrow_pollable_t *ptr) { - for (size_t i = 0; i < ptr->len; i++) { - } - if (ptr->len > 0) { - free(ptr->ptr); +void wasi_io_poll_list_borrow_pollable_free(wasi_io_poll_list_borrow_pollable_t *ptr) { + size_t list_len = ptr->len; + if (list_len > 0) { + wasi_io_poll_borrow_pollable_t *list_ptr = ptr->ptr; + for (size_t i = 0; i < list_len; i++) { + } + free(list_ptr); } } -void wasi_io_0_2_0_poll_list_u32_free(wasi_io_0_2_0_poll_list_u32_t *ptr) { - for (size_t i = 0; i < ptr->len; i++) { - } - if (ptr->len > 0) { - free(ptr->ptr); +void bindings_list_u32_free(bindings_list_u32_t *ptr) { + size_t list_len = ptr->len; + if (list_len > 0) { + uint32_t *list_ptr = ptr->ptr; + for (size_t i = 0; i < list_len; i++) { + } + free(list_ptr); } } -void wasi_io_0_2_0_streams_stream_error_free(wasi_io_0_2_0_streams_stream_error_t *ptr) { +void wasi_io_streams_stream_error_free(wasi_io_streams_stream_error_t *ptr) { switch ((int32_t) ptr->tag) { case 0: { break; @@ -633,122 +715,108 @@ void wasi_io_0_2_0_streams_stream_error_free(wasi_io_0_2_0_streams_stream_error_ } __attribute__((__import_module__("wasi:io/streams@0.2.0"), __import_name__("[resource-drop]input-stream"))) -extern void __wasm_import_wasi_io_0_2_0_streams_input_stream_drop(int32_t handle); +extern void __wasm_import_wasi_io_streams_input_stream_drop(int32_t handle); -void wasi_io_0_2_0_streams_input_stream_drop_own(wasi_io_0_2_0_streams_own_input_stream_t handle) { - __wasm_import_wasi_io_0_2_0_streams_input_stream_drop(handle.__handle); +void wasi_io_streams_input_stream_drop_own(wasi_io_streams_own_input_stream_t handle) { + __wasm_import_wasi_io_streams_input_stream_drop(handle.__handle); } -void wasi_io_0_2_0_streams_input_stream_drop_borrow(wasi_io_0_2_0_streams_own_input_stream_t handle) { - __wasm_import_wasi_io_0_2_0_streams_input_stream_drop(handle.__handle); -} - -wasi_io_0_2_0_streams_borrow_input_stream_t wasi_io_0_2_0_streams_borrow_input_stream(wasi_io_0_2_0_streams_own_input_stream_t arg) { - return (wasi_io_0_2_0_streams_borrow_input_stream_t) { arg.__handle }; +wasi_io_streams_borrow_input_stream_t wasi_io_streams_borrow_input_stream(wasi_io_streams_own_input_stream_t arg) { + return (wasi_io_streams_borrow_input_stream_t) { arg.__handle }; } __attribute__((__import_module__("wasi:io/streams@0.2.0"), __import_name__("[resource-drop]output-stream"))) -extern void __wasm_import_wasi_io_0_2_0_streams_output_stream_drop(int32_t handle); - -void wasi_io_0_2_0_streams_output_stream_drop_own(wasi_io_0_2_0_streams_own_output_stream_t handle) { - __wasm_import_wasi_io_0_2_0_streams_output_stream_drop(handle.__handle); -} +extern void __wasm_import_wasi_io_streams_output_stream_drop(int32_t handle); -void wasi_io_0_2_0_streams_output_stream_drop_borrow(wasi_io_0_2_0_streams_own_output_stream_t handle) { - __wasm_import_wasi_io_0_2_0_streams_output_stream_drop(handle.__handle); +void wasi_io_streams_output_stream_drop_own(wasi_io_streams_own_output_stream_t handle) { + __wasm_import_wasi_io_streams_output_stream_drop(handle.__handle); } -wasi_io_0_2_0_streams_borrow_output_stream_t wasi_io_0_2_0_streams_borrow_output_stream(wasi_io_0_2_0_streams_own_output_stream_t arg) { - return (wasi_io_0_2_0_streams_borrow_output_stream_t) { arg.__handle }; +wasi_io_streams_borrow_output_stream_t wasi_io_streams_borrow_output_stream(wasi_io_streams_own_output_stream_t arg) { + return (wasi_io_streams_borrow_output_stream_t) { arg.__handle }; } -void wasi_io_0_2_0_streams_list_u8_free(wasi_io_0_2_0_streams_list_u8_t *ptr) { - for (size_t i = 0; i < ptr->len; i++) { - } - if (ptr->len > 0) { - free(ptr->ptr); +void bindings_list_u8_free(bindings_list_u8_t *ptr) { + size_t list_len = ptr->len; + if (list_len > 0) { + uint8_t *list_ptr = ptr->ptr; + for (size_t i = 0; i < list_len; i++) { + } + free(list_ptr); } } -void wasi_io_0_2_0_streams_result_list_u8_stream_error_free(wasi_io_0_2_0_streams_result_list_u8_stream_error_t *ptr) { +void wasi_io_streams_result_list_u8_stream_error_free(wasi_io_streams_result_list_u8_stream_error_t *ptr) { if (!ptr->is_err) { - wasi_io_0_2_0_streams_list_u8_free(&ptr->val.ok); + bindings_list_u8_free(&ptr->val.ok); } else { - wasi_io_0_2_0_streams_stream_error_free(&ptr->val.err); + wasi_io_streams_stream_error_free(&ptr->val.err); } } -void wasi_io_0_2_0_streams_result_u64_stream_error_free(wasi_io_0_2_0_streams_result_u64_stream_error_t *ptr) { +void wasi_io_streams_result_u64_stream_error_free(wasi_io_streams_result_u64_stream_error_t *ptr) { if (!ptr->is_err) { } else { - wasi_io_0_2_0_streams_stream_error_free(&ptr->val.err); + wasi_io_streams_stream_error_free(&ptr->val.err); } } -void wasi_io_0_2_0_streams_result_void_stream_error_free(wasi_io_0_2_0_streams_result_void_stream_error_t *ptr) { +void wasi_io_streams_result_void_stream_error_free(wasi_io_streams_result_void_stream_error_t *ptr) { if (!ptr->is_err) { } else { - wasi_io_0_2_0_streams_stream_error_free(&ptr->val.err); + wasi_io_streams_stream_error_free(&ptr->val.err); } } __attribute__((__import_module__("wasi:cli/terminal-input@0.2.0"), __import_name__("[resource-drop]terminal-input"))) -extern void __wasm_import_wasi_cli_0_2_0_terminal_input_terminal_input_drop(int32_t handle); - -void wasi_cli_0_2_0_terminal_input_terminal_input_drop_own(wasi_cli_0_2_0_terminal_input_own_terminal_input_t handle) { - __wasm_import_wasi_cli_0_2_0_terminal_input_terminal_input_drop(handle.__handle); -} +extern void __wasm_import_wasi_cli_terminal_input_terminal_input_drop(int32_t handle); -void wasi_cli_0_2_0_terminal_input_terminal_input_drop_borrow(wasi_cli_0_2_0_terminal_input_own_terminal_input_t handle) { - __wasm_import_wasi_cli_0_2_0_terminal_input_terminal_input_drop(handle.__handle); +void wasi_cli_terminal_input_terminal_input_drop_own(wasi_cli_terminal_input_own_terminal_input_t handle) { + __wasm_import_wasi_cli_terminal_input_terminal_input_drop(handle.__handle); } -wasi_cli_0_2_0_terminal_input_borrow_terminal_input_t wasi_cli_0_2_0_terminal_input_borrow_terminal_input(wasi_cli_0_2_0_terminal_input_own_terminal_input_t arg) { - return (wasi_cli_0_2_0_terminal_input_borrow_terminal_input_t) { arg.__handle }; +wasi_cli_terminal_input_borrow_terminal_input_t wasi_cli_terminal_input_borrow_terminal_input(wasi_cli_terminal_input_own_terminal_input_t arg) { + return (wasi_cli_terminal_input_borrow_terminal_input_t) { arg.__handle }; } __attribute__((__import_module__("wasi:cli/terminal-output@0.2.0"), __import_name__("[resource-drop]terminal-output"))) -extern void __wasm_import_wasi_cli_0_2_0_terminal_output_terminal_output_drop(int32_t handle); +extern void __wasm_import_wasi_cli_terminal_output_terminal_output_drop(int32_t handle); -void wasi_cli_0_2_0_terminal_output_terminal_output_drop_own(wasi_cli_0_2_0_terminal_output_own_terminal_output_t handle) { - __wasm_import_wasi_cli_0_2_0_terminal_output_terminal_output_drop(handle.__handle); +void wasi_cli_terminal_output_terminal_output_drop_own(wasi_cli_terminal_output_own_terminal_output_t handle) { + __wasm_import_wasi_cli_terminal_output_terminal_output_drop(handle.__handle); } -void wasi_cli_0_2_0_terminal_output_terminal_output_drop_borrow(wasi_cli_0_2_0_terminal_output_own_terminal_output_t handle) { - __wasm_import_wasi_cli_0_2_0_terminal_output_terminal_output_drop(handle.__handle); +wasi_cli_terminal_output_borrow_terminal_output_t wasi_cli_terminal_output_borrow_terminal_output(wasi_cli_terminal_output_own_terminal_output_t arg) { + return (wasi_cli_terminal_output_borrow_terminal_output_t) { arg.__handle }; } -wasi_cli_0_2_0_terminal_output_borrow_terminal_output_t wasi_cli_0_2_0_terminal_output_borrow_terminal_output(wasi_cli_0_2_0_terminal_output_own_terminal_output_t arg) { - return (wasi_cli_0_2_0_terminal_output_borrow_terminal_output_t) { arg.__handle }; -} - -void wasi_cli_0_2_0_terminal_stdin_option_own_terminal_input_free(wasi_cli_0_2_0_terminal_stdin_option_own_terminal_input_t *ptr) { +void wasi_cli_terminal_stdin_option_own_terminal_input_free(wasi_cli_terminal_stdin_option_own_terminal_input_t *ptr) { if (ptr->is_some) { } } -void wasi_cli_0_2_0_terminal_stdout_option_own_terminal_output_free(wasi_cli_0_2_0_terminal_stdout_option_own_terminal_output_t *ptr) { +void wasi_cli_terminal_stdout_option_own_terminal_output_free(wasi_cli_terminal_stdout_option_own_terminal_output_t *ptr) { if (ptr->is_some) { } } -void wasi_cli_0_2_0_terminal_stderr_option_own_terminal_output_free(wasi_cli_0_2_0_terminal_stderr_option_own_terminal_output_t *ptr) { +void wasi_cli_terminal_stderr_option_own_terminal_output_free(wasi_cli_terminal_stderr_option_own_terminal_output_t *ptr) { if (ptr->is_some) { } } -void wasi_filesystem_0_2_0_types_option_datetime_free(wasi_filesystem_0_2_0_types_option_datetime_t *ptr) { +void wasi_filesystem_types_option_datetime_free(wasi_filesystem_types_option_datetime_t *ptr) { if (ptr->is_some) { } } -void wasi_filesystem_0_2_0_types_descriptor_stat_free(wasi_filesystem_0_2_0_types_descriptor_stat_t *ptr) { - wasi_filesystem_0_2_0_types_option_datetime_free(&ptr->data_access_timestamp); - wasi_filesystem_0_2_0_types_option_datetime_free(&ptr->data_modification_timestamp); - wasi_filesystem_0_2_0_types_option_datetime_free(&ptr->status_change_timestamp); +void wasi_filesystem_types_descriptor_stat_free(wasi_filesystem_types_descriptor_stat_t *ptr) { + wasi_filesystem_types_option_datetime_free(&ptr->data_access_timestamp); + wasi_filesystem_types_option_datetime_free(&ptr->data_modification_timestamp); + wasi_filesystem_types_option_datetime_free(&ptr->status_change_timestamp); } -void wasi_filesystem_0_2_0_types_new_timestamp_free(wasi_filesystem_0_2_0_types_new_timestamp_t *ptr) { +void wasi_filesystem_types_new_timestamp_free(wasi_filesystem_types_new_timestamp_t *ptr) { switch ((int32_t) ptr->tag) { case 2: { break; @@ -756,174 +824,151 @@ void wasi_filesystem_0_2_0_types_new_timestamp_free(wasi_filesystem_0_2_0_types_ } } -void wasi_filesystem_0_2_0_types_directory_entry_free(wasi_filesystem_0_2_0_types_directory_entry_t *ptr) { +void wasi_filesystem_types_directory_entry_free(wasi_filesystem_types_directory_entry_t *ptr) { bindings_string_free(&ptr->name); } __attribute__((__import_module__("wasi:filesystem/types@0.2.0"), __import_name__("[resource-drop]descriptor"))) -extern void __wasm_import_wasi_filesystem_0_2_0_types_descriptor_drop(int32_t handle); +extern void __wasm_import_wasi_filesystem_types_descriptor_drop(int32_t handle); -void wasi_filesystem_0_2_0_types_descriptor_drop_own(wasi_filesystem_0_2_0_types_own_descriptor_t handle) { - __wasm_import_wasi_filesystem_0_2_0_types_descriptor_drop(handle.__handle); +void wasi_filesystem_types_descriptor_drop_own(wasi_filesystem_types_own_descriptor_t handle) { + __wasm_import_wasi_filesystem_types_descriptor_drop(handle.__handle); } -void wasi_filesystem_0_2_0_types_descriptor_drop_borrow(wasi_filesystem_0_2_0_types_own_descriptor_t handle) { - __wasm_import_wasi_filesystem_0_2_0_types_descriptor_drop(handle.__handle); -} - -wasi_filesystem_0_2_0_types_borrow_descriptor_t wasi_filesystem_0_2_0_types_borrow_descriptor(wasi_filesystem_0_2_0_types_own_descriptor_t arg) { - return (wasi_filesystem_0_2_0_types_borrow_descriptor_t) { arg.__handle }; +wasi_filesystem_types_borrow_descriptor_t wasi_filesystem_types_borrow_descriptor(wasi_filesystem_types_own_descriptor_t arg) { + return (wasi_filesystem_types_borrow_descriptor_t) { arg.__handle }; } __attribute__((__import_module__("wasi:filesystem/types@0.2.0"), __import_name__("[resource-drop]directory-entry-stream"))) -extern void __wasm_import_wasi_filesystem_0_2_0_types_directory_entry_stream_drop(int32_t handle); +extern void __wasm_import_wasi_filesystem_types_directory_entry_stream_drop(int32_t handle); -void wasi_filesystem_0_2_0_types_directory_entry_stream_drop_own(wasi_filesystem_0_2_0_types_own_directory_entry_stream_t handle) { - __wasm_import_wasi_filesystem_0_2_0_types_directory_entry_stream_drop(handle.__handle); +void wasi_filesystem_types_directory_entry_stream_drop_own(wasi_filesystem_types_own_directory_entry_stream_t handle) { + __wasm_import_wasi_filesystem_types_directory_entry_stream_drop(handle.__handle); } -void wasi_filesystem_0_2_0_types_directory_entry_stream_drop_borrow(wasi_filesystem_0_2_0_types_own_directory_entry_stream_t handle) { - __wasm_import_wasi_filesystem_0_2_0_types_directory_entry_stream_drop(handle.__handle); +wasi_filesystem_types_borrow_directory_entry_stream_t wasi_filesystem_types_borrow_directory_entry_stream(wasi_filesystem_types_own_directory_entry_stream_t arg) { + return (wasi_filesystem_types_borrow_directory_entry_stream_t) { arg.__handle }; } -wasi_filesystem_0_2_0_types_borrow_directory_entry_stream_t wasi_filesystem_0_2_0_types_borrow_directory_entry_stream(wasi_filesystem_0_2_0_types_own_directory_entry_stream_t arg) { - return (wasi_filesystem_0_2_0_types_borrow_directory_entry_stream_t) { arg.__handle }; -} - -void wasi_filesystem_0_2_0_types_result_own_input_stream_error_code_free(wasi_filesystem_0_2_0_types_result_own_input_stream_error_code_t *ptr) { +void wasi_filesystem_types_result_own_input_stream_error_code_free(wasi_filesystem_types_result_own_input_stream_error_code_t *ptr) { if (!ptr->is_err) { } else { } } -void wasi_filesystem_0_2_0_types_result_own_output_stream_error_code_free(wasi_filesystem_0_2_0_types_result_own_output_stream_error_code_t *ptr) { +void wasi_filesystem_types_result_own_output_stream_error_code_free(wasi_filesystem_types_result_own_output_stream_error_code_t *ptr) { if (!ptr->is_err) { } else { } } -void wasi_filesystem_0_2_0_types_result_void_error_code_free(wasi_filesystem_0_2_0_types_result_void_error_code_t *ptr) { +void wasi_filesystem_types_result_void_error_code_free(wasi_filesystem_types_result_void_error_code_t *ptr) { if (!ptr->is_err) { } else { } } -void wasi_filesystem_0_2_0_types_result_descriptor_flags_error_code_free(wasi_filesystem_0_2_0_types_result_descriptor_flags_error_code_t *ptr) { +void wasi_filesystem_types_result_descriptor_flags_error_code_free(wasi_filesystem_types_result_descriptor_flags_error_code_t *ptr) { if (!ptr->is_err) { } else { } } -void wasi_filesystem_0_2_0_types_result_descriptor_type_error_code_free(wasi_filesystem_0_2_0_types_result_descriptor_type_error_code_t *ptr) { +void wasi_filesystem_types_result_descriptor_type_error_code_free(wasi_filesystem_types_result_descriptor_type_error_code_t *ptr) { if (!ptr->is_err) { } else { } } -void wasi_filesystem_0_2_0_types_list_u8_free(wasi_filesystem_0_2_0_types_list_u8_t *ptr) { - for (size_t i = 0; i < ptr->len; i++) { - } - if (ptr->len > 0) { - free(ptr->ptr); - } -} - -void wasi_filesystem_0_2_0_types_tuple2_list_u8_bool_free(wasi_filesystem_0_2_0_types_tuple2_list_u8_bool_t *ptr) { - wasi_filesystem_0_2_0_types_list_u8_free(&ptr->f0); -} - -void wasi_filesystem_0_2_0_types_result_tuple2_list_u8_bool_error_code_free(wasi_filesystem_0_2_0_types_result_tuple2_list_u8_bool_error_code_t *ptr) { +void wasi_filesystem_types_result_tuple2_list_u8_bool_error_code_free(wasi_filesystem_types_result_tuple2_list_u8_bool_error_code_t *ptr) { if (!ptr->is_err) { - wasi_filesystem_0_2_0_types_tuple2_list_u8_bool_free(&ptr->val.ok); } else { } } -void wasi_filesystem_0_2_0_types_result_filesize_error_code_free(wasi_filesystem_0_2_0_types_result_filesize_error_code_t *ptr) { +void wasi_filesystem_types_result_filesize_error_code_free(wasi_filesystem_types_result_filesize_error_code_t *ptr) { if (!ptr->is_err) { } else { } } -void wasi_filesystem_0_2_0_types_result_own_directory_entry_stream_error_code_free(wasi_filesystem_0_2_0_types_result_own_directory_entry_stream_error_code_t *ptr) { +void wasi_filesystem_types_result_own_directory_entry_stream_error_code_free(wasi_filesystem_types_result_own_directory_entry_stream_error_code_t *ptr) { if (!ptr->is_err) { } else { } } -void wasi_filesystem_0_2_0_types_result_descriptor_stat_error_code_free(wasi_filesystem_0_2_0_types_result_descriptor_stat_error_code_t *ptr) { +void wasi_filesystem_types_result_descriptor_stat_error_code_free(wasi_filesystem_types_result_descriptor_stat_error_code_t *ptr) { if (!ptr->is_err) { - wasi_filesystem_0_2_0_types_descriptor_stat_free(&ptr->val.ok); + wasi_filesystem_types_descriptor_stat_free(&ptr->val.ok); } else { } } -void wasi_filesystem_0_2_0_types_result_own_descriptor_error_code_free(wasi_filesystem_0_2_0_types_result_own_descriptor_error_code_t *ptr) { +void wasi_filesystem_types_result_own_descriptor_error_code_free(wasi_filesystem_types_result_own_descriptor_error_code_t *ptr) { if (!ptr->is_err) { } else { } } -void wasi_filesystem_0_2_0_types_result_string_error_code_free(wasi_filesystem_0_2_0_types_result_string_error_code_t *ptr) { +void wasi_filesystem_types_result_string_error_code_free(wasi_filesystem_types_result_string_error_code_t *ptr) { if (!ptr->is_err) { bindings_string_free(&ptr->val.ok); } else { } } -void wasi_filesystem_0_2_0_types_result_metadata_hash_value_error_code_free(wasi_filesystem_0_2_0_types_result_metadata_hash_value_error_code_t *ptr) { +void wasi_filesystem_types_result_metadata_hash_value_error_code_free(wasi_filesystem_types_result_metadata_hash_value_error_code_t *ptr) { if (!ptr->is_err) { } else { } } -void wasi_filesystem_0_2_0_types_option_directory_entry_free(wasi_filesystem_0_2_0_types_option_directory_entry_t *ptr) { +void wasi_filesystem_types_option_directory_entry_free(wasi_filesystem_types_option_directory_entry_t *ptr) { if (ptr->is_some) { - wasi_filesystem_0_2_0_types_directory_entry_free(&ptr->val); + wasi_filesystem_types_directory_entry_free(&ptr->val); } } -void wasi_filesystem_0_2_0_types_result_option_directory_entry_error_code_free(wasi_filesystem_0_2_0_types_result_option_directory_entry_error_code_t *ptr) { +void wasi_filesystem_types_result_option_directory_entry_error_code_free(wasi_filesystem_types_result_option_directory_entry_error_code_t *ptr) { if (!ptr->is_err) { - wasi_filesystem_0_2_0_types_option_directory_entry_free(&ptr->val.ok); + wasi_filesystem_types_option_directory_entry_free(&ptr->val.ok); } else { } } -void wasi_filesystem_0_2_0_types_option_error_code_free(wasi_filesystem_0_2_0_types_option_error_code_t *ptr) { +void wasi_filesystem_types_option_error_code_free(wasi_filesystem_types_option_error_code_t *ptr) { if (ptr->is_some) { } } -void wasi_filesystem_0_2_0_preopens_tuple2_own_descriptor_string_free(wasi_filesystem_0_2_0_preopens_tuple2_own_descriptor_string_t *ptr) { +void wasi_filesystem_preopens_tuple2_own_descriptor_string_free(wasi_filesystem_preopens_tuple2_own_descriptor_string_t *ptr) { bindings_string_free(&ptr->f1); } -void wasi_filesystem_0_2_0_preopens_list_tuple2_own_descriptor_string_free(wasi_filesystem_0_2_0_preopens_list_tuple2_own_descriptor_string_t *ptr) { - for (size_t i = 0; i < ptr->len; i++) { - wasi_filesystem_0_2_0_preopens_tuple2_own_descriptor_string_free(&ptr->ptr[i]); - } - if (ptr->len > 0) { - free(ptr->ptr); +void wasi_filesystem_preopens_list_tuple2_own_descriptor_string_free(wasi_filesystem_preopens_list_tuple2_own_descriptor_string_t *ptr) { + size_t list_len = ptr->len; + if (list_len > 0) { + wasi_filesystem_preopens_tuple2_own_descriptor_string_t *list_ptr = ptr->ptr; + for (size_t i = 0; i < list_len; i++) { + wasi_filesystem_preopens_tuple2_own_descriptor_string_free(&list_ptr[i]); + } + free(list_ptr); } } __attribute__((__import_module__("wasi:sockets/network@0.2.0"), __import_name__("[resource-drop]network"))) -extern void __wasm_import_wasi_sockets_0_2_0_network_network_drop(int32_t handle); +extern void __wasm_import_wasi_sockets_network_network_drop(int32_t handle); -void wasi_sockets_0_2_0_network_network_drop_own(wasi_sockets_0_2_0_network_own_network_t handle) { - __wasm_import_wasi_sockets_0_2_0_network_network_drop(handle.__handle); +void wasi_sockets_network_network_drop_own(wasi_sockets_network_own_network_t handle) { + __wasm_import_wasi_sockets_network_network_drop(handle.__handle); } -void wasi_sockets_0_2_0_network_network_drop_borrow(wasi_sockets_0_2_0_network_own_network_t handle) { - __wasm_import_wasi_sockets_0_2_0_network_network_drop(handle.__handle); +wasi_sockets_network_borrow_network_t wasi_sockets_network_borrow_network(wasi_sockets_network_own_network_t arg) { + return (wasi_sockets_network_borrow_network_t) { arg.__handle }; } -wasi_sockets_0_2_0_network_borrow_network_t wasi_sockets_0_2_0_network_borrow_network(wasi_sockets_0_2_0_network_own_network_t arg) { - return (wasi_sockets_0_2_0_network_borrow_network_t) { arg.__handle }; -} - -void wasi_sockets_0_2_0_network_ip_address_free(wasi_sockets_0_2_0_network_ip_address_t *ptr) { +void wasi_sockets_network_ip_address_free(wasi_sockets_network_ip_address_t *ptr) { switch ((int32_t) ptr->tag) { case 0: { break; @@ -934,7 +979,7 @@ void wasi_sockets_0_2_0_network_ip_address_free(wasi_sockets_0_2_0_network_ip_ad } } -void wasi_sockets_0_2_0_network_ip_socket_address_free(wasi_sockets_0_2_0_network_ip_socket_address_t *ptr) { +void wasi_sockets_network_ip_socket_address_free(wasi_sockets_network_ip_socket_address_t *ptr) { switch ((int32_t) ptr->tag) { case 0: { break; @@ -945,268 +990,234 @@ void wasi_sockets_0_2_0_network_ip_socket_address_free(wasi_sockets_0_2_0_networ } } -void wasi_sockets_0_2_0_udp_ip_socket_address_free(wasi_sockets_0_2_0_udp_ip_socket_address_t *ptr) { - wasi_sockets_0_2_0_network_ip_socket_address_free(ptr); +void wasi_sockets_udp_ip_socket_address_free(wasi_sockets_udp_ip_socket_address_t *ptr) { + wasi_sockets_network_ip_socket_address_free(ptr); } -void wasi_sockets_0_2_0_udp_list_u8_free(wasi_sockets_0_2_0_udp_list_u8_t *ptr) { - for (size_t i = 0; i < ptr->len; i++) { - } - if (ptr->len > 0) { - free(ptr->ptr); - } +void wasi_sockets_udp_incoming_datagram_free(wasi_sockets_udp_incoming_datagram_t *ptr) { + wasi_sockets_udp_ip_socket_address_free(&ptr->remote_address); } -void wasi_sockets_0_2_0_udp_incoming_datagram_free(wasi_sockets_0_2_0_udp_incoming_datagram_t *ptr) { - wasi_sockets_0_2_0_udp_list_u8_free(&ptr->data); - wasi_sockets_0_2_0_udp_ip_socket_address_free(&ptr->remote_address); -} - -void wasi_sockets_0_2_0_udp_option_ip_socket_address_free(wasi_sockets_0_2_0_udp_option_ip_socket_address_t *ptr) { +void wasi_sockets_udp_option_ip_socket_address_free(wasi_sockets_udp_option_ip_socket_address_t *ptr) { if (ptr->is_some) { - wasi_sockets_0_2_0_udp_ip_socket_address_free(&ptr->val); + wasi_sockets_udp_ip_socket_address_free(&ptr->val); } } -void wasi_sockets_0_2_0_udp_outgoing_datagram_free(wasi_sockets_0_2_0_udp_outgoing_datagram_t *ptr) { - wasi_sockets_0_2_0_udp_list_u8_free(&ptr->data); - wasi_sockets_0_2_0_udp_option_ip_socket_address_free(&ptr->remote_address); +void wasi_sockets_udp_outgoing_datagram_free(wasi_sockets_udp_outgoing_datagram_t *ptr) { + wasi_sockets_udp_option_ip_socket_address_free(&ptr->remote_address); } __attribute__((__import_module__("wasi:sockets/udp@0.2.0"), __import_name__("[resource-drop]udp-socket"))) -extern void __wasm_import_wasi_sockets_0_2_0_udp_udp_socket_drop(int32_t handle); +extern void __wasm_import_wasi_sockets_udp_udp_socket_drop(int32_t handle); -void wasi_sockets_0_2_0_udp_udp_socket_drop_own(wasi_sockets_0_2_0_udp_own_udp_socket_t handle) { - __wasm_import_wasi_sockets_0_2_0_udp_udp_socket_drop(handle.__handle); +void wasi_sockets_udp_udp_socket_drop_own(wasi_sockets_udp_own_udp_socket_t handle) { + __wasm_import_wasi_sockets_udp_udp_socket_drop(handle.__handle); } -void wasi_sockets_0_2_0_udp_udp_socket_drop_borrow(wasi_sockets_0_2_0_udp_own_udp_socket_t handle) { - __wasm_import_wasi_sockets_0_2_0_udp_udp_socket_drop(handle.__handle); -} - -wasi_sockets_0_2_0_udp_borrow_udp_socket_t wasi_sockets_0_2_0_udp_borrow_udp_socket(wasi_sockets_0_2_0_udp_own_udp_socket_t arg) { - return (wasi_sockets_0_2_0_udp_borrow_udp_socket_t) { arg.__handle }; +wasi_sockets_udp_borrow_udp_socket_t wasi_sockets_udp_borrow_udp_socket(wasi_sockets_udp_own_udp_socket_t arg) { + return (wasi_sockets_udp_borrow_udp_socket_t) { arg.__handle }; } __attribute__((__import_module__("wasi:sockets/udp@0.2.0"), __import_name__("[resource-drop]incoming-datagram-stream"))) -extern void __wasm_import_wasi_sockets_0_2_0_udp_incoming_datagram_stream_drop(int32_t handle); +extern void __wasm_import_wasi_sockets_udp_incoming_datagram_stream_drop(int32_t handle); -void wasi_sockets_0_2_0_udp_incoming_datagram_stream_drop_own(wasi_sockets_0_2_0_udp_own_incoming_datagram_stream_t handle) { - __wasm_import_wasi_sockets_0_2_0_udp_incoming_datagram_stream_drop(handle.__handle); +void wasi_sockets_udp_incoming_datagram_stream_drop_own(wasi_sockets_udp_own_incoming_datagram_stream_t handle) { + __wasm_import_wasi_sockets_udp_incoming_datagram_stream_drop(handle.__handle); } -void wasi_sockets_0_2_0_udp_incoming_datagram_stream_drop_borrow(wasi_sockets_0_2_0_udp_own_incoming_datagram_stream_t handle) { - __wasm_import_wasi_sockets_0_2_0_udp_incoming_datagram_stream_drop(handle.__handle); -} - -wasi_sockets_0_2_0_udp_borrow_incoming_datagram_stream_t wasi_sockets_0_2_0_udp_borrow_incoming_datagram_stream(wasi_sockets_0_2_0_udp_own_incoming_datagram_stream_t arg) { - return (wasi_sockets_0_2_0_udp_borrow_incoming_datagram_stream_t) { arg.__handle }; +wasi_sockets_udp_borrow_incoming_datagram_stream_t wasi_sockets_udp_borrow_incoming_datagram_stream(wasi_sockets_udp_own_incoming_datagram_stream_t arg) { + return (wasi_sockets_udp_borrow_incoming_datagram_stream_t) { arg.__handle }; } __attribute__((__import_module__("wasi:sockets/udp@0.2.0"), __import_name__("[resource-drop]outgoing-datagram-stream"))) -extern void __wasm_import_wasi_sockets_0_2_0_udp_outgoing_datagram_stream_drop(int32_t handle); - -void wasi_sockets_0_2_0_udp_outgoing_datagram_stream_drop_own(wasi_sockets_0_2_0_udp_own_outgoing_datagram_stream_t handle) { - __wasm_import_wasi_sockets_0_2_0_udp_outgoing_datagram_stream_drop(handle.__handle); -} +extern void __wasm_import_wasi_sockets_udp_outgoing_datagram_stream_drop(int32_t handle); -void wasi_sockets_0_2_0_udp_outgoing_datagram_stream_drop_borrow(wasi_sockets_0_2_0_udp_own_outgoing_datagram_stream_t handle) { - __wasm_import_wasi_sockets_0_2_0_udp_outgoing_datagram_stream_drop(handle.__handle); +void wasi_sockets_udp_outgoing_datagram_stream_drop_own(wasi_sockets_udp_own_outgoing_datagram_stream_t handle) { + __wasm_import_wasi_sockets_udp_outgoing_datagram_stream_drop(handle.__handle); } -wasi_sockets_0_2_0_udp_borrow_outgoing_datagram_stream_t wasi_sockets_0_2_0_udp_borrow_outgoing_datagram_stream(wasi_sockets_0_2_0_udp_own_outgoing_datagram_stream_t arg) { - return (wasi_sockets_0_2_0_udp_borrow_outgoing_datagram_stream_t) { arg.__handle }; +wasi_sockets_udp_borrow_outgoing_datagram_stream_t wasi_sockets_udp_borrow_outgoing_datagram_stream(wasi_sockets_udp_own_outgoing_datagram_stream_t arg) { + return (wasi_sockets_udp_borrow_outgoing_datagram_stream_t) { arg.__handle }; } -void wasi_sockets_0_2_0_udp_result_void_error_code_free(wasi_sockets_0_2_0_udp_result_void_error_code_t *ptr) { +void wasi_sockets_udp_result_void_error_code_free(wasi_sockets_udp_result_void_error_code_t *ptr) { if (!ptr->is_err) { } else { } } -void wasi_sockets_0_2_0_udp_result_tuple2_own_incoming_datagram_stream_own_outgoing_datagram_stream_error_code_free(wasi_sockets_0_2_0_udp_result_tuple2_own_incoming_datagram_stream_own_outgoing_datagram_stream_error_code_t *ptr) { +void wasi_sockets_udp_result_tuple2_own_incoming_datagram_stream_own_outgoing_datagram_stream_error_code_free(wasi_sockets_udp_result_tuple2_own_incoming_datagram_stream_own_outgoing_datagram_stream_error_code_t *ptr) { if (!ptr->is_err) { } else { } } -void wasi_sockets_0_2_0_udp_result_ip_socket_address_error_code_free(wasi_sockets_0_2_0_udp_result_ip_socket_address_error_code_t *ptr) { +void wasi_sockets_udp_result_ip_socket_address_error_code_free(wasi_sockets_udp_result_ip_socket_address_error_code_t *ptr) { if (!ptr->is_err) { - wasi_sockets_0_2_0_udp_ip_socket_address_free(&ptr->val.ok); + wasi_sockets_udp_ip_socket_address_free(&ptr->val.ok); } else { } } -void wasi_sockets_0_2_0_udp_result_u8_error_code_free(wasi_sockets_0_2_0_udp_result_u8_error_code_t *ptr) { +void wasi_sockets_udp_result_u8_error_code_free(wasi_sockets_udp_result_u8_error_code_t *ptr) { if (!ptr->is_err) { } else { } } -void wasi_sockets_0_2_0_udp_result_u64_error_code_free(wasi_sockets_0_2_0_udp_result_u64_error_code_t *ptr) { +void wasi_sockets_udp_result_u64_error_code_free(wasi_sockets_udp_result_u64_error_code_t *ptr) { if (!ptr->is_err) { } else { } } -void wasi_sockets_0_2_0_udp_list_incoming_datagram_free(wasi_sockets_0_2_0_udp_list_incoming_datagram_t *ptr) { - for (size_t i = 0; i < ptr->len; i++) { - wasi_sockets_0_2_0_udp_incoming_datagram_free(&ptr->ptr[i]); - } - if (ptr->len > 0) { - free(ptr->ptr); +void wasi_sockets_udp_list_incoming_datagram_free(wasi_sockets_udp_list_incoming_datagram_t *ptr) { + size_t list_len = ptr->len; + if (list_len > 0) { + wasi_sockets_udp_incoming_datagram_t *list_ptr = ptr->ptr; + for (size_t i = 0; i < list_len; i++) { + wasi_sockets_udp_incoming_datagram_free(&list_ptr[i]); + } + free(list_ptr); } } -void wasi_sockets_0_2_0_udp_result_list_incoming_datagram_error_code_free(wasi_sockets_0_2_0_udp_result_list_incoming_datagram_error_code_t *ptr) { +void wasi_sockets_udp_result_list_incoming_datagram_error_code_free(wasi_sockets_udp_result_list_incoming_datagram_error_code_t *ptr) { if (!ptr->is_err) { - wasi_sockets_0_2_0_udp_list_incoming_datagram_free(&ptr->val.ok); + wasi_sockets_udp_list_incoming_datagram_free(&ptr->val.ok); } else { } } -void wasi_sockets_0_2_0_udp_list_outgoing_datagram_free(wasi_sockets_0_2_0_udp_list_outgoing_datagram_t *ptr) { - for (size_t i = 0; i < ptr->len; i++) { - wasi_sockets_0_2_0_udp_outgoing_datagram_free(&ptr->ptr[i]); - } - if (ptr->len > 0) { - free(ptr->ptr); +void wasi_sockets_udp_list_outgoing_datagram_free(wasi_sockets_udp_list_outgoing_datagram_t *ptr) { + size_t list_len = ptr->len; + if (list_len > 0) { + wasi_sockets_udp_outgoing_datagram_t *list_ptr = ptr->ptr; + for (size_t i = 0; i < list_len; i++) { + wasi_sockets_udp_outgoing_datagram_free(&list_ptr[i]); + } + free(list_ptr); } } -void wasi_sockets_0_2_0_udp_create_socket_result_own_udp_socket_error_code_free(wasi_sockets_0_2_0_udp_create_socket_result_own_udp_socket_error_code_t *ptr) { +void wasi_sockets_udp_create_socket_result_own_udp_socket_error_code_free(wasi_sockets_udp_create_socket_result_own_udp_socket_error_code_t *ptr) { if (!ptr->is_err) { } else { } } -void wasi_sockets_0_2_0_tcp_ip_socket_address_free(wasi_sockets_0_2_0_tcp_ip_socket_address_t *ptr) { - wasi_sockets_0_2_0_network_ip_socket_address_free(ptr); +void wasi_sockets_tcp_ip_socket_address_free(wasi_sockets_tcp_ip_socket_address_t *ptr) { + wasi_sockets_network_ip_socket_address_free(ptr); } __attribute__((__import_module__("wasi:sockets/tcp@0.2.0"), __import_name__("[resource-drop]tcp-socket"))) -extern void __wasm_import_wasi_sockets_0_2_0_tcp_tcp_socket_drop(int32_t handle); - -void wasi_sockets_0_2_0_tcp_tcp_socket_drop_own(wasi_sockets_0_2_0_tcp_own_tcp_socket_t handle) { - __wasm_import_wasi_sockets_0_2_0_tcp_tcp_socket_drop(handle.__handle); -} +extern void __wasm_import_wasi_sockets_tcp_tcp_socket_drop(int32_t handle); -void wasi_sockets_0_2_0_tcp_tcp_socket_drop_borrow(wasi_sockets_0_2_0_tcp_own_tcp_socket_t handle) { - __wasm_import_wasi_sockets_0_2_0_tcp_tcp_socket_drop(handle.__handle); +void wasi_sockets_tcp_tcp_socket_drop_own(wasi_sockets_tcp_own_tcp_socket_t handle) { + __wasm_import_wasi_sockets_tcp_tcp_socket_drop(handle.__handle); } -wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t wasi_sockets_0_2_0_tcp_borrow_tcp_socket(wasi_sockets_0_2_0_tcp_own_tcp_socket_t arg) { - return (wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t) { arg.__handle }; +wasi_sockets_tcp_borrow_tcp_socket_t wasi_sockets_tcp_borrow_tcp_socket(wasi_sockets_tcp_own_tcp_socket_t arg) { + return (wasi_sockets_tcp_borrow_tcp_socket_t) { arg.__handle }; } -void wasi_sockets_0_2_0_tcp_result_void_error_code_free(wasi_sockets_0_2_0_tcp_result_void_error_code_t *ptr) { +void wasi_sockets_tcp_result_void_error_code_free(wasi_sockets_tcp_result_void_error_code_t *ptr) { if (!ptr->is_err) { } else { } } -void wasi_sockets_0_2_0_tcp_result_tuple2_own_input_stream_own_output_stream_error_code_free(wasi_sockets_0_2_0_tcp_result_tuple2_own_input_stream_own_output_stream_error_code_t *ptr) { +void wasi_sockets_tcp_result_tuple2_own_input_stream_own_output_stream_error_code_free(wasi_sockets_tcp_result_tuple2_own_input_stream_own_output_stream_error_code_t *ptr) { if (!ptr->is_err) { } else { } } -void wasi_sockets_0_2_0_tcp_result_tuple3_own_tcp_socket_own_input_stream_own_output_stream_error_code_free(wasi_sockets_0_2_0_tcp_result_tuple3_own_tcp_socket_own_input_stream_own_output_stream_error_code_t *ptr) { +void wasi_sockets_tcp_result_tuple3_own_tcp_socket_own_input_stream_own_output_stream_error_code_free(wasi_sockets_tcp_result_tuple3_own_tcp_socket_own_input_stream_own_output_stream_error_code_t *ptr) { if (!ptr->is_err) { } else { } } -void wasi_sockets_0_2_0_tcp_result_ip_socket_address_error_code_free(wasi_sockets_0_2_0_tcp_result_ip_socket_address_error_code_t *ptr) { +void wasi_sockets_tcp_result_ip_socket_address_error_code_free(wasi_sockets_tcp_result_ip_socket_address_error_code_t *ptr) { if (!ptr->is_err) { - wasi_sockets_0_2_0_tcp_ip_socket_address_free(&ptr->val.ok); + wasi_sockets_tcp_ip_socket_address_free(&ptr->val.ok); } else { } } -void wasi_sockets_0_2_0_tcp_result_bool_error_code_free(wasi_sockets_0_2_0_tcp_result_bool_error_code_t *ptr) { +void wasi_sockets_tcp_result_bool_error_code_free(wasi_sockets_tcp_result_bool_error_code_t *ptr) { if (!ptr->is_err) { } else { } } -void wasi_sockets_0_2_0_tcp_result_duration_error_code_free(wasi_sockets_0_2_0_tcp_result_duration_error_code_t *ptr) { +void wasi_sockets_tcp_result_duration_error_code_free(wasi_sockets_tcp_result_duration_error_code_t *ptr) { if (!ptr->is_err) { } else { } } -void wasi_sockets_0_2_0_tcp_result_u32_error_code_free(wasi_sockets_0_2_0_tcp_result_u32_error_code_t *ptr) { +void wasi_sockets_tcp_result_u32_error_code_free(wasi_sockets_tcp_result_u32_error_code_t *ptr) { if (!ptr->is_err) { } else { } } -void wasi_sockets_0_2_0_tcp_result_u8_error_code_free(wasi_sockets_0_2_0_tcp_result_u8_error_code_t *ptr) { +void wasi_sockets_tcp_result_u8_error_code_free(wasi_sockets_tcp_result_u8_error_code_t *ptr) { if (!ptr->is_err) { } else { } } -void wasi_sockets_0_2_0_tcp_result_u64_error_code_free(wasi_sockets_0_2_0_tcp_result_u64_error_code_t *ptr) { +void wasi_sockets_tcp_result_u64_error_code_free(wasi_sockets_tcp_result_u64_error_code_t *ptr) { if (!ptr->is_err) { } else { } } -void wasi_sockets_0_2_0_tcp_create_socket_result_own_tcp_socket_error_code_free(wasi_sockets_0_2_0_tcp_create_socket_result_own_tcp_socket_error_code_t *ptr) { +void wasi_sockets_tcp_create_socket_result_own_tcp_socket_error_code_free(wasi_sockets_tcp_create_socket_result_own_tcp_socket_error_code_t *ptr) { if (!ptr->is_err) { } else { } } -void wasi_sockets_0_2_0_ip_name_lookup_ip_address_free(wasi_sockets_0_2_0_ip_name_lookup_ip_address_t *ptr) { - wasi_sockets_0_2_0_network_ip_address_free(ptr); +void wasi_sockets_ip_name_lookup_ip_address_free(wasi_sockets_ip_name_lookup_ip_address_t *ptr) { + wasi_sockets_network_ip_address_free(ptr); } __attribute__((__import_module__("wasi:sockets/ip-name-lookup@0.2.0"), __import_name__("[resource-drop]resolve-address-stream"))) -extern void __wasm_import_wasi_sockets_0_2_0_ip_name_lookup_resolve_address_stream_drop(int32_t handle); - -void wasi_sockets_0_2_0_ip_name_lookup_resolve_address_stream_drop_own(wasi_sockets_0_2_0_ip_name_lookup_own_resolve_address_stream_t handle) { - __wasm_import_wasi_sockets_0_2_0_ip_name_lookup_resolve_address_stream_drop(handle.__handle); -} +extern void __wasm_import_wasi_sockets_ip_name_lookup_resolve_address_stream_drop(int32_t handle); -void wasi_sockets_0_2_0_ip_name_lookup_resolve_address_stream_drop_borrow(wasi_sockets_0_2_0_ip_name_lookup_own_resolve_address_stream_t handle) { - __wasm_import_wasi_sockets_0_2_0_ip_name_lookup_resolve_address_stream_drop(handle.__handle); +void wasi_sockets_ip_name_lookup_resolve_address_stream_drop_own(wasi_sockets_ip_name_lookup_own_resolve_address_stream_t handle) { + __wasm_import_wasi_sockets_ip_name_lookup_resolve_address_stream_drop(handle.__handle); } -wasi_sockets_0_2_0_ip_name_lookup_borrow_resolve_address_stream_t wasi_sockets_0_2_0_ip_name_lookup_borrow_resolve_address_stream(wasi_sockets_0_2_0_ip_name_lookup_own_resolve_address_stream_t arg) { - return (wasi_sockets_0_2_0_ip_name_lookup_borrow_resolve_address_stream_t) { arg.__handle }; +wasi_sockets_ip_name_lookup_borrow_resolve_address_stream_t wasi_sockets_ip_name_lookup_borrow_resolve_address_stream(wasi_sockets_ip_name_lookup_own_resolve_address_stream_t arg) { + return (wasi_sockets_ip_name_lookup_borrow_resolve_address_stream_t) { arg.__handle }; } -void wasi_sockets_0_2_0_ip_name_lookup_result_own_resolve_address_stream_error_code_free(wasi_sockets_0_2_0_ip_name_lookup_result_own_resolve_address_stream_error_code_t *ptr) { +void wasi_sockets_ip_name_lookup_result_own_resolve_address_stream_error_code_free(wasi_sockets_ip_name_lookup_result_own_resolve_address_stream_error_code_t *ptr) { if (!ptr->is_err) { } else { } } -void wasi_sockets_0_2_0_ip_name_lookup_option_ip_address_free(wasi_sockets_0_2_0_ip_name_lookup_option_ip_address_t *ptr) { +void wasi_sockets_ip_name_lookup_option_ip_address_free(wasi_sockets_ip_name_lookup_option_ip_address_t *ptr) { if (ptr->is_some) { - wasi_sockets_0_2_0_ip_name_lookup_ip_address_free(&ptr->val); + wasi_sockets_ip_name_lookup_ip_address_free(&ptr->val); } } -void wasi_sockets_0_2_0_ip_name_lookup_result_option_ip_address_error_code_free(wasi_sockets_0_2_0_ip_name_lookup_result_option_ip_address_error_code_t *ptr) { +void wasi_sockets_ip_name_lookup_result_option_ip_address_error_code_free(wasi_sockets_ip_name_lookup_result_option_ip_address_error_code_t *ptr) { if (!ptr->is_err) { - wasi_sockets_0_2_0_ip_name_lookup_option_ip_address_free(&ptr->val.ok); + wasi_sockets_ip_name_lookup_option_ip_address_free(&ptr->val.ok); } else { } } -void wasi_random_0_2_0_random_list_u8_free(wasi_random_0_2_0_random_list_u8_t *ptr) { - for (size_t i = 0; i < ptr->len; i++) { - } - if (ptr->len > 0) { - free(ptr->ptr); - } -} - -void wasi_http_0_2_0_types_method_free(wasi_http_0_2_0_types_method_t *ptr) { +void wasi_http_types_method_free(wasi_http_types_method_t *ptr) { switch ((int32_t) ptr->tag) { case 9: { bindings_string_free(&ptr->val.other); @@ -1215,7 +1226,7 @@ void wasi_http_0_2_0_types_method_free(wasi_http_0_2_0_types_method_t *ptr) { } } -void wasi_http_0_2_0_types_scheme_free(wasi_http_0_2_0_types_scheme_t *ptr) { +void wasi_http_types_scheme_free(wasi_http_types_scheme_t *ptr) { switch ((int32_t) ptr->tag) { case 2: { bindings_string_free(&ptr->val.other); @@ -1224,466 +1235,416 @@ void wasi_http_0_2_0_types_scheme_free(wasi_http_0_2_0_types_scheme_t *ptr) { } } -void wasi_http_0_2_0_types_option_string_free(wasi_http_0_2_0_types_option_string_t *ptr) { +void bindings_option_u16_free(bindings_option_u16_t *ptr) { if (ptr->is_some) { - bindings_string_free(&ptr->val); } } -void wasi_http_0_2_0_types_option_u16_free(wasi_http_0_2_0_types_option_u16_t *ptr) { - if (ptr->is_some) { - } -} - -void wasi_http_0_2_0_types_dns_error_payload_free(wasi_http_0_2_0_types_dns_error_payload_t *ptr) { - wasi_http_0_2_0_types_option_string_free(&ptr->rcode); - wasi_http_0_2_0_types_option_u16_free(&ptr->info_code); +void wasi_http_types_dns_error_payload_free(wasi_http_types_dns_error_payload_t *ptr) { + bindings_option_u16_free(&ptr->info_code); } -void wasi_http_0_2_0_types_option_u8_free(wasi_http_0_2_0_types_option_u8_t *ptr) { +void bindings_option_u8_free(bindings_option_u8_t *ptr) { if (ptr->is_some) { } } -void wasi_http_0_2_0_types_tls_alert_received_payload_free(wasi_http_0_2_0_types_tls_alert_received_payload_t *ptr) { - wasi_http_0_2_0_types_option_u8_free(&ptr->alert_id); - wasi_http_0_2_0_types_option_string_free(&ptr->alert_message); +void wasi_http_types_tls_alert_received_payload_free(wasi_http_types_tls_alert_received_payload_t *ptr) { + bindings_option_u8_free(&ptr->alert_id); } -void wasi_http_0_2_0_types_option_u32_free(wasi_http_0_2_0_types_option_u32_t *ptr) { +void bindings_option_u32_free(bindings_option_u32_t *ptr) { if (ptr->is_some) { } } -void wasi_http_0_2_0_types_field_size_payload_free(wasi_http_0_2_0_types_field_size_payload_t *ptr) { - wasi_http_0_2_0_types_option_string_free(&ptr->field_name); - wasi_http_0_2_0_types_option_u32_free(&ptr->field_size); +void wasi_http_types_field_size_payload_free(wasi_http_types_field_size_payload_t *ptr) { + bindings_option_u32_free(&ptr->field_size); } -void wasi_http_0_2_0_types_option_u64_free(wasi_http_0_2_0_types_option_u64_t *ptr) { +void bindings_option_u64_free(bindings_option_u64_t *ptr) { if (ptr->is_some) { } } -void wasi_http_0_2_0_types_option_field_size_payload_free(wasi_http_0_2_0_types_option_field_size_payload_t *ptr) { +void wasi_http_types_option_field_size_payload_free(wasi_http_types_option_field_size_payload_t *ptr) { if (ptr->is_some) { - wasi_http_0_2_0_types_field_size_payload_free(&ptr->val); + wasi_http_types_field_size_payload_free(&ptr->val); } } -void wasi_http_0_2_0_types_error_code_free(wasi_http_0_2_0_types_error_code_t *ptr) { +void wasi_http_types_error_code_free(wasi_http_types_error_code_t *ptr) { switch ((int32_t) ptr->tag) { case 1: { - wasi_http_0_2_0_types_dns_error_payload_free(&ptr->val.dns_error); + wasi_http_types_dns_error_payload_free(&ptr->val.dns_error); break; } case 14: { - wasi_http_0_2_0_types_tls_alert_received_payload_free(&ptr->val.tls_alert_received); + wasi_http_types_tls_alert_received_payload_free(&ptr->val.tls_alert_received); break; } case 17: { - wasi_http_0_2_0_types_option_u64_free(&ptr->val.http_request_body_size); + bindings_option_u64_free(&ptr->val.http_request_body_size); break; } case 21: { - wasi_http_0_2_0_types_option_u32_free(&ptr->val.http_request_header_section_size); + bindings_option_u32_free(&ptr->val.http_request_header_section_size); break; } case 22: { - wasi_http_0_2_0_types_option_field_size_payload_free(&ptr->val.http_request_header_size); + wasi_http_types_option_field_size_payload_free(&ptr->val.http_request_header_size); break; } case 23: { - wasi_http_0_2_0_types_option_u32_free(&ptr->val.http_request_trailer_section_size); + bindings_option_u32_free(&ptr->val.http_request_trailer_section_size); break; } case 24: { - wasi_http_0_2_0_types_field_size_payload_free(&ptr->val.http_request_trailer_size); + wasi_http_types_field_size_payload_free(&ptr->val.http_request_trailer_size); break; } case 26: { - wasi_http_0_2_0_types_option_u32_free(&ptr->val.http_response_header_section_size); + bindings_option_u32_free(&ptr->val.http_response_header_section_size); break; } case 27: { - wasi_http_0_2_0_types_field_size_payload_free(&ptr->val.http_response_header_size); + wasi_http_types_field_size_payload_free(&ptr->val.http_response_header_size); break; } case 28: { - wasi_http_0_2_0_types_option_u64_free(&ptr->val.http_response_body_size); + bindings_option_u64_free(&ptr->val.http_response_body_size); break; } case 29: { - wasi_http_0_2_0_types_option_u32_free(&ptr->val.http_response_trailer_section_size); + bindings_option_u32_free(&ptr->val.http_response_trailer_section_size); break; } case 30: { - wasi_http_0_2_0_types_field_size_payload_free(&ptr->val.http_response_trailer_size); + wasi_http_types_field_size_payload_free(&ptr->val.http_response_trailer_size); break; } case 31: { - wasi_http_0_2_0_types_option_string_free(&ptr->val.http_response_transfer_coding); break; } case 32: { - wasi_http_0_2_0_types_option_string_free(&ptr->val.http_response_content_coding); break; } case 38: { - wasi_http_0_2_0_types_option_string_free(&ptr->val.internal_error); break; } } } -void wasi_http_0_2_0_types_header_error_free(wasi_http_0_2_0_types_header_error_t *ptr) { +void wasi_http_types_header_error_free(wasi_http_types_header_error_t *ptr) { switch ((int32_t) ptr->tag) { } } -void wasi_http_0_2_0_types_field_key_free(wasi_http_0_2_0_types_field_key_t *ptr) { +void wasi_http_types_field_key_free(wasi_http_types_field_key_t *ptr) { bindings_string_free(ptr); } -void wasi_http_0_2_0_types_field_value_free(wasi_http_0_2_0_types_field_value_t *ptr) { - for (size_t i = 0; i < ptr->len; i++) { - } - if (ptr->len > 0) { - free(ptr->ptr); +void wasi_http_types_field_value_free(wasi_http_types_field_value_t *ptr) { + size_t list_len = ptr->len; + if (list_len > 0) { + uint8_t *list_ptr = ptr->ptr; + for (size_t i = 0; i < list_len; i++) { + } + free(list_ptr); } } __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[resource-drop]fields"))) -extern void __wasm_import_wasi_http_0_2_0_types_fields_drop(int32_t handle); - -void wasi_http_0_2_0_types_fields_drop_own(wasi_http_0_2_0_types_own_fields_t handle) { - __wasm_import_wasi_http_0_2_0_types_fields_drop(handle.__handle); -} +extern void __wasm_import_wasi_http_types_fields_drop(int32_t handle); -void wasi_http_0_2_0_types_fields_drop_borrow(wasi_http_0_2_0_types_own_fields_t handle) { - __wasm_import_wasi_http_0_2_0_types_fields_drop(handle.__handle); +void wasi_http_types_fields_drop_own(wasi_http_types_own_fields_t handle) { + __wasm_import_wasi_http_types_fields_drop(handle.__handle); } -wasi_http_0_2_0_types_borrow_fields_t wasi_http_0_2_0_types_borrow_fields(wasi_http_0_2_0_types_own_fields_t arg) { - return (wasi_http_0_2_0_types_borrow_fields_t) { arg.__handle }; +wasi_http_types_borrow_fields_t wasi_http_types_borrow_fields(wasi_http_types_own_fields_t arg) { + return (wasi_http_types_borrow_fields_t) { arg.__handle }; } __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[resource-drop]incoming-request"))) -extern void __wasm_import_wasi_http_0_2_0_types_incoming_request_drop(int32_t handle); - -void wasi_http_0_2_0_types_incoming_request_drop_own(wasi_http_0_2_0_types_own_incoming_request_t handle) { - __wasm_import_wasi_http_0_2_0_types_incoming_request_drop(handle.__handle); -} +extern void __wasm_import_wasi_http_types_incoming_request_drop(int32_t handle); -void wasi_http_0_2_0_types_incoming_request_drop_borrow(wasi_http_0_2_0_types_own_incoming_request_t handle) { - __wasm_import_wasi_http_0_2_0_types_incoming_request_drop(handle.__handle); +void wasi_http_types_incoming_request_drop_own(wasi_http_types_own_incoming_request_t handle) { + __wasm_import_wasi_http_types_incoming_request_drop(handle.__handle); } -wasi_http_0_2_0_types_borrow_incoming_request_t wasi_http_0_2_0_types_borrow_incoming_request(wasi_http_0_2_0_types_own_incoming_request_t arg) { - return (wasi_http_0_2_0_types_borrow_incoming_request_t) { arg.__handle }; +wasi_http_types_borrow_incoming_request_t wasi_http_types_borrow_incoming_request(wasi_http_types_own_incoming_request_t arg) { + return (wasi_http_types_borrow_incoming_request_t) { arg.__handle }; } __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[resource-drop]outgoing-request"))) -extern void __wasm_import_wasi_http_0_2_0_types_outgoing_request_drop(int32_t handle); +extern void __wasm_import_wasi_http_types_outgoing_request_drop(int32_t handle); -void wasi_http_0_2_0_types_outgoing_request_drop_own(wasi_http_0_2_0_types_own_outgoing_request_t handle) { - __wasm_import_wasi_http_0_2_0_types_outgoing_request_drop(handle.__handle); +void wasi_http_types_outgoing_request_drop_own(wasi_http_types_own_outgoing_request_t handle) { + __wasm_import_wasi_http_types_outgoing_request_drop(handle.__handle); } -void wasi_http_0_2_0_types_outgoing_request_drop_borrow(wasi_http_0_2_0_types_own_outgoing_request_t handle) { - __wasm_import_wasi_http_0_2_0_types_outgoing_request_drop(handle.__handle); -} - -wasi_http_0_2_0_types_borrow_outgoing_request_t wasi_http_0_2_0_types_borrow_outgoing_request(wasi_http_0_2_0_types_own_outgoing_request_t arg) { - return (wasi_http_0_2_0_types_borrow_outgoing_request_t) { arg.__handle }; +wasi_http_types_borrow_outgoing_request_t wasi_http_types_borrow_outgoing_request(wasi_http_types_own_outgoing_request_t arg) { + return (wasi_http_types_borrow_outgoing_request_t) { arg.__handle }; } __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[resource-drop]request-options"))) -extern void __wasm_import_wasi_http_0_2_0_types_request_options_drop(int32_t handle); - -void wasi_http_0_2_0_types_request_options_drop_own(wasi_http_0_2_0_types_own_request_options_t handle) { - __wasm_import_wasi_http_0_2_0_types_request_options_drop(handle.__handle); -} +extern void __wasm_import_wasi_http_types_request_options_drop(int32_t handle); -void wasi_http_0_2_0_types_request_options_drop_borrow(wasi_http_0_2_0_types_own_request_options_t handle) { - __wasm_import_wasi_http_0_2_0_types_request_options_drop(handle.__handle); +void wasi_http_types_request_options_drop_own(wasi_http_types_own_request_options_t handle) { + __wasm_import_wasi_http_types_request_options_drop(handle.__handle); } -wasi_http_0_2_0_types_borrow_request_options_t wasi_http_0_2_0_types_borrow_request_options(wasi_http_0_2_0_types_own_request_options_t arg) { - return (wasi_http_0_2_0_types_borrow_request_options_t) { arg.__handle }; +wasi_http_types_borrow_request_options_t wasi_http_types_borrow_request_options(wasi_http_types_own_request_options_t arg) { + return (wasi_http_types_borrow_request_options_t) { arg.__handle }; } __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[resource-drop]response-outparam"))) -extern void __wasm_import_wasi_http_0_2_0_types_response_outparam_drop(int32_t handle); +extern void __wasm_import_wasi_http_types_response_outparam_drop(int32_t handle); -void wasi_http_0_2_0_types_response_outparam_drop_own(wasi_http_0_2_0_types_own_response_outparam_t handle) { - __wasm_import_wasi_http_0_2_0_types_response_outparam_drop(handle.__handle); +void wasi_http_types_response_outparam_drop_own(wasi_http_types_own_response_outparam_t handle) { + __wasm_import_wasi_http_types_response_outparam_drop(handle.__handle); } -void wasi_http_0_2_0_types_response_outparam_drop_borrow(wasi_http_0_2_0_types_own_response_outparam_t handle) { - __wasm_import_wasi_http_0_2_0_types_response_outparam_drop(handle.__handle); -} - -wasi_http_0_2_0_types_borrow_response_outparam_t wasi_http_0_2_0_types_borrow_response_outparam(wasi_http_0_2_0_types_own_response_outparam_t arg) { - return (wasi_http_0_2_0_types_borrow_response_outparam_t) { arg.__handle }; +wasi_http_types_borrow_response_outparam_t wasi_http_types_borrow_response_outparam(wasi_http_types_own_response_outparam_t arg) { + return (wasi_http_types_borrow_response_outparam_t) { arg.__handle }; } __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[resource-drop]incoming-response"))) -extern void __wasm_import_wasi_http_0_2_0_types_incoming_response_drop(int32_t handle); +extern void __wasm_import_wasi_http_types_incoming_response_drop(int32_t handle); -void wasi_http_0_2_0_types_incoming_response_drop_own(wasi_http_0_2_0_types_own_incoming_response_t handle) { - __wasm_import_wasi_http_0_2_0_types_incoming_response_drop(handle.__handle); +void wasi_http_types_incoming_response_drop_own(wasi_http_types_own_incoming_response_t handle) { + __wasm_import_wasi_http_types_incoming_response_drop(handle.__handle); } -void wasi_http_0_2_0_types_incoming_response_drop_borrow(wasi_http_0_2_0_types_own_incoming_response_t handle) { - __wasm_import_wasi_http_0_2_0_types_incoming_response_drop(handle.__handle); -} - -wasi_http_0_2_0_types_borrow_incoming_response_t wasi_http_0_2_0_types_borrow_incoming_response(wasi_http_0_2_0_types_own_incoming_response_t arg) { - return (wasi_http_0_2_0_types_borrow_incoming_response_t) { arg.__handle }; +wasi_http_types_borrow_incoming_response_t wasi_http_types_borrow_incoming_response(wasi_http_types_own_incoming_response_t arg) { + return (wasi_http_types_borrow_incoming_response_t) { arg.__handle }; } __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[resource-drop]incoming-body"))) -extern void __wasm_import_wasi_http_0_2_0_types_incoming_body_drop(int32_t handle); +extern void __wasm_import_wasi_http_types_incoming_body_drop(int32_t handle); -void wasi_http_0_2_0_types_incoming_body_drop_own(wasi_http_0_2_0_types_own_incoming_body_t handle) { - __wasm_import_wasi_http_0_2_0_types_incoming_body_drop(handle.__handle); +void wasi_http_types_incoming_body_drop_own(wasi_http_types_own_incoming_body_t handle) { + __wasm_import_wasi_http_types_incoming_body_drop(handle.__handle); } -void wasi_http_0_2_0_types_incoming_body_drop_borrow(wasi_http_0_2_0_types_own_incoming_body_t handle) { - __wasm_import_wasi_http_0_2_0_types_incoming_body_drop(handle.__handle); -} - -wasi_http_0_2_0_types_borrow_incoming_body_t wasi_http_0_2_0_types_borrow_incoming_body(wasi_http_0_2_0_types_own_incoming_body_t arg) { - return (wasi_http_0_2_0_types_borrow_incoming_body_t) { arg.__handle }; +wasi_http_types_borrow_incoming_body_t wasi_http_types_borrow_incoming_body(wasi_http_types_own_incoming_body_t arg) { + return (wasi_http_types_borrow_incoming_body_t) { arg.__handle }; } __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[resource-drop]future-trailers"))) -extern void __wasm_import_wasi_http_0_2_0_types_future_trailers_drop(int32_t handle); - -void wasi_http_0_2_0_types_future_trailers_drop_own(wasi_http_0_2_0_types_own_future_trailers_t handle) { - __wasm_import_wasi_http_0_2_0_types_future_trailers_drop(handle.__handle); -} +extern void __wasm_import_wasi_http_types_future_trailers_drop(int32_t handle); -void wasi_http_0_2_0_types_future_trailers_drop_borrow(wasi_http_0_2_0_types_own_future_trailers_t handle) { - __wasm_import_wasi_http_0_2_0_types_future_trailers_drop(handle.__handle); +void wasi_http_types_future_trailers_drop_own(wasi_http_types_own_future_trailers_t handle) { + __wasm_import_wasi_http_types_future_trailers_drop(handle.__handle); } -wasi_http_0_2_0_types_borrow_future_trailers_t wasi_http_0_2_0_types_borrow_future_trailers(wasi_http_0_2_0_types_own_future_trailers_t arg) { - return (wasi_http_0_2_0_types_borrow_future_trailers_t) { arg.__handle }; +wasi_http_types_borrow_future_trailers_t wasi_http_types_borrow_future_trailers(wasi_http_types_own_future_trailers_t arg) { + return (wasi_http_types_borrow_future_trailers_t) { arg.__handle }; } __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[resource-drop]outgoing-response"))) -extern void __wasm_import_wasi_http_0_2_0_types_outgoing_response_drop(int32_t handle); +extern void __wasm_import_wasi_http_types_outgoing_response_drop(int32_t handle); -void wasi_http_0_2_0_types_outgoing_response_drop_own(wasi_http_0_2_0_types_own_outgoing_response_t handle) { - __wasm_import_wasi_http_0_2_0_types_outgoing_response_drop(handle.__handle); +void wasi_http_types_outgoing_response_drop_own(wasi_http_types_own_outgoing_response_t handle) { + __wasm_import_wasi_http_types_outgoing_response_drop(handle.__handle); } -void wasi_http_0_2_0_types_outgoing_response_drop_borrow(wasi_http_0_2_0_types_own_outgoing_response_t handle) { - __wasm_import_wasi_http_0_2_0_types_outgoing_response_drop(handle.__handle); -} - -wasi_http_0_2_0_types_borrow_outgoing_response_t wasi_http_0_2_0_types_borrow_outgoing_response(wasi_http_0_2_0_types_own_outgoing_response_t arg) { - return (wasi_http_0_2_0_types_borrow_outgoing_response_t) { arg.__handle }; +wasi_http_types_borrow_outgoing_response_t wasi_http_types_borrow_outgoing_response(wasi_http_types_own_outgoing_response_t arg) { + return (wasi_http_types_borrow_outgoing_response_t) { arg.__handle }; } __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[resource-drop]outgoing-body"))) -extern void __wasm_import_wasi_http_0_2_0_types_outgoing_body_drop(int32_t handle); - -void wasi_http_0_2_0_types_outgoing_body_drop_own(wasi_http_0_2_0_types_own_outgoing_body_t handle) { - __wasm_import_wasi_http_0_2_0_types_outgoing_body_drop(handle.__handle); -} +extern void __wasm_import_wasi_http_types_outgoing_body_drop(int32_t handle); -void wasi_http_0_2_0_types_outgoing_body_drop_borrow(wasi_http_0_2_0_types_own_outgoing_body_t handle) { - __wasm_import_wasi_http_0_2_0_types_outgoing_body_drop(handle.__handle); +void wasi_http_types_outgoing_body_drop_own(wasi_http_types_own_outgoing_body_t handle) { + __wasm_import_wasi_http_types_outgoing_body_drop(handle.__handle); } -wasi_http_0_2_0_types_borrow_outgoing_body_t wasi_http_0_2_0_types_borrow_outgoing_body(wasi_http_0_2_0_types_own_outgoing_body_t arg) { - return (wasi_http_0_2_0_types_borrow_outgoing_body_t) { arg.__handle }; +wasi_http_types_borrow_outgoing_body_t wasi_http_types_borrow_outgoing_body(wasi_http_types_own_outgoing_body_t arg) { + return (wasi_http_types_borrow_outgoing_body_t) { arg.__handle }; } __attribute__((__import_module__("wasi:http/types@0.2.0"), __import_name__("[resource-drop]future-incoming-response"))) -extern void __wasm_import_wasi_http_0_2_0_types_future_incoming_response_drop(int32_t handle); - -void wasi_http_0_2_0_types_future_incoming_response_drop_own(wasi_http_0_2_0_types_own_future_incoming_response_t handle) { - __wasm_import_wasi_http_0_2_0_types_future_incoming_response_drop(handle.__handle); -} +extern void __wasm_import_wasi_http_types_future_incoming_response_drop(int32_t handle); -void wasi_http_0_2_0_types_future_incoming_response_drop_borrow(wasi_http_0_2_0_types_own_future_incoming_response_t handle) { - __wasm_import_wasi_http_0_2_0_types_future_incoming_response_drop(handle.__handle); +void wasi_http_types_future_incoming_response_drop_own(wasi_http_types_own_future_incoming_response_t handle) { + __wasm_import_wasi_http_types_future_incoming_response_drop(handle.__handle); } -wasi_http_0_2_0_types_borrow_future_incoming_response_t wasi_http_0_2_0_types_borrow_future_incoming_response(wasi_http_0_2_0_types_own_future_incoming_response_t arg) { - return (wasi_http_0_2_0_types_borrow_future_incoming_response_t) { arg.__handle }; +wasi_http_types_borrow_future_incoming_response_t wasi_http_types_borrow_future_incoming_response(wasi_http_types_own_future_incoming_response_t arg) { + return (wasi_http_types_borrow_future_incoming_response_t) { arg.__handle }; } -void wasi_http_0_2_0_types_option_error_code_free(wasi_http_0_2_0_types_option_error_code_t *ptr) { +void wasi_http_types_option_error_code_free(wasi_http_types_option_error_code_t *ptr) { if (ptr->is_some) { - wasi_http_0_2_0_types_error_code_free(&ptr->val); + wasi_http_types_error_code_free(&ptr->val); } } -void wasi_http_0_2_0_types_tuple2_field_key_field_value_free(wasi_http_0_2_0_types_tuple2_field_key_field_value_t *ptr) { - wasi_http_0_2_0_types_field_key_free(&ptr->f0); - wasi_http_0_2_0_types_field_value_free(&ptr->f1); +void bindings_tuple2_field_key_field_value_free(bindings_tuple2_field_key_field_value_t *ptr) { + wasi_http_types_field_key_free(&ptr->f0); + wasi_http_types_field_value_free(&ptr->f1); } -void wasi_http_0_2_0_types_list_tuple2_field_key_field_value_free(wasi_http_0_2_0_types_list_tuple2_field_key_field_value_t *ptr) { - for (size_t i = 0; i < ptr->len; i++) { - wasi_http_0_2_0_types_tuple2_field_key_field_value_free(&ptr->ptr[i]); - } - if (ptr->len > 0) { - free(ptr->ptr); +void bindings_list_tuple2_field_key_field_value_free(bindings_list_tuple2_field_key_field_value_t *ptr) { + size_t list_len = ptr->len; + if (list_len > 0) { + bindings_tuple2_field_key_field_value_t *list_ptr = ptr->ptr; + for (size_t i = 0; i < list_len; i++) { + bindings_tuple2_field_key_field_value_free(&list_ptr[i]); + } + free(list_ptr); } } -void wasi_http_0_2_0_types_result_own_fields_header_error_free(wasi_http_0_2_0_types_result_own_fields_header_error_t *ptr) { +void wasi_http_types_result_own_fields_header_error_free(wasi_http_types_result_own_fields_header_error_t *ptr) { if (!ptr->is_err) { } else { - wasi_http_0_2_0_types_header_error_free(&ptr->val.err); + wasi_http_types_header_error_free(&ptr->val.err); } } -void wasi_http_0_2_0_types_list_field_value_free(wasi_http_0_2_0_types_list_field_value_t *ptr) { - for (size_t i = 0; i < ptr->len; i++) { - wasi_http_0_2_0_types_field_value_free(&ptr->ptr[i]); - } - if (ptr->len > 0) { - free(ptr->ptr); +void bindings_list_field_value_free(bindings_list_field_value_t *ptr) { + size_t list_len = ptr->len; + if (list_len > 0) { + wasi_http_types_field_value_t *list_ptr = ptr->ptr; + for (size_t i = 0; i < list_len; i++) { + wasi_http_types_field_value_free(&list_ptr[i]); + } + free(list_ptr); } } -void wasi_http_0_2_0_types_result_void_header_error_free(wasi_http_0_2_0_types_result_void_header_error_t *ptr) { +void wasi_http_types_result_void_header_error_free(wasi_http_types_result_void_header_error_t *ptr) { if (!ptr->is_err) { } else { - wasi_http_0_2_0_types_header_error_free(&ptr->val.err); + wasi_http_types_header_error_free(&ptr->val.err); } } -void wasi_http_0_2_0_types_option_scheme_free(wasi_http_0_2_0_types_option_scheme_t *ptr) { +void wasi_http_types_option_scheme_free(wasi_http_types_option_scheme_t *ptr) { if (ptr->is_some) { - wasi_http_0_2_0_types_scheme_free(&ptr->val); + wasi_http_types_scheme_free(&ptr->val); } } -void wasi_http_0_2_0_types_result_own_incoming_body_void_free(wasi_http_0_2_0_types_result_own_incoming_body_void_t *ptr) { +void wasi_http_types_result_own_incoming_body_void_free(wasi_http_types_result_own_incoming_body_void_t *ptr) { if (!ptr->is_err) { } } -void wasi_http_0_2_0_types_result_own_outgoing_body_void_free(wasi_http_0_2_0_types_result_own_outgoing_body_void_t *ptr) { +void wasi_http_types_result_own_outgoing_body_void_free(wasi_http_types_result_own_outgoing_body_void_t *ptr) { if (!ptr->is_err) { } } -void wasi_http_0_2_0_types_result_void_void_free(wasi_http_0_2_0_types_result_void_void_t *ptr) { +void wasi_http_types_result_void_void_free(wasi_http_types_result_void_void_t *ptr) { if (!ptr->is_err) { } } -void wasi_http_0_2_0_types_option_duration_free(wasi_http_0_2_0_types_option_duration_t *ptr) { +void bindings_option_duration_free(bindings_option_duration_t *ptr) { if (ptr->is_some) { } } -void wasi_http_0_2_0_types_result_own_outgoing_response_error_code_free(wasi_http_0_2_0_types_result_own_outgoing_response_error_code_t *ptr) { +void wasi_http_types_result_own_outgoing_response_error_code_free(wasi_http_types_result_own_outgoing_response_error_code_t *ptr) { if (!ptr->is_err) { } else { - wasi_http_0_2_0_types_error_code_free(&ptr->val.err); + wasi_http_types_error_code_free(&ptr->val.err); } } -void wasi_http_0_2_0_types_result_own_input_stream_void_free(wasi_http_0_2_0_types_result_own_input_stream_void_t *ptr) { +void wasi_http_types_result_own_input_stream_void_free(wasi_http_types_result_own_input_stream_void_t *ptr) { if (!ptr->is_err) { } } -void wasi_http_0_2_0_types_option_own_trailers_free(wasi_http_0_2_0_types_option_own_trailers_t *ptr) { +void wasi_http_types_option_own_trailers_free(wasi_http_types_option_own_trailers_t *ptr) { if (ptr->is_some) { } } -void wasi_http_0_2_0_types_result_option_own_trailers_error_code_free(wasi_http_0_2_0_types_result_option_own_trailers_error_code_t *ptr) { +void wasi_http_types_result_option_own_trailers_error_code_free(wasi_http_types_result_option_own_trailers_error_code_t *ptr) { if (!ptr->is_err) { - wasi_http_0_2_0_types_option_own_trailers_free(&ptr->val.ok); + wasi_http_types_option_own_trailers_free(&ptr->val.ok); } else { - wasi_http_0_2_0_types_error_code_free(&ptr->val.err); + wasi_http_types_error_code_free(&ptr->val.err); } } -void wasi_http_0_2_0_types_result_result_option_own_trailers_error_code_void_free(wasi_http_0_2_0_types_result_result_option_own_trailers_error_code_void_t *ptr) { +void wasi_http_types_result_result_option_own_trailers_error_code_void_free(wasi_http_types_result_result_option_own_trailers_error_code_void_t *ptr) { if (!ptr->is_err) { - wasi_http_0_2_0_types_result_option_own_trailers_error_code_free(&ptr->val.ok); + wasi_http_types_result_option_own_trailers_error_code_free(&ptr->val.ok); } } -void wasi_http_0_2_0_types_option_result_result_option_own_trailers_error_code_void_free(wasi_http_0_2_0_types_option_result_result_option_own_trailers_error_code_void_t *ptr) { +void wasi_http_types_option_result_result_option_own_trailers_error_code_void_free(wasi_http_types_option_result_result_option_own_trailers_error_code_void_t *ptr) { if (ptr->is_some) { - wasi_http_0_2_0_types_result_result_option_own_trailers_error_code_void_free(&ptr->val); + wasi_http_types_result_result_option_own_trailers_error_code_void_free(&ptr->val); } } -void wasi_http_0_2_0_types_result_own_output_stream_void_free(wasi_http_0_2_0_types_result_own_output_stream_void_t *ptr) { +void wasi_http_types_result_own_output_stream_void_free(wasi_http_types_result_own_output_stream_void_t *ptr) { if (!ptr->is_err) { } } -void wasi_http_0_2_0_types_result_void_error_code_free(wasi_http_0_2_0_types_result_void_error_code_t *ptr) { +void wasi_http_types_result_void_error_code_free(wasi_http_types_result_void_error_code_t *ptr) { if (!ptr->is_err) { } else { - wasi_http_0_2_0_types_error_code_free(&ptr->val.err); + wasi_http_types_error_code_free(&ptr->val.err); } } -void wasi_http_0_2_0_types_result_own_incoming_response_error_code_free(wasi_http_0_2_0_types_result_own_incoming_response_error_code_t *ptr) { +void wasi_http_types_result_own_incoming_response_error_code_free(wasi_http_types_result_own_incoming_response_error_code_t *ptr) { if (!ptr->is_err) { } else { - wasi_http_0_2_0_types_error_code_free(&ptr->val.err); + wasi_http_types_error_code_free(&ptr->val.err); } } -void wasi_http_0_2_0_types_result_result_own_incoming_response_error_code_void_free(wasi_http_0_2_0_types_result_result_own_incoming_response_error_code_void_t *ptr) { +void wasi_http_types_result_result_own_incoming_response_error_code_void_free(wasi_http_types_result_result_own_incoming_response_error_code_void_t *ptr) { if (!ptr->is_err) { - wasi_http_0_2_0_types_result_own_incoming_response_error_code_free(&ptr->val.ok); + wasi_http_types_result_own_incoming_response_error_code_free(&ptr->val.ok); } } -void wasi_http_0_2_0_types_option_result_result_own_incoming_response_error_code_void_free(wasi_http_0_2_0_types_option_result_result_own_incoming_response_error_code_void_t *ptr) { +void wasi_http_types_option_result_result_own_incoming_response_error_code_void_free(wasi_http_types_option_result_result_own_incoming_response_error_code_void_t *ptr) { if (ptr->is_some) { - wasi_http_0_2_0_types_result_result_own_incoming_response_error_code_void_free(&ptr->val); + wasi_http_types_result_result_own_incoming_response_error_code_void_free(&ptr->val); } } -void wasi_http_0_2_0_outgoing_handler_error_code_free(wasi_http_0_2_0_outgoing_handler_error_code_t *ptr) { - wasi_http_0_2_0_types_error_code_free(ptr); +void wasi_http_outgoing_handler_error_code_free(wasi_http_outgoing_handler_error_code_t *ptr) { + wasi_http_types_error_code_free(ptr); } -void wasi_http_0_2_0_outgoing_handler_option_own_request_options_free(wasi_http_0_2_0_outgoing_handler_option_own_request_options_t *ptr) { +void wasi_http_outgoing_handler_option_own_request_options_free(wasi_http_outgoing_handler_option_own_request_options_t *ptr) { if (ptr->is_some) { } } -void wasi_http_0_2_0_outgoing_handler_result_own_future_incoming_response_error_code_free(wasi_http_0_2_0_outgoing_handler_result_own_future_incoming_response_error_code_t *ptr) { +void wasi_http_outgoing_handler_result_own_future_incoming_response_error_code_free(wasi_http_outgoing_handler_result_own_future_incoming_response_error_code_t *ptr) { if (!ptr->is_err) { } else { - wasi_http_0_2_0_outgoing_handler_error_code_free(&ptr->val.err); + wasi_http_outgoing_handler_error_code_free(&ptr->val.err); } } -void exports_wasi_cli_0_2_0_run_result_void_void_free(exports_wasi_cli_0_2_0_run_result_void_void_t *ptr) { +void exports_wasi_cli_run_result_void_void_free(exports_wasi_cli_run_result_void_void_t *ptr) { if (!ptr->is_err) { } } -void bindings_string_set(bindings_string_t *ret, char*s) { +void bindings_string_set(bindings_string_t *ret, const char*s) { ret->ptr = (uint8_t*) s; ret->len = strlen(s); } void bindings_string_dup(bindings_string_t *ret, const char*s) { ret->len = strlen(s); - ret->ptr = cabi_realloc(NULL, 0, 1, ret->len * 1); + ret->ptr = (uint8_t*) cabi_realloc(NULL, 0, 1, ret->len * 1); memcpy(ret->ptr, s, ret->len * 1); } @@ -1700,17 +1661,17 @@ void bindings_string_free(bindings_string_t *ret) { bool gcore_fastedge_dictionary_get(bindings_string_t *name, bindings_string_t *ret) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_gcore_fastedge_dictionary_get((int32_t) (*name).ptr, (int32_t) (*name).len, ptr); - gcore_fastedge_dictionary_option_string_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_gcore_fastedge_dictionary_get((uint8_t *) (*name).ptr, (*name).len, ptr); + bindings_option_string_t option; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { option.is_some = false; break; } case 1: { option.is_some = true; - option.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + option.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 4))), (*((size_t*) (ptr + 8))) }; break; } } @@ -1718,36 +1679,146 @@ bool gcore_fastedge_dictionary_get(bindings_string_t *name, bindings_string_t *r return option.is_some; } -void wasi_cli_0_2_0_environment_get_environment(wasi_cli_0_2_0_environment_list_tuple2_string_string_t *ret) { +bool gcore_fastedge_secret_get(bindings_string_t *key, bindings_option_string_t *ret, gcore_fastedge_secret_error_t *err) { + __attribute__((__aligned__(4))) + uint8_t ret_area[16]; + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_gcore_fastedge_secret_get((uint8_t *) (*key).ptr, (*key).len, ptr); + gcore_fastedge_secret_result_option_string_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { + case 0: { + result.is_err = false; + bindings_option_string_t option; + switch ((int32_t) *((uint8_t*) (ptr + 4))) { + case 0: { + option.is_some = false; + break; + } + case 1: { + option.is_some = true; + option.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 8))), (*((size_t*) (ptr + 12))) }; + break; + } + } + + result.val.ok = option; + break; + } + case 1: { + result.is_err = true; + gcore_fastedge_secret_error_t variant; + variant.tag = (int32_t) *((uint8_t*) (ptr + 4)); + switch ((int32_t) variant.tag) { + case 0: { + break; + } + case 1: { + break; + } + case 2: { + variant.val.other = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 8))), (*((size_t*) (ptr + 12))) }; + break; + } + } + + result.val.err = variant; + break; + } + } + if (!result.is_err) { + *ret = result.val.ok; + return 1; + } else { + *err = result.val.err; + return 0; + } +} + +bool gcore_fastedge_secret_get_effective_at(bindings_string_t *key, uint32_t at, bindings_option_string_t *ret, gcore_fastedge_secret_error_t *err) { + __attribute__((__aligned__(4))) + uint8_t ret_area[16]; + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_gcore_fastedge_secret_get_effective_at((uint8_t *) (*key).ptr, (*key).len, (int32_t) (at), ptr); + gcore_fastedge_secret_result_option_string_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { + case 0: { + result.is_err = false; + bindings_option_string_t option; + switch ((int32_t) *((uint8_t*) (ptr + 4))) { + case 0: { + option.is_some = false; + break; + } + case 1: { + option.is_some = true; + option.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 8))), (*((size_t*) (ptr + 12))) }; + break; + } + } + + result.val.ok = option; + break; + } + case 1: { + result.is_err = true; + gcore_fastedge_secret_error_t variant; + variant.tag = (int32_t) *((uint8_t*) (ptr + 4)); + switch ((int32_t) variant.tag) { + case 0: { + break; + } + case 1: { + break; + } + case 2: { + variant.val.other = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 8))), (*((size_t*) (ptr + 12))) }; + break; + } + } + + result.val.err = variant; + break; + } + } + if (!result.is_err) { + *ret = result.val.ok; + return 1; + } else { + *err = result.val.err; + return 0; + } +} + +void wasi_cli_environment_get_environment(bindings_list_tuple2_string_string_t *ret) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_cli_0_2_0_environment_get_environment(ptr); - *ret = (wasi_cli_0_2_0_environment_list_tuple2_string_string_t) { (wasi_cli_0_2_0_environment_tuple2_string_string_t*)(*((int32_t*) (ptr + 0))), (size_t)(*((int32_t*) (ptr + 4))) }; + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_cli_environment_get_environment(ptr); + *ret = (bindings_list_tuple2_string_string_t) { (bindings_tuple2_string_string_t*)(*((uint8_t **) (ptr + 0))), (*((size_t*) (ptr + 4))) }; } -void wasi_cli_0_2_0_environment_get_arguments(wasi_cli_0_2_0_environment_list_string_t *ret) { +void wasi_cli_environment_get_arguments(bindings_list_string_t *ret) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_cli_0_2_0_environment_get_arguments(ptr); - *ret = (wasi_cli_0_2_0_environment_list_string_t) { (bindings_string_t*)(*((int32_t*) (ptr + 0))), (size_t)(*((int32_t*) (ptr + 4))) }; + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_cli_environment_get_arguments(ptr); + *ret = (bindings_list_string_t) { (bindings_string_t*)(*((uint8_t **) (ptr + 0))), (*((size_t*) (ptr + 4))) }; } -bool wasi_cli_0_2_0_environment_initial_cwd(bindings_string_t *ret) { +bool wasi_cli_environment_initial_cwd(bindings_string_t *ret) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_cli_0_2_0_environment_initial_cwd(ptr); - wasi_cli_0_2_0_environment_option_string_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_cli_environment_initial_cwd(ptr); + bindings_option_string_t option; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { option.is_some = false; break; } case 1: { option.is_some = true; - option.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + option.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 4))), (*((size_t*) (ptr + 8))) }; break; } } @@ -1755,67 +1826,67 @@ bool wasi_cli_0_2_0_environment_initial_cwd(bindings_string_t *ret) { return option.is_some; } -void wasi_cli_0_2_0_exit_exit(wasi_cli_0_2_0_exit_result_void_void_t *status) { +void wasi_cli_exit_exit(wasi_cli_exit_result_void_void_t *status) { int32_t result; if ((*status).is_err) { result = 1; } else { result = 0; } - __wasm_import_wasi_cli_0_2_0_exit_exit(result); + __wasm_import_wasi_cli_exit_exit(result); } -void wasi_io_0_2_0_error_method_error_to_debug_string(wasi_io_0_2_0_error_borrow_error_t self, bindings_string_t *ret) { +void wasi_io_error_method_error_to_debug_string(wasi_io_error_borrow_error_t self, bindings_string_t *ret) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_io_0_2_0_error_method_error_to_debug_string((self).__handle, ptr); - *ret = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 0))), (size_t)(*((int32_t*) (ptr + 4))) }; + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_io_error_method_error_to_debug_string((self).__handle, ptr); + *ret = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 0))), (*((size_t*) (ptr + 4))) }; } -bool wasi_io_0_2_0_poll_method_pollable_ready(wasi_io_0_2_0_poll_borrow_pollable_t self) { - int32_t ret = __wasm_import_wasi_io_0_2_0_poll_method_pollable_ready((self).__handle); +bool wasi_io_poll_method_pollable_ready(wasi_io_poll_borrow_pollable_t self) { + int32_t ret = __wasm_import_wasi_io_poll_method_pollable_ready((self).__handle); return ret; } -void wasi_io_0_2_0_poll_method_pollable_block(wasi_io_0_2_0_poll_borrow_pollable_t self) { - __wasm_import_wasi_io_0_2_0_poll_method_pollable_block((self).__handle); +void wasi_io_poll_method_pollable_block(wasi_io_poll_borrow_pollable_t self) { + __wasm_import_wasi_io_poll_method_pollable_block((self).__handle); } -void wasi_io_0_2_0_poll_poll(wasi_io_0_2_0_poll_list_borrow_pollable_t *in, wasi_io_0_2_0_poll_list_u32_t *ret) { +void wasi_io_poll_poll(wasi_io_poll_list_borrow_pollable_t *in, bindings_list_u32_t *ret) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_io_0_2_0_poll_poll((int32_t) (*in).ptr, (int32_t) (*in).len, ptr); - *ret = (wasi_io_0_2_0_poll_list_u32_t) { (uint32_t*)(*((int32_t*) (ptr + 0))), (size_t)(*((int32_t*) (ptr + 4))) }; + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_io_poll_poll((uint8_t *) (*in).ptr, (*in).len, ptr); + *ret = (bindings_list_u32_t) { (uint32_t*)(*((uint8_t **) (ptr + 0))), (*((size_t*) (ptr + 4))) }; } -bool wasi_io_0_2_0_streams_method_input_stream_read(wasi_io_0_2_0_streams_borrow_input_stream_t self, uint64_t len, wasi_io_0_2_0_streams_list_u8_t *ret, wasi_io_0_2_0_streams_stream_error_t *err) { +bool wasi_io_streams_method_input_stream_read(wasi_io_streams_borrow_input_stream_t self, uint64_t len, bindings_list_u8_t *ret, wasi_io_streams_stream_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_io_0_2_0_streams_method_input_stream_read((self).__handle, (int64_t) (len), ptr); - wasi_io_0_2_0_streams_result_list_u8_stream_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_io_streams_method_input_stream_read((self).__handle, (int64_t) (len), ptr); + wasi_io_streams_result_list_u8_stream_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (wasi_io_0_2_0_streams_list_u8_t) { (uint8_t*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + result.val.ok = (bindings_list_u8_t) { (uint8_t*)(*((uint8_t **) (ptr + 4))), (*((size_t*) (ptr + 8))) }; break; } case 1: { result.is_err = true; - wasi_io_0_2_0_streams_stream_error_t variant; - variant.tag = (int32_t) (*((uint8_t*) (ptr + 4))); + wasi_io_streams_stream_error_t variant; + variant.tag = (int32_t) *((uint8_t*) (ptr + 4)); switch ((int32_t) variant.tag) { case 0: { - variant.val.last_operation_failed = (wasi_io_0_2_0_streams_own_error_t) { *((int32_t*) (ptr + 8)) }; + variant.val.last_operation_failed = (wasi_io_streams_own_error_t) { *((int32_t*) (ptr + 8)) }; break; } case 1: { break; } } - + result.val.err = variant; break; } @@ -1829,32 +1900,32 @@ bool wasi_io_0_2_0_streams_method_input_stream_read(wasi_io_0_2_0_streams_borrow } } -bool wasi_io_0_2_0_streams_method_input_stream_blocking_read(wasi_io_0_2_0_streams_borrow_input_stream_t self, uint64_t len, wasi_io_0_2_0_streams_list_u8_t *ret, wasi_io_0_2_0_streams_stream_error_t *err) { +bool wasi_io_streams_method_input_stream_blocking_read(wasi_io_streams_borrow_input_stream_t self, uint64_t len, bindings_list_u8_t *ret, wasi_io_streams_stream_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_io_0_2_0_streams_method_input_stream_blocking_read((self).__handle, (int64_t) (len), ptr); - wasi_io_0_2_0_streams_result_list_u8_stream_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_io_streams_method_input_stream_blocking_read((self).__handle, (int64_t) (len), ptr); + wasi_io_streams_result_list_u8_stream_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (wasi_io_0_2_0_streams_list_u8_t) { (uint8_t*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + result.val.ok = (bindings_list_u8_t) { (uint8_t*)(*((uint8_t **) (ptr + 4))), (*((size_t*) (ptr + 8))) }; break; } case 1: { result.is_err = true; - wasi_io_0_2_0_streams_stream_error_t variant; - variant.tag = (int32_t) (*((uint8_t*) (ptr + 4))); + wasi_io_streams_stream_error_t variant; + variant.tag = (int32_t) *((uint8_t*) (ptr + 4)); switch ((int32_t) variant.tag) { case 0: { - variant.val.last_operation_failed = (wasi_io_0_2_0_streams_own_error_t) { *((int32_t*) (ptr + 8)) }; + variant.val.last_operation_failed = (wasi_io_streams_own_error_t) { *((int32_t*) (ptr + 8)) }; break; } case 1: { break; } } - + result.val.err = variant; break; } @@ -1868,13 +1939,13 @@ bool wasi_io_0_2_0_streams_method_input_stream_blocking_read(wasi_io_0_2_0_strea } } -bool wasi_io_0_2_0_streams_method_input_stream_skip(wasi_io_0_2_0_streams_borrow_input_stream_t self, uint64_t len, uint64_t *ret, wasi_io_0_2_0_streams_stream_error_t *err) { +bool wasi_io_streams_method_input_stream_skip(wasi_io_streams_borrow_input_stream_t self, uint64_t len, uint64_t *ret, wasi_io_streams_stream_error_t *err) { __attribute__((__aligned__(8))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_io_0_2_0_streams_method_input_stream_skip((self).__handle, (int64_t) (len), ptr); - wasi_io_0_2_0_streams_result_u64_stream_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_io_streams_method_input_stream_skip((self).__handle, (int64_t) (len), ptr); + wasi_io_streams_result_u64_stream_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint64_t) (*((int64_t*) (ptr + 8))); @@ -1882,18 +1953,18 @@ bool wasi_io_0_2_0_streams_method_input_stream_skip(wasi_io_0_2_0_streams_borrow } case 1: { result.is_err = true; - wasi_io_0_2_0_streams_stream_error_t variant; - variant.tag = (int32_t) (*((uint8_t*) (ptr + 8))); + wasi_io_streams_stream_error_t variant; + variant.tag = (int32_t) *((uint8_t*) (ptr + 8)); switch ((int32_t) variant.tag) { case 0: { - variant.val.last_operation_failed = (wasi_io_0_2_0_streams_own_error_t) { *((int32_t*) (ptr + 12)) }; + variant.val.last_operation_failed = (wasi_io_streams_own_error_t) { *((int32_t*) (ptr + 12)) }; break; } case 1: { break; } } - + result.val.err = variant; break; } @@ -1907,13 +1978,13 @@ bool wasi_io_0_2_0_streams_method_input_stream_skip(wasi_io_0_2_0_streams_borrow } } -bool wasi_io_0_2_0_streams_method_input_stream_blocking_skip(wasi_io_0_2_0_streams_borrow_input_stream_t self, uint64_t len, uint64_t *ret, wasi_io_0_2_0_streams_stream_error_t *err) { +bool wasi_io_streams_method_input_stream_blocking_skip(wasi_io_streams_borrow_input_stream_t self, uint64_t len, uint64_t *ret, wasi_io_streams_stream_error_t *err) { __attribute__((__aligned__(8))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_io_0_2_0_streams_method_input_stream_blocking_skip((self).__handle, (int64_t) (len), ptr); - wasi_io_0_2_0_streams_result_u64_stream_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_io_streams_method_input_stream_blocking_skip((self).__handle, (int64_t) (len), ptr); + wasi_io_streams_result_u64_stream_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint64_t) (*((int64_t*) (ptr + 8))); @@ -1921,18 +1992,18 @@ bool wasi_io_0_2_0_streams_method_input_stream_blocking_skip(wasi_io_0_2_0_strea } case 1: { result.is_err = true; - wasi_io_0_2_0_streams_stream_error_t variant; - variant.tag = (int32_t) (*((uint8_t*) (ptr + 8))); + wasi_io_streams_stream_error_t variant; + variant.tag = (int32_t) *((uint8_t*) (ptr + 8)); switch ((int32_t) variant.tag) { case 0: { - variant.val.last_operation_failed = (wasi_io_0_2_0_streams_own_error_t) { *((int32_t*) (ptr + 12)) }; + variant.val.last_operation_failed = (wasi_io_streams_own_error_t) { *((int32_t*) (ptr + 12)) }; break; } case 1: { break; } } - + result.val.err = variant; break; } @@ -1946,18 +2017,18 @@ bool wasi_io_0_2_0_streams_method_input_stream_blocking_skip(wasi_io_0_2_0_strea } } -wasi_io_0_2_0_streams_own_pollable_t wasi_io_0_2_0_streams_method_input_stream_subscribe(wasi_io_0_2_0_streams_borrow_input_stream_t self) { - int32_t ret = __wasm_import_wasi_io_0_2_0_streams_method_input_stream_subscribe((self).__handle); - return (wasi_io_0_2_0_streams_own_pollable_t) { ret }; +wasi_io_streams_own_pollable_t wasi_io_streams_method_input_stream_subscribe(wasi_io_streams_borrow_input_stream_t self) { + int32_t ret = __wasm_import_wasi_io_streams_method_input_stream_subscribe((self).__handle); + return (wasi_io_streams_own_pollable_t) { ret }; } -bool wasi_io_0_2_0_streams_method_output_stream_check_write(wasi_io_0_2_0_streams_borrow_output_stream_t self, uint64_t *ret, wasi_io_0_2_0_streams_stream_error_t *err) { +bool wasi_io_streams_method_output_stream_check_write(wasi_io_streams_borrow_output_stream_t self, uint64_t *ret, wasi_io_streams_stream_error_t *err) { __attribute__((__aligned__(8))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_io_0_2_0_streams_method_output_stream_check_write((self).__handle, ptr); - wasi_io_0_2_0_streams_result_u64_stream_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_io_streams_method_output_stream_check_write((self).__handle, ptr); + wasi_io_streams_result_u64_stream_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint64_t) (*((int64_t*) (ptr + 8))); @@ -1965,18 +2036,18 @@ bool wasi_io_0_2_0_streams_method_output_stream_check_write(wasi_io_0_2_0_stream } case 1: { result.is_err = true; - wasi_io_0_2_0_streams_stream_error_t variant; - variant.tag = (int32_t) (*((uint8_t*) (ptr + 8))); + wasi_io_streams_stream_error_t variant; + variant.tag = (int32_t) *((uint8_t*) (ptr + 8)); switch ((int32_t) variant.tag) { case 0: { - variant.val.last_operation_failed = (wasi_io_0_2_0_streams_own_error_t) { *((int32_t*) (ptr + 12)) }; + variant.val.last_operation_failed = (wasi_io_streams_own_error_t) { *((int32_t*) (ptr + 12)) }; break; } case 1: { break; } } - + result.val.err = variant; break; } @@ -1990,31 +2061,31 @@ bool wasi_io_0_2_0_streams_method_output_stream_check_write(wasi_io_0_2_0_stream } } -bool wasi_io_0_2_0_streams_method_output_stream_write(wasi_io_0_2_0_streams_borrow_output_stream_t self, wasi_io_0_2_0_streams_list_u8_t *contents, wasi_io_0_2_0_streams_stream_error_t *err) { +bool wasi_io_streams_method_output_stream_write(wasi_io_streams_borrow_output_stream_t self, bindings_list_u8_t *contents, wasi_io_streams_stream_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_io_0_2_0_streams_method_output_stream_write((self).__handle, (int32_t) (*contents).ptr, (int32_t) (*contents).len, ptr); - wasi_io_0_2_0_streams_result_void_stream_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_io_streams_method_output_stream_write((self).__handle, (uint8_t *) (*contents).ptr, (*contents).len, ptr); + wasi_io_streams_result_void_stream_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; break; } case 1: { result.is_err = true; - wasi_io_0_2_0_streams_stream_error_t variant; - variant.tag = (int32_t) (*((uint8_t*) (ptr + 4))); + wasi_io_streams_stream_error_t variant; + variant.tag = (int32_t) *((uint8_t*) (ptr + 4)); switch ((int32_t) variant.tag) { case 0: { - variant.val.last_operation_failed = (wasi_io_0_2_0_streams_own_error_t) { *((int32_t*) (ptr + 8)) }; + variant.val.last_operation_failed = (wasi_io_streams_own_error_t) { *((int32_t*) (ptr + 8)) }; break; } case 1: { break; } } - + result.val.err = variant; break; } @@ -2027,31 +2098,31 @@ bool wasi_io_0_2_0_streams_method_output_stream_write(wasi_io_0_2_0_streams_borr } } -bool wasi_io_0_2_0_streams_method_output_stream_blocking_write_and_flush(wasi_io_0_2_0_streams_borrow_output_stream_t self, wasi_io_0_2_0_streams_list_u8_t *contents, wasi_io_0_2_0_streams_stream_error_t *err) { +bool wasi_io_streams_method_output_stream_blocking_write_and_flush(wasi_io_streams_borrow_output_stream_t self, bindings_list_u8_t *contents, wasi_io_streams_stream_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_io_0_2_0_streams_method_output_stream_blocking_write_and_flush((self).__handle, (int32_t) (*contents).ptr, (int32_t) (*contents).len, ptr); - wasi_io_0_2_0_streams_result_void_stream_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_io_streams_method_output_stream_blocking_write_and_flush((self).__handle, (uint8_t *) (*contents).ptr, (*contents).len, ptr); + wasi_io_streams_result_void_stream_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; break; } case 1: { result.is_err = true; - wasi_io_0_2_0_streams_stream_error_t variant; - variant.tag = (int32_t) (*((uint8_t*) (ptr + 4))); + wasi_io_streams_stream_error_t variant; + variant.tag = (int32_t) *((uint8_t*) (ptr + 4)); switch ((int32_t) variant.tag) { case 0: { - variant.val.last_operation_failed = (wasi_io_0_2_0_streams_own_error_t) { *((int32_t*) (ptr + 8)) }; + variant.val.last_operation_failed = (wasi_io_streams_own_error_t) { *((int32_t*) (ptr + 8)) }; break; } case 1: { break; } } - + result.val.err = variant; break; } @@ -2064,31 +2135,31 @@ bool wasi_io_0_2_0_streams_method_output_stream_blocking_write_and_flush(wasi_io } } -bool wasi_io_0_2_0_streams_method_output_stream_flush(wasi_io_0_2_0_streams_borrow_output_stream_t self, wasi_io_0_2_0_streams_stream_error_t *err) { +bool wasi_io_streams_method_output_stream_flush(wasi_io_streams_borrow_output_stream_t self, wasi_io_streams_stream_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_io_0_2_0_streams_method_output_stream_flush((self).__handle, ptr); - wasi_io_0_2_0_streams_result_void_stream_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_io_streams_method_output_stream_flush((self).__handle, ptr); + wasi_io_streams_result_void_stream_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; break; } case 1: { result.is_err = true; - wasi_io_0_2_0_streams_stream_error_t variant; - variant.tag = (int32_t) (*((uint8_t*) (ptr + 4))); + wasi_io_streams_stream_error_t variant; + variant.tag = (int32_t) *((uint8_t*) (ptr + 4)); switch ((int32_t) variant.tag) { case 0: { - variant.val.last_operation_failed = (wasi_io_0_2_0_streams_own_error_t) { *((int32_t*) (ptr + 8)) }; + variant.val.last_operation_failed = (wasi_io_streams_own_error_t) { *((int32_t*) (ptr + 8)) }; break; } case 1: { break; } } - + result.val.err = variant; break; } @@ -2101,31 +2172,31 @@ bool wasi_io_0_2_0_streams_method_output_stream_flush(wasi_io_0_2_0_streams_borr } } -bool wasi_io_0_2_0_streams_method_output_stream_blocking_flush(wasi_io_0_2_0_streams_borrow_output_stream_t self, wasi_io_0_2_0_streams_stream_error_t *err) { +bool wasi_io_streams_method_output_stream_blocking_flush(wasi_io_streams_borrow_output_stream_t self, wasi_io_streams_stream_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_io_0_2_0_streams_method_output_stream_blocking_flush((self).__handle, ptr); - wasi_io_0_2_0_streams_result_void_stream_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_io_streams_method_output_stream_blocking_flush((self).__handle, ptr); + wasi_io_streams_result_void_stream_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; break; } case 1: { result.is_err = true; - wasi_io_0_2_0_streams_stream_error_t variant; - variant.tag = (int32_t) (*((uint8_t*) (ptr + 4))); + wasi_io_streams_stream_error_t variant; + variant.tag = (int32_t) *((uint8_t*) (ptr + 4)); switch ((int32_t) variant.tag) { case 0: { - variant.val.last_operation_failed = (wasi_io_0_2_0_streams_own_error_t) { *((int32_t*) (ptr + 8)) }; + variant.val.last_operation_failed = (wasi_io_streams_own_error_t) { *((int32_t*) (ptr + 8)) }; break; } case 1: { break; } } - + result.val.err = variant; break; } @@ -2138,36 +2209,36 @@ bool wasi_io_0_2_0_streams_method_output_stream_blocking_flush(wasi_io_0_2_0_str } } -wasi_io_0_2_0_streams_own_pollable_t wasi_io_0_2_0_streams_method_output_stream_subscribe(wasi_io_0_2_0_streams_borrow_output_stream_t self) { - int32_t ret = __wasm_import_wasi_io_0_2_0_streams_method_output_stream_subscribe((self).__handle); - return (wasi_io_0_2_0_streams_own_pollable_t) { ret }; +wasi_io_streams_own_pollable_t wasi_io_streams_method_output_stream_subscribe(wasi_io_streams_borrow_output_stream_t self) { + int32_t ret = __wasm_import_wasi_io_streams_method_output_stream_subscribe((self).__handle); + return (wasi_io_streams_own_pollable_t) { ret }; } -bool wasi_io_0_2_0_streams_method_output_stream_write_zeroes(wasi_io_0_2_0_streams_borrow_output_stream_t self, uint64_t len, wasi_io_0_2_0_streams_stream_error_t *err) { +bool wasi_io_streams_method_output_stream_write_zeroes(wasi_io_streams_borrow_output_stream_t self, uint64_t len, wasi_io_streams_stream_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_io_0_2_0_streams_method_output_stream_write_zeroes((self).__handle, (int64_t) (len), ptr); - wasi_io_0_2_0_streams_result_void_stream_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_io_streams_method_output_stream_write_zeroes((self).__handle, (int64_t) (len), ptr); + wasi_io_streams_result_void_stream_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; break; } case 1: { result.is_err = true; - wasi_io_0_2_0_streams_stream_error_t variant; - variant.tag = (int32_t) (*((uint8_t*) (ptr + 4))); + wasi_io_streams_stream_error_t variant; + variant.tag = (int32_t) *((uint8_t*) (ptr + 4)); switch ((int32_t) variant.tag) { case 0: { - variant.val.last_operation_failed = (wasi_io_0_2_0_streams_own_error_t) { *((int32_t*) (ptr + 8)) }; + variant.val.last_operation_failed = (wasi_io_streams_own_error_t) { *((int32_t*) (ptr + 8)) }; break; } case 1: { break; } } - + result.val.err = variant; break; } @@ -2180,31 +2251,31 @@ bool wasi_io_0_2_0_streams_method_output_stream_write_zeroes(wasi_io_0_2_0_strea } } -bool wasi_io_0_2_0_streams_method_output_stream_blocking_write_zeroes_and_flush(wasi_io_0_2_0_streams_borrow_output_stream_t self, uint64_t len, wasi_io_0_2_0_streams_stream_error_t *err) { +bool wasi_io_streams_method_output_stream_blocking_write_zeroes_and_flush(wasi_io_streams_borrow_output_stream_t self, uint64_t len, wasi_io_streams_stream_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_io_0_2_0_streams_method_output_stream_blocking_write_zeroes_and_flush((self).__handle, (int64_t) (len), ptr); - wasi_io_0_2_0_streams_result_void_stream_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_io_streams_method_output_stream_blocking_write_zeroes_and_flush((self).__handle, (int64_t) (len), ptr); + wasi_io_streams_result_void_stream_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; break; } case 1: { result.is_err = true; - wasi_io_0_2_0_streams_stream_error_t variant; - variant.tag = (int32_t) (*((uint8_t*) (ptr + 4))); + wasi_io_streams_stream_error_t variant; + variant.tag = (int32_t) *((uint8_t*) (ptr + 4)); switch ((int32_t) variant.tag) { case 0: { - variant.val.last_operation_failed = (wasi_io_0_2_0_streams_own_error_t) { *((int32_t*) (ptr + 8)) }; + variant.val.last_operation_failed = (wasi_io_streams_own_error_t) { *((int32_t*) (ptr + 8)) }; break; } case 1: { break; } } - + result.val.err = variant; break; } @@ -2217,13 +2288,13 @@ bool wasi_io_0_2_0_streams_method_output_stream_blocking_write_zeroes_and_flush( } } -bool wasi_io_0_2_0_streams_method_output_stream_splice(wasi_io_0_2_0_streams_borrow_output_stream_t self, wasi_io_0_2_0_streams_borrow_input_stream_t src, uint64_t len, uint64_t *ret, wasi_io_0_2_0_streams_stream_error_t *err) { +bool wasi_io_streams_method_output_stream_splice(wasi_io_streams_borrow_output_stream_t self, wasi_io_streams_borrow_input_stream_t src, uint64_t len, uint64_t *ret, wasi_io_streams_stream_error_t *err) { __attribute__((__aligned__(8))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_io_0_2_0_streams_method_output_stream_splice((self).__handle, (src).__handle, (int64_t) (len), ptr); - wasi_io_0_2_0_streams_result_u64_stream_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_io_streams_method_output_stream_splice((self).__handle, (src).__handle, (int64_t) (len), ptr); + wasi_io_streams_result_u64_stream_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint64_t) (*((int64_t*) (ptr + 8))); @@ -2231,18 +2302,18 @@ bool wasi_io_0_2_0_streams_method_output_stream_splice(wasi_io_0_2_0_streams_bor } case 1: { result.is_err = true; - wasi_io_0_2_0_streams_stream_error_t variant; - variant.tag = (int32_t) (*((uint8_t*) (ptr + 8))); + wasi_io_streams_stream_error_t variant; + variant.tag = (int32_t) *((uint8_t*) (ptr + 8)); switch ((int32_t) variant.tag) { case 0: { - variant.val.last_operation_failed = (wasi_io_0_2_0_streams_own_error_t) { *((int32_t*) (ptr + 12)) }; + variant.val.last_operation_failed = (wasi_io_streams_own_error_t) { *((int32_t*) (ptr + 12)) }; break; } case 1: { break; } } - + result.val.err = variant; break; } @@ -2256,13 +2327,13 @@ bool wasi_io_0_2_0_streams_method_output_stream_splice(wasi_io_0_2_0_streams_bor } } -bool wasi_io_0_2_0_streams_method_output_stream_blocking_splice(wasi_io_0_2_0_streams_borrow_output_stream_t self, wasi_io_0_2_0_streams_borrow_input_stream_t src, uint64_t len, uint64_t *ret, wasi_io_0_2_0_streams_stream_error_t *err) { +bool wasi_io_streams_method_output_stream_blocking_splice(wasi_io_streams_borrow_output_stream_t self, wasi_io_streams_borrow_input_stream_t src, uint64_t len, uint64_t *ret, wasi_io_streams_stream_error_t *err) { __attribute__((__aligned__(8))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_io_0_2_0_streams_method_output_stream_blocking_splice((self).__handle, (src).__handle, (int64_t) (len), ptr); - wasi_io_0_2_0_streams_result_u64_stream_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_io_streams_method_output_stream_blocking_splice((self).__handle, (src).__handle, (int64_t) (len), ptr); + wasi_io_streams_result_u64_stream_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint64_t) (*((int64_t*) (ptr + 8))); @@ -2270,18 +2341,18 @@ bool wasi_io_0_2_0_streams_method_output_stream_blocking_splice(wasi_io_0_2_0_st } case 1: { result.is_err = true; - wasi_io_0_2_0_streams_stream_error_t variant; - variant.tag = (int32_t) (*((uint8_t*) (ptr + 8))); + wasi_io_streams_stream_error_t variant; + variant.tag = (int32_t) *((uint8_t*) (ptr + 8)); switch ((int32_t) variant.tag) { case 0: { - variant.val.last_operation_failed = (wasi_io_0_2_0_streams_own_error_t) { *((int32_t*) (ptr + 12)) }; + variant.val.last_operation_failed = (wasi_io_streams_own_error_t) { *((int32_t*) (ptr + 12)) }; break; } case 1: { break; } } - + result.val.err = variant; break; } @@ -2295,35 +2366,35 @@ bool wasi_io_0_2_0_streams_method_output_stream_blocking_splice(wasi_io_0_2_0_st } } -wasi_cli_0_2_0_stdin_own_input_stream_t wasi_cli_0_2_0_stdin_get_stdin(void) { - int32_t ret = __wasm_import_wasi_cli_0_2_0_stdin_get_stdin(); - return (wasi_cli_0_2_0_stdin_own_input_stream_t) { ret }; +wasi_cli_stdin_own_input_stream_t wasi_cli_stdin_get_stdin(void) { + int32_t ret = __wasm_import_wasi_cli_stdin_get_stdin(); + return (wasi_cli_stdin_own_input_stream_t) { ret }; } -wasi_cli_0_2_0_stdout_own_output_stream_t wasi_cli_0_2_0_stdout_get_stdout(void) { - int32_t ret = __wasm_import_wasi_cli_0_2_0_stdout_get_stdout(); - return (wasi_cli_0_2_0_stdout_own_output_stream_t) { ret }; +wasi_cli_stdout_own_output_stream_t wasi_cli_stdout_get_stdout(void) { + int32_t ret = __wasm_import_wasi_cli_stdout_get_stdout(); + return (wasi_cli_stdout_own_output_stream_t) { ret }; } -wasi_cli_0_2_0_stderr_own_output_stream_t wasi_cli_0_2_0_stderr_get_stderr(void) { - int32_t ret = __wasm_import_wasi_cli_0_2_0_stderr_get_stderr(); - return (wasi_cli_0_2_0_stderr_own_output_stream_t) { ret }; +wasi_cli_stderr_own_output_stream_t wasi_cli_stderr_get_stderr(void) { + int32_t ret = __wasm_import_wasi_cli_stderr_get_stderr(); + return (wasi_cli_stderr_own_output_stream_t) { ret }; } -bool wasi_cli_0_2_0_terminal_stdin_get_terminal_stdin(wasi_cli_0_2_0_terminal_stdin_own_terminal_input_t *ret) { +bool wasi_cli_terminal_stdin_get_terminal_stdin(wasi_cli_terminal_stdin_own_terminal_input_t *ret) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_cli_0_2_0_terminal_stdin_get_terminal_stdin(ptr); - wasi_cli_0_2_0_terminal_stdin_option_own_terminal_input_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_cli_terminal_stdin_get_terminal_stdin(ptr); + wasi_cli_terminal_stdin_option_own_terminal_input_t option; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { option.is_some = false; break; } case 1: { option.is_some = true; - option.val = (wasi_cli_0_2_0_terminal_stdin_own_terminal_input_t) { *((int32_t*) (ptr + 4)) }; + option.val = (wasi_cli_terminal_stdin_own_terminal_input_t) { *((int32_t*) (ptr + 4)) }; break; } } @@ -2331,20 +2402,20 @@ bool wasi_cli_0_2_0_terminal_stdin_get_terminal_stdin(wasi_cli_0_2_0_terminal_st return option.is_some; } -bool wasi_cli_0_2_0_terminal_stdout_get_terminal_stdout(wasi_cli_0_2_0_terminal_stdout_own_terminal_output_t *ret) { +bool wasi_cli_terminal_stdout_get_terminal_stdout(wasi_cli_terminal_stdout_own_terminal_output_t *ret) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_cli_0_2_0_terminal_stdout_get_terminal_stdout(ptr); - wasi_cli_0_2_0_terminal_stdout_option_own_terminal_output_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_cli_terminal_stdout_get_terminal_stdout(ptr); + wasi_cli_terminal_stdout_option_own_terminal_output_t option; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { option.is_some = false; break; } case 1: { option.is_some = true; - option.val = (wasi_cli_0_2_0_terminal_stdout_own_terminal_output_t) { *((int32_t*) (ptr + 4)) }; + option.val = (wasi_cli_terminal_stdout_own_terminal_output_t) { *((int32_t*) (ptr + 4)) }; break; } } @@ -2352,20 +2423,20 @@ bool wasi_cli_0_2_0_terminal_stdout_get_terminal_stdout(wasi_cli_0_2_0_terminal_ return option.is_some; } -bool wasi_cli_0_2_0_terminal_stderr_get_terminal_stderr(wasi_cli_0_2_0_terminal_stderr_own_terminal_output_t *ret) { +bool wasi_cli_terminal_stderr_get_terminal_stderr(wasi_cli_terminal_stderr_own_terminal_output_t *ret) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_cli_0_2_0_terminal_stderr_get_terminal_stderr(ptr); - wasi_cli_0_2_0_terminal_stderr_option_own_terminal_output_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_cli_terminal_stderr_get_terminal_stderr(ptr); + wasi_cli_terminal_stderr_option_own_terminal_output_t option; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { option.is_some = false; break; } case 1: { option.is_some = true; - option.val = (wasi_cli_0_2_0_terminal_stderr_own_terminal_output_t) { *((int32_t*) (ptr + 4)) }; + option.val = (wasi_cli_terminal_stderr_own_terminal_output_t) { *((int32_t*) (ptr + 4)) }; break; } } @@ -2373,63 +2444,63 @@ bool wasi_cli_0_2_0_terminal_stderr_get_terminal_stderr(wasi_cli_0_2_0_terminal_ return option.is_some; } -wasi_clocks_0_2_0_monotonic_clock_instant_t wasi_clocks_0_2_0_monotonic_clock_now(void) { - int64_t ret = __wasm_import_wasi_clocks_0_2_0_monotonic_clock_now(); +wasi_clocks_monotonic_clock_instant_t wasi_clocks_monotonic_clock_now(void) { + int64_t ret = __wasm_import_wasi_clocks_monotonic_clock_now(); return (uint64_t) (ret); } -wasi_clocks_0_2_0_monotonic_clock_duration_t wasi_clocks_0_2_0_monotonic_clock_resolution(void) { - int64_t ret = __wasm_import_wasi_clocks_0_2_0_monotonic_clock_resolution(); +wasi_clocks_monotonic_clock_duration_t wasi_clocks_monotonic_clock_resolution(void) { + int64_t ret = __wasm_import_wasi_clocks_monotonic_clock_resolution(); return (uint64_t) (ret); } -wasi_clocks_0_2_0_monotonic_clock_own_pollable_t wasi_clocks_0_2_0_monotonic_clock_subscribe_instant(wasi_clocks_0_2_0_monotonic_clock_instant_t when) { - int32_t ret = __wasm_import_wasi_clocks_0_2_0_monotonic_clock_subscribe_instant((int64_t) (when)); - return (wasi_clocks_0_2_0_monotonic_clock_own_pollable_t) { ret }; +wasi_clocks_monotonic_clock_own_pollable_t wasi_clocks_monotonic_clock_subscribe_instant(wasi_clocks_monotonic_clock_instant_t when) { + int32_t ret = __wasm_import_wasi_clocks_monotonic_clock_subscribe_instant((int64_t) (when)); + return (wasi_clocks_monotonic_clock_own_pollable_t) { ret }; } -wasi_clocks_0_2_0_monotonic_clock_own_pollable_t wasi_clocks_0_2_0_monotonic_clock_subscribe_duration(wasi_clocks_0_2_0_monotonic_clock_duration_t when) { - int32_t ret = __wasm_import_wasi_clocks_0_2_0_monotonic_clock_subscribe_duration((int64_t) (when)); - return (wasi_clocks_0_2_0_monotonic_clock_own_pollable_t) { ret }; +wasi_clocks_monotonic_clock_own_pollable_t wasi_clocks_monotonic_clock_subscribe_duration(wasi_clocks_monotonic_clock_duration_t when) { + int32_t ret = __wasm_import_wasi_clocks_monotonic_clock_subscribe_duration((int64_t) (when)); + return (wasi_clocks_monotonic_clock_own_pollable_t) { ret }; } -void wasi_clocks_0_2_0_wall_clock_now(wasi_clocks_0_2_0_wall_clock_datetime_t *ret) { +void wasi_clocks_wall_clock_now(wasi_clocks_wall_clock_datetime_t *ret) { __attribute__((__aligned__(8))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_clocks_0_2_0_wall_clock_now(ptr); - *ret = (wasi_clocks_0_2_0_wall_clock_datetime_t) { - (uint64_t) (*((int64_t*) (ptr + 0))), - (uint32_t) (*((int32_t*) (ptr + 8))), + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_clocks_wall_clock_now(ptr); + *ret = (wasi_clocks_wall_clock_datetime_t) { + (uint64_t) (uint64_t) (*((int64_t*) (ptr + 0))), + (uint32_t) (uint32_t) (*((int32_t*) (ptr + 8))), }; } -void wasi_clocks_0_2_0_wall_clock_resolution(wasi_clocks_0_2_0_wall_clock_datetime_t *ret) { +void wasi_clocks_wall_clock_resolution(wasi_clocks_wall_clock_datetime_t *ret) { __attribute__((__aligned__(8))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_clocks_0_2_0_wall_clock_resolution(ptr); - *ret = (wasi_clocks_0_2_0_wall_clock_datetime_t) { - (uint64_t) (*((int64_t*) (ptr + 0))), - (uint32_t) (*((int32_t*) (ptr + 8))), + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_clocks_wall_clock_resolution(ptr); + *ret = (wasi_clocks_wall_clock_datetime_t) { + (uint64_t) (uint64_t) (*((int64_t*) (ptr + 0))), + (uint32_t) (uint32_t) (*((int32_t*) (ptr + 8))), }; } -bool wasi_filesystem_0_2_0_types_method_descriptor_read_via_stream(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, wasi_filesystem_0_2_0_types_filesize_t offset, wasi_filesystem_0_2_0_types_own_input_stream_t *ret, wasi_filesystem_0_2_0_types_error_code_t *err) { +bool wasi_filesystem_types_method_descriptor_read_via_stream(wasi_filesystem_types_borrow_descriptor_t self, wasi_filesystem_types_filesize_t offset, wasi_filesystem_types_own_input_stream_t *ret, wasi_filesystem_types_error_code_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_read_via_stream((self).__handle, (int64_t) (offset), ptr); - wasi_filesystem_0_2_0_types_result_own_input_stream_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_filesystem_types_method_descriptor_read_via_stream((self).__handle, (int64_t) (offset), ptr); + wasi_filesystem_types_result_own_input_stream_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (wasi_filesystem_0_2_0_types_own_input_stream_t) { *((int32_t*) (ptr + 4)) }; + result.val.ok = (wasi_filesystem_types_own_input_stream_t) { *((int32_t*) (ptr + 4)) }; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 4))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 4)); break; } } @@ -2442,21 +2513,21 @@ bool wasi_filesystem_0_2_0_types_method_descriptor_read_via_stream(wasi_filesyst } } -bool wasi_filesystem_0_2_0_types_method_descriptor_write_via_stream(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, wasi_filesystem_0_2_0_types_filesize_t offset, wasi_filesystem_0_2_0_types_own_output_stream_t *ret, wasi_filesystem_0_2_0_types_error_code_t *err) { +bool wasi_filesystem_types_method_descriptor_write_via_stream(wasi_filesystem_types_borrow_descriptor_t self, wasi_filesystem_types_filesize_t offset, wasi_filesystem_types_own_output_stream_t *ret, wasi_filesystem_types_error_code_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_write_via_stream((self).__handle, (int64_t) (offset), ptr); - wasi_filesystem_0_2_0_types_result_own_output_stream_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_filesystem_types_method_descriptor_write_via_stream((self).__handle, (int64_t) (offset), ptr); + wasi_filesystem_types_result_own_output_stream_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (wasi_filesystem_0_2_0_types_own_output_stream_t) { *((int32_t*) (ptr + 4)) }; + result.val.ok = (wasi_filesystem_types_own_output_stream_t) { *((int32_t*) (ptr + 4)) }; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 4))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 4)); break; } } @@ -2469,21 +2540,21 @@ bool wasi_filesystem_0_2_0_types_method_descriptor_write_via_stream(wasi_filesys } } -bool wasi_filesystem_0_2_0_types_method_descriptor_append_via_stream(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, wasi_filesystem_0_2_0_types_own_output_stream_t *ret, wasi_filesystem_0_2_0_types_error_code_t *err) { +bool wasi_filesystem_types_method_descriptor_append_via_stream(wasi_filesystem_types_borrow_descriptor_t self, wasi_filesystem_types_own_output_stream_t *ret, wasi_filesystem_types_error_code_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_append_via_stream((self).__handle, ptr); - wasi_filesystem_0_2_0_types_result_own_output_stream_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_filesystem_types_method_descriptor_append_via_stream((self).__handle, ptr); + wasi_filesystem_types_result_own_output_stream_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (wasi_filesystem_0_2_0_types_own_output_stream_t) { *((int32_t*) (ptr + 4)) }; + result.val.ok = (wasi_filesystem_types_own_output_stream_t) { *((int32_t*) (ptr + 4)) }; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 4))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 4)); break; } } @@ -2496,20 +2567,20 @@ bool wasi_filesystem_0_2_0_types_method_descriptor_append_via_stream(wasi_filesy } } -bool wasi_filesystem_0_2_0_types_method_descriptor_advise(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, wasi_filesystem_0_2_0_types_filesize_t offset, wasi_filesystem_0_2_0_types_filesize_t length, wasi_filesystem_0_2_0_types_advice_t advice, wasi_filesystem_0_2_0_types_error_code_t *err) { +bool wasi_filesystem_types_method_descriptor_advise(wasi_filesystem_types_borrow_descriptor_t self, wasi_filesystem_types_filesize_t offset, wasi_filesystem_types_filesize_t length, wasi_filesystem_types_advice_t advice, wasi_filesystem_types_error_code_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_advise((self).__handle, (int64_t) (offset), (int64_t) (length), (int32_t) advice, ptr); - wasi_filesystem_0_2_0_types_result_void_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_filesystem_types_method_descriptor_advise((self).__handle, (int64_t) (offset), (int64_t) (length), (int32_t) advice, ptr); + wasi_filesystem_types_result_void_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 1))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 1)); break; } } @@ -2521,20 +2592,20 @@ bool wasi_filesystem_0_2_0_types_method_descriptor_advise(wasi_filesystem_0_2_0_ } } -bool wasi_filesystem_0_2_0_types_method_descriptor_sync_data(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, wasi_filesystem_0_2_0_types_error_code_t *err) { +bool wasi_filesystem_types_method_descriptor_sync_data(wasi_filesystem_types_borrow_descriptor_t self, wasi_filesystem_types_error_code_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_sync_data((self).__handle, ptr); - wasi_filesystem_0_2_0_types_result_void_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_filesystem_types_method_descriptor_sync_data((self).__handle, ptr); + wasi_filesystem_types_result_void_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 1))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 1)); break; } } @@ -2546,21 +2617,21 @@ bool wasi_filesystem_0_2_0_types_method_descriptor_sync_data(wasi_filesystem_0_2 } } -bool wasi_filesystem_0_2_0_types_method_descriptor_get_flags(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, wasi_filesystem_0_2_0_types_descriptor_flags_t *ret, wasi_filesystem_0_2_0_types_error_code_t *err) { +bool wasi_filesystem_types_method_descriptor_get_flags(wasi_filesystem_types_borrow_descriptor_t self, wasi_filesystem_types_descriptor_flags_t *ret, wasi_filesystem_types_error_code_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_get_flags((self).__handle, ptr); - wasi_filesystem_0_2_0_types_result_descriptor_flags_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_filesystem_types_method_descriptor_get_flags((self).__handle, ptr); + wasi_filesystem_types_result_descriptor_flags_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (int32_t) (*((uint8_t*) (ptr + 1))); + result.val.ok = (int32_t) *((uint8_t*) (ptr + 1)); break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 1))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 1)); break; } } @@ -2573,21 +2644,21 @@ bool wasi_filesystem_0_2_0_types_method_descriptor_get_flags(wasi_filesystem_0_2 } } -bool wasi_filesystem_0_2_0_types_method_descriptor_get_type(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, wasi_filesystem_0_2_0_types_descriptor_type_t *ret, wasi_filesystem_0_2_0_types_error_code_t *err) { +bool wasi_filesystem_types_method_descriptor_get_type(wasi_filesystem_types_borrow_descriptor_t self, wasi_filesystem_types_descriptor_type_t *ret, wasi_filesystem_types_error_code_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_get_type((self).__handle, ptr); - wasi_filesystem_0_2_0_types_result_descriptor_type_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_filesystem_types_method_descriptor_get_type((self).__handle, ptr); + wasi_filesystem_types_result_descriptor_type_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (int32_t) (*((uint8_t*) (ptr + 1))); + result.val.ok = (int32_t) *((uint8_t*) (ptr + 1)); break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 1))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 1)); break; } } @@ -2600,20 +2671,20 @@ bool wasi_filesystem_0_2_0_types_method_descriptor_get_type(wasi_filesystem_0_2_ } } -bool wasi_filesystem_0_2_0_types_method_descriptor_set_size(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, wasi_filesystem_0_2_0_types_filesize_t size, wasi_filesystem_0_2_0_types_error_code_t *err) { +bool wasi_filesystem_types_method_descriptor_set_size(wasi_filesystem_types_borrow_descriptor_t self, wasi_filesystem_types_filesize_t size, wasi_filesystem_types_error_code_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_set_size((self).__handle, (int64_t) (size), ptr); - wasi_filesystem_0_2_0_types_result_void_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_filesystem_types_method_descriptor_set_size((self).__handle, (int64_t) (size), ptr); + wasi_filesystem_types_result_void_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 1))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 1)); break; } } @@ -2625,7 +2696,7 @@ bool wasi_filesystem_0_2_0_types_method_descriptor_set_size(wasi_filesystem_0_2_ } } -bool wasi_filesystem_0_2_0_types_method_descriptor_set_times(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, wasi_filesystem_0_2_0_types_new_timestamp_t *data_access_timestamp, wasi_filesystem_0_2_0_types_new_timestamp_t *data_modification_timestamp, wasi_filesystem_0_2_0_types_error_code_t *err) { +bool wasi_filesystem_types_method_descriptor_set_times(wasi_filesystem_types_borrow_descriptor_t self, wasi_filesystem_types_new_timestamp_t *data_access_timestamp, wasi_filesystem_types_new_timestamp_t *data_modification_timestamp, wasi_filesystem_types_error_code_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; int32_t variant; @@ -2645,7 +2716,7 @@ bool wasi_filesystem_0_2_0_types_method_descriptor_set_times(wasi_filesystem_0_2 break; } case 2: { - const wasi_filesystem_0_2_0_types_datetime_t *payload1 = &(*data_access_timestamp).val.timestamp; + const wasi_filesystem_types_datetime_t *payload1 = &(*data_access_timestamp).val.timestamp; variant = 2; variant2 = (int64_t) ((*payload1).seconds); variant3 = (int32_t) ((*payload1).nanoseconds); @@ -2669,24 +2740,24 @@ bool wasi_filesystem_0_2_0_types_method_descriptor_set_times(wasi_filesystem_0_2 break; } case 2: { - const wasi_filesystem_0_2_0_types_datetime_t *payload6 = &(*data_modification_timestamp).val.timestamp; + const wasi_filesystem_types_datetime_t *payload6 = &(*data_modification_timestamp).val.timestamp; variant7 = 2; variant8 = (int64_t) ((*payload6).seconds); variant9 = (int32_t) ((*payload6).nanoseconds); break; } } - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_set_times((self).__handle, variant, variant2, variant3, variant7, variant8, variant9, ptr); - wasi_filesystem_0_2_0_types_result_void_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_filesystem_types_method_descriptor_set_times((self).__handle, variant, variant2, variant3, variant7, variant8, variant9, ptr); + wasi_filesystem_types_result_void_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 1))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 1)); break; } } @@ -2698,24 +2769,24 @@ bool wasi_filesystem_0_2_0_types_method_descriptor_set_times(wasi_filesystem_0_2 } } -bool wasi_filesystem_0_2_0_types_method_descriptor_read(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, wasi_filesystem_0_2_0_types_filesize_t length, wasi_filesystem_0_2_0_types_filesize_t offset, wasi_filesystem_0_2_0_types_tuple2_list_u8_bool_t *ret, wasi_filesystem_0_2_0_types_error_code_t *err) { +bool wasi_filesystem_types_method_descriptor_read(wasi_filesystem_types_borrow_descriptor_t self, wasi_filesystem_types_filesize_t length, wasi_filesystem_types_filesize_t offset, bindings_tuple2_list_u8_bool_t *ret, wasi_filesystem_types_error_code_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_read((self).__handle, (int64_t) (length), (int64_t) (offset), ptr); - wasi_filesystem_0_2_0_types_result_tuple2_list_u8_bool_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_filesystem_types_method_descriptor_read((self).__handle, (int64_t) (length), (int64_t) (offset), ptr); + wasi_filesystem_types_result_tuple2_list_u8_bool_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (wasi_filesystem_0_2_0_types_tuple2_list_u8_bool_t) { - (wasi_filesystem_0_2_0_types_list_u8_t) { (uint8_t*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }, - (int32_t) (*((uint8_t*) (ptr + 12))), + result.val.ok = (bindings_tuple2_list_u8_bool_t) { + (bindings_list_u8_t) (bindings_list_u8_t) { (uint8_t*)(*((uint8_t **) (ptr + 4))), (*((size_t*) (ptr + 8))) }, + (bool) (int32_t) *((uint8_t*) (ptr + 12)), }; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 4))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 4)); break; } } @@ -2728,13 +2799,13 @@ bool wasi_filesystem_0_2_0_types_method_descriptor_read(wasi_filesystem_0_2_0_ty } } -bool wasi_filesystem_0_2_0_types_method_descriptor_write(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, wasi_filesystem_0_2_0_types_list_u8_t *buffer, wasi_filesystem_0_2_0_types_filesize_t offset, wasi_filesystem_0_2_0_types_filesize_t *ret, wasi_filesystem_0_2_0_types_error_code_t *err) { +bool wasi_filesystem_types_method_descriptor_write(wasi_filesystem_types_borrow_descriptor_t self, bindings_list_u8_t *buffer, wasi_filesystem_types_filesize_t offset, wasi_filesystem_types_filesize_t *ret, wasi_filesystem_types_error_code_t *err) { __attribute__((__aligned__(8))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_write((self).__handle, (int32_t) (*buffer).ptr, (int32_t) (*buffer).len, (int64_t) (offset), ptr); - wasi_filesystem_0_2_0_types_result_filesize_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_filesystem_types_method_descriptor_write((self).__handle, (uint8_t *) (*buffer).ptr, (*buffer).len, (int64_t) (offset), ptr); + wasi_filesystem_types_result_filesize_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint64_t) (*((int64_t*) (ptr + 8))); @@ -2742,7 +2813,7 @@ bool wasi_filesystem_0_2_0_types_method_descriptor_write(wasi_filesystem_0_2_0_t } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 8))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 8)); break; } } @@ -2755,21 +2826,21 @@ bool wasi_filesystem_0_2_0_types_method_descriptor_write(wasi_filesystem_0_2_0_t } } -bool wasi_filesystem_0_2_0_types_method_descriptor_read_directory(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, wasi_filesystem_0_2_0_types_own_directory_entry_stream_t *ret, wasi_filesystem_0_2_0_types_error_code_t *err) { +bool wasi_filesystem_types_method_descriptor_read_directory(wasi_filesystem_types_borrow_descriptor_t self, wasi_filesystem_types_own_directory_entry_stream_t *ret, wasi_filesystem_types_error_code_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_read_directory((self).__handle, ptr); - wasi_filesystem_0_2_0_types_result_own_directory_entry_stream_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_filesystem_types_method_descriptor_read_directory((self).__handle, ptr); + wasi_filesystem_types_result_own_directory_entry_stream_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (wasi_filesystem_0_2_0_types_own_directory_entry_stream_t) { *((int32_t*) (ptr + 4)) }; + result.val.ok = (wasi_filesystem_types_own_directory_entry_stream_t) { *((int32_t*) (ptr + 4)) }; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 4))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 4)); break; } } @@ -2782,20 +2853,20 @@ bool wasi_filesystem_0_2_0_types_method_descriptor_read_directory(wasi_filesyste } } -bool wasi_filesystem_0_2_0_types_method_descriptor_sync(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, wasi_filesystem_0_2_0_types_error_code_t *err) { +bool wasi_filesystem_types_method_descriptor_sync(wasi_filesystem_types_borrow_descriptor_t self, wasi_filesystem_types_error_code_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_sync((self).__handle, ptr); - wasi_filesystem_0_2_0_types_result_void_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_filesystem_types_method_descriptor_sync((self).__handle, ptr); + wasi_filesystem_types_result_void_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 1))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 1)); break; } } @@ -2807,20 +2878,20 @@ bool wasi_filesystem_0_2_0_types_method_descriptor_sync(wasi_filesystem_0_2_0_ty } } -bool wasi_filesystem_0_2_0_types_method_descriptor_create_directory_at(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, bindings_string_t *path, wasi_filesystem_0_2_0_types_error_code_t *err) { +bool wasi_filesystem_types_method_descriptor_create_directory_at(wasi_filesystem_types_borrow_descriptor_t self, bindings_string_t *path, wasi_filesystem_types_error_code_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_create_directory_at((self).__handle, (int32_t) (*path).ptr, (int32_t) (*path).len, ptr); - wasi_filesystem_0_2_0_types_result_void_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_filesystem_types_method_descriptor_create_directory_at((self).__handle, (uint8_t *) (*path).ptr, (*path).len, ptr); + wasi_filesystem_types_result_void_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 1))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 1)); break; } } @@ -2832,74 +2903,74 @@ bool wasi_filesystem_0_2_0_types_method_descriptor_create_directory_at(wasi_file } } -bool wasi_filesystem_0_2_0_types_method_descriptor_stat(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, wasi_filesystem_0_2_0_types_descriptor_stat_t *ret, wasi_filesystem_0_2_0_types_error_code_t *err) { +bool wasi_filesystem_types_method_descriptor_stat(wasi_filesystem_types_borrow_descriptor_t self, wasi_filesystem_types_descriptor_stat_t *ret, wasi_filesystem_types_error_code_t *err) { __attribute__((__aligned__(8))) uint8_t ret_area[104]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_stat((self).__handle, ptr); - wasi_filesystem_0_2_0_types_result_descriptor_stat_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_filesystem_types_method_descriptor_stat((self).__handle, ptr); + wasi_filesystem_types_result_descriptor_stat_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - wasi_filesystem_0_2_0_types_option_datetime_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 32)))) { + wasi_filesystem_types_option_datetime_t option; + switch ((int32_t) *((uint8_t*) (ptr + 32))) { case 0: { option.is_some = false; break; } case 1: { option.is_some = true; - option.val = (wasi_clocks_0_2_0_wall_clock_datetime_t) { - (uint64_t) (*((int64_t*) (ptr + 40))), - (uint32_t) (*((int32_t*) (ptr + 48))), + option.val = (wasi_clocks_wall_clock_datetime_t) { + (uint64_t) (uint64_t) (*((int64_t*) (ptr + 40))), + (uint32_t) (uint32_t) (*((int32_t*) (ptr + 48))), }; break; } } - wasi_filesystem_0_2_0_types_option_datetime_t option0; - switch ((int32_t) (*((uint8_t*) (ptr + 56)))) { + wasi_filesystem_types_option_datetime_t option0; + switch ((int32_t) *((uint8_t*) (ptr + 56))) { case 0: { option0.is_some = false; break; } case 1: { option0.is_some = true; - option0.val = (wasi_clocks_0_2_0_wall_clock_datetime_t) { - (uint64_t) (*((int64_t*) (ptr + 64))), - (uint32_t) (*((int32_t*) (ptr + 72))), + option0.val = (wasi_clocks_wall_clock_datetime_t) { + (uint64_t) (uint64_t) (*((int64_t*) (ptr + 64))), + (uint32_t) (uint32_t) (*((int32_t*) (ptr + 72))), }; break; } } - wasi_filesystem_0_2_0_types_option_datetime_t option1; - switch ((int32_t) (*((uint8_t*) (ptr + 80)))) { + wasi_filesystem_types_option_datetime_t option1; + switch ((int32_t) *((uint8_t*) (ptr + 80))) { case 0: { option1.is_some = false; break; } case 1: { option1.is_some = true; - option1.val = (wasi_clocks_0_2_0_wall_clock_datetime_t) { - (uint64_t) (*((int64_t*) (ptr + 88))), - (uint32_t) (*((int32_t*) (ptr + 96))), + option1.val = (wasi_clocks_wall_clock_datetime_t) { + (uint64_t) (uint64_t) (*((int64_t*) (ptr + 88))), + (uint32_t) (uint32_t) (*((int32_t*) (ptr + 96))), }; break; } } - - result.val.ok = (wasi_filesystem_0_2_0_types_descriptor_stat_t) { - (int32_t) (*((uint8_t*) (ptr + 8))), - (uint64_t) (*((int64_t*) (ptr + 16))), - (uint64_t) (*((int64_t*) (ptr + 24))), - option, - option0, - option1, + + result.val.ok = (wasi_filesystem_types_descriptor_stat_t) { + (wasi_filesystem_types_descriptor_type_t) (int32_t) *((uint8_t*) (ptr + 8)), + (wasi_filesystem_types_link_count_t) (uint64_t) (*((int64_t*) (ptr + 16))), + (wasi_filesystem_types_filesize_t) (uint64_t) (*((int64_t*) (ptr + 24))), + (wasi_filesystem_types_option_datetime_t) option, + (wasi_filesystem_types_option_datetime_t) option0, + (wasi_filesystem_types_option_datetime_t) option1, }; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 8))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 8)); break; } } @@ -2912,74 +2983,74 @@ bool wasi_filesystem_0_2_0_types_method_descriptor_stat(wasi_filesystem_0_2_0_ty } } -bool wasi_filesystem_0_2_0_types_method_descriptor_stat_at(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, wasi_filesystem_0_2_0_types_path_flags_t path_flags, bindings_string_t *path, wasi_filesystem_0_2_0_types_descriptor_stat_t *ret, wasi_filesystem_0_2_0_types_error_code_t *err) { +bool wasi_filesystem_types_method_descriptor_stat_at(wasi_filesystem_types_borrow_descriptor_t self, wasi_filesystem_types_path_flags_t path_flags, bindings_string_t *path, wasi_filesystem_types_descriptor_stat_t *ret, wasi_filesystem_types_error_code_t *err) { __attribute__((__aligned__(8))) uint8_t ret_area[104]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_stat_at((self).__handle, path_flags, (int32_t) (*path).ptr, (int32_t) (*path).len, ptr); - wasi_filesystem_0_2_0_types_result_descriptor_stat_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_filesystem_types_method_descriptor_stat_at((self).__handle, path_flags, (uint8_t *) (*path).ptr, (*path).len, ptr); + wasi_filesystem_types_result_descriptor_stat_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - wasi_filesystem_0_2_0_types_option_datetime_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 32)))) { + wasi_filesystem_types_option_datetime_t option; + switch ((int32_t) *((uint8_t*) (ptr + 32))) { case 0: { option.is_some = false; break; } case 1: { option.is_some = true; - option.val = (wasi_clocks_0_2_0_wall_clock_datetime_t) { - (uint64_t) (*((int64_t*) (ptr + 40))), - (uint32_t) (*((int32_t*) (ptr + 48))), + option.val = (wasi_clocks_wall_clock_datetime_t) { + (uint64_t) (uint64_t) (*((int64_t*) (ptr + 40))), + (uint32_t) (uint32_t) (*((int32_t*) (ptr + 48))), }; break; } } - wasi_filesystem_0_2_0_types_option_datetime_t option0; - switch ((int32_t) (*((uint8_t*) (ptr + 56)))) { + wasi_filesystem_types_option_datetime_t option0; + switch ((int32_t) *((uint8_t*) (ptr + 56))) { case 0: { option0.is_some = false; break; } case 1: { option0.is_some = true; - option0.val = (wasi_clocks_0_2_0_wall_clock_datetime_t) { - (uint64_t) (*((int64_t*) (ptr + 64))), - (uint32_t) (*((int32_t*) (ptr + 72))), + option0.val = (wasi_clocks_wall_clock_datetime_t) { + (uint64_t) (uint64_t) (*((int64_t*) (ptr + 64))), + (uint32_t) (uint32_t) (*((int32_t*) (ptr + 72))), }; break; } } - wasi_filesystem_0_2_0_types_option_datetime_t option1; - switch ((int32_t) (*((uint8_t*) (ptr + 80)))) { + wasi_filesystem_types_option_datetime_t option1; + switch ((int32_t) *((uint8_t*) (ptr + 80))) { case 0: { option1.is_some = false; break; } case 1: { option1.is_some = true; - option1.val = (wasi_clocks_0_2_0_wall_clock_datetime_t) { - (uint64_t) (*((int64_t*) (ptr + 88))), - (uint32_t) (*((int32_t*) (ptr + 96))), + option1.val = (wasi_clocks_wall_clock_datetime_t) { + (uint64_t) (uint64_t) (*((int64_t*) (ptr + 88))), + (uint32_t) (uint32_t) (*((int32_t*) (ptr + 96))), }; break; } } - - result.val.ok = (wasi_filesystem_0_2_0_types_descriptor_stat_t) { - (int32_t) (*((uint8_t*) (ptr + 8))), - (uint64_t) (*((int64_t*) (ptr + 16))), - (uint64_t) (*((int64_t*) (ptr + 24))), - option, - option0, - option1, + + result.val.ok = (wasi_filesystem_types_descriptor_stat_t) { + (wasi_filesystem_types_descriptor_type_t) (int32_t) *((uint8_t*) (ptr + 8)), + (wasi_filesystem_types_link_count_t) (uint64_t) (*((int64_t*) (ptr + 16))), + (wasi_filesystem_types_filesize_t) (uint64_t) (*((int64_t*) (ptr + 24))), + (wasi_filesystem_types_option_datetime_t) option, + (wasi_filesystem_types_option_datetime_t) option0, + (wasi_filesystem_types_option_datetime_t) option1, }; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 8))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 8)); break; } } @@ -2992,7 +3063,7 @@ bool wasi_filesystem_0_2_0_types_method_descriptor_stat_at(wasi_filesystem_0_2_0 } } -bool wasi_filesystem_0_2_0_types_method_descriptor_set_times_at(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, wasi_filesystem_0_2_0_types_path_flags_t path_flags, bindings_string_t *path, wasi_filesystem_0_2_0_types_new_timestamp_t *data_access_timestamp, wasi_filesystem_0_2_0_types_new_timestamp_t *data_modification_timestamp, wasi_filesystem_0_2_0_types_error_code_t *err) { +bool wasi_filesystem_types_method_descriptor_set_times_at(wasi_filesystem_types_borrow_descriptor_t self, wasi_filesystem_types_path_flags_t path_flags, bindings_string_t *path, wasi_filesystem_types_new_timestamp_t *data_access_timestamp, wasi_filesystem_types_new_timestamp_t *data_modification_timestamp, wasi_filesystem_types_error_code_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; int32_t variant; @@ -3012,7 +3083,7 @@ bool wasi_filesystem_0_2_0_types_method_descriptor_set_times_at(wasi_filesystem_ break; } case 2: { - const wasi_filesystem_0_2_0_types_datetime_t *payload1 = &(*data_access_timestamp).val.timestamp; + const wasi_filesystem_types_datetime_t *payload1 = &(*data_access_timestamp).val.timestamp; variant = 2; variant2 = (int64_t) ((*payload1).seconds); variant3 = (int32_t) ((*payload1).nanoseconds); @@ -3036,24 +3107,24 @@ bool wasi_filesystem_0_2_0_types_method_descriptor_set_times_at(wasi_filesystem_ break; } case 2: { - const wasi_filesystem_0_2_0_types_datetime_t *payload6 = &(*data_modification_timestamp).val.timestamp; + const wasi_filesystem_types_datetime_t *payload6 = &(*data_modification_timestamp).val.timestamp; variant7 = 2; variant8 = (int64_t) ((*payload6).seconds); variant9 = (int32_t) ((*payload6).nanoseconds); break; } } - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_set_times_at((self).__handle, path_flags, (int32_t) (*path).ptr, (int32_t) (*path).len, variant, variant2, variant3, variant7, variant8, variant9, ptr); - wasi_filesystem_0_2_0_types_result_void_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_filesystem_types_method_descriptor_set_times_at((self).__handle, path_flags, (uint8_t *) (*path).ptr, (*path).len, variant, variant2, variant3, variant7, variant8, variant9, ptr); + wasi_filesystem_types_result_void_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 1))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 1)); break; } } @@ -3065,20 +3136,20 @@ bool wasi_filesystem_0_2_0_types_method_descriptor_set_times_at(wasi_filesystem_ } } -bool wasi_filesystem_0_2_0_types_method_descriptor_link_at(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, wasi_filesystem_0_2_0_types_path_flags_t old_path_flags, bindings_string_t *old_path, wasi_filesystem_0_2_0_types_borrow_descriptor_t new_descriptor, bindings_string_t *new_path, wasi_filesystem_0_2_0_types_error_code_t *err) { +bool wasi_filesystem_types_method_descriptor_link_at(wasi_filesystem_types_borrow_descriptor_t self, wasi_filesystem_types_path_flags_t old_path_flags, bindings_string_t *old_path, wasi_filesystem_types_borrow_descriptor_t new_descriptor, bindings_string_t *new_path, wasi_filesystem_types_error_code_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_link_at((self).__handle, old_path_flags, (int32_t) (*old_path).ptr, (int32_t) (*old_path).len, (new_descriptor).__handle, (int32_t) (*new_path).ptr, (int32_t) (*new_path).len, ptr); - wasi_filesystem_0_2_0_types_result_void_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_filesystem_types_method_descriptor_link_at((self).__handle, old_path_flags, (uint8_t *) (*old_path).ptr, (*old_path).len, (new_descriptor).__handle, (uint8_t *) (*new_path).ptr, (*new_path).len, ptr); + wasi_filesystem_types_result_void_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 1))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 1)); break; } } @@ -3090,21 +3161,21 @@ bool wasi_filesystem_0_2_0_types_method_descriptor_link_at(wasi_filesystem_0_2_0 } } -bool wasi_filesystem_0_2_0_types_method_descriptor_open_at(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, wasi_filesystem_0_2_0_types_path_flags_t path_flags, bindings_string_t *path, wasi_filesystem_0_2_0_types_open_flags_t open_flags, wasi_filesystem_0_2_0_types_descriptor_flags_t flags, wasi_filesystem_0_2_0_types_own_descriptor_t *ret, wasi_filesystem_0_2_0_types_error_code_t *err) { +bool wasi_filesystem_types_method_descriptor_open_at(wasi_filesystem_types_borrow_descriptor_t self, wasi_filesystem_types_path_flags_t path_flags, bindings_string_t *path, wasi_filesystem_types_open_flags_t open_flags, wasi_filesystem_types_descriptor_flags_t flags, wasi_filesystem_types_own_descriptor_t *ret, wasi_filesystem_types_error_code_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_open_at((self).__handle, path_flags, (int32_t) (*path).ptr, (int32_t) (*path).len, open_flags, flags, ptr); - wasi_filesystem_0_2_0_types_result_own_descriptor_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_filesystem_types_method_descriptor_open_at((self).__handle, path_flags, (uint8_t *) (*path).ptr, (*path).len, open_flags, flags, ptr); + wasi_filesystem_types_result_own_descriptor_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (wasi_filesystem_0_2_0_types_own_descriptor_t) { *((int32_t*) (ptr + 4)) }; + result.val.ok = (wasi_filesystem_types_own_descriptor_t) { *((int32_t*) (ptr + 4)) }; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 4))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 4)); break; } } @@ -3117,21 +3188,21 @@ bool wasi_filesystem_0_2_0_types_method_descriptor_open_at(wasi_filesystem_0_2_0 } } -bool wasi_filesystem_0_2_0_types_method_descriptor_readlink_at(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, bindings_string_t *path, bindings_string_t *ret, wasi_filesystem_0_2_0_types_error_code_t *err) { +bool wasi_filesystem_types_method_descriptor_readlink_at(wasi_filesystem_types_borrow_descriptor_t self, bindings_string_t *path, bindings_string_t *ret, wasi_filesystem_types_error_code_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_readlink_at((self).__handle, (int32_t) (*path).ptr, (int32_t) (*path).len, ptr); - wasi_filesystem_0_2_0_types_result_string_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_filesystem_types_method_descriptor_readlink_at((self).__handle, (uint8_t *) (*path).ptr, (*path).len, ptr); + wasi_filesystem_types_result_string_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + result.val.ok = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 4))), (*((size_t*) (ptr + 8))) }; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 4))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 4)); break; } } @@ -3144,20 +3215,20 @@ bool wasi_filesystem_0_2_0_types_method_descriptor_readlink_at(wasi_filesystem_0 } } -bool wasi_filesystem_0_2_0_types_method_descriptor_remove_directory_at(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, bindings_string_t *path, wasi_filesystem_0_2_0_types_error_code_t *err) { +bool wasi_filesystem_types_method_descriptor_remove_directory_at(wasi_filesystem_types_borrow_descriptor_t self, bindings_string_t *path, wasi_filesystem_types_error_code_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_remove_directory_at((self).__handle, (int32_t) (*path).ptr, (int32_t) (*path).len, ptr); - wasi_filesystem_0_2_0_types_result_void_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_filesystem_types_method_descriptor_remove_directory_at((self).__handle, (uint8_t *) (*path).ptr, (*path).len, ptr); + wasi_filesystem_types_result_void_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 1))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 1)); break; } } @@ -3169,20 +3240,20 @@ bool wasi_filesystem_0_2_0_types_method_descriptor_remove_directory_at(wasi_file } } -bool wasi_filesystem_0_2_0_types_method_descriptor_rename_at(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, bindings_string_t *old_path, wasi_filesystem_0_2_0_types_borrow_descriptor_t new_descriptor, bindings_string_t *new_path, wasi_filesystem_0_2_0_types_error_code_t *err) { +bool wasi_filesystem_types_method_descriptor_rename_at(wasi_filesystem_types_borrow_descriptor_t self, bindings_string_t *old_path, wasi_filesystem_types_borrow_descriptor_t new_descriptor, bindings_string_t *new_path, wasi_filesystem_types_error_code_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_rename_at((self).__handle, (int32_t) (*old_path).ptr, (int32_t) (*old_path).len, (new_descriptor).__handle, (int32_t) (*new_path).ptr, (int32_t) (*new_path).len, ptr); - wasi_filesystem_0_2_0_types_result_void_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_filesystem_types_method_descriptor_rename_at((self).__handle, (uint8_t *) (*old_path).ptr, (*old_path).len, (new_descriptor).__handle, (uint8_t *) (*new_path).ptr, (*new_path).len, ptr); + wasi_filesystem_types_result_void_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 1))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 1)); break; } } @@ -3194,20 +3265,20 @@ bool wasi_filesystem_0_2_0_types_method_descriptor_rename_at(wasi_filesystem_0_2 } } -bool wasi_filesystem_0_2_0_types_method_descriptor_symlink_at(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, bindings_string_t *old_path, bindings_string_t *new_path, wasi_filesystem_0_2_0_types_error_code_t *err) { +bool wasi_filesystem_types_method_descriptor_symlink_at(wasi_filesystem_types_borrow_descriptor_t self, bindings_string_t *old_path, bindings_string_t *new_path, wasi_filesystem_types_error_code_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_symlink_at((self).__handle, (int32_t) (*old_path).ptr, (int32_t) (*old_path).len, (int32_t) (*new_path).ptr, (int32_t) (*new_path).len, ptr); - wasi_filesystem_0_2_0_types_result_void_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_filesystem_types_method_descriptor_symlink_at((self).__handle, (uint8_t *) (*old_path).ptr, (*old_path).len, (uint8_t *) (*new_path).ptr, (*new_path).len, ptr); + wasi_filesystem_types_result_void_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 1))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 1)); break; } } @@ -3219,20 +3290,20 @@ bool wasi_filesystem_0_2_0_types_method_descriptor_symlink_at(wasi_filesystem_0_ } } -bool wasi_filesystem_0_2_0_types_method_descriptor_unlink_file_at(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, bindings_string_t *path, wasi_filesystem_0_2_0_types_error_code_t *err) { +bool wasi_filesystem_types_method_descriptor_unlink_file_at(wasi_filesystem_types_borrow_descriptor_t self, bindings_string_t *path, wasi_filesystem_types_error_code_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_unlink_file_at((self).__handle, (int32_t) (*path).ptr, (int32_t) (*path).len, ptr); - wasi_filesystem_0_2_0_types_result_void_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_filesystem_types_method_descriptor_unlink_file_at((self).__handle, (uint8_t *) (*path).ptr, (*path).len, ptr); + wasi_filesystem_types_result_void_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 1))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 1)); break; } } @@ -3244,29 +3315,29 @@ bool wasi_filesystem_0_2_0_types_method_descriptor_unlink_file_at(wasi_filesyste } } -bool wasi_filesystem_0_2_0_types_method_descriptor_is_same_object(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, wasi_filesystem_0_2_0_types_borrow_descriptor_t other) { - int32_t ret = __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_is_same_object((self).__handle, (other).__handle); +bool wasi_filesystem_types_method_descriptor_is_same_object(wasi_filesystem_types_borrow_descriptor_t self, wasi_filesystem_types_borrow_descriptor_t other) { + int32_t ret = __wasm_import_wasi_filesystem_types_method_descriptor_is_same_object((self).__handle, (other).__handle); return ret; } -bool wasi_filesystem_0_2_0_types_method_descriptor_metadata_hash(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, wasi_filesystem_0_2_0_types_metadata_hash_value_t *ret, wasi_filesystem_0_2_0_types_error_code_t *err) { +bool wasi_filesystem_types_method_descriptor_metadata_hash(wasi_filesystem_types_borrow_descriptor_t self, wasi_filesystem_types_metadata_hash_value_t *ret, wasi_filesystem_types_error_code_t *err) { __attribute__((__aligned__(8))) uint8_t ret_area[24]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_metadata_hash((self).__handle, ptr); - wasi_filesystem_0_2_0_types_result_metadata_hash_value_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_filesystem_types_method_descriptor_metadata_hash((self).__handle, ptr); + wasi_filesystem_types_result_metadata_hash_value_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (wasi_filesystem_0_2_0_types_metadata_hash_value_t) { - (uint64_t) (*((int64_t*) (ptr + 8))), - (uint64_t) (*((int64_t*) (ptr + 16))), + result.val.ok = (wasi_filesystem_types_metadata_hash_value_t) { + (uint64_t) (uint64_t) (*((int64_t*) (ptr + 8))), + (uint64_t) (uint64_t) (*((int64_t*) (ptr + 16))), }; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 8))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 8)); break; } } @@ -3279,24 +3350,24 @@ bool wasi_filesystem_0_2_0_types_method_descriptor_metadata_hash(wasi_filesystem } } -bool wasi_filesystem_0_2_0_types_method_descriptor_metadata_hash_at(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, wasi_filesystem_0_2_0_types_path_flags_t path_flags, bindings_string_t *path, wasi_filesystem_0_2_0_types_metadata_hash_value_t *ret, wasi_filesystem_0_2_0_types_error_code_t *err) { +bool wasi_filesystem_types_method_descriptor_metadata_hash_at(wasi_filesystem_types_borrow_descriptor_t self, wasi_filesystem_types_path_flags_t path_flags, bindings_string_t *path, wasi_filesystem_types_metadata_hash_value_t *ret, wasi_filesystem_types_error_code_t *err) { __attribute__((__aligned__(8))) uint8_t ret_area[24]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_filesystem_0_2_0_types_method_descriptor_metadata_hash_at((self).__handle, path_flags, (int32_t) (*path).ptr, (int32_t) (*path).len, ptr); - wasi_filesystem_0_2_0_types_result_metadata_hash_value_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_filesystem_types_method_descriptor_metadata_hash_at((self).__handle, path_flags, (uint8_t *) (*path).ptr, (*path).len, ptr); + wasi_filesystem_types_result_metadata_hash_value_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (wasi_filesystem_0_2_0_types_metadata_hash_value_t) { - (uint64_t) (*((int64_t*) (ptr + 8))), - (uint64_t) (*((int64_t*) (ptr + 16))), + result.val.ok = (wasi_filesystem_types_metadata_hash_value_t) { + (uint64_t) (uint64_t) (*((int64_t*) (ptr + 8))), + (uint64_t) (uint64_t) (*((int64_t*) (ptr + 16))), }; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 8))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 8)); break; } } @@ -3309,37 +3380,37 @@ bool wasi_filesystem_0_2_0_types_method_descriptor_metadata_hash_at(wasi_filesys } } -bool wasi_filesystem_0_2_0_types_method_directory_entry_stream_read_directory_entry(wasi_filesystem_0_2_0_types_borrow_directory_entry_stream_t self, wasi_filesystem_0_2_0_types_option_directory_entry_t *ret, wasi_filesystem_0_2_0_types_error_code_t *err) { +bool wasi_filesystem_types_method_directory_entry_stream_read_directory_entry(wasi_filesystem_types_borrow_directory_entry_stream_t self, wasi_filesystem_types_option_directory_entry_t *ret, wasi_filesystem_types_error_code_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[20]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_filesystem_0_2_0_types_method_directory_entry_stream_read_directory_entry((self).__handle, ptr); - wasi_filesystem_0_2_0_types_result_option_directory_entry_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_filesystem_types_method_directory_entry_stream_read_directory_entry((self).__handle, ptr); + wasi_filesystem_types_result_option_directory_entry_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - wasi_filesystem_0_2_0_types_option_directory_entry_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 4)))) { + wasi_filesystem_types_option_directory_entry_t option; + switch ((int32_t) *((uint8_t*) (ptr + 4))) { case 0: { option.is_some = false; break; } case 1: { option.is_some = true; - option.val = (wasi_filesystem_0_2_0_types_directory_entry_t) { - (int32_t) (*((uint8_t*) (ptr + 8))), - (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 12))), (size_t)(*((int32_t*) (ptr + 16))) }, + option.val = (wasi_filesystem_types_directory_entry_t) { + (wasi_filesystem_types_descriptor_type_t) (int32_t) *((uint8_t*) (ptr + 8)), + (bindings_string_t) (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 12))), (*((size_t*) (ptr + 16))) }, }; break; } } - + result.val.ok = option; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 4))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 4)); break; } } @@ -3352,20 +3423,20 @@ bool wasi_filesystem_0_2_0_types_method_directory_entry_stream_read_directory_en } } -bool wasi_filesystem_0_2_0_types_filesystem_error_code(wasi_filesystem_0_2_0_types_borrow_error_t err_, wasi_filesystem_0_2_0_types_error_code_t *ret) { +bool wasi_filesystem_types_filesystem_error_code(wasi_filesystem_types_borrow_error_t err_, wasi_filesystem_types_error_code_t *ret) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_filesystem_0_2_0_types_filesystem_error_code((err_).__handle, ptr); - wasi_filesystem_0_2_0_types_option_error_code_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_filesystem_types_filesystem_error_code((err_).__handle, ptr); + wasi_filesystem_types_option_error_code_t option; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { option.is_some = false; break; } case 1: { option.is_some = true; - option.val = (int32_t) (*((uint8_t*) (ptr + 1))); + option.val = (int32_t) *((uint8_t*) (ptr + 1)); break; } } @@ -3373,20 +3444,20 @@ bool wasi_filesystem_0_2_0_types_filesystem_error_code(wasi_filesystem_0_2_0_typ return option.is_some; } -void wasi_filesystem_0_2_0_preopens_get_directories(wasi_filesystem_0_2_0_preopens_list_tuple2_own_descriptor_string_t *ret) { +void wasi_filesystem_preopens_get_directories(wasi_filesystem_preopens_list_tuple2_own_descriptor_string_t *ret) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_filesystem_0_2_0_preopens_get_directories(ptr); - *ret = (wasi_filesystem_0_2_0_preopens_list_tuple2_own_descriptor_string_t) { (wasi_filesystem_0_2_0_preopens_tuple2_own_descriptor_string_t*)(*((int32_t*) (ptr + 0))), (size_t)(*((int32_t*) (ptr + 4))) }; + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_filesystem_preopens_get_directories(ptr); + *ret = (wasi_filesystem_preopens_list_tuple2_own_descriptor_string_t) { (wasi_filesystem_preopens_tuple2_own_descriptor_string_t*)(*((uint8_t **) (ptr + 0))), (*((size_t*) (ptr + 4))) }; } -wasi_sockets_0_2_0_instance_network_own_network_t wasi_sockets_0_2_0_instance_network_instance_network(void) { - int32_t ret = __wasm_import_wasi_sockets_0_2_0_instance_network_instance_network(); - return (wasi_sockets_0_2_0_instance_network_own_network_t) { ret }; +wasi_sockets_instance_network_own_network_t wasi_sockets_instance_network_instance_network(void) { + int32_t ret = __wasm_import_wasi_sockets_instance_network_instance_network(); + return (wasi_sockets_instance_network_own_network_t) { ret }; } -bool wasi_sockets_0_2_0_udp_method_udp_socket_start_bind(wasi_sockets_0_2_0_udp_borrow_udp_socket_t self, wasi_sockets_0_2_0_udp_borrow_network_t network, wasi_sockets_0_2_0_udp_ip_socket_address_t *local_address, wasi_sockets_0_2_0_udp_error_code_t *err) { +bool wasi_sockets_udp_method_udp_socket_start_bind(wasi_sockets_udp_borrow_udp_socket_t self, wasi_sockets_udp_borrow_network_t network, wasi_sockets_udp_ip_socket_address_t *local_address, wasi_sockets_udp_error_code_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; int32_t variant; @@ -3403,7 +3474,7 @@ bool wasi_sockets_0_2_0_udp_method_udp_socket_start_bind(wasi_sockets_0_2_0_udp_ int32_t variant11; switch ((int32_t) (*local_address).tag) { case 0: { - const wasi_sockets_0_2_0_network_ipv4_socket_address_t *payload = &(*local_address).val.ipv4; + const wasi_sockets_network_ipv4_socket_address_t *payload = &(*local_address).val.ipv4; variant = 0; variant1 = (int32_t) ((*payload).port); variant2 = (int32_t) (((*payload).address).f0); @@ -3419,7 +3490,7 @@ bool wasi_sockets_0_2_0_udp_method_udp_socket_start_bind(wasi_sockets_0_2_0_udp_ break; } case 1: { - const wasi_sockets_0_2_0_network_ipv6_socket_address_t *payload0 = &(*local_address).val.ipv6; + const wasi_sockets_network_ipv6_socket_address_t *payload0 = &(*local_address).val.ipv6; variant = 1; variant1 = (int32_t) ((*payload0).port); variant2 = (int32_t) ((*payload0).flow_info); @@ -3435,17 +3506,17 @@ bool wasi_sockets_0_2_0_udp_method_udp_socket_start_bind(wasi_sockets_0_2_0_udp_ break; } } - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_sockets_0_2_0_udp_method_udp_socket_start_bind((self).__handle, (network).__handle, variant, variant1, variant2, variant3, variant4, variant5, variant6, variant7, variant8, variant9, variant10, variant11, ptr); - wasi_sockets_0_2_0_udp_result_void_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_sockets_udp_method_udp_socket_start_bind((self).__handle, (network).__handle, variant, variant1, variant2, variant3, variant4, variant5, variant6, variant7, variant8, variant9, variant10, variant11, ptr); + wasi_sockets_udp_result_void_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 1))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 1)); break; } } @@ -3457,20 +3528,20 @@ bool wasi_sockets_0_2_0_udp_method_udp_socket_start_bind(wasi_sockets_0_2_0_udp_ } } -bool wasi_sockets_0_2_0_udp_method_udp_socket_finish_bind(wasi_sockets_0_2_0_udp_borrow_udp_socket_t self, wasi_sockets_0_2_0_udp_error_code_t *err) { +bool wasi_sockets_udp_method_udp_socket_finish_bind(wasi_sockets_udp_borrow_udp_socket_t self, wasi_sockets_udp_error_code_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_sockets_0_2_0_udp_method_udp_socket_finish_bind((self).__handle, ptr); - wasi_sockets_0_2_0_udp_result_void_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_sockets_udp_method_udp_socket_finish_bind((self).__handle, ptr); + wasi_sockets_udp_result_void_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 1))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 1)); break; } } @@ -3482,10 +3553,10 @@ bool wasi_sockets_0_2_0_udp_method_udp_socket_finish_bind(wasi_sockets_0_2_0_udp } } -bool wasi_sockets_0_2_0_udp_method_udp_socket_stream(wasi_sockets_0_2_0_udp_borrow_udp_socket_t self, wasi_sockets_0_2_0_udp_ip_socket_address_t *maybe_remote_address, wasi_sockets_0_2_0_udp_tuple2_own_incoming_datagram_stream_own_outgoing_datagram_stream_t *ret, wasi_sockets_0_2_0_udp_error_code_t *err) { +bool wasi_sockets_udp_method_udp_socket_stream(wasi_sockets_udp_borrow_udp_socket_t self, wasi_sockets_udp_ip_socket_address_t *maybe_remote_address, wasi_sockets_udp_tuple2_own_incoming_datagram_stream_own_outgoing_datagram_stream_t *ret, wasi_sockets_udp_error_code_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - wasi_sockets_0_2_0_udp_option_ip_socket_address_t remote_address; + wasi_sockets_udp_option_ip_socket_address_t remote_address; remote_address.is_some = maybe_remote_address != NULL;if (maybe_remote_address) { remote_address.val = *maybe_remote_address; } @@ -3503,7 +3574,7 @@ bool wasi_sockets_0_2_0_udp_method_udp_socket_stream(wasi_sockets_0_2_0_udp_borr int32_t option24; int32_t option25; if ((remote_address).is_some) { - const wasi_sockets_0_2_0_udp_ip_socket_address_t *payload0 = &(remote_address).val; + const wasi_sockets_udp_ip_socket_address_t *payload0 = &(remote_address).val; int32_t variant; int32_t variant3; int32_t variant4; @@ -3518,7 +3589,7 @@ bool wasi_sockets_0_2_0_udp_method_udp_socket_stream(wasi_sockets_0_2_0_udp_borr int32_t variant13; switch ((int32_t) (*payload0).tag) { case 0: { - const wasi_sockets_0_2_0_network_ipv4_socket_address_t *payload1 = &(*payload0).val.ipv4; + const wasi_sockets_network_ipv4_socket_address_t *payload1 = &(*payload0).val.ipv4; variant = 0; variant3 = (int32_t) ((*payload1).port); variant4 = (int32_t) (((*payload1).address).f0); @@ -3534,7 +3605,7 @@ bool wasi_sockets_0_2_0_udp_method_udp_socket_stream(wasi_sockets_0_2_0_udp_borr break; } case 1: { - const wasi_sockets_0_2_0_network_ipv6_socket_address_t *payload2 = &(*payload0).val.ipv6; + const wasi_sockets_network_ipv6_socket_address_t *payload2 = &(*payload0).val.ipv6; variant = 1; variant3 = (int32_t) ((*payload2).port); variant4 = (int32_t) ((*payload2).flow_info); @@ -3578,21 +3649,21 @@ bool wasi_sockets_0_2_0_udp_method_udp_socket_stream(wasi_sockets_0_2_0_udp_borr option24 = 0; option25 = 0; } - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_sockets_0_2_0_udp_method_udp_socket_stream((self).__handle, option, option14, option15, option16, option17, option18, option19, option20, option21, option22, option23, option24, option25, ptr); - wasi_sockets_0_2_0_udp_result_tuple2_own_incoming_datagram_stream_own_outgoing_datagram_stream_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_sockets_udp_method_udp_socket_stream((self).__handle, option, option14, option15, option16, option17, option18, option19, option20, option21, option22, option23, option24, option25, ptr); + wasi_sockets_udp_result_tuple2_own_incoming_datagram_stream_own_outgoing_datagram_stream_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (wasi_sockets_0_2_0_udp_tuple2_own_incoming_datagram_stream_own_outgoing_datagram_stream_t) { - (wasi_sockets_0_2_0_udp_own_incoming_datagram_stream_t) { *((int32_t*) (ptr + 4)) }, - (wasi_sockets_0_2_0_udp_own_outgoing_datagram_stream_t) { *((int32_t*) (ptr + 8)) }, + result.val.ok = (wasi_sockets_udp_tuple2_own_incoming_datagram_stream_own_outgoing_datagram_stream_t) { + (wasi_sockets_udp_own_incoming_datagram_stream_t) (wasi_sockets_udp_own_incoming_datagram_stream_t) { *((int32_t*) (ptr + 4)) }, + (wasi_sockets_udp_own_outgoing_datagram_stream_t) (wasi_sockets_udp_own_outgoing_datagram_stream_t) { *((int32_t*) (ptr + 8)) }, }; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 4))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 4)); break; } } @@ -3605,56 +3676,56 @@ bool wasi_sockets_0_2_0_udp_method_udp_socket_stream(wasi_sockets_0_2_0_udp_borr } } -bool wasi_sockets_0_2_0_udp_method_udp_socket_local_address(wasi_sockets_0_2_0_udp_borrow_udp_socket_t self, wasi_sockets_0_2_0_udp_ip_socket_address_t *ret, wasi_sockets_0_2_0_udp_error_code_t *err) { +bool wasi_sockets_udp_method_udp_socket_local_address(wasi_sockets_udp_borrow_udp_socket_t self, wasi_sockets_udp_ip_socket_address_t *ret, wasi_sockets_udp_error_code_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[36]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_sockets_0_2_0_udp_method_udp_socket_local_address((self).__handle, ptr); - wasi_sockets_0_2_0_udp_result_ip_socket_address_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_sockets_udp_method_udp_socket_local_address((self).__handle, ptr); + wasi_sockets_udp_result_ip_socket_address_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - wasi_sockets_0_2_0_network_ip_socket_address_t variant; - variant.tag = (int32_t) (*((uint8_t*) (ptr + 4))); + wasi_sockets_network_ip_socket_address_t variant; + variant.tag = (int32_t) *((uint8_t*) (ptr + 4)); switch ((int32_t) variant.tag) { case 0: { - variant.val.ipv4 = (wasi_sockets_0_2_0_network_ipv4_socket_address_t) { - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 8)))), - (wasi_sockets_0_2_0_network_ipv4_address_t) { - (uint8_t) ((int32_t) (*((uint8_t*) (ptr + 10)))), - (uint8_t) ((int32_t) (*((uint8_t*) (ptr + 11)))), - (uint8_t) ((int32_t) (*((uint8_t*) (ptr + 12)))), - (uint8_t) ((int32_t) (*((uint8_t*) (ptr + 13)))), + variant.val.ipv4 = (wasi_sockets_network_ipv4_socket_address_t) { + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 8))), + (wasi_sockets_network_ipv4_address_t) (wasi_sockets_network_ipv4_address_t) { + (uint8_t) (uint8_t) ((int32_t) *((uint8_t*) (ptr + 10))), + (uint8_t) (uint8_t) ((int32_t) *((uint8_t*) (ptr + 11))), + (uint8_t) (uint8_t) ((int32_t) *((uint8_t*) (ptr + 12))), + (uint8_t) (uint8_t) ((int32_t) *((uint8_t*) (ptr + 13))), }, }; break; } case 1: { - variant.val.ipv6 = (wasi_sockets_0_2_0_network_ipv6_socket_address_t) { - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 8)))), - (uint32_t) (*((int32_t*) (ptr + 12))), - (wasi_sockets_0_2_0_network_ipv6_address_t) { - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 16)))), - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 18)))), - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 20)))), - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 22)))), - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 24)))), - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 26)))), - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 28)))), - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 30)))), + variant.val.ipv6 = (wasi_sockets_network_ipv6_socket_address_t) { + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 8))), + (uint32_t) (uint32_t) (*((int32_t*) (ptr + 12))), + (wasi_sockets_network_ipv6_address_t) (wasi_sockets_network_ipv6_address_t) { + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 16))), + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 18))), + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 20))), + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 22))), + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 24))), + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 26))), + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 28))), + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 30))), }, - (uint32_t) (*((int32_t*) (ptr + 32))), + (uint32_t) (uint32_t) (*((int32_t*) (ptr + 32))), }; break; } } - + result.val.ok = variant; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 4))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 4)); break; } } @@ -3667,56 +3738,56 @@ bool wasi_sockets_0_2_0_udp_method_udp_socket_local_address(wasi_sockets_0_2_0_u } } -bool wasi_sockets_0_2_0_udp_method_udp_socket_remote_address(wasi_sockets_0_2_0_udp_borrow_udp_socket_t self, wasi_sockets_0_2_0_udp_ip_socket_address_t *ret, wasi_sockets_0_2_0_udp_error_code_t *err) { +bool wasi_sockets_udp_method_udp_socket_remote_address(wasi_sockets_udp_borrow_udp_socket_t self, wasi_sockets_udp_ip_socket_address_t *ret, wasi_sockets_udp_error_code_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[36]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_sockets_0_2_0_udp_method_udp_socket_remote_address((self).__handle, ptr); - wasi_sockets_0_2_0_udp_result_ip_socket_address_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_sockets_udp_method_udp_socket_remote_address((self).__handle, ptr); + wasi_sockets_udp_result_ip_socket_address_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - wasi_sockets_0_2_0_network_ip_socket_address_t variant; - variant.tag = (int32_t) (*((uint8_t*) (ptr + 4))); + wasi_sockets_network_ip_socket_address_t variant; + variant.tag = (int32_t) *((uint8_t*) (ptr + 4)); switch ((int32_t) variant.tag) { case 0: { - variant.val.ipv4 = (wasi_sockets_0_2_0_network_ipv4_socket_address_t) { - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 8)))), - (wasi_sockets_0_2_0_network_ipv4_address_t) { - (uint8_t) ((int32_t) (*((uint8_t*) (ptr + 10)))), - (uint8_t) ((int32_t) (*((uint8_t*) (ptr + 11)))), - (uint8_t) ((int32_t) (*((uint8_t*) (ptr + 12)))), - (uint8_t) ((int32_t) (*((uint8_t*) (ptr + 13)))), + variant.val.ipv4 = (wasi_sockets_network_ipv4_socket_address_t) { + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 8))), + (wasi_sockets_network_ipv4_address_t) (wasi_sockets_network_ipv4_address_t) { + (uint8_t) (uint8_t) ((int32_t) *((uint8_t*) (ptr + 10))), + (uint8_t) (uint8_t) ((int32_t) *((uint8_t*) (ptr + 11))), + (uint8_t) (uint8_t) ((int32_t) *((uint8_t*) (ptr + 12))), + (uint8_t) (uint8_t) ((int32_t) *((uint8_t*) (ptr + 13))), }, }; break; } case 1: { - variant.val.ipv6 = (wasi_sockets_0_2_0_network_ipv6_socket_address_t) { - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 8)))), - (uint32_t) (*((int32_t*) (ptr + 12))), - (wasi_sockets_0_2_0_network_ipv6_address_t) { - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 16)))), - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 18)))), - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 20)))), - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 22)))), - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 24)))), - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 26)))), - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 28)))), - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 30)))), + variant.val.ipv6 = (wasi_sockets_network_ipv6_socket_address_t) { + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 8))), + (uint32_t) (uint32_t) (*((int32_t*) (ptr + 12))), + (wasi_sockets_network_ipv6_address_t) (wasi_sockets_network_ipv6_address_t) { + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 16))), + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 18))), + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 20))), + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 22))), + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 24))), + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 26))), + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 28))), + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 30))), }, - (uint32_t) (*((int32_t*) (ptr + 32))), + (uint32_t) (uint32_t) (*((int32_t*) (ptr + 32))), }; break; } } - + result.val.ok = variant; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 4))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 4)); break; } } @@ -3729,26 +3800,26 @@ bool wasi_sockets_0_2_0_udp_method_udp_socket_remote_address(wasi_sockets_0_2_0_ } } -wasi_sockets_0_2_0_udp_ip_address_family_t wasi_sockets_0_2_0_udp_method_udp_socket_address_family(wasi_sockets_0_2_0_udp_borrow_udp_socket_t self) { - int32_t ret = __wasm_import_wasi_sockets_0_2_0_udp_method_udp_socket_address_family((self).__handle); +wasi_sockets_udp_ip_address_family_t wasi_sockets_udp_method_udp_socket_address_family(wasi_sockets_udp_borrow_udp_socket_t self) { + int32_t ret = __wasm_import_wasi_sockets_udp_method_udp_socket_address_family((self).__handle); return ret; } -bool wasi_sockets_0_2_0_udp_method_udp_socket_unicast_hop_limit(wasi_sockets_0_2_0_udp_borrow_udp_socket_t self, uint8_t *ret, wasi_sockets_0_2_0_udp_error_code_t *err) { +bool wasi_sockets_udp_method_udp_socket_unicast_hop_limit(wasi_sockets_udp_borrow_udp_socket_t self, uint8_t *ret, wasi_sockets_udp_error_code_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_sockets_0_2_0_udp_method_udp_socket_unicast_hop_limit((self).__handle, ptr); - wasi_sockets_0_2_0_udp_result_u8_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_sockets_udp_method_udp_socket_unicast_hop_limit((self).__handle, ptr); + wasi_sockets_udp_result_u8_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (uint8_t) ((int32_t) (*((uint8_t*) (ptr + 1)))); + result.val.ok = (uint8_t) ((int32_t) *((uint8_t*) (ptr + 1))); break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 1))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 1)); break; } } @@ -3761,20 +3832,20 @@ bool wasi_sockets_0_2_0_udp_method_udp_socket_unicast_hop_limit(wasi_sockets_0_2 } } -bool wasi_sockets_0_2_0_udp_method_udp_socket_set_unicast_hop_limit(wasi_sockets_0_2_0_udp_borrow_udp_socket_t self, uint8_t value, wasi_sockets_0_2_0_udp_error_code_t *err) { +bool wasi_sockets_udp_method_udp_socket_set_unicast_hop_limit(wasi_sockets_udp_borrow_udp_socket_t self, uint8_t value, wasi_sockets_udp_error_code_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_sockets_0_2_0_udp_method_udp_socket_set_unicast_hop_limit((self).__handle, (int32_t) (value), ptr); - wasi_sockets_0_2_0_udp_result_void_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_sockets_udp_method_udp_socket_set_unicast_hop_limit((self).__handle, (int32_t) (value), ptr); + wasi_sockets_udp_result_void_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 1))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 1)); break; } } @@ -3786,13 +3857,13 @@ bool wasi_sockets_0_2_0_udp_method_udp_socket_set_unicast_hop_limit(wasi_sockets } } -bool wasi_sockets_0_2_0_udp_method_udp_socket_receive_buffer_size(wasi_sockets_0_2_0_udp_borrow_udp_socket_t self, uint64_t *ret, wasi_sockets_0_2_0_udp_error_code_t *err) { +bool wasi_sockets_udp_method_udp_socket_receive_buffer_size(wasi_sockets_udp_borrow_udp_socket_t self, uint64_t *ret, wasi_sockets_udp_error_code_t *err) { __attribute__((__aligned__(8))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_sockets_0_2_0_udp_method_udp_socket_receive_buffer_size((self).__handle, ptr); - wasi_sockets_0_2_0_udp_result_u64_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_sockets_udp_method_udp_socket_receive_buffer_size((self).__handle, ptr); + wasi_sockets_udp_result_u64_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint64_t) (*((int64_t*) (ptr + 8))); @@ -3800,7 +3871,7 @@ bool wasi_sockets_0_2_0_udp_method_udp_socket_receive_buffer_size(wasi_sockets_0 } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 8))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 8)); break; } } @@ -3813,20 +3884,20 @@ bool wasi_sockets_0_2_0_udp_method_udp_socket_receive_buffer_size(wasi_sockets_0 } } -bool wasi_sockets_0_2_0_udp_method_udp_socket_set_receive_buffer_size(wasi_sockets_0_2_0_udp_borrow_udp_socket_t self, uint64_t value, wasi_sockets_0_2_0_udp_error_code_t *err) { +bool wasi_sockets_udp_method_udp_socket_set_receive_buffer_size(wasi_sockets_udp_borrow_udp_socket_t self, uint64_t value, wasi_sockets_udp_error_code_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_sockets_0_2_0_udp_method_udp_socket_set_receive_buffer_size((self).__handle, (int64_t) (value), ptr); - wasi_sockets_0_2_0_udp_result_void_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_sockets_udp_method_udp_socket_set_receive_buffer_size((self).__handle, (int64_t) (value), ptr); + wasi_sockets_udp_result_void_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 1))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 1)); break; } } @@ -3838,13 +3909,13 @@ bool wasi_sockets_0_2_0_udp_method_udp_socket_set_receive_buffer_size(wasi_socke } } -bool wasi_sockets_0_2_0_udp_method_udp_socket_send_buffer_size(wasi_sockets_0_2_0_udp_borrow_udp_socket_t self, uint64_t *ret, wasi_sockets_0_2_0_udp_error_code_t *err) { +bool wasi_sockets_udp_method_udp_socket_send_buffer_size(wasi_sockets_udp_borrow_udp_socket_t self, uint64_t *ret, wasi_sockets_udp_error_code_t *err) { __attribute__((__aligned__(8))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_sockets_0_2_0_udp_method_udp_socket_send_buffer_size((self).__handle, ptr); - wasi_sockets_0_2_0_udp_result_u64_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_sockets_udp_method_udp_socket_send_buffer_size((self).__handle, ptr); + wasi_sockets_udp_result_u64_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint64_t) (*((int64_t*) (ptr + 8))); @@ -3852,7 +3923,7 @@ bool wasi_sockets_0_2_0_udp_method_udp_socket_send_buffer_size(wasi_sockets_0_2_ } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 8))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 8)); break; } } @@ -3865,20 +3936,20 @@ bool wasi_sockets_0_2_0_udp_method_udp_socket_send_buffer_size(wasi_sockets_0_2_ } } -bool wasi_sockets_0_2_0_udp_method_udp_socket_set_send_buffer_size(wasi_sockets_0_2_0_udp_borrow_udp_socket_t self, uint64_t value, wasi_sockets_0_2_0_udp_error_code_t *err) { +bool wasi_sockets_udp_method_udp_socket_set_send_buffer_size(wasi_sockets_udp_borrow_udp_socket_t self, uint64_t value, wasi_sockets_udp_error_code_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_sockets_0_2_0_udp_method_udp_socket_set_send_buffer_size((self).__handle, (int64_t) (value), ptr); - wasi_sockets_0_2_0_udp_result_void_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_sockets_udp_method_udp_socket_set_send_buffer_size((self).__handle, (int64_t) (value), ptr); + wasi_sockets_udp_result_void_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 1))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 1)); break; } } @@ -3890,26 +3961,26 @@ bool wasi_sockets_0_2_0_udp_method_udp_socket_set_send_buffer_size(wasi_sockets_ } } -wasi_sockets_0_2_0_udp_own_pollable_t wasi_sockets_0_2_0_udp_method_udp_socket_subscribe(wasi_sockets_0_2_0_udp_borrow_udp_socket_t self) { - int32_t ret = __wasm_import_wasi_sockets_0_2_0_udp_method_udp_socket_subscribe((self).__handle); - return (wasi_sockets_0_2_0_udp_own_pollable_t) { ret }; +wasi_sockets_udp_own_pollable_t wasi_sockets_udp_method_udp_socket_subscribe(wasi_sockets_udp_borrow_udp_socket_t self) { + int32_t ret = __wasm_import_wasi_sockets_udp_method_udp_socket_subscribe((self).__handle); + return (wasi_sockets_udp_own_pollable_t) { ret }; } -bool wasi_sockets_0_2_0_udp_method_incoming_datagram_stream_receive(wasi_sockets_0_2_0_udp_borrow_incoming_datagram_stream_t self, uint64_t max_results, wasi_sockets_0_2_0_udp_list_incoming_datagram_t *ret, wasi_sockets_0_2_0_udp_error_code_t *err) { +bool wasi_sockets_udp_method_incoming_datagram_stream_receive(wasi_sockets_udp_borrow_incoming_datagram_stream_t self, uint64_t max_results, wasi_sockets_udp_list_incoming_datagram_t *ret, wasi_sockets_udp_error_code_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_sockets_0_2_0_udp_method_incoming_datagram_stream_receive((self).__handle, (int64_t) (max_results), ptr); - wasi_sockets_0_2_0_udp_result_list_incoming_datagram_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_sockets_udp_method_incoming_datagram_stream_receive((self).__handle, (int64_t) (max_results), ptr); + wasi_sockets_udp_result_list_incoming_datagram_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (wasi_sockets_0_2_0_udp_list_incoming_datagram_t) { (wasi_sockets_0_2_0_udp_incoming_datagram_t*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + result.val.ok = (wasi_sockets_udp_list_incoming_datagram_t) { (wasi_sockets_udp_incoming_datagram_t*)(*((uint8_t **) (ptr + 4))), (*((size_t*) (ptr + 8))) }; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 4))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 4)); break; } } @@ -3922,18 +3993,18 @@ bool wasi_sockets_0_2_0_udp_method_incoming_datagram_stream_receive(wasi_sockets } } -wasi_sockets_0_2_0_udp_own_pollable_t wasi_sockets_0_2_0_udp_method_incoming_datagram_stream_subscribe(wasi_sockets_0_2_0_udp_borrow_incoming_datagram_stream_t self) { - int32_t ret = __wasm_import_wasi_sockets_0_2_0_udp_method_incoming_datagram_stream_subscribe((self).__handle); - return (wasi_sockets_0_2_0_udp_own_pollable_t) { ret }; +wasi_sockets_udp_own_pollable_t wasi_sockets_udp_method_incoming_datagram_stream_subscribe(wasi_sockets_udp_borrow_incoming_datagram_stream_t self) { + int32_t ret = __wasm_import_wasi_sockets_udp_method_incoming_datagram_stream_subscribe((self).__handle); + return (wasi_sockets_udp_own_pollable_t) { ret }; } -bool wasi_sockets_0_2_0_udp_method_outgoing_datagram_stream_check_send(wasi_sockets_0_2_0_udp_borrow_outgoing_datagram_stream_t self, uint64_t *ret, wasi_sockets_0_2_0_udp_error_code_t *err) { +bool wasi_sockets_udp_method_outgoing_datagram_stream_check_send(wasi_sockets_udp_borrow_outgoing_datagram_stream_t self, uint64_t *ret, wasi_sockets_udp_error_code_t *err) { __attribute__((__aligned__(8))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_sockets_0_2_0_udp_method_outgoing_datagram_stream_check_send((self).__handle, ptr); - wasi_sockets_0_2_0_udp_result_u64_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_sockets_udp_method_outgoing_datagram_stream_check_send((self).__handle, ptr); + wasi_sockets_udp_result_u64_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint64_t) (*((int64_t*) (ptr + 8))); @@ -3941,7 +4012,7 @@ bool wasi_sockets_0_2_0_udp_method_outgoing_datagram_stream_check_send(wasi_sock } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 8))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 8)); break; } } @@ -3954,13 +4025,13 @@ bool wasi_sockets_0_2_0_udp_method_outgoing_datagram_stream_check_send(wasi_sock } } -bool wasi_sockets_0_2_0_udp_method_outgoing_datagram_stream_send(wasi_sockets_0_2_0_udp_borrow_outgoing_datagram_stream_t self, wasi_sockets_0_2_0_udp_list_outgoing_datagram_t *datagrams, uint64_t *ret, wasi_sockets_0_2_0_udp_error_code_t *err) { +bool wasi_sockets_udp_method_outgoing_datagram_stream_send(wasi_sockets_udp_borrow_outgoing_datagram_stream_t self, wasi_sockets_udp_list_outgoing_datagram_t *datagrams, uint64_t *ret, wasi_sockets_udp_error_code_t *err) { __attribute__((__aligned__(8))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_sockets_0_2_0_udp_method_outgoing_datagram_stream_send((self).__handle, (int32_t) (*datagrams).ptr, (int32_t) (*datagrams).len, ptr); - wasi_sockets_0_2_0_udp_result_u64_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_sockets_udp_method_outgoing_datagram_stream_send((self).__handle, (uint8_t *) (*datagrams).ptr, (*datagrams).len, ptr); + wasi_sockets_udp_result_u64_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint64_t) (*((int64_t*) (ptr + 8))); @@ -3968,7 +4039,7 @@ bool wasi_sockets_0_2_0_udp_method_outgoing_datagram_stream_send(wasi_sockets_0_ } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 8))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 8)); break; } } @@ -3981,26 +4052,26 @@ bool wasi_sockets_0_2_0_udp_method_outgoing_datagram_stream_send(wasi_sockets_0_ } } -wasi_sockets_0_2_0_udp_own_pollable_t wasi_sockets_0_2_0_udp_method_outgoing_datagram_stream_subscribe(wasi_sockets_0_2_0_udp_borrow_outgoing_datagram_stream_t self) { - int32_t ret = __wasm_import_wasi_sockets_0_2_0_udp_method_outgoing_datagram_stream_subscribe((self).__handle); - return (wasi_sockets_0_2_0_udp_own_pollable_t) { ret }; +wasi_sockets_udp_own_pollable_t wasi_sockets_udp_method_outgoing_datagram_stream_subscribe(wasi_sockets_udp_borrow_outgoing_datagram_stream_t self) { + int32_t ret = __wasm_import_wasi_sockets_udp_method_outgoing_datagram_stream_subscribe((self).__handle); + return (wasi_sockets_udp_own_pollable_t) { ret }; } -bool wasi_sockets_0_2_0_udp_create_socket_create_udp_socket(wasi_sockets_0_2_0_udp_create_socket_ip_address_family_t address_family, wasi_sockets_0_2_0_udp_create_socket_own_udp_socket_t *ret, wasi_sockets_0_2_0_udp_create_socket_error_code_t *err) { +bool wasi_sockets_udp_create_socket_create_udp_socket(wasi_sockets_udp_create_socket_ip_address_family_t address_family, wasi_sockets_udp_create_socket_own_udp_socket_t *ret, wasi_sockets_udp_create_socket_error_code_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_sockets_0_2_0_udp_create_socket_create_udp_socket((int32_t) address_family, ptr); - wasi_sockets_0_2_0_udp_create_socket_result_own_udp_socket_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_sockets_udp_create_socket_create_udp_socket((int32_t) address_family, ptr); + wasi_sockets_udp_create_socket_result_own_udp_socket_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (wasi_sockets_0_2_0_udp_create_socket_own_udp_socket_t) { *((int32_t*) (ptr + 4)) }; + result.val.ok = (wasi_sockets_udp_create_socket_own_udp_socket_t) { *((int32_t*) (ptr + 4)) }; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 4))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 4)); break; } } @@ -4013,7 +4084,7 @@ bool wasi_sockets_0_2_0_udp_create_socket_create_udp_socket(wasi_sockets_0_2_0_u } } -bool wasi_sockets_0_2_0_tcp_method_tcp_socket_start_bind(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, wasi_sockets_0_2_0_tcp_borrow_network_t network, wasi_sockets_0_2_0_tcp_ip_socket_address_t *local_address, wasi_sockets_0_2_0_tcp_error_code_t *err) { +bool wasi_sockets_tcp_method_tcp_socket_start_bind(wasi_sockets_tcp_borrow_tcp_socket_t self, wasi_sockets_tcp_borrow_network_t network, wasi_sockets_tcp_ip_socket_address_t *local_address, wasi_sockets_tcp_error_code_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; int32_t variant; @@ -4030,7 +4101,7 @@ bool wasi_sockets_0_2_0_tcp_method_tcp_socket_start_bind(wasi_sockets_0_2_0_tcp_ int32_t variant11; switch ((int32_t) (*local_address).tag) { case 0: { - const wasi_sockets_0_2_0_network_ipv4_socket_address_t *payload = &(*local_address).val.ipv4; + const wasi_sockets_network_ipv4_socket_address_t *payload = &(*local_address).val.ipv4; variant = 0; variant1 = (int32_t) ((*payload).port); variant2 = (int32_t) (((*payload).address).f0); @@ -4046,7 +4117,7 @@ bool wasi_sockets_0_2_0_tcp_method_tcp_socket_start_bind(wasi_sockets_0_2_0_tcp_ break; } case 1: { - const wasi_sockets_0_2_0_network_ipv6_socket_address_t *payload0 = &(*local_address).val.ipv6; + const wasi_sockets_network_ipv6_socket_address_t *payload0 = &(*local_address).val.ipv6; variant = 1; variant1 = (int32_t) ((*payload0).port); variant2 = (int32_t) ((*payload0).flow_info); @@ -4062,17 +4133,17 @@ bool wasi_sockets_0_2_0_tcp_method_tcp_socket_start_bind(wasi_sockets_0_2_0_tcp_ break; } } - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_start_bind((self).__handle, (network).__handle, variant, variant1, variant2, variant3, variant4, variant5, variant6, variant7, variant8, variant9, variant10, variant11, ptr); - wasi_sockets_0_2_0_tcp_result_void_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_sockets_tcp_method_tcp_socket_start_bind((self).__handle, (network).__handle, variant, variant1, variant2, variant3, variant4, variant5, variant6, variant7, variant8, variant9, variant10, variant11, ptr); + wasi_sockets_tcp_result_void_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 1))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 1)); break; } } @@ -4084,20 +4155,20 @@ bool wasi_sockets_0_2_0_tcp_method_tcp_socket_start_bind(wasi_sockets_0_2_0_tcp_ } } -bool wasi_sockets_0_2_0_tcp_method_tcp_socket_finish_bind(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, wasi_sockets_0_2_0_tcp_error_code_t *err) { +bool wasi_sockets_tcp_method_tcp_socket_finish_bind(wasi_sockets_tcp_borrow_tcp_socket_t self, wasi_sockets_tcp_error_code_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_finish_bind((self).__handle, ptr); - wasi_sockets_0_2_0_tcp_result_void_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_sockets_tcp_method_tcp_socket_finish_bind((self).__handle, ptr); + wasi_sockets_tcp_result_void_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 1))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 1)); break; } } @@ -4109,7 +4180,7 @@ bool wasi_sockets_0_2_0_tcp_method_tcp_socket_finish_bind(wasi_sockets_0_2_0_tcp } } -bool wasi_sockets_0_2_0_tcp_method_tcp_socket_start_connect(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, wasi_sockets_0_2_0_tcp_borrow_network_t network, wasi_sockets_0_2_0_tcp_ip_socket_address_t *remote_address, wasi_sockets_0_2_0_tcp_error_code_t *err) { +bool wasi_sockets_tcp_method_tcp_socket_start_connect(wasi_sockets_tcp_borrow_tcp_socket_t self, wasi_sockets_tcp_borrow_network_t network, wasi_sockets_tcp_ip_socket_address_t *remote_address, wasi_sockets_tcp_error_code_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; int32_t variant; @@ -4126,7 +4197,7 @@ bool wasi_sockets_0_2_0_tcp_method_tcp_socket_start_connect(wasi_sockets_0_2_0_t int32_t variant11; switch ((int32_t) (*remote_address).tag) { case 0: { - const wasi_sockets_0_2_0_network_ipv4_socket_address_t *payload = &(*remote_address).val.ipv4; + const wasi_sockets_network_ipv4_socket_address_t *payload = &(*remote_address).val.ipv4; variant = 0; variant1 = (int32_t) ((*payload).port); variant2 = (int32_t) (((*payload).address).f0); @@ -4142,7 +4213,7 @@ bool wasi_sockets_0_2_0_tcp_method_tcp_socket_start_connect(wasi_sockets_0_2_0_t break; } case 1: { - const wasi_sockets_0_2_0_network_ipv6_socket_address_t *payload0 = &(*remote_address).val.ipv6; + const wasi_sockets_network_ipv6_socket_address_t *payload0 = &(*remote_address).val.ipv6; variant = 1; variant1 = (int32_t) ((*payload0).port); variant2 = (int32_t) ((*payload0).flow_info); @@ -4158,17 +4229,17 @@ bool wasi_sockets_0_2_0_tcp_method_tcp_socket_start_connect(wasi_sockets_0_2_0_t break; } } - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_start_connect((self).__handle, (network).__handle, variant, variant1, variant2, variant3, variant4, variant5, variant6, variant7, variant8, variant9, variant10, variant11, ptr); - wasi_sockets_0_2_0_tcp_result_void_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_sockets_tcp_method_tcp_socket_start_connect((self).__handle, (network).__handle, variant, variant1, variant2, variant3, variant4, variant5, variant6, variant7, variant8, variant9, variant10, variant11, ptr); + wasi_sockets_tcp_result_void_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 1))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 1)); break; } } @@ -4180,24 +4251,24 @@ bool wasi_sockets_0_2_0_tcp_method_tcp_socket_start_connect(wasi_sockets_0_2_0_t } } -bool wasi_sockets_0_2_0_tcp_method_tcp_socket_finish_connect(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, wasi_sockets_0_2_0_tcp_tuple2_own_input_stream_own_output_stream_t *ret, wasi_sockets_0_2_0_tcp_error_code_t *err) { +bool wasi_sockets_tcp_method_tcp_socket_finish_connect(wasi_sockets_tcp_borrow_tcp_socket_t self, wasi_sockets_tcp_tuple2_own_input_stream_own_output_stream_t *ret, wasi_sockets_tcp_error_code_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_finish_connect((self).__handle, ptr); - wasi_sockets_0_2_0_tcp_result_tuple2_own_input_stream_own_output_stream_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_sockets_tcp_method_tcp_socket_finish_connect((self).__handle, ptr); + wasi_sockets_tcp_result_tuple2_own_input_stream_own_output_stream_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (wasi_sockets_0_2_0_tcp_tuple2_own_input_stream_own_output_stream_t) { - (wasi_sockets_0_2_0_tcp_own_input_stream_t) { *((int32_t*) (ptr + 4)) }, - (wasi_sockets_0_2_0_tcp_own_output_stream_t) { *((int32_t*) (ptr + 8)) }, + result.val.ok = (wasi_sockets_tcp_tuple2_own_input_stream_own_output_stream_t) { + (wasi_sockets_tcp_own_input_stream_t) (wasi_sockets_tcp_own_input_stream_t) { *((int32_t*) (ptr + 4)) }, + (wasi_sockets_tcp_own_output_stream_t) (wasi_sockets_tcp_own_output_stream_t) { *((int32_t*) (ptr + 8)) }, }; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 4))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 4)); break; } } @@ -4210,20 +4281,20 @@ bool wasi_sockets_0_2_0_tcp_method_tcp_socket_finish_connect(wasi_sockets_0_2_0_ } } -bool wasi_sockets_0_2_0_tcp_method_tcp_socket_start_listen(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, wasi_sockets_0_2_0_tcp_error_code_t *err) { +bool wasi_sockets_tcp_method_tcp_socket_start_listen(wasi_sockets_tcp_borrow_tcp_socket_t self, wasi_sockets_tcp_error_code_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_start_listen((self).__handle, ptr); - wasi_sockets_0_2_0_tcp_result_void_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_sockets_tcp_method_tcp_socket_start_listen((self).__handle, ptr); + wasi_sockets_tcp_result_void_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 1))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 1)); break; } } @@ -4235,20 +4306,20 @@ bool wasi_sockets_0_2_0_tcp_method_tcp_socket_start_listen(wasi_sockets_0_2_0_tc } } -bool wasi_sockets_0_2_0_tcp_method_tcp_socket_finish_listen(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, wasi_sockets_0_2_0_tcp_error_code_t *err) { +bool wasi_sockets_tcp_method_tcp_socket_finish_listen(wasi_sockets_tcp_borrow_tcp_socket_t self, wasi_sockets_tcp_error_code_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_finish_listen((self).__handle, ptr); - wasi_sockets_0_2_0_tcp_result_void_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_sockets_tcp_method_tcp_socket_finish_listen((self).__handle, ptr); + wasi_sockets_tcp_result_void_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 1))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 1)); break; } } @@ -4260,25 +4331,25 @@ bool wasi_sockets_0_2_0_tcp_method_tcp_socket_finish_listen(wasi_sockets_0_2_0_t } } -bool wasi_sockets_0_2_0_tcp_method_tcp_socket_accept(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, wasi_sockets_0_2_0_tcp_tuple3_own_tcp_socket_own_input_stream_own_output_stream_t *ret, wasi_sockets_0_2_0_tcp_error_code_t *err) { +bool wasi_sockets_tcp_method_tcp_socket_accept(wasi_sockets_tcp_borrow_tcp_socket_t self, wasi_sockets_tcp_tuple3_own_tcp_socket_own_input_stream_own_output_stream_t *ret, wasi_sockets_tcp_error_code_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_accept((self).__handle, ptr); - wasi_sockets_0_2_0_tcp_result_tuple3_own_tcp_socket_own_input_stream_own_output_stream_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_sockets_tcp_method_tcp_socket_accept((self).__handle, ptr); + wasi_sockets_tcp_result_tuple3_own_tcp_socket_own_input_stream_own_output_stream_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (wasi_sockets_0_2_0_tcp_tuple3_own_tcp_socket_own_input_stream_own_output_stream_t) { - (wasi_sockets_0_2_0_tcp_own_tcp_socket_t) { *((int32_t*) (ptr + 4)) }, - (wasi_sockets_0_2_0_tcp_own_input_stream_t) { *((int32_t*) (ptr + 8)) }, - (wasi_sockets_0_2_0_tcp_own_output_stream_t) { *((int32_t*) (ptr + 12)) }, + result.val.ok = (wasi_sockets_tcp_tuple3_own_tcp_socket_own_input_stream_own_output_stream_t) { + (wasi_sockets_tcp_own_tcp_socket_t) (wasi_sockets_tcp_own_tcp_socket_t) { *((int32_t*) (ptr + 4)) }, + (wasi_sockets_tcp_own_input_stream_t) (wasi_sockets_tcp_own_input_stream_t) { *((int32_t*) (ptr + 8)) }, + (wasi_sockets_tcp_own_output_stream_t) (wasi_sockets_tcp_own_output_stream_t) { *((int32_t*) (ptr + 12)) }, }; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 4))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 4)); break; } } @@ -4291,56 +4362,56 @@ bool wasi_sockets_0_2_0_tcp_method_tcp_socket_accept(wasi_sockets_0_2_0_tcp_borr } } -bool wasi_sockets_0_2_0_tcp_method_tcp_socket_local_address(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, wasi_sockets_0_2_0_tcp_ip_socket_address_t *ret, wasi_sockets_0_2_0_tcp_error_code_t *err) { +bool wasi_sockets_tcp_method_tcp_socket_local_address(wasi_sockets_tcp_borrow_tcp_socket_t self, wasi_sockets_tcp_ip_socket_address_t *ret, wasi_sockets_tcp_error_code_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[36]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_local_address((self).__handle, ptr); - wasi_sockets_0_2_0_tcp_result_ip_socket_address_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_sockets_tcp_method_tcp_socket_local_address((self).__handle, ptr); + wasi_sockets_tcp_result_ip_socket_address_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - wasi_sockets_0_2_0_network_ip_socket_address_t variant; - variant.tag = (int32_t) (*((uint8_t*) (ptr + 4))); + wasi_sockets_network_ip_socket_address_t variant; + variant.tag = (int32_t) *((uint8_t*) (ptr + 4)); switch ((int32_t) variant.tag) { case 0: { - variant.val.ipv4 = (wasi_sockets_0_2_0_network_ipv4_socket_address_t) { - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 8)))), - (wasi_sockets_0_2_0_network_ipv4_address_t) { - (uint8_t) ((int32_t) (*((uint8_t*) (ptr + 10)))), - (uint8_t) ((int32_t) (*((uint8_t*) (ptr + 11)))), - (uint8_t) ((int32_t) (*((uint8_t*) (ptr + 12)))), - (uint8_t) ((int32_t) (*((uint8_t*) (ptr + 13)))), + variant.val.ipv4 = (wasi_sockets_network_ipv4_socket_address_t) { + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 8))), + (wasi_sockets_network_ipv4_address_t) (wasi_sockets_network_ipv4_address_t) { + (uint8_t) (uint8_t) ((int32_t) *((uint8_t*) (ptr + 10))), + (uint8_t) (uint8_t) ((int32_t) *((uint8_t*) (ptr + 11))), + (uint8_t) (uint8_t) ((int32_t) *((uint8_t*) (ptr + 12))), + (uint8_t) (uint8_t) ((int32_t) *((uint8_t*) (ptr + 13))), }, }; break; } case 1: { - variant.val.ipv6 = (wasi_sockets_0_2_0_network_ipv6_socket_address_t) { - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 8)))), - (uint32_t) (*((int32_t*) (ptr + 12))), - (wasi_sockets_0_2_0_network_ipv6_address_t) { - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 16)))), - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 18)))), - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 20)))), - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 22)))), - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 24)))), - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 26)))), - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 28)))), - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 30)))), + variant.val.ipv6 = (wasi_sockets_network_ipv6_socket_address_t) { + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 8))), + (uint32_t) (uint32_t) (*((int32_t*) (ptr + 12))), + (wasi_sockets_network_ipv6_address_t) (wasi_sockets_network_ipv6_address_t) { + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 16))), + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 18))), + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 20))), + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 22))), + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 24))), + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 26))), + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 28))), + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 30))), }, - (uint32_t) (*((int32_t*) (ptr + 32))), + (uint32_t) (uint32_t) (*((int32_t*) (ptr + 32))), }; break; } } - + result.val.ok = variant; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 4))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 4)); break; } } @@ -4353,56 +4424,56 @@ bool wasi_sockets_0_2_0_tcp_method_tcp_socket_local_address(wasi_sockets_0_2_0_t } } -bool wasi_sockets_0_2_0_tcp_method_tcp_socket_remote_address(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, wasi_sockets_0_2_0_tcp_ip_socket_address_t *ret, wasi_sockets_0_2_0_tcp_error_code_t *err) { +bool wasi_sockets_tcp_method_tcp_socket_remote_address(wasi_sockets_tcp_borrow_tcp_socket_t self, wasi_sockets_tcp_ip_socket_address_t *ret, wasi_sockets_tcp_error_code_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[36]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_remote_address((self).__handle, ptr); - wasi_sockets_0_2_0_tcp_result_ip_socket_address_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_sockets_tcp_method_tcp_socket_remote_address((self).__handle, ptr); + wasi_sockets_tcp_result_ip_socket_address_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - wasi_sockets_0_2_0_network_ip_socket_address_t variant; - variant.tag = (int32_t) (*((uint8_t*) (ptr + 4))); + wasi_sockets_network_ip_socket_address_t variant; + variant.tag = (int32_t) *((uint8_t*) (ptr + 4)); switch ((int32_t) variant.tag) { case 0: { - variant.val.ipv4 = (wasi_sockets_0_2_0_network_ipv4_socket_address_t) { - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 8)))), - (wasi_sockets_0_2_0_network_ipv4_address_t) { - (uint8_t) ((int32_t) (*((uint8_t*) (ptr + 10)))), - (uint8_t) ((int32_t) (*((uint8_t*) (ptr + 11)))), - (uint8_t) ((int32_t) (*((uint8_t*) (ptr + 12)))), - (uint8_t) ((int32_t) (*((uint8_t*) (ptr + 13)))), + variant.val.ipv4 = (wasi_sockets_network_ipv4_socket_address_t) { + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 8))), + (wasi_sockets_network_ipv4_address_t) (wasi_sockets_network_ipv4_address_t) { + (uint8_t) (uint8_t) ((int32_t) *((uint8_t*) (ptr + 10))), + (uint8_t) (uint8_t) ((int32_t) *((uint8_t*) (ptr + 11))), + (uint8_t) (uint8_t) ((int32_t) *((uint8_t*) (ptr + 12))), + (uint8_t) (uint8_t) ((int32_t) *((uint8_t*) (ptr + 13))), }, }; break; } case 1: { - variant.val.ipv6 = (wasi_sockets_0_2_0_network_ipv6_socket_address_t) { - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 8)))), - (uint32_t) (*((int32_t*) (ptr + 12))), - (wasi_sockets_0_2_0_network_ipv6_address_t) { - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 16)))), - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 18)))), - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 20)))), - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 22)))), - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 24)))), - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 26)))), - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 28)))), - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 30)))), + variant.val.ipv6 = (wasi_sockets_network_ipv6_socket_address_t) { + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 8))), + (uint32_t) (uint32_t) (*((int32_t*) (ptr + 12))), + (wasi_sockets_network_ipv6_address_t) (wasi_sockets_network_ipv6_address_t) { + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 16))), + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 18))), + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 20))), + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 22))), + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 24))), + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 26))), + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 28))), + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 30))), }, - (uint32_t) (*((int32_t*) (ptr + 32))), + (uint32_t) (uint32_t) (*((int32_t*) (ptr + 32))), }; break; } } - + result.val.ok = variant; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 4))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 4)); break; } } @@ -4415,30 +4486,30 @@ bool wasi_sockets_0_2_0_tcp_method_tcp_socket_remote_address(wasi_sockets_0_2_0_ } } -bool wasi_sockets_0_2_0_tcp_method_tcp_socket_is_listening(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self) { - int32_t ret = __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_is_listening((self).__handle); +bool wasi_sockets_tcp_method_tcp_socket_is_listening(wasi_sockets_tcp_borrow_tcp_socket_t self) { + int32_t ret = __wasm_import_wasi_sockets_tcp_method_tcp_socket_is_listening((self).__handle); return ret; } -wasi_sockets_0_2_0_tcp_ip_address_family_t wasi_sockets_0_2_0_tcp_method_tcp_socket_address_family(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self) { - int32_t ret = __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_address_family((self).__handle); +wasi_sockets_tcp_ip_address_family_t wasi_sockets_tcp_method_tcp_socket_address_family(wasi_sockets_tcp_borrow_tcp_socket_t self) { + int32_t ret = __wasm_import_wasi_sockets_tcp_method_tcp_socket_address_family((self).__handle); return ret; } -bool wasi_sockets_0_2_0_tcp_method_tcp_socket_set_listen_backlog_size(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, uint64_t value, wasi_sockets_0_2_0_tcp_error_code_t *err) { +bool wasi_sockets_tcp_method_tcp_socket_set_listen_backlog_size(wasi_sockets_tcp_borrow_tcp_socket_t self, uint64_t value, wasi_sockets_tcp_error_code_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_set_listen_backlog_size((self).__handle, (int64_t) (value), ptr); - wasi_sockets_0_2_0_tcp_result_void_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_sockets_tcp_method_tcp_socket_set_listen_backlog_size((self).__handle, (int64_t) (value), ptr); + wasi_sockets_tcp_result_void_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 1))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 1)); break; } } @@ -4450,21 +4521,21 @@ bool wasi_sockets_0_2_0_tcp_method_tcp_socket_set_listen_backlog_size(wasi_socke } } -bool wasi_sockets_0_2_0_tcp_method_tcp_socket_keep_alive_enabled(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, bool *ret, wasi_sockets_0_2_0_tcp_error_code_t *err) { +bool wasi_sockets_tcp_method_tcp_socket_keep_alive_enabled(wasi_sockets_tcp_borrow_tcp_socket_t self, bool *ret, wasi_sockets_tcp_error_code_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_keep_alive_enabled((self).__handle, ptr); - wasi_sockets_0_2_0_tcp_result_bool_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_sockets_tcp_method_tcp_socket_keep_alive_enabled((self).__handle, ptr); + wasi_sockets_tcp_result_bool_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (int32_t) (*((uint8_t*) (ptr + 1))); + result.val.ok = (int32_t) *((uint8_t*) (ptr + 1)); break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 1))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 1)); break; } } @@ -4477,20 +4548,20 @@ bool wasi_sockets_0_2_0_tcp_method_tcp_socket_keep_alive_enabled(wasi_sockets_0_ } } -bool wasi_sockets_0_2_0_tcp_method_tcp_socket_set_keep_alive_enabled(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, bool value, wasi_sockets_0_2_0_tcp_error_code_t *err) { +bool wasi_sockets_tcp_method_tcp_socket_set_keep_alive_enabled(wasi_sockets_tcp_borrow_tcp_socket_t self, bool value, wasi_sockets_tcp_error_code_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_set_keep_alive_enabled((self).__handle, value, ptr); - wasi_sockets_0_2_0_tcp_result_void_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_sockets_tcp_method_tcp_socket_set_keep_alive_enabled((self).__handle, value, ptr); + wasi_sockets_tcp_result_void_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 1))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 1)); break; } } @@ -4502,13 +4573,13 @@ bool wasi_sockets_0_2_0_tcp_method_tcp_socket_set_keep_alive_enabled(wasi_socket } } -bool wasi_sockets_0_2_0_tcp_method_tcp_socket_keep_alive_idle_time(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, wasi_sockets_0_2_0_tcp_duration_t *ret, wasi_sockets_0_2_0_tcp_error_code_t *err) { +bool wasi_sockets_tcp_method_tcp_socket_keep_alive_idle_time(wasi_sockets_tcp_borrow_tcp_socket_t self, wasi_sockets_tcp_duration_t *ret, wasi_sockets_tcp_error_code_t *err) { __attribute__((__aligned__(8))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_keep_alive_idle_time((self).__handle, ptr); - wasi_sockets_0_2_0_tcp_result_duration_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_sockets_tcp_method_tcp_socket_keep_alive_idle_time((self).__handle, ptr); + wasi_sockets_tcp_result_duration_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint64_t) (*((int64_t*) (ptr + 8))); @@ -4516,7 +4587,7 @@ bool wasi_sockets_0_2_0_tcp_method_tcp_socket_keep_alive_idle_time(wasi_sockets_ } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 8))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 8)); break; } } @@ -4529,20 +4600,20 @@ bool wasi_sockets_0_2_0_tcp_method_tcp_socket_keep_alive_idle_time(wasi_sockets_ } } -bool wasi_sockets_0_2_0_tcp_method_tcp_socket_set_keep_alive_idle_time(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, wasi_sockets_0_2_0_tcp_duration_t value, wasi_sockets_0_2_0_tcp_error_code_t *err) { +bool wasi_sockets_tcp_method_tcp_socket_set_keep_alive_idle_time(wasi_sockets_tcp_borrow_tcp_socket_t self, wasi_sockets_tcp_duration_t value, wasi_sockets_tcp_error_code_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_set_keep_alive_idle_time((self).__handle, (int64_t) (value), ptr); - wasi_sockets_0_2_0_tcp_result_void_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_sockets_tcp_method_tcp_socket_set_keep_alive_idle_time((self).__handle, (int64_t) (value), ptr); + wasi_sockets_tcp_result_void_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 1))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 1)); break; } } @@ -4554,13 +4625,13 @@ bool wasi_sockets_0_2_0_tcp_method_tcp_socket_set_keep_alive_idle_time(wasi_sock } } -bool wasi_sockets_0_2_0_tcp_method_tcp_socket_keep_alive_interval(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, wasi_sockets_0_2_0_tcp_duration_t *ret, wasi_sockets_0_2_0_tcp_error_code_t *err) { +bool wasi_sockets_tcp_method_tcp_socket_keep_alive_interval(wasi_sockets_tcp_borrow_tcp_socket_t self, wasi_sockets_tcp_duration_t *ret, wasi_sockets_tcp_error_code_t *err) { __attribute__((__aligned__(8))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_keep_alive_interval((self).__handle, ptr); - wasi_sockets_0_2_0_tcp_result_duration_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_sockets_tcp_method_tcp_socket_keep_alive_interval((self).__handle, ptr); + wasi_sockets_tcp_result_duration_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint64_t) (*((int64_t*) (ptr + 8))); @@ -4568,7 +4639,7 @@ bool wasi_sockets_0_2_0_tcp_method_tcp_socket_keep_alive_interval(wasi_sockets_0 } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 8))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 8)); break; } } @@ -4581,20 +4652,20 @@ bool wasi_sockets_0_2_0_tcp_method_tcp_socket_keep_alive_interval(wasi_sockets_0 } } -bool wasi_sockets_0_2_0_tcp_method_tcp_socket_set_keep_alive_interval(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, wasi_sockets_0_2_0_tcp_duration_t value, wasi_sockets_0_2_0_tcp_error_code_t *err) { +bool wasi_sockets_tcp_method_tcp_socket_set_keep_alive_interval(wasi_sockets_tcp_borrow_tcp_socket_t self, wasi_sockets_tcp_duration_t value, wasi_sockets_tcp_error_code_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_set_keep_alive_interval((self).__handle, (int64_t) (value), ptr); - wasi_sockets_0_2_0_tcp_result_void_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_sockets_tcp_method_tcp_socket_set_keep_alive_interval((self).__handle, (int64_t) (value), ptr); + wasi_sockets_tcp_result_void_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 1))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 1)); break; } } @@ -4606,13 +4677,13 @@ bool wasi_sockets_0_2_0_tcp_method_tcp_socket_set_keep_alive_interval(wasi_socke } } -bool wasi_sockets_0_2_0_tcp_method_tcp_socket_keep_alive_count(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, uint32_t *ret, wasi_sockets_0_2_0_tcp_error_code_t *err) { +bool wasi_sockets_tcp_method_tcp_socket_keep_alive_count(wasi_sockets_tcp_borrow_tcp_socket_t self, uint32_t *ret, wasi_sockets_tcp_error_code_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_keep_alive_count((self).__handle, ptr); - wasi_sockets_0_2_0_tcp_result_u32_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_sockets_tcp_method_tcp_socket_keep_alive_count((self).__handle, ptr); + wasi_sockets_tcp_result_u32_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -4620,7 +4691,7 @@ bool wasi_sockets_0_2_0_tcp_method_tcp_socket_keep_alive_count(wasi_sockets_0_2_ } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 4))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 4)); break; } } @@ -4633,20 +4704,20 @@ bool wasi_sockets_0_2_0_tcp_method_tcp_socket_keep_alive_count(wasi_sockets_0_2_ } } -bool wasi_sockets_0_2_0_tcp_method_tcp_socket_set_keep_alive_count(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, uint32_t value, wasi_sockets_0_2_0_tcp_error_code_t *err) { +bool wasi_sockets_tcp_method_tcp_socket_set_keep_alive_count(wasi_sockets_tcp_borrow_tcp_socket_t self, uint32_t value, wasi_sockets_tcp_error_code_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_set_keep_alive_count((self).__handle, (int32_t) (value), ptr); - wasi_sockets_0_2_0_tcp_result_void_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_sockets_tcp_method_tcp_socket_set_keep_alive_count((self).__handle, (int32_t) (value), ptr); + wasi_sockets_tcp_result_void_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 1))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 1)); break; } } @@ -4658,21 +4729,21 @@ bool wasi_sockets_0_2_0_tcp_method_tcp_socket_set_keep_alive_count(wasi_sockets_ } } -bool wasi_sockets_0_2_0_tcp_method_tcp_socket_hop_limit(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, uint8_t *ret, wasi_sockets_0_2_0_tcp_error_code_t *err) { +bool wasi_sockets_tcp_method_tcp_socket_hop_limit(wasi_sockets_tcp_borrow_tcp_socket_t self, uint8_t *ret, wasi_sockets_tcp_error_code_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_hop_limit((self).__handle, ptr); - wasi_sockets_0_2_0_tcp_result_u8_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_sockets_tcp_method_tcp_socket_hop_limit((self).__handle, ptr); + wasi_sockets_tcp_result_u8_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (uint8_t) ((int32_t) (*((uint8_t*) (ptr + 1)))); + result.val.ok = (uint8_t) ((int32_t) *((uint8_t*) (ptr + 1))); break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 1))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 1)); break; } } @@ -4685,20 +4756,20 @@ bool wasi_sockets_0_2_0_tcp_method_tcp_socket_hop_limit(wasi_sockets_0_2_0_tcp_b } } -bool wasi_sockets_0_2_0_tcp_method_tcp_socket_set_hop_limit(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, uint8_t value, wasi_sockets_0_2_0_tcp_error_code_t *err) { +bool wasi_sockets_tcp_method_tcp_socket_set_hop_limit(wasi_sockets_tcp_borrow_tcp_socket_t self, uint8_t value, wasi_sockets_tcp_error_code_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_set_hop_limit((self).__handle, (int32_t) (value), ptr); - wasi_sockets_0_2_0_tcp_result_void_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_sockets_tcp_method_tcp_socket_set_hop_limit((self).__handle, (int32_t) (value), ptr); + wasi_sockets_tcp_result_void_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 1))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 1)); break; } } @@ -4710,13 +4781,13 @@ bool wasi_sockets_0_2_0_tcp_method_tcp_socket_set_hop_limit(wasi_sockets_0_2_0_t } } -bool wasi_sockets_0_2_0_tcp_method_tcp_socket_receive_buffer_size(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, uint64_t *ret, wasi_sockets_0_2_0_tcp_error_code_t *err) { +bool wasi_sockets_tcp_method_tcp_socket_receive_buffer_size(wasi_sockets_tcp_borrow_tcp_socket_t self, uint64_t *ret, wasi_sockets_tcp_error_code_t *err) { __attribute__((__aligned__(8))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_receive_buffer_size((self).__handle, ptr); - wasi_sockets_0_2_0_tcp_result_u64_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_sockets_tcp_method_tcp_socket_receive_buffer_size((self).__handle, ptr); + wasi_sockets_tcp_result_u64_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint64_t) (*((int64_t*) (ptr + 8))); @@ -4724,7 +4795,7 @@ bool wasi_sockets_0_2_0_tcp_method_tcp_socket_receive_buffer_size(wasi_sockets_0 } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 8))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 8)); break; } } @@ -4737,20 +4808,20 @@ bool wasi_sockets_0_2_0_tcp_method_tcp_socket_receive_buffer_size(wasi_sockets_0 } } -bool wasi_sockets_0_2_0_tcp_method_tcp_socket_set_receive_buffer_size(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, uint64_t value, wasi_sockets_0_2_0_tcp_error_code_t *err) { +bool wasi_sockets_tcp_method_tcp_socket_set_receive_buffer_size(wasi_sockets_tcp_borrow_tcp_socket_t self, uint64_t value, wasi_sockets_tcp_error_code_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_set_receive_buffer_size((self).__handle, (int64_t) (value), ptr); - wasi_sockets_0_2_0_tcp_result_void_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_sockets_tcp_method_tcp_socket_set_receive_buffer_size((self).__handle, (int64_t) (value), ptr); + wasi_sockets_tcp_result_void_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 1))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 1)); break; } } @@ -4762,13 +4833,13 @@ bool wasi_sockets_0_2_0_tcp_method_tcp_socket_set_receive_buffer_size(wasi_socke } } -bool wasi_sockets_0_2_0_tcp_method_tcp_socket_send_buffer_size(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, uint64_t *ret, wasi_sockets_0_2_0_tcp_error_code_t *err) { +bool wasi_sockets_tcp_method_tcp_socket_send_buffer_size(wasi_sockets_tcp_borrow_tcp_socket_t self, uint64_t *ret, wasi_sockets_tcp_error_code_t *err) { __attribute__((__aligned__(8))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_send_buffer_size((self).__handle, ptr); - wasi_sockets_0_2_0_tcp_result_u64_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_sockets_tcp_method_tcp_socket_send_buffer_size((self).__handle, ptr); + wasi_sockets_tcp_result_u64_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint64_t) (*((int64_t*) (ptr + 8))); @@ -4776,7 +4847,7 @@ bool wasi_sockets_0_2_0_tcp_method_tcp_socket_send_buffer_size(wasi_sockets_0_2_ } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 8))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 8)); break; } } @@ -4789,20 +4860,20 @@ bool wasi_sockets_0_2_0_tcp_method_tcp_socket_send_buffer_size(wasi_sockets_0_2_ } } -bool wasi_sockets_0_2_0_tcp_method_tcp_socket_set_send_buffer_size(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, uint64_t value, wasi_sockets_0_2_0_tcp_error_code_t *err) { +bool wasi_sockets_tcp_method_tcp_socket_set_send_buffer_size(wasi_sockets_tcp_borrow_tcp_socket_t self, uint64_t value, wasi_sockets_tcp_error_code_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_set_send_buffer_size((self).__handle, (int64_t) (value), ptr); - wasi_sockets_0_2_0_tcp_result_void_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_sockets_tcp_method_tcp_socket_set_send_buffer_size((self).__handle, (int64_t) (value), ptr); + wasi_sockets_tcp_result_void_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 1))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 1)); break; } } @@ -4814,25 +4885,25 @@ bool wasi_sockets_0_2_0_tcp_method_tcp_socket_set_send_buffer_size(wasi_sockets_ } } -wasi_sockets_0_2_0_tcp_own_pollable_t wasi_sockets_0_2_0_tcp_method_tcp_socket_subscribe(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self) { - int32_t ret = __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_subscribe((self).__handle); - return (wasi_sockets_0_2_0_tcp_own_pollable_t) { ret }; +wasi_sockets_tcp_own_pollable_t wasi_sockets_tcp_method_tcp_socket_subscribe(wasi_sockets_tcp_borrow_tcp_socket_t self) { + int32_t ret = __wasm_import_wasi_sockets_tcp_method_tcp_socket_subscribe((self).__handle); + return (wasi_sockets_tcp_own_pollable_t) { ret }; } -bool wasi_sockets_0_2_0_tcp_method_tcp_socket_shutdown(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, wasi_sockets_0_2_0_tcp_shutdown_type_t shutdown_type, wasi_sockets_0_2_0_tcp_error_code_t *err) { +bool wasi_sockets_tcp_method_tcp_socket_shutdown(wasi_sockets_tcp_borrow_tcp_socket_t self, wasi_sockets_tcp_shutdown_type_t shutdown_type, wasi_sockets_tcp_error_code_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_sockets_0_2_0_tcp_method_tcp_socket_shutdown((self).__handle, (int32_t) shutdown_type, ptr); - wasi_sockets_0_2_0_tcp_result_void_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_sockets_tcp_method_tcp_socket_shutdown((self).__handle, (int32_t) shutdown_type, ptr); + wasi_sockets_tcp_result_void_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 1))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 1)); break; } } @@ -4844,21 +4915,21 @@ bool wasi_sockets_0_2_0_tcp_method_tcp_socket_shutdown(wasi_sockets_0_2_0_tcp_bo } } -bool wasi_sockets_0_2_0_tcp_create_socket_create_tcp_socket(wasi_sockets_0_2_0_tcp_create_socket_ip_address_family_t address_family, wasi_sockets_0_2_0_tcp_create_socket_own_tcp_socket_t *ret, wasi_sockets_0_2_0_tcp_create_socket_error_code_t *err) { +bool wasi_sockets_tcp_create_socket_create_tcp_socket(wasi_sockets_tcp_create_socket_ip_address_family_t address_family, wasi_sockets_tcp_create_socket_own_tcp_socket_t *ret, wasi_sockets_tcp_create_socket_error_code_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_sockets_0_2_0_tcp_create_socket_create_tcp_socket((int32_t) address_family, ptr); - wasi_sockets_0_2_0_tcp_create_socket_result_own_tcp_socket_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_sockets_tcp_create_socket_create_tcp_socket((int32_t) address_family, ptr); + wasi_sockets_tcp_create_socket_result_own_tcp_socket_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (wasi_sockets_0_2_0_tcp_create_socket_own_tcp_socket_t) { *((int32_t*) (ptr + 4)) }; + result.val.ok = (wasi_sockets_tcp_create_socket_own_tcp_socket_t) { *((int32_t*) (ptr + 4)) }; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 4))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 4)); break; } } @@ -4871,21 +4942,21 @@ bool wasi_sockets_0_2_0_tcp_create_socket_create_tcp_socket(wasi_sockets_0_2_0_t } } -bool wasi_sockets_0_2_0_ip_name_lookup_resolve_addresses(wasi_sockets_0_2_0_ip_name_lookup_borrow_network_t network, bindings_string_t *name, wasi_sockets_0_2_0_ip_name_lookup_own_resolve_address_stream_t *ret, wasi_sockets_0_2_0_ip_name_lookup_error_code_t *err) { +bool wasi_sockets_ip_name_lookup_resolve_addresses(wasi_sockets_ip_name_lookup_borrow_network_t network, bindings_string_t *name, wasi_sockets_ip_name_lookup_own_resolve_address_stream_t *ret, wasi_sockets_ip_name_lookup_error_code_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_sockets_0_2_0_ip_name_lookup_resolve_addresses((network).__handle, (int32_t) (*name).ptr, (int32_t) (*name).len, ptr); - wasi_sockets_0_2_0_ip_name_lookup_result_own_resolve_address_stream_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_sockets_ip_name_lookup_resolve_addresses((network).__handle, (uint8_t *) (*name).ptr, (*name).len, ptr); + wasi_sockets_ip_name_lookup_result_own_resolve_address_stream_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (wasi_sockets_0_2_0_ip_name_lookup_own_resolve_address_stream_t) { *((int32_t*) (ptr + 4)) }; + result.val.ok = (wasi_sockets_ip_name_lookup_own_resolve_address_stream_t) { *((int32_t*) (ptr + 4)) }; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 4))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 4)); break; } } @@ -4898,61 +4969,61 @@ bool wasi_sockets_0_2_0_ip_name_lookup_resolve_addresses(wasi_sockets_0_2_0_ip_n } } -bool wasi_sockets_0_2_0_ip_name_lookup_method_resolve_address_stream_resolve_next_address(wasi_sockets_0_2_0_ip_name_lookup_borrow_resolve_address_stream_t self, wasi_sockets_0_2_0_ip_name_lookup_option_ip_address_t *ret, wasi_sockets_0_2_0_ip_name_lookup_error_code_t *err) { +bool wasi_sockets_ip_name_lookup_method_resolve_address_stream_resolve_next_address(wasi_sockets_ip_name_lookup_borrow_resolve_address_stream_t self, wasi_sockets_ip_name_lookup_option_ip_address_t *ret, wasi_sockets_ip_name_lookup_error_code_t *err) { __attribute__((__aligned__(2))) uint8_t ret_area[22]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_sockets_0_2_0_ip_name_lookup_method_resolve_address_stream_resolve_next_address((self).__handle, ptr); - wasi_sockets_0_2_0_ip_name_lookup_result_option_ip_address_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_sockets_ip_name_lookup_method_resolve_address_stream_resolve_next_address((self).__handle, ptr); + wasi_sockets_ip_name_lookup_result_option_ip_address_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - wasi_sockets_0_2_0_ip_name_lookup_option_ip_address_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 2)))) { + wasi_sockets_ip_name_lookup_option_ip_address_t option; + switch ((int32_t) *((uint8_t*) (ptr + 2))) { case 0: { option.is_some = false; break; } case 1: { option.is_some = true; - wasi_sockets_0_2_0_network_ip_address_t variant; - variant.tag = (int32_t) (*((uint8_t*) (ptr + 4))); + wasi_sockets_network_ip_address_t variant; + variant.tag = (int32_t) *((uint8_t*) (ptr + 4)); switch ((int32_t) variant.tag) { case 0: { - variant.val.ipv4 = (wasi_sockets_0_2_0_network_ipv4_address_t) { - (uint8_t) ((int32_t) (*((uint8_t*) (ptr + 6)))), - (uint8_t) ((int32_t) (*((uint8_t*) (ptr + 7)))), - (uint8_t) ((int32_t) (*((uint8_t*) (ptr + 8)))), - (uint8_t) ((int32_t) (*((uint8_t*) (ptr + 9)))), + variant.val.ipv4 = (wasi_sockets_network_ipv4_address_t) { + (uint8_t) (uint8_t) ((int32_t) *((uint8_t*) (ptr + 6))), + (uint8_t) (uint8_t) ((int32_t) *((uint8_t*) (ptr + 7))), + (uint8_t) (uint8_t) ((int32_t) *((uint8_t*) (ptr + 8))), + (uint8_t) (uint8_t) ((int32_t) *((uint8_t*) (ptr + 9))), }; break; } case 1: { - variant.val.ipv6 = (wasi_sockets_0_2_0_network_ipv6_address_t) { - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 6)))), - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 8)))), - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 10)))), - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 12)))), - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 14)))), - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 16)))), - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 18)))), - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 20)))), + variant.val.ipv6 = (wasi_sockets_network_ipv6_address_t) { + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 6))), + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 8))), + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 10))), + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 12))), + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 14))), + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 16))), + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 18))), + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 20))), }; break; } } - + option.val = variant; break; } } - + result.val.ok = option; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr + 2))); + result.val.err = (int32_t) *((uint8_t*) (ptr + 2)); break; } } @@ -4965,95 +5036,95 @@ bool wasi_sockets_0_2_0_ip_name_lookup_method_resolve_address_stream_resolve_nex } } -wasi_sockets_0_2_0_ip_name_lookup_own_pollable_t wasi_sockets_0_2_0_ip_name_lookup_method_resolve_address_stream_subscribe(wasi_sockets_0_2_0_ip_name_lookup_borrow_resolve_address_stream_t self) { - int32_t ret = __wasm_import_wasi_sockets_0_2_0_ip_name_lookup_method_resolve_address_stream_subscribe((self).__handle); - return (wasi_sockets_0_2_0_ip_name_lookup_own_pollable_t) { ret }; +wasi_sockets_ip_name_lookup_own_pollable_t wasi_sockets_ip_name_lookup_method_resolve_address_stream_subscribe(wasi_sockets_ip_name_lookup_borrow_resolve_address_stream_t self) { + int32_t ret = __wasm_import_wasi_sockets_ip_name_lookup_method_resolve_address_stream_subscribe((self).__handle); + return (wasi_sockets_ip_name_lookup_own_pollable_t) { ret }; } -void wasi_random_0_2_0_random_get_random_bytes(uint64_t len, wasi_random_0_2_0_random_list_u8_t *ret) { +void wasi_random_random_get_random_bytes(uint64_t len, bindings_list_u8_t *ret) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_random_0_2_0_random_get_random_bytes((int64_t) (len), ptr); - *ret = (wasi_random_0_2_0_random_list_u8_t) { (uint8_t*)(*((int32_t*) (ptr + 0))), (size_t)(*((int32_t*) (ptr + 4))) }; + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_random_random_get_random_bytes((int64_t) (len), ptr); + *ret = (bindings_list_u8_t) { (uint8_t*)(*((uint8_t **) (ptr + 0))), (*((size_t*) (ptr + 4))) }; } -uint64_t wasi_random_0_2_0_random_get_random_u64(void) { - int64_t ret = __wasm_import_wasi_random_0_2_0_random_get_random_u64(); +uint64_t wasi_random_random_get_random_u64(void) { + int64_t ret = __wasm_import_wasi_random_random_get_random_u64(); return (uint64_t) (ret); } -void wasi_random_0_2_0_insecure_get_insecure_random_bytes(uint64_t len, wasi_random_0_2_0_random_list_u8_t *ret) { +void wasi_random_insecure_get_insecure_random_bytes(uint64_t len, bindings_list_u8_t *ret) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_random_0_2_0_insecure_get_insecure_random_bytes((int64_t) (len), ptr); - *ret = (wasi_random_0_2_0_random_list_u8_t) { (uint8_t*)(*((int32_t*) (ptr + 0))), (size_t)(*((int32_t*) (ptr + 4))) }; + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_random_insecure_get_insecure_random_bytes((int64_t) (len), ptr); + *ret = (bindings_list_u8_t) { (uint8_t*)(*((uint8_t **) (ptr + 0))), (*((size_t*) (ptr + 4))) }; } -uint64_t wasi_random_0_2_0_insecure_get_insecure_random_u64(void) { - int64_t ret = __wasm_import_wasi_random_0_2_0_insecure_get_insecure_random_u64(); +uint64_t wasi_random_insecure_get_insecure_random_u64(void) { + int64_t ret = __wasm_import_wasi_random_insecure_get_insecure_random_u64(); return (uint64_t) (ret); } -void wasi_random_0_2_0_insecure_seed_insecure_seed(wasi_random_0_2_0_insecure_seed_tuple2_u64_u64_t *ret) { +void wasi_random_insecure_seed_insecure_seed(bindings_tuple2_u64_u64_t *ret) { __attribute__((__aligned__(8))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_random_0_2_0_insecure_seed_insecure_seed(ptr); - *ret = (wasi_random_0_2_0_insecure_seed_tuple2_u64_u64_t) { - (uint64_t) (*((int64_t*) (ptr + 0))), - (uint64_t) (*((int64_t*) (ptr + 8))), + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_random_insecure_seed_insecure_seed(ptr); + *ret = (bindings_tuple2_u64_u64_t) { + (uint64_t) (uint64_t) (*((int64_t*) (ptr + 0))), + (uint64_t) (uint64_t) (*((int64_t*) (ptr + 8))), }; } -bool wasi_http_0_2_0_types_http_error_code(wasi_http_0_2_0_types_borrow_io_error_t err_, wasi_http_0_2_0_types_error_code_t *ret) { +bool wasi_http_types_http_error_code(wasi_http_types_borrow_io_error_t err_, wasi_http_types_error_code_t *ret) { __attribute__((__aligned__(8))) uint8_t ret_area[40]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_http_0_2_0_types_http_error_code((err_).__handle, ptr); - wasi_http_0_2_0_types_option_error_code_t option21; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_http_types_http_error_code((err_).__handle, ptr); + wasi_http_types_option_error_code_t option21; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { option21.is_some = false; break; } case 1: { option21.is_some = true; - wasi_http_0_2_0_types_error_code_t variant; - variant.tag = (int32_t) (*((uint8_t*) (ptr + 8))); + wasi_http_types_error_code_t variant; + variant.tag = (int32_t) *((uint8_t*) (ptr + 8)); switch ((int32_t) variant.tag) { case 0: { break; } case 1: { - wasi_http_0_2_0_types_option_string_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 16)))) { + bindings_option_string_t option; + switch ((int32_t) *((uint8_t*) (ptr + 16))) { case 0: { option.is_some = false; break; } case 1: { option.is_some = true; - option.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 20))), (size_t)(*((int32_t*) (ptr + 24))) }; + option.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 20))), (*((size_t*) (ptr + 24))) }; break; } } - wasi_http_0_2_0_types_option_u16_t option0; - switch ((int32_t) (*((uint8_t*) (ptr + 28)))) { + bindings_option_u16_t option0; + switch ((int32_t) *((uint8_t*) (ptr + 28))) { case 0: { option0.is_some = false; break; } case 1: { option0.is_some = true; - option0.val = (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 30)))); + option0.val = (uint16_t) ((int32_t) *((uint16_t*) (ptr + 30))); break; } } - variant.val.dns_error = (wasi_http_0_2_0_types_dns_error_payload_t) { - option, - option0, + variant.val.dns_error = (wasi_http_types_dns_error_payload_t) { + (bindings_option_string_t) option, + (bindings_option_u16_t) option0, }; break; } @@ -5094,33 +5165,33 @@ bool wasi_http_0_2_0_types_http_error_code(wasi_http_0_2_0_types_borrow_io_error break; } case 14: { - wasi_http_0_2_0_types_option_u8_t option1; - switch ((int32_t) (*((uint8_t*) (ptr + 16)))) { + bindings_option_u8_t option1; + switch ((int32_t) *((uint8_t*) (ptr + 16))) { case 0: { option1.is_some = false; break; } case 1: { option1.is_some = true; - option1.val = (uint8_t) ((int32_t) (*((uint8_t*) (ptr + 17)))); + option1.val = (uint8_t) ((int32_t) *((uint8_t*) (ptr + 17))); break; } } - wasi_http_0_2_0_types_option_string_t option2; - switch ((int32_t) (*((uint8_t*) (ptr + 20)))) { + bindings_option_string_t option2; + switch ((int32_t) *((uint8_t*) (ptr + 20))) { case 0: { option2.is_some = false; break; } case 1: { option2.is_some = true; - option2.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 24))), (size_t)(*((int32_t*) (ptr + 28))) }; + option2.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 24))), (*((size_t*) (ptr + 28))) }; break; } } - variant.val.tls_alert_received = (wasi_http_0_2_0_types_tls_alert_received_payload_t) { - option1, - option2, + variant.val.tls_alert_received = (wasi_http_types_tls_alert_received_payload_t) { + (bindings_option_u8_t) option1, + (bindings_option_string_t) option2, }; break; } @@ -5131,8 +5202,8 @@ bool wasi_http_0_2_0_types_http_error_code(wasi_http_0_2_0_types_borrow_io_error break; } case 17: { - wasi_http_0_2_0_types_option_u64_t option3; - switch ((int32_t) (*((uint8_t*) (ptr + 16)))) { + bindings_option_u64_t option3; + switch ((int32_t) *((uint8_t*) (ptr + 16))) { case 0: { option3.is_some = false; break; @@ -5156,8 +5227,8 @@ bool wasi_http_0_2_0_types_http_error_code(wasi_http_0_2_0_types_borrow_io_error break; } case 21: { - wasi_http_0_2_0_types_option_u32_t option4; - switch ((int32_t) (*((uint8_t*) (ptr + 16)))) { + bindings_option_u32_t option4; + switch ((int32_t) *((uint8_t*) (ptr + 16))) { case 0: { option4.is_some = false; break; @@ -5172,28 +5243,28 @@ bool wasi_http_0_2_0_types_http_error_code(wasi_http_0_2_0_types_borrow_io_error break; } case 22: { - wasi_http_0_2_0_types_option_field_size_payload_t option7; - switch ((int32_t) (*((uint8_t*) (ptr + 16)))) { + wasi_http_types_option_field_size_payload_t option7; + switch ((int32_t) *((uint8_t*) (ptr + 16))) { case 0: { option7.is_some = false; break; } case 1: { option7.is_some = true; - wasi_http_0_2_0_types_option_string_t option5; - switch ((int32_t) (*((uint8_t*) (ptr + 20)))) { + bindings_option_string_t option5; + switch ((int32_t) *((uint8_t*) (ptr + 20))) { case 0: { option5.is_some = false; break; } case 1: { option5.is_some = true; - option5.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 24))), (size_t)(*((int32_t*) (ptr + 28))) }; + option5.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 24))), (*((size_t*) (ptr + 28))) }; break; } } - wasi_http_0_2_0_types_option_u32_t option6; - switch ((int32_t) (*((uint8_t*) (ptr + 32)))) { + bindings_option_u32_t option6; + switch ((int32_t) *((uint8_t*) (ptr + 32))) { case 0: { option6.is_some = false; break; @@ -5204,10 +5275,10 @@ bool wasi_http_0_2_0_types_http_error_code(wasi_http_0_2_0_types_borrow_io_error break; } } - - option7.val = (wasi_http_0_2_0_types_field_size_payload_t) { - option5, - option6, + + option7.val = (wasi_http_types_field_size_payload_t) { + (bindings_option_string_t) option5, + (bindings_option_u32_t) option6, }; break; } @@ -5216,8 +5287,8 @@ bool wasi_http_0_2_0_types_http_error_code(wasi_http_0_2_0_types_borrow_io_error break; } case 23: { - wasi_http_0_2_0_types_option_u32_t option8; - switch ((int32_t) (*((uint8_t*) (ptr + 16)))) { + bindings_option_u32_t option8; + switch ((int32_t) *((uint8_t*) (ptr + 16))) { case 0: { option8.is_some = false; break; @@ -5232,20 +5303,20 @@ bool wasi_http_0_2_0_types_http_error_code(wasi_http_0_2_0_types_borrow_io_error break; } case 24: { - wasi_http_0_2_0_types_option_string_t option9; - switch ((int32_t) (*((uint8_t*) (ptr + 16)))) { + bindings_option_string_t option9; + switch ((int32_t) *((uint8_t*) (ptr + 16))) { case 0: { option9.is_some = false; break; } case 1: { option9.is_some = true; - option9.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 20))), (size_t)(*((int32_t*) (ptr + 24))) }; + option9.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 20))), (*((size_t*) (ptr + 24))) }; break; } } - wasi_http_0_2_0_types_option_u32_t option10; - switch ((int32_t) (*((uint8_t*) (ptr + 28)))) { + bindings_option_u32_t option10; + switch ((int32_t) *((uint8_t*) (ptr + 28))) { case 0: { option10.is_some = false; break; @@ -5256,9 +5327,9 @@ bool wasi_http_0_2_0_types_http_error_code(wasi_http_0_2_0_types_borrow_io_error break; } } - variant.val.http_request_trailer_size = (wasi_http_0_2_0_types_field_size_payload_t) { - option9, - option10, + variant.val.http_request_trailer_size = (wasi_http_types_field_size_payload_t) { + (bindings_option_string_t) option9, + (bindings_option_u32_t) option10, }; break; } @@ -5266,8 +5337,8 @@ bool wasi_http_0_2_0_types_http_error_code(wasi_http_0_2_0_types_borrow_io_error break; } case 26: { - wasi_http_0_2_0_types_option_u32_t option11; - switch ((int32_t) (*((uint8_t*) (ptr + 16)))) { + bindings_option_u32_t option11; + switch ((int32_t) *((uint8_t*) (ptr + 16))) { case 0: { option11.is_some = false; break; @@ -5282,20 +5353,20 @@ bool wasi_http_0_2_0_types_http_error_code(wasi_http_0_2_0_types_borrow_io_error break; } case 27: { - wasi_http_0_2_0_types_option_string_t option12; - switch ((int32_t) (*((uint8_t*) (ptr + 16)))) { + bindings_option_string_t option12; + switch ((int32_t) *((uint8_t*) (ptr + 16))) { case 0: { option12.is_some = false; break; } case 1: { option12.is_some = true; - option12.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 20))), (size_t)(*((int32_t*) (ptr + 24))) }; + option12.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 20))), (*((size_t*) (ptr + 24))) }; break; } } - wasi_http_0_2_0_types_option_u32_t option13; - switch ((int32_t) (*((uint8_t*) (ptr + 28)))) { + bindings_option_u32_t option13; + switch ((int32_t) *((uint8_t*) (ptr + 28))) { case 0: { option13.is_some = false; break; @@ -5306,15 +5377,15 @@ bool wasi_http_0_2_0_types_http_error_code(wasi_http_0_2_0_types_borrow_io_error break; } } - variant.val.http_response_header_size = (wasi_http_0_2_0_types_field_size_payload_t) { - option12, - option13, + variant.val.http_response_header_size = (wasi_http_types_field_size_payload_t) { + (bindings_option_string_t) option12, + (bindings_option_u32_t) option13, }; break; } case 28: { - wasi_http_0_2_0_types_option_u64_t option14; - switch ((int32_t) (*((uint8_t*) (ptr + 16)))) { + bindings_option_u64_t option14; + switch ((int32_t) *((uint8_t*) (ptr + 16))) { case 0: { option14.is_some = false; break; @@ -5329,8 +5400,8 @@ bool wasi_http_0_2_0_types_http_error_code(wasi_http_0_2_0_types_borrow_io_error break; } case 29: { - wasi_http_0_2_0_types_option_u32_t option15; - switch ((int32_t) (*((uint8_t*) (ptr + 16)))) { + bindings_option_u32_t option15; + switch ((int32_t) *((uint8_t*) (ptr + 16))) { case 0: { option15.is_some = false; break; @@ -5345,20 +5416,20 @@ bool wasi_http_0_2_0_types_http_error_code(wasi_http_0_2_0_types_borrow_io_error break; } case 30: { - wasi_http_0_2_0_types_option_string_t option16; - switch ((int32_t) (*((uint8_t*) (ptr + 16)))) { + bindings_option_string_t option16; + switch ((int32_t) *((uint8_t*) (ptr + 16))) { case 0: { option16.is_some = false; break; } case 1: { option16.is_some = true; - option16.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 20))), (size_t)(*((int32_t*) (ptr + 24))) }; + option16.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 20))), (*((size_t*) (ptr + 24))) }; break; } } - wasi_http_0_2_0_types_option_u32_t option17; - switch ((int32_t) (*((uint8_t*) (ptr + 28)))) { + bindings_option_u32_t option17; + switch ((int32_t) *((uint8_t*) (ptr + 28))) { case 0: { option17.is_some = false; break; @@ -5369,22 +5440,22 @@ bool wasi_http_0_2_0_types_http_error_code(wasi_http_0_2_0_types_borrow_io_error break; } } - variant.val.http_response_trailer_size = (wasi_http_0_2_0_types_field_size_payload_t) { - option16, - option17, + variant.val.http_response_trailer_size = (wasi_http_types_field_size_payload_t) { + (bindings_option_string_t) option16, + (bindings_option_u32_t) option17, }; break; } case 31: { - wasi_http_0_2_0_types_option_string_t option18; - switch ((int32_t) (*((uint8_t*) (ptr + 16)))) { + bindings_option_string_t option18; + switch ((int32_t) *((uint8_t*) (ptr + 16))) { case 0: { option18.is_some = false; break; } case 1: { option18.is_some = true; - option18.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 20))), (size_t)(*((int32_t*) (ptr + 24))) }; + option18.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 20))), (*((size_t*) (ptr + 24))) }; break; } } @@ -5392,15 +5463,15 @@ bool wasi_http_0_2_0_types_http_error_code(wasi_http_0_2_0_types_borrow_io_error break; } case 32: { - wasi_http_0_2_0_types_option_string_t option19; - switch ((int32_t) (*((uint8_t*) (ptr + 16)))) { + bindings_option_string_t option19; + switch ((int32_t) *((uint8_t*) (ptr + 16))) { case 0: { option19.is_some = false; break; } case 1: { option19.is_some = true; - option19.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 20))), (size_t)(*((int32_t*) (ptr + 24))) }; + option19.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 20))), (*((size_t*) (ptr + 24))) }; break; } } @@ -5423,15 +5494,15 @@ bool wasi_http_0_2_0_types_http_error_code(wasi_http_0_2_0_types_borrow_io_error break; } case 38: { - wasi_http_0_2_0_types_option_string_t option20; - switch ((int32_t) (*((uint8_t*) (ptr + 16)))) { + bindings_option_string_t option20; + switch ((int32_t) *((uint8_t*) (ptr + 16))) { case 0: { option20.is_some = false; break; } case 1: { option20.is_some = true; - option20.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 20))), (size_t)(*((int32_t*) (ptr + 24))) }; + option20.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 20))), (*((size_t*) (ptr + 24))) }; break; } } @@ -5439,7 +5510,7 @@ bool wasi_http_0_2_0_types_http_error_code(wasi_http_0_2_0_types_borrow_io_error break; } } - + option21.val = variant; break; } @@ -5448,27 +5519,27 @@ bool wasi_http_0_2_0_types_http_error_code(wasi_http_0_2_0_types_borrow_io_error return option21.is_some; } -wasi_http_0_2_0_types_own_fields_t wasi_http_0_2_0_types_constructor_fields(void) { - int32_t ret = __wasm_import_wasi_http_0_2_0_types_constructor_fields(); - return (wasi_http_0_2_0_types_own_fields_t) { ret }; +wasi_http_types_own_fields_t wasi_http_types_constructor_fields(void) { + int32_t ret = __wasm_import_wasi_http_types_constructor_fields(); + return (wasi_http_types_own_fields_t) { ret }; } -bool wasi_http_0_2_0_types_static_fields_from_list(wasi_http_0_2_0_types_list_tuple2_field_key_field_value_t *entries, wasi_http_0_2_0_types_own_fields_t *ret, wasi_http_0_2_0_types_header_error_t *err) { +bool wasi_http_types_static_fields_from_list(bindings_list_tuple2_field_key_field_value_t *entries, wasi_http_types_own_fields_t *ret, wasi_http_types_header_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_http_0_2_0_types_static_fields_from_list((int32_t) (*entries).ptr, (int32_t) (*entries).len, ptr); - wasi_http_0_2_0_types_result_own_fields_header_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_http_types_static_fields_from_list((uint8_t *) (*entries).ptr, (*entries).len, ptr); + wasi_http_types_result_own_fields_header_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (wasi_http_0_2_0_types_own_fields_t) { *((int32_t*) (ptr + 4)) }; + result.val.ok = (wasi_http_types_own_fields_t) { *((int32_t*) (ptr + 4)) }; break; } case 1: { result.is_err = true; - wasi_http_0_2_0_types_header_error_t variant; - variant.tag = (int32_t) (*((uint8_t*) (ptr + 4))); + wasi_http_types_header_error_t variant; + variant.tag = (int32_t) *((uint8_t*) (ptr + 4)); switch ((int32_t) variant.tag) { case 0: { break; @@ -5480,7 +5551,7 @@ bool wasi_http_0_2_0_types_static_fields_from_list(wasi_http_0_2_0_types_list_tu break; } } - + result.val.err = variant; break; } @@ -5494,34 +5565,34 @@ bool wasi_http_0_2_0_types_static_fields_from_list(wasi_http_0_2_0_types_list_tu } } -void wasi_http_0_2_0_types_method_fields_get(wasi_http_0_2_0_types_borrow_fields_t self, wasi_http_0_2_0_types_field_key_t *name, wasi_http_0_2_0_types_list_field_value_t *ret) { +void wasi_http_types_method_fields_get(wasi_http_types_borrow_fields_t self, wasi_http_types_field_key_t *name, bindings_list_field_value_t *ret) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_http_0_2_0_types_method_fields_get((self).__handle, (int32_t) (*name).ptr, (int32_t) (*name).len, ptr); - *ret = (wasi_http_0_2_0_types_list_field_value_t) { (wasi_http_0_2_0_types_field_value_t*)(*((int32_t*) (ptr + 0))), (size_t)(*((int32_t*) (ptr + 4))) }; + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_http_types_method_fields_get((self).__handle, (uint8_t *) (*name).ptr, (*name).len, ptr); + *ret = (bindings_list_field_value_t) { (wasi_http_types_field_value_t*)(*((uint8_t **) (ptr + 0))), (*((size_t*) (ptr + 4))) }; } -bool wasi_http_0_2_0_types_method_fields_has(wasi_http_0_2_0_types_borrow_fields_t self, wasi_http_0_2_0_types_field_key_t *name) { - int32_t ret = __wasm_import_wasi_http_0_2_0_types_method_fields_has((self).__handle, (int32_t) (*name).ptr, (int32_t) (*name).len); +bool wasi_http_types_method_fields_has(wasi_http_types_borrow_fields_t self, wasi_http_types_field_key_t *name) { + int32_t ret = __wasm_import_wasi_http_types_method_fields_has((self).__handle, (uint8_t *) (*name).ptr, (*name).len); return ret; } -bool wasi_http_0_2_0_types_method_fields_set(wasi_http_0_2_0_types_borrow_fields_t self, wasi_http_0_2_0_types_field_key_t *name, wasi_http_0_2_0_types_list_field_value_t *value, wasi_http_0_2_0_types_header_error_t *err) { +bool wasi_http_types_method_fields_set(wasi_http_types_borrow_fields_t self, wasi_http_types_field_key_t *name, bindings_list_field_value_t *value, wasi_http_types_header_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_http_0_2_0_types_method_fields_set((self).__handle, (int32_t) (*name).ptr, (int32_t) (*name).len, (int32_t) (*value).ptr, (int32_t) (*value).len, ptr); - wasi_http_0_2_0_types_result_void_header_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_http_types_method_fields_set((self).__handle, (uint8_t *) (*name).ptr, (*name).len, (uint8_t *) (*value).ptr, (*value).len, ptr); + wasi_http_types_result_void_header_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; break; } case 1: { result.is_err = true; - wasi_http_0_2_0_types_header_error_t variant; - variant.tag = (int32_t) (*((uint8_t*) (ptr + 1))); + wasi_http_types_header_error_t variant; + variant.tag = (int32_t) *((uint8_t*) (ptr + 1)); switch ((int32_t) variant.tag) { case 0: { break; @@ -5533,7 +5604,7 @@ bool wasi_http_0_2_0_types_method_fields_set(wasi_http_0_2_0_types_borrow_fields break; } } - + result.val.err = variant; break; } @@ -5546,21 +5617,21 @@ bool wasi_http_0_2_0_types_method_fields_set(wasi_http_0_2_0_types_borrow_fields } } -bool wasi_http_0_2_0_types_method_fields_delete(wasi_http_0_2_0_types_borrow_fields_t self, wasi_http_0_2_0_types_field_key_t *name, wasi_http_0_2_0_types_header_error_t *err) { +bool wasi_http_types_method_fields_delete(wasi_http_types_borrow_fields_t self, wasi_http_types_field_key_t *name, wasi_http_types_header_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_http_0_2_0_types_method_fields_delete((self).__handle, (int32_t) (*name).ptr, (int32_t) (*name).len, ptr); - wasi_http_0_2_0_types_result_void_header_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_http_types_method_fields_delete((self).__handle, (uint8_t *) (*name).ptr, (*name).len, ptr); + wasi_http_types_result_void_header_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; break; } case 1: { result.is_err = true; - wasi_http_0_2_0_types_header_error_t variant; - variant.tag = (int32_t) (*((uint8_t*) (ptr + 1))); + wasi_http_types_header_error_t variant; + variant.tag = (int32_t) *((uint8_t*) (ptr + 1)); switch ((int32_t) variant.tag) { case 0: { break; @@ -5572,7 +5643,7 @@ bool wasi_http_0_2_0_types_method_fields_delete(wasi_http_0_2_0_types_borrow_fie break; } } - + result.val.err = variant; break; } @@ -5585,21 +5656,21 @@ bool wasi_http_0_2_0_types_method_fields_delete(wasi_http_0_2_0_types_borrow_fie } } -bool wasi_http_0_2_0_types_method_fields_append(wasi_http_0_2_0_types_borrow_fields_t self, wasi_http_0_2_0_types_field_key_t *name, wasi_http_0_2_0_types_field_value_t *value, wasi_http_0_2_0_types_header_error_t *err) { +bool wasi_http_types_method_fields_append(wasi_http_types_borrow_fields_t self, wasi_http_types_field_key_t *name, wasi_http_types_field_value_t *value, wasi_http_types_header_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_http_0_2_0_types_method_fields_append((self).__handle, (int32_t) (*name).ptr, (int32_t) (*name).len, (int32_t) (*value).ptr, (int32_t) (*value).len, ptr); - wasi_http_0_2_0_types_result_void_header_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_http_types_method_fields_append((self).__handle, (uint8_t *) (*name).ptr, (*name).len, (uint8_t *) (*value).ptr, (*value).len, ptr); + wasi_http_types_result_void_header_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; break; } case 1: { result.is_err = true; - wasi_http_0_2_0_types_header_error_t variant; - variant.tag = (int32_t) (*((uint8_t*) (ptr + 1))); + wasi_http_types_header_error_t variant; + variant.tag = (int32_t) *((uint8_t*) (ptr + 1)); switch ((int32_t) variant.tag) { case 0: { break; @@ -5611,7 +5682,7 @@ bool wasi_http_0_2_0_types_method_fields_append(wasi_http_0_2_0_types_borrow_fie break; } } - + result.val.err = variant; break; } @@ -5624,26 +5695,26 @@ bool wasi_http_0_2_0_types_method_fields_append(wasi_http_0_2_0_types_borrow_fie } } -void wasi_http_0_2_0_types_method_fields_entries(wasi_http_0_2_0_types_borrow_fields_t self, wasi_http_0_2_0_types_list_tuple2_field_key_field_value_t *ret) { +void wasi_http_types_method_fields_entries(wasi_http_types_borrow_fields_t self, bindings_list_tuple2_field_key_field_value_t *ret) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_http_0_2_0_types_method_fields_entries((self).__handle, ptr); - *ret = (wasi_http_0_2_0_types_list_tuple2_field_key_field_value_t) { (wasi_http_0_2_0_types_tuple2_field_key_field_value_t*)(*((int32_t*) (ptr + 0))), (size_t)(*((int32_t*) (ptr + 4))) }; + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_http_types_method_fields_entries((self).__handle, ptr); + *ret = (bindings_list_tuple2_field_key_field_value_t) { (bindings_tuple2_field_key_field_value_t*)(*((uint8_t **) (ptr + 0))), (*((size_t*) (ptr + 4))) }; } -wasi_http_0_2_0_types_own_fields_t wasi_http_0_2_0_types_method_fields_clone(wasi_http_0_2_0_types_borrow_fields_t self) { - int32_t ret = __wasm_import_wasi_http_0_2_0_types_method_fields_clone((self).__handle); - return (wasi_http_0_2_0_types_own_fields_t) { ret }; +wasi_http_types_own_fields_t wasi_http_types_method_fields_clone(wasi_http_types_borrow_fields_t self) { + int32_t ret = __wasm_import_wasi_http_types_method_fields_clone((self).__handle); + return (wasi_http_types_own_fields_t) { ret }; } -void wasi_http_0_2_0_types_method_incoming_request_method(wasi_http_0_2_0_types_borrow_incoming_request_t self, wasi_http_0_2_0_types_method_t *ret) { +void wasi_http_types_method_incoming_request_method(wasi_http_types_borrow_incoming_request_t self, wasi_http_types_method_t *ret) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_http_0_2_0_types_method_incoming_request_method((self).__handle, ptr); - wasi_http_0_2_0_types_method_t variant; - variant.tag = (int32_t) (*((uint8_t*) (ptr + 0))); + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_http_types_method_incoming_request_method((self).__handle, ptr); + wasi_http_types_method_t variant; + variant.tag = (int32_t) *((uint8_t*) (ptr + 0)); switch ((int32_t) variant.tag) { case 0: { break; @@ -5673,27 +5744,27 @@ void wasi_http_0_2_0_types_method_incoming_request_method(wasi_http_0_2_0_types_ break; } case 9: { - variant.val.other = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + variant.val.other = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 4))), (*((size_t*) (ptr + 8))) }; break; } } *ret = variant; } -bool wasi_http_0_2_0_types_method_incoming_request_path_with_query(wasi_http_0_2_0_types_borrow_incoming_request_t self, bindings_string_t *ret) { +bool wasi_http_types_method_incoming_request_path_with_query(wasi_http_types_borrow_incoming_request_t self, bindings_string_t *ret) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_http_0_2_0_types_method_incoming_request_path_with_query((self).__handle, ptr); - wasi_http_0_2_0_types_option_string_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_http_types_method_incoming_request_path_with_query((self).__handle, ptr); + bindings_option_string_t option; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { option.is_some = false; break; } case 1: { option.is_some = true; - option.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + option.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 4))), (*((size_t*) (ptr + 8))) }; break; } } @@ -5701,21 +5772,21 @@ bool wasi_http_0_2_0_types_method_incoming_request_path_with_query(wasi_http_0_2 return option.is_some; } -bool wasi_http_0_2_0_types_method_incoming_request_scheme(wasi_http_0_2_0_types_borrow_incoming_request_t self, wasi_http_0_2_0_types_scheme_t *ret) { +bool wasi_http_types_method_incoming_request_scheme(wasi_http_types_borrow_incoming_request_t self, wasi_http_types_scheme_t *ret) { __attribute__((__aligned__(4))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_http_0_2_0_types_method_incoming_request_scheme((self).__handle, ptr); - wasi_http_0_2_0_types_option_scheme_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_http_types_method_incoming_request_scheme((self).__handle, ptr); + wasi_http_types_option_scheme_t option; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { option.is_some = false; break; } case 1: { option.is_some = true; - wasi_http_0_2_0_types_scheme_t variant; - variant.tag = (int32_t) (*((uint8_t*) (ptr + 4))); + wasi_http_types_scheme_t variant; + variant.tag = (int32_t) *((uint8_t*) (ptr + 4)); switch ((int32_t) variant.tag) { case 0: { break; @@ -5724,11 +5795,11 @@ bool wasi_http_0_2_0_types_method_incoming_request_scheme(wasi_http_0_2_0_types_ break; } case 2: { - variant.val.other = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 8))), (size_t)(*((int32_t*) (ptr + 12))) }; + variant.val.other = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 8))), (*((size_t*) (ptr + 12))) }; break; } } - + option.val = variant; break; } @@ -5737,20 +5808,20 @@ bool wasi_http_0_2_0_types_method_incoming_request_scheme(wasi_http_0_2_0_types_ return option.is_some; } -bool wasi_http_0_2_0_types_method_incoming_request_authority(wasi_http_0_2_0_types_borrow_incoming_request_t self, bindings_string_t *ret) { +bool wasi_http_types_method_incoming_request_authority(wasi_http_types_borrow_incoming_request_t self, bindings_string_t *ret) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_http_0_2_0_types_method_incoming_request_authority((self).__handle, ptr); - wasi_http_0_2_0_types_option_string_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_http_types_method_incoming_request_authority((self).__handle, ptr); + bindings_option_string_t option; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { option.is_some = false; break; } case 1: { option.is_some = true; - option.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + option.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 4))), (*((size_t*) (ptr + 8))) }; break; } } @@ -5758,21 +5829,21 @@ bool wasi_http_0_2_0_types_method_incoming_request_authority(wasi_http_0_2_0_typ return option.is_some; } -wasi_http_0_2_0_types_own_headers_t wasi_http_0_2_0_types_method_incoming_request_headers(wasi_http_0_2_0_types_borrow_incoming_request_t self) { - int32_t ret = __wasm_import_wasi_http_0_2_0_types_method_incoming_request_headers((self).__handle); - return (wasi_http_0_2_0_types_own_headers_t) { ret }; +wasi_http_types_own_headers_t wasi_http_types_method_incoming_request_headers(wasi_http_types_borrow_incoming_request_t self) { + int32_t ret = __wasm_import_wasi_http_types_method_incoming_request_headers((self).__handle); + return (wasi_http_types_own_headers_t) { ret }; } -bool wasi_http_0_2_0_types_method_incoming_request_consume(wasi_http_0_2_0_types_borrow_incoming_request_t self, wasi_http_0_2_0_types_own_incoming_body_t *ret) { +bool wasi_http_types_method_incoming_request_consume(wasi_http_types_borrow_incoming_request_t self, wasi_http_types_own_incoming_body_t *ret) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_http_0_2_0_types_method_incoming_request_consume((self).__handle, ptr); - wasi_http_0_2_0_types_result_own_incoming_body_void_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_http_types_method_incoming_request_consume((self).__handle, ptr); + wasi_http_types_result_own_incoming_body_void_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (wasi_http_0_2_0_types_own_incoming_body_t) { *((int32_t*) (ptr + 4)) }; + result.val.ok = (wasi_http_types_own_incoming_body_t) { *((int32_t*) (ptr + 4)) }; break; } case 1: { @@ -5788,21 +5859,21 @@ bool wasi_http_0_2_0_types_method_incoming_request_consume(wasi_http_0_2_0_types } } -wasi_http_0_2_0_types_own_outgoing_request_t wasi_http_0_2_0_types_constructor_outgoing_request(wasi_http_0_2_0_types_own_headers_t headers) { - int32_t ret = __wasm_import_wasi_http_0_2_0_types_constructor_outgoing_request((headers).__handle); - return (wasi_http_0_2_0_types_own_outgoing_request_t) { ret }; +wasi_http_types_own_outgoing_request_t wasi_http_types_constructor_outgoing_request(wasi_http_types_own_headers_t headers) { + int32_t ret = __wasm_import_wasi_http_types_constructor_outgoing_request((headers).__handle); + return (wasi_http_types_own_outgoing_request_t) { ret }; } -bool wasi_http_0_2_0_types_method_outgoing_request_body(wasi_http_0_2_0_types_borrow_outgoing_request_t self, wasi_http_0_2_0_types_own_outgoing_body_t *ret) { +bool wasi_http_types_method_outgoing_request_body(wasi_http_types_borrow_outgoing_request_t self, wasi_http_types_own_outgoing_body_t *ret) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_http_0_2_0_types_method_outgoing_request_body((self).__handle, ptr); - wasi_http_0_2_0_types_result_own_outgoing_body_void_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_http_types_method_outgoing_request_body((self).__handle, ptr); + wasi_http_types_result_own_outgoing_body_void_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (wasi_http_0_2_0_types_own_outgoing_body_t) { *((int32_t*) (ptr + 4)) }; + result.val.ok = (wasi_http_types_own_outgoing_body_t) { *((int32_t*) (ptr + 4)) }; break; } case 1: { @@ -5818,13 +5889,13 @@ bool wasi_http_0_2_0_types_method_outgoing_request_body(wasi_http_0_2_0_types_bo } } -void wasi_http_0_2_0_types_method_outgoing_request_method(wasi_http_0_2_0_types_borrow_outgoing_request_t self, wasi_http_0_2_0_types_method_t *ret) { +void wasi_http_types_method_outgoing_request_method(wasi_http_types_borrow_outgoing_request_t self, wasi_http_types_method_t *ret) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_http_0_2_0_types_method_outgoing_request_method((self).__handle, ptr); - wasi_http_0_2_0_types_method_t variant; - variant.tag = (int32_t) (*((uint8_t*) (ptr + 0))); + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_http_types_method_outgoing_request_method((self).__handle, ptr); + wasi_http_types_method_t variant; + variant.tag = (int32_t) *((uint8_t*) (ptr + 0)); switch ((int32_t) variant.tag) { case 0: { break; @@ -5854,17 +5925,17 @@ void wasi_http_0_2_0_types_method_outgoing_request_method(wasi_http_0_2_0_types_ break; } case 9: { - variant.val.other = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + variant.val.other = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 4))), (*((size_t*) (ptr + 8))) }; break; } } *ret = variant; } -bool wasi_http_0_2_0_types_method_outgoing_request_set_method(wasi_http_0_2_0_types_borrow_outgoing_request_t self, wasi_http_0_2_0_types_method_t *method) { +bool wasi_http_types_method_outgoing_request_set_method(wasi_http_types_borrow_outgoing_request_t self, wasi_http_types_method_t *method) { int32_t variant; - int32_t variant9; - int32_t variant10; + uint8_t * variant9; + size_t variant10; switch ((int32_t) (*method).tag) { case 0: { variant = 0; @@ -5923,13 +5994,13 @@ bool wasi_http_0_2_0_types_method_outgoing_request_set_method(wasi_http_0_2_0_ty case 9: { const bindings_string_t *payload8 = &(*method).val.other; variant = 9; - variant9 = (int32_t) (*payload8).ptr; - variant10 = (int32_t) (*payload8).len; + variant9 = (uint8_t *) (*payload8).ptr; + variant10 = (*payload8).len; break; } } - int32_t ret = __wasm_import_wasi_http_0_2_0_types_method_outgoing_request_set_method((self).__handle, variant, variant9, variant10); - wasi_http_0_2_0_types_result_void_void_t result; + int32_t ret = __wasm_import_wasi_http_types_method_outgoing_request_set_method((self).__handle, variant, variant9, variant10); + wasi_http_types_result_void_void_t result; switch (ret) { case 0: { result.is_err = false; @@ -5947,20 +6018,20 @@ bool wasi_http_0_2_0_types_method_outgoing_request_set_method(wasi_http_0_2_0_ty } } -bool wasi_http_0_2_0_types_method_outgoing_request_path_with_query(wasi_http_0_2_0_types_borrow_outgoing_request_t self, bindings_string_t *ret) { +bool wasi_http_types_method_outgoing_request_path_with_query(wasi_http_types_borrow_outgoing_request_t self, bindings_string_t *ret) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_http_0_2_0_types_method_outgoing_request_path_with_query((self).__handle, ptr); - wasi_http_0_2_0_types_option_string_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_http_types_method_outgoing_request_path_with_query((self).__handle, ptr); + bindings_option_string_t option; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { option.is_some = false; break; } case 1: { option.is_some = true; - option.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + option.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 4))), (*((size_t*) (ptr + 8))) }; break; } } @@ -5968,26 +6039,26 @@ bool wasi_http_0_2_0_types_method_outgoing_request_path_with_query(wasi_http_0_2 return option.is_some; } -bool wasi_http_0_2_0_types_method_outgoing_request_set_path_with_query(wasi_http_0_2_0_types_borrow_outgoing_request_t self, bindings_string_t *maybe_path_with_query) { - wasi_http_0_2_0_types_option_string_t path_with_query; +bool wasi_http_types_method_outgoing_request_set_path_with_query(wasi_http_types_borrow_outgoing_request_t self, bindings_string_t *maybe_path_with_query) { + bindings_option_string_t path_with_query; path_with_query.is_some = maybe_path_with_query != NULL;if (maybe_path_with_query) { path_with_query.val = *maybe_path_with_query; } int32_t option; - int32_t option1; - int32_t option2; + uint8_t * option1; + size_t option2; if ((path_with_query).is_some) { const bindings_string_t *payload0 = &(path_with_query).val; option = 1; - option1 = (int32_t) (*payload0).ptr; - option2 = (int32_t) (*payload0).len; + option1 = (uint8_t *) (*payload0).ptr; + option2 = (*payload0).len; } else { option = 0; option1 = 0; option2 = 0; } - int32_t ret = __wasm_import_wasi_http_0_2_0_types_method_outgoing_request_set_path_with_query((self).__handle, option, option1, option2); - wasi_http_0_2_0_types_result_void_void_t result; + int32_t ret = __wasm_import_wasi_http_types_method_outgoing_request_set_path_with_query((self).__handle, option, option1, option2); + wasi_http_types_result_void_void_t result; switch (ret) { case 0: { result.is_err = false; @@ -6005,21 +6076,21 @@ bool wasi_http_0_2_0_types_method_outgoing_request_set_path_with_query(wasi_http } } -bool wasi_http_0_2_0_types_method_outgoing_request_scheme(wasi_http_0_2_0_types_borrow_outgoing_request_t self, wasi_http_0_2_0_types_scheme_t *ret) { +bool wasi_http_types_method_outgoing_request_scheme(wasi_http_types_borrow_outgoing_request_t self, wasi_http_types_scheme_t *ret) { __attribute__((__aligned__(4))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_http_0_2_0_types_method_outgoing_request_scheme((self).__handle, ptr); - wasi_http_0_2_0_types_option_scheme_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_http_types_method_outgoing_request_scheme((self).__handle, ptr); + wasi_http_types_option_scheme_t option; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { option.is_some = false; break; } case 1: { option.is_some = true; - wasi_http_0_2_0_types_scheme_t variant; - variant.tag = (int32_t) (*((uint8_t*) (ptr + 4))); + wasi_http_types_scheme_t variant; + variant.tag = (int32_t) *((uint8_t*) (ptr + 4)); switch ((int32_t) variant.tag) { case 0: { break; @@ -6028,11 +6099,11 @@ bool wasi_http_0_2_0_types_method_outgoing_request_scheme(wasi_http_0_2_0_types_ break; } case 2: { - variant.val.other = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 8))), (size_t)(*((int32_t*) (ptr + 12))) }; + variant.val.other = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 8))), (*((size_t*) (ptr + 12))) }; break; } } - + option.val = variant; break; } @@ -6041,20 +6112,20 @@ bool wasi_http_0_2_0_types_method_outgoing_request_scheme(wasi_http_0_2_0_types_ return option.is_some; } -bool wasi_http_0_2_0_types_method_outgoing_request_set_scheme(wasi_http_0_2_0_types_borrow_outgoing_request_t self, wasi_http_0_2_0_types_scheme_t *maybe_scheme) { - wasi_http_0_2_0_types_option_scheme_t scheme; +bool wasi_http_types_method_outgoing_request_set_scheme(wasi_http_types_borrow_outgoing_request_t self, wasi_http_types_scheme_t *maybe_scheme) { + wasi_http_types_option_scheme_t scheme; scheme.is_some = maybe_scheme != NULL;if (maybe_scheme) { scheme.val = *maybe_scheme; } int32_t option; int32_t option6; - int32_t option7; - int32_t option8; + uint8_t * option7; + size_t option8; if ((scheme).is_some) { - const wasi_http_0_2_0_types_scheme_t *payload0 = &(scheme).val; + const wasi_http_types_scheme_t *payload0 = &(scheme).val; int32_t variant; - int32_t variant4; - int32_t variant5; + uint8_t * variant4; + size_t variant5; switch ((int32_t) (*payload0).tag) { case 0: { variant = 0; @@ -6071,8 +6142,8 @@ bool wasi_http_0_2_0_types_method_outgoing_request_set_scheme(wasi_http_0_2_0_ty case 2: { const bindings_string_t *payload3 = &(*payload0).val.other; variant = 2; - variant4 = (int32_t) (*payload3).ptr; - variant5 = (int32_t) (*payload3).len; + variant4 = (uint8_t *) (*payload3).ptr; + variant5 = (*payload3).len; break; } } @@ -6086,8 +6157,8 @@ bool wasi_http_0_2_0_types_method_outgoing_request_set_scheme(wasi_http_0_2_0_ty option7 = 0; option8 = 0; } - int32_t ret = __wasm_import_wasi_http_0_2_0_types_method_outgoing_request_set_scheme((self).__handle, option, option6, option7, option8); - wasi_http_0_2_0_types_result_void_void_t result; + int32_t ret = __wasm_import_wasi_http_types_method_outgoing_request_set_scheme((self).__handle, option, option6, option7, option8); + wasi_http_types_result_void_void_t result; switch (ret) { case 0: { result.is_err = false; @@ -6105,20 +6176,20 @@ bool wasi_http_0_2_0_types_method_outgoing_request_set_scheme(wasi_http_0_2_0_ty } } -bool wasi_http_0_2_0_types_method_outgoing_request_authority(wasi_http_0_2_0_types_borrow_outgoing_request_t self, bindings_string_t *ret) { +bool wasi_http_types_method_outgoing_request_authority(wasi_http_types_borrow_outgoing_request_t self, bindings_string_t *ret) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_http_0_2_0_types_method_outgoing_request_authority((self).__handle, ptr); - wasi_http_0_2_0_types_option_string_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_http_types_method_outgoing_request_authority((self).__handle, ptr); + bindings_option_string_t option; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { option.is_some = false; break; } case 1: { option.is_some = true; - option.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + option.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 4))), (*((size_t*) (ptr + 8))) }; break; } } @@ -6126,26 +6197,26 @@ bool wasi_http_0_2_0_types_method_outgoing_request_authority(wasi_http_0_2_0_typ return option.is_some; } -bool wasi_http_0_2_0_types_method_outgoing_request_set_authority(wasi_http_0_2_0_types_borrow_outgoing_request_t self, bindings_string_t *maybe_authority) { - wasi_http_0_2_0_types_option_string_t authority; +bool wasi_http_types_method_outgoing_request_set_authority(wasi_http_types_borrow_outgoing_request_t self, bindings_string_t *maybe_authority) { + bindings_option_string_t authority; authority.is_some = maybe_authority != NULL;if (maybe_authority) { authority.val = *maybe_authority; } int32_t option; - int32_t option1; - int32_t option2; + uint8_t * option1; + size_t option2; if ((authority).is_some) { const bindings_string_t *payload0 = &(authority).val; option = 1; - option1 = (int32_t) (*payload0).ptr; - option2 = (int32_t) (*payload0).len; + option1 = (uint8_t *) (*payload0).ptr; + option2 = (*payload0).len; } else { option = 0; option1 = 0; option2 = 0; } - int32_t ret = __wasm_import_wasi_http_0_2_0_types_method_outgoing_request_set_authority((self).__handle, option, option1, option2); - wasi_http_0_2_0_types_result_void_void_t result; + int32_t ret = __wasm_import_wasi_http_types_method_outgoing_request_set_authority((self).__handle, option, option1, option2); + wasi_http_types_result_void_void_t result; switch (ret) { case 0: { result.is_err = false; @@ -6163,23 +6234,23 @@ bool wasi_http_0_2_0_types_method_outgoing_request_set_authority(wasi_http_0_2_0 } } -wasi_http_0_2_0_types_own_headers_t wasi_http_0_2_0_types_method_outgoing_request_headers(wasi_http_0_2_0_types_borrow_outgoing_request_t self) { - int32_t ret = __wasm_import_wasi_http_0_2_0_types_method_outgoing_request_headers((self).__handle); - return (wasi_http_0_2_0_types_own_headers_t) { ret }; +wasi_http_types_own_headers_t wasi_http_types_method_outgoing_request_headers(wasi_http_types_borrow_outgoing_request_t self) { + int32_t ret = __wasm_import_wasi_http_types_method_outgoing_request_headers((self).__handle); + return (wasi_http_types_own_headers_t) { ret }; } -wasi_http_0_2_0_types_own_request_options_t wasi_http_0_2_0_types_constructor_request_options(void) { - int32_t ret = __wasm_import_wasi_http_0_2_0_types_constructor_request_options(); - return (wasi_http_0_2_0_types_own_request_options_t) { ret }; +wasi_http_types_own_request_options_t wasi_http_types_constructor_request_options(void) { + int32_t ret = __wasm_import_wasi_http_types_constructor_request_options(); + return (wasi_http_types_own_request_options_t) { ret }; } -bool wasi_http_0_2_0_types_method_request_options_connect_timeout(wasi_http_0_2_0_types_borrow_request_options_t self, wasi_http_0_2_0_types_duration_t *ret) { +bool wasi_http_types_method_request_options_connect_timeout(wasi_http_types_borrow_request_options_t self, wasi_http_types_duration_t *ret) { __attribute__((__aligned__(8))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_http_0_2_0_types_method_request_options_connect_timeout((self).__handle, ptr); - wasi_http_0_2_0_types_option_duration_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_http_types_method_request_options_connect_timeout((self).__handle, ptr); + bindings_option_duration_t option; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { option.is_some = false; break; @@ -6194,23 +6265,23 @@ bool wasi_http_0_2_0_types_method_request_options_connect_timeout(wasi_http_0_2_ return option.is_some; } -bool wasi_http_0_2_0_types_method_request_options_set_connect_timeout(wasi_http_0_2_0_types_borrow_request_options_t self, wasi_http_0_2_0_types_duration_t *maybe_duration) { - wasi_http_0_2_0_types_option_duration_t duration; +bool wasi_http_types_method_request_options_set_connect_timeout(wasi_http_types_borrow_request_options_t self, wasi_http_types_duration_t *maybe_duration) { + bindings_option_duration_t duration; duration.is_some = maybe_duration != NULL;if (maybe_duration) { duration.val = *maybe_duration; } int32_t option; int64_t option1; if ((duration).is_some) { - const wasi_http_0_2_0_types_duration_t *payload0 = &(duration).val; + const wasi_http_types_duration_t *payload0 = &(duration).val; option = 1; option1 = (int64_t) (*payload0); } else { option = 0; option1 = 0; } - int32_t ret = __wasm_import_wasi_http_0_2_0_types_method_request_options_set_connect_timeout((self).__handle, option, option1); - wasi_http_0_2_0_types_result_void_void_t result; + int32_t ret = __wasm_import_wasi_http_types_method_request_options_set_connect_timeout((self).__handle, option, option1); + wasi_http_types_result_void_void_t result; switch (ret) { case 0: { result.is_err = false; @@ -6228,13 +6299,13 @@ bool wasi_http_0_2_0_types_method_request_options_set_connect_timeout(wasi_http_ } } -bool wasi_http_0_2_0_types_method_request_options_first_byte_timeout(wasi_http_0_2_0_types_borrow_request_options_t self, wasi_http_0_2_0_types_duration_t *ret) { +bool wasi_http_types_method_request_options_first_byte_timeout(wasi_http_types_borrow_request_options_t self, wasi_http_types_duration_t *ret) { __attribute__((__aligned__(8))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_http_0_2_0_types_method_request_options_first_byte_timeout((self).__handle, ptr); - wasi_http_0_2_0_types_option_duration_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_http_types_method_request_options_first_byte_timeout((self).__handle, ptr); + bindings_option_duration_t option; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { option.is_some = false; break; @@ -6249,23 +6320,23 @@ bool wasi_http_0_2_0_types_method_request_options_first_byte_timeout(wasi_http_0 return option.is_some; } -bool wasi_http_0_2_0_types_method_request_options_set_first_byte_timeout(wasi_http_0_2_0_types_borrow_request_options_t self, wasi_http_0_2_0_types_duration_t *maybe_duration) { - wasi_http_0_2_0_types_option_duration_t duration; +bool wasi_http_types_method_request_options_set_first_byte_timeout(wasi_http_types_borrow_request_options_t self, wasi_http_types_duration_t *maybe_duration) { + bindings_option_duration_t duration; duration.is_some = maybe_duration != NULL;if (maybe_duration) { duration.val = *maybe_duration; } int32_t option; int64_t option1; if ((duration).is_some) { - const wasi_http_0_2_0_types_duration_t *payload0 = &(duration).val; + const wasi_http_types_duration_t *payload0 = &(duration).val; option = 1; option1 = (int64_t) (*payload0); } else { option = 0; option1 = 0; } - int32_t ret = __wasm_import_wasi_http_0_2_0_types_method_request_options_set_first_byte_timeout((self).__handle, option, option1); - wasi_http_0_2_0_types_result_void_void_t result; + int32_t ret = __wasm_import_wasi_http_types_method_request_options_set_first_byte_timeout((self).__handle, option, option1); + wasi_http_types_result_void_void_t result; switch (ret) { case 0: { result.is_err = false; @@ -6283,13 +6354,13 @@ bool wasi_http_0_2_0_types_method_request_options_set_first_byte_timeout(wasi_ht } } -bool wasi_http_0_2_0_types_method_request_options_between_bytes_timeout(wasi_http_0_2_0_types_borrow_request_options_t self, wasi_http_0_2_0_types_duration_t *ret) { +bool wasi_http_types_method_request_options_between_bytes_timeout(wasi_http_types_borrow_request_options_t self, wasi_http_types_duration_t *ret) { __attribute__((__aligned__(8))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_http_0_2_0_types_method_request_options_between_bytes_timeout((self).__handle, ptr); - wasi_http_0_2_0_types_option_duration_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_http_types_method_request_options_between_bytes_timeout((self).__handle, ptr); + bindings_option_duration_t option; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { option.is_some = false; break; @@ -6304,23 +6375,23 @@ bool wasi_http_0_2_0_types_method_request_options_between_bytes_timeout(wasi_htt return option.is_some; } -bool wasi_http_0_2_0_types_method_request_options_set_between_bytes_timeout(wasi_http_0_2_0_types_borrow_request_options_t self, wasi_http_0_2_0_types_duration_t *maybe_duration) { - wasi_http_0_2_0_types_option_duration_t duration; +bool wasi_http_types_method_request_options_set_between_bytes_timeout(wasi_http_types_borrow_request_options_t self, wasi_http_types_duration_t *maybe_duration) { + bindings_option_duration_t duration; duration.is_some = maybe_duration != NULL;if (maybe_duration) { duration.val = *maybe_duration; } int32_t option; int64_t option1; if ((duration).is_some) { - const wasi_http_0_2_0_types_duration_t *payload0 = &(duration).val; + const wasi_http_types_duration_t *payload0 = &(duration).val; option = 1; option1 = (int64_t) (*payload0); } else { option = 0; option1 = 0; } - int32_t ret = __wasm_import_wasi_http_0_2_0_types_method_request_options_set_between_bytes_timeout((self).__handle, option, option1); - wasi_http_0_2_0_types_result_void_void_t result; + int32_t ret = __wasm_import_wasi_http_types_method_request_options_set_between_bytes_timeout((self).__handle, option, option1); + wasi_http_types_result_void_void_t result; switch (ret) { case 0: { result.is_err = false; @@ -6338,22 +6409,22 @@ bool wasi_http_0_2_0_types_method_request_options_set_between_bytes_timeout(wasi } } -void wasi_http_0_2_0_types_static_response_outparam_set(wasi_http_0_2_0_types_own_response_outparam_t param, wasi_http_0_2_0_types_result_own_outgoing_response_error_code_t *response) { +void wasi_http_types_static_response_outparam_set(wasi_http_types_own_response_outparam_t param, wasi_http_types_result_own_outgoing_response_error_code_t *response) { int32_t result; int32_t result146; int32_t result147; int64_t result148; - int32_t result149; - int32_t result150; - int32_t result151; + uint8_t * result149; + uint8_t * result150; + size_t result151; int32_t result152; if ((*response).is_err) { - const wasi_http_0_2_0_types_error_code_t *payload0 = &(*response).val.err;int32_t variant; + const wasi_http_types_error_code_t *payload0 = &(*response).val.err;int32_t variant; int32_t variant140; int64_t variant141; - int32_t variant142; - int32_t variant143; - int32_t variant144; + uint8_t * variant142; + uint8_t * variant143; + size_t variant144; int32_t variant145; switch ((int32_t) (*payload0).tag) { case 0: { @@ -6367,15 +6438,15 @@ void wasi_http_0_2_0_types_static_response_outparam_set(wasi_http_0_2_0_types_ow break; } case 1: { - const wasi_http_0_2_0_types_dns_error_payload_t *payload2 = &(*payload0).val.dns_error; + const wasi_http_types_dns_error_payload_t *payload2 = &(*payload0).val.dns_error; int32_t option; - int32_t option5; - int32_t option6; + uint8_t * option5; + size_t option6; if (((*payload2).rcode).is_some) { const bindings_string_t *payload4 = &((*payload2).rcode).val; option = 1; - option5 = (int32_t) (*payload4).ptr; - option6 = (int32_t) (*payload4).len; + option5 = (uint8_t *) (*payload4).ptr; + option6 = (*payload4).len; } else { option = 0; option5 = 0; @@ -6394,8 +6465,8 @@ void wasi_http_0_2_0_types_static_response_outparam_set(wasi_http_0_2_0_types_ow variant = 1; variant140 = option; variant141 = (int64_t) option5; - variant142 = option6; - variant143 = option9; + variant142 = (uint8_t *) option6; + variant143 = (uint8_t *) option9; variant144 = option10; variant145 = 0; break; @@ -6521,7 +6592,7 @@ void wasi_http_0_2_0_types_static_response_outparam_set(wasi_http_0_2_0_types_ow break; } case 14: { - const wasi_http_0_2_0_types_tls_alert_received_payload_t *payload23 = &(*payload0).val.tls_alert_received; + const wasi_http_types_tls_alert_received_payload_t *payload23 = &(*payload0).val.tls_alert_received; int32_t option26; int32_t option27; if (((*payload23).alert_id).is_some) { @@ -6533,13 +6604,13 @@ void wasi_http_0_2_0_types_static_response_outparam_set(wasi_http_0_2_0_types_ow option27 = 0; } int32_t option30; - int32_t option31; - int32_t option32; + uint8_t * option31; + size_t option32; if (((*payload23).alert_message).is_some) { const bindings_string_t *payload29 = &((*payload23).alert_message).val; option30 = 1; - option31 = (int32_t) (*payload29).ptr; - option32 = (int32_t) (*payload29).len; + option31 = (uint8_t *) (*payload29).ptr; + option32 = (*payload29).len; } else { option30 = 0; option31 = 0; @@ -6548,7 +6619,7 @@ void wasi_http_0_2_0_types_static_response_outparam_set(wasi_http_0_2_0_types_ow variant = 14; variant140 = option26; variant141 = (int64_t) option27; - variant142 = option30; + variant142 = (uint8_t *) option30; variant143 = option31; variant144 = option32; variant145 = 0; @@ -6575,7 +6646,7 @@ void wasi_http_0_2_0_types_static_response_outparam_set(wasi_http_0_2_0_types_ow break; } case 17: { - const wasi_http_0_2_0_types_option_u64_t *payload35 = &(*payload0).val.http_request_body_size; + const bindings_option_u64_t *payload35 = &(*payload0).val.http_request_body_size; int32_t option38; int64_t option39; if ((*payload35).is_some) { @@ -6626,7 +6697,7 @@ void wasi_http_0_2_0_types_static_response_outparam_set(wasi_http_0_2_0_types_ow break; } case 21: { - const wasi_http_0_2_0_types_option_u32_t *payload43 = &(*payload0).val.http_request_header_section_size; + const bindings_option_u32_t *payload43 = &(*payload0).val.http_request_header_section_size; int32_t option46; int32_t option47; if ((*payload43).is_some) { @@ -6647,23 +6718,23 @@ void wasi_http_0_2_0_types_static_response_outparam_set(wasi_http_0_2_0_types_ow break; } case 22: { - const wasi_http_0_2_0_types_option_field_size_payload_t *payload48 = &(*payload0).val.http_request_header_size; + const wasi_http_types_option_field_size_payload_t *payload48 = &(*payload0).val.http_request_header_size; int32_t option60; int32_t option61; - int32_t option62; - int32_t option63; + uint8_t * option62; + size_t option63; int32_t option64; int32_t option65; if ((*payload48).is_some) { - const wasi_http_0_2_0_types_field_size_payload_t *payload50 = &(*payload48).val; + const wasi_http_types_field_size_payload_t *payload50 = &(*payload48).val; int32_t option53; - int32_t option54; - int32_t option55; + uint8_t * option54; + size_t option55; if (((*payload50).field_name).is_some) { const bindings_string_t *payload52 = &((*payload50).field_name).val; option53 = 1; - option54 = (int32_t) (*payload52).ptr; - option55 = (int32_t) (*payload52).len; + option54 = (uint8_t *) (*payload52).ptr; + option55 = (*payload52).len; } else { option53 = 0; option54 = 0; @@ -6697,13 +6768,13 @@ void wasi_http_0_2_0_types_static_response_outparam_set(wasi_http_0_2_0_types_ow variant140 = option60; variant141 = (int64_t) option61; variant142 = option62; - variant143 = option63; + variant143 = (uint8_t *) option63; variant144 = option64; variant145 = option65; break; } case 23: { - const wasi_http_0_2_0_types_option_u32_t *payload66 = &(*payload0).val.http_request_trailer_section_size; + const bindings_option_u32_t *payload66 = &(*payload0).val.http_request_trailer_section_size; int32_t option69; int32_t option70; if ((*payload66).is_some) { @@ -6724,15 +6795,15 @@ void wasi_http_0_2_0_types_static_response_outparam_set(wasi_http_0_2_0_types_ow break; } case 24: { - const wasi_http_0_2_0_types_field_size_payload_t *payload71 = &(*payload0).val.http_request_trailer_size; + const wasi_http_types_field_size_payload_t *payload71 = &(*payload0).val.http_request_trailer_size; int32_t option74; - int32_t option75; - int32_t option76; + uint8_t * option75; + size_t option76; if (((*payload71).field_name).is_some) { const bindings_string_t *payload73 = &((*payload71).field_name).val; option74 = 1; - option75 = (int32_t) (*payload73).ptr; - option76 = (int32_t) (*payload73).len; + option75 = (uint8_t *) (*payload73).ptr; + option76 = (*payload73).len; } else { option74 = 0; option75 = 0; @@ -6751,8 +6822,8 @@ void wasi_http_0_2_0_types_static_response_outparam_set(wasi_http_0_2_0_types_ow variant = 24; variant140 = option74; variant141 = (int64_t) option75; - variant142 = option76; - variant143 = option79; + variant142 = (uint8_t *) option76; + variant143 = (uint8_t *) option79; variant144 = option80; variant145 = 0; break; @@ -6768,7 +6839,7 @@ void wasi_http_0_2_0_types_static_response_outparam_set(wasi_http_0_2_0_types_ow break; } case 26: { - const wasi_http_0_2_0_types_option_u32_t *payload82 = &(*payload0).val.http_response_header_section_size; + const bindings_option_u32_t *payload82 = &(*payload0).val.http_response_header_section_size; int32_t option85; int32_t option86; if ((*payload82).is_some) { @@ -6789,15 +6860,15 @@ void wasi_http_0_2_0_types_static_response_outparam_set(wasi_http_0_2_0_types_ow break; } case 27: { - const wasi_http_0_2_0_types_field_size_payload_t *payload87 = &(*payload0).val.http_response_header_size; + const wasi_http_types_field_size_payload_t *payload87 = &(*payload0).val.http_response_header_size; int32_t option90; - int32_t option91; - int32_t option92; + uint8_t * option91; + size_t option92; if (((*payload87).field_name).is_some) { const bindings_string_t *payload89 = &((*payload87).field_name).val; option90 = 1; - option91 = (int32_t) (*payload89).ptr; - option92 = (int32_t) (*payload89).len; + option91 = (uint8_t *) (*payload89).ptr; + option92 = (*payload89).len; } else { option90 = 0; option91 = 0; @@ -6816,14 +6887,14 @@ void wasi_http_0_2_0_types_static_response_outparam_set(wasi_http_0_2_0_types_ow variant = 27; variant140 = option90; variant141 = (int64_t) option91; - variant142 = option92; - variant143 = option95; + variant142 = (uint8_t *) option92; + variant143 = (uint8_t *) option95; variant144 = option96; variant145 = 0; break; } case 28: { - const wasi_http_0_2_0_types_option_u64_t *payload97 = &(*payload0).val.http_response_body_size; + const bindings_option_u64_t *payload97 = &(*payload0).val.http_response_body_size; int32_t option100; int64_t option101; if ((*payload97).is_some) { @@ -6844,7 +6915,7 @@ void wasi_http_0_2_0_types_static_response_outparam_set(wasi_http_0_2_0_types_ow break; } case 29: { - const wasi_http_0_2_0_types_option_u32_t *payload102 = &(*payload0).val.http_response_trailer_section_size; + const bindings_option_u32_t *payload102 = &(*payload0).val.http_response_trailer_section_size; int32_t option105; int32_t option106; if ((*payload102).is_some) { @@ -6865,15 +6936,15 @@ void wasi_http_0_2_0_types_static_response_outparam_set(wasi_http_0_2_0_types_ow break; } case 30: { - const wasi_http_0_2_0_types_field_size_payload_t *payload107 = &(*payload0).val.http_response_trailer_size; + const wasi_http_types_field_size_payload_t *payload107 = &(*payload0).val.http_response_trailer_size; int32_t option110; - int32_t option111; - int32_t option112; + uint8_t * option111; + size_t option112; if (((*payload107).field_name).is_some) { const bindings_string_t *payload109 = &((*payload107).field_name).val; option110 = 1; - option111 = (int32_t) (*payload109).ptr; - option112 = (int32_t) (*payload109).len; + option111 = (uint8_t *) (*payload109).ptr; + option112 = (*payload109).len; } else { option110 = 0; option111 = 0; @@ -6892,22 +6963,22 @@ void wasi_http_0_2_0_types_static_response_outparam_set(wasi_http_0_2_0_types_ow variant = 30; variant140 = option110; variant141 = (int64_t) option111; - variant142 = option112; - variant143 = option115; + variant142 = (uint8_t *) option112; + variant143 = (uint8_t *) option115; variant144 = option116; variant145 = 0; break; } case 31: { - const wasi_http_0_2_0_types_option_string_t *payload117 = &(*payload0).val.http_response_transfer_coding; + const bindings_option_string_t *payload117 = &(*payload0).val.http_response_transfer_coding; int32_t option120; - int32_t option121; - int32_t option122; + uint8_t * option121; + size_t option122; if ((*payload117).is_some) { const bindings_string_t *payload119 = &(*payload117).val; option120 = 1; - option121 = (int32_t) (*payload119).ptr; - option122 = (int32_t) (*payload119).len; + option121 = (uint8_t *) (*payload119).ptr; + option122 = (*payload119).len; } else { option120 = 0; option121 = 0; @@ -6916,22 +6987,22 @@ void wasi_http_0_2_0_types_static_response_outparam_set(wasi_http_0_2_0_types_ow variant = 31; variant140 = option120; variant141 = (int64_t) option121; - variant142 = option122; + variant142 = (uint8_t *) option122; variant143 = 0; variant144 = 0; variant145 = 0; break; } case 32: { - const wasi_http_0_2_0_types_option_string_t *payload123 = &(*payload0).val.http_response_content_coding; + const bindings_option_string_t *payload123 = &(*payload0).val.http_response_content_coding; int32_t option126; - int32_t option127; - int32_t option128; + uint8_t * option127; + size_t option128; if ((*payload123).is_some) { const bindings_string_t *payload125 = &(*payload123).val; option126 = 1; - option127 = (int32_t) (*payload125).ptr; - option128 = (int32_t) (*payload125).len; + option127 = (uint8_t *) (*payload125).ptr; + option128 = (*payload125).len; } else { option126 = 0; option127 = 0; @@ -6940,7 +7011,7 @@ void wasi_http_0_2_0_types_static_response_outparam_set(wasi_http_0_2_0_types_ow variant = 32; variant140 = option126; variant141 = (int64_t) option127; - variant142 = option128; + variant142 = (uint8_t *) option128; variant143 = 0; variant144 = 0; variant145 = 0; @@ -6997,15 +7068,15 @@ void wasi_http_0_2_0_types_static_response_outparam_set(wasi_http_0_2_0_types_ow break; } case 38: { - const wasi_http_0_2_0_types_option_string_t *payload134 = &(*payload0).val.internal_error; + const bindings_option_string_t *payload134 = &(*payload0).val.internal_error; int32_t option137; - int32_t option138; - int32_t option139; + uint8_t * option138; + size_t option139; if ((*payload134).is_some) { const bindings_string_t *payload136 = &(*payload134).val; option137 = 1; - option138 = (int32_t) (*payload136).ptr; - option139 = (int32_t) (*payload136).len; + option138 = (uint8_t *) (*payload136).ptr; + option139 = (*payload136).len; } else { option137 = 0; option138 = 0; @@ -7014,7 +7085,7 @@ void wasi_http_0_2_0_types_static_response_outparam_set(wasi_http_0_2_0_types_ow variant = 38; variant140 = option137; variant141 = (int64_t) option138; - variant142 = option139; + variant142 = (uint8_t *) option139; variant143 = 0; variant144 = 0; variant145 = 0; @@ -7030,7 +7101,7 @@ void wasi_http_0_2_0_types_static_response_outparam_set(wasi_http_0_2_0_types_ow result151 = variant144; result152 = variant145; } else { - const wasi_http_0_2_0_types_own_outgoing_response_t *payload = &(*response).val.ok;result = 0; + const wasi_http_types_own_outgoing_response_t *payload = &(*response).val.ok;result = 0; result146 = (*payload).__handle; result147 = 0; result148 = 0; @@ -7039,29 +7110,29 @@ void wasi_http_0_2_0_types_static_response_outparam_set(wasi_http_0_2_0_types_ow result151 = 0; result152 = 0; } - __wasm_import_wasi_http_0_2_0_types_static_response_outparam_set((param).__handle, result, result146, result147, result148, result149, result150, result151, result152); + __wasm_import_wasi_http_types_static_response_outparam_set((param).__handle, result, result146, result147, result148, result149, result150, result151, result152); } -wasi_http_0_2_0_types_status_code_t wasi_http_0_2_0_types_method_incoming_response_status(wasi_http_0_2_0_types_borrow_incoming_response_t self) { - int32_t ret = __wasm_import_wasi_http_0_2_0_types_method_incoming_response_status((self).__handle); +wasi_http_types_status_code_t wasi_http_types_method_incoming_response_status(wasi_http_types_borrow_incoming_response_t self) { + int32_t ret = __wasm_import_wasi_http_types_method_incoming_response_status((self).__handle); return (uint16_t) (ret); } -wasi_http_0_2_0_types_own_headers_t wasi_http_0_2_0_types_method_incoming_response_headers(wasi_http_0_2_0_types_borrow_incoming_response_t self) { - int32_t ret = __wasm_import_wasi_http_0_2_0_types_method_incoming_response_headers((self).__handle); - return (wasi_http_0_2_0_types_own_headers_t) { ret }; +wasi_http_types_own_headers_t wasi_http_types_method_incoming_response_headers(wasi_http_types_borrow_incoming_response_t self) { + int32_t ret = __wasm_import_wasi_http_types_method_incoming_response_headers((self).__handle); + return (wasi_http_types_own_headers_t) { ret }; } -bool wasi_http_0_2_0_types_method_incoming_response_consume(wasi_http_0_2_0_types_borrow_incoming_response_t self, wasi_http_0_2_0_types_own_incoming_body_t *ret) { +bool wasi_http_types_method_incoming_response_consume(wasi_http_types_borrow_incoming_response_t self, wasi_http_types_own_incoming_body_t *ret) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_http_0_2_0_types_method_incoming_response_consume((self).__handle, ptr); - wasi_http_0_2_0_types_result_own_incoming_body_void_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_http_types_method_incoming_response_consume((self).__handle, ptr); + wasi_http_types_result_own_incoming_body_void_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (wasi_http_0_2_0_types_own_incoming_body_t) { *((int32_t*) (ptr + 4)) }; + result.val.ok = (wasi_http_types_own_incoming_body_t) { *((int32_t*) (ptr + 4)) }; break; } case 1: { @@ -7077,16 +7148,16 @@ bool wasi_http_0_2_0_types_method_incoming_response_consume(wasi_http_0_2_0_type } } -bool wasi_http_0_2_0_types_method_incoming_body_stream(wasi_http_0_2_0_types_borrow_incoming_body_t self, wasi_http_0_2_0_types_own_input_stream_t *ret) { +bool wasi_http_types_method_incoming_body_stream(wasi_http_types_borrow_incoming_body_t self, wasi_http_types_own_input_stream_t *ret) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_http_0_2_0_types_method_incoming_body_stream((self).__handle, ptr); - wasi_http_0_2_0_types_result_own_input_stream_void_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_http_types_method_incoming_body_stream((self).__handle, ptr); + wasi_http_types_result_own_input_stream_void_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (wasi_http_0_2_0_types_own_input_stream_t) { *((int32_t*) (ptr + 4)) }; + result.val.ok = (wasi_http_types_own_input_stream_t) { *((int32_t*) (ptr + 4)) }; break; } case 1: { @@ -7102,89 +7173,89 @@ bool wasi_http_0_2_0_types_method_incoming_body_stream(wasi_http_0_2_0_types_bor } } -wasi_http_0_2_0_types_own_future_trailers_t wasi_http_0_2_0_types_static_incoming_body_finish(wasi_http_0_2_0_types_own_incoming_body_t this_) { - int32_t ret = __wasm_import_wasi_http_0_2_0_types_static_incoming_body_finish((this_).__handle); - return (wasi_http_0_2_0_types_own_future_trailers_t) { ret }; +wasi_http_types_own_future_trailers_t wasi_http_types_static_incoming_body_finish(wasi_http_types_own_incoming_body_t this_) { + int32_t ret = __wasm_import_wasi_http_types_static_incoming_body_finish((this_).__handle); + return (wasi_http_types_own_future_trailers_t) { ret }; } -wasi_http_0_2_0_types_own_pollable_t wasi_http_0_2_0_types_method_future_trailers_subscribe(wasi_http_0_2_0_types_borrow_future_trailers_t self) { - int32_t ret = __wasm_import_wasi_http_0_2_0_types_method_future_trailers_subscribe((self).__handle); - return (wasi_http_0_2_0_types_own_pollable_t) { ret }; +wasi_http_types_own_pollable_t wasi_http_types_method_future_trailers_subscribe(wasi_http_types_borrow_future_trailers_t self) { + int32_t ret = __wasm_import_wasi_http_types_method_future_trailers_subscribe((self).__handle); + return (wasi_http_types_own_pollable_t) { ret }; } -bool wasi_http_0_2_0_types_method_future_trailers_get(wasi_http_0_2_0_types_borrow_future_trailers_t self, wasi_http_0_2_0_types_result_result_option_own_trailers_error_code_void_t *ret) { +bool wasi_http_types_method_future_trailers_get(wasi_http_types_borrow_future_trailers_t self, wasi_http_types_result_result_option_own_trailers_error_code_void_t *ret) { __attribute__((__aligned__(8))) uint8_t ret_area[56]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_http_0_2_0_types_method_future_trailers_get((self).__handle, ptr); - wasi_http_0_2_0_types_option_result_result_option_own_trailers_error_code_void_t option23; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_http_types_method_future_trailers_get((self).__handle, ptr); + wasi_http_types_option_result_result_option_own_trailers_error_code_void_t option23; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { option23.is_some = false; break; } case 1: { option23.is_some = true; - wasi_http_0_2_0_types_result_result_option_own_trailers_error_code_void_t result22; - switch ((int32_t) (*((uint8_t*) (ptr + 8)))) { + wasi_http_types_result_result_option_own_trailers_error_code_void_t result22; + switch ((int32_t) *((uint8_t*) (ptr + 8))) { case 0: { result22.is_err = false; - wasi_http_0_2_0_types_result_option_own_trailers_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 16)))) { + wasi_http_types_result_option_own_trailers_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 16))) { case 0: { result.is_err = false; - wasi_http_0_2_0_types_option_own_trailers_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 24)))) { + wasi_http_types_option_own_trailers_t option; + switch ((int32_t) *((uint8_t*) (ptr + 24))) { case 0: { option.is_some = false; break; } case 1: { option.is_some = true; - option.val = (wasi_http_0_2_0_types_own_trailers_t) { *((int32_t*) (ptr + 28)) }; + option.val = (wasi_http_types_own_trailers_t) { *((int32_t*) (ptr + 28)) }; break; } } - + result.val.ok = option; break; } case 1: { result.is_err = true; - wasi_http_0_2_0_types_error_code_t variant; - variant.tag = (int32_t) (*((uint8_t*) (ptr + 24))); + wasi_http_types_error_code_t variant; + variant.tag = (int32_t) *((uint8_t*) (ptr + 24)); switch ((int32_t) variant.tag) { case 0: { break; } case 1: { - wasi_http_0_2_0_types_option_string_t option0; - switch ((int32_t) (*((uint8_t*) (ptr + 32)))) { + bindings_option_string_t option0; + switch ((int32_t) *((uint8_t*) (ptr + 32))) { case 0: { option0.is_some = false; break; } case 1: { option0.is_some = true; - option0.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 36))), (size_t)(*((int32_t*) (ptr + 40))) }; + option0.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 36))), (*((size_t*) (ptr + 40))) }; break; } } - wasi_http_0_2_0_types_option_u16_t option1; - switch ((int32_t) (*((uint8_t*) (ptr + 44)))) { + bindings_option_u16_t option1; + switch ((int32_t) *((uint8_t*) (ptr + 44))) { case 0: { option1.is_some = false; break; } case 1: { option1.is_some = true; - option1.val = (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 46)))); + option1.val = (uint16_t) ((int32_t) *((uint16_t*) (ptr + 46))); break; } } - variant.val.dns_error = (wasi_http_0_2_0_types_dns_error_payload_t) { - option0, - option1, + variant.val.dns_error = (wasi_http_types_dns_error_payload_t) { + (bindings_option_string_t) option0, + (bindings_option_u16_t) option1, }; break; } @@ -7225,33 +7296,33 @@ bool wasi_http_0_2_0_types_method_future_trailers_get(wasi_http_0_2_0_types_borr break; } case 14: { - wasi_http_0_2_0_types_option_u8_t option2; - switch ((int32_t) (*((uint8_t*) (ptr + 32)))) { + bindings_option_u8_t option2; + switch ((int32_t) *((uint8_t*) (ptr + 32))) { case 0: { option2.is_some = false; break; } case 1: { option2.is_some = true; - option2.val = (uint8_t) ((int32_t) (*((uint8_t*) (ptr + 33)))); + option2.val = (uint8_t) ((int32_t) *((uint8_t*) (ptr + 33))); break; } } - wasi_http_0_2_0_types_option_string_t option3; - switch ((int32_t) (*((uint8_t*) (ptr + 36)))) { + bindings_option_string_t option3; + switch ((int32_t) *((uint8_t*) (ptr + 36))) { case 0: { option3.is_some = false; break; } case 1: { option3.is_some = true; - option3.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 40))), (size_t)(*((int32_t*) (ptr + 44))) }; + option3.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 40))), (*((size_t*) (ptr + 44))) }; break; } } - variant.val.tls_alert_received = (wasi_http_0_2_0_types_tls_alert_received_payload_t) { - option2, - option3, + variant.val.tls_alert_received = (wasi_http_types_tls_alert_received_payload_t) { + (bindings_option_u8_t) option2, + (bindings_option_string_t) option3, }; break; } @@ -7262,8 +7333,8 @@ bool wasi_http_0_2_0_types_method_future_trailers_get(wasi_http_0_2_0_types_borr break; } case 17: { - wasi_http_0_2_0_types_option_u64_t option4; - switch ((int32_t) (*((uint8_t*) (ptr + 32)))) { + bindings_option_u64_t option4; + switch ((int32_t) *((uint8_t*) (ptr + 32))) { case 0: { option4.is_some = false; break; @@ -7287,8 +7358,8 @@ bool wasi_http_0_2_0_types_method_future_trailers_get(wasi_http_0_2_0_types_borr break; } case 21: { - wasi_http_0_2_0_types_option_u32_t option5; - switch ((int32_t) (*((uint8_t*) (ptr + 32)))) { + bindings_option_u32_t option5; + switch ((int32_t) *((uint8_t*) (ptr + 32))) { case 0: { option5.is_some = false; break; @@ -7303,28 +7374,28 @@ bool wasi_http_0_2_0_types_method_future_trailers_get(wasi_http_0_2_0_types_borr break; } case 22: { - wasi_http_0_2_0_types_option_field_size_payload_t option8; - switch ((int32_t) (*((uint8_t*) (ptr + 32)))) { + wasi_http_types_option_field_size_payload_t option8; + switch ((int32_t) *((uint8_t*) (ptr + 32))) { case 0: { option8.is_some = false; break; } case 1: { option8.is_some = true; - wasi_http_0_2_0_types_option_string_t option6; - switch ((int32_t) (*((uint8_t*) (ptr + 36)))) { + bindings_option_string_t option6; + switch ((int32_t) *((uint8_t*) (ptr + 36))) { case 0: { option6.is_some = false; break; } case 1: { option6.is_some = true; - option6.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 40))), (size_t)(*((int32_t*) (ptr + 44))) }; + option6.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 40))), (*((size_t*) (ptr + 44))) }; break; } } - wasi_http_0_2_0_types_option_u32_t option7; - switch ((int32_t) (*((uint8_t*) (ptr + 48)))) { + bindings_option_u32_t option7; + switch ((int32_t) *((uint8_t*) (ptr + 48))) { case 0: { option7.is_some = false; break; @@ -7335,10 +7406,10 @@ bool wasi_http_0_2_0_types_method_future_trailers_get(wasi_http_0_2_0_types_borr break; } } - - option8.val = (wasi_http_0_2_0_types_field_size_payload_t) { - option6, - option7, + + option8.val = (wasi_http_types_field_size_payload_t) { + (bindings_option_string_t) option6, + (bindings_option_u32_t) option7, }; break; } @@ -7347,8 +7418,8 @@ bool wasi_http_0_2_0_types_method_future_trailers_get(wasi_http_0_2_0_types_borr break; } case 23: { - wasi_http_0_2_0_types_option_u32_t option9; - switch ((int32_t) (*((uint8_t*) (ptr + 32)))) { + bindings_option_u32_t option9; + switch ((int32_t) *((uint8_t*) (ptr + 32))) { case 0: { option9.is_some = false; break; @@ -7363,20 +7434,20 @@ bool wasi_http_0_2_0_types_method_future_trailers_get(wasi_http_0_2_0_types_borr break; } case 24: { - wasi_http_0_2_0_types_option_string_t option10; - switch ((int32_t) (*((uint8_t*) (ptr + 32)))) { + bindings_option_string_t option10; + switch ((int32_t) *((uint8_t*) (ptr + 32))) { case 0: { option10.is_some = false; break; } case 1: { option10.is_some = true; - option10.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 36))), (size_t)(*((int32_t*) (ptr + 40))) }; + option10.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 36))), (*((size_t*) (ptr + 40))) }; break; } } - wasi_http_0_2_0_types_option_u32_t option11; - switch ((int32_t) (*((uint8_t*) (ptr + 44)))) { + bindings_option_u32_t option11; + switch ((int32_t) *((uint8_t*) (ptr + 44))) { case 0: { option11.is_some = false; break; @@ -7387,9 +7458,9 @@ bool wasi_http_0_2_0_types_method_future_trailers_get(wasi_http_0_2_0_types_borr break; } } - variant.val.http_request_trailer_size = (wasi_http_0_2_0_types_field_size_payload_t) { - option10, - option11, + variant.val.http_request_trailer_size = (wasi_http_types_field_size_payload_t) { + (bindings_option_string_t) option10, + (bindings_option_u32_t) option11, }; break; } @@ -7397,8 +7468,8 @@ bool wasi_http_0_2_0_types_method_future_trailers_get(wasi_http_0_2_0_types_borr break; } case 26: { - wasi_http_0_2_0_types_option_u32_t option12; - switch ((int32_t) (*((uint8_t*) (ptr + 32)))) { + bindings_option_u32_t option12; + switch ((int32_t) *((uint8_t*) (ptr + 32))) { case 0: { option12.is_some = false; break; @@ -7413,20 +7484,20 @@ bool wasi_http_0_2_0_types_method_future_trailers_get(wasi_http_0_2_0_types_borr break; } case 27: { - wasi_http_0_2_0_types_option_string_t option13; - switch ((int32_t) (*((uint8_t*) (ptr + 32)))) { + bindings_option_string_t option13; + switch ((int32_t) *((uint8_t*) (ptr + 32))) { case 0: { option13.is_some = false; break; } case 1: { option13.is_some = true; - option13.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 36))), (size_t)(*((int32_t*) (ptr + 40))) }; + option13.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 36))), (*((size_t*) (ptr + 40))) }; break; } } - wasi_http_0_2_0_types_option_u32_t option14; - switch ((int32_t) (*((uint8_t*) (ptr + 44)))) { + bindings_option_u32_t option14; + switch ((int32_t) *((uint8_t*) (ptr + 44))) { case 0: { option14.is_some = false; break; @@ -7437,15 +7508,15 @@ bool wasi_http_0_2_0_types_method_future_trailers_get(wasi_http_0_2_0_types_borr break; } } - variant.val.http_response_header_size = (wasi_http_0_2_0_types_field_size_payload_t) { - option13, - option14, + variant.val.http_response_header_size = (wasi_http_types_field_size_payload_t) { + (bindings_option_string_t) option13, + (bindings_option_u32_t) option14, }; break; } case 28: { - wasi_http_0_2_0_types_option_u64_t option15; - switch ((int32_t) (*((uint8_t*) (ptr + 32)))) { + bindings_option_u64_t option15; + switch ((int32_t) *((uint8_t*) (ptr + 32))) { case 0: { option15.is_some = false; break; @@ -7460,8 +7531,8 @@ bool wasi_http_0_2_0_types_method_future_trailers_get(wasi_http_0_2_0_types_borr break; } case 29: { - wasi_http_0_2_0_types_option_u32_t option16; - switch ((int32_t) (*((uint8_t*) (ptr + 32)))) { + bindings_option_u32_t option16; + switch ((int32_t) *((uint8_t*) (ptr + 32))) { case 0: { option16.is_some = false; break; @@ -7476,20 +7547,20 @@ bool wasi_http_0_2_0_types_method_future_trailers_get(wasi_http_0_2_0_types_borr break; } case 30: { - wasi_http_0_2_0_types_option_string_t option17; - switch ((int32_t) (*((uint8_t*) (ptr + 32)))) { + bindings_option_string_t option17; + switch ((int32_t) *((uint8_t*) (ptr + 32))) { case 0: { option17.is_some = false; break; } case 1: { option17.is_some = true; - option17.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 36))), (size_t)(*((int32_t*) (ptr + 40))) }; + option17.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 36))), (*((size_t*) (ptr + 40))) }; break; } } - wasi_http_0_2_0_types_option_u32_t option18; - switch ((int32_t) (*((uint8_t*) (ptr + 44)))) { + bindings_option_u32_t option18; + switch ((int32_t) *((uint8_t*) (ptr + 44))) { case 0: { option18.is_some = false; break; @@ -7500,22 +7571,22 @@ bool wasi_http_0_2_0_types_method_future_trailers_get(wasi_http_0_2_0_types_borr break; } } - variant.val.http_response_trailer_size = (wasi_http_0_2_0_types_field_size_payload_t) { - option17, - option18, + variant.val.http_response_trailer_size = (wasi_http_types_field_size_payload_t) { + (bindings_option_string_t) option17, + (bindings_option_u32_t) option18, }; break; } case 31: { - wasi_http_0_2_0_types_option_string_t option19; - switch ((int32_t) (*((uint8_t*) (ptr + 32)))) { + bindings_option_string_t option19; + switch ((int32_t) *((uint8_t*) (ptr + 32))) { case 0: { option19.is_some = false; break; } case 1: { option19.is_some = true; - option19.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 36))), (size_t)(*((int32_t*) (ptr + 40))) }; + option19.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 36))), (*((size_t*) (ptr + 40))) }; break; } } @@ -7523,15 +7594,15 @@ bool wasi_http_0_2_0_types_method_future_trailers_get(wasi_http_0_2_0_types_borr break; } case 32: { - wasi_http_0_2_0_types_option_string_t option20; - switch ((int32_t) (*((uint8_t*) (ptr + 32)))) { + bindings_option_string_t option20; + switch ((int32_t) *((uint8_t*) (ptr + 32))) { case 0: { option20.is_some = false; break; } case 1: { option20.is_some = true; - option20.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 36))), (size_t)(*((int32_t*) (ptr + 40))) }; + option20.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 36))), (*((size_t*) (ptr + 40))) }; break; } } @@ -7554,15 +7625,15 @@ bool wasi_http_0_2_0_types_method_future_trailers_get(wasi_http_0_2_0_types_borr break; } case 38: { - wasi_http_0_2_0_types_option_string_t option21; - switch ((int32_t) (*((uint8_t*) (ptr + 32)))) { + bindings_option_string_t option21; + switch ((int32_t) *((uint8_t*) (ptr + 32))) { case 0: { option21.is_some = false; break; } case 1: { option21.is_some = true; - option21.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 36))), (size_t)(*((int32_t*) (ptr + 40))) }; + option21.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 36))), (*((size_t*) (ptr + 40))) }; break; } } @@ -7570,12 +7641,12 @@ bool wasi_http_0_2_0_types_method_future_trailers_get(wasi_http_0_2_0_types_borr break; } } - + result.val.err = variant; break; } } - + result22.val.ok = result; break; } @@ -7584,7 +7655,7 @@ bool wasi_http_0_2_0_types_method_future_trailers_get(wasi_http_0_2_0_types_borr break; } } - + option23.val = result22; break; } @@ -7593,19 +7664,19 @@ bool wasi_http_0_2_0_types_method_future_trailers_get(wasi_http_0_2_0_types_borr return option23.is_some; } -wasi_http_0_2_0_types_own_outgoing_response_t wasi_http_0_2_0_types_constructor_outgoing_response(wasi_http_0_2_0_types_own_headers_t headers) { - int32_t ret = __wasm_import_wasi_http_0_2_0_types_constructor_outgoing_response((headers).__handle); - return (wasi_http_0_2_0_types_own_outgoing_response_t) { ret }; +wasi_http_types_own_outgoing_response_t wasi_http_types_constructor_outgoing_response(wasi_http_types_own_headers_t headers) { + int32_t ret = __wasm_import_wasi_http_types_constructor_outgoing_response((headers).__handle); + return (wasi_http_types_own_outgoing_response_t) { ret }; } -wasi_http_0_2_0_types_status_code_t wasi_http_0_2_0_types_method_outgoing_response_status_code(wasi_http_0_2_0_types_borrow_outgoing_response_t self) { - int32_t ret = __wasm_import_wasi_http_0_2_0_types_method_outgoing_response_status_code((self).__handle); +wasi_http_types_status_code_t wasi_http_types_method_outgoing_response_status_code(wasi_http_types_borrow_outgoing_response_t self) { + int32_t ret = __wasm_import_wasi_http_types_method_outgoing_response_status_code((self).__handle); return (uint16_t) (ret); } -bool wasi_http_0_2_0_types_method_outgoing_response_set_status_code(wasi_http_0_2_0_types_borrow_outgoing_response_t self, wasi_http_0_2_0_types_status_code_t status_code) { - int32_t ret = __wasm_import_wasi_http_0_2_0_types_method_outgoing_response_set_status_code((self).__handle, (int32_t) (status_code)); - wasi_http_0_2_0_types_result_void_void_t result; +bool wasi_http_types_method_outgoing_response_set_status_code(wasi_http_types_borrow_outgoing_response_t self, wasi_http_types_status_code_t status_code) { + int32_t ret = __wasm_import_wasi_http_types_method_outgoing_response_set_status_code((self).__handle, (int32_t) (status_code)); + wasi_http_types_result_void_void_t result; switch (ret) { case 0: { result.is_err = false; @@ -7623,21 +7694,21 @@ bool wasi_http_0_2_0_types_method_outgoing_response_set_status_code(wasi_http_0_ } } -wasi_http_0_2_0_types_own_headers_t wasi_http_0_2_0_types_method_outgoing_response_headers(wasi_http_0_2_0_types_borrow_outgoing_response_t self) { - int32_t ret = __wasm_import_wasi_http_0_2_0_types_method_outgoing_response_headers((self).__handle); - return (wasi_http_0_2_0_types_own_headers_t) { ret }; +wasi_http_types_own_headers_t wasi_http_types_method_outgoing_response_headers(wasi_http_types_borrow_outgoing_response_t self) { + int32_t ret = __wasm_import_wasi_http_types_method_outgoing_response_headers((self).__handle); + return (wasi_http_types_own_headers_t) { ret }; } -bool wasi_http_0_2_0_types_method_outgoing_response_body(wasi_http_0_2_0_types_borrow_outgoing_response_t self, wasi_http_0_2_0_types_own_outgoing_body_t *ret) { +bool wasi_http_types_method_outgoing_response_body(wasi_http_types_borrow_outgoing_response_t self, wasi_http_types_own_outgoing_body_t *ret) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_http_0_2_0_types_method_outgoing_response_body((self).__handle, ptr); - wasi_http_0_2_0_types_result_own_outgoing_body_void_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_http_types_method_outgoing_response_body((self).__handle, ptr); + wasi_http_types_result_own_outgoing_body_void_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (wasi_http_0_2_0_types_own_outgoing_body_t) { *((int32_t*) (ptr + 4)) }; + result.val.ok = (wasi_http_types_own_outgoing_body_t) { *((int32_t*) (ptr + 4)) }; break; } case 1: { @@ -7653,16 +7724,16 @@ bool wasi_http_0_2_0_types_method_outgoing_response_body(wasi_http_0_2_0_types_b } } -bool wasi_http_0_2_0_types_method_outgoing_body_write(wasi_http_0_2_0_types_borrow_outgoing_body_t self, wasi_http_0_2_0_types_own_output_stream_t *ret) { +bool wasi_http_types_method_outgoing_body_write(wasi_http_types_borrow_outgoing_body_t self, wasi_http_types_own_output_stream_t *ret) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_http_0_2_0_types_method_outgoing_body_write((self).__handle, ptr); - wasi_http_0_2_0_types_result_own_output_stream_void_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_http_types_method_outgoing_body_write((self).__handle, ptr); + wasi_http_types_result_own_output_stream_void_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (wasi_http_0_2_0_types_own_output_stream_t) { *((int32_t*) (ptr + 4)) }; + result.val.ok = (wasi_http_types_own_output_stream_t) { *((int32_t*) (ptr + 4)) }; break; } case 1: { @@ -7678,67 +7749,67 @@ bool wasi_http_0_2_0_types_method_outgoing_body_write(wasi_http_0_2_0_types_borr } } -bool wasi_http_0_2_0_types_static_outgoing_body_finish(wasi_http_0_2_0_types_own_outgoing_body_t this_, wasi_http_0_2_0_types_own_trailers_t *maybe_trailers, wasi_http_0_2_0_types_error_code_t *err) { +bool wasi_http_types_static_outgoing_body_finish(wasi_http_types_own_outgoing_body_t this_, wasi_http_types_own_trailers_t *maybe_trailers, wasi_http_types_error_code_t *err) { __attribute__((__aligned__(8))) uint8_t ret_area[40]; - wasi_http_0_2_0_types_option_own_trailers_t trailers; + wasi_http_types_option_own_trailers_t trailers; trailers.is_some = maybe_trailers != NULL;if (maybe_trailers) { trailers.val = *maybe_trailers; } int32_t option; int32_t option1; if ((trailers).is_some) { - const wasi_http_0_2_0_types_own_trailers_t *payload0 = &(trailers).val; + const wasi_http_types_own_trailers_t *payload0 = &(trailers).val; option = 1; option1 = (*payload0).__handle; } else { option = 0; option1 = 0; } - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_http_0_2_0_types_static_outgoing_body_finish((this_).__handle, option, option1, ptr); - wasi_http_0_2_0_types_result_void_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_http_types_static_outgoing_body_finish((this_).__handle, option, option1, ptr); + wasi_http_types_result_void_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; break; } case 1: { result.is_err = true; - wasi_http_0_2_0_types_error_code_t variant; - variant.tag = (int32_t) (*((uint8_t*) (ptr + 8))); + wasi_http_types_error_code_t variant; + variant.tag = (int32_t) *((uint8_t*) (ptr + 8)); switch ((int32_t) variant.tag) { case 0: { break; } case 1: { - wasi_http_0_2_0_types_option_string_t option2; - switch ((int32_t) (*((uint8_t*) (ptr + 16)))) { + bindings_option_string_t option2; + switch ((int32_t) *((uint8_t*) (ptr + 16))) { case 0: { option2.is_some = false; break; } case 1: { option2.is_some = true; - option2.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 20))), (size_t)(*((int32_t*) (ptr + 24))) }; + option2.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 20))), (*((size_t*) (ptr + 24))) }; break; } } - wasi_http_0_2_0_types_option_u16_t option3; - switch ((int32_t) (*((uint8_t*) (ptr + 28)))) { + bindings_option_u16_t option3; + switch ((int32_t) *((uint8_t*) (ptr + 28))) { case 0: { option3.is_some = false; break; } case 1: { option3.is_some = true; - option3.val = (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 30)))); + option3.val = (uint16_t) ((int32_t) *((uint16_t*) (ptr + 30))); break; } } - variant.val.dns_error = (wasi_http_0_2_0_types_dns_error_payload_t) { - option2, - option3, + variant.val.dns_error = (wasi_http_types_dns_error_payload_t) { + (bindings_option_string_t) option2, + (bindings_option_u16_t) option3, }; break; } @@ -7779,33 +7850,33 @@ bool wasi_http_0_2_0_types_static_outgoing_body_finish(wasi_http_0_2_0_types_own break; } case 14: { - wasi_http_0_2_0_types_option_u8_t option4; - switch ((int32_t) (*((uint8_t*) (ptr + 16)))) { + bindings_option_u8_t option4; + switch ((int32_t) *((uint8_t*) (ptr + 16))) { case 0: { option4.is_some = false; break; } case 1: { option4.is_some = true; - option4.val = (uint8_t) ((int32_t) (*((uint8_t*) (ptr + 17)))); + option4.val = (uint8_t) ((int32_t) *((uint8_t*) (ptr + 17))); break; } } - wasi_http_0_2_0_types_option_string_t option5; - switch ((int32_t) (*((uint8_t*) (ptr + 20)))) { + bindings_option_string_t option5; + switch ((int32_t) *((uint8_t*) (ptr + 20))) { case 0: { option5.is_some = false; break; } case 1: { option5.is_some = true; - option5.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 24))), (size_t)(*((int32_t*) (ptr + 28))) }; + option5.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 24))), (*((size_t*) (ptr + 28))) }; break; } } - variant.val.tls_alert_received = (wasi_http_0_2_0_types_tls_alert_received_payload_t) { - option4, - option5, + variant.val.tls_alert_received = (wasi_http_types_tls_alert_received_payload_t) { + (bindings_option_u8_t) option4, + (bindings_option_string_t) option5, }; break; } @@ -7816,8 +7887,8 @@ bool wasi_http_0_2_0_types_static_outgoing_body_finish(wasi_http_0_2_0_types_own break; } case 17: { - wasi_http_0_2_0_types_option_u64_t option6; - switch ((int32_t) (*((uint8_t*) (ptr + 16)))) { + bindings_option_u64_t option6; + switch ((int32_t) *((uint8_t*) (ptr + 16))) { case 0: { option6.is_some = false; break; @@ -7841,8 +7912,8 @@ bool wasi_http_0_2_0_types_static_outgoing_body_finish(wasi_http_0_2_0_types_own break; } case 21: { - wasi_http_0_2_0_types_option_u32_t option7; - switch ((int32_t) (*((uint8_t*) (ptr + 16)))) { + bindings_option_u32_t option7; + switch ((int32_t) *((uint8_t*) (ptr + 16))) { case 0: { option7.is_some = false; break; @@ -7857,28 +7928,28 @@ bool wasi_http_0_2_0_types_static_outgoing_body_finish(wasi_http_0_2_0_types_own break; } case 22: { - wasi_http_0_2_0_types_option_field_size_payload_t option10; - switch ((int32_t) (*((uint8_t*) (ptr + 16)))) { + wasi_http_types_option_field_size_payload_t option10; + switch ((int32_t) *((uint8_t*) (ptr + 16))) { case 0: { option10.is_some = false; break; } case 1: { option10.is_some = true; - wasi_http_0_2_0_types_option_string_t option8; - switch ((int32_t) (*((uint8_t*) (ptr + 20)))) { + bindings_option_string_t option8; + switch ((int32_t) *((uint8_t*) (ptr + 20))) { case 0: { option8.is_some = false; break; } case 1: { option8.is_some = true; - option8.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 24))), (size_t)(*((int32_t*) (ptr + 28))) }; + option8.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 24))), (*((size_t*) (ptr + 28))) }; break; } } - wasi_http_0_2_0_types_option_u32_t option9; - switch ((int32_t) (*((uint8_t*) (ptr + 32)))) { + bindings_option_u32_t option9; + switch ((int32_t) *((uint8_t*) (ptr + 32))) { case 0: { option9.is_some = false; break; @@ -7889,10 +7960,10 @@ bool wasi_http_0_2_0_types_static_outgoing_body_finish(wasi_http_0_2_0_types_own break; } } - - option10.val = (wasi_http_0_2_0_types_field_size_payload_t) { - option8, - option9, + + option10.val = (wasi_http_types_field_size_payload_t) { + (bindings_option_string_t) option8, + (bindings_option_u32_t) option9, }; break; } @@ -7901,8 +7972,8 @@ bool wasi_http_0_2_0_types_static_outgoing_body_finish(wasi_http_0_2_0_types_own break; } case 23: { - wasi_http_0_2_0_types_option_u32_t option11; - switch ((int32_t) (*((uint8_t*) (ptr + 16)))) { + bindings_option_u32_t option11; + switch ((int32_t) *((uint8_t*) (ptr + 16))) { case 0: { option11.is_some = false; break; @@ -7917,20 +7988,20 @@ bool wasi_http_0_2_0_types_static_outgoing_body_finish(wasi_http_0_2_0_types_own break; } case 24: { - wasi_http_0_2_0_types_option_string_t option12; - switch ((int32_t) (*((uint8_t*) (ptr + 16)))) { + bindings_option_string_t option12; + switch ((int32_t) *((uint8_t*) (ptr + 16))) { case 0: { option12.is_some = false; break; } case 1: { option12.is_some = true; - option12.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 20))), (size_t)(*((int32_t*) (ptr + 24))) }; + option12.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 20))), (*((size_t*) (ptr + 24))) }; break; } } - wasi_http_0_2_0_types_option_u32_t option13; - switch ((int32_t) (*((uint8_t*) (ptr + 28)))) { + bindings_option_u32_t option13; + switch ((int32_t) *((uint8_t*) (ptr + 28))) { case 0: { option13.is_some = false; break; @@ -7941,9 +8012,9 @@ bool wasi_http_0_2_0_types_static_outgoing_body_finish(wasi_http_0_2_0_types_own break; } } - variant.val.http_request_trailer_size = (wasi_http_0_2_0_types_field_size_payload_t) { - option12, - option13, + variant.val.http_request_trailer_size = (wasi_http_types_field_size_payload_t) { + (bindings_option_string_t) option12, + (bindings_option_u32_t) option13, }; break; } @@ -7951,8 +8022,8 @@ bool wasi_http_0_2_0_types_static_outgoing_body_finish(wasi_http_0_2_0_types_own break; } case 26: { - wasi_http_0_2_0_types_option_u32_t option14; - switch ((int32_t) (*((uint8_t*) (ptr + 16)))) { + bindings_option_u32_t option14; + switch ((int32_t) *((uint8_t*) (ptr + 16))) { case 0: { option14.is_some = false; break; @@ -7967,20 +8038,20 @@ bool wasi_http_0_2_0_types_static_outgoing_body_finish(wasi_http_0_2_0_types_own break; } case 27: { - wasi_http_0_2_0_types_option_string_t option15; - switch ((int32_t) (*((uint8_t*) (ptr + 16)))) { + bindings_option_string_t option15; + switch ((int32_t) *((uint8_t*) (ptr + 16))) { case 0: { option15.is_some = false; break; } case 1: { option15.is_some = true; - option15.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 20))), (size_t)(*((int32_t*) (ptr + 24))) }; + option15.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 20))), (*((size_t*) (ptr + 24))) }; break; } } - wasi_http_0_2_0_types_option_u32_t option16; - switch ((int32_t) (*((uint8_t*) (ptr + 28)))) { + bindings_option_u32_t option16; + switch ((int32_t) *((uint8_t*) (ptr + 28))) { case 0: { option16.is_some = false; break; @@ -7991,15 +8062,15 @@ bool wasi_http_0_2_0_types_static_outgoing_body_finish(wasi_http_0_2_0_types_own break; } } - variant.val.http_response_header_size = (wasi_http_0_2_0_types_field_size_payload_t) { - option15, - option16, + variant.val.http_response_header_size = (wasi_http_types_field_size_payload_t) { + (bindings_option_string_t) option15, + (bindings_option_u32_t) option16, }; break; } case 28: { - wasi_http_0_2_0_types_option_u64_t option17; - switch ((int32_t) (*((uint8_t*) (ptr + 16)))) { + bindings_option_u64_t option17; + switch ((int32_t) *((uint8_t*) (ptr + 16))) { case 0: { option17.is_some = false; break; @@ -8014,8 +8085,8 @@ bool wasi_http_0_2_0_types_static_outgoing_body_finish(wasi_http_0_2_0_types_own break; } case 29: { - wasi_http_0_2_0_types_option_u32_t option18; - switch ((int32_t) (*((uint8_t*) (ptr + 16)))) { + bindings_option_u32_t option18; + switch ((int32_t) *((uint8_t*) (ptr + 16))) { case 0: { option18.is_some = false; break; @@ -8030,20 +8101,20 @@ bool wasi_http_0_2_0_types_static_outgoing_body_finish(wasi_http_0_2_0_types_own break; } case 30: { - wasi_http_0_2_0_types_option_string_t option19; - switch ((int32_t) (*((uint8_t*) (ptr + 16)))) { + bindings_option_string_t option19; + switch ((int32_t) *((uint8_t*) (ptr + 16))) { case 0: { option19.is_some = false; break; } case 1: { option19.is_some = true; - option19.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 20))), (size_t)(*((int32_t*) (ptr + 24))) }; + option19.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 20))), (*((size_t*) (ptr + 24))) }; break; } } - wasi_http_0_2_0_types_option_u32_t option20; - switch ((int32_t) (*((uint8_t*) (ptr + 28)))) { + bindings_option_u32_t option20; + switch ((int32_t) *((uint8_t*) (ptr + 28))) { case 0: { option20.is_some = false; break; @@ -8054,22 +8125,22 @@ bool wasi_http_0_2_0_types_static_outgoing_body_finish(wasi_http_0_2_0_types_own break; } } - variant.val.http_response_trailer_size = (wasi_http_0_2_0_types_field_size_payload_t) { - option19, - option20, + variant.val.http_response_trailer_size = (wasi_http_types_field_size_payload_t) { + (bindings_option_string_t) option19, + (bindings_option_u32_t) option20, }; break; } case 31: { - wasi_http_0_2_0_types_option_string_t option21; - switch ((int32_t) (*((uint8_t*) (ptr + 16)))) { + bindings_option_string_t option21; + switch ((int32_t) *((uint8_t*) (ptr + 16))) { case 0: { option21.is_some = false; break; } case 1: { option21.is_some = true; - option21.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 20))), (size_t)(*((int32_t*) (ptr + 24))) }; + option21.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 20))), (*((size_t*) (ptr + 24))) }; break; } } @@ -8077,15 +8148,15 @@ bool wasi_http_0_2_0_types_static_outgoing_body_finish(wasi_http_0_2_0_types_own break; } case 32: { - wasi_http_0_2_0_types_option_string_t option22; - switch ((int32_t) (*((uint8_t*) (ptr + 16)))) { + bindings_option_string_t option22; + switch ((int32_t) *((uint8_t*) (ptr + 16))) { case 0: { option22.is_some = false; break; } case 1: { option22.is_some = true; - option22.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 20))), (size_t)(*((int32_t*) (ptr + 24))) }; + option22.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 20))), (*((size_t*) (ptr + 24))) }; break; } } @@ -8108,15 +8179,15 @@ bool wasi_http_0_2_0_types_static_outgoing_body_finish(wasi_http_0_2_0_types_own break; } case 38: { - wasi_http_0_2_0_types_option_string_t option23; - switch ((int32_t) (*((uint8_t*) (ptr + 16)))) { + bindings_option_string_t option23; + switch ((int32_t) *((uint8_t*) (ptr + 16))) { case 0: { option23.is_some = false; break; } case 1: { option23.is_some = true; - option23.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 20))), (size_t)(*((int32_t*) (ptr + 24))) }; + option23.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 20))), (*((size_t*) (ptr + 24))) }; break; } } @@ -8124,7 +8195,7 @@ bool wasi_http_0_2_0_types_static_outgoing_body_finish(wasi_http_0_2_0_types_own break; } } - + result.val.err = variant; break; } @@ -8137,71 +8208,71 @@ bool wasi_http_0_2_0_types_static_outgoing_body_finish(wasi_http_0_2_0_types_own } } -wasi_http_0_2_0_types_own_pollable_t wasi_http_0_2_0_types_method_future_incoming_response_subscribe(wasi_http_0_2_0_types_borrow_future_incoming_response_t self) { - int32_t ret = __wasm_import_wasi_http_0_2_0_types_method_future_incoming_response_subscribe((self).__handle); - return (wasi_http_0_2_0_types_own_pollable_t) { ret }; +wasi_http_types_own_pollable_t wasi_http_types_method_future_incoming_response_subscribe(wasi_http_types_borrow_future_incoming_response_t self) { + int32_t ret = __wasm_import_wasi_http_types_method_future_incoming_response_subscribe((self).__handle); + return (wasi_http_types_own_pollable_t) { ret }; } -bool wasi_http_0_2_0_types_method_future_incoming_response_get(wasi_http_0_2_0_types_borrow_future_incoming_response_t self, wasi_http_0_2_0_types_result_result_own_incoming_response_error_code_void_t *ret) { +bool wasi_http_types_method_future_incoming_response_get(wasi_http_types_borrow_future_incoming_response_t self, wasi_http_types_result_result_own_incoming_response_error_code_void_t *ret) { __attribute__((__aligned__(8))) uint8_t ret_area[56]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_http_0_2_0_types_method_future_incoming_response_get((self).__handle, ptr); - wasi_http_0_2_0_types_option_result_result_own_incoming_response_error_code_void_t option22; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_http_types_method_future_incoming_response_get((self).__handle, ptr); + wasi_http_types_option_result_result_own_incoming_response_error_code_void_t option22; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { option22.is_some = false; break; } case 1: { option22.is_some = true; - wasi_http_0_2_0_types_result_result_own_incoming_response_error_code_void_t result21; - switch ((int32_t) (*((uint8_t*) (ptr + 8)))) { + wasi_http_types_result_result_own_incoming_response_error_code_void_t result21; + switch ((int32_t) *((uint8_t*) (ptr + 8))) { case 0: { result21.is_err = false; - wasi_http_0_2_0_types_result_own_incoming_response_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 16)))) { + wasi_http_types_result_own_incoming_response_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 16))) { case 0: { result.is_err = false; - result.val.ok = (wasi_http_0_2_0_types_own_incoming_response_t) { *((int32_t*) (ptr + 24)) }; + result.val.ok = (wasi_http_types_own_incoming_response_t) { *((int32_t*) (ptr + 24)) }; break; } case 1: { result.is_err = true; - wasi_http_0_2_0_types_error_code_t variant; - variant.tag = (int32_t) (*((uint8_t*) (ptr + 24))); + wasi_http_types_error_code_t variant; + variant.tag = (int32_t) *((uint8_t*) (ptr + 24)); switch ((int32_t) variant.tag) { case 0: { break; } case 1: { - wasi_http_0_2_0_types_option_string_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 32)))) { + bindings_option_string_t option; + switch ((int32_t) *((uint8_t*) (ptr + 32))) { case 0: { option.is_some = false; break; } case 1: { option.is_some = true; - option.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 36))), (size_t)(*((int32_t*) (ptr + 40))) }; + option.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 36))), (*((size_t*) (ptr + 40))) }; break; } } - wasi_http_0_2_0_types_option_u16_t option0; - switch ((int32_t) (*((uint8_t*) (ptr + 44)))) { + bindings_option_u16_t option0; + switch ((int32_t) *((uint8_t*) (ptr + 44))) { case 0: { option0.is_some = false; break; } case 1: { option0.is_some = true; - option0.val = (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 46)))); + option0.val = (uint16_t) ((int32_t) *((uint16_t*) (ptr + 46))); break; } } - variant.val.dns_error = (wasi_http_0_2_0_types_dns_error_payload_t) { - option, - option0, + variant.val.dns_error = (wasi_http_types_dns_error_payload_t) { + (bindings_option_string_t) option, + (bindings_option_u16_t) option0, }; break; } @@ -8242,33 +8313,33 @@ bool wasi_http_0_2_0_types_method_future_incoming_response_get(wasi_http_0_2_0_t break; } case 14: { - wasi_http_0_2_0_types_option_u8_t option1; - switch ((int32_t) (*((uint8_t*) (ptr + 32)))) { + bindings_option_u8_t option1; + switch ((int32_t) *((uint8_t*) (ptr + 32))) { case 0: { option1.is_some = false; break; } case 1: { option1.is_some = true; - option1.val = (uint8_t) ((int32_t) (*((uint8_t*) (ptr + 33)))); + option1.val = (uint8_t) ((int32_t) *((uint8_t*) (ptr + 33))); break; } } - wasi_http_0_2_0_types_option_string_t option2; - switch ((int32_t) (*((uint8_t*) (ptr + 36)))) { + bindings_option_string_t option2; + switch ((int32_t) *((uint8_t*) (ptr + 36))) { case 0: { option2.is_some = false; break; } case 1: { option2.is_some = true; - option2.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 40))), (size_t)(*((int32_t*) (ptr + 44))) }; + option2.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 40))), (*((size_t*) (ptr + 44))) }; break; } } - variant.val.tls_alert_received = (wasi_http_0_2_0_types_tls_alert_received_payload_t) { - option1, - option2, + variant.val.tls_alert_received = (wasi_http_types_tls_alert_received_payload_t) { + (bindings_option_u8_t) option1, + (bindings_option_string_t) option2, }; break; } @@ -8279,8 +8350,8 @@ bool wasi_http_0_2_0_types_method_future_incoming_response_get(wasi_http_0_2_0_t break; } case 17: { - wasi_http_0_2_0_types_option_u64_t option3; - switch ((int32_t) (*((uint8_t*) (ptr + 32)))) { + bindings_option_u64_t option3; + switch ((int32_t) *((uint8_t*) (ptr + 32))) { case 0: { option3.is_some = false; break; @@ -8304,8 +8375,8 @@ bool wasi_http_0_2_0_types_method_future_incoming_response_get(wasi_http_0_2_0_t break; } case 21: { - wasi_http_0_2_0_types_option_u32_t option4; - switch ((int32_t) (*((uint8_t*) (ptr + 32)))) { + bindings_option_u32_t option4; + switch ((int32_t) *((uint8_t*) (ptr + 32))) { case 0: { option4.is_some = false; break; @@ -8320,28 +8391,28 @@ bool wasi_http_0_2_0_types_method_future_incoming_response_get(wasi_http_0_2_0_t break; } case 22: { - wasi_http_0_2_0_types_option_field_size_payload_t option7; - switch ((int32_t) (*((uint8_t*) (ptr + 32)))) { + wasi_http_types_option_field_size_payload_t option7; + switch ((int32_t) *((uint8_t*) (ptr + 32))) { case 0: { option7.is_some = false; break; } case 1: { option7.is_some = true; - wasi_http_0_2_0_types_option_string_t option5; - switch ((int32_t) (*((uint8_t*) (ptr + 36)))) { + bindings_option_string_t option5; + switch ((int32_t) *((uint8_t*) (ptr + 36))) { case 0: { option5.is_some = false; break; } case 1: { option5.is_some = true; - option5.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 40))), (size_t)(*((int32_t*) (ptr + 44))) }; + option5.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 40))), (*((size_t*) (ptr + 44))) }; break; } } - wasi_http_0_2_0_types_option_u32_t option6; - switch ((int32_t) (*((uint8_t*) (ptr + 48)))) { + bindings_option_u32_t option6; + switch ((int32_t) *((uint8_t*) (ptr + 48))) { case 0: { option6.is_some = false; break; @@ -8352,10 +8423,10 @@ bool wasi_http_0_2_0_types_method_future_incoming_response_get(wasi_http_0_2_0_t break; } } - - option7.val = (wasi_http_0_2_0_types_field_size_payload_t) { - option5, - option6, + + option7.val = (wasi_http_types_field_size_payload_t) { + (bindings_option_string_t) option5, + (bindings_option_u32_t) option6, }; break; } @@ -8364,8 +8435,8 @@ bool wasi_http_0_2_0_types_method_future_incoming_response_get(wasi_http_0_2_0_t break; } case 23: { - wasi_http_0_2_0_types_option_u32_t option8; - switch ((int32_t) (*((uint8_t*) (ptr + 32)))) { + bindings_option_u32_t option8; + switch ((int32_t) *((uint8_t*) (ptr + 32))) { case 0: { option8.is_some = false; break; @@ -8380,20 +8451,20 @@ bool wasi_http_0_2_0_types_method_future_incoming_response_get(wasi_http_0_2_0_t break; } case 24: { - wasi_http_0_2_0_types_option_string_t option9; - switch ((int32_t) (*((uint8_t*) (ptr + 32)))) { + bindings_option_string_t option9; + switch ((int32_t) *((uint8_t*) (ptr + 32))) { case 0: { option9.is_some = false; break; } case 1: { option9.is_some = true; - option9.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 36))), (size_t)(*((int32_t*) (ptr + 40))) }; + option9.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 36))), (*((size_t*) (ptr + 40))) }; break; } } - wasi_http_0_2_0_types_option_u32_t option10; - switch ((int32_t) (*((uint8_t*) (ptr + 44)))) { + bindings_option_u32_t option10; + switch ((int32_t) *((uint8_t*) (ptr + 44))) { case 0: { option10.is_some = false; break; @@ -8404,9 +8475,9 @@ bool wasi_http_0_2_0_types_method_future_incoming_response_get(wasi_http_0_2_0_t break; } } - variant.val.http_request_trailer_size = (wasi_http_0_2_0_types_field_size_payload_t) { - option9, - option10, + variant.val.http_request_trailer_size = (wasi_http_types_field_size_payload_t) { + (bindings_option_string_t) option9, + (bindings_option_u32_t) option10, }; break; } @@ -8414,8 +8485,8 @@ bool wasi_http_0_2_0_types_method_future_incoming_response_get(wasi_http_0_2_0_t break; } case 26: { - wasi_http_0_2_0_types_option_u32_t option11; - switch ((int32_t) (*((uint8_t*) (ptr + 32)))) { + bindings_option_u32_t option11; + switch ((int32_t) *((uint8_t*) (ptr + 32))) { case 0: { option11.is_some = false; break; @@ -8430,20 +8501,20 @@ bool wasi_http_0_2_0_types_method_future_incoming_response_get(wasi_http_0_2_0_t break; } case 27: { - wasi_http_0_2_0_types_option_string_t option12; - switch ((int32_t) (*((uint8_t*) (ptr + 32)))) { + bindings_option_string_t option12; + switch ((int32_t) *((uint8_t*) (ptr + 32))) { case 0: { option12.is_some = false; break; } case 1: { option12.is_some = true; - option12.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 36))), (size_t)(*((int32_t*) (ptr + 40))) }; + option12.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 36))), (*((size_t*) (ptr + 40))) }; break; } } - wasi_http_0_2_0_types_option_u32_t option13; - switch ((int32_t) (*((uint8_t*) (ptr + 44)))) { + bindings_option_u32_t option13; + switch ((int32_t) *((uint8_t*) (ptr + 44))) { case 0: { option13.is_some = false; break; @@ -8454,15 +8525,15 @@ bool wasi_http_0_2_0_types_method_future_incoming_response_get(wasi_http_0_2_0_t break; } } - variant.val.http_response_header_size = (wasi_http_0_2_0_types_field_size_payload_t) { - option12, - option13, + variant.val.http_response_header_size = (wasi_http_types_field_size_payload_t) { + (bindings_option_string_t) option12, + (bindings_option_u32_t) option13, }; break; } case 28: { - wasi_http_0_2_0_types_option_u64_t option14; - switch ((int32_t) (*((uint8_t*) (ptr + 32)))) { + bindings_option_u64_t option14; + switch ((int32_t) *((uint8_t*) (ptr + 32))) { case 0: { option14.is_some = false; break; @@ -8477,8 +8548,8 @@ bool wasi_http_0_2_0_types_method_future_incoming_response_get(wasi_http_0_2_0_t break; } case 29: { - wasi_http_0_2_0_types_option_u32_t option15; - switch ((int32_t) (*((uint8_t*) (ptr + 32)))) { + bindings_option_u32_t option15; + switch ((int32_t) *((uint8_t*) (ptr + 32))) { case 0: { option15.is_some = false; break; @@ -8493,20 +8564,20 @@ bool wasi_http_0_2_0_types_method_future_incoming_response_get(wasi_http_0_2_0_t break; } case 30: { - wasi_http_0_2_0_types_option_string_t option16; - switch ((int32_t) (*((uint8_t*) (ptr + 32)))) { + bindings_option_string_t option16; + switch ((int32_t) *((uint8_t*) (ptr + 32))) { case 0: { option16.is_some = false; break; } case 1: { option16.is_some = true; - option16.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 36))), (size_t)(*((int32_t*) (ptr + 40))) }; + option16.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 36))), (*((size_t*) (ptr + 40))) }; break; } } - wasi_http_0_2_0_types_option_u32_t option17; - switch ((int32_t) (*((uint8_t*) (ptr + 44)))) { + bindings_option_u32_t option17; + switch ((int32_t) *((uint8_t*) (ptr + 44))) { case 0: { option17.is_some = false; break; @@ -8517,22 +8588,22 @@ bool wasi_http_0_2_0_types_method_future_incoming_response_get(wasi_http_0_2_0_t break; } } - variant.val.http_response_trailer_size = (wasi_http_0_2_0_types_field_size_payload_t) { - option16, - option17, + variant.val.http_response_trailer_size = (wasi_http_types_field_size_payload_t) { + (bindings_option_string_t) option16, + (bindings_option_u32_t) option17, }; break; } case 31: { - wasi_http_0_2_0_types_option_string_t option18; - switch ((int32_t) (*((uint8_t*) (ptr + 32)))) { + bindings_option_string_t option18; + switch ((int32_t) *((uint8_t*) (ptr + 32))) { case 0: { option18.is_some = false; break; } case 1: { option18.is_some = true; - option18.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 36))), (size_t)(*((int32_t*) (ptr + 40))) }; + option18.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 36))), (*((size_t*) (ptr + 40))) }; break; } } @@ -8540,15 +8611,15 @@ bool wasi_http_0_2_0_types_method_future_incoming_response_get(wasi_http_0_2_0_t break; } case 32: { - wasi_http_0_2_0_types_option_string_t option19; - switch ((int32_t) (*((uint8_t*) (ptr + 32)))) { + bindings_option_string_t option19; + switch ((int32_t) *((uint8_t*) (ptr + 32))) { case 0: { option19.is_some = false; break; } case 1: { option19.is_some = true; - option19.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 36))), (size_t)(*((int32_t*) (ptr + 40))) }; + option19.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 36))), (*((size_t*) (ptr + 40))) }; break; } } @@ -8571,15 +8642,15 @@ bool wasi_http_0_2_0_types_method_future_incoming_response_get(wasi_http_0_2_0_t break; } case 38: { - wasi_http_0_2_0_types_option_string_t option20; - switch ((int32_t) (*((uint8_t*) (ptr + 32)))) { + bindings_option_string_t option20; + switch ((int32_t) *((uint8_t*) (ptr + 32))) { case 0: { option20.is_some = false; break; } case 1: { option20.is_some = true; - option20.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 36))), (size_t)(*((int32_t*) (ptr + 40))) }; + option20.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 36))), (*((size_t*) (ptr + 40))) }; break; } } @@ -8587,12 +8658,12 @@ bool wasi_http_0_2_0_types_method_future_incoming_response_get(wasi_http_0_2_0_t break; } } - + result.val.err = variant; break; } } - + result21.val.ok = result; break; } @@ -8601,7 +8672,7 @@ bool wasi_http_0_2_0_types_method_future_incoming_response_get(wasi_http_0_2_0_t break; } } - + option22.val = result21; break; } @@ -8610,68 +8681,68 @@ bool wasi_http_0_2_0_types_method_future_incoming_response_get(wasi_http_0_2_0_t return option22.is_some; } -bool wasi_http_0_2_0_outgoing_handler_handle(wasi_http_0_2_0_outgoing_handler_own_outgoing_request_t request, wasi_http_0_2_0_outgoing_handler_own_request_options_t *maybe_options, wasi_http_0_2_0_outgoing_handler_own_future_incoming_response_t *ret, wasi_http_0_2_0_outgoing_handler_error_code_t *err) { +bool wasi_http_outgoing_handler_handle(wasi_http_outgoing_handler_own_outgoing_request_t request, wasi_http_outgoing_handler_own_request_options_t *maybe_options, wasi_http_outgoing_handler_own_future_incoming_response_t *ret, wasi_http_outgoing_handler_error_code_t *err) { __attribute__((__aligned__(8))) uint8_t ret_area[40]; - wasi_http_0_2_0_outgoing_handler_option_own_request_options_t options; + wasi_http_outgoing_handler_option_own_request_options_t options; options.is_some = maybe_options != NULL;if (maybe_options) { options.val = *maybe_options; } int32_t option; int32_t option1; if ((options).is_some) { - const wasi_http_0_2_0_outgoing_handler_own_request_options_t *payload0 = &(options).val; + const wasi_http_outgoing_handler_own_request_options_t *payload0 = &(options).val; option = 1; option1 = (*payload0).__handle; } else { option = 0; option1 = 0; } - int32_t ptr = (int32_t) &ret_area; - __wasm_import_wasi_http_0_2_0_outgoing_handler_handle((request).__handle, option, option1, ptr); - wasi_http_0_2_0_outgoing_handler_result_own_future_incoming_response_error_code_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_wasi_http_outgoing_handler_handle((request).__handle, option, option1, ptr); + wasi_http_outgoing_handler_result_own_future_incoming_response_error_code_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (wasi_http_0_2_0_outgoing_handler_own_future_incoming_response_t) { *((int32_t*) (ptr + 8)) }; + result.val.ok = (wasi_http_outgoing_handler_own_future_incoming_response_t) { *((int32_t*) (ptr + 8)) }; break; } case 1: { result.is_err = true; - wasi_http_0_2_0_types_error_code_t variant; - variant.tag = (int32_t) (*((uint8_t*) (ptr + 8))); + wasi_http_types_error_code_t variant; + variant.tag = (int32_t) *((uint8_t*) (ptr + 8)); switch ((int32_t) variant.tag) { case 0: { break; } case 1: { - wasi_http_0_2_0_types_option_string_t option2; - switch ((int32_t) (*((uint8_t*) (ptr + 16)))) { + bindings_option_string_t option2; + switch ((int32_t) *((uint8_t*) (ptr + 16))) { case 0: { option2.is_some = false; break; } case 1: { option2.is_some = true; - option2.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 20))), (size_t)(*((int32_t*) (ptr + 24))) }; + option2.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 20))), (*((size_t*) (ptr + 24))) }; break; } } - wasi_http_0_2_0_types_option_u16_t option3; - switch ((int32_t) (*((uint8_t*) (ptr + 28)))) { + bindings_option_u16_t option3; + switch ((int32_t) *((uint8_t*) (ptr + 28))) { case 0: { option3.is_some = false; break; } case 1: { option3.is_some = true; - option3.val = (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 30)))); + option3.val = (uint16_t) ((int32_t) *((uint16_t*) (ptr + 30))); break; } } - variant.val.dns_error = (wasi_http_0_2_0_types_dns_error_payload_t) { - option2, - option3, + variant.val.dns_error = (wasi_http_types_dns_error_payload_t) { + (bindings_option_string_t) option2, + (bindings_option_u16_t) option3, }; break; } @@ -8712,33 +8783,33 @@ bool wasi_http_0_2_0_outgoing_handler_handle(wasi_http_0_2_0_outgoing_handler_ow break; } case 14: { - wasi_http_0_2_0_types_option_u8_t option4; - switch ((int32_t) (*((uint8_t*) (ptr + 16)))) { + bindings_option_u8_t option4; + switch ((int32_t) *((uint8_t*) (ptr + 16))) { case 0: { option4.is_some = false; break; } case 1: { option4.is_some = true; - option4.val = (uint8_t) ((int32_t) (*((uint8_t*) (ptr + 17)))); + option4.val = (uint8_t) ((int32_t) *((uint8_t*) (ptr + 17))); break; } } - wasi_http_0_2_0_types_option_string_t option5; - switch ((int32_t) (*((uint8_t*) (ptr + 20)))) { + bindings_option_string_t option5; + switch ((int32_t) *((uint8_t*) (ptr + 20))) { case 0: { option5.is_some = false; break; } case 1: { option5.is_some = true; - option5.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 24))), (size_t)(*((int32_t*) (ptr + 28))) }; + option5.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 24))), (*((size_t*) (ptr + 28))) }; break; } } - variant.val.tls_alert_received = (wasi_http_0_2_0_types_tls_alert_received_payload_t) { - option4, - option5, + variant.val.tls_alert_received = (wasi_http_types_tls_alert_received_payload_t) { + (bindings_option_u8_t) option4, + (bindings_option_string_t) option5, }; break; } @@ -8749,8 +8820,8 @@ bool wasi_http_0_2_0_outgoing_handler_handle(wasi_http_0_2_0_outgoing_handler_ow break; } case 17: { - wasi_http_0_2_0_types_option_u64_t option6; - switch ((int32_t) (*((uint8_t*) (ptr + 16)))) { + bindings_option_u64_t option6; + switch ((int32_t) *((uint8_t*) (ptr + 16))) { case 0: { option6.is_some = false; break; @@ -8774,8 +8845,8 @@ bool wasi_http_0_2_0_outgoing_handler_handle(wasi_http_0_2_0_outgoing_handler_ow break; } case 21: { - wasi_http_0_2_0_types_option_u32_t option7; - switch ((int32_t) (*((uint8_t*) (ptr + 16)))) { + bindings_option_u32_t option7; + switch ((int32_t) *((uint8_t*) (ptr + 16))) { case 0: { option7.is_some = false; break; @@ -8790,28 +8861,28 @@ bool wasi_http_0_2_0_outgoing_handler_handle(wasi_http_0_2_0_outgoing_handler_ow break; } case 22: { - wasi_http_0_2_0_types_option_field_size_payload_t option10; - switch ((int32_t) (*((uint8_t*) (ptr + 16)))) { + wasi_http_types_option_field_size_payload_t option10; + switch ((int32_t) *((uint8_t*) (ptr + 16))) { case 0: { option10.is_some = false; break; } case 1: { option10.is_some = true; - wasi_http_0_2_0_types_option_string_t option8; - switch ((int32_t) (*((uint8_t*) (ptr + 20)))) { + bindings_option_string_t option8; + switch ((int32_t) *((uint8_t*) (ptr + 20))) { case 0: { option8.is_some = false; break; } case 1: { option8.is_some = true; - option8.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 24))), (size_t)(*((int32_t*) (ptr + 28))) }; + option8.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 24))), (*((size_t*) (ptr + 28))) }; break; } } - wasi_http_0_2_0_types_option_u32_t option9; - switch ((int32_t) (*((uint8_t*) (ptr + 32)))) { + bindings_option_u32_t option9; + switch ((int32_t) *((uint8_t*) (ptr + 32))) { case 0: { option9.is_some = false; break; @@ -8822,10 +8893,10 @@ bool wasi_http_0_2_0_outgoing_handler_handle(wasi_http_0_2_0_outgoing_handler_ow break; } } - - option10.val = (wasi_http_0_2_0_types_field_size_payload_t) { - option8, - option9, + + option10.val = (wasi_http_types_field_size_payload_t) { + (bindings_option_string_t) option8, + (bindings_option_u32_t) option9, }; break; } @@ -8834,8 +8905,8 @@ bool wasi_http_0_2_0_outgoing_handler_handle(wasi_http_0_2_0_outgoing_handler_ow break; } case 23: { - wasi_http_0_2_0_types_option_u32_t option11; - switch ((int32_t) (*((uint8_t*) (ptr + 16)))) { + bindings_option_u32_t option11; + switch ((int32_t) *((uint8_t*) (ptr + 16))) { case 0: { option11.is_some = false; break; @@ -8850,20 +8921,20 @@ bool wasi_http_0_2_0_outgoing_handler_handle(wasi_http_0_2_0_outgoing_handler_ow break; } case 24: { - wasi_http_0_2_0_types_option_string_t option12; - switch ((int32_t) (*((uint8_t*) (ptr + 16)))) { + bindings_option_string_t option12; + switch ((int32_t) *((uint8_t*) (ptr + 16))) { case 0: { option12.is_some = false; break; } case 1: { option12.is_some = true; - option12.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 20))), (size_t)(*((int32_t*) (ptr + 24))) }; + option12.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 20))), (*((size_t*) (ptr + 24))) }; break; } } - wasi_http_0_2_0_types_option_u32_t option13; - switch ((int32_t) (*((uint8_t*) (ptr + 28)))) { + bindings_option_u32_t option13; + switch ((int32_t) *((uint8_t*) (ptr + 28))) { case 0: { option13.is_some = false; break; @@ -8874,9 +8945,9 @@ bool wasi_http_0_2_0_outgoing_handler_handle(wasi_http_0_2_0_outgoing_handler_ow break; } } - variant.val.http_request_trailer_size = (wasi_http_0_2_0_types_field_size_payload_t) { - option12, - option13, + variant.val.http_request_trailer_size = (wasi_http_types_field_size_payload_t) { + (bindings_option_string_t) option12, + (bindings_option_u32_t) option13, }; break; } @@ -8884,8 +8955,8 @@ bool wasi_http_0_2_0_outgoing_handler_handle(wasi_http_0_2_0_outgoing_handler_ow break; } case 26: { - wasi_http_0_2_0_types_option_u32_t option14; - switch ((int32_t) (*((uint8_t*) (ptr + 16)))) { + bindings_option_u32_t option14; + switch ((int32_t) *((uint8_t*) (ptr + 16))) { case 0: { option14.is_some = false; break; @@ -8900,20 +8971,20 @@ bool wasi_http_0_2_0_outgoing_handler_handle(wasi_http_0_2_0_outgoing_handler_ow break; } case 27: { - wasi_http_0_2_0_types_option_string_t option15; - switch ((int32_t) (*((uint8_t*) (ptr + 16)))) { + bindings_option_string_t option15; + switch ((int32_t) *((uint8_t*) (ptr + 16))) { case 0: { option15.is_some = false; break; } case 1: { option15.is_some = true; - option15.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 20))), (size_t)(*((int32_t*) (ptr + 24))) }; + option15.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 20))), (*((size_t*) (ptr + 24))) }; break; } } - wasi_http_0_2_0_types_option_u32_t option16; - switch ((int32_t) (*((uint8_t*) (ptr + 28)))) { + bindings_option_u32_t option16; + switch ((int32_t) *((uint8_t*) (ptr + 28))) { case 0: { option16.is_some = false; break; @@ -8924,15 +8995,15 @@ bool wasi_http_0_2_0_outgoing_handler_handle(wasi_http_0_2_0_outgoing_handler_ow break; } } - variant.val.http_response_header_size = (wasi_http_0_2_0_types_field_size_payload_t) { - option15, - option16, + variant.val.http_response_header_size = (wasi_http_types_field_size_payload_t) { + (bindings_option_string_t) option15, + (bindings_option_u32_t) option16, }; break; } case 28: { - wasi_http_0_2_0_types_option_u64_t option17; - switch ((int32_t) (*((uint8_t*) (ptr + 16)))) { + bindings_option_u64_t option17; + switch ((int32_t) *((uint8_t*) (ptr + 16))) { case 0: { option17.is_some = false; break; @@ -8947,8 +9018,8 @@ bool wasi_http_0_2_0_outgoing_handler_handle(wasi_http_0_2_0_outgoing_handler_ow break; } case 29: { - wasi_http_0_2_0_types_option_u32_t option18; - switch ((int32_t) (*((uint8_t*) (ptr + 16)))) { + bindings_option_u32_t option18; + switch ((int32_t) *((uint8_t*) (ptr + 16))) { case 0: { option18.is_some = false; break; @@ -8963,20 +9034,20 @@ bool wasi_http_0_2_0_outgoing_handler_handle(wasi_http_0_2_0_outgoing_handler_ow break; } case 30: { - wasi_http_0_2_0_types_option_string_t option19; - switch ((int32_t) (*((uint8_t*) (ptr + 16)))) { + bindings_option_string_t option19; + switch ((int32_t) *((uint8_t*) (ptr + 16))) { case 0: { option19.is_some = false; break; } case 1: { option19.is_some = true; - option19.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 20))), (size_t)(*((int32_t*) (ptr + 24))) }; + option19.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 20))), (*((size_t*) (ptr + 24))) }; break; } } - wasi_http_0_2_0_types_option_u32_t option20; - switch ((int32_t) (*((uint8_t*) (ptr + 28)))) { + bindings_option_u32_t option20; + switch ((int32_t) *((uint8_t*) (ptr + 28))) { case 0: { option20.is_some = false; break; @@ -8987,22 +9058,22 @@ bool wasi_http_0_2_0_outgoing_handler_handle(wasi_http_0_2_0_outgoing_handler_ow break; } } - variant.val.http_response_trailer_size = (wasi_http_0_2_0_types_field_size_payload_t) { - option19, - option20, + variant.val.http_response_trailer_size = (wasi_http_types_field_size_payload_t) { + (bindings_option_string_t) option19, + (bindings_option_u32_t) option20, }; break; } case 31: { - wasi_http_0_2_0_types_option_string_t option21; - switch ((int32_t) (*((uint8_t*) (ptr + 16)))) { + bindings_option_string_t option21; + switch ((int32_t) *((uint8_t*) (ptr + 16))) { case 0: { option21.is_some = false; break; } case 1: { option21.is_some = true; - option21.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 20))), (size_t)(*((int32_t*) (ptr + 24))) }; + option21.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 20))), (*((size_t*) (ptr + 24))) }; break; } } @@ -9010,15 +9081,15 @@ bool wasi_http_0_2_0_outgoing_handler_handle(wasi_http_0_2_0_outgoing_handler_ow break; } case 32: { - wasi_http_0_2_0_types_option_string_t option22; - switch ((int32_t) (*((uint8_t*) (ptr + 16)))) { + bindings_option_string_t option22; + switch ((int32_t) *((uint8_t*) (ptr + 16))) { case 0: { option22.is_some = false; break; } case 1: { option22.is_some = true; - option22.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 20))), (size_t)(*((int32_t*) (ptr + 24))) }; + option22.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 20))), (*((size_t*) (ptr + 24))) }; break; } } @@ -9041,15 +9112,15 @@ bool wasi_http_0_2_0_outgoing_handler_handle(wasi_http_0_2_0_outgoing_handler_ow break; } case 38: { - wasi_http_0_2_0_types_option_string_t option23; - switch ((int32_t) (*((uint8_t*) (ptr + 16)))) { + bindings_option_string_t option23; + switch ((int32_t) *((uint8_t*) (ptr + 16))) { case 0: { option23.is_some = false; break; } case 1: { option23.is_some = true; - option23.val = (bindings_string_t) { (uint8_t*)(*((int32_t*) (ptr + 20))), (size_t)(*((int32_t*) (ptr + 24))) }; + option23.val = (bindings_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 20))), (*((size_t*) (ptr + 24))) }; break; } } @@ -9057,7 +9128,7 @@ bool wasi_http_0_2_0_outgoing_handler_handle(wasi_http_0_2_0_outgoing_handler_ow break; } } - + result.val.err = variant; break; } @@ -9072,9 +9143,9 @@ bool wasi_http_0_2_0_outgoing_handler_handle(wasi_http_0_2_0_outgoing_handler_ow } __attribute__((__export_name__("wasi:cli/run@0.2.0#run"))) -int32_t __wasm_export_exports_wasi_cli_0_2_0_run_run(void) { - exports_wasi_cli_0_2_0_run_result_void_void_t ret; - ret.is_err = !exports_wasi_cli_0_2_0_run_run(); +int32_t __wasm_export_exports_wasi_cli_run_run(void) { + exports_wasi_cli_run_result_void_void_t ret; + ret.is_err = !exports_wasi_cli_run_run(); int32_t result; if ((ret).is_err) { result = 1; @@ -9085,10 +9156,12 @@ int32_t __wasm_export_exports_wasi_cli_0_2_0_run_run(void) { } __attribute__((__export_name__("wasi:http/incoming-handler@0.2.0#handle"))) -void __wasm_export_exports_wasi_http_0_2_0_incoming_handler_handle(int32_t arg, int32_t arg0) { - exports_wasi_http_0_2_0_incoming_handler_handle((exports_wasi_http_0_2_0_incoming_handler_own_incoming_request_t) { arg }, (exports_wasi_http_0_2_0_incoming_handler_own_response_outparam_t) { arg0 }); +void __wasm_export_exports_wasi_http_incoming_handler_handle(int32_t arg, int32_t arg0) { + exports_wasi_http_incoming_handler_handle((exports_wasi_http_incoming_handler_own_incoming_request_t) { arg }, (exports_wasi_http_incoming_handler_own_response_outparam_t) { arg0 }); } +// Ensure that the *_component_type.o object is linked in + extern void __component_type_object_force_link_bindings(void); void __component_type_object_force_link_bindings_public_use_in_this_compilation_unit(void) { __component_type_object_force_link_bindings(); diff --git a/runtime/fastedge/host-api/bindings/bindings.h b/runtime/fastedge/host-api/bindings/bindings.h index 4118508..206aa22 100644 --- a/runtime/fastedge/host-api/bindings/bindings.h +++ b/runtime/fastedge/host-api/bindings/bindings.h @@ -1,16 +1,14 @@ -// Generated by `wit-bindgen` 0.16.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.30.0. DO NOT EDIT! #ifndef __BINDINGS_BINDINGS_H #define __BINDINGS_BINDINGS_H #ifdef __cplusplus extern "C" { #endif -#include -#include #include #include -typedef struct { +typedef struct bindings_string_t { uint8_t*ptr; size_t len; } bindings_string_t; @@ -18,219 +16,238 @@ typedef struct { typedef struct { bool is_some; bindings_string_t val; -} gcore_fastedge_dictionary_option_string_t; +} bindings_option_string_t; + +// The set of errors which may be raised by functions in this interface +typedef struct gcore_fastedge_secret_error_t { + uint8_t tag; + union { + bindings_string_t other; + } val; +} gcore_fastedge_secret_error_t; + +// The requesting component does not have access to the specified key +// (which may or may not exist). +#define GCORE_FASTEDGE_SECRET_ERROR_ACCESS_DENIED 0 +// Decryption error. +#define GCORE_FASTEDGE_SECRET_ERROR_DECRYPT_ERROR 1 +// Some implementation-specific error has occurred (e.g. I/O) +#define GCORE_FASTEDGE_SECRET_ERROR_OTHER 2 + +typedef struct { + bool is_err; + union { + bindings_option_string_t ok; + gcore_fastedge_secret_error_t err; + } val; +} gcore_fastedge_secret_result_option_string_error_t; typedef struct { bindings_string_t f0; bindings_string_t f1; -} wasi_cli_0_2_0_environment_tuple2_string_string_t; +} bindings_tuple2_string_string_t; typedef struct { - wasi_cli_0_2_0_environment_tuple2_string_string_t *ptr; + bindings_tuple2_string_string_t *ptr; size_t len; -} wasi_cli_0_2_0_environment_list_tuple2_string_string_t; +} bindings_list_tuple2_string_string_t; typedef struct { bindings_string_t *ptr; size_t len; -} wasi_cli_0_2_0_environment_list_string_t; - -typedef struct { - bool is_some; - bindings_string_t val; -} wasi_cli_0_2_0_environment_option_string_t; +} bindings_list_string_t; typedef struct { bool is_err; -} wasi_cli_0_2_0_exit_result_void_void_t; +} wasi_cli_exit_result_void_void_t; -typedef struct wasi_io_0_2_0_error_own_error_t { +typedef struct wasi_io_error_own_error_t { int32_t __handle; -} wasi_io_0_2_0_error_own_error_t; +} wasi_io_error_own_error_t; -typedef struct wasi_io_0_2_0_error_borrow_error_t { +typedef struct wasi_io_error_borrow_error_t { int32_t __handle; -} wasi_io_0_2_0_error_borrow_error_t; +} wasi_io_error_borrow_error_t; -typedef struct wasi_io_0_2_0_poll_own_pollable_t { +typedef struct wasi_io_poll_own_pollable_t { int32_t __handle; -} wasi_io_0_2_0_poll_own_pollable_t; +} wasi_io_poll_own_pollable_t; -typedef struct wasi_io_0_2_0_poll_borrow_pollable_t { +typedef struct wasi_io_poll_borrow_pollable_t { int32_t __handle; -} wasi_io_0_2_0_poll_borrow_pollable_t; +} wasi_io_poll_borrow_pollable_t; typedef struct { - wasi_io_0_2_0_poll_borrow_pollable_t *ptr; + wasi_io_poll_borrow_pollable_t *ptr; size_t len; -} wasi_io_0_2_0_poll_list_borrow_pollable_t; +} wasi_io_poll_list_borrow_pollable_t; typedef struct { uint32_t *ptr; size_t len; -} wasi_io_0_2_0_poll_list_u32_t; +} bindings_list_u32_t; -typedef wasi_io_0_2_0_error_own_error_t wasi_io_0_2_0_streams_own_error_t; +typedef wasi_io_error_own_error_t wasi_io_streams_own_error_t; // An error for input-stream and output-stream operations. -typedef struct { +typedef struct wasi_io_streams_stream_error_t { uint8_t tag; union { - wasi_io_0_2_0_streams_own_error_t last_operation_failed; + wasi_io_streams_own_error_t last_operation_failed; } val; -} wasi_io_0_2_0_streams_stream_error_t; +} wasi_io_streams_stream_error_t; // The last operation (a write or flush) failed before completion. // // More information is available in the `error` payload. -#define WASI_IO_0_2_0_STREAMS_STREAM_ERROR_LAST_OPERATION_FAILED 0 +#define WASI_IO_STREAMS_STREAM_ERROR_LAST_OPERATION_FAILED 0 // The stream is closed: no more input will be accepted by the // stream. A closed output-stream will return this error on all // future operations. -#define WASI_IO_0_2_0_STREAMS_STREAM_ERROR_CLOSED 1 +#define WASI_IO_STREAMS_STREAM_ERROR_CLOSED 1 -typedef struct wasi_io_0_2_0_streams_own_input_stream_t { +typedef struct wasi_io_streams_own_input_stream_t { int32_t __handle; -} wasi_io_0_2_0_streams_own_input_stream_t; +} wasi_io_streams_own_input_stream_t; -typedef struct wasi_io_0_2_0_streams_borrow_input_stream_t { +typedef struct wasi_io_streams_borrow_input_stream_t { int32_t __handle; -} wasi_io_0_2_0_streams_borrow_input_stream_t; +} wasi_io_streams_borrow_input_stream_t; -typedef struct wasi_io_0_2_0_streams_own_output_stream_t { +typedef struct wasi_io_streams_own_output_stream_t { int32_t __handle; -} wasi_io_0_2_0_streams_own_output_stream_t; +} wasi_io_streams_own_output_stream_t; -typedef struct wasi_io_0_2_0_streams_borrow_output_stream_t { +typedef struct wasi_io_streams_borrow_output_stream_t { int32_t __handle; -} wasi_io_0_2_0_streams_borrow_output_stream_t; +} wasi_io_streams_borrow_output_stream_t; typedef struct { uint8_t *ptr; size_t len; -} wasi_io_0_2_0_streams_list_u8_t; +} bindings_list_u8_t; typedef struct { bool is_err; union { - wasi_io_0_2_0_streams_list_u8_t ok; - wasi_io_0_2_0_streams_stream_error_t err; + bindings_list_u8_t ok; + wasi_io_streams_stream_error_t err; } val; -} wasi_io_0_2_0_streams_result_list_u8_stream_error_t; +} wasi_io_streams_result_list_u8_stream_error_t; typedef struct { bool is_err; union { uint64_t ok; - wasi_io_0_2_0_streams_stream_error_t err; + wasi_io_streams_stream_error_t err; } val; -} wasi_io_0_2_0_streams_result_u64_stream_error_t; +} wasi_io_streams_result_u64_stream_error_t; -typedef wasi_io_0_2_0_poll_own_pollable_t wasi_io_0_2_0_streams_own_pollable_t; +typedef wasi_io_poll_own_pollable_t wasi_io_streams_own_pollable_t; typedef struct { bool is_err; union { - wasi_io_0_2_0_streams_stream_error_t err; + wasi_io_streams_stream_error_t err; } val; -} wasi_io_0_2_0_streams_result_void_stream_error_t; +} wasi_io_streams_result_void_stream_error_t; -typedef wasi_io_0_2_0_streams_own_input_stream_t wasi_cli_0_2_0_stdin_own_input_stream_t; +typedef wasi_io_streams_own_input_stream_t wasi_cli_stdin_own_input_stream_t; -typedef wasi_io_0_2_0_streams_own_output_stream_t wasi_cli_0_2_0_stdout_own_output_stream_t; +typedef wasi_io_streams_own_output_stream_t wasi_cli_stdout_own_output_stream_t; -typedef wasi_io_0_2_0_streams_own_output_stream_t wasi_cli_0_2_0_stderr_own_output_stream_t; +typedef wasi_io_streams_own_output_stream_t wasi_cli_stderr_own_output_stream_t; -typedef struct wasi_cli_0_2_0_terminal_input_own_terminal_input_t { +typedef struct wasi_cli_terminal_input_own_terminal_input_t { int32_t __handle; -} wasi_cli_0_2_0_terminal_input_own_terminal_input_t; +} wasi_cli_terminal_input_own_terminal_input_t; -typedef struct wasi_cli_0_2_0_terminal_input_borrow_terminal_input_t { +typedef struct wasi_cli_terminal_input_borrow_terminal_input_t { int32_t __handle; -} wasi_cli_0_2_0_terminal_input_borrow_terminal_input_t; +} wasi_cli_terminal_input_borrow_terminal_input_t; -typedef struct wasi_cli_0_2_0_terminal_output_own_terminal_output_t { +typedef struct wasi_cli_terminal_output_own_terminal_output_t { int32_t __handle; -} wasi_cli_0_2_0_terminal_output_own_terminal_output_t; +} wasi_cli_terminal_output_own_terminal_output_t; -typedef struct wasi_cli_0_2_0_terminal_output_borrow_terminal_output_t { +typedef struct wasi_cli_terminal_output_borrow_terminal_output_t { int32_t __handle; -} wasi_cli_0_2_0_terminal_output_borrow_terminal_output_t; +} wasi_cli_terminal_output_borrow_terminal_output_t; -typedef wasi_cli_0_2_0_terminal_input_own_terminal_input_t wasi_cli_0_2_0_terminal_stdin_own_terminal_input_t; +typedef wasi_cli_terminal_input_own_terminal_input_t wasi_cli_terminal_stdin_own_terminal_input_t; typedef struct { bool is_some; - wasi_cli_0_2_0_terminal_stdin_own_terminal_input_t val; -} wasi_cli_0_2_0_terminal_stdin_option_own_terminal_input_t; + wasi_cli_terminal_stdin_own_terminal_input_t val; +} wasi_cli_terminal_stdin_option_own_terminal_input_t; -typedef wasi_cli_0_2_0_terminal_output_own_terminal_output_t wasi_cli_0_2_0_terminal_stdout_own_terminal_output_t; +typedef wasi_cli_terminal_output_own_terminal_output_t wasi_cli_terminal_stdout_own_terminal_output_t; typedef struct { bool is_some; - wasi_cli_0_2_0_terminal_stdout_own_terminal_output_t val; -} wasi_cli_0_2_0_terminal_stdout_option_own_terminal_output_t; + wasi_cli_terminal_stdout_own_terminal_output_t val; +} wasi_cli_terminal_stdout_option_own_terminal_output_t; -typedef wasi_cli_0_2_0_terminal_output_own_terminal_output_t wasi_cli_0_2_0_terminal_stderr_own_terminal_output_t; +typedef wasi_cli_terminal_output_own_terminal_output_t wasi_cli_terminal_stderr_own_terminal_output_t; typedef struct { bool is_some; - wasi_cli_0_2_0_terminal_stderr_own_terminal_output_t val; -} wasi_cli_0_2_0_terminal_stderr_option_own_terminal_output_t; + wasi_cli_terminal_stderr_own_terminal_output_t val; +} wasi_cli_terminal_stderr_option_own_terminal_output_t; // An instant in time, in nanoseconds. An instant is relative to an // unspecified initial value, and can only be compared to instances from // the same monotonic-clock. -typedef uint64_t wasi_clocks_0_2_0_monotonic_clock_instant_t; +typedef uint64_t wasi_clocks_monotonic_clock_instant_t; // A duration of time, in nanoseconds. -typedef uint64_t wasi_clocks_0_2_0_monotonic_clock_duration_t; +typedef uint64_t wasi_clocks_monotonic_clock_duration_t; -typedef wasi_io_0_2_0_poll_own_pollable_t wasi_clocks_0_2_0_monotonic_clock_own_pollable_t; +typedef wasi_io_poll_own_pollable_t wasi_clocks_monotonic_clock_own_pollable_t; // A time and date in seconds plus nanoseconds. -typedef struct { - uint64_t seconds; - uint32_t nanoseconds; -} wasi_clocks_0_2_0_wall_clock_datetime_t; +typedef struct wasi_clocks_wall_clock_datetime_t { + uint64_t seconds; + uint32_t nanoseconds; +} wasi_clocks_wall_clock_datetime_t; -typedef wasi_clocks_0_2_0_wall_clock_datetime_t wasi_filesystem_0_2_0_types_datetime_t; +typedef wasi_clocks_wall_clock_datetime_t wasi_filesystem_types_datetime_t; // File size or length of a region within a file. -typedef uint64_t wasi_filesystem_0_2_0_types_filesize_t; +typedef uint64_t wasi_filesystem_types_filesize_t; // The type of a filesystem object referenced by a descriptor. // // Note: This was called `filetype` in earlier versions of WASI. -typedef uint8_t wasi_filesystem_0_2_0_types_descriptor_type_t; +typedef uint8_t wasi_filesystem_types_descriptor_type_t; // The type of the descriptor or file is unknown or is different from // any of the other types specified. -#define WASI_FILESYSTEM_0_2_0_TYPES_DESCRIPTOR_TYPE_UNKNOWN 0 +#define WASI_FILESYSTEM_TYPES_DESCRIPTOR_TYPE_UNKNOWN 0 // The descriptor refers to a block device inode. -#define WASI_FILESYSTEM_0_2_0_TYPES_DESCRIPTOR_TYPE_BLOCK_DEVICE 1 +#define WASI_FILESYSTEM_TYPES_DESCRIPTOR_TYPE_BLOCK_DEVICE 1 // The descriptor refers to a character device inode. -#define WASI_FILESYSTEM_0_2_0_TYPES_DESCRIPTOR_TYPE_CHARACTER_DEVICE 2 +#define WASI_FILESYSTEM_TYPES_DESCRIPTOR_TYPE_CHARACTER_DEVICE 2 // The descriptor refers to a directory inode. -#define WASI_FILESYSTEM_0_2_0_TYPES_DESCRIPTOR_TYPE_DIRECTORY 3 +#define WASI_FILESYSTEM_TYPES_DESCRIPTOR_TYPE_DIRECTORY 3 // The descriptor refers to a named pipe. -#define WASI_FILESYSTEM_0_2_0_TYPES_DESCRIPTOR_TYPE_FIFO 4 +#define WASI_FILESYSTEM_TYPES_DESCRIPTOR_TYPE_FIFO 4 // The file refers to a symbolic link inode. -#define WASI_FILESYSTEM_0_2_0_TYPES_DESCRIPTOR_TYPE_SYMBOLIC_LINK 5 +#define WASI_FILESYSTEM_TYPES_DESCRIPTOR_TYPE_SYMBOLIC_LINK 5 // The descriptor refers to a regular file inode. -#define WASI_FILESYSTEM_0_2_0_TYPES_DESCRIPTOR_TYPE_REGULAR_FILE 6 +#define WASI_FILESYSTEM_TYPES_DESCRIPTOR_TYPE_REGULAR_FILE 6 // The descriptor refers to a socket. -#define WASI_FILESYSTEM_0_2_0_TYPES_DESCRIPTOR_TYPE_SOCKET 7 +#define WASI_FILESYSTEM_TYPES_DESCRIPTOR_TYPE_SOCKET 7 // Descriptor flags. // // Note: This was called `fdflags` in earlier versions of WASI. -typedef uint8_t wasi_filesystem_0_2_0_types_descriptor_flags_t; +typedef uint8_t wasi_filesystem_types_descriptor_flags_t; // Read mode: Data can be read. -#define WASI_FILESYSTEM_0_2_0_TYPES_DESCRIPTOR_FLAGS_READ (1 << 0) +#define WASI_FILESYSTEM_TYPES_DESCRIPTOR_FLAGS_READ (1 << 0) // Write mode: Data can be written to. -#define WASI_FILESYSTEM_0_2_0_TYPES_DESCRIPTOR_FLAGS_WRITE (1 << 1) +#define WASI_FILESYSTEM_TYPES_DESCRIPTOR_FLAGS_WRITE (1 << 1) // Request that writes be performed according to synchronized I/O file // integrity completion. The data stored in the file and the file's // metadata are synchronized. This is similar to `O_SYNC` in POSIX. @@ -238,7 +255,7 @@ typedef uint8_t wasi_filesystem_0_2_0_types_descriptor_flags_t; // The precise semantics of this operation have not yet been defined for // WASI. At this time, it should be interpreted as a request, and not a // requirement. -#define WASI_FILESYSTEM_0_2_0_TYPES_DESCRIPTOR_FLAGS_FILE_INTEGRITY_SYNC (1 << 2) +#define WASI_FILESYSTEM_TYPES_DESCRIPTOR_FLAGS_FILE_INTEGRITY_SYNC (1 << 2) // Request that writes be performed according to synchronized I/O data // integrity completion. Only the data stored in the file is // synchronized. This is similar to `O_DSYNC` in POSIX. @@ -246,14 +263,14 @@ typedef uint8_t wasi_filesystem_0_2_0_types_descriptor_flags_t; // The precise semantics of this operation have not yet been defined for // WASI. At this time, it should be interpreted as a request, and not a // requirement. -#define WASI_FILESYSTEM_0_2_0_TYPES_DESCRIPTOR_FLAGS_DATA_INTEGRITY_SYNC (1 << 3) +#define WASI_FILESYSTEM_TYPES_DESCRIPTOR_FLAGS_DATA_INTEGRITY_SYNC (1 << 3) // Requests that reads be performed at the same level of integrety // requested for writes. This is similar to `O_RSYNC` in POSIX. // // The precise semantics of this operation have not yet been defined for // WASI. At this time, it should be interpreted as a request, and not a // requirement. -#define WASI_FILESYSTEM_0_2_0_TYPES_DESCRIPTOR_FLAGS_REQUESTED_WRITE_SYNC (1 << 4) +#define WASI_FILESYSTEM_TYPES_DESCRIPTOR_FLAGS_REQUESTED_WRITE_SYNC (1 << 4) // Mutating directories mode: Directory contents may be mutated. // // When this flag is unset on a descriptor, operations using the @@ -263,363 +280,358 @@ typedef uint8_t wasi_filesystem_0_2_0_types_descriptor_flags_t; // they would otherwise succeed. // // This may only be set on directories. -#define WASI_FILESYSTEM_0_2_0_TYPES_DESCRIPTOR_FLAGS_MUTATE_DIRECTORY (1 << 5) +#define WASI_FILESYSTEM_TYPES_DESCRIPTOR_FLAGS_MUTATE_DIRECTORY (1 << 5) // Flags determining the method of how paths are resolved. -typedef uint8_t wasi_filesystem_0_2_0_types_path_flags_t; +typedef uint8_t wasi_filesystem_types_path_flags_t; // As long as the resolved path corresponds to a symbolic link, it is // expanded. -#define WASI_FILESYSTEM_0_2_0_TYPES_PATH_FLAGS_SYMLINK_FOLLOW (1 << 0) +#define WASI_FILESYSTEM_TYPES_PATH_FLAGS_SYMLINK_FOLLOW (1 << 0) // Open flags used by `open-at`. -typedef uint8_t wasi_filesystem_0_2_0_types_open_flags_t; +typedef uint8_t wasi_filesystem_types_open_flags_t; // Create file if it does not exist, similar to `O_CREAT` in POSIX. -#define WASI_FILESYSTEM_0_2_0_TYPES_OPEN_FLAGS_CREATE (1 << 0) +#define WASI_FILESYSTEM_TYPES_OPEN_FLAGS_CREATE (1 << 0) // Fail if not a directory, similar to `O_DIRECTORY` in POSIX. -#define WASI_FILESYSTEM_0_2_0_TYPES_OPEN_FLAGS_DIRECTORY (1 << 1) +#define WASI_FILESYSTEM_TYPES_OPEN_FLAGS_DIRECTORY (1 << 1) // Fail if file already exists, similar to `O_EXCL` in POSIX. -#define WASI_FILESYSTEM_0_2_0_TYPES_OPEN_FLAGS_EXCLUSIVE (1 << 2) +#define WASI_FILESYSTEM_TYPES_OPEN_FLAGS_EXCLUSIVE (1 << 2) // Truncate file to size 0, similar to `O_TRUNC` in POSIX. -#define WASI_FILESYSTEM_0_2_0_TYPES_OPEN_FLAGS_TRUNCATE (1 << 3) +#define WASI_FILESYSTEM_TYPES_OPEN_FLAGS_TRUNCATE (1 << 3) // Number of hard links to an inode. -typedef uint64_t wasi_filesystem_0_2_0_types_link_count_t; +typedef uint64_t wasi_filesystem_types_link_count_t; typedef struct { bool is_some; - wasi_filesystem_0_2_0_types_datetime_t val; -} wasi_filesystem_0_2_0_types_option_datetime_t; + wasi_filesystem_types_datetime_t val; +} wasi_filesystem_types_option_datetime_t; // File attributes. // // Note: This was called `filestat` in earlier versions of WASI. -typedef struct { +typedef struct wasi_filesystem_types_descriptor_stat_t { // File type. - wasi_filesystem_0_2_0_types_descriptor_type_t type; + wasi_filesystem_types_descriptor_type_t type; // Number of hard links to the file. - wasi_filesystem_0_2_0_types_link_count_t link_count; + wasi_filesystem_types_link_count_t link_count; // For regular files, the file size in bytes. For symbolic links, the // length in bytes of the pathname contained in the symbolic link. - wasi_filesystem_0_2_0_types_filesize_t size; + wasi_filesystem_types_filesize_t size; // Last data access timestamp. // // If the `option` is none, the platform doesn't maintain an access // timestamp for this file. - wasi_filesystem_0_2_0_types_option_datetime_t data_access_timestamp; + wasi_filesystem_types_option_datetime_t data_access_timestamp; // Last data modification timestamp. // // If the `option` is none, the platform doesn't maintain a // modification timestamp for this file. - wasi_filesystem_0_2_0_types_option_datetime_t data_modification_timestamp; + wasi_filesystem_types_option_datetime_t data_modification_timestamp; // Last file status-change timestamp. // // If the `option` is none, the platform doesn't maintain a // status-change timestamp for this file. - wasi_filesystem_0_2_0_types_option_datetime_t status_change_timestamp; -} wasi_filesystem_0_2_0_types_descriptor_stat_t; + wasi_filesystem_types_option_datetime_t status_change_timestamp; +} wasi_filesystem_types_descriptor_stat_t; // When setting a timestamp, this gives the value to set it to. -typedef struct { +typedef struct wasi_filesystem_types_new_timestamp_t { uint8_t tag; union { - wasi_filesystem_0_2_0_types_datetime_t timestamp; + wasi_filesystem_types_datetime_t timestamp; } val; -} wasi_filesystem_0_2_0_types_new_timestamp_t; +} wasi_filesystem_types_new_timestamp_t; // Leave the timestamp set to its previous value. -#define WASI_FILESYSTEM_0_2_0_TYPES_NEW_TIMESTAMP_NO_CHANGE 0 +#define WASI_FILESYSTEM_TYPES_NEW_TIMESTAMP_NO_CHANGE 0 // Set the timestamp to the current time of the system clock associated // with the filesystem. -#define WASI_FILESYSTEM_0_2_0_TYPES_NEW_TIMESTAMP_NOW 1 +#define WASI_FILESYSTEM_TYPES_NEW_TIMESTAMP_NOW 1 // Set the timestamp to the given value. -#define WASI_FILESYSTEM_0_2_0_TYPES_NEW_TIMESTAMP_TIMESTAMP 2 +#define WASI_FILESYSTEM_TYPES_NEW_TIMESTAMP_TIMESTAMP 2 // A directory entry. -typedef struct { +typedef struct wasi_filesystem_types_directory_entry_t { // The type of the file referred to by this directory entry. - wasi_filesystem_0_2_0_types_descriptor_type_t type; + wasi_filesystem_types_descriptor_type_t type; // The name of the object. - bindings_string_t name; -} wasi_filesystem_0_2_0_types_directory_entry_t; + bindings_string_t name; +} wasi_filesystem_types_directory_entry_t; // Error codes returned by functions, similar to `errno` in POSIX. // Not all of these error codes are returned by the functions provided by this // API; some are used in higher-level library layers, and others are provided // merely for alignment with POSIX. -typedef uint8_t wasi_filesystem_0_2_0_types_error_code_t; +typedef uint8_t wasi_filesystem_types_error_code_t; // Permission denied, similar to `EACCES` in POSIX. -#define WASI_FILESYSTEM_0_2_0_TYPES_ERROR_CODE_ACCESS 0 +#define WASI_FILESYSTEM_TYPES_ERROR_CODE_ACCESS 0 // Resource unavailable, or operation would block, similar to `EAGAIN` and `EWOULDBLOCK` in POSIX. -#define WASI_FILESYSTEM_0_2_0_TYPES_ERROR_CODE_WOULD_BLOCK 1 +#define WASI_FILESYSTEM_TYPES_ERROR_CODE_WOULD_BLOCK 1 // Connection already in progress, similar to `EALREADY` in POSIX. -#define WASI_FILESYSTEM_0_2_0_TYPES_ERROR_CODE_ALREADY 2 +#define WASI_FILESYSTEM_TYPES_ERROR_CODE_ALREADY 2 // Bad descriptor, similar to `EBADF` in POSIX. -#define WASI_FILESYSTEM_0_2_0_TYPES_ERROR_CODE_BAD_DESCRIPTOR 3 +#define WASI_FILESYSTEM_TYPES_ERROR_CODE_BAD_DESCRIPTOR 3 // Device or resource busy, similar to `EBUSY` in POSIX. -#define WASI_FILESYSTEM_0_2_0_TYPES_ERROR_CODE_BUSY 4 +#define WASI_FILESYSTEM_TYPES_ERROR_CODE_BUSY 4 // Resource deadlock would occur, similar to `EDEADLK` in POSIX. -#define WASI_FILESYSTEM_0_2_0_TYPES_ERROR_CODE_DEADLOCK 5 +#define WASI_FILESYSTEM_TYPES_ERROR_CODE_DEADLOCK 5 // Storage quota exceeded, similar to `EDQUOT` in POSIX. -#define WASI_FILESYSTEM_0_2_0_TYPES_ERROR_CODE_QUOTA 6 +#define WASI_FILESYSTEM_TYPES_ERROR_CODE_QUOTA 6 // File exists, similar to `EEXIST` in POSIX. -#define WASI_FILESYSTEM_0_2_0_TYPES_ERROR_CODE_EXIST 7 +#define WASI_FILESYSTEM_TYPES_ERROR_CODE_EXIST 7 // File too large, similar to `EFBIG` in POSIX. -#define WASI_FILESYSTEM_0_2_0_TYPES_ERROR_CODE_FILE_TOO_LARGE 8 +#define WASI_FILESYSTEM_TYPES_ERROR_CODE_FILE_TOO_LARGE 8 // Illegal byte sequence, similar to `EILSEQ` in POSIX. -#define WASI_FILESYSTEM_0_2_0_TYPES_ERROR_CODE_ILLEGAL_BYTE_SEQUENCE 9 +#define WASI_FILESYSTEM_TYPES_ERROR_CODE_ILLEGAL_BYTE_SEQUENCE 9 // Operation in progress, similar to `EINPROGRESS` in POSIX. -#define WASI_FILESYSTEM_0_2_0_TYPES_ERROR_CODE_IN_PROGRESS 10 +#define WASI_FILESYSTEM_TYPES_ERROR_CODE_IN_PROGRESS 10 // Interrupted function, similar to `EINTR` in POSIX. -#define WASI_FILESYSTEM_0_2_0_TYPES_ERROR_CODE_INTERRUPTED 11 +#define WASI_FILESYSTEM_TYPES_ERROR_CODE_INTERRUPTED 11 // Invalid argument, similar to `EINVAL` in POSIX. -#define WASI_FILESYSTEM_0_2_0_TYPES_ERROR_CODE_INVALID 12 +#define WASI_FILESYSTEM_TYPES_ERROR_CODE_INVALID 12 // I/O error, similar to `EIO` in POSIX. -#define WASI_FILESYSTEM_0_2_0_TYPES_ERROR_CODE_IO 13 +#define WASI_FILESYSTEM_TYPES_ERROR_CODE_IO 13 // Is a directory, similar to `EISDIR` in POSIX. -#define WASI_FILESYSTEM_0_2_0_TYPES_ERROR_CODE_IS_DIRECTORY 14 +#define WASI_FILESYSTEM_TYPES_ERROR_CODE_IS_DIRECTORY 14 // Too many levels of symbolic links, similar to `ELOOP` in POSIX. -#define WASI_FILESYSTEM_0_2_0_TYPES_ERROR_CODE_LOOP 15 +#define WASI_FILESYSTEM_TYPES_ERROR_CODE_LOOP 15 // Too many links, similar to `EMLINK` in POSIX. -#define WASI_FILESYSTEM_0_2_0_TYPES_ERROR_CODE_TOO_MANY_LINKS 16 +#define WASI_FILESYSTEM_TYPES_ERROR_CODE_TOO_MANY_LINKS 16 // Message too large, similar to `EMSGSIZE` in POSIX. -#define WASI_FILESYSTEM_0_2_0_TYPES_ERROR_CODE_MESSAGE_SIZE 17 +#define WASI_FILESYSTEM_TYPES_ERROR_CODE_MESSAGE_SIZE 17 // Filename too long, similar to `ENAMETOOLONG` in POSIX. -#define WASI_FILESYSTEM_0_2_0_TYPES_ERROR_CODE_NAME_TOO_LONG 18 +#define WASI_FILESYSTEM_TYPES_ERROR_CODE_NAME_TOO_LONG 18 // No such device, similar to `ENODEV` in POSIX. -#define WASI_FILESYSTEM_0_2_0_TYPES_ERROR_CODE_NO_DEVICE 19 +#define WASI_FILESYSTEM_TYPES_ERROR_CODE_NO_DEVICE 19 // No such file or directory, similar to `ENOENT` in POSIX. -#define WASI_FILESYSTEM_0_2_0_TYPES_ERROR_CODE_NO_ENTRY 20 +#define WASI_FILESYSTEM_TYPES_ERROR_CODE_NO_ENTRY 20 // No locks available, similar to `ENOLCK` in POSIX. -#define WASI_FILESYSTEM_0_2_0_TYPES_ERROR_CODE_NO_LOCK 21 +#define WASI_FILESYSTEM_TYPES_ERROR_CODE_NO_LOCK 21 // Not enough space, similar to `ENOMEM` in POSIX. -#define WASI_FILESYSTEM_0_2_0_TYPES_ERROR_CODE_INSUFFICIENT_MEMORY 22 +#define WASI_FILESYSTEM_TYPES_ERROR_CODE_INSUFFICIENT_MEMORY 22 // No space left on device, similar to `ENOSPC` in POSIX. -#define WASI_FILESYSTEM_0_2_0_TYPES_ERROR_CODE_INSUFFICIENT_SPACE 23 +#define WASI_FILESYSTEM_TYPES_ERROR_CODE_INSUFFICIENT_SPACE 23 // Not a directory or a symbolic link to a directory, similar to `ENOTDIR` in POSIX. -#define WASI_FILESYSTEM_0_2_0_TYPES_ERROR_CODE_NOT_DIRECTORY 24 +#define WASI_FILESYSTEM_TYPES_ERROR_CODE_NOT_DIRECTORY 24 // Directory not empty, similar to `ENOTEMPTY` in POSIX. -#define WASI_FILESYSTEM_0_2_0_TYPES_ERROR_CODE_NOT_EMPTY 25 +#define WASI_FILESYSTEM_TYPES_ERROR_CODE_NOT_EMPTY 25 // State not recoverable, similar to `ENOTRECOVERABLE` in POSIX. -#define WASI_FILESYSTEM_0_2_0_TYPES_ERROR_CODE_NOT_RECOVERABLE 26 +#define WASI_FILESYSTEM_TYPES_ERROR_CODE_NOT_RECOVERABLE 26 // Not supported, similar to `ENOTSUP` and `ENOSYS` in POSIX. -#define WASI_FILESYSTEM_0_2_0_TYPES_ERROR_CODE_UNSUPPORTED 27 +#define WASI_FILESYSTEM_TYPES_ERROR_CODE_UNSUPPORTED 27 // Inappropriate I/O control operation, similar to `ENOTTY` in POSIX. -#define WASI_FILESYSTEM_0_2_0_TYPES_ERROR_CODE_NO_TTY 28 +#define WASI_FILESYSTEM_TYPES_ERROR_CODE_NO_TTY 28 // No such device or address, similar to `ENXIO` in POSIX. -#define WASI_FILESYSTEM_0_2_0_TYPES_ERROR_CODE_NO_SUCH_DEVICE 29 +#define WASI_FILESYSTEM_TYPES_ERROR_CODE_NO_SUCH_DEVICE 29 // Value too large to be stored in data type, similar to `EOVERFLOW` in POSIX. -#define WASI_FILESYSTEM_0_2_0_TYPES_ERROR_CODE_OVERFLOW 30 +#define WASI_FILESYSTEM_TYPES_ERROR_CODE_OVERFLOW 30 // Operation not permitted, similar to `EPERM` in POSIX. -#define WASI_FILESYSTEM_0_2_0_TYPES_ERROR_CODE_NOT_PERMITTED 31 +#define WASI_FILESYSTEM_TYPES_ERROR_CODE_NOT_PERMITTED 31 // Broken pipe, similar to `EPIPE` in POSIX. -#define WASI_FILESYSTEM_0_2_0_TYPES_ERROR_CODE_PIPE 32 +#define WASI_FILESYSTEM_TYPES_ERROR_CODE_PIPE 32 // Read-only file system, similar to `EROFS` in POSIX. -#define WASI_FILESYSTEM_0_2_0_TYPES_ERROR_CODE_READ_ONLY 33 +#define WASI_FILESYSTEM_TYPES_ERROR_CODE_READ_ONLY 33 // Invalid seek, similar to `ESPIPE` in POSIX. -#define WASI_FILESYSTEM_0_2_0_TYPES_ERROR_CODE_INVALID_SEEK 34 +#define WASI_FILESYSTEM_TYPES_ERROR_CODE_INVALID_SEEK 34 // Text file busy, similar to `ETXTBSY` in POSIX. -#define WASI_FILESYSTEM_0_2_0_TYPES_ERROR_CODE_TEXT_FILE_BUSY 35 +#define WASI_FILESYSTEM_TYPES_ERROR_CODE_TEXT_FILE_BUSY 35 // Cross-device link, similar to `EXDEV` in POSIX. -#define WASI_FILESYSTEM_0_2_0_TYPES_ERROR_CODE_CROSS_DEVICE 36 +#define WASI_FILESYSTEM_TYPES_ERROR_CODE_CROSS_DEVICE 36 // File or memory access pattern advisory information. -typedef uint8_t wasi_filesystem_0_2_0_types_advice_t; +typedef uint8_t wasi_filesystem_types_advice_t; // The application has no advice to give on its behavior with respect // to the specified data. -#define WASI_FILESYSTEM_0_2_0_TYPES_ADVICE_NORMAL 0 +#define WASI_FILESYSTEM_TYPES_ADVICE_NORMAL 0 // The application expects to access the specified data sequentially // from lower offsets to higher offsets. -#define WASI_FILESYSTEM_0_2_0_TYPES_ADVICE_SEQUENTIAL 1 +#define WASI_FILESYSTEM_TYPES_ADVICE_SEQUENTIAL 1 // The application expects to access the specified data in a random // order. -#define WASI_FILESYSTEM_0_2_0_TYPES_ADVICE_RANDOM 2 +#define WASI_FILESYSTEM_TYPES_ADVICE_RANDOM 2 // The application expects to access the specified data in the near // future. -#define WASI_FILESYSTEM_0_2_0_TYPES_ADVICE_WILL_NEED 3 +#define WASI_FILESYSTEM_TYPES_ADVICE_WILL_NEED 3 // The application expects that it will not access the specified data // in the near future. -#define WASI_FILESYSTEM_0_2_0_TYPES_ADVICE_DONT_NEED 4 +#define WASI_FILESYSTEM_TYPES_ADVICE_DONT_NEED 4 // The application expects to access the specified data once and then // not reuse it thereafter. -#define WASI_FILESYSTEM_0_2_0_TYPES_ADVICE_NO_REUSE 5 +#define WASI_FILESYSTEM_TYPES_ADVICE_NO_REUSE 5 // A 128-bit hash value, split into parts because wasm doesn't have a // 128-bit integer type. -typedef struct { +typedef struct wasi_filesystem_types_metadata_hash_value_t { // 64 bits of a 128-bit hash value. - uint64_t lower; + uint64_t lower; // Another 64 bits of a 128-bit hash value. - uint64_t upper; -} wasi_filesystem_0_2_0_types_metadata_hash_value_t; + uint64_t upper; +} wasi_filesystem_types_metadata_hash_value_t; -typedef struct wasi_filesystem_0_2_0_types_own_descriptor_t { +typedef struct wasi_filesystem_types_own_descriptor_t { int32_t __handle; -} wasi_filesystem_0_2_0_types_own_descriptor_t; +} wasi_filesystem_types_own_descriptor_t; -typedef struct wasi_filesystem_0_2_0_types_borrow_descriptor_t { +typedef struct wasi_filesystem_types_borrow_descriptor_t { int32_t __handle; -} wasi_filesystem_0_2_0_types_borrow_descriptor_t; +} wasi_filesystem_types_borrow_descriptor_t; -typedef struct wasi_filesystem_0_2_0_types_own_directory_entry_stream_t { +typedef struct wasi_filesystem_types_own_directory_entry_stream_t { int32_t __handle; -} wasi_filesystem_0_2_0_types_own_directory_entry_stream_t; +} wasi_filesystem_types_own_directory_entry_stream_t; -typedef struct wasi_filesystem_0_2_0_types_borrow_directory_entry_stream_t { +typedef struct wasi_filesystem_types_borrow_directory_entry_stream_t { int32_t __handle; -} wasi_filesystem_0_2_0_types_borrow_directory_entry_stream_t; +} wasi_filesystem_types_borrow_directory_entry_stream_t; -typedef wasi_io_0_2_0_streams_own_input_stream_t wasi_filesystem_0_2_0_types_own_input_stream_t; +typedef wasi_io_streams_own_input_stream_t wasi_filesystem_types_own_input_stream_t; typedef struct { bool is_err; union { - wasi_filesystem_0_2_0_types_own_input_stream_t ok; - wasi_filesystem_0_2_0_types_error_code_t err; + wasi_filesystem_types_own_input_stream_t ok; + wasi_filesystem_types_error_code_t err; } val; -} wasi_filesystem_0_2_0_types_result_own_input_stream_error_code_t; +} wasi_filesystem_types_result_own_input_stream_error_code_t; -typedef wasi_io_0_2_0_streams_own_output_stream_t wasi_filesystem_0_2_0_types_own_output_stream_t; +typedef wasi_io_streams_own_output_stream_t wasi_filesystem_types_own_output_stream_t; typedef struct { bool is_err; union { - wasi_filesystem_0_2_0_types_own_output_stream_t ok; - wasi_filesystem_0_2_0_types_error_code_t err; + wasi_filesystem_types_own_output_stream_t ok; + wasi_filesystem_types_error_code_t err; } val; -} wasi_filesystem_0_2_0_types_result_own_output_stream_error_code_t; +} wasi_filesystem_types_result_own_output_stream_error_code_t; typedef struct { bool is_err; union { - wasi_filesystem_0_2_0_types_error_code_t err; + wasi_filesystem_types_error_code_t err; } val; -} wasi_filesystem_0_2_0_types_result_void_error_code_t; +} wasi_filesystem_types_result_void_error_code_t; typedef struct { bool is_err; union { - wasi_filesystem_0_2_0_types_descriptor_flags_t ok; - wasi_filesystem_0_2_0_types_error_code_t err; + wasi_filesystem_types_descriptor_flags_t ok; + wasi_filesystem_types_error_code_t err; } val; -} wasi_filesystem_0_2_0_types_result_descriptor_flags_error_code_t; +} wasi_filesystem_types_result_descriptor_flags_error_code_t; typedef struct { bool is_err; union { - wasi_filesystem_0_2_0_types_descriptor_type_t ok; - wasi_filesystem_0_2_0_types_error_code_t err; + wasi_filesystem_types_descriptor_type_t ok; + wasi_filesystem_types_error_code_t err; } val; -} wasi_filesystem_0_2_0_types_result_descriptor_type_error_code_t; +} wasi_filesystem_types_result_descriptor_type_error_code_t; typedef struct { - uint8_t *ptr; - size_t len; -} wasi_filesystem_0_2_0_types_list_u8_t; - -typedef struct { - wasi_filesystem_0_2_0_types_list_u8_t f0; + bindings_list_u8_t f0; bool f1; -} wasi_filesystem_0_2_0_types_tuple2_list_u8_bool_t; +} bindings_tuple2_list_u8_bool_t; typedef struct { bool is_err; union { - wasi_filesystem_0_2_0_types_tuple2_list_u8_bool_t ok; - wasi_filesystem_0_2_0_types_error_code_t err; + bindings_tuple2_list_u8_bool_t ok; + wasi_filesystem_types_error_code_t err; } val; -} wasi_filesystem_0_2_0_types_result_tuple2_list_u8_bool_error_code_t; +} wasi_filesystem_types_result_tuple2_list_u8_bool_error_code_t; typedef struct { bool is_err; union { - wasi_filesystem_0_2_0_types_filesize_t ok; - wasi_filesystem_0_2_0_types_error_code_t err; + wasi_filesystem_types_filesize_t ok; + wasi_filesystem_types_error_code_t err; } val; -} wasi_filesystem_0_2_0_types_result_filesize_error_code_t; +} wasi_filesystem_types_result_filesize_error_code_t; typedef struct { bool is_err; union { - wasi_filesystem_0_2_0_types_own_directory_entry_stream_t ok; - wasi_filesystem_0_2_0_types_error_code_t err; + wasi_filesystem_types_own_directory_entry_stream_t ok; + wasi_filesystem_types_error_code_t err; } val; -} wasi_filesystem_0_2_0_types_result_own_directory_entry_stream_error_code_t; +} wasi_filesystem_types_result_own_directory_entry_stream_error_code_t; typedef struct { bool is_err; union { - wasi_filesystem_0_2_0_types_descriptor_stat_t ok; - wasi_filesystem_0_2_0_types_error_code_t err; + wasi_filesystem_types_descriptor_stat_t ok; + wasi_filesystem_types_error_code_t err; } val; -} wasi_filesystem_0_2_0_types_result_descriptor_stat_error_code_t; +} wasi_filesystem_types_result_descriptor_stat_error_code_t; typedef struct { bool is_err; union { - wasi_filesystem_0_2_0_types_own_descriptor_t ok; - wasi_filesystem_0_2_0_types_error_code_t err; + wasi_filesystem_types_own_descriptor_t ok; + wasi_filesystem_types_error_code_t err; } val; -} wasi_filesystem_0_2_0_types_result_own_descriptor_error_code_t; +} wasi_filesystem_types_result_own_descriptor_error_code_t; typedef struct { bool is_err; union { bindings_string_t ok; - wasi_filesystem_0_2_0_types_error_code_t err; + wasi_filesystem_types_error_code_t err; } val; -} wasi_filesystem_0_2_0_types_result_string_error_code_t; +} wasi_filesystem_types_result_string_error_code_t; typedef struct { bool is_err; union { - wasi_filesystem_0_2_0_types_metadata_hash_value_t ok; - wasi_filesystem_0_2_0_types_error_code_t err; + wasi_filesystem_types_metadata_hash_value_t ok; + wasi_filesystem_types_error_code_t err; } val; -} wasi_filesystem_0_2_0_types_result_metadata_hash_value_error_code_t; +} wasi_filesystem_types_result_metadata_hash_value_error_code_t; typedef struct { bool is_some; - wasi_filesystem_0_2_0_types_directory_entry_t val; -} wasi_filesystem_0_2_0_types_option_directory_entry_t; + wasi_filesystem_types_directory_entry_t val; +} wasi_filesystem_types_option_directory_entry_t; typedef struct { bool is_err; union { - wasi_filesystem_0_2_0_types_option_directory_entry_t ok; - wasi_filesystem_0_2_0_types_error_code_t err; + wasi_filesystem_types_option_directory_entry_t ok; + wasi_filesystem_types_error_code_t err; } val; -} wasi_filesystem_0_2_0_types_result_option_directory_entry_error_code_t; +} wasi_filesystem_types_result_option_directory_entry_error_code_t; -typedef wasi_io_0_2_0_error_borrow_error_t wasi_filesystem_0_2_0_types_borrow_error_t; +typedef wasi_io_error_borrow_error_t wasi_filesystem_types_borrow_error_t; typedef struct { bool is_some; - wasi_filesystem_0_2_0_types_error_code_t val; -} wasi_filesystem_0_2_0_types_option_error_code_t; + wasi_filesystem_types_error_code_t val; +} wasi_filesystem_types_option_error_code_t; -typedef wasi_filesystem_0_2_0_types_own_descriptor_t wasi_filesystem_0_2_0_preopens_own_descriptor_t; +typedef wasi_filesystem_types_own_descriptor_t wasi_filesystem_preopens_own_descriptor_t; typedef struct { - wasi_filesystem_0_2_0_preopens_own_descriptor_t f0; + wasi_filesystem_preopens_own_descriptor_t f0; bindings_string_t f1; -} wasi_filesystem_0_2_0_preopens_tuple2_own_descriptor_string_t; +} wasi_filesystem_preopens_tuple2_own_descriptor_string_t; typedef struct { - wasi_filesystem_0_2_0_preopens_tuple2_own_descriptor_string_t *ptr; + wasi_filesystem_preopens_tuple2_own_descriptor_string_t *ptr; size_t len; -} wasi_filesystem_0_2_0_preopens_list_tuple2_own_descriptor_string_t; +} wasi_filesystem_preopens_list_tuple2_own_descriptor_string_t; -typedef struct wasi_sockets_0_2_0_network_own_network_t { +typedef struct wasi_sockets_network_own_network_t { int32_t __handle; -} wasi_sockets_0_2_0_network_own_network_t; +} wasi_sockets_network_own_network_t; -typedef struct wasi_sockets_0_2_0_network_borrow_network_t { +typedef struct wasi_sockets_network_borrow_network_t { int32_t __handle; -} wasi_sockets_0_2_0_network_borrow_network_t; +} wasi_sockets_network_borrow_network_t; // Error codes. // @@ -633,169 +645,164 @@ typedef struct wasi_sockets_0_2_0_network_borrow_network_t { // - `concurrency-conflict` // // See each individual API for what the POSIX equivalents are. They sometimes differ per API. -typedef uint8_t wasi_sockets_0_2_0_network_error_code_t; +typedef uint8_t wasi_sockets_network_error_code_t; // Unknown error -#define WASI_SOCKETS_0_2_0_NETWORK_ERROR_CODE_UNKNOWN 0 +#define WASI_SOCKETS_NETWORK_ERROR_CODE_UNKNOWN 0 // Access denied. // // POSIX equivalent: EACCES, EPERM -#define WASI_SOCKETS_0_2_0_NETWORK_ERROR_CODE_ACCESS_DENIED 1 +#define WASI_SOCKETS_NETWORK_ERROR_CODE_ACCESS_DENIED 1 // The operation is not supported. // // POSIX equivalent: EOPNOTSUPP -#define WASI_SOCKETS_0_2_0_NETWORK_ERROR_CODE_NOT_SUPPORTED 2 +#define WASI_SOCKETS_NETWORK_ERROR_CODE_NOT_SUPPORTED 2 // One of the arguments is invalid. // // POSIX equivalent: EINVAL -#define WASI_SOCKETS_0_2_0_NETWORK_ERROR_CODE_INVALID_ARGUMENT 3 +#define WASI_SOCKETS_NETWORK_ERROR_CODE_INVALID_ARGUMENT 3 // Not enough memory to complete the operation. // // POSIX equivalent: ENOMEM, ENOBUFS, EAI_MEMORY -#define WASI_SOCKETS_0_2_0_NETWORK_ERROR_CODE_OUT_OF_MEMORY 4 +#define WASI_SOCKETS_NETWORK_ERROR_CODE_OUT_OF_MEMORY 4 // The operation timed out before it could finish completely. -#define WASI_SOCKETS_0_2_0_NETWORK_ERROR_CODE_TIMEOUT 5 +#define WASI_SOCKETS_NETWORK_ERROR_CODE_TIMEOUT 5 // This operation is incompatible with another asynchronous operation that is already in progress. // // POSIX equivalent: EALREADY -#define WASI_SOCKETS_0_2_0_NETWORK_ERROR_CODE_CONCURRENCY_CONFLICT 6 +#define WASI_SOCKETS_NETWORK_ERROR_CODE_CONCURRENCY_CONFLICT 6 // Trying to finish an asynchronous operation that: // - has not been started yet, or: // - was already finished by a previous `finish-*` call. // // Note: this is scheduled to be removed when `future`s are natively supported. -#define WASI_SOCKETS_0_2_0_NETWORK_ERROR_CODE_NOT_IN_PROGRESS 7 +#define WASI_SOCKETS_NETWORK_ERROR_CODE_NOT_IN_PROGRESS 7 // The operation has been aborted because it could not be completed immediately. // // Note: this is scheduled to be removed when `future`s are natively supported. -#define WASI_SOCKETS_0_2_0_NETWORK_ERROR_CODE_WOULD_BLOCK 8 +#define WASI_SOCKETS_NETWORK_ERROR_CODE_WOULD_BLOCK 8 // The operation is not valid in the socket's current state. -#define WASI_SOCKETS_0_2_0_NETWORK_ERROR_CODE_INVALID_STATE 9 +#define WASI_SOCKETS_NETWORK_ERROR_CODE_INVALID_STATE 9 // A new socket resource could not be created because of a system limit. -#define WASI_SOCKETS_0_2_0_NETWORK_ERROR_CODE_NEW_SOCKET_LIMIT 10 +#define WASI_SOCKETS_NETWORK_ERROR_CODE_NEW_SOCKET_LIMIT 10 // A bind operation failed because the provided address is not an address that the `network` can bind to. -#define WASI_SOCKETS_0_2_0_NETWORK_ERROR_CODE_ADDRESS_NOT_BINDABLE 11 +#define WASI_SOCKETS_NETWORK_ERROR_CODE_ADDRESS_NOT_BINDABLE 11 // A bind operation failed because the provided address is already in use or because there are no ephemeral ports available. -#define WASI_SOCKETS_0_2_0_NETWORK_ERROR_CODE_ADDRESS_IN_USE 12 +#define WASI_SOCKETS_NETWORK_ERROR_CODE_ADDRESS_IN_USE 12 // The remote address is not reachable -#define WASI_SOCKETS_0_2_0_NETWORK_ERROR_CODE_REMOTE_UNREACHABLE 13 +#define WASI_SOCKETS_NETWORK_ERROR_CODE_REMOTE_UNREACHABLE 13 // The TCP connection was forcefully rejected -#define WASI_SOCKETS_0_2_0_NETWORK_ERROR_CODE_CONNECTION_REFUSED 14 +#define WASI_SOCKETS_NETWORK_ERROR_CODE_CONNECTION_REFUSED 14 // The TCP connection was reset. -#define WASI_SOCKETS_0_2_0_NETWORK_ERROR_CODE_CONNECTION_RESET 15 +#define WASI_SOCKETS_NETWORK_ERROR_CODE_CONNECTION_RESET 15 // A TCP connection was aborted. -#define WASI_SOCKETS_0_2_0_NETWORK_ERROR_CODE_CONNECTION_ABORTED 16 +#define WASI_SOCKETS_NETWORK_ERROR_CODE_CONNECTION_ABORTED 16 // The size of a datagram sent to a UDP socket exceeded the maximum // supported size. -#define WASI_SOCKETS_0_2_0_NETWORK_ERROR_CODE_DATAGRAM_TOO_LARGE 17 +#define WASI_SOCKETS_NETWORK_ERROR_CODE_DATAGRAM_TOO_LARGE 17 // Name does not exist or has no suitable associated IP addresses. -#define WASI_SOCKETS_0_2_0_NETWORK_ERROR_CODE_NAME_UNRESOLVABLE 18 +#define WASI_SOCKETS_NETWORK_ERROR_CODE_NAME_UNRESOLVABLE 18 // A temporary failure in name resolution occurred. -#define WASI_SOCKETS_0_2_0_NETWORK_ERROR_CODE_TEMPORARY_RESOLVER_FAILURE 19 +#define WASI_SOCKETS_NETWORK_ERROR_CODE_TEMPORARY_RESOLVER_FAILURE 19 // A permanent failure in name resolution occurred. -#define WASI_SOCKETS_0_2_0_NETWORK_ERROR_CODE_PERMANENT_RESOLVER_FAILURE 20 +#define WASI_SOCKETS_NETWORK_ERROR_CODE_PERMANENT_RESOLVER_FAILURE 20 -typedef uint8_t wasi_sockets_0_2_0_network_ip_address_family_t; +typedef uint8_t wasi_sockets_network_ip_address_family_t; // Similar to `AF_INET` in POSIX. -#define WASI_SOCKETS_0_2_0_NETWORK_IP_ADDRESS_FAMILY_IPV4 0 +#define WASI_SOCKETS_NETWORK_IP_ADDRESS_FAMILY_IPV4 0 // Similar to `AF_INET6` in POSIX. -#define WASI_SOCKETS_0_2_0_NETWORK_IP_ADDRESS_FAMILY_IPV6 1 - -typedef struct { - uint8_t f0; - uint8_t f1; - uint8_t f2; - uint8_t f3; -} wasi_sockets_0_2_0_network_ipv4_address_t; - -typedef struct { - uint16_t f0; - uint16_t f1; - uint16_t f2; - uint16_t f3; - uint16_t f4; - uint16_t f5; - uint16_t f6; - uint16_t f7; -} wasi_sockets_0_2_0_network_ipv6_address_t; - -typedef struct { +#define WASI_SOCKETS_NETWORK_IP_ADDRESS_FAMILY_IPV6 1 + +typedef struct wasi_sockets_network_ipv4_address_t { + uint8_t f0; + uint8_t f1; + uint8_t f2; + uint8_t f3; +} wasi_sockets_network_ipv4_address_t; + +typedef struct wasi_sockets_network_ipv6_address_t { + uint16_t f0; + uint16_t f1; + uint16_t f2; + uint16_t f3; + uint16_t f4; + uint16_t f5; + uint16_t f6; + uint16_t f7; +} wasi_sockets_network_ipv6_address_t; + +typedef struct wasi_sockets_network_ip_address_t { uint8_t tag; union { - wasi_sockets_0_2_0_network_ipv4_address_t ipv4; - wasi_sockets_0_2_0_network_ipv6_address_t ipv6; + wasi_sockets_network_ipv4_address_t ipv4; + wasi_sockets_network_ipv6_address_t ipv6; } val; -} wasi_sockets_0_2_0_network_ip_address_t; +} wasi_sockets_network_ip_address_t; -#define WASI_SOCKETS_0_2_0_NETWORK_IP_ADDRESS_IPV4 0 -#define WASI_SOCKETS_0_2_0_NETWORK_IP_ADDRESS_IPV6 1 +#define WASI_SOCKETS_NETWORK_IP_ADDRESS_IPV4 0 +#define WASI_SOCKETS_NETWORK_IP_ADDRESS_IPV6 1 -typedef struct { +typedef struct wasi_sockets_network_ipv4_socket_address_t { // sin_port - uint16_t port; + uint16_t port; // sin_addr - wasi_sockets_0_2_0_network_ipv4_address_t address; -} wasi_sockets_0_2_0_network_ipv4_socket_address_t; + wasi_sockets_network_ipv4_address_t address; +} wasi_sockets_network_ipv4_socket_address_t; -typedef struct { +typedef struct wasi_sockets_network_ipv6_socket_address_t { // sin6_port - uint16_t port; + uint16_t port; // sin6_flowinfo - uint32_t flow_info; + uint32_t flow_info; // sin6_addr - wasi_sockets_0_2_0_network_ipv6_address_t address; + wasi_sockets_network_ipv6_address_t address; // sin6_scope_id - uint32_t scope_id; -} wasi_sockets_0_2_0_network_ipv6_socket_address_t; + uint32_t scope_id; +} wasi_sockets_network_ipv6_socket_address_t; -typedef struct { +typedef struct wasi_sockets_network_ip_socket_address_t { uint8_t tag; union { - wasi_sockets_0_2_0_network_ipv4_socket_address_t ipv4; - wasi_sockets_0_2_0_network_ipv6_socket_address_t ipv6; + wasi_sockets_network_ipv4_socket_address_t ipv4; + wasi_sockets_network_ipv6_socket_address_t ipv6; } val; -} wasi_sockets_0_2_0_network_ip_socket_address_t; - -#define WASI_SOCKETS_0_2_0_NETWORK_IP_SOCKET_ADDRESS_IPV4 0 -#define WASI_SOCKETS_0_2_0_NETWORK_IP_SOCKET_ADDRESS_IPV6 1 +} wasi_sockets_network_ip_socket_address_t; -typedef wasi_sockets_0_2_0_network_own_network_t wasi_sockets_0_2_0_instance_network_own_network_t; +#define WASI_SOCKETS_NETWORK_IP_SOCKET_ADDRESS_IPV4 0 +#define WASI_SOCKETS_NETWORK_IP_SOCKET_ADDRESS_IPV6 1 -typedef wasi_sockets_0_2_0_network_error_code_t wasi_sockets_0_2_0_udp_error_code_t; +typedef wasi_sockets_network_own_network_t wasi_sockets_instance_network_own_network_t; -typedef wasi_sockets_0_2_0_network_ip_socket_address_t wasi_sockets_0_2_0_udp_ip_socket_address_t; +typedef wasi_sockets_network_error_code_t wasi_sockets_udp_error_code_t; -typedef wasi_sockets_0_2_0_network_ip_address_family_t wasi_sockets_0_2_0_udp_ip_address_family_t; +typedef wasi_sockets_network_ip_socket_address_t wasi_sockets_udp_ip_socket_address_t; -typedef struct { - uint8_t *ptr; - size_t len; -} wasi_sockets_0_2_0_udp_list_u8_t; +typedef wasi_sockets_network_ip_address_family_t wasi_sockets_udp_ip_address_family_t; // A received datagram. -typedef struct { +typedef struct wasi_sockets_udp_incoming_datagram_t { // The payload. // // Theoretical max size: ~64 KiB. In practice, typically less than 1500 bytes. - wasi_sockets_0_2_0_udp_list_u8_t data; + bindings_list_u8_t data; // The source address. // // This field is guaranteed to match the remote address the stream was initialized with, if any. // // Equivalent to the `src_addr` out parameter of `recvfrom`. - wasi_sockets_0_2_0_udp_ip_socket_address_t remote_address; -} wasi_sockets_0_2_0_udp_incoming_datagram_t; + wasi_sockets_udp_ip_socket_address_t remote_address; +} wasi_sockets_udp_incoming_datagram_t; typedef struct { bool is_some; - wasi_sockets_0_2_0_udp_ip_socket_address_t val; -} wasi_sockets_0_2_0_udp_option_ip_socket_address_t; + wasi_sockets_udp_ip_socket_address_t val; +} wasi_sockets_udp_option_ip_socket_address_t; // A datagram to be sent out. -typedef struct { +typedef struct wasi_sockets_udp_outgoing_datagram_t { // The payload. - wasi_sockets_0_2_0_udp_list_u8_t data; + bindings_list_u8_t data; // The destination address. // // The requirements on this field depend on how the stream was initialized: @@ -803,734 +810,724 @@ typedef struct { // - without a remote address: this field is required. // // If this value is None, the send operation is equivalent to `send` in POSIX. Otherwise it is equivalent to `sendto`. - wasi_sockets_0_2_0_udp_option_ip_socket_address_t remote_address; -} wasi_sockets_0_2_0_udp_outgoing_datagram_t; + wasi_sockets_udp_option_ip_socket_address_t remote_address; +} wasi_sockets_udp_outgoing_datagram_t; -typedef struct wasi_sockets_0_2_0_udp_own_udp_socket_t { +typedef struct wasi_sockets_udp_own_udp_socket_t { int32_t __handle; -} wasi_sockets_0_2_0_udp_own_udp_socket_t; +} wasi_sockets_udp_own_udp_socket_t; -typedef struct wasi_sockets_0_2_0_udp_borrow_udp_socket_t { +typedef struct wasi_sockets_udp_borrow_udp_socket_t { int32_t __handle; -} wasi_sockets_0_2_0_udp_borrow_udp_socket_t; +} wasi_sockets_udp_borrow_udp_socket_t; -typedef struct wasi_sockets_0_2_0_udp_own_incoming_datagram_stream_t { +typedef struct wasi_sockets_udp_own_incoming_datagram_stream_t { int32_t __handle; -} wasi_sockets_0_2_0_udp_own_incoming_datagram_stream_t; +} wasi_sockets_udp_own_incoming_datagram_stream_t; -typedef struct wasi_sockets_0_2_0_udp_borrow_incoming_datagram_stream_t { +typedef struct wasi_sockets_udp_borrow_incoming_datagram_stream_t { int32_t __handle; -} wasi_sockets_0_2_0_udp_borrow_incoming_datagram_stream_t; +} wasi_sockets_udp_borrow_incoming_datagram_stream_t; -typedef struct wasi_sockets_0_2_0_udp_own_outgoing_datagram_stream_t { +typedef struct wasi_sockets_udp_own_outgoing_datagram_stream_t { int32_t __handle; -} wasi_sockets_0_2_0_udp_own_outgoing_datagram_stream_t; +} wasi_sockets_udp_own_outgoing_datagram_stream_t; -typedef struct wasi_sockets_0_2_0_udp_borrow_outgoing_datagram_stream_t { +typedef struct wasi_sockets_udp_borrow_outgoing_datagram_stream_t { int32_t __handle; -} wasi_sockets_0_2_0_udp_borrow_outgoing_datagram_stream_t; +} wasi_sockets_udp_borrow_outgoing_datagram_stream_t; -typedef wasi_sockets_0_2_0_network_borrow_network_t wasi_sockets_0_2_0_udp_borrow_network_t; +typedef wasi_sockets_network_borrow_network_t wasi_sockets_udp_borrow_network_t; typedef struct { bool is_err; union { - wasi_sockets_0_2_0_udp_error_code_t err; + wasi_sockets_udp_error_code_t err; } val; -} wasi_sockets_0_2_0_udp_result_void_error_code_t; +} wasi_sockets_udp_result_void_error_code_t; typedef struct { - wasi_sockets_0_2_0_udp_own_incoming_datagram_stream_t f0; - wasi_sockets_0_2_0_udp_own_outgoing_datagram_stream_t f1; -} wasi_sockets_0_2_0_udp_tuple2_own_incoming_datagram_stream_own_outgoing_datagram_stream_t; + wasi_sockets_udp_own_incoming_datagram_stream_t f0; + wasi_sockets_udp_own_outgoing_datagram_stream_t f1; +} wasi_sockets_udp_tuple2_own_incoming_datagram_stream_own_outgoing_datagram_stream_t; typedef struct { bool is_err; union { - wasi_sockets_0_2_0_udp_tuple2_own_incoming_datagram_stream_own_outgoing_datagram_stream_t ok; - wasi_sockets_0_2_0_udp_error_code_t err; + wasi_sockets_udp_tuple2_own_incoming_datagram_stream_own_outgoing_datagram_stream_t ok; + wasi_sockets_udp_error_code_t err; } val; -} wasi_sockets_0_2_0_udp_result_tuple2_own_incoming_datagram_stream_own_outgoing_datagram_stream_error_code_t; +} wasi_sockets_udp_result_tuple2_own_incoming_datagram_stream_own_outgoing_datagram_stream_error_code_t; typedef struct { bool is_err; union { - wasi_sockets_0_2_0_udp_ip_socket_address_t ok; - wasi_sockets_0_2_0_udp_error_code_t err; + wasi_sockets_udp_ip_socket_address_t ok; + wasi_sockets_udp_error_code_t err; } val; -} wasi_sockets_0_2_0_udp_result_ip_socket_address_error_code_t; +} wasi_sockets_udp_result_ip_socket_address_error_code_t; typedef struct { bool is_err; union { uint8_t ok; - wasi_sockets_0_2_0_udp_error_code_t err; + wasi_sockets_udp_error_code_t err; } val; -} wasi_sockets_0_2_0_udp_result_u8_error_code_t; +} wasi_sockets_udp_result_u8_error_code_t; typedef struct { bool is_err; union { uint64_t ok; - wasi_sockets_0_2_0_udp_error_code_t err; + wasi_sockets_udp_error_code_t err; } val; -} wasi_sockets_0_2_0_udp_result_u64_error_code_t; +} wasi_sockets_udp_result_u64_error_code_t; -typedef wasi_io_0_2_0_poll_own_pollable_t wasi_sockets_0_2_0_udp_own_pollable_t; +typedef wasi_io_poll_own_pollable_t wasi_sockets_udp_own_pollable_t; typedef struct { - wasi_sockets_0_2_0_udp_incoming_datagram_t *ptr; + wasi_sockets_udp_incoming_datagram_t *ptr; size_t len; -} wasi_sockets_0_2_0_udp_list_incoming_datagram_t; +} wasi_sockets_udp_list_incoming_datagram_t; typedef struct { bool is_err; union { - wasi_sockets_0_2_0_udp_list_incoming_datagram_t ok; - wasi_sockets_0_2_0_udp_error_code_t err; + wasi_sockets_udp_list_incoming_datagram_t ok; + wasi_sockets_udp_error_code_t err; } val; -} wasi_sockets_0_2_0_udp_result_list_incoming_datagram_error_code_t; +} wasi_sockets_udp_result_list_incoming_datagram_error_code_t; typedef struct { - wasi_sockets_0_2_0_udp_outgoing_datagram_t *ptr; + wasi_sockets_udp_outgoing_datagram_t *ptr; size_t len; -} wasi_sockets_0_2_0_udp_list_outgoing_datagram_t; +} wasi_sockets_udp_list_outgoing_datagram_t; -typedef wasi_sockets_0_2_0_network_error_code_t wasi_sockets_0_2_0_udp_create_socket_error_code_t; +typedef wasi_sockets_network_error_code_t wasi_sockets_udp_create_socket_error_code_t; -typedef wasi_sockets_0_2_0_network_ip_address_family_t wasi_sockets_0_2_0_udp_create_socket_ip_address_family_t; +typedef wasi_sockets_network_ip_address_family_t wasi_sockets_udp_create_socket_ip_address_family_t; -typedef wasi_sockets_0_2_0_udp_own_udp_socket_t wasi_sockets_0_2_0_udp_create_socket_own_udp_socket_t; +typedef wasi_sockets_udp_own_udp_socket_t wasi_sockets_udp_create_socket_own_udp_socket_t; typedef struct { bool is_err; union { - wasi_sockets_0_2_0_udp_create_socket_own_udp_socket_t ok; - wasi_sockets_0_2_0_udp_create_socket_error_code_t err; + wasi_sockets_udp_create_socket_own_udp_socket_t ok; + wasi_sockets_udp_create_socket_error_code_t err; } val; -} wasi_sockets_0_2_0_udp_create_socket_result_own_udp_socket_error_code_t; +} wasi_sockets_udp_create_socket_result_own_udp_socket_error_code_t; -typedef wasi_clocks_0_2_0_monotonic_clock_duration_t wasi_sockets_0_2_0_tcp_duration_t; +typedef wasi_clocks_monotonic_clock_duration_t wasi_sockets_tcp_duration_t; -typedef wasi_sockets_0_2_0_network_error_code_t wasi_sockets_0_2_0_tcp_error_code_t; +typedef wasi_sockets_network_error_code_t wasi_sockets_tcp_error_code_t; -typedef wasi_sockets_0_2_0_network_ip_socket_address_t wasi_sockets_0_2_0_tcp_ip_socket_address_t; +typedef wasi_sockets_network_ip_socket_address_t wasi_sockets_tcp_ip_socket_address_t; -typedef wasi_sockets_0_2_0_network_ip_address_family_t wasi_sockets_0_2_0_tcp_ip_address_family_t; +typedef wasi_sockets_network_ip_address_family_t wasi_sockets_tcp_ip_address_family_t; -typedef uint8_t wasi_sockets_0_2_0_tcp_shutdown_type_t; +typedef uint8_t wasi_sockets_tcp_shutdown_type_t; // Similar to `SHUT_RD` in POSIX. -#define WASI_SOCKETS_0_2_0_TCP_SHUTDOWN_TYPE_RECEIVE 0 +#define WASI_SOCKETS_TCP_SHUTDOWN_TYPE_RECEIVE 0 // Similar to `SHUT_WR` in POSIX. -#define WASI_SOCKETS_0_2_0_TCP_SHUTDOWN_TYPE_SEND 1 +#define WASI_SOCKETS_TCP_SHUTDOWN_TYPE_SEND 1 // Similar to `SHUT_RDWR` in POSIX. -#define WASI_SOCKETS_0_2_0_TCP_SHUTDOWN_TYPE_BOTH 2 +#define WASI_SOCKETS_TCP_SHUTDOWN_TYPE_BOTH 2 -typedef struct wasi_sockets_0_2_0_tcp_own_tcp_socket_t { +typedef struct wasi_sockets_tcp_own_tcp_socket_t { int32_t __handle; -} wasi_sockets_0_2_0_tcp_own_tcp_socket_t; +} wasi_sockets_tcp_own_tcp_socket_t; -typedef struct wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t { +typedef struct wasi_sockets_tcp_borrow_tcp_socket_t { int32_t __handle; -} wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t; +} wasi_sockets_tcp_borrow_tcp_socket_t; -typedef wasi_sockets_0_2_0_network_borrow_network_t wasi_sockets_0_2_0_tcp_borrow_network_t; +typedef wasi_sockets_network_borrow_network_t wasi_sockets_tcp_borrow_network_t; typedef struct { bool is_err; union { - wasi_sockets_0_2_0_tcp_error_code_t err; + wasi_sockets_tcp_error_code_t err; } val; -} wasi_sockets_0_2_0_tcp_result_void_error_code_t; +} wasi_sockets_tcp_result_void_error_code_t; -typedef wasi_io_0_2_0_streams_own_input_stream_t wasi_sockets_0_2_0_tcp_own_input_stream_t; +typedef wasi_io_streams_own_input_stream_t wasi_sockets_tcp_own_input_stream_t; -typedef wasi_io_0_2_0_streams_own_output_stream_t wasi_sockets_0_2_0_tcp_own_output_stream_t; +typedef wasi_io_streams_own_output_stream_t wasi_sockets_tcp_own_output_stream_t; typedef struct { - wasi_sockets_0_2_0_tcp_own_input_stream_t f0; - wasi_sockets_0_2_0_tcp_own_output_stream_t f1; -} wasi_sockets_0_2_0_tcp_tuple2_own_input_stream_own_output_stream_t; + wasi_sockets_tcp_own_input_stream_t f0; + wasi_sockets_tcp_own_output_stream_t f1; +} wasi_sockets_tcp_tuple2_own_input_stream_own_output_stream_t; typedef struct { bool is_err; union { - wasi_sockets_0_2_0_tcp_tuple2_own_input_stream_own_output_stream_t ok; - wasi_sockets_0_2_0_tcp_error_code_t err; + wasi_sockets_tcp_tuple2_own_input_stream_own_output_stream_t ok; + wasi_sockets_tcp_error_code_t err; } val; -} wasi_sockets_0_2_0_tcp_result_tuple2_own_input_stream_own_output_stream_error_code_t; +} wasi_sockets_tcp_result_tuple2_own_input_stream_own_output_stream_error_code_t; typedef struct { - wasi_sockets_0_2_0_tcp_own_tcp_socket_t f0; - wasi_sockets_0_2_0_tcp_own_input_stream_t f1; - wasi_sockets_0_2_0_tcp_own_output_stream_t f2; -} wasi_sockets_0_2_0_tcp_tuple3_own_tcp_socket_own_input_stream_own_output_stream_t; + wasi_sockets_tcp_own_tcp_socket_t f0; + wasi_sockets_tcp_own_input_stream_t f1; + wasi_sockets_tcp_own_output_stream_t f2; +} wasi_sockets_tcp_tuple3_own_tcp_socket_own_input_stream_own_output_stream_t; typedef struct { bool is_err; union { - wasi_sockets_0_2_0_tcp_tuple3_own_tcp_socket_own_input_stream_own_output_stream_t ok; - wasi_sockets_0_2_0_tcp_error_code_t err; + wasi_sockets_tcp_tuple3_own_tcp_socket_own_input_stream_own_output_stream_t ok; + wasi_sockets_tcp_error_code_t err; } val; -} wasi_sockets_0_2_0_tcp_result_tuple3_own_tcp_socket_own_input_stream_own_output_stream_error_code_t; +} wasi_sockets_tcp_result_tuple3_own_tcp_socket_own_input_stream_own_output_stream_error_code_t; typedef struct { bool is_err; union { - wasi_sockets_0_2_0_tcp_ip_socket_address_t ok; - wasi_sockets_0_2_0_tcp_error_code_t err; + wasi_sockets_tcp_ip_socket_address_t ok; + wasi_sockets_tcp_error_code_t err; } val; -} wasi_sockets_0_2_0_tcp_result_ip_socket_address_error_code_t; +} wasi_sockets_tcp_result_ip_socket_address_error_code_t; typedef struct { bool is_err; union { bool ok; - wasi_sockets_0_2_0_tcp_error_code_t err; + wasi_sockets_tcp_error_code_t err; } val; -} wasi_sockets_0_2_0_tcp_result_bool_error_code_t; +} wasi_sockets_tcp_result_bool_error_code_t; typedef struct { bool is_err; union { - wasi_sockets_0_2_0_tcp_duration_t ok; - wasi_sockets_0_2_0_tcp_error_code_t err; + wasi_sockets_tcp_duration_t ok; + wasi_sockets_tcp_error_code_t err; } val; -} wasi_sockets_0_2_0_tcp_result_duration_error_code_t; +} wasi_sockets_tcp_result_duration_error_code_t; typedef struct { bool is_err; union { uint32_t ok; - wasi_sockets_0_2_0_tcp_error_code_t err; + wasi_sockets_tcp_error_code_t err; } val; -} wasi_sockets_0_2_0_tcp_result_u32_error_code_t; +} wasi_sockets_tcp_result_u32_error_code_t; typedef struct { bool is_err; union { uint8_t ok; - wasi_sockets_0_2_0_tcp_error_code_t err; + wasi_sockets_tcp_error_code_t err; } val; -} wasi_sockets_0_2_0_tcp_result_u8_error_code_t; +} wasi_sockets_tcp_result_u8_error_code_t; typedef struct { bool is_err; union { uint64_t ok; - wasi_sockets_0_2_0_tcp_error_code_t err; + wasi_sockets_tcp_error_code_t err; } val; -} wasi_sockets_0_2_0_tcp_result_u64_error_code_t; +} wasi_sockets_tcp_result_u64_error_code_t; -typedef wasi_io_0_2_0_poll_own_pollable_t wasi_sockets_0_2_0_tcp_own_pollable_t; +typedef wasi_io_poll_own_pollable_t wasi_sockets_tcp_own_pollable_t; -typedef wasi_sockets_0_2_0_network_error_code_t wasi_sockets_0_2_0_tcp_create_socket_error_code_t; +typedef wasi_sockets_network_error_code_t wasi_sockets_tcp_create_socket_error_code_t; -typedef wasi_sockets_0_2_0_network_ip_address_family_t wasi_sockets_0_2_0_tcp_create_socket_ip_address_family_t; +typedef wasi_sockets_network_ip_address_family_t wasi_sockets_tcp_create_socket_ip_address_family_t; -typedef wasi_sockets_0_2_0_tcp_own_tcp_socket_t wasi_sockets_0_2_0_tcp_create_socket_own_tcp_socket_t; +typedef wasi_sockets_tcp_own_tcp_socket_t wasi_sockets_tcp_create_socket_own_tcp_socket_t; typedef struct { bool is_err; union { - wasi_sockets_0_2_0_tcp_create_socket_own_tcp_socket_t ok; - wasi_sockets_0_2_0_tcp_create_socket_error_code_t err; + wasi_sockets_tcp_create_socket_own_tcp_socket_t ok; + wasi_sockets_tcp_create_socket_error_code_t err; } val; -} wasi_sockets_0_2_0_tcp_create_socket_result_own_tcp_socket_error_code_t; +} wasi_sockets_tcp_create_socket_result_own_tcp_socket_error_code_t; -typedef wasi_sockets_0_2_0_network_error_code_t wasi_sockets_0_2_0_ip_name_lookup_error_code_t; +typedef wasi_sockets_network_error_code_t wasi_sockets_ip_name_lookup_error_code_t; -typedef wasi_sockets_0_2_0_network_ip_address_t wasi_sockets_0_2_0_ip_name_lookup_ip_address_t; +typedef wasi_sockets_network_ip_address_t wasi_sockets_ip_name_lookup_ip_address_t; -typedef struct wasi_sockets_0_2_0_ip_name_lookup_own_resolve_address_stream_t { +typedef struct wasi_sockets_ip_name_lookup_own_resolve_address_stream_t { int32_t __handle; -} wasi_sockets_0_2_0_ip_name_lookup_own_resolve_address_stream_t; +} wasi_sockets_ip_name_lookup_own_resolve_address_stream_t; -typedef struct wasi_sockets_0_2_0_ip_name_lookup_borrow_resolve_address_stream_t { +typedef struct wasi_sockets_ip_name_lookup_borrow_resolve_address_stream_t { int32_t __handle; -} wasi_sockets_0_2_0_ip_name_lookup_borrow_resolve_address_stream_t; +} wasi_sockets_ip_name_lookup_borrow_resolve_address_stream_t; -typedef wasi_sockets_0_2_0_network_borrow_network_t wasi_sockets_0_2_0_ip_name_lookup_borrow_network_t; +typedef wasi_sockets_network_borrow_network_t wasi_sockets_ip_name_lookup_borrow_network_t; typedef struct { bool is_err; union { - wasi_sockets_0_2_0_ip_name_lookup_own_resolve_address_stream_t ok; - wasi_sockets_0_2_0_ip_name_lookup_error_code_t err; + wasi_sockets_ip_name_lookup_own_resolve_address_stream_t ok; + wasi_sockets_ip_name_lookup_error_code_t err; } val; -} wasi_sockets_0_2_0_ip_name_lookup_result_own_resolve_address_stream_error_code_t; +} wasi_sockets_ip_name_lookup_result_own_resolve_address_stream_error_code_t; typedef struct { bool is_some; - wasi_sockets_0_2_0_ip_name_lookup_ip_address_t val; -} wasi_sockets_0_2_0_ip_name_lookup_option_ip_address_t; + wasi_sockets_ip_name_lookup_ip_address_t val; +} wasi_sockets_ip_name_lookup_option_ip_address_t; typedef struct { bool is_err; union { - wasi_sockets_0_2_0_ip_name_lookup_option_ip_address_t ok; - wasi_sockets_0_2_0_ip_name_lookup_error_code_t err; + wasi_sockets_ip_name_lookup_option_ip_address_t ok; + wasi_sockets_ip_name_lookup_error_code_t err; } val; -} wasi_sockets_0_2_0_ip_name_lookup_result_option_ip_address_error_code_t; - -typedef wasi_io_0_2_0_poll_own_pollable_t wasi_sockets_0_2_0_ip_name_lookup_own_pollable_t; +} wasi_sockets_ip_name_lookup_result_option_ip_address_error_code_t; -typedef struct { - uint8_t *ptr; - size_t len; -} wasi_random_0_2_0_random_list_u8_t; +typedef wasi_io_poll_own_pollable_t wasi_sockets_ip_name_lookup_own_pollable_t; typedef struct { uint64_t f0; uint64_t f1; -} wasi_random_0_2_0_insecure_seed_tuple2_u64_u64_t; +} bindings_tuple2_u64_u64_t; -typedef wasi_clocks_0_2_0_monotonic_clock_duration_t wasi_http_0_2_0_types_duration_t; +typedef wasi_clocks_monotonic_clock_duration_t wasi_http_types_duration_t; // This type corresponds to HTTP standard Methods. -typedef struct { +typedef struct wasi_http_types_method_t { uint8_t tag; union { - bindings_string_t other; + bindings_string_t other; } val; -} wasi_http_0_2_0_types_method_t; - -#define WASI_HTTP_0_2_0_TYPES_METHOD_GET 0 -#define WASI_HTTP_0_2_0_TYPES_METHOD_HEAD 1 -#define WASI_HTTP_0_2_0_TYPES_METHOD_POST 2 -#define WASI_HTTP_0_2_0_TYPES_METHOD_PUT 3 -#define WASI_HTTP_0_2_0_TYPES_METHOD_DELETE 4 -#define WASI_HTTP_0_2_0_TYPES_METHOD_CONNECT 5 -#define WASI_HTTP_0_2_0_TYPES_METHOD_OPTIONS 6 -#define WASI_HTTP_0_2_0_TYPES_METHOD_TRACE 7 -#define WASI_HTTP_0_2_0_TYPES_METHOD_PATCH 8 -#define WASI_HTTP_0_2_0_TYPES_METHOD_OTHER 9 +} wasi_http_types_method_t; + +#define WASI_HTTP_TYPES_METHOD_GET 0 +#define WASI_HTTP_TYPES_METHOD_HEAD 1 +#define WASI_HTTP_TYPES_METHOD_POST 2 +#define WASI_HTTP_TYPES_METHOD_PUT 3 +#define WASI_HTTP_TYPES_METHOD_DELETE 4 +#define WASI_HTTP_TYPES_METHOD_CONNECT 5 +#define WASI_HTTP_TYPES_METHOD_OPTIONS 6 +#define WASI_HTTP_TYPES_METHOD_TRACE 7 +#define WASI_HTTP_TYPES_METHOD_PATCH 8 +#define WASI_HTTP_TYPES_METHOD_OTHER 9 // This type corresponds to HTTP standard Related Schemes. -typedef struct { +typedef struct wasi_http_types_scheme_t { uint8_t tag; union { - bindings_string_t other; + bindings_string_t other; } val; -} wasi_http_0_2_0_types_scheme_t; +} wasi_http_types_scheme_t; -#define WASI_HTTP_0_2_0_TYPES_SCHEME_HTTP 0 -#define WASI_HTTP_0_2_0_TYPES_SCHEME_HTTPS 1 -#define WASI_HTTP_0_2_0_TYPES_SCHEME_OTHER 2 - -typedef struct { - bool is_some; - bindings_string_t val; -} wasi_http_0_2_0_types_option_string_t; +#define WASI_HTTP_TYPES_SCHEME_HTTP 0 +#define WASI_HTTP_TYPES_SCHEME_HTTPS 1 +#define WASI_HTTP_TYPES_SCHEME_OTHER 2 typedef struct { bool is_some; uint16_t val; -} wasi_http_0_2_0_types_option_u16_t; +} bindings_option_u16_t; // Defines the case payload type for `DNS-error` above: -typedef struct { - wasi_http_0_2_0_types_option_string_t rcode; - wasi_http_0_2_0_types_option_u16_t info_code; -} wasi_http_0_2_0_types_dns_error_payload_t; +typedef struct wasi_http_types_dns_error_payload_t { + bindings_option_string_t rcode; + bindings_option_u16_t info_code; +} wasi_http_types_dns_error_payload_t; typedef struct { bool is_some; uint8_t val; -} wasi_http_0_2_0_types_option_u8_t; +} bindings_option_u8_t; // Defines the case payload type for `TLS-alert-received` above: -typedef struct { - wasi_http_0_2_0_types_option_u8_t alert_id; - wasi_http_0_2_0_types_option_string_t alert_message; -} wasi_http_0_2_0_types_tls_alert_received_payload_t; +typedef struct wasi_http_types_tls_alert_received_payload_t { + bindings_option_u8_t alert_id; + bindings_option_string_t alert_message; +} wasi_http_types_tls_alert_received_payload_t; typedef struct { bool is_some; uint32_t val; -} wasi_http_0_2_0_types_option_u32_t; +} bindings_option_u32_t; // Defines the case payload type for `HTTP-response-{header,trailer}-size` above: -typedef struct { - wasi_http_0_2_0_types_option_string_t field_name; - wasi_http_0_2_0_types_option_u32_t field_size; -} wasi_http_0_2_0_types_field_size_payload_t; +typedef struct wasi_http_types_field_size_payload_t { + bindings_option_string_t field_name; + bindings_option_u32_t field_size; +} wasi_http_types_field_size_payload_t; typedef struct { bool is_some; uint64_t val; -} wasi_http_0_2_0_types_option_u64_t; +} bindings_option_u64_t; typedef struct { bool is_some; - wasi_http_0_2_0_types_field_size_payload_t val; -} wasi_http_0_2_0_types_option_field_size_payload_t; + wasi_http_types_field_size_payload_t val; +} wasi_http_types_option_field_size_payload_t; // These cases are inspired by the IANA HTTP Proxy Error Types: // https://www.iana.org/assignments/http-proxy-status/http-proxy-status.xhtml#table-http-proxy-error-types -typedef struct { +typedef struct wasi_http_types_error_code_t { uint8_t tag; union { - wasi_http_0_2_0_types_dns_error_payload_t dns_error; - wasi_http_0_2_0_types_tls_alert_received_payload_t tls_alert_received; - wasi_http_0_2_0_types_option_u64_t http_request_body_size; - wasi_http_0_2_0_types_option_u32_t http_request_header_section_size; - wasi_http_0_2_0_types_option_field_size_payload_t http_request_header_size; - wasi_http_0_2_0_types_option_u32_t http_request_trailer_section_size; - wasi_http_0_2_0_types_field_size_payload_t http_request_trailer_size; - wasi_http_0_2_0_types_option_u32_t http_response_header_section_size; - wasi_http_0_2_0_types_field_size_payload_t http_response_header_size; - wasi_http_0_2_0_types_option_u64_t http_response_body_size; - wasi_http_0_2_0_types_option_u32_t http_response_trailer_section_size; - wasi_http_0_2_0_types_field_size_payload_t http_response_trailer_size; - wasi_http_0_2_0_types_option_string_t http_response_transfer_coding; - wasi_http_0_2_0_types_option_string_t http_response_content_coding; - wasi_http_0_2_0_types_option_string_t internal_error; + wasi_http_types_dns_error_payload_t dns_error; + wasi_http_types_tls_alert_received_payload_t tls_alert_received; + bindings_option_u64_t http_request_body_size; + bindings_option_u32_t http_request_header_section_size; + wasi_http_types_option_field_size_payload_t http_request_header_size; + bindings_option_u32_t http_request_trailer_section_size; + wasi_http_types_field_size_payload_t http_request_trailer_size; + bindings_option_u32_t http_response_header_section_size; + wasi_http_types_field_size_payload_t http_response_header_size; + bindings_option_u64_t http_response_body_size; + bindings_option_u32_t http_response_trailer_section_size; + wasi_http_types_field_size_payload_t http_response_trailer_size; + bindings_option_string_t http_response_transfer_coding; + bindings_option_string_t http_response_content_coding; + bindings_option_string_t internal_error; } val; -} wasi_http_0_2_0_types_error_code_t; - -#define WASI_HTTP_0_2_0_TYPES_ERROR_CODE_DNS_TIMEOUT 0 -#define WASI_HTTP_0_2_0_TYPES_ERROR_CODE_DNS_ERROR 1 -#define WASI_HTTP_0_2_0_TYPES_ERROR_CODE_DESTINATION_NOT_FOUND 2 -#define WASI_HTTP_0_2_0_TYPES_ERROR_CODE_DESTINATION_UNAVAILABLE 3 -#define WASI_HTTP_0_2_0_TYPES_ERROR_CODE_DESTINATION_IP_PROHIBITED 4 -#define WASI_HTTP_0_2_0_TYPES_ERROR_CODE_DESTINATION_IP_UNROUTABLE 5 -#define WASI_HTTP_0_2_0_TYPES_ERROR_CODE_CONNECTION_REFUSED 6 -#define WASI_HTTP_0_2_0_TYPES_ERROR_CODE_CONNECTION_TERMINATED 7 -#define WASI_HTTP_0_2_0_TYPES_ERROR_CODE_CONNECTION_TIMEOUT 8 -#define WASI_HTTP_0_2_0_TYPES_ERROR_CODE_CONNECTION_READ_TIMEOUT 9 -#define WASI_HTTP_0_2_0_TYPES_ERROR_CODE_CONNECTION_WRITE_TIMEOUT 10 -#define WASI_HTTP_0_2_0_TYPES_ERROR_CODE_CONNECTION_LIMIT_REACHED 11 -#define WASI_HTTP_0_2_0_TYPES_ERROR_CODE_TLS_PROTOCOL_ERROR 12 -#define WASI_HTTP_0_2_0_TYPES_ERROR_CODE_TLS_CERTIFICATE_ERROR 13 -#define WASI_HTTP_0_2_0_TYPES_ERROR_CODE_TLS_ALERT_RECEIVED 14 -#define WASI_HTTP_0_2_0_TYPES_ERROR_CODE_HTTP_REQUEST_DENIED 15 -#define WASI_HTTP_0_2_0_TYPES_ERROR_CODE_HTTP_REQUEST_LENGTH_REQUIRED 16 -#define WASI_HTTP_0_2_0_TYPES_ERROR_CODE_HTTP_REQUEST_BODY_SIZE 17 -#define WASI_HTTP_0_2_0_TYPES_ERROR_CODE_HTTP_REQUEST_METHOD_INVALID 18 -#define WASI_HTTP_0_2_0_TYPES_ERROR_CODE_HTTP_REQUEST_URI_INVALID 19 -#define WASI_HTTP_0_2_0_TYPES_ERROR_CODE_HTTP_REQUEST_URI_TOO_LONG 20 -#define WASI_HTTP_0_2_0_TYPES_ERROR_CODE_HTTP_REQUEST_HEADER_SECTION_SIZE 21 -#define WASI_HTTP_0_2_0_TYPES_ERROR_CODE_HTTP_REQUEST_HEADER_SIZE 22 -#define WASI_HTTP_0_2_0_TYPES_ERROR_CODE_HTTP_REQUEST_TRAILER_SECTION_SIZE 23 -#define WASI_HTTP_0_2_0_TYPES_ERROR_CODE_HTTP_REQUEST_TRAILER_SIZE 24 -#define WASI_HTTP_0_2_0_TYPES_ERROR_CODE_HTTP_RESPONSE_INCOMPLETE 25 -#define WASI_HTTP_0_2_0_TYPES_ERROR_CODE_HTTP_RESPONSE_HEADER_SECTION_SIZE 26 -#define WASI_HTTP_0_2_0_TYPES_ERROR_CODE_HTTP_RESPONSE_HEADER_SIZE 27 -#define WASI_HTTP_0_2_0_TYPES_ERROR_CODE_HTTP_RESPONSE_BODY_SIZE 28 -#define WASI_HTTP_0_2_0_TYPES_ERROR_CODE_HTTP_RESPONSE_TRAILER_SECTION_SIZE 29 -#define WASI_HTTP_0_2_0_TYPES_ERROR_CODE_HTTP_RESPONSE_TRAILER_SIZE 30 -#define WASI_HTTP_0_2_0_TYPES_ERROR_CODE_HTTP_RESPONSE_TRANSFER_CODING 31 -#define WASI_HTTP_0_2_0_TYPES_ERROR_CODE_HTTP_RESPONSE_CONTENT_CODING 32 -#define WASI_HTTP_0_2_0_TYPES_ERROR_CODE_HTTP_RESPONSE_TIMEOUT 33 -#define WASI_HTTP_0_2_0_TYPES_ERROR_CODE_HTTP_UPGRADE_FAILED 34 -#define WASI_HTTP_0_2_0_TYPES_ERROR_CODE_HTTP_PROTOCOL_ERROR 35 -#define WASI_HTTP_0_2_0_TYPES_ERROR_CODE_LOOP_DETECTED 36 -#define WASI_HTTP_0_2_0_TYPES_ERROR_CODE_CONFIGURATION_ERROR 37 +} wasi_http_types_error_code_t; + +#define WASI_HTTP_TYPES_ERROR_CODE_DNS_TIMEOUT 0 +#define WASI_HTTP_TYPES_ERROR_CODE_DNS_ERROR 1 +#define WASI_HTTP_TYPES_ERROR_CODE_DESTINATION_NOT_FOUND 2 +#define WASI_HTTP_TYPES_ERROR_CODE_DESTINATION_UNAVAILABLE 3 +#define WASI_HTTP_TYPES_ERROR_CODE_DESTINATION_IP_PROHIBITED 4 +#define WASI_HTTP_TYPES_ERROR_CODE_DESTINATION_IP_UNROUTABLE 5 +#define WASI_HTTP_TYPES_ERROR_CODE_CONNECTION_REFUSED 6 +#define WASI_HTTP_TYPES_ERROR_CODE_CONNECTION_TERMINATED 7 +#define WASI_HTTP_TYPES_ERROR_CODE_CONNECTION_TIMEOUT 8 +#define WASI_HTTP_TYPES_ERROR_CODE_CONNECTION_READ_TIMEOUT 9 +#define WASI_HTTP_TYPES_ERROR_CODE_CONNECTION_WRITE_TIMEOUT 10 +#define WASI_HTTP_TYPES_ERROR_CODE_CONNECTION_LIMIT_REACHED 11 +#define WASI_HTTP_TYPES_ERROR_CODE_TLS_PROTOCOL_ERROR 12 +#define WASI_HTTP_TYPES_ERROR_CODE_TLS_CERTIFICATE_ERROR 13 +#define WASI_HTTP_TYPES_ERROR_CODE_TLS_ALERT_RECEIVED 14 +#define WASI_HTTP_TYPES_ERROR_CODE_HTTP_REQUEST_DENIED 15 +#define WASI_HTTP_TYPES_ERROR_CODE_HTTP_REQUEST_LENGTH_REQUIRED 16 +#define WASI_HTTP_TYPES_ERROR_CODE_HTTP_REQUEST_BODY_SIZE 17 +#define WASI_HTTP_TYPES_ERROR_CODE_HTTP_REQUEST_METHOD_INVALID 18 +#define WASI_HTTP_TYPES_ERROR_CODE_HTTP_REQUEST_URI_INVALID 19 +#define WASI_HTTP_TYPES_ERROR_CODE_HTTP_REQUEST_URI_TOO_LONG 20 +#define WASI_HTTP_TYPES_ERROR_CODE_HTTP_REQUEST_HEADER_SECTION_SIZE 21 +#define WASI_HTTP_TYPES_ERROR_CODE_HTTP_REQUEST_HEADER_SIZE 22 +#define WASI_HTTP_TYPES_ERROR_CODE_HTTP_REQUEST_TRAILER_SECTION_SIZE 23 +#define WASI_HTTP_TYPES_ERROR_CODE_HTTP_REQUEST_TRAILER_SIZE 24 +#define WASI_HTTP_TYPES_ERROR_CODE_HTTP_RESPONSE_INCOMPLETE 25 +#define WASI_HTTP_TYPES_ERROR_CODE_HTTP_RESPONSE_HEADER_SECTION_SIZE 26 +#define WASI_HTTP_TYPES_ERROR_CODE_HTTP_RESPONSE_HEADER_SIZE 27 +#define WASI_HTTP_TYPES_ERROR_CODE_HTTP_RESPONSE_BODY_SIZE 28 +#define WASI_HTTP_TYPES_ERROR_CODE_HTTP_RESPONSE_TRAILER_SECTION_SIZE 29 +#define WASI_HTTP_TYPES_ERROR_CODE_HTTP_RESPONSE_TRAILER_SIZE 30 +#define WASI_HTTP_TYPES_ERROR_CODE_HTTP_RESPONSE_TRANSFER_CODING 31 +#define WASI_HTTP_TYPES_ERROR_CODE_HTTP_RESPONSE_CONTENT_CODING 32 +#define WASI_HTTP_TYPES_ERROR_CODE_HTTP_RESPONSE_TIMEOUT 33 +#define WASI_HTTP_TYPES_ERROR_CODE_HTTP_UPGRADE_FAILED 34 +#define WASI_HTTP_TYPES_ERROR_CODE_HTTP_PROTOCOL_ERROR 35 +#define WASI_HTTP_TYPES_ERROR_CODE_LOOP_DETECTED 36 +#define WASI_HTTP_TYPES_ERROR_CODE_CONFIGURATION_ERROR 37 // This is a catch-all error for anything that doesn't fit cleanly into a // more specific case. It also includes an optional string for an // unstructured description of the error. Users should not depend on the // string for diagnosing errors, as it's not required to be consistent // between implementations. -#define WASI_HTTP_0_2_0_TYPES_ERROR_CODE_INTERNAL_ERROR 38 +#define WASI_HTTP_TYPES_ERROR_CODE_INTERNAL_ERROR 38 // This type enumerates the different kinds of errors that may occur when // setting or appending to a `fields` resource. -typedef struct { +typedef struct wasi_http_types_header_error_t { uint8_t tag; -} wasi_http_0_2_0_types_header_error_t; +} wasi_http_types_header_error_t; // This error indicates that a `field-key` or `field-value` was // syntactically invalid when used with an operation that sets headers in a // `fields`. -#define WASI_HTTP_0_2_0_TYPES_HEADER_ERROR_INVALID_SYNTAX 0 +#define WASI_HTTP_TYPES_HEADER_ERROR_INVALID_SYNTAX 0 // This error indicates that a forbidden `field-key` was used when trying // to set a header in a `fields`. -#define WASI_HTTP_0_2_0_TYPES_HEADER_ERROR_FORBIDDEN 1 +#define WASI_HTTP_TYPES_HEADER_ERROR_FORBIDDEN 1 // This error indicates that the operation on the `fields` was not // permitted because the fields are immutable. -#define WASI_HTTP_0_2_0_TYPES_HEADER_ERROR_IMMUTABLE 2 +#define WASI_HTTP_TYPES_HEADER_ERROR_IMMUTABLE 2 // Field keys are always strings. -typedef bindings_string_t wasi_http_0_2_0_types_field_key_t; +typedef bindings_string_t wasi_http_types_field_key_t; // Field values should always be ASCII strings. However, in // reality, HTTP implementations often have to interpret malformed values, // so they are provided as a list of bytes. -typedef struct { - uint8_t *ptr; +typedef struct wasi_http_types_field_value_t { + uint8_t *ptr; size_t len; -} wasi_http_0_2_0_types_field_value_t; +} wasi_http_types_field_value_t; -typedef struct wasi_http_0_2_0_types_own_fields_t { +typedef struct wasi_http_types_own_fields_t { int32_t __handle; -} wasi_http_0_2_0_types_own_fields_t; +} wasi_http_types_own_fields_t; -typedef struct wasi_http_0_2_0_types_borrow_fields_t { +typedef struct wasi_http_types_borrow_fields_t { int32_t __handle; -} wasi_http_0_2_0_types_borrow_fields_t; +} wasi_http_types_borrow_fields_t; -typedef struct wasi_http_0_2_0_types_own_incoming_request_t { +typedef struct wasi_http_types_own_incoming_request_t { int32_t __handle; -} wasi_http_0_2_0_types_own_incoming_request_t; +} wasi_http_types_own_incoming_request_t; -typedef struct wasi_http_0_2_0_types_borrow_incoming_request_t { +typedef struct wasi_http_types_borrow_incoming_request_t { int32_t __handle; -} wasi_http_0_2_0_types_borrow_incoming_request_t; +} wasi_http_types_borrow_incoming_request_t; -typedef struct wasi_http_0_2_0_types_own_outgoing_request_t { +typedef struct wasi_http_types_own_outgoing_request_t { int32_t __handle; -} wasi_http_0_2_0_types_own_outgoing_request_t; +} wasi_http_types_own_outgoing_request_t; -typedef struct wasi_http_0_2_0_types_borrow_outgoing_request_t { +typedef struct wasi_http_types_borrow_outgoing_request_t { int32_t __handle; -} wasi_http_0_2_0_types_borrow_outgoing_request_t; +} wasi_http_types_borrow_outgoing_request_t; -typedef struct wasi_http_0_2_0_types_own_request_options_t { +typedef struct wasi_http_types_own_request_options_t { int32_t __handle; -} wasi_http_0_2_0_types_own_request_options_t; +} wasi_http_types_own_request_options_t; -typedef struct wasi_http_0_2_0_types_borrow_request_options_t { +typedef struct wasi_http_types_borrow_request_options_t { int32_t __handle; -} wasi_http_0_2_0_types_borrow_request_options_t; +} wasi_http_types_borrow_request_options_t; -typedef struct wasi_http_0_2_0_types_own_response_outparam_t { +typedef struct wasi_http_types_own_response_outparam_t { int32_t __handle; -} wasi_http_0_2_0_types_own_response_outparam_t; +} wasi_http_types_own_response_outparam_t; -typedef struct wasi_http_0_2_0_types_borrow_response_outparam_t { +typedef struct wasi_http_types_borrow_response_outparam_t { int32_t __handle; -} wasi_http_0_2_0_types_borrow_response_outparam_t; +} wasi_http_types_borrow_response_outparam_t; // This type corresponds to the HTTP standard Status Code. -typedef uint16_t wasi_http_0_2_0_types_status_code_t; +typedef uint16_t wasi_http_types_status_code_t; -typedef struct wasi_http_0_2_0_types_own_incoming_response_t { +typedef struct wasi_http_types_own_incoming_response_t { int32_t __handle; -} wasi_http_0_2_0_types_own_incoming_response_t; +} wasi_http_types_own_incoming_response_t; -typedef struct wasi_http_0_2_0_types_borrow_incoming_response_t { +typedef struct wasi_http_types_borrow_incoming_response_t { int32_t __handle; -} wasi_http_0_2_0_types_borrow_incoming_response_t; +} wasi_http_types_borrow_incoming_response_t; -typedef struct wasi_http_0_2_0_types_own_incoming_body_t { +typedef struct wasi_http_types_own_incoming_body_t { int32_t __handle; -} wasi_http_0_2_0_types_own_incoming_body_t; +} wasi_http_types_own_incoming_body_t; -typedef struct wasi_http_0_2_0_types_borrow_incoming_body_t { +typedef struct wasi_http_types_borrow_incoming_body_t { int32_t __handle; -} wasi_http_0_2_0_types_borrow_incoming_body_t; +} wasi_http_types_borrow_incoming_body_t; -typedef struct wasi_http_0_2_0_types_own_future_trailers_t { +typedef struct wasi_http_types_own_future_trailers_t { int32_t __handle; -} wasi_http_0_2_0_types_own_future_trailers_t; +} wasi_http_types_own_future_trailers_t; -typedef struct wasi_http_0_2_0_types_borrow_future_trailers_t { +typedef struct wasi_http_types_borrow_future_trailers_t { int32_t __handle; -} wasi_http_0_2_0_types_borrow_future_trailers_t; +} wasi_http_types_borrow_future_trailers_t; -typedef struct wasi_http_0_2_0_types_own_outgoing_response_t { +typedef struct wasi_http_types_own_outgoing_response_t { int32_t __handle; -} wasi_http_0_2_0_types_own_outgoing_response_t; +} wasi_http_types_own_outgoing_response_t; -typedef struct wasi_http_0_2_0_types_borrow_outgoing_response_t { +typedef struct wasi_http_types_borrow_outgoing_response_t { int32_t __handle; -} wasi_http_0_2_0_types_borrow_outgoing_response_t; +} wasi_http_types_borrow_outgoing_response_t; -typedef struct wasi_http_0_2_0_types_own_outgoing_body_t { +typedef struct wasi_http_types_own_outgoing_body_t { int32_t __handle; -} wasi_http_0_2_0_types_own_outgoing_body_t; +} wasi_http_types_own_outgoing_body_t; -typedef struct wasi_http_0_2_0_types_borrow_outgoing_body_t { +typedef struct wasi_http_types_borrow_outgoing_body_t { int32_t __handle; -} wasi_http_0_2_0_types_borrow_outgoing_body_t; +} wasi_http_types_borrow_outgoing_body_t; -typedef struct wasi_http_0_2_0_types_own_future_incoming_response_t { +typedef struct wasi_http_types_own_future_incoming_response_t { int32_t __handle; -} wasi_http_0_2_0_types_own_future_incoming_response_t; +} wasi_http_types_own_future_incoming_response_t; -typedef struct wasi_http_0_2_0_types_borrow_future_incoming_response_t { +typedef struct wasi_http_types_borrow_future_incoming_response_t { int32_t __handle; -} wasi_http_0_2_0_types_borrow_future_incoming_response_t; +} wasi_http_types_borrow_future_incoming_response_t; -typedef wasi_io_0_2_0_error_borrow_error_t wasi_http_0_2_0_types_borrow_io_error_t; +typedef wasi_io_error_borrow_error_t wasi_http_types_borrow_io_error_t; typedef struct { bool is_some; - wasi_http_0_2_0_types_error_code_t val; -} wasi_http_0_2_0_types_option_error_code_t; + wasi_http_types_error_code_t val; +} wasi_http_types_option_error_code_t; typedef struct { - wasi_http_0_2_0_types_field_key_t f0; - wasi_http_0_2_0_types_field_value_t f1; -} wasi_http_0_2_0_types_tuple2_field_key_field_value_t; + wasi_http_types_field_key_t f0; + wasi_http_types_field_value_t f1; +} bindings_tuple2_field_key_field_value_t; typedef struct { - wasi_http_0_2_0_types_tuple2_field_key_field_value_t *ptr; + bindings_tuple2_field_key_field_value_t *ptr; size_t len; -} wasi_http_0_2_0_types_list_tuple2_field_key_field_value_t; +} bindings_list_tuple2_field_key_field_value_t; typedef struct { bool is_err; union { - wasi_http_0_2_0_types_own_fields_t ok; - wasi_http_0_2_0_types_header_error_t err; + wasi_http_types_own_fields_t ok; + wasi_http_types_header_error_t err; } val; -} wasi_http_0_2_0_types_result_own_fields_header_error_t; +} wasi_http_types_result_own_fields_header_error_t; typedef struct { - wasi_http_0_2_0_types_field_value_t *ptr; + wasi_http_types_field_value_t *ptr; size_t len; -} wasi_http_0_2_0_types_list_field_value_t; +} bindings_list_field_value_t; typedef struct { bool is_err; union { - wasi_http_0_2_0_types_header_error_t err; + wasi_http_types_header_error_t err; } val; -} wasi_http_0_2_0_types_result_void_header_error_t; +} wasi_http_types_result_void_header_error_t; typedef struct { bool is_some; - wasi_http_0_2_0_types_scheme_t val; -} wasi_http_0_2_0_types_option_scheme_t; + wasi_http_types_scheme_t val; +} wasi_http_types_option_scheme_t; -typedef wasi_http_0_2_0_types_own_fields_t wasi_http_0_2_0_types_own_headers_t; +typedef wasi_http_types_own_fields_t wasi_http_types_own_headers_t; typedef struct { bool is_err; union { - wasi_http_0_2_0_types_own_incoming_body_t ok; + wasi_http_types_own_incoming_body_t ok; } val; -} wasi_http_0_2_0_types_result_own_incoming_body_void_t; +} wasi_http_types_result_own_incoming_body_void_t; typedef struct { bool is_err; union { - wasi_http_0_2_0_types_own_outgoing_body_t ok; + wasi_http_types_own_outgoing_body_t ok; } val; -} wasi_http_0_2_0_types_result_own_outgoing_body_void_t; +} wasi_http_types_result_own_outgoing_body_void_t; typedef struct { bool is_err; -} wasi_http_0_2_0_types_result_void_void_t; +} wasi_http_types_result_void_void_t; typedef struct { bool is_some; - wasi_http_0_2_0_types_duration_t val; -} wasi_http_0_2_0_types_option_duration_t; + wasi_http_types_duration_t val; +} bindings_option_duration_t; typedef struct { bool is_err; union { - wasi_http_0_2_0_types_own_outgoing_response_t ok; - wasi_http_0_2_0_types_error_code_t err; + wasi_http_types_own_outgoing_response_t ok; + wasi_http_types_error_code_t err; } val; -} wasi_http_0_2_0_types_result_own_outgoing_response_error_code_t; +} wasi_http_types_result_own_outgoing_response_error_code_t; -typedef wasi_io_0_2_0_streams_own_input_stream_t wasi_http_0_2_0_types_own_input_stream_t; +typedef wasi_io_streams_own_input_stream_t wasi_http_types_own_input_stream_t; typedef struct { bool is_err; union { - wasi_http_0_2_0_types_own_input_stream_t ok; + wasi_http_types_own_input_stream_t ok; } val; -} wasi_http_0_2_0_types_result_own_input_stream_void_t; +} wasi_http_types_result_own_input_stream_void_t; -typedef wasi_io_0_2_0_poll_own_pollable_t wasi_http_0_2_0_types_own_pollable_t; +typedef wasi_io_poll_own_pollable_t wasi_http_types_own_pollable_t; -typedef wasi_http_0_2_0_types_own_fields_t wasi_http_0_2_0_types_own_trailers_t; +typedef wasi_http_types_own_fields_t wasi_http_types_own_trailers_t; typedef struct { bool is_some; - wasi_http_0_2_0_types_own_trailers_t val; -} wasi_http_0_2_0_types_option_own_trailers_t; + wasi_http_types_own_trailers_t val; +} wasi_http_types_option_own_trailers_t; typedef struct { bool is_err; union { - wasi_http_0_2_0_types_option_own_trailers_t ok; - wasi_http_0_2_0_types_error_code_t err; + wasi_http_types_option_own_trailers_t ok; + wasi_http_types_error_code_t err; } val; -} wasi_http_0_2_0_types_result_option_own_trailers_error_code_t; +} wasi_http_types_result_option_own_trailers_error_code_t; typedef struct { bool is_err; union { - wasi_http_0_2_0_types_result_option_own_trailers_error_code_t ok; + wasi_http_types_result_option_own_trailers_error_code_t ok; } val; -} wasi_http_0_2_0_types_result_result_option_own_trailers_error_code_void_t; +} wasi_http_types_result_result_option_own_trailers_error_code_void_t; typedef struct { bool is_some; - wasi_http_0_2_0_types_result_result_option_own_trailers_error_code_void_t val; -} wasi_http_0_2_0_types_option_result_result_option_own_trailers_error_code_void_t; + wasi_http_types_result_result_option_own_trailers_error_code_void_t val; +} wasi_http_types_option_result_result_option_own_trailers_error_code_void_t; -typedef wasi_io_0_2_0_streams_own_output_stream_t wasi_http_0_2_0_types_own_output_stream_t; +typedef wasi_io_streams_own_output_stream_t wasi_http_types_own_output_stream_t; typedef struct { bool is_err; union { - wasi_http_0_2_0_types_own_output_stream_t ok; + wasi_http_types_own_output_stream_t ok; } val; -} wasi_http_0_2_0_types_result_own_output_stream_void_t; +} wasi_http_types_result_own_output_stream_void_t; typedef struct { bool is_err; union { - wasi_http_0_2_0_types_error_code_t err; + wasi_http_types_error_code_t err; } val; -} wasi_http_0_2_0_types_result_void_error_code_t; +} wasi_http_types_result_void_error_code_t; typedef struct { bool is_err; union { - wasi_http_0_2_0_types_own_incoming_response_t ok; - wasi_http_0_2_0_types_error_code_t err; + wasi_http_types_own_incoming_response_t ok; + wasi_http_types_error_code_t err; } val; -} wasi_http_0_2_0_types_result_own_incoming_response_error_code_t; +} wasi_http_types_result_own_incoming_response_error_code_t; typedef struct { bool is_err; union { - wasi_http_0_2_0_types_result_own_incoming_response_error_code_t ok; + wasi_http_types_result_own_incoming_response_error_code_t ok; } val; -} wasi_http_0_2_0_types_result_result_own_incoming_response_error_code_void_t; +} wasi_http_types_result_result_own_incoming_response_error_code_void_t; typedef struct { bool is_some; - wasi_http_0_2_0_types_result_result_own_incoming_response_error_code_void_t val; -} wasi_http_0_2_0_types_option_result_result_own_incoming_response_error_code_void_t; + wasi_http_types_result_result_own_incoming_response_error_code_void_t val; +} wasi_http_types_option_result_result_own_incoming_response_error_code_void_t; -typedef wasi_http_0_2_0_types_error_code_t wasi_http_0_2_0_outgoing_handler_error_code_t; +typedef wasi_http_types_error_code_t wasi_http_outgoing_handler_error_code_t; -typedef wasi_http_0_2_0_types_own_outgoing_request_t wasi_http_0_2_0_outgoing_handler_own_outgoing_request_t; +typedef wasi_http_types_own_outgoing_request_t wasi_http_outgoing_handler_own_outgoing_request_t; -typedef wasi_http_0_2_0_types_own_request_options_t wasi_http_0_2_0_outgoing_handler_own_request_options_t; +typedef wasi_http_types_own_request_options_t wasi_http_outgoing_handler_own_request_options_t; typedef struct { bool is_some; - wasi_http_0_2_0_outgoing_handler_own_request_options_t val; -} wasi_http_0_2_0_outgoing_handler_option_own_request_options_t; + wasi_http_outgoing_handler_own_request_options_t val; +} wasi_http_outgoing_handler_option_own_request_options_t; -typedef wasi_http_0_2_0_types_own_future_incoming_response_t wasi_http_0_2_0_outgoing_handler_own_future_incoming_response_t; +typedef wasi_http_types_own_future_incoming_response_t wasi_http_outgoing_handler_own_future_incoming_response_t; typedef struct { bool is_err; union { - wasi_http_0_2_0_outgoing_handler_own_future_incoming_response_t ok; - wasi_http_0_2_0_outgoing_handler_error_code_t err; + wasi_http_outgoing_handler_own_future_incoming_response_t ok; + wasi_http_outgoing_handler_error_code_t err; } val; -} wasi_http_0_2_0_outgoing_handler_result_own_future_incoming_response_error_code_t; +} wasi_http_outgoing_handler_result_own_future_incoming_response_error_code_t; typedef struct { bool is_err; -} exports_wasi_cli_0_2_0_run_result_void_void_t; +} exports_wasi_cli_run_result_void_void_t; -typedef wasi_http_0_2_0_types_own_incoming_request_t exports_wasi_http_0_2_0_incoming_handler_own_incoming_request_t; +typedef wasi_http_types_own_incoming_request_t exports_wasi_http_incoming_handler_own_incoming_request_t; -typedef wasi_http_0_2_0_types_own_response_outparam_t exports_wasi_http_0_2_0_incoming_handler_own_response_outparam_t; +typedef wasi_http_types_own_response_outparam_t exports_wasi_http_incoming_handler_own_response_outparam_t; // Imported Functions from `gcore:fastedge/dictionary` // Get the value associated with the specified `key` @@ -1538,6 +1535,14 @@ typedef wasi_http_0_2_0_types_own_response_outparam_t exports_wasi_http_0_2_0_in // Returns `ok(none)` if the key does not exist. extern bool gcore_fastedge_dictionary_get(bindings_string_t *name, bindings_string_t *ret); +// Imported Functions from `gcore:fastedge/secret` +// Get the secret associated with the specified `key` efective at current timestamp. +// Returns `ok(none)` if the key does not exist. +extern bool gcore_fastedge_secret_get(bindings_string_t *key, bindings_option_string_t *ret, gcore_fastedge_secret_error_t *err); +// Get the secret associated with the specified `key` effective `at` given timestamp in seconds. +// Returns `ok(none)` if the key does not exist. +extern bool gcore_fastedge_secret_get_effective_at(bindings_string_t *key, uint32_t at, bindings_option_string_t *ret, gcore_fastedge_secret_error_t *err); + // Imported Functions from `wasi:cli/environment@0.2.0` // Get the POSIX-style environment variables. // @@ -1547,16 +1552,16 @@ extern bool gcore_fastedge_dictionary_get(bindings_string_t *name, bindings_stri // Morally, these are a value import, but until value imports are available // in the component model, this import function should return the same // values each time it is called. -extern void wasi_cli_0_2_0_environment_get_environment(wasi_cli_0_2_0_environment_list_tuple2_string_string_t *ret); +extern void wasi_cli_environment_get_environment(bindings_list_tuple2_string_string_t *ret); // Get the POSIX-style arguments to the program. -extern void wasi_cli_0_2_0_environment_get_arguments(wasi_cli_0_2_0_environment_list_string_t *ret); +extern void wasi_cli_environment_get_arguments(bindings_list_string_t *ret); // Return a path that programs should use as their initial current working // directory, interpreting `.` as shorthand for this. -extern bool wasi_cli_0_2_0_environment_initial_cwd(bindings_string_t *ret); +extern bool wasi_cli_environment_initial_cwd(bindings_string_t *ret); // Imported Functions from `wasi:cli/exit@0.2.0` // Exit the current instance and any linked instances. -extern void wasi_cli_0_2_0_exit_exit(wasi_cli_0_2_0_exit_result_void_void_t *status); +extern void wasi_cli_exit_exit(wasi_cli_exit_result_void_void_t *status); // Imported Functions from `wasi:io/error@0.2.0` // Returns a string that is suitable to assist humans in debugging @@ -1566,19 +1571,19 @@ extern void wasi_cli_0_2_0_exit_exit(wasi_cli_0_2_0_exit_result_void_void_t *sta // It may change across platforms, hosts, or other implementation // details. Parsing this string is a major platform-compatibility // hazard. -extern void wasi_io_0_2_0_error_method_error_to_debug_string(wasi_io_0_2_0_error_borrow_error_t self, bindings_string_t *ret); +extern void wasi_io_error_method_error_to_debug_string(wasi_io_error_borrow_error_t self, bindings_string_t *ret); // Imported Functions from `wasi:io/poll@0.2.0` // Return the readiness of a pollable. This function never blocks. // // Returns `true` when the pollable is ready, and `false` otherwise. -extern bool wasi_io_0_2_0_poll_method_pollable_ready(wasi_io_0_2_0_poll_borrow_pollable_t self); +extern bool wasi_io_poll_method_pollable_ready(wasi_io_poll_borrow_pollable_t self); // `block` returns immediately if the pollable is ready, and otherwise // blocks until ready. // // This function is equivalent to calling `poll.poll` on a list // containing only this pollable. -extern void wasi_io_0_2_0_poll_method_pollable_block(wasi_io_0_2_0_poll_borrow_pollable_t self); +extern void wasi_io_poll_method_pollable_block(wasi_io_poll_borrow_pollable_t self); // Poll for completion on a set of pollables. // // This function takes a list of pollables, which identify I/O sources of @@ -1598,7 +1603,7 @@ extern void wasi_io_0_2_0_poll_method_pollable_block(wasi_io_0_2_0_poll_borrow_p // do any I/O so it doesn't fail. If any of the I/O sources identified by // the pollables has an error, it is indicated by marking the source as // being reaedy for I/O. -extern void wasi_io_0_2_0_poll_poll(wasi_io_0_2_0_poll_list_borrow_pollable_t *in, wasi_io_0_2_0_poll_list_u32_t *ret); +extern void wasi_io_poll_poll(wasi_io_poll_list_borrow_pollable_t *in, bindings_list_u32_t *ret); // Imported Functions from `wasi:io/streams@0.2.0` // Perform a non-blocking read from the stream. @@ -1627,25 +1632,25 @@ extern void wasi_io_0_2_0_poll_poll(wasi_io_0_2_0_poll_list_borrow_pollable_t *i // is not possible to allocate in wasm32, or not desirable to allocate as // as a return value by the callee. The callee may return a list of bytes // less than `len` in size while more bytes are available for reading. -extern bool wasi_io_0_2_0_streams_method_input_stream_read(wasi_io_0_2_0_streams_borrow_input_stream_t self, uint64_t len, wasi_io_0_2_0_streams_list_u8_t *ret, wasi_io_0_2_0_streams_stream_error_t *err); +extern bool wasi_io_streams_method_input_stream_read(wasi_io_streams_borrow_input_stream_t self, uint64_t len, bindings_list_u8_t *ret, wasi_io_streams_stream_error_t *err); // Read bytes from a stream, after blocking until at least one byte can // be read. Except for blocking, behavior is identical to `read`. -extern bool wasi_io_0_2_0_streams_method_input_stream_blocking_read(wasi_io_0_2_0_streams_borrow_input_stream_t self, uint64_t len, wasi_io_0_2_0_streams_list_u8_t *ret, wasi_io_0_2_0_streams_stream_error_t *err); +extern bool wasi_io_streams_method_input_stream_blocking_read(wasi_io_streams_borrow_input_stream_t self, uint64_t len, bindings_list_u8_t *ret, wasi_io_streams_stream_error_t *err); // Skip bytes from a stream. Returns number of bytes skipped. // // Behaves identical to `read`, except instead of returning a list // of bytes, returns the number of bytes consumed from the stream. -extern bool wasi_io_0_2_0_streams_method_input_stream_skip(wasi_io_0_2_0_streams_borrow_input_stream_t self, uint64_t len, uint64_t *ret, wasi_io_0_2_0_streams_stream_error_t *err); +extern bool wasi_io_streams_method_input_stream_skip(wasi_io_streams_borrow_input_stream_t self, uint64_t len, uint64_t *ret, wasi_io_streams_stream_error_t *err); // Skip bytes from a stream, after blocking until at least one byte // can be skipped. Except for blocking behavior, identical to `skip`. -extern bool wasi_io_0_2_0_streams_method_input_stream_blocking_skip(wasi_io_0_2_0_streams_borrow_input_stream_t self, uint64_t len, uint64_t *ret, wasi_io_0_2_0_streams_stream_error_t *err); +extern bool wasi_io_streams_method_input_stream_blocking_skip(wasi_io_streams_borrow_input_stream_t self, uint64_t len, uint64_t *ret, wasi_io_streams_stream_error_t *err); // Create a `pollable` which will resolve once either the specified stream // has bytes available to read or the other end of the stream has been // closed. // The created `pollable` is a child resource of the `input-stream`. // Implementations may trap if the `input-stream` is dropped before // all derived `pollable`s created with this function are dropped. -extern wasi_io_0_2_0_streams_own_pollable_t wasi_io_0_2_0_streams_method_input_stream_subscribe(wasi_io_0_2_0_streams_borrow_input_stream_t self); +extern wasi_io_streams_own_pollable_t wasi_io_streams_method_input_stream_subscribe(wasi_io_streams_borrow_input_stream_t self); // Check readiness for writing. This function never blocks. // // Returns the number of bytes permitted for the next call to `write`, @@ -1655,7 +1660,7 @@ extern wasi_io_0_2_0_streams_own_pollable_t wasi_io_0_2_0_streams_method_input_s // When this function returns 0 bytes, the `subscribe` pollable will // become ready when this function will report at least 1 byte, or an // error. -extern bool wasi_io_0_2_0_streams_method_output_stream_check_write(wasi_io_0_2_0_streams_borrow_output_stream_t self, uint64_t *ret, wasi_io_0_2_0_streams_stream_error_t *err); +extern bool wasi_io_streams_method_output_stream_check_write(wasi_io_streams_borrow_output_stream_t self, uint64_t *ret, wasi_io_streams_stream_error_t *err); // Perform a write. This function never blocks. // // When the destination of a `write` is binary data, the bytes from @@ -1669,7 +1674,7 @@ extern bool wasi_io_0_2_0_streams_method_output_stream_check_write(wasi_io_0_2_0 // // returns Err(closed) without writing if the stream has closed since // the last call to check-write provided a permit. -extern bool wasi_io_0_2_0_streams_method_output_stream_write(wasi_io_0_2_0_streams_borrow_output_stream_t self, wasi_io_0_2_0_streams_list_u8_t *contents, wasi_io_0_2_0_streams_stream_error_t *err); +extern bool wasi_io_streams_method_output_stream_write(wasi_io_streams_borrow_output_stream_t self, bindings_list_u8_t *contents, wasi_io_streams_stream_error_t *err); // Perform a write of up to 4096 bytes, and then flush the stream. Block // until all of these operations are complete, or an error occurs. // @@ -1680,1726 +1685,1692 @@ extern bool wasi_io_0_2_0_streams_method_output_stream_write(wasi_io_0_2_0_strea // ```text // let pollable = this.subscribe(); // while !contents.is_empty() { - // // Wait for the stream to become writable - // pollable.block(); - // let Ok(n) = this.check-write(); // eliding error handling - // let len = min(n, contents.len()); - // let (chunk, rest) = contents.split_at(len); - // this.write(chunk ); // eliding error handling - // contents = rest; - // } - // this.flush(); - // // Wait for completion of `flush` - // pollable.block(); - // // Check for any errors that arose during `flush` - // let _ = this.check-write(); // eliding error handling - // ``` - extern bool wasi_io_0_2_0_streams_method_output_stream_blocking_write_and_flush(wasi_io_0_2_0_streams_borrow_output_stream_t self, wasi_io_0_2_0_streams_list_u8_t *contents, wasi_io_0_2_0_streams_stream_error_t *err); - // Request to flush buffered output. This function never blocks. - // - // This tells the output-stream that the caller intends any buffered - // output to be flushed. the output which is expected to be flushed - // is all that has been passed to `write` prior to this call. - // - // Upon calling this function, the `output-stream` will not accept any - // writes (`check-write` will return `ok(0)`) until the flush has - // completed. The `subscribe` pollable will become ready when the - // flush has completed and the stream can accept more writes. - extern bool wasi_io_0_2_0_streams_method_output_stream_flush(wasi_io_0_2_0_streams_borrow_output_stream_t self, wasi_io_0_2_0_streams_stream_error_t *err); - // Request to flush buffered output, and block until flush completes - // and stream is ready for writing again. - extern bool wasi_io_0_2_0_streams_method_output_stream_blocking_flush(wasi_io_0_2_0_streams_borrow_output_stream_t self, wasi_io_0_2_0_streams_stream_error_t *err); - // Create a `pollable` which will resolve once the output-stream - // is ready for more writing, or an error has occured. When this - // pollable is ready, `check-write` will return `ok(n)` with n>0, or an - // error. - // - // If the stream is closed, this pollable is always ready immediately. - // - // The created `pollable` is a child resource of the `output-stream`. - // Implementations may trap if the `output-stream` is dropped before - // all derived `pollable`s created with this function are dropped. - extern wasi_io_0_2_0_streams_own_pollable_t wasi_io_0_2_0_streams_method_output_stream_subscribe(wasi_io_0_2_0_streams_borrow_output_stream_t self); - // Write zeroes to a stream. - // - // This should be used precisely like `write` with the exact same - // preconditions (must use check-write first), but instead of - // passing a list of bytes, you simply pass the number of zero-bytes - // that should be written. - extern bool wasi_io_0_2_0_streams_method_output_stream_write_zeroes(wasi_io_0_2_0_streams_borrow_output_stream_t self, uint64_t len, wasi_io_0_2_0_streams_stream_error_t *err); - // Perform a write of up to 4096 zeroes, and then flush the stream. - // Block until all of these operations are complete, or an error - // occurs. - // - // This is a convenience wrapper around the use of `check-write`, - // `subscribe`, `write-zeroes`, and `flush`, and is implemented with - // the following pseudo-code: - // - // ```text - // let pollable = this.subscribe(); - // while num_zeroes != 0 { - // // Wait for the stream to become writable - // pollable.block(); - // let Ok(n) = this.check-write(); // eliding error handling - // let len = min(n, num_zeroes); - // this.write-zeroes(len); // eliding error handling - // num_zeroes -= len; - // } - // this.flush(); - // // Wait for completion of `flush` - // pollable.block(); - // // Check for any errors that arose during `flush` - // let _ = this.check-write(); // eliding error handling - // ``` - extern bool wasi_io_0_2_0_streams_method_output_stream_blocking_write_zeroes_and_flush(wasi_io_0_2_0_streams_borrow_output_stream_t self, uint64_t len, wasi_io_0_2_0_streams_stream_error_t *err); - // Read from one stream and write to another. - // - // The behavior of splice is equivelant to: - // 1. calling `check-write` on the `output-stream` - // 2. calling `read` on the `input-stream` with the smaller of the - // `check-write` permitted length and the `len` provided to `splice` - // 3. calling `write` on the `output-stream` with that read data. - // - // Any error reported by the call to `check-write`, `read`, or - // `write` ends the splice and reports that error. - // - // This function returns the number of bytes transferred; it may be less - // than `len`. - extern bool wasi_io_0_2_0_streams_method_output_stream_splice(wasi_io_0_2_0_streams_borrow_output_stream_t self, wasi_io_0_2_0_streams_borrow_input_stream_t src, uint64_t len, uint64_t *ret, wasi_io_0_2_0_streams_stream_error_t *err); - // Read from one stream and write to another, with blocking. - // - // This is similar to `splice`, except that it blocks until the - // `output-stream` is ready for writing, and the `input-stream` - // is ready for reading, before performing the `splice`. - extern bool wasi_io_0_2_0_streams_method_output_stream_blocking_splice(wasi_io_0_2_0_streams_borrow_output_stream_t self, wasi_io_0_2_0_streams_borrow_input_stream_t src, uint64_t len, uint64_t *ret, wasi_io_0_2_0_streams_stream_error_t *err); - - // Imported Functions from `wasi:cli/stdin@0.2.0` - extern wasi_cli_0_2_0_stdin_own_input_stream_t wasi_cli_0_2_0_stdin_get_stdin(void); - - // Imported Functions from `wasi:cli/stdout@0.2.0` - extern wasi_cli_0_2_0_stdout_own_output_stream_t wasi_cli_0_2_0_stdout_get_stdout(void); - - // Imported Functions from `wasi:cli/stderr@0.2.0` - extern wasi_cli_0_2_0_stderr_own_output_stream_t wasi_cli_0_2_0_stderr_get_stderr(void); - - // Imported Functions from `wasi:cli/terminal-stdin@0.2.0` - // If stdin is connected to a terminal, return a `terminal-input` handle - // allowing further interaction with it. - extern bool wasi_cli_0_2_0_terminal_stdin_get_terminal_stdin(wasi_cli_0_2_0_terminal_stdin_own_terminal_input_t *ret); - - // Imported Functions from `wasi:cli/terminal-stdout@0.2.0` - // If stdout is connected to a terminal, return a `terminal-output` handle - // allowing further interaction with it. - extern bool wasi_cli_0_2_0_terminal_stdout_get_terminal_stdout(wasi_cli_0_2_0_terminal_stdout_own_terminal_output_t *ret); - - // Imported Functions from `wasi:cli/terminal-stderr@0.2.0` - // If stderr is connected to a terminal, return a `terminal-output` handle - // allowing further interaction with it. - extern bool wasi_cli_0_2_0_terminal_stderr_get_terminal_stderr(wasi_cli_0_2_0_terminal_stderr_own_terminal_output_t *ret); - - // Imported Functions from `wasi:clocks/monotonic-clock@0.2.0` - // Read the current value of the clock. - // - // The clock is monotonic, therefore calling this function repeatedly will - // produce a sequence of non-decreasing values. - extern wasi_clocks_0_2_0_monotonic_clock_instant_t wasi_clocks_0_2_0_monotonic_clock_now(void); - // Query the resolution of the clock. Returns the duration of time - // corresponding to a clock tick. - extern wasi_clocks_0_2_0_monotonic_clock_duration_t wasi_clocks_0_2_0_monotonic_clock_resolution(void); - // Create a `pollable` which will resolve once the specified instant - // occured. - extern wasi_clocks_0_2_0_monotonic_clock_own_pollable_t wasi_clocks_0_2_0_monotonic_clock_subscribe_instant(wasi_clocks_0_2_0_monotonic_clock_instant_t when); - // Create a `pollable` which will resolve once the given duration has - // elapsed, starting at the time at which this function was called. - // occured. - extern wasi_clocks_0_2_0_monotonic_clock_own_pollable_t wasi_clocks_0_2_0_monotonic_clock_subscribe_duration(wasi_clocks_0_2_0_monotonic_clock_duration_t when); - - // Imported Functions from `wasi:clocks/wall-clock@0.2.0` - // Read the current value of the clock. - // - // This clock is not monotonic, therefore calling this function repeatedly - // will not necessarily produce a sequence of non-decreasing values. - // - // The returned timestamps represent the number of seconds since - // 1970-01-01T00:00:00Z, also known as [POSIX's Seconds Since the Epoch], - // also known as [Unix Time]. - // - // The nanoseconds field of the output is always less than 1000000000. - // - // [POSIX's Seconds Since the Epoch]: https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xbd_chap04.html#tag_21_04_16 - // [Unix Time]: https://en.wikipedia.org/wiki/Unix_time - extern void wasi_clocks_0_2_0_wall_clock_now(wasi_clocks_0_2_0_wall_clock_datetime_t *ret); - // Query the resolution of the clock. - // - // The nanoseconds field of the output is always less than 1000000000. - extern void wasi_clocks_0_2_0_wall_clock_resolution(wasi_clocks_0_2_0_wall_clock_datetime_t *ret); - - // Imported Functions from `wasi:filesystem/types@0.2.0` - // Return a stream for reading from a file, if available. - // - // May fail with an error-code describing why the file cannot be read. - // - // Multiple read, write, and append streams may be active on the same open - // file and they do not interfere with each other. - // - // Note: This allows using `read-stream`, which is similar to `read` in POSIX. - extern bool wasi_filesystem_0_2_0_types_method_descriptor_read_via_stream(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, wasi_filesystem_0_2_0_types_filesize_t offset, wasi_filesystem_0_2_0_types_own_input_stream_t *ret, wasi_filesystem_0_2_0_types_error_code_t *err); - // Return a stream for writing to a file, if available. - // - // May fail with an error-code describing why the file cannot be written. - // - // Note: This allows using `write-stream`, which is similar to `write` in - // POSIX. - extern bool wasi_filesystem_0_2_0_types_method_descriptor_write_via_stream(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, wasi_filesystem_0_2_0_types_filesize_t offset, wasi_filesystem_0_2_0_types_own_output_stream_t *ret, wasi_filesystem_0_2_0_types_error_code_t *err); - // Return a stream for appending to a file, if available. - // - // May fail with an error-code describing why the file cannot be appended. - // - // Note: This allows using `write-stream`, which is similar to `write` with - // `O_APPEND` in in POSIX. - extern bool wasi_filesystem_0_2_0_types_method_descriptor_append_via_stream(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, wasi_filesystem_0_2_0_types_own_output_stream_t *ret, wasi_filesystem_0_2_0_types_error_code_t *err); - // Provide file advisory information on a descriptor. - // - // This is similar to `posix_fadvise` in POSIX. - extern bool wasi_filesystem_0_2_0_types_method_descriptor_advise(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, wasi_filesystem_0_2_0_types_filesize_t offset, wasi_filesystem_0_2_0_types_filesize_t length, wasi_filesystem_0_2_0_types_advice_t advice, wasi_filesystem_0_2_0_types_error_code_t *err); - // Synchronize the data of a file to disk. - // - // This function succeeds with no effect if the file descriptor is not - // opened for writing. - // - // Note: This is similar to `fdatasync` in POSIX. - extern bool wasi_filesystem_0_2_0_types_method_descriptor_sync_data(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, wasi_filesystem_0_2_0_types_error_code_t *err); - // Get flags associated with a descriptor. - // - // Note: This returns similar flags to `fcntl(fd, F_GETFL)` in POSIX. - // - // Note: This returns the value that was the `fs_flags` value returned - // from `fdstat_get` in earlier versions of WASI. - extern bool wasi_filesystem_0_2_0_types_method_descriptor_get_flags(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, wasi_filesystem_0_2_0_types_descriptor_flags_t *ret, wasi_filesystem_0_2_0_types_error_code_t *err); - // Get the dynamic type of a descriptor. - // - // Note: This returns the same value as the `type` field of the `fd-stat` - // returned by `stat`, `stat-at` and similar. - // - // Note: This returns similar flags to the `st_mode & S_IFMT` value provided - // by `fstat` in POSIX. - // - // Note: This returns the value that was the `fs_filetype` value returned - // from `fdstat_get` in earlier versions of WASI. - extern bool wasi_filesystem_0_2_0_types_method_descriptor_get_type(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, wasi_filesystem_0_2_0_types_descriptor_type_t *ret, wasi_filesystem_0_2_0_types_error_code_t *err); - // Adjust the size of an open file. If this increases the file's size, the - // extra bytes are filled with zeros. - // - // Note: This was called `fd_filestat_set_size` in earlier versions of WASI. - extern bool wasi_filesystem_0_2_0_types_method_descriptor_set_size(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, wasi_filesystem_0_2_0_types_filesize_t size, wasi_filesystem_0_2_0_types_error_code_t *err); - // Adjust the timestamps of an open file or directory. - // - // Note: This is similar to `futimens` in POSIX. - // - // Note: This was called `fd_filestat_set_times` in earlier versions of WASI. - extern bool wasi_filesystem_0_2_0_types_method_descriptor_set_times(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, wasi_filesystem_0_2_0_types_new_timestamp_t *data_access_timestamp, wasi_filesystem_0_2_0_types_new_timestamp_t *data_modification_timestamp, wasi_filesystem_0_2_0_types_error_code_t *err); - // Read from a descriptor, without using and updating the descriptor's offset. - // - // This function returns a list of bytes containing the data that was - // read, along with a bool which, when true, indicates that the end of the - // file was reached. The returned list will contain up to `length` bytes; it - // may return fewer than requested, if the end of the file is reached or - // if the I/O operation is interrupted. - // - // In the future, this may change to return a `stream`. - // - // Note: This is similar to `pread` in POSIX. - extern bool wasi_filesystem_0_2_0_types_method_descriptor_read(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, wasi_filesystem_0_2_0_types_filesize_t length, wasi_filesystem_0_2_0_types_filesize_t offset, wasi_filesystem_0_2_0_types_tuple2_list_u8_bool_t *ret, wasi_filesystem_0_2_0_types_error_code_t *err); - // Write to a descriptor, without using and updating the descriptor's offset. - // - // It is valid to write past the end of a file; the file is extended to the - // extent of the write, with bytes between the previous end and the start of - // the write set to zero. - // - // In the future, this may change to take a `stream`. - // - // Note: This is similar to `pwrite` in POSIX. - extern bool wasi_filesystem_0_2_0_types_method_descriptor_write(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, wasi_filesystem_0_2_0_types_list_u8_t *buffer, wasi_filesystem_0_2_0_types_filesize_t offset, wasi_filesystem_0_2_0_types_filesize_t *ret, wasi_filesystem_0_2_0_types_error_code_t *err); - // Read directory entries from a directory. - // - // On filesystems where directories contain entries referring to themselves - // and their parents, often named `.` and `..` respectively, these entries - // are omitted. - // - // This always returns a new stream which starts at the beginning of the - // directory. Multiple streams may be active on the same directory, and they - // do not interfere with each other. - extern bool wasi_filesystem_0_2_0_types_method_descriptor_read_directory(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, wasi_filesystem_0_2_0_types_own_directory_entry_stream_t *ret, wasi_filesystem_0_2_0_types_error_code_t *err); - // Synchronize the data and metadata of a file to disk. - // - // This function succeeds with no effect if the file descriptor is not - // opened for writing. - // - // Note: This is similar to `fsync` in POSIX. - extern bool wasi_filesystem_0_2_0_types_method_descriptor_sync(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, wasi_filesystem_0_2_0_types_error_code_t *err); - // Create a directory. - // - // Note: This is similar to `mkdirat` in POSIX. - extern bool wasi_filesystem_0_2_0_types_method_descriptor_create_directory_at(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, bindings_string_t *path, wasi_filesystem_0_2_0_types_error_code_t *err); - // Return the attributes of an open file or directory. - // - // Note: This is similar to `fstat` in POSIX, except that it does not return - // device and inode information. For testing whether two descriptors refer to - // the same underlying filesystem object, use `is-same-object`. To obtain - // additional data that can be used do determine whether a file has been - // modified, use `metadata-hash`. - // - // Note: This was called `fd_filestat_get` in earlier versions of WASI. - extern bool wasi_filesystem_0_2_0_types_method_descriptor_stat(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, wasi_filesystem_0_2_0_types_descriptor_stat_t *ret, wasi_filesystem_0_2_0_types_error_code_t *err); - // Return the attributes of a file or directory. - // - // Note: This is similar to `fstatat` in POSIX, except that it does not - // return device and inode information. See the `stat` description for a - // discussion of alternatives. - // - // Note: This was called `path_filestat_get` in earlier versions of WASI. - extern bool wasi_filesystem_0_2_0_types_method_descriptor_stat_at(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, wasi_filesystem_0_2_0_types_path_flags_t path_flags, bindings_string_t *path, wasi_filesystem_0_2_0_types_descriptor_stat_t *ret, wasi_filesystem_0_2_0_types_error_code_t *err); - // Adjust the timestamps of a file or directory. - // - // Note: This is similar to `utimensat` in POSIX. - // - // Note: This was called `path_filestat_set_times` in earlier versions of - // WASI. - extern bool wasi_filesystem_0_2_0_types_method_descriptor_set_times_at(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, wasi_filesystem_0_2_0_types_path_flags_t path_flags, bindings_string_t *path, wasi_filesystem_0_2_0_types_new_timestamp_t *data_access_timestamp, wasi_filesystem_0_2_0_types_new_timestamp_t *data_modification_timestamp, wasi_filesystem_0_2_0_types_error_code_t *err); - // Create a hard link. - // - // Note: This is similar to `linkat` in POSIX. - extern bool wasi_filesystem_0_2_0_types_method_descriptor_link_at(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, wasi_filesystem_0_2_0_types_path_flags_t old_path_flags, bindings_string_t *old_path, wasi_filesystem_0_2_0_types_borrow_descriptor_t new_descriptor, bindings_string_t *new_path, wasi_filesystem_0_2_0_types_error_code_t *err); - // Open a file or directory. - // - // The returned descriptor is not guaranteed to be the lowest-numbered - // descriptor not currently open/ it is randomized to prevent applications - // from depending on making assumptions about indexes, since this is - // error-prone in multi-threaded contexts. The returned descriptor is - // guaranteed to be less than 2**31. - // - // If `flags` contains `descriptor-flags::mutate-directory`, and the base - // descriptor doesn't have `descriptor-flags::mutate-directory` set, - // `open-at` fails with `error-code::read-only`. - // - // If `flags` contains `write` or `mutate-directory`, or `open-flags` - // contains `truncate` or `create`, and the base descriptor doesn't have - // `descriptor-flags::mutate-directory` set, `open-at` fails with - // `error-code::read-only`. - // - // Note: This is similar to `openat` in POSIX. - extern bool wasi_filesystem_0_2_0_types_method_descriptor_open_at(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, wasi_filesystem_0_2_0_types_path_flags_t path_flags, bindings_string_t *path, wasi_filesystem_0_2_0_types_open_flags_t open_flags, wasi_filesystem_0_2_0_types_descriptor_flags_t flags, wasi_filesystem_0_2_0_types_own_descriptor_t *ret, wasi_filesystem_0_2_0_types_error_code_t *err); - // Read the contents of a symbolic link. - // - // If the contents contain an absolute or rooted path in the underlying - // filesystem, this function fails with `error-code::not-permitted`. - // - // Note: This is similar to `readlinkat` in POSIX. - extern bool wasi_filesystem_0_2_0_types_method_descriptor_readlink_at(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, bindings_string_t *path, bindings_string_t *ret, wasi_filesystem_0_2_0_types_error_code_t *err); - // Remove a directory. - // - // Return `error-code::not-empty` if the directory is not empty. - // - // Note: This is similar to `unlinkat(fd, path, AT_REMOVEDIR)` in POSIX. - extern bool wasi_filesystem_0_2_0_types_method_descriptor_remove_directory_at(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, bindings_string_t *path, wasi_filesystem_0_2_0_types_error_code_t *err); - // Rename a filesystem object. - // - // Note: This is similar to `renameat` in POSIX. - extern bool wasi_filesystem_0_2_0_types_method_descriptor_rename_at(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, bindings_string_t *old_path, wasi_filesystem_0_2_0_types_borrow_descriptor_t new_descriptor, bindings_string_t *new_path, wasi_filesystem_0_2_0_types_error_code_t *err); - // Create a symbolic link (also known as a "symlink"). - // - // If `old-path` starts with `/`, the function fails with - // `error-code::not-permitted`. - // - // Note: This is similar to `symlinkat` in POSIX. - extern bool wasi_filesystem_0_2_0_types_method_descriptor_symlink_at(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, bindings_string_t *old_path, bindings_string_t *new_path, wasi_filesystem_0_2_0_types_error_code_t *err); - // Unlink a filesystem object that is not a directory. - // - // Return `error-code::is-directory` if the path refers to a directory. - // Note: This is similar to `unlinkat(fd, path, 0)` in POSIX. - extern bool wasi_filesystem_0_2_0_types_method_descriptor_unlink_file_at(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, bindings_string_t *path, wasi_filesystem_0_2_0_types_error_code_t *err); - // Test whether two descriptors refer to the same filesystem object. - // - // In POSIX, this corresponds to testing whether the two descriptors have the - // same device (`st_dev`) and inode (`st_ino` or `d_ino`) numbers. - // wasi-filesystem does not expose device and inode numbers, so this function - // may be used instead. - extern bool wasi_filesystem_0_2_0_types_method_descriptor_is_same_object(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, wasi_filesystem_0_2_0_types_borrow_descriptor_t other); - // Return a hash of the metadata associated with a filesystem object referred - // to by a descriptor. - // - // This returns a hash of the last-modification timestamp and file size, and - // may also include the inode number, device number, birth timestamp, and - // other metadata fields that may change when the file is modified or - // replaced. It may also include a secret value chosen by the - // implementation and not otherwise exposed. - // - // Implementations are encourated to provide the following properties: - // - // - If the file is not modified or replaced, the computed hash value should - // usually not change. - // - If the object is modified or replaced, the computed hash value should - // usually change. - // - The inputs to the hash should not be easily computable from the - // computed hash. - // - // However, none of these is required. - extern bool wasi_filesystem_0_2_0_types_method_descriptor_metadata_hash(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, wasi_filesystem_0_2_0_types_metadata_hash_value_t *ret, wasi_filesystem_0_2_0_types_error_code_t *err); - // Return a hash of the metadata associated with a filesystem object referred - // to by a directory descriptor and a relative path. - // - // This performs the same hash computation as `metadata-hash`. - extern bool wasi_filesystem_0_2_0_types_method_descriptor_metadata_hash_at(wasi_filesystem_0_2_0_types_borrow_descriptor_t self, wasi_filesystem_0_2_0_types_path_flags_t path_flags, bindings_string_t *path, wasi_filesystem_0_2_0_types_metadata_hash_value_t *ret, wasi_filesystem_0_2_0_types_error_code_t *err); - // Read a single directory entry from a `directory-entry-stream`. - extern bool wasi_filesystem_0_2_0_types_method_directory_entry_stream_read_directory_entry(wasi_filesystem_0_2_0_types_borrow_directory_entry_stream_t self, wasi_filesystem_0_2_0_types_option_directory_entry_t *ret, wasi_filesystem_0_2_0_types_error_code_t *err); - // Attempts to extract a filesystem-related `error-code` from the stream - // `error` provided. - // - // Stream operations which return `stream-error::last-operation-failed` - // have a payload with more information about the operation that failed. - // This payload can be passed through to this function to see if there's - // filesystem-related information about the error to return. - // - // Note that this function is fallible because not all stream-related - // errors are filesystem-related errors. - extern bool wasi_filesystem_0_2_0_types_filesystem_error_code(wasi_filesystem_0_2_0_types_borrow_error_t err_, wasi_filesystem_0_2_0_types_error_code_t *ret); - - // Imported Functions from `wasi:filesystem/preopens@0.2.0` - // Return the set of preopened directories, and their path. - extern void wasi_filesystem_0_2_0_preopens_get_directories(wasi_filesystem_0_2_0_preopens_list_tuple2_own_descriptor_string_t *ret); - - // Imported Functions from `wasi:sockets/instance-network@0.2.0` - // Get a handle to the default network. - extern wasi_sockets_0_2_0_instance_network_own_network_t wasi_sockets_0_2_0_instance_network_instance_network(void); - - // Imported Functions from `wasi:sockets/udp@0.2.0` - // Bind the socket to a specific network on the provided IP address and port. - // - // 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 port is zero, the socket will be bound to a random free port. - // - // # Typical errors - // - `invalid-argument`: The `local-address` has the wrong address family. (EAFNOSUPPORT, EFAULT on Windows) - // - `invalid-state`: The socket is already bound. (EINVAL) - // - `address-in-use`: No ephemeral ports available. (EADDRINUSE, ENOBUFS on Windows) - // - `address-in-use`: Address is already in use. (EADDRINUSE) - // - `address-not-bindable`: `local-address` is not an address that the `network` can bind to. (EADDRNOTAVAIL) - // - `not-in-progress`: A `bind` operation is not in progress. - // - `would-block`: Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN) - // - // # Implementors note - // Unlike in POSIX, in WASI the bind operation is async. This enables - // interactive WASI hosts to inject permission prompts. Runtimes that - // don't want to make use of this ability can simply call the native - // `bind` as part of either `start-bind` or `finish-bind`. - // - // # References - // - - // - - // - - // - - extern bool wasi_sockets_0_2_0_udp_method_udp_socket_start_bind(wasi_sockets_0_2_0_udp_borrow_udp_socket_t self, wasi_sockets_0_2_0_udp_borrow_network_t network, wasi_sockets_0_2_0_udp_ip_socket_address_t *local_address, wasi_sockets_0_2_0_udp_error_code_t *err); - extern bool wasi_sockets_0_2_0_udp_method_udp_socket_finish_bind(wasi_sockets_0_2_0_udp_borrow_udp_socket_t self, wasi_sockets_0_2_0_udp_error_code_t *err); - // Set up inbound & outbound communication channels, optionally to a specific peer. - // - // This function only changes the local socket configuration and does not generate any network traffic. - // On success, the `remote-address` of the socket is updated. The `local-address` may be updated as well, - // based on the best network path to `remote-address`. - // - // When a `remote-address` is provided, the returned streams are limited to communicating with that specific peer: - // - `send` can only be used to send to this destination. - // - `receive` will only return datagrams sent from the provided `remote-address`. - // - // This method may be called multiple times on the same socket to change its association, but - // only the most recently returned pair of streams will be operational. Implementations may trap if - // the streams returned by a previous invocation haven't been dropped yet before calling `stream` again. - // - // The POSIX equivalent in pseudo-code is: - // ```text - // if (was previously connected) { - // connect(s, AF_UNSPEC) - // } - // if (remote_address is Some) { - // connect(s, remote_address) - // } - // ``` - // - // Unlike in POSIX, the socket must already be explicitly bound. - // - // # Typical errors - // - `invalid-argument`: The `remote-address` has the wrong address family. (EAFNOSUPPORT) - // - `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-in-use`: Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE, EADDRNOTAVAIL on Linux, EAGAIN on BSD) - // - `remote-unreachable`: The remote address is not reachable. (ECONNRESET, ENETRESET, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET) - // - `connection-refused`: The connection was refused. (ECONNREFUSED) - // - // # References - // - - // - - // - - // - - extern bool wasi_sockets_0_2_0_udp_method_udp_socket_stream(wasi_sockets_0_2_0_udp_borrow_udp_socket_t self, wasi_sockets_0_2_0_udp_ip_socket_address_t *maybe_remote_address, wasi_sockets_0_2_0_udp_tuple2_own_incoming_datagram_stream_own_outgoing_datagram_stream_t *ret, wasi_sockets_0_2_0_udp_error_code_t *err); - // Get the current bound address. - // - // POSIX mentions: - // > If the socket has not been bound to a local name, the value - // > stored in the object pointed to by `address` is unspecified. - // - // WASI is stricter and requires `local-address` to return `invalid-state` when the socket hasn't been bound yet. - // - // # Typical errors - // - `invalid-state`: The socket is not bound to any local address. - // - // # References - // - - // - - // - - // - - extern bool wasi_sockets_0_2_0_udp_method_udp_socket_local_address(wasi_sockets_0_2_0_udp_borrow_udp_socket_t self, wasi_sockets_0_2_0_udp_ip_socket_address_t *ret, wasi_sockets_0_2_0_udp_error_code_t *err); - // Get the address the socket is currently streaming to. - // - // # Typical errors - // - `invalid-state`: The socket is not streaming to a specific remote address. (ENOTCONN) - // - // # References - // - - // - - // - - // - - extern bool wasi_sockets_0_2_0_udp_method_udp_socket_remote_address(wasi_sockets_0_2_0_udp_borrow_udp_socket_t self, wasi_sockets_0_2_0_udp_ip_socket_address_t *ret, wasi_sockets_0_2_0_udp_error_code_t *err); - // Whether this is a IPv4 or IPv6 socket. - // - // Equivalent to the SO_DOMAIN socket option. - extern wasi_sockets_0_2_0_udp_ip_address_family_t wasi_sockets_0_2_0_udp_method_udp_socket_address_family(wasi_sockets_0_2_0_udp_borrow_udp_socket_t self); - // Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options. - // - // If the provided value is 0, an `invalid-argument` error is returned. - // - // # Typical errors - // - `invalid-argument`: (set) The TTL value must be 1 or higher. - extern bool wasi_sockets_0_2_0_udp_method_udp_socket_unicast_hop_limit(wasi_sockets_0_2_0_udp_borrow_udp_socket_t self, uint8_t *ret, wasi_sockets_0_2_0_udp_error_code_t *err); - extern bool wasi_sockets_0_2_0_udp_method_udp_socket_set_unicast_hop_limit(wasi_sockets_0_2_0_udp_borrow_udp_socket_t self, uint8_t value, wasi_sockets_0_2_0_udp_error_code_t *err); - // The kernel buffer space reserved for sends/receives on this socket. - // - // If the provided value is 0, an `invalid-argument` error is returned. - // Any other value will never cause an error, but it might be silently clamped and/or rounded. - // I.e. after setting a value, reading the same setting back may return a different value. - // - // Equivalent to the SO_RCVBUF and SO_SNDBUF socket options. - // - // # Typical errors - // - `invalid-argument`: (set) The provided value was 0. - extern bool wasi_sockets_0_2_0_udp_method_udp_socket_receive_buffer_size(wasi_sockets_0_2_0_udp_borrow_udp_socket_t self, uint64_t *ret, wasi_sockets_0_2_0_udp_error_code_t *err); - extern bool wasi_sockets_0_2_0_udp_method_udp_socket_set_receive_buffer_size(wasi_sockets_0_2_0_udp_borrow_udp_socket_t self, uint64_t value, wasi_sockets_0_2_0_udp_error_code_t *err); - extern bool wasi_sockets_0_2_0_udp_method_udp_socket_send_buffer_size(wasi_sockets_0_2_0_udp_borrow_udp_socket_t self, uint64_t *ret, wasi_sockets_0_2_0_udp_error_code_t *err); - extern bool wasi_sockets_0_2_0_udp_method_udp_socket_set_send_buffer_size(wasi_sockets_0_2_0_udp_borrow_udp_socket_t self, uint64_t value, wasi_sockets_0_2_0_udp_error_code_t *err); - // Create a `pollable` which will resolve once the socket is ready for I/O. - // - // Note: this function is here for WASI Preview2 only. - // It's planned to be removed when `future` is natively supported in Preview3. - extern wasi_sockets_0_2_0_udp_own_pollable_t wasi_sockets_0_2_0_udp_method_udp_socket_subscribe(wasi_sockets_0_2_0_udp_borrow_udp_socket_t self); - // Receive messages on the socket. - // - // This function attempts to receive up to `max-results` datagrams on the socket without blocking. - // The returned list may contain fewer elements than requested, but never more. - // - // This function returns successfully with an empty list when either: - // - `max-results` is 0, or: - // - `max-results` is greater than 0, but no results are immediately available. - // This function never returns `error(would-block)`. - // - // # Typical errors - // - `remote-unreachable`: The remote address is not reachable. (ECONNRESET, ENETRESET on Windows, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET) - // - `connection-refused`: The connection was refused. (ECONNREFUSED) - // - // # References - // - - // - - // - - // - - // - - // - - // - - // - - extern bool wasi_sockets_0_2_0_udp_method_incoming_datagram_stream_receive(wasi_sockets_0_2_0_udp_borrow_incoming_datagram_stream_t self, uint64_t max_results, wasi_sockets_0_2_0_udp_list_incoming_datagram_t *ret, wasi_sockets_0_2_0_udp_error_code_t *err); - // Create a `pollable` which will resolve once the stream is ready to receive again. - // - // Note: this function is here for WASI Preview2 only. - // It's planned to be removed when `future` is natively supported in Preview3. - extern wasi_sockets_0_2_0_udp_own_pollable_t wasi_sockets_0_2_0_udp_method_incoming_datagram_stream_subscribe(wasi_sockets_0_2_0_udp_borrow_incoming_datagram_stream_t self); - // Check readiness for sending. This function never blocks. - // - // Returns the number of datagrams permitted for the next call to `send`, - // or an error. Calling `send` with more datagrams than this function has - // permitted will trap. - // - // When this function returns ok(0), the `subscribe` pollable will - // become ready when this function will report at least ok(1), or an - // error. - // - // Never returns `would-block`. - extern bool wasi_sockets_0_2_0_udp_method_outgoing_datagram_stream_check_send(wasi_sockets_0_2_0_udp_borrow_outgoing_datagram_stream_t self, uint64_t *ret, wasi_sockets_0_2_0_udp_error_code_t *err); - // Send messages on the socket. - // - // This function attempts to send all provided `datagrams` on the socket without blocking and - // returns how many messages were actually sent (or queued for sending). This function never - // returns `error(would-block)`. If none of the datagrams were able to be sent, `ok(0)` is returned. - // - // This function semantically behaves the same as iterating the `datagrams` list and sequentially - // sending each individual datagram until either the end of the list has been reached or the first error occurred. - // If at least one datagram has been sent successfully, this function never returns an error. - // - // If the input list is empty, the function returns `ok(0)`. - // - // Each call to `send` must be permitted by a preceding `check-send`. Implementations must trap if - // either `check-send` was not called or `datagrams` contains more items than `check-send` permitted. - // - // # Typical errors - // - `invalid-argument`: The `remote-address` has the wrong address family. (EAFNOSUPPORT) - // - `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) - // - `invalid-argument`: The socket is not "connected" and no value for `remote-address` was provided. (EDESTADDRREQ) - // - `remote-unreachable`: The remote address is not reachable. (ECONNRESET, ENETRESET on Windows, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET) - // - `connection-refused`: The connection was refused. (ECONNREFUSED) - // - `datagram-too-large`: The datagram is too large. (EMSGSIZE) - // - // # References - // - - // - - // - - // - - // - - // - - // - - // - - extern bool wasi_sockets_0_2_0_udp_method_outgoing_datagram_stream_send(wasi_sockets_0_2_0_udp_borrow_outgoing_datagram_stream_t self, wasi_sockets_0_2_0_udp_list_outgoing_datagram_t *datagrams, uint64_t *ret, wasi_sockets_0_2_0_udp_error_code_t *err); - // Create a `pollable` which will resolve once the stream is ready to send again. - // - // Note: this function is here for WASI Preview2 only. - // It's planned to be removed when `future` is natively supported in Preview3. - extern wasi_sockets_0_2_0_udp_own_pollable_t wasi_sockets_0_2_0_udp_method_outgoing_datagram_stream_subscribe(wasi_sockets_0_2_0_udp_borrow_outgoing_datagram_stream_t self); - - // Imported Functions from `wasi:sockets/udp-create-socket@0.2.0` - // Create a new UDP socket. - // - // 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. - // - // All sockets are non-blocking. Use the wasi-poll interface to block on asynchronous operations. - // - // # Typical errors - // - `not-supported`: The specified `address-family` is not supported. (EAFNOSUPPORT) - // - `new-socket-limit`: The new socket resource could not be created because of a system limit. (EMFILE, ENFILE) - // - // # References: - // - - // - - // - - // - - extern bool wasi_sockets_0_2_0_udp_create_socket_create_udp_socket(wasi_sockets_0_2_0_udp_create_socket_ip_address_family_t address_family, wasi_sockets_0_2_0_udp_create_socket_own_udp_socket_t *ret, wasi_sockets_0_2_0_udp_create_socket_error_code_t *err); - - // Imported Functions from `wasi:sockets/tcp@0.2.0` - // Bind the socket to a specific network on the provided IP address and port. - // - // 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. - // - // Bind can be attempted multiple times on the same socket, even with - // different arguments on each iteration. But never concurrently and - // only as long as the previous bind failed. Once a bind succeeds, the - // binding can't be changed anymore. - // - // # Typical errors - // - `invalid-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. (EINVAL) - // - `invalid-state`: The socket is already bound. (EINVAL) - // - `address-in-use`: No ephemeral ports available. (EADDRINUSE, ENOBUFS on Windows) - // - `address-in-use`: Address is already in use. (EADDRINUSE) - // - `address-not-bindable`: `local-address` is not an address that the `network` can bind to. (EADDRNOTAVAIL) - // - `not-in-progress`: A `bind` operation is not in progress. - // - `would-block`: Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN) - // - // # Implementors note - // When binding to a non-zero port, this bind operation shouldn't be affected by the TIME_WAIT - // state of a recently closed socket on the same local address. In practice this means that the SO_REUSEADDR - // socket option should be set implicitly on all platforms, except on Windows where this is the default behavior - // and SO_REUSEADDR performs something different entirely. - // - // Unlike in POSIX, in WASI the bind operation is async. This enables - // interactive WASI hosts to inject permission prompts. Runtimes that - // don't want to make use of this ability can simply call the native - // `bind` as part of either `start-bind` or `finish-bind`. - // - // # References - // - - // - - // - - // - - extern bool wasi_sockets_0_2_0_tcp_method_tcp_socket_start_bind(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, wasi_sockets_0_2_0_tcp_borrow_network_t network, wasi_sockets_0_2_0_tcp_ip_socket_address_t *local_address, wasi_sockets_0_2_0_tcp_error_code_t *err); - extern bool wasi_sockets_0_2_0_tcp_method_tcp_socket_finish_bind(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, wasi_sockets_0_2_0_tcp_error_code_t *err); - // Connect to a remote endpoint. - // - // On success: - // - the socket is transitioned into the `connection` state. - // - a pair of streams is returned that can be used to read & write to the connection - // - // After a failed connection attempt, the socket will be in the `closed` - // state and the only valid action left is to `drop` the socket. A single - // socket can not be used to connect more than once. - // - // # Typical errors - // - `invalid-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. (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`. - // - `invalid-state`: The socket is already in the `connected` state. (EISCONN) - // - `invalid-state`: The socket is already in the `listening` state. (EOPNOTSUPP, EINVAL on Windows) - // - `timeout`: Connection timed out. (ETIMEDOUT) - // - `connection-refused`: The connection was forcefully rejected. (ECONNREFUSED) - // - `connection-reset`: The connection was reset. (ECONNRESET) - // - `connection-aborted`: The connection was aborted. (ECONNABORTED) - // - `remote-unreachable`: The remote address is not reachable. (EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET) - // - `address-in-use`: Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE, EADDRNOTAVAIL on Linux, EAGAIN on BSD) - // - `not-in-progress`: A connect operation is not in progress. - // - `would-block`: Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN) - // - // # Implementors note - // The POSIX equivalent of `start-connect` is the regular `connect` syscall. - // Because all WASI sockets are non-blocking this is expected to return - // EINPROGRESS, which should be translated to `ok()` in WASI. - // - // The POSIX equivalent of `finish-connect` is a `poll` for event `POLLOUT` - // with a timeout of 0 on the socket descriptor. Followed by a check for - // the `SO_ERROR` socket option, in case the poll signaled readiness. - // - // # References - // - - // - - // - - // - - extern bool wasi_sockets_0_2_0_tcp_method_tcp_socket_start_connect(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, wasi_sockets_0_2_0_tcp_borrow_network_t network, wasi_sockets_0_2_0_tcp_ip_socket_address_t *remote_address, wasi_sockets_0_2_0_tcp_error_code_t *err); - extern bool wasi_sockets_0_2_0_tcp_method_tcp_socket_finish_connect(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, wasi_sockets_0_2_0_tcp_tuple2_own_input_stream_own_output_stream_t *ret, wasi_sockets_0_2_0_tcp_error_code_t *err); - // Start listening for new connections. - // - // Transitions the socket into the `listening` state. - // - // Unlike POSIX, the socket must already be explicitly bound. - // - // # Typical errors - // - `invalid-state`: The socket is not bound to any local address. (EDESTADDRREQ) - // - `invalid-state`: The socket is already in the `connected` state. (EISCONN, EINVAL on BSD) - // - `invalid-state`: The socket is already in the `listening` state. - // - `address-in-use`: Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE) - // - `not-in-progress`: A listen operation is not in progress. - // - `would-block`: Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN) - // - // # Implementors note - // Unlike in POSIX, in WASI the listen operation is async. This enables - // interactive WASI hosts to inject permission prompts. Runtimes that - // don't want to make use of this ability can simply call the native - // `listen` as part of either `start-listen` or `finish-listen`. - // - // # References - // - - // - - // - - // - - extern bool wasi_sockets_0_2_0_tcp_method_tcp_socket_start_listen(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, wasi_sockets_0_2_0_tcp_error_code_t *err); - extern bool wasi_sockets_0_2_0_tcp_method_tcp_socket_finish_listen(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, wasi_sockets_0_2_0_tcp_error_code_t *err); - // Accept a new client socket. - // - // The returned socket is bound and in the `connected` state. The following properties are inherited from the listener socket: - // - `address-family` - // - `keep-alive-enabled` - // - `keep-alive-idle-time` - // - `keep-alive-interval` - // - `keep-alive-count` - // - `hop-limit` - // - `receive-buffer-size` - // - `send-buffer-size` - // - // On success, this function returns the newly accepted client socket along with - // a pair of streams that can be used to read & write to the connection. - // - // # Typical errors - // - `invalid-state`: Socket is not in the `listening` state. (EINVAL) - // - `would-block`: No pending connections at the moment. (EWOULDBLOCK, EAGAIN) - // - `connection-aborted`: An incoming connection was pending, but was terminated by the client before this listener could accept it. (ECONNABORTED) - // - `new-socket-limit`: The new socket resource could not be created because of a system limit. (EMFILE, ENFILE) - // - // # References - // - - // - - // - - // - - extern bool wasi_sockets_0_2_0_tcp_method_tcp_socket_accept(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, wasi_sockets_0_2_0_tcp_tuple3_own_tcp_socket_own_input_stream_own_output_stream_t *ret, wasi_sockets_0_2_0_tcp_error_code_t *err); - // Get the bound local address. - // - // POSIX mentions: - // > If the socket has not been bound to a local name, the value - // > stored in the object pointed to by `address` is unspecified. - // - // WASI is stricter and requires `local-address` to return `invalid-state` when the socket hasn't been bound yet. - // - // # Typical errors - // - `invalid-state`: The socket is not bound to any local address. - // - // # References - // - - // - - // - - // - - extern bool wasi_sockets_0_2_0_tcp_method_tcp_socket_local_address(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, wasi_sockets_0_2_0_tcp_ip_socket_address_t *ret, wasi_sockets_0_2_0_tcp_error_code_t *err); - // Get the remote address. - // - // # Typical errors - // - `invalid-state`: The socket is not connected to a remote address. (ENOTCONN) - // - // # References - // - - // - - // - - // - - extern bool wasi_sockets_0_2_0_tcp_method_tcp_socket_remote_address(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, wasi_sockets_0_2_0_tcp_ip_socket_address_t *ret, wasi_sockets_0_2_0_tcp_error_code_t *err); - // Whether the socket is in the `listening` state. - // - // Equivalent to the SO_ACCEPTCONN socket option. - extern bool wasi_sockets_0_2_0_tcp_method_tcp_socket_is_listening(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self); - // Whether this is a IPv4 or IPv6 socket. - // - // Equivalent to the SO_DOMAIN socket option. - extern wasi_sockets_0_2_0_tcp_ip_address_family_t wasi_sockets_0_2_0_tcp_method_tcp_socket_address_family(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self); - // Hints the desired listen queue size. Implementations are free to ignore this. - // - // If the provided value is 0, an `invalid-argument` error is returned. - // Any other value will never cause an error, but it might be silently clamped and/or rounded. - // - // # Typical errors - // - `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. - extern bool wasi_sockets_0_2_0_tcp_method_tcp_socket_set_listen_backlog_size(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, uint64_t value, wasi_sockets_0_2_0_tcp_error_code_t *err); - // Enables or disables keepalive. - // - // The keepalive behavior can be adjusted using: - // - `keep-alive-idle-time` - // - `keep-alive-interval` - // - `keep-alive-count` - // 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. - extern bool wasi_sockets_0_2_0_tcp_method_tcp_socket_keep_alive_enabled(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, bool *ret, wasi_sockets_0_2_0_tcp_error_code_t *err); - extern bool wasi_sockets_0_2_0_tcp_method_tcp_socket_set_keep_alive_enabled(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, bool value, wasi_sockets_0_2_0_tcp_error_code_t *err); - // Amount of time the connection has to be idle before TCP starts sending keepalive packets. - // - // If the provided value is 0, an `invalid-argument` error is returned. - // Any other value will never cause an error, but it might be silently clamped and/or rounded. - // I.e. after setting a value, reading the same setting back may return a different value. - // - // Equivalent to the TCP_KEEPIDLE socket option. (TCP_KEEPALIVE on MacOS) - // - // # Typical errors - // - `invalid-argument`: (set) The provided value was 0. - extern bool wasi_sockets_0_2_0_tcp_method_tcp_socket_keep_alive_idle_time(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, wasi_sockets_0_2_0_tcp_duration_t *ret, wasi_sockets_0_2_0_tcp_error_code_t *err); - extern bool wasi_sockets_0_2_0_tcp_method_tcp_socket_set_keep_alive_idle_time(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, wasi_sockets_0_2_0_tcp_duration_t value, wasi_sockets_0_2_0_tcp_error_code_t *err); - // The time between keepalive packets. - // - // If the provided value is 0, an `invalid-argument` error is returned. - // Any other value will never cause an error, but it might be silently clamped and/or rounded. - // I.e. after setting a value, reading the same setting back may return a different value. - // - // Equivalent to the TCP_KEEPINTVL socket option. - // - // # Typical errors - // - `invalid-argument`: (set) The provided value was 0. - extern bool wasi_sockets_0_2_0_tcp_method_tcp_socket_keep_alive_interval(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, wasi_sockets_0_2_0_tcp_duration_t *ret, wasi_sockets_0_2_0_tcp_error_code_t *err); - extern bool wasi_sockets_0_2_0_tcp_method_tcp_socket_set_keep_alive_interval(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, wasi_sockets_0_2_0_tcp_duration_t value, wasi_sockets_0_2_0_tcp_error_code_t *err); - // The maximum amount of keepalive packets TCP should send before aborting the connection. - // - // If the provided value is 0, an `invalid-argument` error is returned. - // Any other value will never cause an error, but it might be silently clamped and/or rounded. - // I.e. after setting a value, reading the same setting back may return a different value. - // - // Equivalent to the TCP_KEEPCNT socket option. - // - // # Typical errors - // - `invalid-argument`: (set) The provided value was 0. - extern bool wasi_sockets_0_2_0_tcp_method_tcp_socket_keep_alive_count(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, uint32_t *ret, wasi_sockets_0_2_0_tcp_error_code_t *err); - extern bool wasi_sockets_0_2_0_tcp_method_tcp_socket_set_keep_alive_count(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, uint32_t value, wasi_sockets_0_2_0_tcp_error_code_t *err); - // Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options. - // - // If the provided value is 0, an `invalid-argument` error is returned. - // - // # Typical errors - // - `invalid-argument`: (set) The TTL value must be 1 or higher. - extern bool wasi_sockets_0_2_0_tcp_method_tcp_socket_hop_limit(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, uint8_t *ret, wasi_sockets_0_2_0_tcp_error_code_t *err); - extern bool wasi_sockets_0_2_0_tcp_method_tcp_socket_set_hop_limit(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, uint8_t value, wasi_sockets_0_2_0_tcp_error_code_t *err); - // The kernel buffer space reserved for sends/receives on this socket. - // - // If the provided value is 0, an `invalid-argument` error is returned. - // Any other value will never cause an error, but it might be silently clamped and/or rounded. - // I.e. after setting a value, reading the same setting back may return a different value. - // - // Equivalent to the SO_RCVBUF and SO_SNDBUF socket options. - // - // # Typical errors - // - `invalid-argument`: (set) The provided value was 0. - extern bool wasi_sockets_0_2_0_tcp_method_tcp_socket_receive_buffer_size(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, uint64_t *ret, wasi_sockets_0_2_0_tcp_error_code_t *err); - extern bool wasi_sockets_0_2_0_tcp_method_tcp_socket_set_receive_buffer_size(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, uint64_t value, wasi_sockets_0_2_0_tcp_error_code_t *err); - extern bool wasi_sockets_0_2_0_tcp_method_tcp_socket_send_buffer_size(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, uint64_t *ret, wasi_sockets_0_2_0_tcp_error_code_t *err); - extern bool wasi_sockets_0_2_0_tcp_method_tcp_socket_set_send_buffer_size(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, uint64_t value, wasi_sockets_0_2_0_tcp_error_code_t *err); - // Create a `pollable` which can be used to poll for, or block on, - // completion of any of the asynchronous operations of this socket. - // - // When `finish-bind`, `finish-listen`, `finish-connect` or `accept` - // return `error(would-block)`, this pollable can be used to wait for - // their success or failure, after which the method can be retried. - // - // The pollable is not limited to the async operation that happens to be - // in progress at the time of calling `subscribe` (if any). Theoretically, - // `subscribe` only has to be called once per socket and can then be - // (re)used for the remainder of the socket's lifetime. - // - // See - // for a more information. - // - // Note: this function is here for WASI Preview2 only. - // It's planned to be removed when `future` is natively supported in Preview3. - extern wasi_sockets_0_2_0_tcp_own_pollable_t wasi_sockets_0_2_0_tcp_method_tcp_socket_subscribe(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self); - // Initiate a graceful shutdown. - // - // - `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. - // - // # Typical errors - // - `invalid-state`: The socket is not in the `connected` state. (ENOTCONN) - // - // # References - // - - // - - // - - // - - extern bool wasi_sockets_0_2_0_tcp_method_tcp_socket_shutdown(wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t self, wasi_sockets_0_2_0_tcp_shutdown_type_t shutdown_type, wasi_sockets_0_2_0_tcp_error_code_t *err); - - // Imported Functions from `wasi:sockets/tcp-create-socket@0.2.0` - // Create a new TCP socket. - // - // 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`/`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. - // - // # Typical errors - // - `not-supported`: The specified `address-family` is not supported. (EAFNOSUPPORT) - // - `new-socket-limit`: The new socket resource could not be created because of a system limit. (EMFILE, ENFILE) - // - // # References - // - - // - - // - - // - - extern bool wasi_sockets_0_2_0_tcp_create_socket_create_tcp_socket(wasi_sockets_0_2_0_tcp_create_socket_ip_address_family_t address_family, wasi_sockets_0_2_0_tcp_create_socket_own_tcp_socket_t *ret, wasi_sockets_0_2_0_tcp_create_socket_error_code_t *err); - - // Imported Functions from `wasi:sockets/ip-name-lookup@0.2.0` - // Resolve an internet host name to a list of IP addresses. - // - // Unicode domain names are automatically converted to ASCII using IDNA encoding. - // If the input is an IP address string, the address is parsed and returned - // as-is without making any external requests. - // - // See the wasi-socket proposal README.md for a comparison with getaddrinfo. - // - // This function never blocks. It either immediately fails or immediately - // returns successfully with a `resolve-address-stream` that can be used - // to (asynchronously) fetch the results. - // - // # Typical errors - // - `invalid-argument`: `name` is a syntactically invalid domain name or IP address. - // - // # References: - // - - // - - // - - // - - extern bool wasi_sockets_0_2_0_ip_name_lookup_resolve_addresses(wasi_sockets_0_2_0_ip_name_lookup_borrow_network_t network, bindings_string_t *name, wasi_sockets_0_2_0_ip_name_lookup_own_resolve_address_stream_t *ret, wasi_sockets_0_2_0_ip_name_lookup_error_code_t *err); - // Returns the next address from the resolver. - // - // This function should be called multiple times. On each call, it will - // return the next address in connection order preference. If all - // addresses have been exhausted, this function returns `none`. - // - // This function never returns IPv4-mapped IPv6 addresses. - // - // # Typical errors - // - `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) - // - `would-block`: A result is not available yet. (EWOULDBLOCK, EAGAIN) - extern bool wasi_sockets_0_2_0_ip_name_lookup_method_resolve_address_stream_resolve_next_address(wasi_sockets_0_2_0_ip_name_lookup_borrow_resolve_address_stream_t self, wasi_sockets_0_2_0_ip_name_lookup_option_ip_address_t *ret, wasi_sockets_0_2_0_ip_name_lookup_error_code_t *err); - // Create a `pollable` which will resolve once the stream is ready for I/O. - // - // Note: this function is here for WASI Preview2 only. - // It's planned to be removed when `future` is natively supported in Preview3. - extern wasi_sockets_0_2_0_ip_name_lookup_own_pollable_t wasi_sockets_0_2_0_ip_name_lookup_method_resolve_address_stream_subscribe(wasi_sockets_0_2_0_ip_name_lookup_borrow_resolve_address_stream_t self); - - // Imported Functions from `wasi:random/random@0.2.0` - // Return `len` cryptographically-secure random or pseudo-random bytes. - // - // This function must produce data at least as cryptographically secure and - // fast as an adequately seeded cryptographically-secure pseudo-random - // number generator (CSPRNG). It must not block, from the perspective of - // the calling program, under any circumstances, including on the first - // request and on requests for numbers of bytes. The returned data must - // always be unpredictable. - // - // This function must always return fresh data. Deterministic environments - // must omit this function, rather than implementing it with deterministic - // data. - extern void wasi_random_0_2_0_random_get_random_bytes(uint64_t len, wasi_random_0_2_0_random_list_u8_t *ret); - // Return a cryptographically-secure random or pseudo-random `u64` value. - // - // This function returns the same type of data as `get-random-bytes`, - // represented as a `u64`. - extern uint64_t wasi_random_0_2_0_random_get_random_u64(void); - - // Imported Functions from `wasi:random/insecure@0.2.0` - // Return `len` insecure pseudo-random bytes. - // - // This function is not cryptographically secure. Do not use it for - // anything related to security. - // - // There are no requirements on the values of the returned bytes, however - // implementations are encouraged to return evenly distributed values with - // a long period. - extern void wasi_random_0_2_0_insecure_get_insecure_random_bytes(uint64_t len, wasi_random_0_2_0_random_list_u8_t *ret); - // Return an insecure pseudo-random `u64` value. - // - // This function returns the same type of pseudo-random data as - // `get-insecure-random-bytes`, represented as a `u64`. - extern uint64_t wasi_random_0_2_0_insecure_get_insecure_random_u64(void); - - // Imported Functions from `wasi:random/insecure-seed@0.2.0` - // Return a 128-bit value that may contain a pseudo-random value. - // - // The returned value is not required to be computed from a CSPRNG, and may - // even be entirely deterministic. Host implementations are encouraged to - // provide pseudo-random values to any program exposed to - // attacker-controlled content, to enable DoS protection built into many - // languages' hash-map implementations. - // - // This function is intended to only be called once, by a source language - // to initialize Denial Of Service (DoS) protection in its hash-map - // implementation. - // - // # Expected future evolution - // - // This will likely be changed to a value import, to prevent it from being - // called multiple times and potentially used for purposes other than DoS - // protection. - extern void wasi_random_0_2_0_insecure_seed_insecure_seed(wasi_random_0_2_0_insecure_seed_tuple2_u64_u64_t *ret); - - // Imported Functions from `wasi:http/types@0.2.0` - // Attempts to extract a http-related `error` from the wasi:io `error` - // provided. - // - // Stream operations which return - // `wasi:io/stream/stream-error::last-operation-failed` have a payload of - // type `wasi:io/error/error` with more information about the operation - // that failed. This payload can be passed through to this function to see - // if there's http-related information about the error to return. - // - // Note that this function is fallible because not all io-errors are - // http-related errors. - extern bool wasi_http_0_2_0_types_http_error_code(wasi_http_0_2_0_types_borrow_io_error_t err_, wasi_http_0_2_0_types_error_code_t *ret); - // Construct an empty HTTP Fields. - // - // The resulting `fields` is mutable. - extern wasi_http_0_2_0_types_own_fields_t wasi_http_0_2_0_types_constructor_fields(void); - // Construct an HTTP Fields. - // - // The resulting `fields` is mutable. - // - // The list represents each key-value pair in the Fields. Keys - // which have multiple values are represented by multiple entries in this - // list with the same key. - // - // The tuple is a pair of the field key, represented as a string, and - // Value, represented as a list of bytes. In a valid Fields, all keys - // and values are valid UTF-8 strings. However, values are not always - // well-formed, so they are represented as a raw list of bytes. - // - // An error result will be returned if any header or value was - // syntactically invalid, or if a header was forbidden. - extern bool wasi_http_0_2_0_types_static_fields_from_list(wasi_http_0_2_0_types_list_tuple2_field_key_field_value_t *entries, wasi_http_0_2_0_types_own_fields_t *ret, wasi_http_0_2_0_types_header_error_t *err); - // Get all of the values corresponding to a key. If the key is not present - // in this `fields`, an empty list is returned. However, if the key is - // present but empty, this is represented by a list with one or more - // empty field-values present. - extern void wasi_http_0_2_0_types_method_fields_get(wasi_http_0_2_0_types_borrow_fields_t self, wasi_http_0_2_0_types_field_key_t *name, wasi_http_0_2_0_types_list_field_value_t *ret); - // Returns `true` when the key is present in this `fields`. If the key is - // syntactically invalid, `false` is returned. - extern bool wasi_http_0_2_0_types_method_fields_has(wasi_http_0_2_0_types_borrow_fields_t self, wasi_http_0_2_0_types_field_key_t *name); - // Set all of the values for a key. Clears any existing values for that - // key, if they have been set. - // - // Fails with `header-error.immutable` if the `fields` are immutable. - extern bool wasi_http_0_2_0_types_method_fields_set(wasi_http_0_2_0_types_borrow_fields_t self, wasi_http_0_2_0_types_field_key_t *name, wasi_http_0_2_0_types_list_field_value_t *value, wasi_http_0_2_0_types_header_error_t *err); - // Delete all values for a key. Does nothing if no values for the key - // exist. - // - // Fails with `header-error.immutable` if the `fields` are immutable. - extern bool wasi_http_0_2_0_types_method_fields_delete(wasi_http_0_2_0_types_borrow_fields_t self, wasi_http_0_2_0_types_field_key_t *name, wasi_http_0_2_0_types_header_error_t *err); - // Append a value for a key. Does not change or delete any existing - // values for that key. - // - // Fails with `header-error.immutable` if the `fields` are immutable. - extern bool wasi_http_0_2_0_types_method_fields_append(wasi_http_0_2_0_types_borrow_fields_t self, wasi_http_0_2_0_types_field_key_t *name, wasi_http_0_2_0_types_field_value_t *value, wasi_http_0_2_0_types_header_error_t *err); - // Retrieve the full set of keys and values in the Fields. Like the - // constructor, the list represents each key-value pair. - // - // The outer list represents each key-value pair in the Fields. Keys - // which have multiple values are represented by multiple entries in this - // list with the same key. - extern void wasi_http_0_2_0_types_method_fields_entries(wasi_http_0_2_0_types_borrow_fields_t self, wasi_http_0_2_0_types_list_tuple2_field_key_field_value_t *ret); - // Make a deep copy of the Fields. Equivelant in behavior to calling the - // `fields` constructor on the return value of `entries`. The resulting - // `fields` is mutable. - extern wasi_http_0_2_0_types_own_fields_t wasi_http_0_2_0_types_method_fields_clone(wasi_http_0_2_0_types_borrow_fields_t self); - // Returns the method of the incoming request. - extern void wasi_http_0_2_0_types_method_incoming_request_method(wasi_http_0_2_0_types_borrow_incoming_request_t self, wasi_http_0_2_0_types_method_t *ret); - // Returns the path with query parameters from the request, as a string. - extern bool wasi_http_0_2_0_types_method_incoming_request_path_with_query(wasi_http_0_2_0_types_borrow_incoming_request_t self, bindings_string_t *ret); - // Returns the protocol scheme from the request. - extern bool wasi_http_0_2_0_types_method_incoming_request_scheme(wasi_http_0_2_0_types_borrow_incoming_request_t self, wasi_http_0_2_0_types_scheme_t *ret); - // Returns the authority from the request, if it was present. - extern bool wasi_http_0_2_0_types_method_incoming_request_authority(wasi_http_0_2_0_types_borrow_incoming_request_t self, bindings_string_t *ret); - // Get the `headers` associated with the request. - // - // The returned `headers` resource is immutable: `set`, `append`, and - // `delete` operations will fail with `header-error.immutable`. - // - // The `headers` returned are a child resource: it must be dropped before - // the parent `incoming-request` is dropped. Dropping this - // `incoming-request` before all children are dropped will trap. - extern wasi_http_0_2_0_types_own_headers_t wasi_http_0_2_0_types_method_incoming_request_headers(wasi_http_0_2_0_types_borrow_incoming_request_t self); - // Gives the `incoming-body` associated with this request. Will only - // return success at most once, and subsequent calls will return error. - extern bool wasi_http_0_2_0_types_method_incoming_request_consume(wasi_http_0_2_0_types_borrow_incoming_request_t self, wasi_http_0_2_0_types_own_incoming_body_t *ret); - // Construct a new `outgoing-request` with a default `method` of `GET`, and - // `none` values for `path-with-query`, `scheme`, and `authority`. - // - // * `headers` is the HTTP Headers for the Request. - // - // It is possible to construct, or manipulate with the accessor functions - // below, an `outgoing-request` with an invalid combination of `scheme` - // and `authority`, or `headers` which are not permitted to be sent. - // It is the obligation of the `outgoing-handler.handle` implementation - // to reject invalid constructions of `outgoing-request`. - extern wasi_http_0_2_0_types_own_outgoing_request_t wasi_http_0_2_0_types_constructor_outgoing_request(wasi_http_0_2_0_types_own_headers_t headers); - // Returns the resource corresponding to the outgoing Body for this - // Request. - // - // Returns success on the first call: the `outgoing-body` resource for - // this `outgoing-request` can be retrieved at most once. Subsequent - // calls will return error. - extern bool wasi_http_0_2_0_types_method_outgoing_request_body(wasi_http_0_2_0_types_borrow_outgoing_request_t self, wasi_http_0_2_0_types_own_outgoing_body_t *ret); - // Get the Method for the Request. - extern void wasi_http_0_2_0_types_method_outgoing_request_method(wasi_http_0_2_0_types_borrow_outgoing_request_t self, wasi_http_0_2_0_types_method_t *ret); - // Set the Method for the Request. Fails if the string present in a - // `method.other` argument is not a syntactically valid method. - extern bool wasi_http_0_2_0_types_method_outgoing_request_set_method(wasi_http_0_2_0_types_borrow_outgoing_request_t self, wasi_http_0_2_0_types_method_t *method); - // Get the combination of the HTTP Path and Query for the Request. - // When `none`, this represents an empty Path and empty Query. - extern bool wasi_http_0_2_0_types_method_outgoing_request_path_with_query(wasi_http_0_2_0_types_borrow_outgoing_request_t self, bindings_string_t *ret); - // Set the combination of the HTTP Path and Query for the Request. - // When `none`, this represents an empty Path and empty Query. Fails is the - // string given is not a syntactically valid path and query uri component. - extern bool wasi_http_0_2_0_types_method_outgoing_request_set_path_with_query(wasi_http_0_2_0_types_borrow_outgoing_request_t self, bindings_string_t *maybe_path_with_query); - // Get the HTTP Related Scheme for the Request. When `none`, the - // implementation may choose an appropriate default scheme. - extern bool wasi_http_0_2_0_types_method_outgoing_request_scheme(wasi_http_0_2_0_types_borrow_outgoing_request_t self, wasi_http_0_2_0_types_scheme_t *ret); - // Set the HTTP Related Scheme for the Request. When `none`, the - // implementation may choose an appropriate default scheme. Fails if the - // string given is not a syntactically valid uri scheme. - extern bool wasi_http_0_2_0_types_method_outgoing_request_set_scheme(wasi_http_0_2_0_types_borrow_outgoing_request_t self, wasi_http_0_2_0_types_scheme_t *maybe_scheme); - // Get the HTTP Authority for the Request. A value of `none` may be used - // with Related Schemes which do not require an Authority. The HTTP and - // HTTPS schemes always require an authority. - extern bool wasi_http_0_2_0_types_method_outgoing_request_authority(wasi_http_0_2_0_types_borrow_outgoing_request_t self, bindings_string_t *ret); - // Set the HTTP Authority for the Request. A value of `none` may be used - // with Related Schemes which do not require an Authority. The HTTP and - // HTTPS schemes always require an authority. Fails if the string given is - // not a syntactically valid uri authority. - extern bool wasi_http_0_2_0_types_method_outgoing_request_set_authority(wasi_http_0_2_0_types_borrow_outgoing_request_t self, bindings_string_t *maybe_authority); - // Get the headers associated with the Request. - // - // The returned `headers` resource is immutable: `set`, `append`, and - // `delete` operations will fail with `header-error.immutable`. - // - // This headers resource is a child: it must be dropped before the parent - // `outgoing-request` is dropped, or its ownership is transfered to - // another component by e.g. `outgoing-handler.handle`. - extern wasi_http_0_2_0_types_own_headers_t wasi_http_0_2_0_types_method_outgoing_request_headers(wasi_http_0_2_0_types_borrow_outgoing_request_t self); - // Construct a default `request-options` value. - extern wasi_http_0_2_0_types_own_request_options_t wasi_http_0_2_0_types_constructor_request_options(void); - // The timeout for the initial connect to the HTTP Server. - extern bool wasi_http_0_2_0_types_method_request_options_connect_timeout(wasi_http_0_2_0_types_borrow_request_options_t self, wasi_http_0_2_0_types_duration_t *ret); - // Set the timeout for the initial connect to the HTTP Server. An error - // return value indicates that this timeout is not supported. - extern bool wasi_http_0_2_0_types_method_request_options_set_connect_timeout(wasi_http_0_2_0_types_borrow_request_options_t self, wasi_http_0_2_0_types_duration_t *maybe_duration); - // The timeout for receiving the first byte of the Response body. - extern bool wasi_http_0_2_0_types_method_request_options_first_byte_timeout(wasi_http_0_2_0_types_borrow_request_options_t self, wasi_http_0_2_0_types_duration_t *ret); - // Set the timeout for receiving the first byte of the Response body. An - // error return value indicates that this timeout is not supported. - extern bool wasi_http_0_2_0_types_method_request_options_set_first_byte_timeout(wasi_http_0_2_0_types_borrow_request_options_t self, wasi_http_0_2_0_types_duration_t *maybe_duration); - // The timeout for receiving subsequent chunks of bytes in the Response - // body stream. - extern bool wasi_http_0_2_0_types_method_request_options_between_bytes_timeout(wasi_http_0_2_0_types_borrow_request_options_t self, wasi_http_0_2_0_types_duration_t *ret); - // Set the timeout for receiving subsequent chunks of bytes in the Response - // body stream. An error return value indicates that this timeout is not - // supported. - extern bool wasi_http_0_2_0_types_method_request_options_set_between_bytes_timeout(wasi_http_0_2_0_types_borrow_request_options_t self, wasi_http_0_2_0_types_duration_t *maybe_duration); - // Set the value of the `response-outparam` to either send a response, - // or indicate an error. - // - // This method consumes the `response-outparam` to ensure that it is - // called at most once. If it is never called, the implementation - // will respond with an error. - // - // The user may provide an `error` to `response` to allow the - // implementation determine how to respond with an HTTP error response. - extern void wasi_http_0_2_0_types_static_response_outparam_set(wasi_http_0_2_0_types_own_response_outparam_t param, wasi_http_0_2_0_types_result_own_outgoing_response_error_code_t *response); - // Returns the status code from the incoming response. - extern wasi_http_0_2_0_types_status_code_t wasi_http_0_2_0_types_method_incoming_response_status(wasi_http_0_2_0_types_borrow_incoming_response_t self); - // Returns the headers from the incoming response. - // - // The returned `headers` resource is immutable: `set`, `append`, and - // `delete` operations will fail with `header-error.immutable`. - // - // This headers resource is a child: it must be dropped before the parent - // `incoming-response` is dropped. - extern wasi_http_0_2_0_types_own_headers_t wasi_http_0_2_0_types_method_incoming_response_headers(wasi_http_0_2_0_types_borrow_incoming_response_t self); - // Returns the incoming body. May be called at most once. Returns error - // if called additional times. - extern bool wasi_http_0_2_0_types_method_incoming_response_consume(wasi_http_0_2_0_types_borrow_incoming_response_t self, wasi_http_0_2_0_types_own_incoming_body_t *ret); - // Returns the contents of the body, as a stream of bytes. - // - // Returns success on first call: the stream representing the contents - // can be retrieved at most once. Subsequent calls will return error. - // - // The returned `input-stream` resource is a child: it must be dropped - // before the parent `incoming-body` is dropped, or consumed by - // `incoming-body.finish`. - // - // This invariant ensures that the implementation can determine whether - // the user is consuming the contents of the body, waiting on the - // `future-trailers` to be ready, or neither. This allows for network - // backpressure is to be applied when the user is consuming the body, - // and for that backpressure to not inhibit delivery of the trailers if - // the user does not read the entire body. - extern bool wasi_http_0_2_0_types_method_incoming_body_stream(wasi_http_0_2_0_types_borrow_incoming_body_t self, wasi_http_0_2_0_types_own_input_stream_t *ret); - // Takes ownership of `incoming-body`, and returns a `future-trailers`. - // This function will trap if the `input-stream` child is still alive. - extern wasi_http_0_2_0_types_own_future_trailers_t wasi_http_0_2_0_types_static_incoming_body_finish(wasi_http_0_2_0_types_own_incoming_body_t this_); - // Returns a pollable which becomes ready when either the trailers have - // been received, or an error has occured. When this pollable is ready, - // the `get` method will return `some`. - extern wasi_http_0_2_0_types_own_pollable_t wasi_http_0_2_0_types_method_future_trailers_subscribe(wasi_http_0_2_0_types_borrow_future_trailers_t self); - // Returns the contents of the trailers, or an error which occured, - // once the future is ready. - // - // The outer `option` represents future readiness. Users can wait on this - // `option` to become `some` using the `subscribe` method. - // - // The outer `result` is used to retrieve the trailers or error at most - // once. It will be success on the first call in which the outer option - // is `some`, and error on subsequent calls. - // - // The inner `result` represents that either the HTTP Request or Response - // body, as well as any trailers, were received successfully, or that an - // error occured receiving them. The optional `trailers` indicates whether - // or not trailers were present in the body. - // - // When some `trailers` are returned by this method, the `trailers` - // resource is immutable, and a child. Use of the `set`, `append`, or - // `delete` methods will return an error, and the resource must be - // dropped before the parent `future-trailers` is dropped. - extern bool wasi_http_0_2_0_types_method_future_trailers_get(wasi_http_0_2_0_types_borrow_future_trailers_t self, wasi_http_0_2_0_types_result_result_option_own_trailers_error_code_void_t *ret); - // Construct an `outgoing-response`, with a default `status-code` of `200`. - // If a different `status-code` is needed, it must be set via the - // `set-status-code` method. - // - // * `headers` is the HTTP Headers for the Response. - extern wasi_http_0_2_0_types_own_outgoing_response_t wasi_http_0_2_0_types_constructor_outgoing_response(wasi_http_0_2_0_types_own_headers_t headers); - // Get the HTTP Status Code for the Response. - extern wasi_http_0_2_0_types_status_code_t wasi_http_0_2_0_types_method_outgoing_response_status_code(wasi_http_0_2_0_types_borrow_outgoing_response_t self); - // Set the HTTP Status Code for the Response. Fails if the status-code - // given is not a valid http status code. - extern bool wasi_http_0_2_0_types_method_outgoing_response_set_status_code(wasi_http_0_2_0_types_borrow_outgoing_response_t self, wasi_http_0_2_0_types_status_code_t status_code); - // Get the headers associated with the Request. - // - // The returned `headers` resource is immutable: `set`, `append`, and - // `delete` operations will fail with `header-error.immutable`. - // - // This headers resource is a child: it must be dropped before the parent - // `outgoing-request` is dropped, or its ownership is transfered to - // another component by e.g. `outgoing-handler.handle`. - extern wasi_http_0_2_0_types_own_headers_t wasi_http_0_2_0_types_method_outgoing_response_headers(wasi_http_0_2_0_types_borrow_outgoing_response_t self); - // Returns the resource corresponding to the outgoing Body for this Response. - // - // Returns success on the first call: the `outgoing-body` resource for - // this `outgoing-response` can be retrieved at most once. Subsequent - // calls will return error. - extern bool wasi_http_0_2_0_types_method_outgoing_response_body(wasi_http_0_2_0_types_borrow_outgoing_response_t self, wasi_http_0_2_0_types_own_outgoing_body_t *ret); - // Returns a stream for writing the body contents. - // - // The returned `output-stream` is a child resource: it must be dropped - // before the parent `outgoing-body` resource is dropped (or finished), - // otherwise the `outgoing-body` drop or `finish` will trap. - // - // Returns success on the first call: the `output-stream` resource for - // this `outgoing-body` may be retrieved at most once. Subsequent calls - // will return error. - extern bool wasi_http_0_2_0_types_method_outgoing_body_write(wasi_http_0_2_0_types_borrow_outgoing_body_t self, wasi_http_0_2_0_types_own_output_stream_t *ret); - // Finalize an outgoing body, optionally providing trailers. This must be - // called to signal that the response is complete. If the `outgoing-body` - // is dropped without calling `outgoing-body.finalize`, the implementation - // should treat the body as corrupted. - // - // Fails if the body's `outgoing-request` or `outgoing-response` was - // constructed with a Content-Length header, and the contents written - // to the body (via `write`) does not match the value given in the - // Content-Length. - extern bool wasi_http_0_2_0_types_static_outgoing_body_finish(wasi_http_0_2_0_types_own_outgoing_body_t this_, wasi_http_0_2_0_types_own_trailers_t *maybe_trailers, wasi_http_0_2_0_types_error_code_t *err); - // Returns a pollable which becomes ready when either the Response has - // been received, or an error has occured. When this pollable is ready, - // the `get` method will return `some`. - extern wasi_http_0_2_0_types_own_pollable_t wasi_http_0_2_0_types_method_future_incoming_response_subscribe(wasi_http_0_2_0_types_borrow_future_incoming_response_t self); - // Returns the incoming HTTP Response, or an error, once one is ready. - // - // The outer `option` represents future readiness. Users can wait on this - // `option` to become `some` using the `subscribe` method. - // - // The outer `result` is used to retrieve the response or error at most - // once. It will be success on the first call in which the outer option - // is `some`, and error on subsequent calls. - // - // The inner `result` represents that either the incoming HTTP Response - // status and headers have recieved successfully, or that an error - // occured. Errors may also occur while consuming the response body, - // but those will be reported by the `incoming-body` and its - // `output-stream` child. - extern bool wasi_http_0_2_0_types_method_future_incoming_response_get(wasi_http_0_2_0_types_borrow_future_incoming_response_t self, wasi_http_0_2_0_types_result_result_own_incoming_response_error_code_void_t *ret); - - // Imported Functions from `wasi:http/outgoing-handler@0.2.0` - // This function is invoked with an outgoing HTTP Request, and it returns - // a resource `future-incoming-response` which represents an HTTP Response - // which may arrive in the future. - // - // The `options` argument accepts optional parameters for the HTTP - // protocol's transport layer. - // - // This function may return an error if the `outgoing-request` is invalid - // or not allowed to be made. Otherwise, protocol errors are reported - // through the `future-incoming-response`. - extern bool wasi_http_0_2_0_outgoing_handler_handle(wasi_http_0_2_0_outgoing_handler_own_outgoing_request_t request, wasi_http_0_2_0_outgoing_handler_own_request_options_t *maybe_options, wasi_http_0_2_0_outgoing_handler_own_future_incoming_response_t *ret, wasi_http_0_2_0_outgoing_handler_error_code_t *err); - - // Exported Functions from `wasi:cli/run@0.2.0` - bool exports_wasi_cli_0_2_0_run_run(void); - - // Exported Functions from `wasi:http/incoming-handler@0.2.0` - void exports_wasi_http_0_2_0_incoming_handler_handle(exports_wasi_http_0_2_0_incoming_handler_own_incoming_request_t request, exports_wasi_http_0_2_0_incoming_handler_own_response_outparam_t response_out); - - // Helper Functions - - void gcore_fastedge_dictionary_option_string_free(gcore_fastedge_dictionary_option_string_t *ptr); - - void wasi_cli_0_2_0_environment_tuple2_string_string_free(wasi_cli_0_2_0_environment_tuple2_string_string_t *ptr); - - void wasi_cli_0_2_0_environment_list_tuple2_string_string_free(wasi_cli_0_2_0_environment_list_tuple2_string_string_t *ptr); - - void wasi_cli_0_2_0_environment_list_string_free(wasi_cli_0_2_0_environment_list_string_t *ptr); - - void wasi_cli_0_2_0_environment_option_string_free(wasi_cli_0_2_0_environment_option_string_t *ptr); - - void wasi_cli_0_2_0_exit_result_void_void_free(wasi_cli_0_2_0_exit_result_void_void_t *ptr); - - extern void wasi_io_0_2_0_error_error_drop_own(wasi_io_0_2_0_error_own_error_t handle); - extern void wasi_io_0_2_0_error_error_drop_borrow(wasi_io_0_2_0_error_own_error_t handle); - - extern wasi_io_0_2_0_error_borrow_error_t wasi_io_0_2_0_error_borrow_error(wasi_io_0_2_0_error_own_error_t handle); - - extern void wasi_io_0_2_0_poll_pollable_drop_own(wasi_io_0_2_0_poll_own_pollable_t handle); - extern void wasi_io_0_2_0_poll_pollable_drop_borrow(wasi_io_0_2_0_poll_own_pollable_t handle); - - extern wasi_io_0_2_0_poll_borrow_pollable_t wasi_io_0_2_0_poll_borrow_pollable(wasi_io_0_2_0_poll_own_pollable_t handle); - - void wasi_io_0_2_0_poll_list_borrow_pollable_free(wasi_io_0_2_0_poll_list_borrow_pollable_t *ptr); - - void wasi_io_0_2_0_poll_list_u32_free(wasi_io_0_2_0_poll_list_u32_t *ptr); - - void wasi_io_0_2_0_streams_stream_error_free(wasi_io_0_2_0_streams_stream_error_t *ptr); - - extern void wasi_io_0_2_0_streams_input_stream_drop_own(wasi_io_0_2_0_streams_own_input_stream_t handle); - extern void wasi_io_0_2_0_streams_input_stream_drop_borrow(wasi_io_0_2_0_streams_own_input_stream_t handle); - - extern wasi_io_0_2_0_streams_borrow_input_stream_t wasi_io_0_2_0_streams_borrow_input_stream(wasi_io_0_2_0_streams_own_input_stream_t handle); - - extern void wasi_io_0_2_0_streams_output_stream_drop_own(wasi_io_0_2_0_streams_own_output_stream_t handle); - extern void wasi_io_0_2_0_streams_output_stream_drop_borrow(wasi_io_0_2_0_streams_own_output_stream_t handle); - - extern wasi_io_0_2_0_streams_borrow_output_stream_t wasi_io_0_2_0_streams_borrow_output_stream(wasi_io_0_2_0_streams_own_output_stream_t handle); - - void wasi_io_0_2_0_streams_list_u8_free(wasi_io_0_2_0_streams_list_u8_t *ptr); - - void wasi_io_0_2_0_streams_result_list_u8_stream_error_free(wasi_io_0_2_0_streams_result_list_u8_stream_error_t *ptr); - - void wasi_io_0_2_0_streams_result_u64_stream_error_free(wasi_io_0_2_0_streams_result_u64_stream_error_t *ptr); - - void wasi_io_0_2_0_streams_result_void_stream_error_free(wasi_io_0_2_0_streams_result_void_stream_error_t *ptr); - - extern void wasi_cli_0_2_0_terminal_input_terminal_input_drop_own(wasi_cli_0_2_0_terminal_input_own_terminal_input_t handle); - extern void wasi_cli_0_2_0_terminal_input_terminal_input_drop_borrow(wasi_cli_0_2_0_terminal_input_own_terminal_input_t handle); - - extern wasi_cli_0_2_0_terminal_input_borrow_terminal_input_t wasi_cli_0_2_0_terminal_input_borrow_terminal_input(wasi_cli_0_2_0_terminal_input_own_terminal_input_t handle); - - extern void wasi_cli_0_2_0_terminal_output_terminal_output_drop_own(wasi_cli_0_2_0_terminal_output_own_terminal_output_t handle); - extern void wasi_cli_0_2_0_terminal_output_terminal_output_drop_borrow(wasi_cli_0_2_0_terminal_output_own_terminal_output_t handle); - - extern wasi_cli_0_2_0_terminal_output_borrow_terminal_output_t wasi_cli_0_2_0_terminal_output_borrow_terminal_output(wasi_cli_0_2_0_terminal_output_own_terminal_output_t handle); - - void wasi_cli_0_2_0_terminal_stdin_option_own_terminal_input_free(wasi_cli_0_2_0_terminal_stdin_option_own_terminal_input_t *ptr); - - void wasi_cli_0_2_0_terminal_stdout_option_own_terminal_output_free(wasi_cli_0_2_0_terminal_stdout_option_own_terminal_output_t *ptr); - - void wasi_cli_0_2_0_terminal_stderr_option_own_terminal_output_free(wasi_cli_0_2_0_terminal_stderr_option_own_terminal_output_t *ptr); - - void wasi_filesystem_0_2_0_types_option_datetime_free(wasi_filesystem_0_2_0_types_option_datetime_t *ptr); - - void wasi_filesystem_0_2_0_types_descriptor_stat_free(wasi_filesystem_0_2_0_types_descriptor_stat_t *ptr); - - void wasi_filesystem_0_2_0_types_new_timestamp_free(wasi_filesystem_0_2_0_types_new_timestamp_t *ptr); - - void wasi_filesystem_0_2_0_types_directory_entry_free(wasi_filesystem_0_2_0_types_directory_entry_t *ptr); - - extern void wasi_filesystem_0_2_0_types_descriptor_drop_own(wasi_filesystem_0_2_0_types_own_descriptor_t handle); - extern void wasi_filesystem_0_2_0_types_descriptor_drop_borrow(wasi_filesystem_0_2_0_types_own_descriptor_t handle); - - extern wasi_filesystem_0_2_0_types_borrow_descriptor_t wasi_filesystem_0_2_0_types_borrow_descriptor(wasi_filesystem_0_2_0_types_own_descriptor_t handle); - - extern void wasi_filesystem_0_2_0_types_directory_entry_stream_drop_own(wasi_filesystem_0_2_0_types_own_directory_entry_stream_t handle); - extern void wasi_filesystem_0_2_0_types_directory_entry_stream_drop_borrow(wasi_filesystem_0_2_0_types_own_directory_entry_stream_t handle); - - extern wasi_filesystem_0_2_0_types_borrow_directory_entry_stream_t wasi_filesystem_0_2_0_types_borrow_directory_entry_stream(wasi_filesystem_0_2_0_types_own_directory_entry_stream_t handle); - - void wasi_filesystem_0_2_0_types_result_own_input_stream_error_code_free(wasi_filesystem_0_2_0_types_result_own_input_stream_error_code_t *ptr); - - void wasi_filesystem_0_2_0_types_result_own_output_stream_error_code_free(wasi_filesystem_0_2_0_types_result_own_output_stream_error_code_t *ptr); - - void wasi_filesystem_0_2_0_types_result_void_error_code_free(wasi_filesystem_0_2_0_types_result_void_error_code_t *ptr); - - void wasi_filesystem_0_2_0_types_result_descriptor_flags_error_code_free(wasi_filesystem_0_2_0_types_result_descriptor_flags_error_code_t *ptr); - - void wasi_filesystem_0_2_0_types_result_descriptor_type_error_code_free(wasi_filesystem_0_2_0_types_result_descriptor_type_error_code_t *ptr); - - void wasi_filesystem_0_2_0_types_list_u8_free(wasi_filesystem_0_2_0_types_list_u8_t *ptr); - - void wasi_filesystem_0_2_0_types_tuple2_list_u8_bool_free(wasi_filesystem_0_2_0_types_tuple2_list_u8_bool_t *ptr); - - void wasi_filesystem_0_2_0_types_result_tuple2_list_u8_bool_error_code_free(wasi_filesystem_0_2_0_types_result_tuple2_list_u8_bool_error_code_t *ptr); - - void wasi_filesystem_0_2_0_types_result_filesize_error_code_free(wasi_filesystem_0_2_0_types_result_filesize_error_code_t *ptr); - - void wasi_filesystem_0_2_0_types_result_own_directory_entry_stream_error_code_free(wasi_filesystem_0_2_0_types_result_own_directory_entry_stream_error_code_t *ptr); - - void wasi_filesystem_0_2_0_types_result_descriptor_stat_error_code_free(wasi_filesystem_0_2_0_types_result_descriptor_stat_error_code_t *ptr); - - void wasi_filesystem_0_2_0_types_result_own_descriptor_error_code_free(wasi_filesystem_0_2_0_types_result_own_descriptor_error_code_t *ptr); - - void wasi_filesystem_0_2_0_types_result_string_error_code_free(wasi_filesystem_0_2_0_types_result_string_error_code_t *ptr); - - void wasi_filesystem_0_2_0_types_result_metadata_hash_value_error_code_free(wasi_filesystem_0_2_0_types_result_metadata_hash_value_error_code_t *ptr); - - void wasi_filesystem_0_2_0_types_option_directory_entry_free(wasi_filesystem_0_2_0_types_option_directory_entry_t *ptr); - - void wasi_filesystem_0_2_0_types_result_option_directory_entry_error_code_free(wasi_filesystem_0_2_0_types_result_option_directory_entry_error_code_t *ptr); - - void wasi_filesystem_0_2_0_types_option_error_code_free(wasi_filesystem_0_2_0_types_option_error_code_t *ptr); - - void wasi_filesystem_0_2_0_preopens_tuple2_own_descriptor_string_free(wasi_filesystem_0_2_0_preopens_tuple2_own_descriptor_string_t *ptr); - - void wasi_filesystem_0_2_0_preopens_list_tuple2_own_descriptor_string_free(wasi_filesystem_0_2_0_preopens_list_tuple2_own_descriptor_string_t *ptr); - - extern void wasi_sockets_0_2_0_network_network_drop_own(wasi_sockets_0_2_0_network_own_network_t handle); - extern void wasi_sockets_0_2_0_network_network_drop_borrow(wasi_sockets_0_2_0_network_own_network_t handle); - - extern wasi_sockets_0_2_0_network_borrow_network_t wasi_sockets_0_2_0_network_borrow_network(wasi_sockets_0_2_0_network_own_network_t handle); - - void wasi_sockets_0_2_0_network_ip_address_free(wasi_sockets_0_2_0_network_ip_address_t *ptr); - - void wasi_sockets_0_2_0_network_ip_socket_address_free(wasi_sockets_0_2_0_network_ip_socket_address_t *ptr); - - void wasi_sockets_0_2_0_udp_ip_socket_address_free(wasi_sockets_0_2_0_udp_ip_socket_address_t *ptr); - - void wasi_sockets_0_2_0_udp_list_u8_free(wasi_sockets_0_2_0_udp_list_u8_t *ptr); - - void wasi_sockets_0_2_0_udp_incoming_datagram_free(wasi_sockets_0_2_0_udp_incoming_datagram_t *ptr); - - void wasi_sockets_0_2_0_udp_option_ip_socket_address_free(wasi_sockets_0_2_0_udp_option_ip_socket_address_t *ptr); - - void wasi_sockets_0_2_0_udp_outgoing_datagram_free(wasi_sockets_0_2_0_udp_outgoing_datagram_t *ptr); - - extern void wasi_sockets_0_2_0_udp_udp_socket_drop_own(wasi_sockets_0_2_0_udp_own_udp_socket_t handle); - extern void wasi_sockets_0_2_0_udp_udp_socket_drop_borrow(wasi_sockets_0_2_0_udp_own_udp_socket_t handle); - - extern wasi_sockets_0_2_0_udp_borrow_udp_socket_t wasi_sockets_0_2_0_udp_borrow_udp_socket(wasi_sockets_0_2_0_udp_own_udp_socket_t handle); - - extern void wasi_sockets_0_2_0_udp_incoming_datagram_stream_drop_own(wasi_sockets_0_2_0_udp_own_incoming_datagram_stream_t handle); - extern void wasi_sockets_0_2_0_udp_incoming_datagram_stream_drop_borrow(wasi_sockets_0_2_0_udp_own_incoming_datagram_stream_t handle); - - extern wasi_sockets_0_2_0_udp_borrow_incoming_datagram_stream_t wasi_sockets_0_2_0_udp_borrow_incoming_datagram_stream(wasi_sockets_0_2_0_udp_own_incoming_datagram_stream_t handle); - - extern void wasi_sockets_0_2_0_udp_outgoing_datagram_stream_drop_own(wasi_sockets_0_2_0_udp_own_outgoing_datagram_stream_t handle); - extern void wasi_sockets_0_2_0_udp_outgoing_datagram_stream_drop_borrow(wasi_sockets_0_2_0_udp_own_outgoing_datagram_stream_t handle); - - extern wasi_sockets_0_2_0_udp_borrow_outgoing_datagram_stream_t wasi_sockets_0_2_0_udp_borrow_outgoing_datagram_stream(wasi_sockets_0_2_0_udp_own_outgoing_datagram_stream_t handle); - - void wasi_sockets_0_2_0_udp_result_void_error_code_free(wasi_sockets_0_2_0_udp_result_void_error_code_t *ptr); - - void wasi_sockets_0_2_0_udp_result_tuple2_own_incoming_datagram_stream_own_outgoing_datagram_stream_error_code_free(wasi_sockets_0_2_0_udp_result_tuple2_own_incoming_datagram_stream_own_outgoing_datagram_stream_error_code_t *ptr); - - void wasi_sockets_0_2_0_udp_result_ip_socket_address_error_code_free(wasi_sockets_0_2_0_udp_result_ip_socket_address_error_code_t *ptr); - - void wasi_sockets_0_2_0_udp_result_u8_error_code_free(wasi_sockets_0_2_0_udp_result_u8_error_code_t *ptr); - - void wasi_sockets_0_2_0_udp_result_u64_error_code_free(wasi_sockets_0_2_0_udp_result_u64_error_code_t *ptr); - - void wasi_sockets_0_2_0_udp_list_incoming_datagram_free(wasi_sockets_0_2_0_udp_list_incoming_datagram_t *ptr); - - void wasi_sockets_0_2_0_udp_result_list_incoming_datagram_error_code_free(wasi_sockets_0_2_0_udp_result_list_incoming_datagram_error_code_t *ptr); - - void wasi_sockets_0_2_0_udp_list_outgoing_datagram_free(wasi_sockets_0_2_0_udp_list_outgoing_datagram_t *ptr); - - void wasi_sockets_0_2_0_udp_create_socket_result_own_udp_socket_error_code_free(wasi_sockets_0_2_0_udp_create_socket_result_own_udp_socket_error_code_t *ptr); - - void wasi_sockets_0_2_0_tcp_ip_socket_address_free(wasi_sockets_0_2_0_tcp_ip_socket_address_t *ptr); - - extern void wasi_sockets_0_2_0_tcp_tcp_socket_drop_own(wasi_sockets_0_2_0_tcp_own_tcp_socket_t handle); - extern void wasi_sockets_0_2_0_tcp_tcp_socket_drop_borrow(wasi_sockets_0_2_0_tcp_own_tcp_socket_t handle); - - extern wasi_sockets_0_2_0_tcp_borrow_tcp_socket_t wasi_sockets_0_2_0_tcp_borrow_tcp_socket(wasi_sockets_0_2_0_tcp_own_tcp_socket_t handle); - - void wasi_sockets_0_2_0_tcp_result_void_error_code_free(wasi_sockets_0_2_0_tcp_result_void_error_code_t *ptr); - - void wasi_sockets_0_2_0_tcp_result_tuple2_own_input_stream_own_output_stream_error_code_free(wasi_sockets_0_2_0_tcp_result_tuple2_own_input_stream_own_output_stream_error_code_t *ptr); - - void wasi_sockets_0_2_0_tcp_result_tuple3_own_tcp_socket_own_input_stream_own_output_stream_error_code_free(wasi_sockets_0_2_0_tcp_result_tuple3_own_tcp_socket_own_input_stream_own_output_stream_error_code_t *ptr); - - void wasi_sockets_0_2_0_tcp_result_ip_socket_address_error_code_free(wasi_sockets_0_2_0_tcp_result_ip_socket_address_error_code_t *ptr); - - void wasi_sockets_0_2_0_tcp_result_bool_error_code_free(wasi_sockets_0_2_0_tcp_result_bool_error_code_t *ptr); - - void wasi_sockets_0_2_0_tcp_result_duration_error_code_free(wasi_sockets_0_2_0_tcp_result_duration_error_code_t *ptr); - - void wasi_sockets_0_2_0_tcp_result_u32_error_code_free(wasi_sockets_0_2_0_tcp_result_u32_error_code_t *ptr); - - void wasi_sockets_0_2_0_tcp_result_u8_error_code_free(wasi_sockets_0_2_0_tcp_result_u8_error_code_t *ptr); - - void wasi_sockets_0_2_0_tcp_result_u64_error_code_free(wasi_sockets_0_2_0_tcp_result_u64_error_code_t *ptr); - - void wasi_sockets_0_2_0_tcp_create_socket_result_own_tcp_socket_error_code_free(wasi_sockets_0_2_0_tcp_create_socket_result_own_tcp_socket_error_code_t *ptr); - - void wasi_sockets_0_2_0_ip_name_lookup_ip_address_free(wasi_sockets_0_2_0_ip_name_lookup_ip_address_t *ptr); - - extern void wasi_sockets_0_2_0_ip_name_lookup_resolve_address_stream_drop_own(wasi_sockets_0_2_0_ip_name_lookup_own_resolve_address_stream_t handle); - extern void wasi_sockets_0_2_0_ip_name_lookup_resolve_address_stream_drop_borrow(wasi_sockets_0_2_0_ip_name_lookup_own_resolve_address_stream_t handle); - - extern wasi_sockets_0_2_0_ip_name_lookup_borrow_resolve_address_stream_t wasi_sockets_0_2_0_ip_name_lookup_borrow_resolve_address_stream(wasi_sockets_0_2_0_ip_name_lookup_own_resolve_address_stream_t handle); - - void wasi_sockets_0_2_0_ip_name_lookup_result_own_resolve_address_stream_error_code_free(wasi_sockets_0_2_0_ip_name_lookup_result_own_resolve_address_stream_error_code_t *ptr); - - void wasi_sockets_0_2_0_ip_name_lookup_option_ip_address_free(wasi_sockets_0_2_0_ip_name_lookup_option_ip_address_t *ptr); - - void wasi_sockets_0_2_0_ip_name_lookup_result_option_ip_address_error_code_free(wasi_sockets_0_2_0_ip_name_lookup_result_option_ip_address_error_code_t *ptr); - - void wasi_random_0_2_0_random_list_u8_free(wasi_random_0_2_0_random_list_u8_t *ptr); - - void wasi_http_0_2_0_types_method_free(wasi_http_0_2_0_types_method_t *ptr); - - void wasi_http_0_2_0_types_scheme_free(wasi_http_0_2_0_types_scheme_t *ptr); - - void wasi_http_0_2_0_types_option_string_free(wasi_http_0_2_0_types_option_string_t *ptr); - - void wasi_http_0_2_0_types_option_u16_free(wasi_http_0_2_0_types_option_u16_t *ptr); - - void wasi_http_0_2_0_types_dns_error_payload_free(wasi_http_0_2_0_types_dns_error_payload_t *ptr); - - void wasi_http_0_2_0_types_option_u8_free(wasi_http_0_2_0_types_option_u8_t *ptr); - - void wasi_http_0_2_0_types_tls_alert_received_payload_free(wasi_http_0_2_0_types_tls_alert_received_payload_t *ptr); - - void wasi_http_0_2_0_types_option_u32_free(wasi_http_0_2_0_types_option_u32_t *ptr); - - void wasi_http_0_2_0_types_field_size_payload_free(wasi_http_0_2_0_types_field_size_payload_t *ptr); - - void wasi_http_0_2_0_types_option_u64_free(wasi_http_0_2_0_types_option_u64_t *ptr); - - void wasi_http_0_2_0_types_option_field_size_payload_free(wasi_http_0_2_0_types_option_field_size_payload_t *ptr); - - void wasi_http_0_2_0_types_error_code_free(wasi_http_0_2_0_types_error_code_t *ptr); - - void wasi_http_0_2_0_types_header_error_free(wasi_http_0_2_0_types_header_error_t *ptr); - - void wasi_http_0_2_0_types_field_key_free(wasi_http_0_2_0_types_field_key_t *ptr); - - void wasi_http_0_2_0_types_field_value_free(wasi_http_0_2_0_types_field_value_t *ptr); - - extern void wasi_http_0_2_0_types_fields_drop_own(wasi_http_0_2_0_types_own_fields_t handle); - extern void wasi_http_0_2_0_types_fields_drop_borrow(wasi_http_0_2_0_types_own_fields_t handle); - - extern wasi_http_0_2_0_types_borrow_fields_t wasi_http_0_2_0_types_borrow_fields(wasi_http_0_2_0_types_own_fields_t handle); - - extern void wasi_http_0_2_0_types_incoming_request_drop_own(wasi_http_0_2_0_types_own_incoming_request_t handle); - extern void wasi_http_0_2_0_types_incoming_request_drop_borrow(wasi_http_0_2_0_types_own_incoming_request_t handle); - - extern wasi_http_0_2_0_types_borrow_incoming_request_t wasi_http_0_2_0_types_borrow_incoming_request(wasi_http_0_2_0_types_own_incoming_request_t handle); - - extern void wasi_http_0_2_0_types_outgoing_request_drop_own(wasi_http_0_2_0_types_own_outgoing_request_t handle); - extern void wasi_http_0_2_0_types_outgoing_request_drop_borrow(wasi_http_0_2_0_types_own_outgoing_request_t handle); - - extern wasi_http_0_2_0_types_borrow_outgoing_request_t wasi_http_0_2_0_types_borrow_outgoing_request(wasi_http_0_2_0_types_own_outgoing_request_t handle); - - extern void wasi_http_0_2_0_types_request_options_drop_own(wasi_http_0_2_0_types_own_request_options_t handle); - extern void wasi_http_0_2_0_types_request_options_drop_borrow(wasi_http_0_2_0_types_own_request_options_t handle); - - extern wasi_http_0_2_0_types_borrow_request_options_t wasi_http_0_2_0_types_borrow_request_options(wasi_http_0_2_0_types_own_request_options_t handle); - - extern void wasi_http_0_2_0_types_response_outparam_drop_own(wasi_http_0_2_0_types_own_response_outparam_t handle); - extern void wasi_http_0_2_0_types_response_outparam_drop_borrow(wasi_http_0_2_0_types_own_response_outparam_t handle); - - extern wasi_http_0_2_0_types_borrow_response_outparam_t wasi_http_0_2_0_types_borrow_response_outparam(wasi_http_0_2_0_types_own_response_outparam_t handle); - - extern void wasi_http_0_2_0_types_incoming_response_drop_own(wasi_http_0_2_0_types_own_incoming_response_t handle); - extern void wasi_http_0_2_0_types_incoming_response_drop_borrow(wasi_http_0_2_0_types_own_incoming_response_t handle); - - extern wasi_http_0_2_0_types_borrow_incoming_response_t wasi_http_0_2_0_types_borrow_incoming_response(wasi_http_0_2_0_types_own_incoming_response_t handle); - - extern void wasi_http_0_2_0_types_incoming_body_drop_own(wasi_http_0_2_0_types_own_incoming_body_t handle); - extern void wasi_http_0_2_0_types_incoming_body_drop_borrow(wasi_http_0_2_0_types_own_incoming_body_t handle); - - extern wasi_http_0_2_0_types_borrow_incoming_body_t wasi_http_0_2_0_types_borrow_incoming_body(wasi_http_0_2_0_types_own_incoming_body_t handle); - - extern void wasi_http_0_2_0_types_future_trailers_drop_own(wasi_http_0_2_0_types_own_future_trailers_t handle); - extern void wasi_http_0_2_0_types_future_trailers_drop_borrow(wasi_http_0_2_0_types_own_future_trailers_t handle); - - extern wasi_http_0_2_0_types_borrow_future_trailers_t wasi_http_0_2_0_types_borrow_future_trailers(wasi_http_0_2_0_types_own_future_trailers_t handle); - - extern void wasi_http_0_2_0_types_outgoing_response_drop_own(wasi_http_0_2_0_types_own_outgoing_response_t handle); - extern void wasi_http_0_2_0_types_outgoing_response_drop_borrow(wasi_http_0_2_0_types_own_outgoing_response_t handle); - - extern wasi_http_0_2_0_types_borrow_outgoing_response_t wasi_http_0_2_0_types_borrow_outgoing_response(wasi_http_0_2_0_types_own_outgoing_response_t handle); - - extern void wasi_http_0_2_0_types_outgoing_body_drop_own(wasi_http_0_2_0_types_own_outgoing_body_t handle); - extern void wasi_http_0_2_0_types_outgoing_body_drop_borrow(wasi_http_0_2_0_types_own_outgoing_body_t handle); - - extern wasi_http_0_2_0_types_borrow_outgoing_body_t wasi_http_0_2_0_types_borrow_outgoing_body(wasi_http_0_2_0_types_own_outgoing_body_t handle); - - extern void wasi_http_0_2_0_types_future_incoming_response_drop_own(wasi_http_0_2_0_types_own_future_incoming_response_t handle); - extern void wasi_http_0_2_0_types_future_incoming_response_drop_borrow(wasi_http_0_2_0_types_own_future_incoming_response_t handle); - - extern wasi_http_0_2_0_types_borrow_future_incoming_response_t wasi_http_0_2_0_types_borrow_future_incoming_response(wasi_http_0_2_0_types_own_future_incoming_response_t handle); - - void wasi_http_0_2_0_types_option_error_code_free(wasi_http_0_2_0_types_option_error_code_t *ptr); - - void wasi_http_0_2_0_types_tuple2_field_key_field_value_free(wasi_http_0_2_0_types_tuple2_field_key_field_value_t *ptr); - - void wasi_http_0_2_0_types_list_tuple2_field_key_field_value_free(wasi_http_0_2_0_types_list_tuple2_field_key_field_value_t *ptr); - - void wasi_http_0_2_0_types_result_own_fields_header_error_free(wasi_http_0_2_0_types_result_own_fields_header_error_t *ptr); - - void wasi_http_0_2_0_types_list_field_value_free(wasi_http_0_2_0_types_list_field_value_t *ptr); - - void wasi_http_0_2_0_types_result_void_header_error_free(wasi_http_0_2_0_types_result_void_header_error_t *ptr); - - void wasi_http_0_2_0_types_option_scheme_free(wasi_http_0_2_0_types_option_scheme_t *ptr); - - void wasi_http_0_2_0_types_result_own_incoming_body_void_free(wasi_http_0_2_0_types_result_own_incoming_body_void_t *ptr); - - void wasi_http_0_2_0_types_result_own_outgoing_body_void_free(wasi_http_0_2_0_types_result_own_outgoing_body_void_t *ptr); - - void wasi_http_0_2_0_types_result_void_void_free(wasi_http_0_2_0_types_result_void_void_t *ptr); - - void wasi_http_0_2_0_types_option_duration_free(wasi_http_0_2_0_types_option_duration_t *ptr); - - void wasi_http_0_2_0_types_result_own_outgoing_response_error_code_free(wasi_http_0_2_0_types_result_own_outgoing_response_error_code_t *ptr); - - void wasi_http_0_2_0_types_result_own_input_stream_void_free(wasi_http_0_2_0_types_result_own_input_stream_void_t *ptr); - - void wasi_http_0_2_0_types_option_own_trailers_free(wasi_http_0_2_0_types_option_own_trailers_t *ptr); - - void wasi_http_0_2_0_types_result_option_own_trailers_error_code_free(wasi_http_0_2_0_types_result_option_own_trailers_error_code_t *ptr); - - void wasi_http_0_2_0_types_result_result_option_own_trailers_error_code_void_free(wasi_http_0_2_0_types_result_result_option_own_trailers_error_code_void_t *ptr); - - void wasi_http_0_2_0_types_option_result_result_option_own_trailers_error_code_void_free(wasi_http_0_2_0_types_option_result_result_option_own_trailers_error_code_void_t *ptr); - - void wasi_http_0_2_0_types_result_own_output_stream_void_free(wasi_http_0_2_0_types_result_own_output_stream_void_t *ptr); - - void wasi_http_0_2_0_types_result_void_error_code_free(wasi_http_0_2_0_types_result_void_error_code_t *ptr); - - void wasi_http_0_2_0_types_result_own_incoming_response_error_code_free(wasi_http_0_2_0_types_result_own_incoming_response_error_code_t *ptr); - - void wasi_http_0_2_0_types_result_result_own_incoming_response_error_code_void_free(wasi_http_0_2_0_types_result_result_own_incoming_response_error_code_void_t *ptr); - - void wasi_http_0_2_0_types_option_result_result_own_incoming_response_error_code_void_free(wasi_http_0_2_0_types_option_result_result_own_incoming_response_error_code_void_t *ptr); - - void wasi_http_0_2_0_outgoing_handler_error_code_free(wasi_http_0_2_0_outgoing_handler_error_code_t *ptr); - - void wasi_http_0_2_0_outgoing_handler_option_own_request_options_free(wasi_http_0_2_0_outgoing_handler_option_own_request_options_t *ptr); - - void wasi_http_0_2_0_outgoing_handler_result_own_future_incoming_response_error_code_free(wasi_http_0_2_0_outgoing_handler_result_own_future_incoming_response_error_code_t *ptr); - - void exports_wasi_cli_0_2_0_run_result_void_void_free(exports_wasi_cli_0_2_0_run_result_void_void_t *ptr); - - // Transfers ownership of `s` into the string `ret` - void bindings_string_set(bindings_string_t *ret, char*s); - - // Creates a copy of the input nul-terminate string `s` and - // stores it into the component model string `ret`. - void bindings_string_dup(bindings_string_t *ret, const char*s); - - // Deallocates the string pointed to by `ret`, deallocating - // the memory behind the string. - void bindings_string_free(bindings_string_t *ret); - - #ifdef __cplusplus - } - #endif - #endif - \ No newline at end of file +// // Wait for the stream to become writable +// pollable.block(); +// let Ok(n) = this.check-write(); // eliding error handling +// let len = min(n, contents.len()); +// let (chunk, rest) = contents.split_at(len); +// this.write(chunk ); // eliding error handling +// contents = rest; +// } +// this.flush(); +// // Wait for completion of `flush` +// pollable.block(); +// // Check for any errors that arose during `flush` +// let _ = this.check-write(); // eliding error handling +// ``` +extern bool wasi_io_streams_method_output_stream_blocking_write_and_flush(wasi_io_streams_borrow_output_stream_t self, bindings_list_u8_t *contents, wasi_io_streams_stream_error_t *err); +// Request to flush buffered output. This function never blocks. +// +// This tells the output-stream that the caller intends any buffered +// output to be flushed. the output which is expected to be flushed +// is all that has been passed to `write` prior to this call. +// +// Upon calling this function, the `output-stream` will not accept any +// writes (`check-write` will return `ok(0)`) until the flush has +// completed. The `subscribe` pollable will become ready when the +// flush has completed and the stream can accept more writes. +extern bool wasi_io_streams_method_output_stream_flush(wasi_io_streams_borrow_output_stream_t self, wasi_io_streams_stream_error_t *err); +// Request to flush buffered output, and block until flush completes +// and stream is ready for writing again. +extern bool wasi_io_streams_method_output_stream_blocking_flush(wasi_io_streams_borrow_output_stream_t self, wasi_io_streams_stream_error_t *err); +// Create a `pollable` which will resolve once the output-stream +// is ready for more writing, or an error has occured. When this +// pollable is ready, `check-write` will return `ok(n)` with n>0, or an +// error. +// +// If the stream is closed, this pollable is always ready immediately. +// +// The created `pollable` is a child resource of the `output-stream`. +// Implementations may trap if the `output-stream` is dropped before +// all derived `pollable`s created with this function are dropped. +extern wasi_io_streams_own_pollable_t wasi_io_streams_method_output_stream_subscribe(wasi_io_streams_borrow_output_stream_t self); +// Write zeroes to a stream. +// +// This should be used precisely like `write` with the exact same +// preconditions (must use check-write first), but instead of +// passing a list of bytes, you simply pass the number of zero-bytes +// that should be written. +extern bool wasi_io_streams_method_output_stream_write_zeroes(wasi_io_streams_borrow_output_stream_t self, uint64_t len, wasi_io_streams_stream_error_t *err); +// Perform a write of up to 4096 zeroes, and then flush the stream. +// Block until all of these operations are complete, or an error +// occurs. +// +// This is a convenience wrapper around the use of `check-write`, +// `subscribe`, `write-zeroes`, and `flush`, and is implemented with +// the following pseudo-code: +// +// ```text +// let pollable = this.subscribe(); +// while num_zeroes != 0 { +// // Wait for the stream to become writable +// pollable.block(); +// let Ok(n) = this.check-write(); // eliding error handling +// let len = min(n, num_zeroes); +// this.write-zeroes(len); // eliding error handling +// num_zeroes -= len; +// } +// this.flush(); +// // Wait for completion of `flush` +// pollable.block(); +// // Check for any errors that arose during `flush` +// let _ = this.check-write(); // eliding error handling +// ``` +extern bool wasi_io_streams_method_output_stream_blocking_write_zeroes_and_flush(wasi_io_streams_borrow_output_stream_t self, uint64_t len, wasi_io_streams_stream_error_t *err); +// Read from one stream and write to another. +// +// The behavior of splice is equivelant to: +// 1. calling `check-write` on the `output-stream` +// 2. calling `read` on the `input-stream` with the smaller of the +// `check-write` permitted length and the `len` provided to `splice` +// 3. calling `write` on the `output-stream` with that read data. +// +// Any error reported by the call to `check-write`, `read`, or +// `write` ends the splice and reports that error. +// +// This function returns the number of bytes transferred; it may be less +// than `len`. +extern bool wasi_io_streams_method_output_stream_splice(wasi_io_streams_borrow_output_stream_t self, wasi_io_streams_borrow_input_stream_t src, uint64_t len, uint64_t *ret, wasi_io_streams_stream_error_t *err); +// Read from one stream and write to another, with blocking. +// +// This is similar to `splice`, except that it blocks until the +// `output-stream` is ready for writing, and the `input-stream` +// is ready for reading, before performing the `splice`. +extern bool wasi_io_streams_method_output_stream_blocking_splice(wasi_io_streams_borrow_output_stream_t self, wasi_io_streams_borrow_input_stream_t src, uint64_t len, uint64_t *ret, wasi_io_streams_stream_error_t *err); + +// Imported Functions from `wasi:cli/stdin@0.2.0` +extern wasi_cli_stdin_own_input_stream_t wasi_cli_stdin_get_stdin(void); + +// Imported Functions from `wasi:cli/stdout@0.2.0` +extern wasi_cli_stdout_own_output_stream_t wasi_cli_stdout_get_stdout(void); + +// Imported Functions from `wasi:cli/stderr@0.2.0` +extern wasi_cli_stderr_own_output_stream_t wasi_cli_stderr_get_stderr(void); + +// Imported Functions from `wasi:cli/terminal-stdin@0.2.0` +// If stdin is connected to a terminal, return a `terminal-input` handle +// allowing further interaction with it. +extern bool wasi_cli_terminal_stdin_get_terminal_stdin(wasi_cli_terminal_stdin_own_terminal_input_t *ret); + +// Imported Functions from `wasi:cli/terminal-stdout@0.2.0` +// If stdout is connected to a terminal, return a `terminal-output` handle +// allowing further interaction with it. +extern bool wasi_cli_terminal_stdout_get_terminal_stdout(wasi_cli_terminal_stdout_own_terminal_output_t *ret); + +// Imported Functions from `wasi:cli/terminal-stderr@0.2.0` +// If stderr is connected to a terminal, return a `terminal-output` handle +// allowing further interaction with it. +extern bool wasi_cli_terminal_stderr_get_terminal_stderr(wasi_cli_terminal_stderr_own_terminal_output_t *ret); + +// Imported Functions from `wasi:clocks/monotonic-clock@0.2.0` +// Read the current value of the clock. +// +// The clock is monotonic, therefore calling this function repeatedly will +// produce a sequence of non-decreasing values. +extern wasi_clocks_monotonic_clock_instant_t wasi_clocks_monotonic_clock_now(void); +// Query the resolution of the clock. Returns the duration of time +// corresponding to a clock tick. +extern wasi_clocks_monotonic_clock_duration_t wasi_clocks_monotonic_clock_resolution(void); +// Create a `pollable` which will resolve once the specified instant +// occured. +extern wasi_clocks_monotonic_clock_own_pollable_t wasi_clocks_monotonic_clock_subscribe_instant(wasi_clocks_monotonic_clock_instant_t when); +// Create a `pollable` which will resolve once the given duration has +// elapsed, starting at the time at which this function was called. +// occured. +extern wasi_clocks_monotonic_clock_own_pollable_t wasi_clocks_monotonic_clock_subscribe_duration(wasi_clocks_monotonic_clock_duration_t when); + +// Imported Functions from `wasi:clocks/wall-clock@0.2.0` +// Read the current value of the clock. +// +// This clock is not monotonic, therefore calling this function repeatedly +// will not necessarily produce a sequence of non-decreasing values. +// +// The returned timestamps represent the number of seconds since +// 1970-01-01T00:00:00Z, also known as [POSIX's Seconds Since the Epoch], +// also known as [Unix Time]. +// +// The nanoseconds field of the output is always less than 1000000000. +// +// [POSIX's Seconds Since the Epoch]: https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xbd_chap04.html#tag_21_04_16 +// [Unix Time]: https://en.wikipedia.org/wiki/Unix_time +extern void wasi_clocks_wall_clock_now(wasi_clocks_wall_clock_datetime_t *ret); +// Query the resolution of the clock. +// +// The nanoseconds field of the output is always less than 1000000000. +extern void wasi_clocks_wall_clock_resolution(wasi_clocks_wall_clock_datetime_t *ret); + +// Imported Functions from `wasi:filesystem/types@0.2.0` +// Return a stream for reading from a file, if available. +// +// May fail with an error-code describing why the file cannot be read. +// +// Multiple read, write, and append streams may be active on the same open +// file and they do not interfere with each other. +// +// Note: This allows using `read-stream`, which is similar to `read` in POSIX. +extern bool wasi_filesystem_types_method_descriptor_read_via_stream(wasi_filesystem_types_borrow_descriptor_t self, wasi_filesystem_types_filesize_t offset, wasi_filesystem_types_own_input_stream_t *ret, wasi_filesystem_types_error_code_t *err); +// Return a stream for writing to a file, if available. +// +// May fail with an error-code describing why the file cannot be written. +// +// Note: This allows using `write-stream`, which is similar to `write` in +// POSIX. +extern bool wasi_filesystem_types_method_descriptor_write_via_stream(wasi_filesystem_types_borrow_descriptor_t self, wasi_filesystem_types_filesize_t offset, wasi_filesystem_types_own_output_stream_t *ret, wasi_filesystem_types_error_code_t *err); +// Return a stream for appending to a file, if available. +// +// May fail with an error-code describing why the file cannot be appended. +// +// Note: This allows using `write-stream`, which is similar to `write` with +// `O_APPEND` in in POSIX. +extern bool wasi_filesystem_types_method_descriptor_append_via_stream(wasi_filesystem_types_borrow_descriptor_t self, wasi_filesystem_types_own_output_stream_t *ret, wasi_filesystem_types_error_code_t *err); +// Provide file advisory information on a descriptor. +// +// This is similar to `posix_fadvise` in POSIX. +extern bool wasi_filesystem_types_method_descriptor_advise(wasi_filesystem_types_borrow_descriptor_t self, wasi_filesystem_types_filesize_t offset, wasi_filesystem_types_filesize_t length, wasi_filesystem_types_advice_t advice, wasi_filesystem_types_error_code_t *err); +// Synchronize the data of a file to disk. +// +// This function succeeds with no effect if the file descriptor is not +// opened for writing. +// +// Note: This is similar to `fdatasync` in POSIX. +extern bool wasi_filesystem_types_method_descriptor_sync_data(wasi_filesystem_types_borrow_descriptor_t self, wasi_filesystem_types_error_code_t *err); +// Get flags associated with a descriptor. +// +// Note: This returns similar flags to `fcntl(fd, F_GETFL)` in POSIX. +// +// Note: This returns the value that was the `fs_flags` value returned +// from `fdstat_get` in earlier versions of WASI. +extern bool wasi_filesystem_types_method_descriptor_get_flags(wasi_filesystem_types_borrow_descriptor_t self, wasi_filesystem_types_descriptor_flags_t *ret, wasi_filesystem_types_error_code_t *err); +// Get the dynamic type of a descriptor. +// +// Note: This returns the same value as the `type` field of the `fd-stat` +// returned by `stat`, `stat-at` and similar. +// +// Note: This returns similar flags to the `st_mode & S_IFMT` value provided +// by `fstat` in POSIX. +// +// Note: This returns the value that was the `fs_filetype` value returned +// from `fdstat_get` in earlier versions of WASI. +extern bool wasi_filesystem_types_method_descriptor_get_type(wasi_filesystem_types_borrow_descriptor_t self, wasi_filesystem_types_descriptor_type_t *ret, wasi_filesystem_types_error_code_t *err); +// Adjust the size of an open file. If this increases the file's size, the +// extra bytes are filled with zeros. +// +// Note: This was called `fd_filestat_set_size` in earlier versions of WASI. +extern bool wasi_filesystem_types_method_descriptor_set_size(wasi_filesystem_types_borrow_descriptor_t self, wasi_filesystem_types_filesize_t size, wasi_filesystem_types_error_code_t *err); +// Adjust the timestamps of an open file or directory. +// +// Note: This is similar to `futimens` in POSIX. +// +// Note: This was called `fd_filestat_set_times` in earlier versions of WASI. +extern bool wasi_filesystem_types_method_descriptor_set_times(wasi_filesystem_types_borrow_descriptor_t self, wasi_filesystem_types_new_timestamp_t *data_access_timestamp, wasi_filesystem_types_new_timestamp_t *data_modification_timestamp, wasi_filesystem_types_error_code_t *err); +// Read from a descriptor, without using and updating the descriptor's offset. +// +// This function returns a list of bytes containing the data that was +// read, along with a bool which, when true, indicates that the end of the +// file was reached. The returned list will contain up to `length` bytes; it +// may return fewer than requested, if the end of the file is reached or +// if the I/O operation is interrupted. +// +// In the future, this may change to return a `stream`. +// +// Note: This is similar to `pread` in POSIX. +extern bool wasi_filesystem_types_method_descriptor_read(wasi_filesystem_types_borrow_descriptor_t self, wasi_filesystem_types_filesize_t length, wasi_filesystem_types_filesize_t offset, bindings_tuple2_list_u8_bool_t *ret, wasi_filesystem_types_error_code_t *err); +// Write to a descriptor, without using and updating the descriptor's offset. +// +// It is valid to write past the end of a file; the file is extended to the +// extent of the write, with bytes between the previous end and the start of +// the write set to zero. +// +// In the future, this may change to take a `stream`. +// +// Note: This is similar to `pwrite` in POSIX. +extern bool wasi_filesystem_types_method_descriptor_write(wasi_filesystem_types_borrow_descriptor_t self, bindings_list_u8_t *buffer, wasi_filesystem_types_filesize_t offset, wasi_filesystem_types_filesize_t *ret, wasi_filesystem_types_error_code_t *err); +// Read directory entries from a directory. +// +// On filesystems where directories contain entries referring to themselves +// and their parents, often named `.` and `..` respectively, these entries +// are omitted. +// +// This always returns a new stream which starts at the beginning of the +// directory. Multiple streams may be active on the same directory, and they +// do not interfere with each other. +extern bool wasi_filesystem_types_method_descriptor_read_directory(wasi_filesystem_types_borrow_descriptor_t self, wasi_filesystem_types_own_directory_entry_stream_t *ret, wasi_filesystem_types_error_code_t *err); +// Synchronize the data and metadata of a file to disk. +// +// This function succeeds with no effect if the file descriptor is not +// opened for writing. +// +// Note: This is similar to `fsync` in POSIX. +extern bool wasi_filesystem_types_method_descriptor_sync(wasi_filesystem_types_borrow_descriptor_t self, wasi_filesystem_types_error_code_t *err); +// Create a directory. +// +// Note: This is similar to `mkdirat` in POSIX. +extern bool wasi_filesystem_types_method_descriptor_create_directory_at(wasi_filesystem_types_borrow_descriptor_t self, bindings_string_t *path, wasi_filesystem_types_error_code_t *err); +// Return the attributes of an open file or directory. +// +// Note: This is similar to `fstat` in POSIX, except that it does not return +// device and inode information. For testing whether two descriptors refer to +// the same underlying filesystem object, use `is-same-object`. To obtain +// additional data that can be used do determine whether a file has been +// modified, use `metadata-hash`. +// +// Note: This was called `fd_filestat_get` in earlier versions of WASI. +extern bool wasi_filesystem_types_method_descriptor_stat(wasi_filesystem_types_borrow_descriptor_t self, wasi_filesystem_types_descriptor_stat_t *ret, wasi_filesystem_types_error_code_t *err); +// Return the attributes of a file or directory. +// +// Note: This is similar to `fstatat` in POSIX, except that it does not +// return device and inode information. See the `stat` description for a +// discussion of alternatives. +// +// Note: This was called `path_filestat_get` in earlier versions of WASI. +extern bool wasi_filesystem_types_method_descriptor_stat_at(wasi_filesystem_types_borrow_descriptor_t self, wasi_filesystem_types_path_flags_t path_flags, bindings_string_t *path, wasi_filesystem_types_descriptor_stat_t *ret, wasi_filesystem_types_error_code_t *err); +// Adjust the timestamps of a file or directory. +// +// Note: This is similar to `utimensat` in POSIX. +// +// Note: This was called `path_filestat_set_times` in earlier versions of +// WASI. +extern bool wasi_filesystem_types_method_descriptor_set_times_at(wasi_filesystem_types_borrow_descriptor_t self, wasi_filesystem_types_path_flags_t path_flags, bindings_string_t *path, wasi_filesystem_types_new_timestamp_t *data_access_timestamp, wasi_filesystem_types_new_timestamp_t *data_modification_timestamp, wasi_filesystem_types_error_code_t *err); +// Create a hard link. +// +// Note: This is similar to `linkat` in POSIX. +extern bool wasi_filesystem_types_method_descriptor_link_at(wasi_filesystem_types_borrow_descriptor_t self, wasi_filesystem_types_path_flags_t old_path_flags, bindings_string_t *old_path, wasi_filesystem_types_borrow_descriptor_t new_descriptor, bindings_string_t *new_path, wasi_filesystem_types_error_code_t *err); +// Open a file or directory. +// +// The returned descriptor is not guaranteed to be the lowest-numbered +// descriptor not currently open/ it is randomized to prevent applications +// from depending on making assumptions about indexes, since this is +// error-prone in multi-threaded contexts. The returned descriptor is +// guaranteed to be less than 2**31. +// +// If `flags` contains `descriptor-flags::mutate-directory`, and the base +// descriptor doesn't have `descriptor-flags::mutate-directory` set, +// `open-at` fails with `error-code::read-only`. +// +// If `flags` contains `write` or `mutate-directory`, or `open-flags` +// contains `truncate` or `create`, and the base descriptor doesn't have +// `descriptor-flags::mutate-directory` set, `open-at` fails with +// `error-code::read-only`. +// +// Note: This is similar to `openat` in POSIX. +extern bool wasi_filesystem_types_method_descriptor_open_at(wasi_filesystem_types_borrow_descriptor_t self, wasi_filesystem_types_path_flags_t path_flags, bindings_string_t *path, wasi_filesystem_types_open_flags_t open_flags, wasi_filesystem_types_descriptor_flags_t flags, wasi_filesystem_types_own_descriptor_t *ret, wasi_filesystem_types_error_code_t *err); +// Read the contents of a symbolic link. +// +// If the contents contain an absolute or rooted path in the underlying +// filesystem, this function fails with `error-code::not-permitted`. +// +// Note: This is similar to `readlinkat` in POSIX. +extern bool wasi_filesystem_types_method_descriptor_readlink_at(wasi_filesystem_types_borrow_descriptor_t self, bindings_string_t *path, bindings_string_t *ret, wasi_filesystem_types_error_code_t *err); +// Remove a directory. +// +// Return `error-code::not-empty` if the directory is not empty. +// +// Note: This is similar to `unlinkat(fd, path, AT_REMOVEDIR)` in POSIX. +extern bool wasi_filesystem_types_method_descriptor_remove_directory_at(wasi_filesystem_types_borrow_descriptor_t self, bindings_string_t *path, wasi_filesystem_types_error_code_t *err); +// Rename a filesystem object. +// +// Note: This is similar to `renameat` in POSIX. +extern bool wasi_filesystem_types_method_descriptor_rename_at(wasi_filesystem_types_borrow_descriptor_t self, bindings_string_t *old_path, wasi_filesystem_types_borrow_descriptor_t new_descriptor, bindings_string_t *new_path, wasi_filesystem_types_error_code_t *err); +// Create a symbolic link (also known as a "symlink"). +// +// If `old-path` starts with `/`, the function fails with +// `error-code::not-permitted`. +// +// Note: This is similar to `symlinkat` in POSIX. +extern bool wasi_filesystem_types_method_descriptor_symlink_at(wasi_filesystem_types_borrow_descriptor_t self, bindings_string_t *old_path, bindings_string_t *new_path, wasi_filesystem_types_error_code_t *err); +// Unlink a filesystem object that is not a directory. +// +// Return `error-code::is-directory` if the path refers to a directory. +// Note: This is similar to `unlinkat(fd, path, 0)` in POSIX. +extern bool wasi_filesystem_types_method_descriptor_unlink_file_at(wasi_filesystem_types_borrow_descriptor_t self, bindings_string_t *path, wasi_filesystem_types_error_code_t *err); +// Test whether two descriptors refer to the same filesystem object. +// +// In POSIX, this corresponds to testing whether the two descriptors have the +// same device (`st_dev`) and inode (`st_ino` or `d_ino`) numbers. +// wasi-filesystem does not expose device and inode numbers, so this function +// may be used instead. +extern bool wasi_filesystem_types_method_descriptor_is_same_object(wasi_filesystem_types_borrow_descriptor_t self, wasi_filesystem_types_borrow_descriptor_t other); +// Return a hash of the metadata associated with a filesystem object referred +// to by a descriptor. +// +// This returns a hash of the last-modification timestamp and file size, and +// may also include the inode number, device number, birth timestamp, and +// other metadata fields that may change when the file is modified or +// replaced. It may also include a secret value chosen by the +// implementation and not otherwise exposed. +// +// Implementations are encourated to provide the following properties: +// +// - If the file is not modified or replaced, the computed hash value should +// usually not change. +// - If the object is modified or replaced, the computed hash value should +// usually change. +// - The inputs to the hash should not be easily computable from the +// computed hash. +// +// However, none of these is required. +extern bool wasi_filesystem_types_method_descriptor_metadata_hash(wasi_filesystem_types_borrow_descriptor_t self, wasi_filesystem_types_metadata_hash_value_t *ret, wasi_filesystem_types_error_code_t *err); +// Return a hash of the metadata associated with a filesystem object referred +// to by a directory descriptor and a relative path. +// +// This performs the same hash computation as `metadata-hash`. +extern bool wasi_filesystem_types_method_descriptor_metadata_hash_at(wasi_filesystem_types_borrow_descriptor_t self, wasi_filesystem_types_path_flags_t path_flags, bindings_string_t *path, wasi_filesystem_types_metadata_hash_value_t *ret, wasi_filesystem_types_error_code_t *err); +// Read a single directory entry from a `directory-entry-stream`. +extern bool wasi_filesystem_types_method_directory_entry_stream_read_directory_entry(wasi_filesystem_types_borrow_directory_entry_stream_t self, wasi_filesystem_types_option_directory_entry_t *ret, wasi_filesystem_types_error_code_t *err); +// Attempts to extract a filesystem-related `error-code` from the stream +// `error` provided. +// +// Stream operations which return `stream-error::last-operation-failed` +// have a payload with more information about the operation that failed. +// This payload can be passed through to this function to see if there's +// filesystem-related information about the error to return. +// +// Note that this function is fallible because not all stream-related +// errors are filesystem-related errors. +extern bool wasi_filesystem_types_filesystem_error_code(wasi_filesystem_types_borrow_error_t err_, wasi_filesystem_types_error_code_t *ret); + +// Imported Functions from `wasi:filesystem/preopens@0.2.0` +// Return the set of preopened directories, and their path. +extern void wasi_filesystem_preopens_get_directories(wasi_filesystem_preopens_list_tuple2_own_descriptor_string_t *ret); + +// Imported Functions from `wasi:sockets/instance-network@0.2.0` +// Get a handle to the default network. +extern wasi_sockets_instance_network_own_network_t wasi_sockets_instance_network_instance_network(void); + +// Imported Functions from `wasi:sockets/udp@0.2.0` +// Bind the socket to a specific network on the provided IP address and port. +// +// 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 port is zero, the socket will be bound to a random free port. +// +// # Typical errors +// - `invalid-argument`: The `local-address` has the wrong address family. (EAFNOSUPPORT, EFAULT on Windows) +// - `invalid-state`: The socket is already bound. (EINVAL) +// - `address-in-use`: No ephemeral ports available. (EADDRINUSE, ENOBUFS on Windows) +// - `address-in-use`: Address is already in use. (EADDRINUSE) +// - `address-not-bindable`: `local-address` is not an address that the `network` can bind to. (EADDRNOTAVAIL) +// - `not-in-progress`: A `bind` operation is not in progress. +// - `would-block`: Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN) +// +// # Implementors note +// Unlike in POSIX, in WASI the bind operation is async. This enables +// interactive WASI hosts to inject permission prompts. Runtimes that +// don't want to make use of this ability can simply call the native +// `bind` as part of either `start-bind` or `finish-bind`. +// +// # References +// - +// - +// - +// - +extern bool wasi_sockets_udp_method_udp_socket_start_bind(wasi_sockets_udp_borrow_udp_socket_t self, wasi_sockets_udp_borrow_network_t network, wasi_sockets_udp_ip_socket_address_t *local_address, wasi_sockets_udp_error_code_t *err); +extern bool wasi_sockets_udp_method_udp_socket_finish_bind(wasi_sockets_udp_borrow_udp_socket_t self, wasi_sockets_udp_error_code_t *err); +// Set up inbound & outbound communication channels, optionally to a specific peer. +// +// This function only changes the local socket configuration and does not generate any network traffic. +// On success, the `remote-address` of the socket is updated. The `local-address` may be updated as well, +// based on the best network path to `remote-address`. +// +// When a `remote-address` is provided, the returned streams are limited to communicating with that specific peer: +// - `send` can only be used to send to this destination. +// - `receive` will only return datagrams sent from the provided `remote-address`. +// +// This method may be called multiple times on the same socket to change its association, but +// only the most recently returned pair of streams will be operational. Implementations may trap if +// the streams returned by a previous invocation haven't been dropped yet before calling `stream` again. +// +// The POSIX equivalent in pseudo-code is: +// ```text +// if (was previously connected) { +// connect(s, AF_UNSPEC) +// } +// if (remote_address is Some) { +// connect(s, remote_address) +// } +// ``` +// +// Unlike in POSIX, the socket must already be explicitly bound. +// +// # Typical errors +// - `invalid-argument`: The `remote-address` has the wrong address family. (EAFNOSUPPORT) +// - `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-in-use`: Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE, EADDRNOTAVAIL on Linux, EAGAIN on BSD) +// - `remote-unreachable`: The remote address is not reachable. (ECONNRESET, ENETRESET, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET) +// - `connection-refused`: The connection was refused. (ECONNREFUSED) +// +// # References +// - +// - +// - +// - +extern bool wasi_sockets_udp_method_udp_socket_stream(wasi_sockets_udp_borrow_udp_socket_t self, wasi_sockets_udp_ip_socket_address_t *maybe_remote_address, wasi_sockets_udp_tuple2_own_incoming_datagram_stream_own_outgoing_datagram_stream_t *ret, wasi_sockets_udp_error_code_t *err); +// Get the current bound address. +// +// POSIX mentions: +// > If the socket has not been bound to a local name, the value +// > stored in the object pointed to by `address` is unspecified. +// +// WASI is stricter and requires `local-address` to return `invalid-state` when the socket hasn't been bound yet. +// +// # Typical errors +// - `invalid-state`: The socket is not bound to any local address. +// +// # References +// - +// - +// - +// - +extern bool wasi_sockets_udp_method_udp_socket_local_address(wasi_sockets_udp_borrow_udp_socket_t self, wasi_sockets_udp_ip_socket_address_t *ret, wasi_sockets_udp_error_code_t *err); +// Get the address the socket is currently streaming to. +// +// # Typical errors +// - `invalid-state`: The socket is not streaming to a specific remote address. (ENOTCONN) +// +// # References +// - +// - +// - +// - +extern bool wasi_sockets_udp_method_udp_socket_remote_address(wasi_sockets_udp_borrow_udp_socket_t self, wasi_sockets_udp_ip_socket_address_t *ret, wasi_sockets_udp_error_code_t *err); +// Whether this is a IPv4 or IPv6 socket. +// +// Equivalent to the SO_DOMAIN socket option. +extern wasi_sockets_udp_ip_address_family_t wasi_sockets_udp_method_udp_socket_address_family(wasi_sockets_udp_borrow_udp_socket_t self); +// Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options. +// +// If the provided value is 0, an `invalid-argument` error is returned. +// +// # Typical errors +// - `invalid-argument`: (set) The TTL value must be 1 or higher. +extern bool wasi_sockets_udp_method_udp_socket_unicast_hop_limit(wasi_sockets_udp_borrow_udp_socket_t self, uint8_t *ret, wasi_sockets_udp_error_code_t *err); +extern bool wasi_sockets_udp_method_udp_socket_set_unicast_hop_limit(wasi_sockets_udp_borrow_udp_socket_t self, uint8_t value, wasi_sockets_udp_error_code_t *err); +// The kernel buffer space reserved for sends/receives on this socket. +// +// If the provided value is 0, an `invalid-argument` error is returned. +// Any other value will never cause an error, but it might be silently clamped and/or rounded. +// I.e. after setting a value, reading the same setting back may return a different value. +// +// Equivalent to the SO_RCVBUF and SO_SNDBUF socket options. +// +// # Typical errors +// - `invalid-argument`: (set) The provided value was 0. +extern bool wasi_sockets_udp_method_udp_socket_receive_buffer_size(wasi_sockets_udp_borrow_udp_socket_t self, uint64_t *ret, wasi_sockets_udp_error_code_t *err); +extern bool wasi_sockets_udp_method_udp_socket_set_receive_buffer_size(wasi_sockets_udp_borrow_udp_socket_t self, uint64_t value, wasi_sockets_udp_error_code_t *err); +extern bool wasi_sockets_udp_method_udp_socket_send_buffer_size(wasi_sockets_udp_borrow_udp_socket_t self, uint64_t *ret, wasi_sockets_udp_error_code_t *err); +extern bool wasi_sockets_udp_method_udp_socket_set_send_buffer_size(wasi_sockets_udp_borrow_udp_socket_t self, uint64_t value, wasi_sockets_udp_error_code_t *err); +// Create a `pollable` which will resolve once the socket is ready for I/O. +// +// Note: this function is here for WASI Preview2 only. +// It's planned to be removed when `future` is natively supported in Preview3. +extern wasi_sockets_udp_own_pollable_t wasi_sockets_udp_method_udp_socket_subscribe(wasi_sockets_udp_borrow_udp_socket_t self); +// Receive messages on the socket. +// +// This function attempts to receive up to `max-results` datagrams on the socket without blocking. +// The returned list may contain fewer elements than requested, but never more. +// +// This function returns successfully with an empty list when either: +// - `max-results` is 0, or: +// - `max-results` is greater than 0, but no results are immediately available. +// This function never returns `error(would-block)`. +// +// # Typical errors +// - `remote-unreachable`: The remote address is not reachable. (ECONNRESET, ENETRESET on Windows, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET) +// - `connection-refused`: The connection was refused. (ECONNREFUSED) +// +// # References +// - +// - +// - +// - +// - +// - +// - +// - +extern bool wasi_sockets_udp_method_incoming_datagram_stream_receive(wasi_sockets_udp_borrow_incoming_datagram_stream_t self, uint64_t max_results, wasi_sockets_udp_list_incoming_datagram_t *ret, wasi_sockets_udp_error_code_t *err); +// Create a `pollable` which will resolve once the stream is ready to receive again. +// +// Note: this function is here for WASI Preview2 only. +// It's planned to be removed when `future` is natively supported in Preview3. +extern wasi_sockets_udp_own_pollable_t wasi_sockets_udp_method_incoming_datagram_stream_subscribe(wasi_sockets_udp_borrow_incoming_datagram_stream_t self); +// Check readiness for sending. This function never blocks. +// +// Returns the number of datagrams permitted for the next call to `send`, +// or an error. Calling `send` with more datagrams than this function has +// permitted will trap. +// +// When this function returns ok(0), the `subscribe` pollable will +// become ready when this function will report at least ok(1), or an +// error. +// +// Never returns `would-block`. +extern bool wasi_sockets_udp_method_outgoing_datagram_stream_check_send(wasi_sockets_udp_borrow_outgoing_datagram_stream_t self, uint64_t *ret, wasi_sockets_udp_error_code_t *err); +// Send messages on the socket. +// +// This function attempts to send all provided `datagrams` on the socket without blocking and +// returns how many messages were actually sent (or queued for sending). This function never +// returns `error(would-block)`. If none of the datagrams were able to be sent, `ok(0)` is returned. +// +// This function semantically behaves the same as iterating the `datagrams` list and sequentially +// sending each individual datagram until either the end of the list has been reached or the first error occurred. +// If at least one datagram has been sent successfully, this function never returns an error. +// +// If the input list is empty, the function returns `ok(0)`. +// +// Each call to `send` must be permitted by a preceding `check-send`. Implementations must trap if +// either `check-send` was not called or `datagrams` contains more items than `check-send` permitted. +// +// # Typical errors +// - `invalid-argument`: The `remote-address` has the wrong address family. (EAFNOSUPPORT) +// - `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) +// - `invalid-argument`: The socket is not "connected" and no value for `remote-address` was provided. (EDESTADDRREQ) +// - `remote-unreachable`: The remote address is not reachable. (ECONNRESET, ENETRESET on Windows, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET) +// - `connection-refused`: The connection was refused. (ECONNREFUSED) +// - `datagram-too-large`: The datagram is too large. (EMSGSIZE) +// +// # References +// - +// - +// - +// - +// - +// - +// - +// - +extern bool wasi_sockets_udp_method_outgoing_datagram_stream_send(wasi_sockets_udp_borrow_outgoing_datagram_stream_t self, wasi_sockets_udp_list_outgoing_datagram_t *datagrams, uint64_t *ret, wasi_sockets_udp_error_code_t *err); +// Create a `pollable` which will resolve once the stream is ready to send again. +// +// Note: this function is here for WASI Preview2 only. +// It's planned to be removed when `future` is natively supported in Preview3. +extern wasi_sockets_udp_own_pollable_t wasi_sockets_udp_method_outgoing_datagram_stream_subscribe(wasi_sockets_udp_borrow_outgoing_datagram_stream_t self); + +// Imported Functions from `wasi:sockets/udp-create-socket@0.2.0` +// Create a new UDP socket. +// +// 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. +// +// All sockets are non-blocking. Use the wasi-poll interface to block on asynchronous operations. +// +// # Typical errors +// - `not-supported`: The specified `address-family` is not supported. (EAFNOSUPPORT) +// - `new-socket-limit`: The new socket resource could not be created because of a system limit. (EMFILE, ENFILE) +// +// # References: +// - +// - +// - +// - +extern bool wasi_sockets_udp_create_socket_create_udp_socket(wasi_sockets_udp_create_socket_ip_address_family_t address_family, wasi_sockets_udp_create_socket_own_udp_socket_t *ret, wasi_sockets_udp_create_socket_error_code_t *err); + +// Imported Functions from `wasi:sockets/tcp@0.2.0` +// Bind the socket to a specific network on the provided IP address and port. +// +// 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. +// +// Bind can be attempted multiple times on the same socket, even with +// different arguments on each iteration. But never concurrently and +// only as long as the previous bind failed. Once a bind succeeds, the +// binding can't be changed anymore. +// +// # Typical errors +// - `invalid-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. (EINVAL) +// - `invalid-state`: The socket is already bound. (EINVAL) +// - `address-in-use`: No ephemeral ports available. (EADDRINUSE, ENOBUFS on Windows) +// - `address-in-use`: Address is already in use. (EADDRINUSE) +// - `address-not-bindable`: `local-address` is not an address that the `network` can bind to. (EADDRNOTAVAIL) +// - `not-in-progress`: A `bind` operation is not in progress. +// - `would-block`: Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN) +// +// # Implementors note +// When binding to a non-zero port, this bind operation shouldn't be affected by the TIME_WAIT +// state of a recently closed socket on the same local address. In practice this means that the SO_REUSEADDR +// socket option should be set implicitly on all platforms, except on Windows where this is the default behavior +// and SO_REUSEADDR performs something different entirely. +// +// Unlike in POSIX, in WASI the bind operation is async. This enables +// interactive WASI hosts to inject permission prompts. Runtimes that +// don't want to make use of this ability can simply call the native +// `bind` as part of either `start-bind` or `finish-bind`. +// +// # References +// - +// - +// - +// - +extern bool wasi_sockets_tcp_method_tcp_socket_start_bind(wasi_sockets_tcp_borrow_tcp_socket_t self, wasi_sockets_tcp_borrow_network_t network, wasi_sockets_tcp_ip_socket_address_t *local_address, wasi_sockets_tcp_error_code_t *err); +extern bool wasi_sockets_tcp_method_tcp_socket_finish_bind(wasi_sockets_tcp_borrow_tcp_socket_t self, wasi_sockets_tcp_error_code_t *err); +// Connect to a remote endpoint. +// +// On success: +// - the socket is transitioned into the `connection` state. +// - a pair of streams is returned that can be used to read & write to the connection +// +// After a failed connection attempt, the socket will be in the `closed` +// state and the only valid action left is to `drop` the socket. A single +// socket can not be used to connect more than once. +// +// # Typical errors +// - `invalid-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. (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`. +// - `invalid-state`: The socket is already in the `connected` state. (EISCONN) +// - `invalid-state`: The socket is already in the `listening` state. (EOPNOTSUPP, EINVAL on Windows) +// - `timeout`: Connection timed out. (ETIMEDOUT) +// - `connection-refused`: The connection was forcefully rejected. (ECONNREFUSED) +// - `connection-reset`: The connection was reset. (ECONNRESET) +// - `connection-aborted`: The connection was aborted. (ECONNABORTED) +// - `remote-unreachable`: The remote address is not reachable. (EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET) +// - `address-in-use`: Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE, EADDRNOTAVAIL on Linux, EAGAIN on BSD) +// - `not-in-progress`: A connect operation is not in progress. +// - `would-block`: Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN) +// +// # Implementors note +// The POSIX equivalent of `start-connect` is the regular `connect` syscall. +// Because all WASI sockets are non-blocking this is expected to return +// EINPROGRESS, which should be translated to `ok()` in WASI. +// +// The POSIX equivalent of `finish-connect` is a `poll` for event `POLLOUT` +// with a timeout of 0 on the socket descriptor. Followed by a check for +// the `SO_ERROR` socket option, in case the poll signaled readiness. +// +// # References +// - +// - +// - +// - +extern bool wasi_sockets_tcp_method_tcp_socket_start_connect(wasi_sockets_tcp_borrow_tcp_socket_t self, wasi_sockets_tcp_borrow_network_t network, wasi_sockets_tcp_ip_socket_address_t *remote_address, wasi_sockets_tcp_error_code_t *err); +extern bool wasi_sockets_tcp_method_tcp_socket_finish_connect(wasi_sockets_tcp_borrow_tcp_socket_t self, wasi_sockets_tcp_tuple2_own_input_stream_own_output_stream_t *ret, wasi_sockets_tcp_error_code_t *err); +// Start listening for new connections. +// +// Transitions the socket into the `listening` state. +// +// Unlike POSIX, the socket must already be explicitly bound. +// +// # Typical errors +// - `invalid-state`: The socket is not bound to any local address. (EDESTADDRREQ) +// - `invalid-state`: The socket is already in the `connected` state. (EISCONN, EINVAL on BSD) +// - `invalid-state`: The socket is already in the `listening` state. +// - `address-in-use`: Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE) +// - `not-in-progress`: A listen operation is not in progress. +// - `would-block`: Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN) +// +// # Implementors note +// Unlike in POSIX, in WASI the listen operation is async. This enables +// interactive WASI hosts to inject permission prompts. Runtimes that +// don't want to make use of this ability can simply call the native +// `listen` as part of either `start-listen` or `finish-listen`. +// +// # References +// - +// - +// - +// - +extern bool wasi_sockets_tcp_method_tcp_socket_start_listen(wasi_sockets_tcp_borrow_tcp_socket_t self, wasi_sockets_tcp_error_code_t *err); +extern bool wasi_sockets_tcp_method_tcp_socket_finish_listen(wasi_sockets_tcp_borrow_tcp_socket_t self, wasi_sockets_tcp_error_code_t *err); +// Accept a new client socket. +// +// The returned socket is bound and in the `connected` state. The following properties are inherited from the listener socket: +// - `address-family` +// - `keep-alive-enabled` +// - `keep-alive-idle-time` +// - `keep-alive-interval` +// - `keep-alive-count` +// - `hop-limit` +// - `receive-buffer-size` +// - `send-buffer-size` +// +// On success, this function returns the newly accepted client socket along with +// a pair of streams that can be used to read & write to the connection. +// +// # Typical errors +// - `invalid-state`: Socket is not in the `listening` state. (EINVAL) +// - `would-block`: No pending connections at the moment. (EWOULDBLOCK, EAGAIN) +// - `connection-aborted`: An incoming connection was pending, but was terminated by the client before this listener could accept it. (ECONNABORTED) +// - `new-socket-limit`: The new socket resource could not be created because of a system limit. (EMFILE, ENFILE) +// +// # References +// - +// - +// - +// - +extern bool wasi_sockets_tcp_method_tcp_socket_accept(wasi_sockets_tcp_borrow_tcp_socket_t self, wasi_sockets_tcp_tuple3_own_tcp_socket_own_input_stream_own_output_stream_t *ret, wasi_sockets_tcp_error_code_t *err); +// Get the bound local address. +// +// POSIX mentions: +// > If the socket has not been bound to a local name, the value +// > stored in the object pointed to by `address` is unspecified. +// +// WASI is stricter and requires `local-address` to return `invalid-state` when the socket hasn't been bound yet. +// +// # Typical errors +// - `invalid-state`: The socket is not bound to any local address. +// +// # References +// - +// - +// - +// - +extern bool wasi_sockets_tcp_method_tcp_socket_local_address(wasi_sockets_tcp_borrow_tcp_socket_t self, wasi_sockets_tcp_ip_socket_address_t *ret, wasi_sockets_tcp_error_code_t *err); +// Get the remote address. +// +// # Typical errors +// - `invalid-state`: The socket is not connected to a remote address. (ENOTCONN) +// +// # References +// - +// - +// - +// - +extern bool wasi_sockets_tcp_method_tcp_socket_remote_address(wasi_sockets_tcp_borrow_tcp_socket_t self, wasi_sockets_tcp_ip_socket_address_t *ret, wasi_sockets_tcp_error_code_t *err); +// Whether the socket is in the `listening` state. +// +// Equivalent to the SO_ACCEPTCONN socket option. +extern bool wasi_sockets_tcp_method_tcp_socket_is_listening(wasi_sockets_tcp_borrow_tcp_socket_t self); +// Whether this is a IPv4 or IPv6 socket. +// +// Equivalent to the SO_DOMAIN socket option. +extern wasi_sockets_tcp_ip_address_family_t wasi_sockets_tcp_method_tcp_socket_address_family(wasi_sockets_tcp_borrow_tcp_socket_t self); +// Hints the desired listen queue size. Implementations are free to ignore this. +// +// If the provided value is 0, an `invalid-argument` error is returned. +// Any other value will never cause an error, but it might be silently clamped and/or rounded. +// +// # Typical errors +// - `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. +extern bool wasi_sockets_tcp_method_tcp_socket_set_listen_backlog_size(wasi_sockets_tcp_borrow_tcp_socket_t self, uint64_t value, wasi_sockets_tcp_error_code_t *err); +// Enables or disables keepalive. +// +// The keepalive behavior can be adjusted using: +// - `keep-alive-idle-time` +// - `keep-alive-interval` +// - `keep-alive-count` +// 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. +extern bool wasi_sockets_tcp_method_tcp_socket_keep_alive_enabled(wasi_sockets_tcp_borrow_tcp_socket_t self, bool *ret, wasi_sockets_tcp_error_code_t *err); +extern bool wasi_sockets_tcp_method_tcp_socket_set_keep_alive_enabled(wasi_sockets_tcp_borrow_tcp_socket_t self, bool value, wasi_sockets_tcp_error_code_t *err); +// Amount of time the connection has to be idle before TCP starts sending keepalive packets. +// +// If the provided value is 0, an `invalid-argument` error is returned. +// Any other value will never cause an error, but it might be silently clamped and/or rounded. +// I.e. after setting a value, reading the same setting back may return a different value. +// +// Equivalent to the TCP_KEEPIDLE socket option. (TCP_KEEPALIVE on MacOS) +// +// # Typical errors +// - `invalid-argument`: (set) The provided value was 0. +extern bool wasi_sockets_tcp_method_tcp_socket_keep_alive_idle_time(wasi_sockets_tcp_borrow_tcp_socket_t self, wasi_sockets_tcp_duration_t *ret, wasi_sockets_tcp_error_code_t *err); +extern bool wasi_sockets_tcp_method_tcp_socket_set_keep_alive_idle_time(wasi_sockets_tcp_borrow_tcp_socket_t self, wasi_sockets_tcp_duration_t value, wasi_sockets_tcp_error_code_t *err); +// The time between keepalive packets. +// +// If the provided value is 0, an `invalid-argument` error is returned. +// Any other value will never cause an error, but it might be silently clamped and/or rounded. +// I.e. after setting a value, reading the same setting back may return a different value. +// +// Equivalent to the TCP_KEEPINTVL socket option. +// +// # Typical errors +// - `invalid-argument`: (set) The provided value was 0. +extern bool wasi_sockets_tcp_method_tcp_socket_keep_alive_interval(wasi_sockets_tcp_borrow_tcp_socket_t self, wasi_sockets_tcp_duration_t *ret, wasi_sockets_tcp_error_code_t *err); +extern bool wasi_sockets_tcp_method_tcp_socket_set_keep_alive_interval(wasi_sockets_tcp_borrow_tcp_socket_t self, wasi_sockets_tcp_duration_t value, wasi_sockets_tcp_error_code_t *err); +// The maximum amount of keepalive packets TCP should send before aborting the connection. +// +// If the provided value is 0, an `invalid-argument` error is returned. +// Any other value will never cause an error, but it might be silently clamped and/or rounded. +// I.e. after setting a value, reading the same setting back may return a different value. +// +// Equivalent to the TCP_KEEPCNT socket option. +// +// # Typical errors +// - `invalid-argument`: (set) The provided value was 0. +extern bool wasi_sockets_tcp_method_tcp_socket_keep_alive_count(wasi_sockets_tcp_borrow_tcp_socket_t self, uint32_t *ret, wasi_sockets_tcp_error_code_t *err); +extern bool wasi_sockets_tcp_method_tcp_socket_set_keep_alive_count(wasi_sockets_tcp_borrow_tcp_socket_t self, uint32_t value, wasi_sockets_tcp_error_code_t *err); +// Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options. +// +// If the provided value is 0, an `invalid-argument` error is returned. +// +// # Typical errors +// - `invalid-argument`: (set) The TTL value must be 1 or higher. +extern bool wasi_sockets_tcp_method_tcp_socket_hop_limit(wasi_sockets_tcp_borrow_tcp_socket_t self, uint8_t *ret, wasi_sockets_tcp_error_code_t *err); +extern bool wasi_sockets_tcp_method_tcp_socket_set_hop_limit(wasi_sockets_tcp_borrow_tcp_socket_t self, uint8_t value, wasi_sockets_tcp_error_code_t *err); +// The kernel buffer space reserved for sends/receives on this socket. +// +// If the provided value is 0, an `invalid-argument` error is returned. +// Any other value will never cause an error, but it might be silently clamped and/or rounded. +// I.e. after setting a value, reading the same setting back may return a different value. +// +// Equivalent to the SO_RCVBUF and SO_SNDBUF socket options. +// +// # Typical errors +// - `invalid-argument`: (set) The provided value was 0. +extern bool wasi_sockets_tcp_method_tcp_socket_receive_buffer_size(wasi_sockets_tcp_borrow_tcp_socket_t self, uint64_t *ret, wasi_sockets_tcp_error_code_t *err); +extern bool wasi_sockets_tcp_method_tcp_socket_set_receive_buffer_size(wasi_sockets_tcp_borrow_tcp_socket_t self, uint64_t value, wasi_sockets_tcp_error_code_t *err); +extern bool wasi_sockets_tcp_method_tcp_socket_send_buffer_size(wasi_sockets_tcp_borrow_tcp_socket_t self, uint64_t *ret, wasi_sockets_tcp_error_code_t *err); +extern bool wasi_sockets_tcp_method_tcp_socket_set_send_buffer_size(wasi_sockets_tcp_borrow_tcp_socket_t self, uint64_t value, wasi_sockets_tcp_error_code_t *err); +// Create a `pollable` which can be used to poll for, or block on, +// completion of any of the asynchronous operations of this socket. +// +// When `finish-bind`, `finish-listen`, `finish-connect` or `accept` +// return `error(would-block)`, this pollable can be used to wait for +// their success or failure, after which the method can be retried. +// +// The pollable is not limited to the async operation that happens to be +// in progress at the time of calling `subscribe` (if any). Theoretically, +// `subscribe` only has to be called once per socket and can then be +// (re)used for the remainder of the socket's lifetime. +// +// See +// for a more information. +// +// Note: this function is here for WASI Preview2 only. +// It's planned to be removed when `future` is natively supported in Preview3. +extern wasi_sockets_tcp_own_pollable_t wasi_sockets_tcp_method_tcp_socket_subscribe(wasi_sockets_tcp_borrow_tcp_socket_t self); +// Initiate a graceful shutdown. +// +// - `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. +// +// # Typical errors +// - `invalid-state`: The socket is not in the `connected` state. (ENOTCONN) +// +// # References +// - +// - +// - +// - +extern bool wasi_sockets_tcp_method_tcp_socket_shutdown(wasi_sockets_tcp_borrow_tcp_socket_t self, wasi_sockets_tcp_shutdown_type_t shutdown_type, wasi_sockets_tcp_error_code_t *err); + +// Imported Functions from `wasi:sockets/tcp-create-socket@0.2.0` +// Create a new TCP socket. +// +// 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`/`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. +// +// # Typical errors +// - `not-supported`: The specified `address-family` is not supported. (EAFNOSUPPORT) +// - `new-socket-limit`: The new socket resource could not be created because of a system limit. (EMFILE, ENFILE) +// +// # References +// - +// - +// - +// - +extern bool wasi_sockets_tcp_create_socket_create_tcp_socket(wasi_sockets_tcp_create_socket_ip_address_family_t address_family, wasi_sockets_tcp_create_socket_own_tcp_socket_t *ret, wasi_sockets_tcp_create_socket_error_code_t *err); + +// Imported Functions from `wasi:sockets/ip-name-lookup@0.2.0` +// Resolve an internet host name to a list of IP addresses. +// +// Unicode domain names are automatically converted to ASCII using IDNA encoding. +// If the input is an IP address string, the address is parsed and returned +// as-is without making any external requests. +// +// See the wasi-socket proposal README.md for a comparison with getaddrinfo. +// +// This function never blocks. It either immediately fails or immediately +// returns successfully with a `resolve-address-stream` that can be used +// to (asynchronously) fetch the results. +// +// # Typical errors +// - `invalid-argument`: `name` is a syntactically invalid domain name or IP address. +// +// # References: +// - +// - +// - +// - +extern bool wasi_sockets_ip_name_lookup_resolve_addresses(wasi_sockets_ip_name_lookup_borrow_network_t network, bindings_string_t *name, wasi_sockets_ip_name_lookup_own_resolve_address_stream_t *ret, wasi_sockets_ip_name_lookup_error_code_t *err); +// Returns the next address from the resolver. +// +// This function should be called multiple times. On each call, it will +// return the next address in connection order preference. If all +// addresses have been exhausted, this function returns `none`. +// +// This function never returns IPv4-mapped IPv6 addresses. +// +// # Typical errors +// - `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) +// - `would-block`: A result is not available yet. (EWOULDBLOCK, EAGAIN) +extern bool wasi_sockets_ip_name_lookup_method_resolve_address_stream_resolve_next_address(wasi_sockets_ip_name_lookup_borrow_resolve_address_stream_t self, wasi_sockets_ip_name_lookup_option_ip_address_t *ret, wasi_sockets_ip_name_lookup_error_code_t *err); +// Create a `pollable` which will resolve once the stream is ready for I/O. +// +// Note: this function is here for WASI Preview2 only. +// It's planned to be removed when `future` is natively supported in Preview3. +extern wasi_sockets_ip_name_lookup_own_pollable_t wasi_sockets_ip_name_lookup_method_resolve_address_stream_subscribe(wasi_sockets_ip_name_lookup_borrow_resolve_address_stream_t self); + +// Imported Functions from `wasi:random/random@0.2.0` +// Return `len` cryptographically-secure random or pseudo-random bytes. +// +// This function must produce data at least as cryptographically secure and +// fast as an adequately seeded cryptographically-secure pseudo-random +// number generator (CSPRNG). It must not block, from the perspective of +// the calling program, under any circumstances, including on the first +// request and on requests for numbers of bytes. The returned data must +// always be unpredictable. +// +// This function must always return fresh data. Deterministic environments +// must omit this function, rather than implementing it with deterministic +// data. +extern void wasi_random_random_get_random_bytes(uint64_t len, bindings_list_u8_t *ret); +// Return a cryptographically-secure random or pseudo-random `u64` value. +// +// This function returns the same type of data as `get-random-bytes`, +// represented as a `u64`. +extern uint64_t wasi_random_random_get_random_u64(void); + +// Imported Functions from `wasi:random/insecure@0.2.0` +// Return `len` insecure pseudo-random bytes. +// +// This function is not cryptographically secure. Do not use it for +// anything related to security. +// +// There are no requirements on the values of the returned bytes, however +// implementations are encouraged to return evenly distributed values with +// a long period. +extern void wasi_random_insecure_get_insecure_random_bytes(uint64_t len, bindings_list_u8_t *ret); +// Return an insecure pseudo-random `u64` value. +// +// This function returns the same type of pseudo-random data as +// `get-insecure-random-bytes`, represented as a `u64`. +extern uint64_t wasi_random_insecure_get_insecure_random_u64(void); + +// Imported Functions from `wasi:random/insecure-seed@0.2.0` +// Return a 128-bit value that may contain a pseudo-random value. +// +// The returned value is not required to be computed from a CSPRNG, and may +// even be entirely deterministic. Host implementations are encouraged to +// provide pseudo-random values to any program exposed to +// attacker-controlled content, to enable DoS protection built into many +// languages' hash-map implementations. +// +// This function is intended to only be called once, by a source language +// to initialize Denial Of Service (DoS) protection in its hash-map +// implementation. +// +// # Expected future evolution +// +// This will likely be changed to a value import, to prevent it from being +// called multiple times and potentially used for purposes other than DoS +// protection. +extern void wasi_random_insecure_seed_insecure_seed(bindings_tuple2_u64_u64_t *ret); + +// Imported Functions from `wasi:http/types@0.2.0` +// Attempts to extract a http-related `error` from the wasi:io `error` +// provided. +// +// Stream operations which return +// `wasi:io/stream/stream-error::last-operation-failed` have a payload of +// type `wasi:io/error/error` with more information about the operation +// that failed. This payload can be passed through to this function to see +// if there's http-related information about the error to return. +// +// Note that this function is fallible because not all io-errors are +// http-related errors. +extern bool wasi_http_types_http_error_code(wasi_http_types_borrow_io_error_t err_, wasi_http_types_error_code_t *ret); +// Construct an empty HTTP Fields. +// +// The resulting `fields` is mutable. +extern wasi_http_types_own_fields_t wasi_http_types_constructor_fields(void); +// Construct an HTTP Fields. +// +// The resulting `fields` is mutable. +// +// The list represents each key-value pair in the Fields. Keys +// which have multiple values are represented by multiple entries in this +// list with the same key. +// +// The tuple is a pair of the field key, represented as a string, and +// Value, represented as a list of bytes. In a valid Fields, all keys +// and values are valid UTF-8 strings. However, values are not always +// well-formed, so they are represented as a raw list of bytes. +// +// An error result will be returned if any header or value was +// syntactically invalid, or if a header was forbidden. +extern bool wasi_http_types_static_fields_from_list(bindings_list_tuple2_field_key_field_value_t *entries, wasi_http_types_own_fields_t *ret, wasi_http_types_header_error_t *err); +// Get all of the values corresponding to a key. If the key is not present +// in this `fields`, an empty list is returned. However, if the key is +// present but empty, this is represented by a list with one or more +// empty field-values present. +extern void wasi_http_types_method_fields_get(wasi_http_types_borrow_fields_t self, wasi_http_types_field_key_t *name, bindings_list_field_value_t *ret); +// Returns `true` when the key is present in this `fields`. If the key is +// syntactically invalid, `false` is returned. +extern bool wasi_http_types_method_fields_has(wasi_http_types_borrow_fields_t self, wasi_http_types_field_key_t *name); +// Set all of the values for a key. Clears any existing values for that +// key, if they have been set. +// +// Fails with `header-error.immutable` if the `fields` are immutable. +extern bool wasi_http_types_method_fields_set(wasi_http_types_borrow_fields_t self, wasi_http_types_field_key_t *name, bindings_list_field_value_t *value, wasi_http_types_header_error_t *err); +// Delete all values for a key. Does nothing if no values for the key +// exist. +// +// Fails with `header-error.immutable` if the `fields` are immutable. +extern bool wasi_http_types_method_fields_delete(wasi_http_types_borrow_fields_t self, wasi_http_types_field_key_t *name, wasi_http_types_header_error_t *err); +// Append a value for a key. Does not change or delete any existing +// values for that key. +// +// Fails with `header-error.immutable` if the `fields` are immutable. +extern bool wasi_http_types_method_fields_append(wasi_http_types_borrow_fields_t self, wasi_http_types_field_key_t *name, wasi_http_types_field_value_t *value, wasi_http_types_header_error_t *err); +// Retrieve the full set of keys and values in the Fields. Like the +// constructor, the list represents each key-value pair. +// +// The outer list represents each key-value pair in the Fields. Keys +// which have multiple values are represented by multiple entries in this +// list with the same key. +extern void wasi_http_types_method_fields_entries(wasi_http_types_borrow_fields_t self, bindings_list_tuple2_field_key_field_value_t *ret); +// Make a deep copy of the Fields. Equivelant in behavior to calling the +// `fields` constructor on the return value of `entries`. The resulting +// `fields` is mutable. +extern wasi_http_types_own_fields_t wasi_http_types_method_fields_clone(wasi_http_types_borrow_fields_t self); +// Returns the method of the incoming request. +extern void wasi_http_types_method_incoming_request_method(wasi_http_types_borrow_incoming_request_t self, wasi_http_types_method_t *ret); +// Returns the path with query parameters from the request, as a string. +extern bool wasi_http_types_method_incoming_request_path_with_query(wasi_http_types_borrow_incoming_request_t self, bindings_string_t *ret); +// Returns the protocol scheme from the request. +extern bool wasi_http_types_method_incoming_request_scheme(wasi_http_types_borrow_incoming_request_t self, wasi_http_types_scheme_t *ret); +// Returns the authority from the request, if it was present. +extern bool wasi_http_types_method_incoming_request_authority(wasi_http_types_borrow_incoming_request_t self, bindings_string_t *ret); +// Get the `headers` associated with the request. +// +// The returned `headers` resource is immutable: `set`, `append`, and +// `delete` operations will fail with `header-error.immutable`. +// +// The `headers` returned are a child resource: it must be dropped before +// the parent `incoming-request` is dropped. Dropping this +// `incoming-request` before all children are dropped will trap. +extern wasi_http_types_own_headers_t wasi_http_types_method_incoming_request_headers(wasi_http_types_borrow_incoming_request_t self); +// Gives the `incoming-body` associated with this request. Will only +// return success at most once, and subsequent calls will return error. +extern bool wasi_http_types_method_incoming_request_consume(wasi_http_types_borrow_incoming_request_t self, wasi_http_types_own_incoming_body_t *ret); +// Construct a new `outgoing-request` with a default `method` of `GET`, and +// `none` values for `path-with-query`, `scheme`, and `authority`. +// +// * `headers` is the HTTP Headers for the Request. +// +// It is possible to construct, or manipulate with the accessor functions +// below, an `outgoing-request` with an invalid combination of `scheme` +// and `authority`, or `headers` which are not permitted to be sent. +// It is the obligation of the `outgoing-handler.handle` implementation +// to reject invalid constructions of `outgoing-request`. +extern wasi_http_types_own_outgoing_request_t wasi_http_types_constructor_outgoing_request(wasi_http_types_own_headers_t headers); +// Returns the resource corresponding to the outgoing Body for this +// Request. +// +// Returns success on the first call: the `outgoing-body` resource for +// this `outgoing-request` can be retrieved at most once. Subsequent +// calls will return error. +extern bool wasi_http_types_method_outgoing_request_body(wasi_http_types_borrow_outgoing_request_t self, wasi_http_types_own_outgoing_body_t *ret); +// Get the Method for the Request. +extern void wasi_http_types_method_outgoing_request_method(wasi_http_types_borrow_outgoing_request_t self, wasi_http_types_method_t *ret); +// Set the Method for the Request. Fails if the string present in a +// `method.other` argument is not a syntactically valid method. +extern bool wasi_http_types_method_outgoing_request_set_method(wasi_http_types_borrow_outgoing_request_t self, wasi_http_types_method_t *method); +// Get the combination of the HTTP Path and Query for the Request. +// When `none`, this represents an empty Path and empty Query. +extern bool wasi_http_types_method_outgoing_request_path_with_query(wasi_http_types_borrow_outgoing_request_t self, bindings_string_t *ret); +// Set the combination of the HTTP Path and Query for the Request. +// When `none`, this represents an empty Path and empty Query. Fails is the +// string given is not a syntactically valid path and query uri component. +extern bool wasi_http_types_method_outgoing_request_set_path_with_query(wasi_http_types_borrow_outgoing_request_t self, bindings_string_t *maybe_path_with_query); +// Get the HTTP Related Scheme for the Request. When `none`, the +// implementation may choose an appropriate default scheme. +extern bool wasi_http_types_method_outgoing_request_scheme(wasi_http_types_borrow_outgoing_request_t self, wasi_http_types_scheme_t *ret); +// Set the HTTP Related Scheme for the Request. When `none`, the +// implementation may choose an appropriate default scheme. Fails if the +// string given is not a syntactically valid uri scheme. +extern bool wasi_http_types_method_outgoing_request_set_scheme(wasi_http_types_borrow_outgoing_request_t self, wasi_http_types_scheme_t *maybe_scheme); +// Get the HTTP Authority for the Request. A value of `none` may be used +// with Related Schemes which do not require an Authority. The HTTP and +// HTTPS schemes always require an authority. +extern bool wasi_http_types_method_outgoing_request_authority(wasi_http_types_borrow_outgoing_request_t self, bindings_string_t *ret); +// Set the HTTP Authority for the Request. A value of `none` may be used +// with Related Schemes which do not require an Authority. The HTTP and +// HTTPS schemes always require an authority. Fails if the string given is +// not a syntactically valid uri authority. +extern bool wasi_http_types_method_outgoing_request_set_authority(wasi_http_types_borrow_outgoing_request_t self, bindings_string_t *maybe_authority); +// Get the headers associated with the Request. +// +// The returned `headers` resource is immutable: `set`, `append`, and +// `delete` operations will fail with `header-error.immutable`. +// +// This headers resource is a child: it must be dropped before the parent +// `outgoing-request` is dropped, or its ownership is transfered to +// another component by e.g. `outgoing-handler.handle`. +extern wasi_http_types_own_headers_t wasi_http_types_method_outgoing_request_headers(wasi_http_types_borrow_outgoing_request_t self); +// Construct a default `request-options` value. +extern wasi_http_types_own_request_options_t wasi_http_types_constructor_request_options(void); +// The timeout for the initial connect to the HTTP Server. +extern bool wasi_http_types_method_request_options_connect_timeout(wasi_http_types_borrow_request_options_t self, wasi_http_types_duration_t *ret); +// Set the timeout for the initial connect to the HTTP Server. An error +// return value indicates that this timeout is not supported. +extern bool wasi_http_types_method_request_options_set_connect_timeout(wasi_http_types_borrow_request_options_t self, wasi_http_types_duration_t *maybe_duration); +// The timeout for receiving the first byte of the Response body. +extern bool wasi_http_types_method_request_options_first_byte_timeout(wasi_http_types_borrow_request_options_t self, wasi_http_types_duration_t *ret); +// Set the timeout for receiving the first byte of the Response body. An +// error return value indicates that this timeout is not supported. +extern bool wasi_http_types_method_request_options_set_first_byte_timeout(wasi_http_types_borrow_request_options_t self, wasi_http_types_duration_t *maybe_duration); +// The timeout for receiving subsequent chunks of bytes in the Response +// body stream. +extern bool wasi_http_types_method_request_options_between_bytes_timeout(wasi_http_types_borrow_request_options_t self, wasi_http_types_duration_t *ret); +// Set the timeout for receiving subsequent chunks of bytes in the Response +// body stream. An error return value indicates that this timeout is not +// supported. +extern bool wasi_http_types_method_request_options_set_between_bytes_timeout(wasi_http_types_borrow_request_options_t self, wasi_http_types_duration_t *maybe_duration); +// Set the value of the `response-outparam` to either send a response, +// or indicate an error. +// +// This method consumes the `response-outparam` to ensure that it is +// called at most once. If it is never called, the implementation +// will respond with an error. +// +// The user may provide an `error` to `response` to allow the +// implementation determine how to respond with an HTTP error response. +extern void wasi_http_types_static_response_outparam_set(wasi_http_types_own_response_outparam_t param, wasi_http_types_result_own_outgoing_response_error_code_t *response); +// Returns the status code from the incoming response. +extern wasi_http_types_status_code_t wasi_http_types_method_incoming_response_status(wasi_http_types_borrow_incoming_response_t self); +// Returns the headers from the incoming response. +// +// The returned `headers` resource is immutable: `set`, `append`, and +// `delete` operations will fail with `header-error.immutable`. +// +// This headers resource is a child: it must be dropped before the parent +// `incoming-response` is dropped. +extern wasi_http_types_own_headers_t wasi_http_types_method_incoming_response_headers(wasi_http_types_borrow_incoming_response_t self); +// Returns the incoming body. May be called at most once. Returns error +// if called additional times. +extern bool wasi_http_types_method_incoming_response_consume(wasi_http_types_borrow_incoming_response_t self, wasi_http_types_own_incoming_body_t *ret); +// Returns the contents of the body, as a stream of bytes. +// +// Returns success on first call: the stream representing the contents +// can be retrieved at most once. Subsequent calls will return error. +// +// The returned `input-stream` resource is a child: it must be dropped +// before the parent `incoming-body` is dropped, or consumed by +// `incoming-body.finish`. +// +// This invariant ensures that the implementation can determine whether +// the user is consuming the contents of the body, waiting on the +// `future-trailers` to be ready, or neither. This allows for network +// backpressure is to be applied when the user is consuming the body, +// and for that backpressure to not inhibit delivery of the trailers if +// the user does not read the entire body. +extern bool wasi_http_types_method_incoming_body_stream(wasi_http_types_borrow_incoming_body_t self, wasi_http_types_own_input_stream_t *ret); +// Takes ownership of `incoming-body`, and returns a `future-trailers`. +// This function will trap if the `input-stream` child is still alive. +extern wasi_http_types_own_future_trailers_t wasi_http_types_static_incoming_body_finish(wasi_http_types_own_incoming_body_t this_); +// Returns a pollable which becomes ready when either the trailers have +// been received, or an error has occured. When this pollable is ready, +// the `get` method will return `some`. +extern wasi_http_types_own_pollable_t wasi_http_types_method_future_trailers_subscribe(wasi_http_types_borrow_future_trailers_t self); +// Returns the contents of the trailers, or an error which occured, +// once the future is ready. +// +// The outer `option` represents future readiness. Users can wait on this +// `option` to become `some` using the `subscribe` method. +// +// The outer `result` is used to retrieve the trailers or error at most +// once. It will be success on the first call in which the outer option +// is `some`, and error on subsequent calls. +// +// The inner `result` represents that either the HTTP Request or Response +// body, as well as any trailers, were received successfully, or that an +// error occured receiving them. The optional `trailers` indicates whether +// or not trailers were present in the body. +// +// When some `trailers` are returned by this method, the `trailers` +// resource is immutable, and a child. Use of the `set`, `append`, or +// `delete` methods will return an error, and the resource must be +// dropped before the parent `future-trailers` is dropped. +extern bool wasi_http_types_method_future_trailers_get(wasi_http_types_borrow_future_trailers_t self, wasi_http_types_result_result_option_own_trailers_error_code_void_t *ret); +// Construct an `outgoing-response`, with a default `status-code` of `200`. +// If a different `status-code` is needed, it must be set via the +// `set-status-code` method. +// +// * `headers` is the HTTP Headers for the Response. +extern wasi_http_types_own_outgoing_response_t wasi_http_types_constructor_outgoing_response(wasi_http_types_own_headers_t headers); +// Get the HTTP Status Code for the Response. +extern wasi_http_types_status_code_t wasi_http_types_method_outgoing_response_status_code(wasi_http_types_borrow_outgoing_response_t self); +// Set the HTTP Status Code for the Response. Fails if the status-code +// given is not a valid http status code. +extern bool wasi_http_types_method_outgoing_response_set_status_code(wasi_http_types_borrow_outgoing_response_t self, wasi_http_types_status_code_t status_code); +// Get the headers associated with the Request. +// +// The returned `headers` resource is immutable: `set`, `append`, and +// `delete` operations will fail with `header-error.immutable`. +// +// This headers resource is a child: it must be dropped before the parent +// `outgoing-request` is dropped, or its ownership is transfered to +// another component by e.g. `outgoing-handler.handle`. +extern wasi_http_types_own_headers_t wasi_http_types_method_outgoing_response_headers(wasi_http_types_borrow_outgoing_response_t self); +// Returns the resource corresponding to the outgoing Body for this Response. +// +// Returns success on the first call: the `outgoing-body` resource for +// this `outgoing-response` can be retrieved at most once. Subsequent +// calls will return error. +extern bool wasi_http_types_method_outgoing_response_body(wasi_http_types_borrow_outgoing_response_t self, wasi_http_types_own_outgoing_body_t *ret); +// Returns a stream for writing the body contents. +// +// The returned `output-stream` is a child resource: it must be dropped +// before the parent `outgoing-body` resource is dropped (or finished), +// otherwise the `outgoing-body` drop or `finish` will trap. +// +// Returns success on the first call: the `output-stream` resource for +// this `outgoing-body` may be retrieved at most once. Subsequent calls +// will return error. +extern bool wasi_http_types_method_outgoing_body_write(wasi_http_types_borrow_outgoing_body_t self, wasi_http_types_own_output_stream_t *ret); +// Finalize an outgoing body, optionally providing trailers. This must be +// called to signal that the response is complete. If the `outgoing-body` +// is dropped without calling `outgoing-body.finalize`, the implementation +// should treat the body as corrupted. +// +// Fails if the body's `outgoing-request` or `outgoing-response` was +// constructed with a Content-Length header, and the contents written +// to the body (via `write`) does not match the value given in the +// Content-Length. +extern bool wasi_http_types_static_outgoing_body_finish(wasi_http_types_own_outgoing_body_t this_, wasi_http_types_own_trailers_t *maybe_trailers, wasi_http_types_error_code_t *err); +// Returns a pollable which becomes ready when either the Response has +// been received, or an error has occured. When this pollable is ready, +// the `get` method will return `some`. +extern wasi_http_types_own_pollable_t wasi_http_types_method_future_incoming_response_subscribe(wasi_http_types_borrow_future_incoming_response_t self); +// Returns the incoming HTTP Response, or an error, once one is ready. +// +// The outer `option` represents future readiness. Users can wait on this +// `option` to become `some` using the `subscribe` method. +// +// The outer `result` is used to retrieve the response or error at most +// once. It will be success on the first call in which the outer option +// is `some`, and error on subsequent calls. +// +// The inner `result` represents that either the incoming HTTP Response +// status and headers have recieved successfully, or that an error +// occured. Errors may also occur while consuming the response body, +// but those will be reported by the `incoming-body` and its +// `output-stream` child. +extern bool wasi_http_types_method_future_incoming_response_get(wasi_http_types_borrow_future_incoming_response_t self, wasi_http_types_result_result_own_incoming_response_error_code_void_t *ret); + +// Imported Functions from `wasi:http/outgoing-handler@0.2.0` +// This function is invoked with an outgoing HTTP Request, and it returns +// a resource `future-incoming-response` which represents an HTTP Response +// which may arrive in the future. +// +// The `options` argument accepts optional parameters for the HTTP +// protocol's transport layer. +// +// This function may return an error if the `outgoing-request` is invalid +// or not allowed to be made. Otherwise, protocol errors are reported +// through the `future-incoming-response`. +extern bool wasi_http_outgoing_handler_handle(wasi_http_outgoing_handler_own_outgoing_request_t request, wasi_http_outgoing_handler_own_request_options_t *maybe_options, wasi_http_outgoing_handler_own_future_incoming_response_t *ret, wasi_http_outgoing_handler_error_code_t *err); + +// Exported Functions from `wasi:cli/run@0.2.0` +bool exports_wasi_cli_run_run(void); + +// Exported Functions from `wasi:http/incoming-handler@0.2.0` +void exports_wasi_http_incoming_handler_handle(exports_wasi_http_incoming_handler_own_incoming_request_t request, exports_wasi_http_incoming_handler_own_response_outparam_t response_out); + +// Helper Functions + +void bindings_option_string_free(bindings_option_string_t *ptr); + +void gcore_fastedge_secret_error_free(gcore_fastedge_secret_error_t *ptr); + +void gcore_fastedge_secret_result_option_string_error_free(gcore_fastedge_secret_result_option_string_error_t *ptr); + +void bindings_tuple2_string_string_free(bindings_tuple2_string_string_t *ptr); + +void bindings_list_tuple2_string_string_free(bindings_list_tuple2_string_string_t *ptr); + +void bindings_list_string_free(bindings_list_string_t *ptr); + +void wasi_cli_exit_result_void_void_free(wasi_cli_exit_result_void_void_t *ptr); + +extern void wasi_io_error_error_drop_own(wasi_io_error_own_error_t handle); + +extern wasi_io_error_borrow_error_t wasi_io_error_borrow_error(wasi_io_error_own_error_t handle); + +extern void wasi_io_poll_pollable_drop_own(wasi_io_poll_own_pollable_t handle); + +extern wasi_io_poll_borrow_pollable_t wasi_io_poll_borrow_pollable(wasi_io_poll_own_pollable_t handle); + +void wasi_io_poll_list_borrow_pollable_free(wasi_io_poll_list_borrow_pollable_t *ptr); + +void bindings_list_u32_free(bindings_list_u32_t *ptr); + +void wasi_io_streams_stream_error_free(wasi_io_streams_stream_error_t *ptr); + +extern void wasi_io_streams_input_stream_drop_own(wasi_io_streams_own_input_stream_t handle); + +extern wasi_io_streams_borrow_input_stream_t wasi_io_streams_borrow_input_stream(wasi_io_streams_own_input_stream_t handle); + +extern void wasi_io_streams_output_stream_drop_own(wasi_io_streams_own_output_stream_t handle); + +extern wasi_io_streams_borrow_output_stream_t wasi_io_streams_borrow_output_stream(wasi_io_streams_own_output_stream_t handle); + +void bindings_list_u8_free(bindings_list_u8_t *ptr); + +void wasi_io_streams_result_list_u8_stream_error_free(wasi_io_streams_result_list_u8_stream_error_t *ptr); + +void wasi_io_streams_result_u64_stream_error_free(wasi_io_streams_result_u64_stream_error_t *ptr); + +void wasi_io_streams_result_void_stream_error_free(wasi_io_streams_result_void_stream_error_t *ptr); + +extern void wasi_cli_terminal_input_terminal_input_drop_own(wasi_cli_terminal_input_own_terminal_input_t handle); + +extern wasi_cli_terminal_input_borrow_terminal_input_t wasi_cli_terminal_input_borrow_terminal_input(wasi_cli_terminal_input_own_terminal_input_t handle); + +extern void wasi_cli_terminal_output_terminal_output_drop_own(wasi_cli_terminal_output_own_terminal_output_t handle); + +extern wasi_cli_terminal_output_borrow_terminal_output_t wasi_cli_terminal_output_borrow_terminal_output(wasi_cli_terminal_output_own_terminal_output_t handle); + +void wasi_cli_terminal_stdin_option_own_terminal_input_free(wasi_cli_terminal_stdin_option_own_terminal_input_t *ptr); + +void wasi_cli_terminal_stdout_option_own_terminal_output_free(wasi_cli_terminal_stdout_option_own_terminal_output_t *ptr); + +void wasi_cli_terminal_stderr_option_own_terminal_output_free(wasi_cli_terminal_stderr_option_own_terminal_output_t *ptr); + +void wasi_filesystem_types_option_datetime_free(wasi_filesystem_types_option_datetime_t *ptr); + +void wasi_filesystem_types_descriptor_stat_free(wasi_filesystem_types_descriptor_stat_t *ptr); + +void wasi_filesystem_types_new_timestamp_free(wasi_filesystem_types_new_timestamp_t *ptr); + +void wasi_filesystem_types_directory_entry_free(wasi_filesystem_types_directory_entry_t *ptr); + +extern void wasi_filesystem_types_descriptor_drop_own(wasi_filesystem_types_own_descriptor_t handle); + +extern wasi_filesystem_types_borrow_descriptor_t wasi_filesystem_types_borrow_descriptor(wasi_filesystem_types_own_descriptor_t handle); + +extern void wasi_filesystem_types_directory_entry_stream_drop_own(wasi_filesystem_types_own_directory_entry_stream_t handle); + +extern wasi_filesystem_types_borrow_directory_entry_stream_t wasi_filesystem_types_borrow_directory_entry_stream(wasi_filesystem_types_own_directory_entry_stream_t handle); + +void wasi_filesystem_types_result_own_input_stream_error_code_free(wasi_filesystem_types_result_own_input_stream_error_code_t *ptr); + +void wasi_filesystem_types_result_own_output_stream_error_code_free(wasi_filesystem_types_result_own_output_stream_error_code_t *ptr); + +void wasi_filesystem_types_result_void_error_code_free(wasi_filesystem_types_result_void_error_code_t *ptr); + +void wasi_filesystem_types_result_descriptor_flags_error_code_free(wasi_filesystem_types_result_descriptor_flags_error_code_t *ptr); + +void wasi_filesystem_types_result_descriptor_type_error_code_free(wasi_filesystem_types_result_descriptor_type_error_code_t *ptr); + +void wasi_filesystem_types_result_tuple2_list_u8_bool_error_code_free(wasi_filesystem_types_result_tuple2_list_u8_bool_error_code_t *ptr); + +void wasi_filesystem_types_result_filesize_error_code_free(wasi_filesystem_types_result_filesize_error_code_t *ptr); + +void wasi_filesystem_types_result_own_directory_entry_stream_error_code_free(wasi_filesystem_types_result_own_directory_entry_stream_error_code_t *ptr); + +void wasi_filesystem_types_result_descriptor_stat_error_code_free(wasi_filesystem_types_result_descriptor_stat_error_code_t *ptr); + +void wasi_filesystem_types_result_own_descriptor_error_code_free(wasi_filesystem_types_result_own_descriptor_error_code_t *ptr); + +void wasi_filesystem_types_result_string_error_code_free(wasi_filesystem_types_result_string_error_code_t *ptr); + +void wasi_filesystem_types_result_metadata_hash_value_error_code_free(wasi_filesystem_types_result_metadata_hash_value_error_code_t *ptr); + +void wasi_filesystem_types_option_directory_entry_free(wasi_filesystem_types_option_directory_entry_t *ptr); + +void wasi_filesystem_types_result_option_directory_entry_error_code_free(wasi_filesystem_types_result_option_directory_entry_error_code_t *ptr); + +void wasi_filesystem_types_option_error_code_free(wasi_filesystem_types_option_error_code_t *ptr); + +void wasi_filesystem_preopens_tuple2_own_descriptor_string_free(wasi_filesystem_preopens_tuple2_own_descriptor_string_t *ptr); + +void wasi_filesystem_preopens_list_tuple2_own_descriptor_string_free(wasi_filesystem_preopens_list_tuple2_own_descriptor_string_t *ptr); + +extern void wasi_sockets_network_network_drop_own(wasi_sockets_network_own_network_t handle); + +extern wasi_sockets_network_borrow_network_t wasi_sockets_network_borrow_network(wasi_sockets_network_own_network_t handle); + +void wasi_sockets_network_ip_address_free(wasi_sockets_network_ip_address_t *ptr); + +void wasi_sockets_network_ip_socket_address_free(wasi_sockets_network_ip_socket_address_t *ptr); + +void wasi_sockets_udp_ip_socket_address_free(wasi_sockets_udp_ip_socket_address_t *ptr); + +void wasi_sockets_udp_incoming_datagram_free(wasi_sockets_udp_incoming_datagram_t *ptr); + +void wasi_sockets_udp_option_ip_socket_address_free(wasi_sockets_udp_option_ip_socket_address_t *ptr); + +void wasi_sockets_udp_outgoing_datagram_free(wasi_sockets_udp_outgoing_datagram_t *ptr); + +extern void wasi_sockets_udp_udp_socket_drop_own(wasi_sockets_udp_own_udp_socket_t handle); + +extern wasi_sockets_udp_borrow_udp_socket_t wasi_sockets_udp_borrow_udp_socket(wasi_sockets_udp_own_udp_socket_t handle); + +extern void wasi_sockets_udp_incoming_datagram_stream_drop_own(wasi_sockets_udp_own_incoming_datagram_stream_t handle); + +extern wasi_sockets_udp_borrow_incoming_datagram_stream_t wasi_sockets_udp_borrow_incoming_datagram_stream(wasi_sockets_udp_own_incoming_datagram_stream_t handle); + +extern void wasi_sockets_udp_outgoing_datagram_stream_drop_own(wasi_sockets_udp_own_outgoing_datagram_stream_t handle); + +extern wasi_sockets_udp_borrow_outgoing_datagram_stream_t wasi_sockets_udp_borrow_outgoing_datagram_stream(wasi_sockets_udp_own_outgoing_datagram_stream_t handle); + +void wasi_sockets_udp_result_void_error_code_free(wasi_sockets_udp_result_void_error_code_t *ptr); + +void wasi_sockets_udp_result_tuple2_own_incoming_datagram_stream_own_outgoing_datagram_stream_error_code_free(wasi_sockets_udp_result_tuple2_own_incoming_datagram_stream_own_outgoing_datagram_stream_error_code_t *ptr); + +void wasi_sockets_udp_result_ip_socket_address_error_code_free(wasi_sockets_udp_result_ip_socket_address_error_code_t *ptr); + +void wasi_sockets_udp_result_u8_error_code_free(wasi_sockets_udp_result_u8_error_code_t *ptr); + +void wasi_sockets_udp_result_u64_error_code_free(wasi_sockets_udp_result_u64_error_code_t *ptr); + +void wasi_sockets_udp_list_incoming_datagram_free(wasi_sockets_udp_list_incoming_datagram_t *ptr); + +void wasi_sockets_udp_result_list_incoming_datagram_error_code_free(wasi_sockets_udp_result_list_incoming_datagram_error_code_t *ptr); + +void wasi_sockets_udp_list_outgoing_datagram_free(wasi_sockets_udp_list_outgoing_datagram_t *ptr); + +void wasi_sockets_udp_create_socket_result_own_udp_socket_error_code_free(wasi_sockets_udp_create_socket_result_own_udp_socket_error_code_t *ptr); + +void wasi_sockets_tcp_ip_socket_address_free(wasi_sockets_tcp_ip_socket_address_t *ptr); + +extern void wasi_sockets_tcp_tcp_socket_drop_own(wasi_sockets_tcp_own_tcp_socket_t handle); + +extern wasi_sockets_tcp_borrow_tcp_socket_t wasi_sockets_tcp_borrow_tcp_socket(wasi_sockets_tcp_own_tcp_socket_t handle); + +void wasi_sockets_tcp_result_void_error_code_free(wasi_sockets_tcp_result_void_error_code_t *ptr); + +void wasi_sockets_tcp_result_tuple2_own_input_stream_own_output_stream_error_code_free(wasi_sockets_tcp_result_tuple2_own_input_stream_own_output_stream_error_code_t *ptr); + +void wasi_sockets_tcp_result_tuple3_own_tcp_socket_own_input_stream_own_output_stream_error_code_free(wasi_sockets_tcp_result_tuple3_own_tcp_socket_own_input_stream_own_output_stream_error_code_t *ptr); + +void wasi_sockets_tcp_result_ip_socket_address_error_code_free(wasi_sockets_tcp_result_ip_socket_address_error_code_t *ptr); + +void wasi_sockets_tcp_result_bool_error_code_free(wasi_sockets_tcp_result_bool_error_code_t *ptr); + +void wasi_sockets_tcp_result_duration_error_code_free(wasi_sockets_tcp_result_duration_error_code_t *ptr); + +void wasi_sockets_tcp_result_u32_error_code_free(wasi_sockets_tcp_result_u32_error_code_t *ptr); + +void wasi_sockets_tcp_result_u8_error_code_free(wasi_sockets_tcp_result_u8_error_code_t *ptr); + +void wasi_sockets_tcp_result_u64_error_code_free(wasi_sockets_tcp_result_u64_error_code_t *ptr); + +void wasi_sockets_tcp_create_socket_result_own_tcp_socket_error_code_free(wasi_sockets_tcp_create_socket_result_own_tcp_socket_error_code_t *ptr); + +void wasi_sockets_ip_name_lookup_ip_address_free(wasi_sockets_ip_name_lookup_ip_address_t *ptr); + +extern void wasi_sockets_ip_name_lookup_resolve_address_stream_drop_own(wasi_sockets_ip_name_lookup_own_resolve_address_stream_t handle); + +extern wasi_sockets_ip_name_lookup_borrow_resolve_address_stream_t wasi_sockets_ip_name_lookup_borrow_resolve_address_stream(wasi_sockets_ip_name_lookup_own_resolve_address_stream_t handle); + +void wasi_sockets_ip_name_lookup_result_own_resolve_address_stream_error_code_free(wasi_sockets_ip_name_lookup_result_own_resolve_address_stream_error_code_t *ptr); + +void wasi_sockets_ip_name_lookup_option_ip_address_free(wasi_sockets_ip_name_lookup_option_ip_address_t *ptr); + +void wasi_sockets_ip_name_lookup_result_option_ip_address_error_code_free(wasi_sockets_ip_name_lookup_result_option_ip_address_error_code_t *ptr); + +void wasi_http_types_method_free(wasi_http_types_method_t *ptr); + +void wasi_http_types_scheme_free(wasi_http_types_scheme_t *ptr); + +void bindings_option_u16_free(bindings_option_u16_t *ptr); + +void wasi_http_types_dns_error_payload_free(wasi_http_types_dns_error_payload_t *ptr); + +void bindings_option_u8_free(bindings_option_u8_t *ptr); + +void wasi_http_types_tls_alert_received_payload_free(wasi_http_types_tls_alert_received_payload_t *ptr); + +void bindings_option_u32_free(bindings_option_u32_t *ptr); + +void wasi_http_types_field_size_payload_free(wasi_http_types_field_size_payload_t *ptr); + +void bindings_option_u64_free(bindings_option_u64_t *ptr); + +void wasi_http_types_option_field_size_payload_free(wasi_http_types_option_field_size_payload_t *ptr); + +void wasi_http_types_error_code_free(wasi_http_types_error_code_t *ptr); + +void wasi_http_types_header_error_free(wasi_http_types_header_error_t *ptr); + +void wasi_http_types_field_key_free(wasi_http_types_field_key_t *ptr); + +void wasi_http_types_field_value_free(wasi_http_types_field_value_t *ptr); + +extern void wasi_http_types_fields_drop_own(wasi_http_types_own_fields_t handle); + +extern wasi_http_types_borrow_fields_t wasi_http_types_borrow_fields(wasi_http_types_own_fields_t handle); + +extern void wasi_http_types_incoming_request_drop_own(wasi_http_types_own_incoming_request_t handle); + +extern wasi_http_types_borrow_incoming_request_t wasi_http_types_borrow_incoming_request(wasi_http_types_own_incoming_request_t handle); + +extern void wasi_http_types_outgoing_request_drop_own(wasi_http_types_own_outgoing_request_t handle); + +extern wasi_http_types_borrow_outgoing_request_t wasi_http_types_borrow_outgoing_request(wasi_http_types_own_outgoing_request_t handle); + +extern void wasi_http_types_request_options_drop_own(wasi_http_types_own_request_options_t handle); + +extern wasi_http_types_borrow_request_options_t wasi_http_types_borrow_request_options(wasi_http_types_own_request_options_t handle); + +extern void wasi_http_types_response_outparam_drop_own(wasi_http_types_own_response_outparam_t handle); + +extern wasi_http_types_borrow_response_outparam_t wasi_http_types_borrow_response_outparam(wasi_http_types_own_response_outparam_t handle); + +extern void wasi_http_types_incoming_response_drop_own(wasi_http_types_own_incoming_response_t handle); + +extern wasi_http_types_borrow_incoming_response_t wasi_http_types_borrow_incoming_response(wasi_http_types_own_incoming_response_t handle); + +extern void wasi_http_types_incoming_body_drop_own(wasi_http_types_own_incoming_body_t handle); + +extern wasi_http_types_borrow_incoming_body_t wasi_http_types_borrow_incoming_body(wasi_http_types_own_incoming_body_t handle); + +extern void wasi_http_types_future_trailers_drop_own(wasi_http_types_own_future_trailers_t handle); + +extern wasi_http_types_borrow_future_trailers_t wasi_http_types_borrow_future_trailers(wasi_http_types_own_future_trailers_t handle); + +extern void wasi_http_types_outgoing_response_drop_own(wasi_http_types_own_outgoing_response_t handle); + +extern wasi_http_types_borrow_outgoing_response_t wasi_http_types_borrow_outgoing_response(wasi_http_types_own_outgoing_response_t handle); + +extern void wasi_http_types_outgoing_body_drop_own(wasi_http_types_own_outgoing_body_t handle); + +extern wasi_http_types_borrow_outgoing_body_t wasi_http_types_borrow_outgoing_body(wasi_http_types_own_outgoing_body_t handle); + +extern void wasi_http_types_future_incoming_response_drop_own(wasi_http_types_own_future_incoming_response_t handle); + +extern wasi_http_types_borrow_future_incoming_response_t wasi_http_types_borrow_future_incoming_response(wasi_http_types_own_future_incoming_response_t handle); + +void wasi_http_types_option_error_code_free(wasi_http_types_option_error_code_t *ptr); + +void bindings_tuple2_field_key_field_value_free(bindings_tuple2_field_key_field_value_t *ptr); + +void bindings_list_tuple2_field_key_field_value_free(bindings_list_tuple2_field_key_field_value_t *ptr); + +void wasi_http_types_result_own_fields_header_error_free(wasi_http_types_result_own_fields_header_error_t *ptr); + +void bindings_list_field_value_free(bindings_list_field_value_t *ptr); + +void wasi_http_types_result_void_header_error_free(wasi_http_types_result_void_header_error_t *ptr); + +void wasi_http_types_option_scheme_free(wasi_http_types_option_scheme_t *ptr); + +void wasi_http_types_result_own_incoming_body_void_free(wasi_http_types_result_own_incoming_body_void_t *ptr); + +void wasi_http_types_result_own_outgoing_body_void_free(wasi_http_types_result_own_outgoing_body_void_t *ptr); + +void wasi_http_types_result_void_void_free(wasi_http_types_result_void_void_t *ptr); + +void bindings_option_duration_free(bindings_option_duration_t *ptr); + +void wasi_http_types_result_own_outgoing_response_error_code_free(wasi_http_types_result_own_outgoing_response_error_code_t *ptr); + +void wasi_http_types_result_own_input_stream_void_free(wasi_http_types_result_own_input_stream_void_t *ptr); + +void wasi_http_types_option_own_trailers_free(wasi_http_types_option_own_trailers_t *ptr); + +void wasi_http_types_result_option_own_trailers_error_code_free(wasi_http_types_result_option_own_trailers_error_code_t *ptr); + +void wasi_http_types_result_result_option_own_trailers_error_code_void_free(wasi_http_types_result_result_option_own_trailers_error_code_void_t *ptr); + +void wasi_http_types_option_result_result_option_own_trailers_error_code_void_free(wasi_http_types_option_result_result_option_own_trailers_error_code_void_t *ptr); + +void wasi_http_types_result_own_output_stream_void_free(wasi_http_types_result_own_output_stream_void_t *ptr); + +void wasi_http_types_result_void_error_code_free(wasi_http_types_result_void_error_code_t *ptr); + +void wasi_http_types_result_own_incoming_response_error_code_free(wasi_http_types_result_own_incoming_response_error_code_t *ptr); + +void wasi_http_types_result_result_own_incoming_response_error_code_void_free(wasi_http_types_result_result_own_incoming_response_error_code_void_t *ptr); + +void wasi_http_types_option_result_result_own_incoming_response_error_code_void_free(wasi_http_types_option_result_result_own_incoming_response_error_code_void_t *ptr); + +void wasi_http_outgoing_handler_error_code_free(wasi_http_outgoing_handler_error_code_t *ptr); + +void wasi_http_outgoing_handler_option_own_request_options_free(wasi_http_outgoing_handler_option_own_request_options_t *ptr); + +void wasi_http_outgoing_handler_result_own_future_incoming_response_error_code_free(wasi_http_outgoing_handler_result_own_future_incoming_response_error_code_t *ptr); + +void exports_wasi_cli_run_result_void_void_free(exports_wasi_cli_run_result_void_void_t *ptr); + +// Transfers ownership of `s` into the string `ret` +void bindings_string_set(bindings_string_t *ret, const char*s); + +// Creates a copy of the input nul-terminate string `s` and +// stores it into the component model string `ret`. +void bindings_string_dup(bindings_string_t *ret, const char*s); + +// Deallocates the string pointed to by `ret`, deallocating +// the memory behind the string. +void bindings_string_free(bindings_string_t *ret); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/runtime/fastedge/host-api/bindings/bindings_component_type.o b/runtime/fastedge/host-api/bindings/bindings_component_type.o index ba56b23..bbf5102 100644 Binary files a/runtime/fastedge/host-api/bindings/bindings_component_type.o and b/runtime/fastedge/host-api/bindings/bindings_component_type.o differ diff --git a/runtime/fastedge/host-api/host_api.cpp b/runtime/fastedge/host-api/host_api.cpp index 787f082..694a49e 100644 --- a/runtime/fastedge/host-api/host_api.cpp +++ b/runtime/fastedge/host-api/host_api.cpp @@ -1,13 +1,6 @@ #include "host_api.h" #include "bindings/bindings.h" - -#include "./host_api_fastedge.h" - -#include // for std::hex and std::dec (DEBUGGING ONLY) -#include - - #include #include #ifdef DEBUG @@ -25,21 +18,23 @@ using std::vector; // pointer. static_assert(sizeof(uint32_t) == sizeof(void *)); -typedef wasi_http_0_2_0_types_own_future_incoming_response_t future_incoming_response_t; -typedef wasi_http_0_2_0_types_borrow_future_incoming_response_t borrow_future_incoming_response_t; +typedef wasi_http_types_own_future_incoming_response_t future_incoming_response_t; +typedef wasi_http_types_borrow_future_incoming_response_t borrow_future_incoming_response_t; -typedef wasi_http_0_2_0_types_own_incoming_body_t incoming_body_t; -typedef wasi_http_0_2_0_types_own_outgoing_body_t outgoing_body_t; +typedef wasi_http_types_own_incoming_body_t incoming_body_t; +typedef wasi_http_types_own_outgoing_body_t outgoing_body_t; -using field_key = wasi_http_0_2_0_types_field_key_t; -using field_value = wasi_http_0_2_0_types_field_value_t; +using field_key = wasi_http_types_field_key_t; +using field_value = wasi_http_types_field_value_t; -typedef wasi_io_0_2_0_poll_own_pollable_t own_pollable_t; -typedef wasi_io_0_2_0_poll_borrow_pollable_t borrow_pollable_t; -typedef wasi_io_0_2_0_poll_list_borrow_pollable_t list_borrow_pollable_t; +typedef wasi_io_poll_own_pollable_t own_pollable_t; +typedef wasi_io_poll_borrow_pollable_t borrow_pollable_t; +typedef wasi_io_poll_list_borrow_pollable_t list_borrow_pollable_t; #ifdef LOG_HANDLE_OPS -#define LOG_HANDLE_OP(...) fprintf(stderr, "%s", __PRETTY_FUNCTION__); fprintf(stderr, __VA_ARGS__) +#define LOG_HANDLE_OP(...) \ + fprintf(stderr, "%s", __PRETTY_FUNCTION__); \ + fprintf(stderr, __VA_ARGS__) #else #define LOG_HANDLE_OP(...) #endif @@ -59,8 +54,7 @@ class host_api::HandleState { template struct HandleOps {}; -template -class WASIHandle : public host_api::HandleState { +template class WASIHandle : public host_api::HandleState { #ifdef DEBUG static inline auto used_handles = std::set(); #endif @@ -102,13 +96,11 @@ class WASIHandle : public host_api::HandleState { #endif } - static WASIHandle* cast(HandleState* handle) { - return reinterpret_cast*>(handle); + static WASIHandle *cast(HandleState *handle) { + return reinterpret_cast *>(handle); } - typename HandleOps::borrowed borrow(HandleState *handle) { - return cast(handle)->borrow(); - } + typename HandleOps::borrowed borrow(HandleState *handle) { return cast(handle)->borrow(); } bool valid() const override { bool valid = handle_ != POISONED_HANDLE; @@ -126,7 +118,7 @@ class WASIHandle : public host_api::HandleState { MOZ_ASSERT(valid()); MOZ_ASSERT(owned_); LOG_HANDLE_OP("taking handle %d\n", handle_); - typename HandleOps::owned handle = { handle_ }; + typename HandleOps::owned handle = {handle_}; #ifdef DEBUG used_handles.erase(handle_); #endif @@ -135,8 +127,7 @@ class WASIHandle : public host_api::HandleState { } }; -template -struct Borrow { +template struct Borrow { static constexpr typename HandleOps::borrowed invalid{std::numeric_limits::max()}; typename HandleOps::borrowed handle_{invalid}; @@ -144,72 +135,68 @@ struct Borrow { handle_ = WASIHandle::cast(handle)->borrow(); } - explicit Borrow(typename HandleOps::borrowed handle) { - handle_ = handle; - } + explicit Borrow(typename HandleOps::borrowed handle) { handle_ = handle; } - explicit Borrow(typename HandleOps::owned handle) { - handle_ = {handle.__handle}; - } + explicit Borrow(typename HandleOps::owned handle) { handle_ = {handle.__handle}; } operator typename HandleOps::borrowed() const { return handle_; } }; template <> struct HandleOps { - using owned = wasi_io_0_2_0_poll_own_pollable_t; - using borrowed = wasi_io_0_2_0_poll_borrow_pollable_t; + using owned = wasi_io_poll_own_pollable_t; + using borrowed = wasi_io_poll_borrow_pollable_t; }; template <> struct HandleOps { - using owned = wasi_http_0_2_0_types_own_headers_t; - using borrowed = wasi_http_0_2_0_types_borrow_fields_t; + using owned = wasi_http_types_own_headers_t; + using borrowed = wasi_http_types_borrow_fields_t; }; template <> struct HandleOps { - using owned = wasi_http_0_2_0_types_own_incoming_request_t; - using borrowed = wasi_http_0_2_0_types_borrow_incoming_request_t; + using owned = wasi_http_types_own_incoming_request_t; + using borrowed = wasi_http_types_borrow_incoming_request_t; }; template <> struct HandleOps { - using owned = wasi_http_0_2_0_types_own_outgoing_request_t; - using borrowed = wasi_http_0_2_0_types_borrow_outgoing_request_t; + using owned = wasi_http_types_own_outgoing_request_t; + using borrowed = wasi_http_types_borrow_outgoing_request_t; }; template <> struct HandleOps { - using owned = wasi_http_0_2_0_types_own_future_incoming_response_t; - using borrowed = wasi_http_0_2_0_types_borrow_future_incoming_response_t; + using owned = wasi_http_types_own_future_incoming_response_t; + using borrowed = wasi_http_types_borrow_future_incoming_response_t; }; template <> struct HandleOps { - using owned = wasi_http_0_2_0_types_own_incoming_response_t; - using borrowed = wasi_http_0_2_0_types_borrow_incoming_response_t; + using owned = wasi_http_types_own_incoming_response_t; + using borrowed = wasi_http_types_borrow_incoming_response_t; }; template <> struct HandleOps { - using owned = wasi_http_0_2_0_types_own_outgoing_response_t; - using borrowed = wasi_http_0_2_0_types_borrow_outgoing_response_t; + using owned = wasi_http_types_own_outgoing_response_t; + using borrowed = wasi_http_types_borrow_outgoing_response_t; }; template <> struct HandleOps { - using owned = wasi_http_0_2_0_types_own_incoming_body_t; - using borrowed = wasi_http_0_2_0_types_borrow_incoming_body_t; + using owned = wasi_http_types_own_incoming_body_t; + using borrowed = wasi_http_types_borrow_incoming_body_t; }; template <> struct HandleOps { - using owned = wasi_http_0_2_0_types_own_outgoing_body_t; - using borrowed = wasi_http_0_2_0_types_borrow_outgoing_body_t; + using owned = wasi_http_types_own_outgoing_body_t; + using borrowed = wasi_http_types_borrow_outgoing_body_t; }; struct OutputStream {}; template <> struct HandleOps { - using owned = wasi_io_0_2_0_streams_own_output_stream_t; - using borrowed = wasi_io_0_2_0_streams_borrow_output_stream_t; + using owned = wasi_io_streams_own_output_stream_t; + using borrowed = wasi_io_streams_borrow_output_stream_t; }; struct InputStream {}; template <> struct HandleOps { - using owned = wasi_io_0_2_0_streams_own_input_stream_t; - using borrowed = wasi_io_0_2_0_streams_borrow_input_stream_t; + using owned = wasi_io_streams_own_input_stream_t; + using borrowed = wasi_io_streams_borrow_input_stream_t; }; class IncomingBodyHandle final : public WASIHandle { @@ -222,14 +209,14 @@ class IncomingBodyHandle final : public WASIHandle { explicit IncomingBodyHandle(HandleOps::owned handle) : WASIHandle(handle), pollable_handle_(INVALID_POLLABLE_HANDLE) { HandleOps::owned stream{}; - if (!wasi_http_0_2_0_types_method_incoming_body_stream(borrow(), &stream)) { + if (!wasi_http_types_method_incoming_body_stream(borrow(), &stream)) { MOZ_ASSERT_UNREACHABLE("Getting a body's stream should never fail"); } stream_handle_ = stream; } - static IncomingBodyHandle* cast(HandleState* handle) { - return reinterpret_cast(handle); + static IncomingBodyHandle *cast(HandleState *handle) { + return reinterpret_cast(handle); } }; @@ -243,14 +230,14 @@ class OutgoingBodyHandle final : public WASIHandle { explicit OutgoingBodyHandle(HandleOps::owned handle) : WASIHandle(handle), pollable_handle_(INVALID_POLLABLE_HANDLE) { HandleOps::owned stream{}; - if (!wasi_http_0_2_0_types_method_outgoing_body_write(borrow(), &stream)) { + if (!wasi_http_types_method_outgoing_body_write(borrow(), &stream)) { MOZ_ASSERT_UNREACHABLE("Getting a body's stream should never fail"); } stream_handle_ = stream; } - static OutgoingBodyHandle* cast(HandleState* handle) { - return reinterpret_cast(handle); + static OutgoingBodyHandle *cast(HandleState *handle) { + return reinterpret_cast(handle); } }; @@ -260,9 +247,9 @@ size_t api::AsyncTask::select(std::vector &tasks) { for (const auto task : tasks) { handles.emplace_back(task->id()); } - auto list = list_borrow_pollable_t{ handles.data(), count}; - wasi_io_0_2_0_poll_list_u32_t result{nullptr, 0}; - wasi_io_0_2_0_poll_poll(&list, &result); + auto list = list_borrow_pollable_t{handles.data(), count}; + bindings_list_u32_t result{nullptr, 0}; + wasi_io_poll_poll(&list, &result); MOZ_ASSERT(result.len > 0); const auto ready_index = result.ptr[0]; free(result.ptr); @@ -272,13 +259,6 @@ size_t api::AsyncTask::select(std::vector &tasks) { namespace host_api { -HostString::HostString(const char *c_str) { - len = strlen(c_str); - ptr = JS::UniqueChars(static_cast(malloc(len + 1))); - std::memcpy(ptr.get(), c_str, len); - ptr[len] = '\0'; -} - namespace { template HostString to_host_string(T str) { @@ -296,11 +276,11 @@ template T from_string_view(std::string_view str) { auto string_view_to_world_string = from_string_view; -HostString scheme_to_string(const wasi_http_0_2_0_types_scheme_t &scheme) { - if (scheme.tag == WASI_HTTP_0_2_0_TYPES_SCHEME_HTTP) { +HostString scheme_to_string(const wasi_http_types_scheme_t &scheme) { + if (scheme.tag == WASI_HTTP_TYPES_SCHEME_HTTP) { return {"http"}; } - if (scheme.tag == WASI_HTTP_0_2_0_TYPES_SCHEME_HTTPS) { + if (scheme.tag == WASI_HTTP_TYPES_SCHEME_HTTPS) { return {"https"}; } return to_host_string(scheme.val.other); @@ -311,8 +291,8 @@ HostString scheme_to_string(const wasi_http_0_2_0_types_scheme_t &scheme) { Result Random::get_bytes(size_t num_bytes) { Result res; - wasi_random_0_2_0_random_list_u8_t list{}; - wasi_random_0_2_0_random_get_random_bytes(num_bytes, &list); + bindings_list_u8_t list{}; + wasi_random_random_get_random_bytes(num_bytes, &list); auto ret = HostBytes{ std::unique_ptr{list.ptr}, list.len, @@ -323,135 +303,98 @@ Result Random::get_bytes(size_t num_bytes) { } Result Random::get_u32() { - return Result::ok(wasi_random_0_2_0_random_get_random_u64()); + return Result::ok(wasi_random_random_get_random_u64()); } -uint64_t MonotonicClock::now() { return wasi_clocks_0_2_0_monotonic_clock_now(); } +uint64_t MonotonicClock::now() { return wasi_clocks_monotonic_clock_now(); } -uint64_t MonotonicClock::resolution() { return wasi_clocks_0_2_0_monotonic_clock_resolution(); } +uint64_t MonotonicClock::resolution() { return wasi_clocks_monotonic_clock_resolution(); } int32_t MonotonicClock::subscribe(const uint64_t when, const bool absolute) { if (absolute) { - return wasi_clocks_0_2_0_monotonic_clock_subscribe_instant(when).__handle; + return wasi_clocks_monotonic_clock_subscribe_instant(when).__handle; } else { - return wasi_clocks_0_2_0_monotonic_clock_subscribe_duration(when).__handle; + return wasi_clocks_monotonic_clock_subscribe_duration(when).__handle; } } void MonotonicClock::unsubscribe(const int32_t handle_id) { - wasi_io_0_2_0_poll_pollable_drop_own(own_pollable_t{handle_id}); + wasi_io_poll_pollable_drop_own(own_pollable_t{handle_id}); } -HttpHeaders::HttpHeaders(HttpHeadersGuard guard, std::unique_ptr state) - : HttpHeadersReadOnly(std::move(state)), guard_(guard) {} +vector environment_get_arguments() { + bindings_list_string_t raw_args = {}; + wasi_cli_environment_get_arguments(&raw_args); + std::vector args = {}; + for (int i = 0; i < raw_args.len; i++) { + args.push_back(std::string(reinterpret_cast(raw_args.ptr[i].ptr), raw_args.ptr[i].len)); + } + return args; +} -HttpHeaders::HttpHeaders(HttpHeadersGuard guard) : guard_(guard) { - handle_state_ = std::make_unique>(wasi_http_0_2_0_types_constructor_fields()); +HttpHeaders::HttpHeaders(std::unique_ptr state) + : HttpHeadersReadOnly(std::move(state)) {} + +HttpHeaders::HttpHeaders() { + handle_state_ = + std::make_unique>(wasi_http_types_constructor_fields()); } -Result HttpHeaders::FromEntries(HttpHeadersGuard guard, - vector>& entries) { - std::vector pairs; +Result HttpHeaders::FromEntries(vector> &entries) { + std::vector pairs; pairs.reserve(entries.size()); for (const auto &[name, value] : entries) { pairs.emplace_back(from_string_view(name), from_string_view(value)); } - wasi_http_0_2_0_types_list_tuple2_field_key_field_value_t tuples{pairs.data(), entries.size()}; + bindings_list_tuple2_field_key_field_value_t tuples{pairs.data(), entries.size()}; - wasi_http_0_2_0_types_own_fields_t ret; - wasi_http_0_2_0_types_header_error_t err; - if (!wasi_http_0_2_0_types_static_fields_from_list(&tuples, &ret, &err)) { + wasi_http_types_own_fields_t ret; + wasi_http_types_header_error_t err; + if (!wasi_http_types_static_fields_from_list(&tuples, &ret, &err)) { // TODO: handle `err` - return Result::err(154); + return Result::err(154); } - auto headers = new HttpHeaders(guard, std::make_unique>(ret)); - return Result::ok(headers); + auto headers = new HttpHeaders(std::make_unique>(ret)); + return Result::ok(headers); } -HttpHeaders::HttpHeaders(HttpHeadersGuard guard, const HttpHeadersReadOnly &headers) - : HttpHeadersReadOnly(nullptr), guard_(guard) { +HttpHeaders::HttpHeaders(const HttpHeadersReadOnly &headers) : HttpHeadersReadOnly(nullptr) { Borrow borrow(headers.handle_state_.get()); - auto handle = wasi_http_0_2_0_types_method_fields_clone(borrow); + auto handle = wasi_http_types_method_fields_clone(borrow); this->handle_state_ = std::unique_ptr(new WASIHandle(handle)); } // We currently only guard against a single request header, instead of the full list in // https://fetch.spec.whatwg.org/#forbidden-request-header. -static std::list forbidden_request_headers = { - "host", +static const std::vector forbidden_request_headers = { + "host", }; // We currently only guard against a single response header, instead of the full list in // https://fetch.spec.whatwg.org/#forbidden-request-header. -static std::list forbidden_response_headers = { - "host", +static const std::vector forbidden_response_headers = { + "host", }; -bool HttpHeaders::check_guard(HttpHeadersGuard guard, string_view header_name) { - std::list* forbidden_headers = nullptr; - switch (guard) { - case HttpHeadersGuard::None: - return true; - case HttpHeadersGuard::Request: - forbidden_headers = &forbidden_request_headers; - break; - case HttpHeadersGuard::Response: - forbidden_headers = &forbidden_response_headers; - break; - default: - MOZ_ASSERT_UNREACHABLE(); - } - - if (!forbidden_headers) { - return true; - } - - for (auto header : *forbidden_headers) { - if (header_name.compare(header) == 0) { - return false; - } - } - - return true; +const std::vector &HttpHeaders::get_forbidden_request_headers() { + return forbidden_request_headers; } -HttpHeaders *HttpHeadersReadOnly::clone(HttpHeadersGuard guard) { - auto headers = new HttpHeaders(guard, *this); - std::list* forbidden_headers = nullptr; - switch (guard) { - case HttpHeadersGuard::Request: - forbidden_headers = &forbidden_request_headers; - break; - case HttpHeadersGuard::Response: - break; - case HttpHeadersGuard::None: - break; - default: - MOZ_ASSERT_UNREACHABLE(); - } - - if (!forbidden_headers) { - return headers; - } - - for (auto header : *forbidden_headers) { - if (headers->has(header).unwrap()) { - headers->remove(header).unwrap(); - } - } - - return headers; +const std::vector &HttpHeaders::get_forbidden_response_headers() { + return forbidden_response_headers; } +HttpHeaders *HttpHeadersReadOnly::clone() { return new HttpHeaders(*this); } + Result>> HttpHeadersReadOnly::entries() const { Result>> res; - wasi_http_0_2_0_types_list_tuple2_field_key_field_value_t entries; + bindings_list_tuple2_field_key_field_value_t entries; Borrow borrow(this->handle_state_.get()); - wasi_http_0_2_0_types_method_fields_entries(borrow, &entries); + wasi_http_types_method_fields_entries(borrow, &entries); vector> entries_vec; for (int i = 0; i < entries.len; i++) { @@ -469,9 +412,9 @@ Result>> HttpHeadersReadOnly::entries() con Result> HttpHeadersReadOnly::names() const { Result> res; - wasi_http_0_2_0_types_list_tuple2_field_key_field_value_t entries; + bindings_list_tuple2_field_key_field_value_t entries; Borrow borrow(this->handle_state_.get()); - wasi_http_0_2_0_types_method_fields_entries(borrow, &entries); + wasi_http_types_method_fields_entries(borrow, &entries); vector names; names.reserve(entries.len); @@ -488,10 +431,10 @@ Result> HttpHeadersReadOnly::names() const { Result>> HttpHeadersReadOnly::get(string_view name) const { Result>> res; - wasi_http_0_2_0_types_list_field_value_t values; + bindings_list_field_value_t values; auto hdr = string_view_to_world_string(name); Borrow borrow(this->handle_state_.get()); - wasi_http_0_2_0_types_method_fields_get(borrow, &hdr, &values); + wasi_http_types_method_fields_get(borrow, &hdr, &values); if (values.len > 0) { std::vector names; @@ -512,44 +455,37 @@ Result>> HttpHeadersReadOnly::get(string_view name) Result HttpHeadersReadOnly::has(string_view name) const { auto hdr = string_view_to_world_string(name); Borrow borrow(this->handle_state_.get()); - return Result::ok(wasi_http_0_2_0_types_method_fields_has(borrow, &hdr)); + return Result::ok(wasi_http_types_method_fields_has(borrow, &hdr)); } Result HttpHeaders::set(string_view name, string_view value) { - if (!check_guard(guard_, name)) { - return {}; - } auto hdr = from_string_view(name); auto val = from_string_view(value); - wasi_http_0_2_0_types_list_field_value_t host_values{&val, 1}; + bindings_list_field_value_t host_values{&val, 1}; Borrow borrow(this->handle_state_.get()); - wasi_http_0_2_0_types_header_error_t err; - if (!wasi_http_0_2_0_types_method_fields_set(borrow, &hdr, &host_values, &err)) { - // TODO: handle `err` + wasi_http_types_header_error_t err; + if (!wasi_http_types_method_fields_set(borrow, &hdr, &host_values, &err)) { + // TODO: handle `err` return Result::err(154); } - return {}; } Result HttpHeaders::append(string_view name, string_view value) { - if (!check_guard(guard_, name)) { - return {}; - } auto hdr = from_string_view(name); auto val = from_string_view(value); Borrow borrow(this->handle_state_.get()); // TODO: properly handle `err` - wasi_http_0_2_0_types_header_error_t err; - if (!wasi_http_0_2_0_types_method_fields_append(borrow, &hdr, &val, &err)) { + wasi_http_types_header_error_t err; + if (!wasi_http_types_method_fields_append(borrow, &hdr, &val, &err)) { switch (err.tag) { - case WASI_HTTP_0_2_0_TYPES_HEADER_ERROR_INVALID_SYNTAX: - case WASI_HTTP_0_2_0_TYPES_HEADER_ERROR_FORBIDDEN: + case WASI_HTTP_TYPES_HEADER_ERROR_INVALID_SYNTAX: + case WASI_HTTP_TYPES_HEADER_ERROR_FORBIDDEN: return Result::err(154); - case WASI_HTTP_0_2_0_TYPES_HEADER_ERROR_IMMUTABLE: + case WASI_HTTP_TYPES_HEADER_ERROR_IMMUTABLE: MOZ_ASSERT_UNREACHABLE("Headers should not be immutable"); default: MOZ_ASSERT_UNREACHABLE("Unknown header error type"); @@ -563,8 +499,8 @@ Result HttpHeaders::remove(string_view name) { auto hdr = string_view_to_world_string(name); Borrow borrow(this->handle_state_.get()); - wasi_http_0_2_0_types_header_error_t err; - if (!wasi_http_0_2_0_types_method_fields_delete(borrow, &hdr, &err)) { + wasi_http_types_header_error_t err; + if (!wasi_http_types_method_fields_delete(borrow, &hdr, &err)) { // TODO: handle `err` return Result::err(154); } @@ -580,17 +516,17 @@ string_view HttpRequestResponseBase::url() { Borrow borrow(handle_state_.get()); - wasi_http_0_2_0_types_scheme_t scheme; + wasi_http_types_scheme_t scheme; bool success; - success = wasi_http_0_2_0_types_method_incoming_request_scheme(borrow, &scheme); + success = wasi_http_types_method_incoming_request_scheme(borrow, &scheme); MOZ_RELEASE_ASSERT(success); bindings_string_t authority; - success = wasi_http_0_2_0_types_method_incoming_request_authority(borrow, &authority); + success = wasi_http_types_method_incoming_request_authority(borrow, &authority); MOZ_RELEASE_ASSERT(success); bindings_string_t path; - success = wasi_http_0_2_0_types_method_incoming_request_path_with_query(borrow, &path); + success = wasi_http_types_method_incoming_request_path_with_query(borrow, &path); MOZ_RELEASE_ASSERT(success); HostString scheme_str = scheme_to_string(scheme); @@ -605,10 +541,10 @@ string_view HttpRequestResponseBase::url() { bool write_to_outgoing_body(Borrow borrow, const uint8_t *ptr, const size_t len) { // The write call doesn't mutate the buffer; the cast is just for the // generated bindings. - wasi_io_0_2_0_streams_list_u8_t list{const_cast(ptr), len}; - wasi_io_0_2_0_streams_stream_error_t err; + bindings_list_u8_t list{const_cast(ptr), len}; + wasi_io_streams_stream_error_t err; // TODO: proper error handling. - return wasi_io_0_2_0_streams_method_output_stream_write(borrow, &list, &err); + return wasi_io_streams_method_output_stream_write(borrow, &list, &err); } HttpOutgoingBody::HttpOutgoingBody(std::unique_ptr state) : Pollable() { @@ -623,56 +559,88 @@ Result HttpOutgoingBody::capacity() { auto *state = static_cast(this->handle_state_.get()); Borrow borrow(state->stream_handle_); uint64_t capacity = 0; - wasi_io_0_2_0_streams_stream_error_t err; - if (!wasi_io_0_2_0_streams_method_output_stream_check_write(borrow, &capacity, &err)) { + wasi_io_streams_stream_error_t err; + if (!wasi_io_streams_method_output_stream_check_write(borrow, &capacity, &err)) { return Result::err(154); } return Result::ok(capacity); } -Result HttpOutgoingBody::write(const uint8_t *bytes, size_t len) { - auto res = capacity(); - if (res.is_err()) { - // TODO: proper error handling for all 154 error codes. - return Result::err(154); - } - auto capacity = res.unwrap(); - auto bytes_to_write = std::min(len, static_cast(capacity)); +void HttpOutgoingBody::write(const uint8_t *bytes, size_t len) { + MOZ_ASSERT(capacity().unwrap() >= len); auto *state = static_cast(this->handle_state_.get()); Borrow borrow(state->stream_handle_); - if (!write_to_outgoing_body(borrow, bytes, bytes_to_write)) { - return Result::err(154); - } - - return Result::ok(bytes_to_write); + MOZ_RELEASE_ASSERT(write_to_outgoing_body(borrow, bytes, len)); } -Result HttpOutgoingBody::write_all(const uint8_t *bytes, size_t len) { - if (!valid()) { - // TODO: proper error handling for all 154 error codes. - return Result::err(154); +class BodyWriteAllTask final : public api::AsyncTask { + HttpOutgoingBody *outgoing_body_; + PollableHandle outgoing_pollable_; + + api::TaskCompletionCallback cb_; + Heap cb_receiver_; + HostBytes bytes_; + size_t offset_ = 0; + +public: + explicit BodyWriteAllTask(HttpOutgoingBody *outgoing_body, HostBytes bytes, + api::TaskCompletionCallback completion_callback, + HandleObject callback_receiver) + : outgoing_body_(outgoing_body), cb_(completion_callback), + cb_receiver_(callback_receiver), bytes_(std::move(bytes)) { + outgoing_pollable_ = outgoing_body_->subscribe().unwrap(); } - auto *state = static_cast(handle_state_.get()); - Borrow borrow(state->stream_handle_); + [[nodiscard]] bool run(api::Engine *engine) override { + MOZ_ASSERT(offset_ < bytes_.len); + while (true) { + auto res = outgoing_body_->capacity(); + if (res.is_err()) { + return false; + } + uint64_t capacity = res.unwrap(); + if (capacity == 0) { + engine->queue_async_task(this); + return true; + } - while (len > 0) { - auto capacity_res = capacity(); - if (capacity_res.is_err()) { - // TODO: proper error handling for all 154 error codes. - return Result::err(154); - } - auto capacity = capacity_res.unwrap(); - auto bytes_to_write = std::min(len, static_cast(capacity)); - if (!write_to_outgoing_body(borrow, bytes, len)) { - return Result::err(154); + auto bytes_to_write = std::min(bytes_.len - offset_, static_cast(capacity)); + outgoing_body_->write(bytes_.ptr.get() + offset_, bytes_to_write); + offset_ += bytes_to_write; + MOZ_ASSERT(offset_ <= bytes_.len); + if (offset_ == bytes_.len) { + bytes_.ptr.reset(); + RootedObject receiver(engine->cx(), cb_receiver_); + bool result = cb_(engine->cx(), receiver); + cb_ = nullptr; + cb_receiver_ = nullptr; + return result; + } } + } + + [[nodiscard]] bool cancel(api::Engine *engine) override { + MOZ_ASSERT_UNREACHABLE("BodyWriteAllTask's semantics don't allow for cancellation"); + return true; + } + + [[nodiscard]] int32_t id() override { + return outgoing_pollable_; + } - bytes += bytes_to_write; - len -= bytes_to_write; + void trace(JSTracer *trc) override { + JS::TraceEdge(trc, &cb_receiver_, "BodyWriteAllTask completion callback receiver"); } +}; +Result HttpOutgoingBody::write_all(api::Engine *engine, HostBytes bytes, + api::TaskCompletionCallback callback, HandleObject cb_receiver) { + if (!valid()) { + // TODO: proper error handling for all 154 error codes. + return Result::err(154); + } + engine->queue_async_task(new BodyWriteAllTask(this, std::move(bytes), callback, cb_receiver)); return {}; } @@ -691,10 +659,10 @@ class BodyAppendTask final : public api::AsyncTask { PollableHandle outgoing_pollable_; api::TaskCompletionCallback cb_; - Heap cb_receiver_; + Heap cb_receiver_; State state_; - void set_state(JSContext* cx, const State state) { + void set_state(JSContext *cx, const State state) { MOZ_ASSERT(state_ != State::Done); state_ = state; if (state == State::Done && cb_) { @@ -706,24 +674,14 @@ class BodyAppendTask final : public api::AsyncTask { } public: - explicit BodyAppendTask(api::Engine *engine, - HttpIncomingBody *incoming_body, + explicit BodyAppendTask(api::Engine *engine, HttpIncomingBody *incoming_body, HttpOutgoingBody *outgoing_body, api::TaskCompletionCallback completion_callback, HandleObject callback_receiver) - : incoming_body_(incoming_body), outgoing_body_(outgoing_body), - cb_(completion_callback) { - auto res = incoming_body_->subscribe(); - MOZ_ASSERT(!res.is_err()); - incoming_pollable_ = res.unwrap(); - - res = outgoing_body_->subscribe(); - MOZ_ASSERT(!res.is_err()); - outgoing_pollable_ = res.unwrap(); - - cb_receiver_ = callback_receiver; - - set_state(engine->cx(), State::BlockedOnBoth); + : incoming_body_(incoming_body), outgoing_body_(outgoing_body), cb_(completion_callback), + cb_receiver_(callback_receiver), state_(State::BlockedOnBoth) { + incoming_pollable_ = incoming_body_->subscribe().unwrap(); + outgoing_pollable_ = outgoing_body_->subscribe().unwrap(); } [[nodiscard]] bool run(api::Engine *engine) override { @@ -740,19 +698,17 @@ class BodyAppendTask final : public api::AsyncTask { set_state(engine->cx(), State::BlockedOnOutgoing); } - uint64_t capacity = 0; - if (state_ == State::BlockedOnOutgoing) { - auto res = outgoing_body_->capacity(); - if (res.is_err()) { - return false; - } - capacity = res.unwrap(); - if (capacity > 0) { - set_state(engine->cx(), State::Ready); - } else { - engine->queue_async_task(this); - return true; - } + MOZ_ASSERT(state_ == State::BlockedOnOutgoing); + auto res = outgoing_body_->capacity(); + if (res.is_err()) { + return false; + } + uint64_t capacity = res.unwrap(); + if (capacity > 0) { + set_state(engine->cx(), State::Ready); + } else { + engine->queue_async_task(this); + return true; } MOZ_ASSERT(state_ == State::Ready); @@ -771,17 +727,8 @@ class BodyAppendTask final : public api::AsyncTask { return true; } - unsigned offset = 0; - while (bytes.len - offset > 0) { - // TODO: remove double checking of write-readiness - // TODO: make this async by storing the remaining chunk in the task and marking it as - // being blocked on write - auto write_res = outgoing_body_->write(bytes.ptr.get() + offset, bytes.len - offset); - if (write_res.is_err()) { - // TODO: proper error handling. - return false; - } - offset += write_res.unwrap(); + if (bytes.len > 0) { + outgoing_body_->write(bytes.ptr.get(), bytes.len); } if (done) { @@ -823,7 +770,8 @@ class BodyAppendTask final : public api::AsyncTask { }; Result HttpOutgoingBody::append(api::Engine *engine, HttpIncomingBody *other, - api::TaskCompletionCallback callback, HandleObject callback_receiver) { + api::TaskCompletionCallback callback, + HandleObject callback_receiver) { engine->queue_async_task(new BodyAppendTask(engine, other, this, callback, callback_receiver)); return {}; } @@ -835,23 +783,23 @@ Result HttpOutgoingBody::close() { Borrow borrow{state->stream_handle_}; { - wasi_io_0_2_0_streams_stream_error_t err; - bool success = wasi_io_0_2_0_streams_method_output_stream_blocking_flush(borrow, &err); + wasi_io_streams_stream_error_t err; + bool success = wasi_io_streams_method_output_stream_blocking_flush(borrow, &err); if (!success) { // TODO: validate that this condition applies if `content-length` bytes were written, and // the host has auto-closed the body. - MOZ_RELEASE_ASSERT(err.tag == WASI_IO_0_2_0_STREAMS_STREAM_ERROR_CLOSED); + MOZ_RELEASE_ASSERT(err.tag == WASI_IO_STREAMS_STREAM_ERROR_CLOSED); } } if (state->pollable_handle_ != INVALID_POLLABLE_HANDLE) { - wasi_io_0_2_0_poll_pollable_drop_own(own_pollable_t{state->pollable_handle_}); + wasi_io_poll_pollable_drop_own(own_pollable_t{state->pollable_handle_}); } - wasi_io_0_2_0_streams_output_stream_drop_own({state->stream_handle_}); + wasi_io_streams_output_stream_drop_own({state->stream_handle_}); { - wasi_http_0_2_0_types_error_code_t err; - wasi_http_0_2_0_types_static_outgoing_body_finish({state->take()}, nullptr, &err); + wasi_http_types_error_code_t err; + wasi_http_types_static_outgoing_body_finish({state->take()}, nullptr, &err); // TODO: handle `err` } @@ -861,7 +809,7 @@ Result HttpOutgoingBody::subscribe() { auto state = static_cast(handle_state_.get()); if (state->pollable_handle_ == INVALID_POLLABLE_HANDLE) { Borrow borrow(state->stream_handle_); - state->pollable_handle_ = wasi_io_0_2_0_streams_method_output_stream_subscribe(borrow).__handle; + state->pollable_handle_ = wasi_io_streams_method_output_stream_subscribe(borrow).__handle; } return Result::ok(state->pollable_handle_); } @@ -871,42 +819,44 @@ void HttpOutgoingBody::unsubscribe() { if (state->pollable_handle_ == INVALID_POLLABLE_HANDLE) { return; } - wasi_io_0_2_0_poll_pollable_drop_own(own_pollable_t{state->pollable_handle_}); + wasi_io_poll_pollable_drop_own(own_pollable_t{state->pollable_handle_}); state->pollable_handle_ = INVALID_POLLABLE_HANDLE; } static const char *http_method_names[9] = {"GET", "HEAD", "POST", "PUT", "DELETE", "CONNECT", "OPTIONS", "TRACE", "PATCH"}; -wasi_http_0_2_0_types_method_t http_method_to_host(string_view method_str) { +wasi_http_types_method_t http_method_to_host(string_view method_str) { if (method_str.empty()) { - return wasi_http_0_2_0_types_method_t{WASI_HTTP_0_2_0_TYPES_METHOD_GET}; + return wasi_http_types_method_t{WASI_HTTP_TYPES_METHOD_GET}; } auto method = method_str.begin(); - for (uint8_t i = 0; i < WASI_HTTP_0_2_0_TYPES_METHOD_OTHER; i++) { + for (uint8_t i = 0; i < WASI_HTTP_TYPES_METHOD_OTHER; i++) { auto name = http_method_names[i]; if (strcasecmp(method, name) == 0) { - return wasi_http_0_2_0_types_method_t{i}; + return wasi_http_types_method_t{i}; } } auto val = bindings_string_t{reinterpret_cast(const_cast(method)), method_str.length()}; - return wasi_http_0_2_0_types_method_t{WASI_HTTP_0_2_0_TYPES_METHOD_OTHER, {val}}; + return wasi_http_types_method_t{WASI_HTTP_TYPES_METHOD_OTHER, {val}}; } -HttpOutgoingRequest::HttpOutgoingRequest(std::unique_ptr state) { this->handle_state_ = std::move(state); } +HttpOutgoingRequest::HttpOutgoingRequest(std::unique_ptr state) { + this->handle_state_ = std::move(state); +} HttpOutgoingRequest *HttpOutgoingRequest::make(string_view method_str, optional url_str, std::unique_ptr headers) { bindings_string_t path_with_query; - wasi_http_0_2_0_types_scheme_t scheme; + wasi_http_types_scheme_t scheme; bindings_string_t authority; bindings_string_t *maybe_path_with_query = nullptr; - wasi_http_0_2_0_types_scheme_t *maybe_scheme = nullptr; + wasi_http_types_scheme_t *maybe_scheme = nullptr; bindings_string_t *maybe_authority = nullptr; if (url_str) { @@ -914,11 +864,11 @@ HttpOutgoingRequest *HttpOutgoingRequest::make(string_view method_str, optional< jsurl::JSUrl *url = new_jsurl(&val); jsurl::SpecSlice protocol = jsurl::protocol(url); if (std::memcmp(protocol.data, "http:", protocol.len) == 0) { - scheme.tag = WASI_HTTP_0_2_0_TYPES_SCHEME_HTTP; + scheme.tag = WASI_HTTP_TYPES_SCHEME_HTTP; } else if (std::memcmp(protocol.data, "https:", protocol.len) == 0) { - scheme.tag = WASI_HTTP_0_2_0_TYPES_SCHEME_HTTPS; + scheme.tag = WASI_HTTP_TYPES_SCHEME_HTTPS; } else { - scheme.tag = WASI_HTTP_0_2_0_TYPES_SCHEME_OTHER; + scheme.tag = WASI_HTTP_TYPES_SCHEME_OTHER; scheme.val = {const_cast(protocol.data), protocol.len - 1}; } maybe_scheme = &scheme; @@ -934,23 +884,22 @@ HttpOutgoingRequest *HttpOutgoingRequest::make(string_view method_str, optional< } auto headers_handle = WASIHandle::cast(headers->handle_state_.get())->take(); - auto handle = - wasi_http_0_2_0_types_constructor_outgoing_request(headers_handle); + auto handle = wasi_http_types_constructor_outgoing_request(headers_handle); { - auto borrow = wasi_http_0_2_0_types_borrow_outgoing_request(handle); + auto borrow = wasi_http_types_borrow_outgoing_request(handle); // TODO: error handling on result auto method = http_method_to_host(method_str); - wasi_http_0_2_0_types_method_outgoing_request_set_method(borrow, &method); + wasi_http_types_method_outgoing_request_set_method(borrow, &method); // TODO: error handling on result - wasi_http_0_2_0_types_method_outgoing_request_set_scheme(borrow, maybe_scheme); + wasi_http_types_method_outgoing_request_set_scheme(borrow, maybe_scheme); // TODO: error handling on result - wasi_http_0_2_0_types_method_outgoing_request_set_authority(borrow, maybe_authority); + wasi_http_types_method_outgoing_request_set_authority(borrow, maybe_authority); // TODO: error handling on result - wasi_http_0_2_0_types_method_outgoing_request_set_path_with_query(borrow, + wasi_http_types_method_outgoing_request_set_path_with_query(borrow, maybe_path_with_query); } @@ -960,9 +909,7 @@ HttpOutgoingRequest *HttpOutgoingRequest::make(string_view method_str, optional< return resp; } -Result HttpOutgoingRequest::method() { - return Result::ok(method_); -} +Result HttpOutgoingRequest::method() { return Result::ok(method_); } Result HttpOutgoingRequest::headers() { if (!headers_) { @@ -970,8 +917,9 @@ Result HttpOutgoingRequest::headers() { return Result::err(154); } Borrow borrow(handle_state_.get()); - auto res = wasi_http_0_2_0_types_method_outgoing_request_headers(borrow); - headers_ = new HttpHeadersReadOnly(std::unique_ptr(new WASIHandle(res))); + auto res = wasi_http_types_method_outgoing_request_headers(borrow); + headers_ = + new HttpHeadersReadOnly(std::unique_ptr(new WASIHandle(res))); } return Result::ok(headers_); @@ -982,7 +930,7 @@ Result HttpOutgoingRequest::body() { if (!this->body_) { outgoing_body_t body; Borrow borrow(handle_state_.get()); - if (!wasi_http_0_2_0_types_method_outgoing_request_body(borrow, &body)) { + if (!wasi_http_types_method_outgoing_request_body(borrow, &body)) { return Res::err(154); } body_ = new HttpOutgoingBody(std::unique_ptr(new OutgoingBodyHandle(body))); @@ -993,20 +941,23 @@ Result HttpOutgoingRequest::body() { Result HttpOutgoingRequest::send() { typedef Result Res; future_incoming_response_t ret; - wasi_http_0_2_0_outgoing_handler_error_code_t err; + wasi_http_outgoing_handler_error_code_t err; auto request_handle = WASIHandle::cast(handle_state_.get())->take(); - if (!wasi_http_0_2_0_outgoing_handler_handle(request_handle, nullptr, &ret, &err)) { + if (!wasi_http_outgoing_handler_handle(request_handle, nullptr, &ret, &err)) { return Res::err(154); } - auto res = new FutureHttpIncomingResponse(std::unique_ptr(new WASIHandle(ret))); + auto res = new FutureHttpIncomingResponse( + std::unique_ptr(new WASIHandle(ret))); return Result::ok(res); } void block_on_pollable_handle(PollableHandle handle) { - wasi_io_0_2_0_poll_method_pollable_block({handle}); + wasi_io_poll_method_pollable_block({handle}); } -HttpIncomingBody::HttpIncomingBody(std::unique_ptr state) : Pollable() { handle_state_ = std::move(state); } +HttpIncomingBody::HttpIncomingBody(std::unique_ptr state) : Pollable() { + handle_state_ = std::move(state); +} Resource::~Resource() { if (handle_state_ != nullptr) { @@ -1021,13 +972,13 @@ bool Resource::valid() const { Result HttpIncomingBody::read(uint32_t chunk_size) { typedef Result Res; - wasi_io_0_2_0_streams_list_u8_t ret{}; - wasi_io_0_2_0_streams_stream_error_t err{}; + bindings_list_u8_t ret{}; + wasi_io_streams_stream_error_t err{}; auto body_handle = IncomingBodyHandle::cast(handle_state_.get()); auto borrow = Borrow(body_handle->stream_handle_); - bool success = wasi_io_0_2_0_streams_method_input_stream_read(borrow, chunk_size, &ret, &err); + bool success = wasi_io_streams_method_input_stream_read(borrow, chunk_size, &ret, &err); if (!success) { - if (err.tag == WASI_IO_0_2_0_STREAMS_STREAM_ERROR_CLOSED) { + if (err.tag == WASI_IO_STREAMS_STREAM_ERROR_CLOSED) { return Res::ok(ReadResult(true, nullptr, 0)); } return Res::err(154); @@ -1041,7 +992,7 @@ Result HttpIncomingBody::close() { return {}; } Result HttpIncomingBody::subscribe() { auto body_handle = IncomingBodyHandle::cast(handle_state_.get()); auto borrow = Borrow(body_handle->stream_handle_); - auto pollable = wasi_io_0_2_0_streams_method_input_stream_subscribe(borrow); + auto pollable = wasi_io_streams_method_input_stream_subscribe(borrow); return Result::ok(pollable.__handle); } void HttpIncomingBody::unsubscribe() { @@ -1049,7 +1000,7 @@ void HttpIncomingBody::unsubscribe() { if (state->pollable_handle_ == INVALID_POLLABLE_HANDLE) { return; } - wasi_io_0_2_0_poll_pollable_drop_own(own_pollable_t{state->pollable_handle_}); + wasi_io_poll_pollable_drop_own(own_pollable_t{state->pollable_handle_}); state->pollable_handle_ = INVALID_POLLABLE_HANDLE; } @@ -1057,12 +1008,11 @@ FutureHttpIncomingResponse::FutureHttpIncomingResponse(std::unique_ptr> FutureHttpIncomingResponse::maybe_response() { typedef Result> Res; - wasi_http_0_2_0_types_result_result_own_incoming_response_error_code_void_t res; + wasi_http_types_result_result_own_incoming_response_error_code_void_t res; Borrow borrow(handle_state_.get()); - if (!wasi_http_0_2_0_types_method_future_incoming_response_get(borrow, &res)) { + if (!wasi_http_types_method_future_incoming_response_get(borrow, &res)) { return Res::ok(std::nullopt); } @@ -1080,16 +1030,14 @@ Result> FutureHttpIncomingResponse::maybe_respo Result FutureHttpIncomingResponse::subscribe() { Borrow borrow(handle_state_.get()); - auto pollable = wasi_http_0_2_0_types_method_future_incoming_response_subscribe(borrow); + auto pollable = wasi_http_types_method_future_incoming_response_subscribe(borrow); return Result::ok(pollable.__handle); } void FutureHttpIncomingResponse::unsubscribe() { // TODO: implement } -HttpHeadersReadOnly::HttpHeadersReadOnly() { - handle_state_ = nullptr; -} +HttpHeadersReadOnly::HttpHeadersReadOnly() { handle_state_ = nullptr; } HttpHeadersReadOnly::HttpHeadersReadOnly(std::unique_ptr state) { handle_state_ = std::move(state); @@ -1101,7 +1049,7 @@ Result HttpIncomingResponse::status() { return Result::err(154); } auto borrow = Borrow(handle_state_.get()); - status_ = wasi_http_0_2_0_types_method_incoming_response_status(borrow); + status_ = wasi_http_types_method_incoming_response_status(borrow); } return Result::ok(status_); } @@ -1116,7 +1064,7 @@ Result HttpIncomingResponse::headers() { return Result::err(154); } auto borrow = Borrow(handle_state_.get()); - auto res = wasi_http_0_2_0_types_method_incoming_response_headers(borrow); + auto res = wasi_http_types_method_incoming_response_headers(borrow); auto state = new WASIHandle(res); headers_ = new HttpHeadersReadOnly(std::unique_ptr(state)); } @@ -1131,7 +1079,7 @@ Result HttpIncomingResponse::body() { } auto borrow = Borrow(handle_state_.get()); incoming_body_t body; - if (!wasi_http_0_2_0_types_method_incoming_response_consume(borrow, &body)) { + if (!wasi_http_types_method_incoming_response_consume(borrow, &body)) { return Result::err(154); } body_ = new HttpIncomingBody(std::unique_ptr(new IncomingBodyHandle(body))); @@ -1139,11 +1087,14 @@ Result HttpIncomingResponse::body() { return Result::ok(body_); } -HttpOutgoingResponse::HttpOutgoingResponse(std::unique_ptr state) { this->handle_state_ = std::move(state); } +HttpOutgoingResponse::HttpOutgoingResponse(std::unique_ptr state) { + this->handle_state_ = std::move(state); +} -HttpOutgoingResponse *HttpOutgoingResponse::make(const uint16_t status, unique_ptr headers) { +HttpOutgoingResponse *HttpOutgoingResponse::make(const uint16_t status, + unique_ptr headers) { auto owned_headers = WASIHandle::cast(headers->handle_state_.get())->take(); - auto handle = wasi_http_0_2_0_types_constructor_outgoing_response(owned_headers); + auto handle = wasi_http_types_constructor_outgoing_response(owned_headers); auto *state = new WASIHandle(handle); auto *resp = new HttpOutgoingResponse(std::unique_ptr(state)); @@ -1151,7 +1102,8 @@ HttpOutgoingResponse *HttpOutgoingResponse::make(const uint16_t status, unique_p // Set the status if (status != 200) { // The DOM implementation is expected to have validated the status code already. - MOZ_RELEASE_ASSERT(wasi_http_0_2_0_types_method_outgoing_response_set_status_code(state->borrow(), status)); + MOZ_RELEASE_ASSERT( + wasi_http_types_method_outgoing_response_set_status_code(state->borrow(), status)); } resp->status_ = status; @@ -1164,7 +1116,7 @@ Result HttpOutgoingResponse::headers() { return Result::err(154); } auto borrow = Borrow(handle_state_.get()); - auto res = wasi_http_0_2_0_types_method_outgoing_response_headers(borrow); + auto res = wasi_http_types_method_outgoing_response_headers(borrow); auto state = new WASIHandle(res); headers_ = new HttpHeadersReadOnly(std::unique_ptr(state)); } @@ -1177,7 +1129,7 @@ Result HttpOutgoingResponse::body() { if (!this->body_) { auto borrow = Borrow(handle_state_.get()); outgoing_body_t body; - if (!wasi_http_0_2_0_types_method_outgoing_response_body(borrow, &body)) { + if (!wasi_http_types_method_outgoing_response_body(borrow, &body)) { return Res::err(154); } body_ = new HttpOutgoingBody(std::unique_ptr(new OutgoingBodyHandle(body))); @@ -1197,9 +1149,9 @@ Result HttpIncomingRequest::method() { } } auto borrow = Borrow(handle_state_.get()); - wasi_http_0_2_0_types_method_t method; - wasi_http_0_2_0_types_method_incoming_request_method(borrow, &method); - if (method.tag != WASI_HTTP_0_2_0_TYPES_METHOD_OTHER) { + wasi_http_types_method_t method; + wasi_http_types_method_incoming_request_method(borrow, &method); + if (method.tag != WASI_HTTP_TYPES_METHOD_OTHER) { method_ = std::string(http_method_names[method.tag], strlen(http_method_names[method.tag])); } else { method_ = std::string(reinterpret_cast(method.val.other.ptr), method.val.other.len); @@ -1214,7 +1166,7 @@ Result HttpIncomingRequest::headers() { return Result::err(154); } auto borrow = Borrow(handle_state_.get()); - auto res = wasi_http_0_2_0_types_method_incoming_request_headers(borrow); + auto res = wasi_http_types_method_incoming_request_headers(borrow); auto state = new WASIHandle(res); headers_ = new HttpHeadersReadOnly(std::unique_ptr(state)); } @@ -1229,7 +1181,7 @@ Result HttpIncomingRequest::body() { } auto borrow = Borrow(handle_state_.get()); incoming_body_t body; - if (!wasi_http_0_2_0_types_method_incoming_request_consume(borrow, &body)) { + if (!wasi_http_types_method_incoming_request_consume(borrow, &body)) { return Result::err(154); } body_ = new HttpIncomingBody(std::unique_ptr(new IncomingBodyHandle(body))); @@ -1237,9 +1189,11 @@ Result HttpIncomingRequest::body() { return Result::ok(body_); } +// Gcore FastEdge API extensions + +/* // Used for debugging and logging bindings_string_t values // Un-comment the following code to enable debugging -/* std::ostream& operator<<(std::ostream& os, const bindings_string_t& str) { os << "ptr: "; for (size_t i = 0; i < str.len; ++i) { @@ -1260,6 +1214,29 @@ HostString get_env_vars(std::string_view name) { return bindings_string_to_host_string(value_str); } +HostString get_secret_vars(std::string_view name) { + auto key_str = string_view_to_world_string(name); + bindings_option_string_t ret{}; + gcore_fastedge_secret_error_t err; + auto has_value = gcore_fastedge_secret_get(&key_str, &ret, &err); + if (has_value && ret.is_some) { + return bindings_string_to_host_string(ret.val); + } + return nullptr; +} + +HostString get_secret_vars_effective_at(std::string_view name, uint32_t effective_at) { + auto key_str = string_view_to_world_string(name); + bindings_option_string_t ret{}; + gcore_fastedge_secret_error_t err; + auto has_value = gcore_fastedge_secret_get_effective_at(&key_str, effective_at, &ret, &err); + if (has_value && ret.is_some) { + return bindings_string_to_host_string(ret.val); + } + return nullptr; +} + + } // namespace host_api static host_api::HttpIncomingRequest::RequestHandler REQUEST_HANDLER = nullptr; @@ -1271,20 +1248,30 @@ void host_api::HttpIncomingRequest::set_handler(RequestHandler handler) { } host_api::Result host_api::HttpOutgoingResponse::send() { - wasi_http_0_2_0_types_result_own_outgoing_response_error_code_t result; + wasi_http_types_result_own_outgoing_response_error_code_t result; auto own = WASIHandle::cast(this->handle_state_.get())->take(); result.is_err = false; result.val.ok = own; - wasi_http_0_2_0_types_static_response_outparam_set(RESPONSE_OUT, &result); + wasi_http_types_static_response_outparam_set(RESPONSE_OUT, &result); return {}; } +extern "C" bool init_from_environment(); + void exports_wasi_http_incoming_handler(exports_wasi_http_incoming_request request_handle, exports_wasi_http_response_outparam response_out) { + // If StarlingMonkey hasn't been pre-initialized, no request handler will be installed yet. + // The embedding must provide an implementation of the `init_from_environment()` hook and ensure + // that it properly initializes the runtime and installs a request handler. + if (!REQUEST_HANDLER) { + init_from_environment(); + } + MOZ_ASSERT(REQUEST_HANDLER); + RESPONSE_OUT = response_out; auto state = new WASIHandle(request_handle); auto *request = new host_api::HttpIncomingRequest(std::unique_ptr(state)); diff --git a/runtime/fastedge/host-api/host_api_fastedge.h b/runtime/fastedge/host-api/host_api_fastedge.h index 2237bc2..bf34788 100644 --- a/runtime/fastedge/host-api/host_api_fastedge.h +++ b/runtime/fastedge/host-api/host_api_fastedge.h @@ -31,6 +31,8 @@ struct JSErrorFormatString; namespace host_api { HostString get_env_vars(std::string_view name); +HostString get_secret_vars(std::string_view name); +HostString get_secret_vars_effective_at(std::string_view name, uint32_t effective_at); } // namespace host_api diff --git a/runtime/fastedge/host-api/include/exports.h b/runtime/fastedge/host-api/include/exports.h index 642ba28..3e32a5c 100644 --- a/runtime/fastedge/host-api/include/exports.h +++ b/runtime/fastedge/host-api/include/exports.h @@ -1,12 +1,10 @@ #ifndef WASI_PREVIEW2_EXPORTS #define WASI_PREVIEW2_EXPORTS -#define exports_wasi_http_incoming_handler exports_wasi_http_0_2_0_incoming_handler_handle +#define exports_wasi_http_incoming_handler exports_wasi_http_incoming_handler_handle #define exports_wasi_http_incoming_request \ - exports_wasi_http_0_2_0_incoming_handler_own_incoming_request_t + exports_wasi_http_incoming_handler_own_incoming_request_t #define exports_wasi_http_response_outparam \ - exports_wasi_http_0_2_0_incoming_handler_own_response_outparam_t - -#define exports_wasi_cli_run_run exports_wasi_cli_0_2_0_run_run + exports_wasi_http_incoming_handler_own_response_outparam_t #endif diff --git a/runtime/fastedge/host-api/wit/deps/fastedge/secret.wit b/runtime/fastedge/host-api/wit/deps/fastedge/secret.wit new file mode 100644 index 0000000..dc07a11 --- /dev/null +++ b/runtime/fastedge/host-api/wit/deps/fastedge/secret.wit @@ -0,0 +1,20 @@ +interface secret { + /// Get the secret associated with the specified `key` efective at current timestamp. + /// Returns `ok(none)` if the key does not exist. + get: func(key: string) -> result, error>; + + /// Get the secret associated with the specified `key` effective `at` given timestamp in seconds. + /// Returns `ok(none)` if the key does not exist. + get-effective-at: func(key: string, at: u32) -> result, error>; + + /// The set of errors which may be raised by functions in this interface + variant error { + /// The requesting component does not have access to the specified key + /// (which may or may not exist). + access-denied, + /// Decryption error. + decrypt-error, + /// Some implementation-specific error has occurred (e.g. I/O) + other(string) + } +} diff --git a/runtime/fastedge/host-api/wit/deps/fastedge/world.wit b/runtime/fastedge/host-api/wit/deps/fastedge/world.wit index 1080979..29d741f 100644 --- a/runtime/fastedge/host-api/wit/deps/fastedge/world.wit +++ b/runtime/fastedge/host-api/wit/deps/fastedge/world.wit @@ -2,4 +2,5 @@ package gcore:fastedge; world imports { import dictionary; + import secret; } diff --git a/src/componentize/es-bundle.js b/src/componentize/es-bundle.js index 1ef578b..e185f5d 100644 --- a/src/componentize/es-bundle.js +++ b/src/componentize/es-bundle.js @@ -15,6 +15,14 @@ const fastedgePackagePlugin = { case 'fs': { return { contents: `export const readFileSync = globalThis.fastedge.readFileSync;` }; } + case 'secret': { + return { + contents: ` + export const getSecret = globalThis.fastedge.getSecret; + export const getSecretEffectiveAt = globalThis.fastedge.getSecretEffectiveAt; + `, + }; + } default: { return { contents: '' }; } diff --git a/src/componentize/index.js b/src/componentize/index.js index c318d37..5f2a627 100644 --- a/src/componentize/index.js +++ b/src/componentize/index.js @@ -11,26 +11,32 @@ import { addWasmMetadata } from './add-wasm-metadata.js'; import { getJsInputContents } from './get-js-input.js'; import { precompile } from './precompile.js'; -import { getTmpDir, npxPackagePath, resolveTmpDir } from '~utils/file-system.js'; +import { + getTmpDir, + npxPackagePath, + resolveOsPath, + resolveTmpDir, + useUnixPath, +} from '~utils/file-system.js'; import { validateFilePaths } from '~utils/input-path-verification.js'; async function componentize(jsInput, output, opts = {}) { const { debug = false, - wasmEngine = await npxPackagePath('./lib/fastedge-runtime.wasm'), + wasmEngine = npxPackagePath('./lib/fastedge-runtime.wasm'), enableStdout = false, enablePBL = false, preBundleJSInput = true, } = opts; - const jsPath = fileURLToPath(new URL(resolve(process.cwd(), jsInput), import.meta.url)); + const jsPath = resolveOsPath(process.cwd(), jsInput); + + const wasmOutputDir = resolveOsPath(process.cwd(), output); - const wasmOutputDir = fileURLToPath(new URL(resolve(process.cwd(), output), import.meta.url)); await validateFilePaths(jsPath, wasmOutputDir, wasmEngine); const contents = await getJsInputContents(jsPath, preBundleJSInput); - // todo: farq: Can I remove this step?? regex collection? const application = precompile(contents); // Create a temporary file @@ -50,15 +56,15 @@ async function componentize(jsInput, output, opts = {}) { `--wasm-bulk-memory=true`, '--inherit-env=true', '--dir=.', - // '--dir=../', // todo: Farq: NEED to iterate config file and add these paths for static building... - `--dir=${dirname(wizerInput)}`, + // '--dir=../', // Farq: NEED to iterate config file and add these paths for static building... + `--dir=${useUnixPath(dirname(wizerInput))}`, '-r _start=wizer.resume', - `-o=${wasmOutputDir}`, - wasmEngine, + `-o=${useUnixPath(wasmOutputDir)}`, + useUnixPath(wasmEngine), ], { stdio: [null, process.stdout, process.stderr], - input: wizerInput, + input: useUnixPath(wizerInput), shell: true, encoding: 'utf-8', env: { @@ -85,9 +91,7 @@ async function componentize(jsInput, output, opts = {}) { } const coreComponent = await readFile(output); - const adapter = fileURLToPath( - new URL(npxPackagePath('./lib/preview1-adapter.wasm'), import.meta.url), - ); + const adapter = npxPackagePath('./lib/preview1-adapter.wasm'); const generatedComponent = await componentNew(coreComponent, [ ['wasi_snapshot_preview1', await readFile(adapter)], diff --git a/src/componentize/index.test.js b/src/componentize/index.test.js index 8aa0bf4..803dbec 100644 --- a/src/componentize/index.test.js +++ b/src/componentize/index.test.js @@ -1,7 +1,6 @@ import { spawnSync } from 'node:child_process'; import { rmSync } from 'node:fs'; import { readFile, writeFile } from 'node:fs/promises'; -import { fileURLToPath } from 'node:url'; import { componentNew } from '@bytecodealliance/jco'; @@ -29,14 +28,6 @@ jest.mock('./get-js-input', () => ({ getJsInputContents: jest.fn().mockReturnValue('{_user_provided_js_content_}'), })); -jest.mock('node:url', () => ({ - fileURLToPath: jest - .fn() - .mockReturnValueOnce('input.js') - .mockReturnValueOnce('output.wasm') - .mockReturnValue('./lib/wasi_snapshot_preview1.reactor.wasm'), -})); - // This is just mocked here.. Integration tests from fastedge-build will test this in detail jest.mock('~utils/input-path-verification', () => ({ validateFilePaths: jest.fn().mockResolvedValue(), @@ -66,16 +57,14 @@ describe('componentize', () => { }); it('should handle componentization process correctly', async () => { - expect.assertions(11); + expect.assertions(10); await componentize('input.js', 'output.wasm'); - expect(fileURLToPath).toHaveBeenCalledTimes(3); expect(validateFilePaths).toHaveBeenCalledWith( 'input.js', 'output.wasm', 'root_dir/lib/fastedge-runtime.wasm', ); - expect(getJsInputContents).toHaveBeenCalledWith('input.js', true); expect(precompile).toHaveBeenCalledWith('{_user_provided_js_content_}'); expect(spawnSync).toHaveBeenCalledWith( @@ -104,7 +93,7 @@ describe('componentize', () => { expect(rmSync).toHaveBeenCalledWith('tmp_dir', { recursive: true }); expect(readFile).toHaveBeenNthCalledWith(1, 'output.wasm'); - expect(readFile).toHaveBeenNthCalledWith(2, './lib/wasi_snapshot_preview1.reactor.wasm'); + expect(readFile).toHaveBeenNthCalledWith(2, 'root_dir/lib/preview1-adapter.wasm'); expect(componentNew).toHaveBeenCalledWith('generated_binary', [ ['wasi_snapshot_preview1', 'preview_wasm'], diff --git a/src/fastedge-build/config-build/build-manifest/create-manifest.js b/src/fastedge-build/config-build/build-manifest/create-manifest.js index 07b0030..e71603c 100644 --- a/src/fastedge-build/config-build/build-manifest/create-manifest.js +++ b/src/fastedge-build/config-build/build-manifest/create-manifest.js @@ -82,9 +82,9 @@ function createManifestFileMap(config) { return { assetKey, ...contentTypeInfo, - // fileInfo: createFileInfo(assetKey, config.publicDir, file), + // Farq: fileInfo: createFileInfo(assetKey, config.publicDir, file), fileInfo, - // todo: fix these.. to our shape + // Farq: fix these.. to our shape lastModifiedTime: fileInfo.lastModifiedTime, type: 'wasm-inline', }; @@ -94,7 +94,7 @@ function createManifestFileMap(config) { const staticAssetManifest = {}; for (const assetInfo of manifestAssets) { - // todo: Do other build things here?? + // Do other build things here?? // or should the above loop become a reduce? staticAssetManifest[assetInfo.assetKey] = assetInfo; } diff --git a/src/fastedge-build/config-build/index.js b/src/fastedge-build/config-build/index.js index fb34cd6..3478a2c 100644 --- a/src/fastedge-build/config-build/index.js +++ b/src/fastedge-build/config-build/index.js @@ -1,10 +1,10 @@ -import path from 'node:path'; +import { pathToFileURL } from 'node:url'; import { createStaticManifest } from './build-manifest/create-static-manifest.js'; import { buildWasm } from './build-wasm.js'; import { normalizeBuildConfig } from '~utils/config-helpers.js'; -import { isFile } from '~utils/file-system.js'; +import { isFile, resolveOsPath } from '~utils/file-system.js'; import { colorLog } from '~utils/prompts.js'; async function buildFromConfig(config) { @@ -22,7 +22,7 @@ async function buildFromConfig(config) { break; } case 'next': { - console.log('Farq: next build - Not yet implemented'); + colorLog('info', 'Farq: next build - Not yet implemented'); break; } default: { @@ -36,7 +36,8 @@ async function loadConfig(configPath) { try { const configFileExists = await isFile(configPath); if (configFileExists) { - const { config } = await import(/* webpackChunkName: "config" */ configPath); + const configUrlPath = pathToFileURL(configPath).href; + const { config } = await import(/* webpackChunkName: "config" */ configUrlPath); return normalizeBuildConfig(config); } colorLog('error', `Error: Config file not found at ${configPath}. Skipping build.`); @@ -48,7 +49,7 @@ async function loadConfig(configPath) { async function buildFromConfigFiles(configFilePaths = []) { for (const configFilePath of configFilePaths) { - const configPath = path.resolve(configFilePath); + const configPath = resolveOsPath(configFilePath); // Await in loop is correct, it must run sequentially - it overwrites files within each build cycle // eslint-disable-next-line no-await-in-loop await buildFromConfig(await loadConfig(configPath)); diff --git a/src/utils/__mocks__/file-system.js b/src/utils/__mocks__/file-system.js index f8116be..3fe4957 100644 --- a/src/utils/__mocks__/file-system.js +++ b/src/utils/__mocks__/file-system.js @@ -6,4 +6,8 @@ const getTmpDir = async () => 'tmp_dir'; const resolveTmpDir = (filePath) => path.join('temp_root', 'temp.bundle.js'); -export { getTmpDir, npxPackagePath, resolveTmpDir }; +const resolveOsPath = (base, providedPath) => providedPath; + +const useUnixPath = (path) => path; + +export { getTmpDir, npxPackagePath, resolveOsPath, resolveTmpDir, useUnixPath }; diff --git a/src/utils/file-system.js b/src/utils/file-system.js index e85ff21..636a712 100644 --- a/src/utils/file-system.js +++ b/src/utils/file-system.js @@ -1,18 +1,37 @@ import { readdirSync } from 'node:fs'; import { mkdir, mkdtemp, readdir, stat } from 'node:fs/promises'; import { tmpdir } from 'node:os'; -import path from 'node:path'; +import path, { resolve } from 'node:path'; import { fileURLToPath } from 'node:url'; import { colorLog } from './prompts.js'; +/** + * + * Normalizes and resolves the path for unix/windows compatibility + * @param {Array} paths + * @returns {string} path + */ +const resolveOsPath = (...paths) => path.normalize(resolve(...paths)); + +/** + * + * Replaces backslashes with forward slashes - wizer requires unix paths + * @param {string} path + * @returns {string} path + */ +const useUnixPath = (path) => path.replace(/\\/gu, '/'); + /** * * @param {string} filePath * @returns {string} npxPackagePath */ const npxPackagePath = (filePath) => { - const __dirname = path.dirname(fileURLToPath(import.meta.url)).replace(/\/bin([^/]*)$/u, ''); + const __dirname = path + .dirname(fileURLToPath(import.meta.url)) + .replace(/[\\/]bin([\\/][^\\/]*)?$/u, ''); + try { return path.resolve(__dirname, filePath); } catch { @@ -120,5 +139,7 @@ export { isDirectory, isFile, npxPackagePath, + resolveOsPath, resolveTmpDir, + useUnixPath, }; diff --git a/types/fastedge-secret.d.ts b/types/fastedge-secret.d.ts new file mode 100644 index 0000000..efbd234 --- /dev/null +++ b/types/fastedge-secret.d.ts @@ -0,0 +1,58 @@ +declare module 'fastedge::secret' { + /** + * Function to get the value for the provided secret variable name. + * + * **Note**: The secret variables can only be retrieved when processing requests, not during build-time initialization. + * + * @param {string} name - The name of the secret variable. + * @returns {string} The value of the secret variable. + * + * @example + * ```js + * /// + * + * import { getSecret } from "fastedge::secret"; + * + * function app(event) { + * console.log("PASSWORD:", getSecret("PASSWORD")); + * console.log("SECRET_TOKEN", getSecret("SECRET_TOKEN")); + * + * return new Response("", { + * status: 200 + * }); + * } + * + * addEventListener("fetch", event => event.respondWith(app(event))); + * ``` + */ + function getSecret(name: string): string; + + /** + * Function to get the value for the provided secret variable name from a specific slot. + * + * **Note**: The secret variables can only be retrieved when processing requests, not during build-time initialization. + * + * @param {string} name - The name of the secret variable. + * @param {number} effectiveAt - The slot index of the secret. (effectiveAt >= secret_slots.slot) + * @returns {string} The value of the secret variable. + * + * @example + * ```js + * /// + * + * import { getSecretEffectiveAt } from "fastedge::secret"; + * + * function app(event) { + * console.log("PASSWORD:", getSecretEffectiveAt("PASSWORD", 1)); // Using slot indices + * console.log("SECRET_TOKEN", getSecretEffectiveAt("SECRET_TOKEN", 1745698356)); // Using slot indices as unix time stamps + * + * return new Response("", { + * status: 200 + * }); + * } + * + * addEventListener("fetch", event => event.respondWith(app(event))); + * ``` + */ + function getSecretEffectiveAt(name: string, effectiveAt: number): string; +} diff --git a/types/index.d.ts b/types/index.d.ts index d671a62..a96842e 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -1,6 +1,7 @@ /// /// /// +/// import { AssetCache } from './static-server/assets/asset-cache.d.ts'; import { StaticAssetManifest } from './static-server/assets/static-assets.d.ts';