diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml index cc51ffa3e5..c93e94380b 100644 --- a/.github/workflows/dependencies.yml +++ b/.github/workflows/dependencies.yml @@ -11,5 +11,5 @@ jobs: steps: - uses: actions/dependency-review-action@v2.2.0 with: - allow-licenses: Apache-2.0, MIT, BSD-3-Clause, ISC, BSD-2-Clause, MIT OR (CC0-1.0 AND MIT), CC0-1.0 OR MIT OR (CC0-1.0 AND MIT), CC-BY-3.0, CC0-1.0, MIT OR Apache-2.0, MIT AND Apache-2.0, MIT OR WTFPL, BSD-2-Clause OR (MIT OR Apache-2.0), Python-2.0, ISC AND MIT, Apache-2.0 AND MIT, MIT/Apache-2.0, Apache-2.0 OR MIT, (Apache-2.0 OR MIT) AND BSD-3-Clause, Zlib OR Apache-2.0 OR MIT, MIT OR Apache-2.0 OR Zlib, MIT OR (Apache-2.0 OR Zlib) + allow-licenses: Apache-2.0, MIT, BSD-3-Clause, ISC, BSD-2-Clause, MIT OR (CC0-1.0 AND MIT), CC0-1.0 OR MIT OR (CC0-1.0 AND MIT), CC-BY-3.0, CC0-1.0, MIT OR Apache-2.0, MIT AND Apache-2.0, MIT OR WTFPL, BSD-2-Clause OR (MIT OR Apache-2.0), Python-2.0, ISC AND MIT, Apache-2.0 AND MIT, MIT/Apache-2.0, Apache-2.0 OR MIT, (Apache-2.0 OR MIT) AND BSD-3-Clause, Zlib OR Apache-2.0 OR MIT, MIT OR Apache-2.0 OR Zlib, MIT OR (Apache-2.0 OR Zlib), (Apache-2.0 WITH LLVM-exception) fail-on-scopes: runtime diff --git a/integration-tests/js-compute/fixtures/app/src/dynamic-backend.js b/integration-tests/js-compute/fixtures/app/src/dynamic-backend.js index ba86a40f7c..46e0f40f53 100644 --- a/integration-tests/js-compute/fixtures/app/src/dynamic-backend.js +++ b/integration-tests/js-compute/fixtures/app/src/dynamic-backend.js @@ -278,7 +278,6 @@ routes.set("/backend/timeout", async () => { // constructor { - routes.set("/backend/constructor/called-as-regular-function", async () => { let error = assertThrows(() => { Backend() @@ -1386,6 +1385,64 @@ routes.set("/backend/timeout", async () => { return pass('ok') }); } + + // clientCertificate property + { + routes.set("/backend/constructor/parameter-clientCertificate-property-invalid", async () => { + let error = assertThrows(() => { + new Backend({ name: 'clientCertificate-clientCertificate-property-invalid', target: 'a', clientCertificate: "" }) + }, TypeError, `Backend constructor: clientCertificate must be an object containing 'certificate' and 'key' properties`) + if (error) { return error } + return pass('ok') + }); + routes.set("/backend/constructor/parameter-clientCertificate-certificate-property-missing", async () => { + let error = assertThrows(() => { + new Backend({ name: 'clientCertificate-clientCertificate-certificate-property-missing', target: 'a', clientCertificate: {} }) + }, TypeError, `Backend constructor: clientCertificate 'certificate' must be a certificate string`) + if (error) { return error } + return pass('ok') + }); + routes.set("/backend/constructor/parameter-clientCertificate-certificate-property-invalid", async () => { + let error = assertThrows(() => { + new Backend({ name: 'clientCertificate-clientCertificate-certificate-property-invalid', target: 'a', clientCertificate: { certificate: "" } }) + }, TypeError, `Backend constructor: clientCertificate 'certificate' can not be an empty string`) + if (error) { return error } + return pass('ok') + }); + routes.set("/backend/constructor/parameter-clientCertificate-key-property-missing", async () => { + let error = assertThrows(() => { + new Backend({ name: 'clientCertificate-clientCertificate-key-property-missing', target: 'a', clientCertificate: { certificate: "a" } }) + }, TypeError, `Backend constructor: clientCertificate 'key' must be a SecretStoreEntry instance`) + if (error) { return error } + return pass('ok') + }); + routes.set("/backend/constructor/parameter-clientCertificate-key-property-invalid", async () => { + let error = assertThrows(() => { + new Backend({ name: 'clientCertificate-clientCertificate-key-property-invalid', target: 'a', clientCertificate: { certificate: "a", key: "" } }) + }, TypeError, `Backend constructor: clientCertificate 'key' must be a SecretStoreEntry instance`) + if (error) { return error } + return pass('ok') + }); + routes.set("/backend/constructor/parameter-clientCertificate-key-property-fake", async () => { + let error = assertThrows(() => { + new Backend({ name: 'clientCertificate-clientCertificate-key-property-fake', target: 'a', clientCertificate: { certificate: "a", key: Object.create(SecretStoreEntry.prototype) } }) + }, TypeError, `Backend constructor: clientCertificate 'key' must be a SecretStoreEntry instance`) + if (error) { return error } + return pass('ok') + }); + routes.set("/backend/constructor/parameter-clientCertificate-valid", async () => { + if (isRunningLocally()) { + return pass('ok') + } + let backend = new Backend({ name: 'clientCertificate-clientCertificate-valid', target: 'http-me.glitch.me', clientCertificate: { certificate: "a", key: SecretStore.fromBytes(new Uint8Array([1, 2, 3])) } }) + let res = await fetch('https://http-me.glitch.me/headers', { + backend, + cacheOverride: new CacheOverride("pass"), + }) + console.error(res); + return pass('ok') + }); + } } // exists diff --git a/integration-tests/js-compute/fixtures/app/src/secret-store.js b/integration-tests/js-compute/fixtures/app/src/secret-store.js index 340a52468d..e41c469193 100644 --- a/integration-tests/js-compute/fixtures/app/src/secret-store.js +++ b/integration-tests/js-compute/fixtures/app/src/secret-store.js @@ -117,7 +117,7 @@ import fc from './fast-check.js'; routes.set("/secret-store/get/called-as-constructor", () => { let error = assertThrows(() => { new SecretStore.prototype.get('1') - }, TypeError, `SecretStore.prototype.get is not a constructor`) + }, TypeError) if (error) { return error } return pass() }); @@ -238,6 +238,37 @@ import fc from './fast-check.js'; return pass() }); } + + // SecretStore.fromBytes static method + { + routes.set("/secret-store/from-bytes/invalid", async () => { + let error = assertThrows(() => { + SecretStore.fromBytes("blah") + }, TypeError, `SecretStore.fromBytes: bytes must be an ArrayBuffer or ArrayBufferView object`) + if (error) { return error } + return pass() + }); + routes.set("/secret-store/from-bytes/valid", async () => { + let result, error; + result = SecretStore.fromBytes(new Uint8Array([1, 2, 3])); + error = assert(result instanceof SecretStoreEntry, true, `(SecretStore.fromBytes(Uint8Array) instanceof SecretStoreEntry)`) + if (error) { return error } + error = assert(result.rawBytes(), new Uint8Array([1, 2, 3]), `(SecretStore.fromBytes(Uint8Array).rawBytes() === Uint8Array)`) + if (error) { return error } + result = SecretStore.fromBytes(new Uint16Array([4, 5, 6])); + error = assert(result instanceof SecretStoreEntry, true, `(SecretStore.fromBytes(Uint16Array) instanceof SecretStoreEntry)`) + if (error) { return error } + // (can rely on Wasm being little endian) + error = assert(result.rawBytes(), new Uint8Array([4, 0, 5, 0, 6, 0]), `(SecretStore.fromBytes(Uint16Array).rawBytes() === Uint8Array)`) + if (error) { return error } + result = SecretStore.fromBytes(new Uint16Array([7, 8, 9]).buffer); + error = assert(result instanceof SecretStoreEntry, true, `(SecretStore.fromBytes(ArrayBuffer) instanceof SecretStoreEntry)`) + if (error) { return error } + error = assert(result.rawBytes(), new Uint8Array([7, 0, 8, 0, 9, 0]), `(SecretStore.fromBytes(ArrayBuffer).rawBytes() === Uint8Array)`) + if (error) { return error } + return pass() + }); + } } // SecretStoreEntry { @@ -290,7 +321,7 @@ function SecretStoreEntryInterfaceTests() { if (error) { return error } actual = Reflect.ownKeys(SecretStoreEntry.prototype) - expected = ["constructor", "plaintext"] + expected = ["constructor", "plaintext", "rawBytes"] error = assert(actual, expected, `Reflect.ownKeys(SecretStoreEntry.prototype)`) if (error) { return error } @@ -354,7 +385,7 @@ function SecretStoreEntryInterfaceTests() { function SecretStoreInterfaceTests() { let actual = Reflect.ownKeys(SecretStore) - let expected = ["prototype", "length", "name"] + let expected = ["prototype", "fromBytes", "length", "name"] let error = assert(actual, expected, `Reflect.ownKeys(SecretStore)`) if (error) { return error } diff --git a/integration-tests/js-compute/fixtures/app/tests-starlingmonkey.json b/integration-tests/js-compute/fixtures/app/tests-starlingmonkey.json index 17fb9cf154..2e48d0ee4f 100644 --- a/integration-tests/js-compute/fixtures/app/tests-starlingmonkey.json +++ b/integration-tests/js-compute/fixtures/app/tests-starlingmonkey.json @@ -10,6 +10,28 @@ "GET /cache-override/constructor/valid-mode", "GET /cache-override/fetch/mode-none", "GET /cache-override/fetch/mode-pass", + "GET /secret-store/exposed-as-global", + "GET /secret-store/interface", + "GET /secret-store/constructor/called-as-regular-function", + "GET /secret-store/constructor/parameter-calls-7.1.17-ToString", + "GET /secret-store/constructor/empty-parameter", + "GET /secret-store/constructor/found-store", + "GET /secret-store/constructor/missing-store", + "GET /secret-store/constructor/invalid-name", + "GET /secret-store/get/called-as-constructor", + "GET /secret-store/get/called-unbound", + "GET /secret-store/get/key-parameter-calls-7.1.17-ToString", + "GET /secret-store/get/key-parameter-not-supplied", + "GET /secret-store/get/key-parameter-empty-string", + "GET /secret-store/get/key-parameter-255-character-string", + "GET /secret-store/get/key-parameter-256-character-string", + "GET /secret-store/get/key-parameter-invalid-string", + "GET /secret-store/get/key-does-not-exist-returns-null", + "GET /secret-store/get/key-exists", + "GET /secret-store/from-bytes/invalid", + "GET /secret-store/from-bytes/valid", + "GET /secret-store-entry/interface", + "GET /secret-store-entry/plaintext", "GET /simple-cache/interface", "GET /simple-store/constructor/called-as-regular-function", "GET /simple-cache/constructor/throws", @@ -258,6 +280,13 @@ "GET /backend/constructor/parameter-sniHostname-property-empty-string", "GET /backend/constructor/parameter-sniHostname-property-calls-7.1.17-ToString", "GET /backend/constructor/parameter-sniHostname-property-valid-string", + "GET /backend/constructor/parameter-clientCertificate-property-invalid", + "GET /backend/constructor/parameter-clientCertificate-certificate-property-missing", + "GET /backend/constructor/parameter-clientCertificate-certificate-property-invalid", + "GET /backend/constructor/parameter-clientCertificate-key-property-missing", + "GET /backend/constructor/parameter-clientCertificate-key-property-invalid", + "GET /backend/constructor/parameter-clientCertificate-key-property-fake", + "GET /backend/constructor/parameter-clientCertificate-valid", "GET /backend/health/called-as-constructor-function", "GET /backend/health/empty-parameter", "GET /backend/health/parameter-calls-7.1.17-ToString", diff --git a/integration-tests/js-compute/fixtures/app/tests.json b/integration-tests/js-compute/fixtures/app/tests.json index a373361d3c..3e07e35ca5 100644 --- a/integration-tests/js-compute/fixtures/app/tests.json +++ b/integration-tests/js-compute/fixtures/app/tests.json @@ -117,6 +117,226 @@ "status": 200 } }, + "GET /secret-store/exposed-as-global": { + "environments": ["viceroy", "compute"], + "downstream_request": { + "method": "GET", + "pathname": "/secret-store/exposed-as-global" + }, + "downstream_response": { + "status": 200 + } + }, + "GET /secret-store/interface": { + "environments": ["viceroy", "compute"], + "downstream_request": { + "method": "GET", + "pathname": "/secret-store/interface" + }, + "downstream_response": { + "status": 200 + } + }, + "GET /secret-store/constructor/called-as-regular-function": { + "environments": ["viceroy", "compute"], + "downstream_request": { + "method": "GET", + "pathname": "/secret-store/constructor/called-as-regular-function" + }, + "downstream_response": { + "status": 200 + } + }, + "GET /secret-store/constructor/parameter-calls-7.1.17-ToString": { + "environments": ["viceroy", "compute"], + "downstream_request": { + "method": "GET", + "pathname": "/secret-store/constructor/parameter-calls-7.1.17-ToString" + }, + "downstream_response": { + "status": 200 + } + }, + "GET /secret-store/constructor/empty-parameter": { + "environments": ["viceroy", "compute"], + "downstream_request": { + "method": "GET", + "pathname": "/secret-store/constructor/empty-parameter" + }, + "downstream_response": { + "status": 200 + } + }, + "GET /secret-store/constructor/found-store": { + "environments": ["viceroy", "compute"], + "downstream_request": { + "method": "GET", + "pathname": "/secret-store/constructor/found-store" + }, + "downstream_response": { + "status": 200 + } + }, + "GET /secret-store/constructor/missing-store": { + "environments": ["viceroy", "compute"], + "downstream_request": { + "method": "GET", + "pathname": "/secret-store/constructor/missing-store" + }, + "downstream_response": { + "status": 200 + } + }, + "GET /secret-store/constructor/invalid-name": { + "environments": ["viceroy", "compute"], + "downstream_request": { + "method": "GET", + "pathname": "/secret-store/constructor/invalid-name" + }, + "downstream_response": { + "status": 200 + } + }, + "GET /secret-store/get/called-as-constructor": { + "environments": ["viceroy", "compute"], + "downstream_request": { + "method": "GET", + "pathname": "/secret-store/get/called-as-constructor" + }, + "downstream_response": { + "status": 200 + } + }, + "GET /secret-store/get/called-unbound": { + "environments": ["viceroy", "compute"], + "downstream_request": { + "method": "GET", + "pathname": "/secret-store/get/called-unbound" + }, + "downstream_response": { + "status": 200 + } + }, + "GET /secret-store/get/key-parameter-calls-7.1.17-ToString": { + "environments": ["viceroy", "compute"], + "downstream_request": { + "method": "GET", + "pathname": "/secret-store/get/key-parameter-calls-7.1.17-ToString" + }, + "downstream_response": { + "status": 200 + } + }, + "GET /secret-store/get/key-parameter-not-supplied": { + "environments": ["viceroy", "compute"], + "downstream_request": { + "method": "GET", + "pathname": "/secret-store/get/key-parameter-not-supplied" + }, + "downstream_response": { + "status": 200 + } + }, + "GET /secret-store/get/key-parameter-empty-string": { + "environments": ["viceroy", "compute"], + "downstream_request": { + "method": "GET", + "pathname": "/secret-store/get/key-parameter-empty-string" + }, + "downstream_response": { + "status": 200 + } + }, + "GET /secret-store/get/key-parameter-255-character-string": { + "environments": ["viceroy", "compute"], + "downstream_request": { + "method": "GET", + "pathname": "/secret-store/get/key-parameter-255-character-string" + }, + "downstream_response": { + "status": 200 + } + }, + "GET /secret-store/get/key-parameter-256-character-string": { + "environments": ["viceroy", "compute"], + "downstream_request": { + "method": "GET", + "pathname": "/secret-store/get/key-parameter-256-character-string" + }, + "downstream_response": { + "status": 200 + } + }, + "GET /secret-store/get/key-parameter-invalid-string": { + "environments": ["viceroy", "compute"], + "downstream_request": { + "method": "GET", + "pathname": "/secret-store/get/key-parameter-invalid-string" + }, + "downstream_response": { + "status": 200 + } + }, + "GET /secret-store/get/key-does-not-exist-returns-null": { + "environments": ["viceroy", "compute"], + "downstream_request": { + "method": "GET", + "pathname": "/secret-store/get/key-does-not-exist-returns-null" + }, + "downstream_response": { + "status": 200 + } + }, + "GET /secret-store/get/key-exists": { + "environments": ["viceroy", "compute"], + "downstream_request": { + "method": "GET", + "pathname": "/secret-store/get/key-exists" + }, + "downstream_response": { + "status": 200 + } + }, + "GET /secret-store/from-bytes/invalid": { + "environments": ["viceroy", "compute"], + "downstream_request": { + "method": "GET", + "pathname": "/secret-store/from-bytes/invalid" + }, + "downstream_response": { + "status": 200 + } + }, + "GET /secret-store/from-bytes/valid": { + "environments": ["viceroy", "compute"], + "downstream_request": { + "method": "GET", + "pathname": "/secret-store/from-bytes/valid" + }, + "downstream_response": { + "status": 200 + } + }, + "GET /secret-store-entry/interface": { + "environments": ["viceroy", "compute"], + "downstream_request": { + "method": "GET", + "pathname": "/secret-store-entry/interface" + }, + "downstream_response": { + "status": 200 + } + }, + "GET /secret-store-entry/plaintext": { + "environments": ["viceroy", "compute"], + "downstream_request": { + "method": "GET", + "pathname": "/secret-store-entry/plaintext" + }, + "downstream_response": { + "status": 200 + } + }, "GET /simple-cache/interface": { "environments": ["viceroy", "compute"], "downstream_request": { @@ -2802,6 +3022,83 @@ "body": "ok" } }, + "GET /backend/constructor/parameter-clientCertificate-property-invalid": { + "environments": ["viceroy", "compute"], + "downstream_request": { + "method": "GET", + "pathname": "/backend/constructor/parameter-clientCertificate-property-invalid" + }, + "downstream_response": { + "status": 200, + "body": "ok" + } + }, + "GET /backend/constructor/parameter-clientCertificate-certificate-property-missing": { + "environments": ["viceroy", "compute"], + "downstream_request": { + "method": "GET", + "pathname": "/backend/constructor/parameter-clientCertificate-certificate-property-missing" + }, + "downstream_response": { + "status": 200, + "body": "ok" + } + }, + "GET /backend/constructor/parameter-clientCertificate-certificate-property-invalid": { + "environments": ["viceroy", "compute"], + "downstream_request": { + "method": "GET", + "pathname": "/backend/constructor/parameter-clientCertificate-certificate-property-invalid" + }, + "downstream_response": { + "status": 200, + "body": "ok" + } + }, + "GET /backend/constructor/parameter-clientCertificate-key-property-missing": { + "environments": ["viceroy", "compute"], + "downstream_request": { + "method": "GET", + "pathname": "/backend/constructor/parameter-clientCertificate-key-property-missing" + }, + "downstream_response": { + "status": 200, + "body": "ok" + } + }, + "GET /backend/constructor/parameter-clientCertificate-key-property-invalid": { + "environments": ["viceroy", "compute"], + "downstream_request": { + "method": "GET", + "pathname": "/backend/constructor/parameter-clientCertificate-key-property-invalid" + }, + "downstream_response": { + "status": 200, + "body": "ok" + } + }, + "GET /backend/constructor/parameter-clientCertificate-key-property-fake": { + "environments": ["viceroy", "compute"], + "downstream_request": { + "method": "GET", + "pathname": "/backend/constructor/parameter-clientCertificate-key-property-fake" + }, + "downstream_response": { + "status": 200, + "body": "ok" + } + }, + "GET /backend/constructor/parameter-clientCertificate-valid": { + "environments": ["viceroy", "compute"], + "downstream_request": { + "method": "GET", + "pathname": "/backend/constructor/parameter-clientCertificate-valid" + }, + "downstream_response": { + "status": 200, + "body": "ok" + } + }, "GET /backend/health/called-as-constructor-function": { "environments": ["viceroy", "compute"], "downstream_request": { diff --git a/package.json b/package.json index 2604851c9d..cdc7f525b2 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "unified": "^11.0.0" }, "dependencies": { - "@bytecodealliance/jco": "^0.10.0", + "@bytecodealliance/jco": "^1.2.4", "@bytecodealliance/wizer": "^3.0.1", "acorn": "^8.8.2", "acorn-walk": "^8.2.0", diff --git a/runtime/fastly/builtins/backend.cpp b/runtime/fastly/builtins/backend.cpp index 5e3badee5b..ad963c3985 100644 --- a/runtime/fastly/builtins/backend.cpp +++ b/runtime/fastly/builtins/backend.cpp @@ -19,6 +19,7 @@ #include "../host-api/host_api_fastly.h" #include "./fetch/request-response.h" +#include "./secret-store.h" #include "backend.h" #include "builtin.h" #include "encode.h" @@ -28,6 +29,7 @@ using builtins::BuiltinImpl; using fastly::fastly::Fastly; using fastly::fastly::FastlyGetErrorMessage; using fastly::fetch::RequestOrResponse; +using fastly::secret_store::SecretStoreEntry; namespace fastly::backend { @@ -775,6 +777,7 @@ JS::Result Backend::register_dynamic_backend(JSContext *cx, JS::Han auto certificate_hostname_slot = JS::GetReservedSlot(backend, Backend::Slots::CertificateHostname); if (!certificate_hostname_slot.isNullOrUndefined()) { + MOZ_ASSERT(certificate_hostname_slot.isString()); JS::RootedString certificate_hostname_string(cx, certificate_hostname_slot.toString()); auto certificate_hostname_chars = core::encode(cx, certificate_hostname_string); backend_config.cert_hostname.emplace(std::move(certificate_hostname_chars)); @@ -782,6 +785,7 @@ JS::Result Backend::register_dynamic_backend(JSContext *cx, JS::Han auto ca_certificate_slot = JS::GetReservedSlot(backend, Backend::Slots::CaCertificate); if (!ca_certificate_slot.isNullOrUndefined()) { + MOZ_ASSERT(ca_certificate_slot.isString()); JS::RootedString ca_certificate_string(cx, ca_certificate_slot.toString()); auto ca_certificate_chars = core::encode(cx, ca_certificate_string); backend_config.ca_cert.emplace(std::move(ca_certificate_chars)); @@ -789,6 +793,7 @@ JS::Result Backend::register_dynamic_backend(JSContext *cx, JS::Han auto ciphers_slot = JS::GetReservedSlot(backend, Backend::Slots::Ciphers); if (!ciphers_slot.isNullOrUndefined()) { + MOZ_ASSERT(ciphers_slot.isString()); JS::RootedString ciphers_string(cx, ciphers_slot.toString()); auto ciphers_chars = core::encode(cx, ciphers_string); backend_config.ciphers.emplace(std::move(ciphers_chars)); @@ -796,11 +801,24 @@ JS::Result Backend::register_dynamic_backend(JSContext *cx, JS::Han auto sni_hostname_slot = JS::GetReservedSlot(backend, Backend::Slots::SniHostname); if (!sni_hostname_slot.isNullOrUndefined()) { + MOZ_ASSERT(sni_hostname_slot.isString()); JS::RootedString sni_hostname_string(cx, sni_hostname_slot.toString()); auto sni_hostname_chars = core::encode(cx, sni_hostname_string); backend_config.sni_hostname.emplace(std::move(sni_hostname_chars)); } + auto client_cert_slot = JS::GetReservedSlot(backend, Backend::Slots::ClientCert); + if (!client_cert_slot.isNullOrUndefined()) { + MOZ_ASSERT(client_cert_slot.isString()); + JS::RootedString client_cert_string(cx, client_cert_slot.toString()); + auto client_cert_chars = core::encode(cx, client_cert_string); + + auto client_cert_key_slot = JS::GetReservedSlot(backend, Backend::Slots::ClientCertKey); + + backend_config.client_cert = host_api::ClientCert{ + .cert = std::move(client_cert_chars), .key = (FastlyHandle)client_cert_key_slot.toInt32()}; + } + auto res = host_api::HttpReq::register_dynamic_backend(name_str, target_str, backend_config); if (auto *err = res.to_err()) { HANDLE_ERROR(cx, *err); @@ -846,7 +864,6 @@ host_api::HostString parse_and_validate_name(JSContext *cx, JS::HandleValue name bool Backend::exists(JSContext *cx, unsigned argc, JS::Value *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - JS::RootedObject self(cx, &args.thisv().toObject()); if (!args.requireAtLeast(cx, "Backend.exists", 1)) { return false; } @@ -867,7 +884,6 @@ bool Backend::exists(JSContext *cx, unsigned argc, JS::Value *vp) { bool Backend::from_name(JSContext *cx, unsigned argc, JS::Value *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - JS::RootedObject self(cx, &args.thisv().toObject()); if (!args.requireAtLeast(cx, "Backend.fromName", 1)) { return false; } @@ -910,7 +926,6 @@ bool Backend::from_name(JSContext *cx, unsigned argc, JS::Value *vp) { bool Backend::health(JSContext *cx, unsigned argc, JS::Value *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - JS::RootedObject self(cx, &args.thisv().toObject()); if (!args.requireAtLeast(cx, "Backend.health", 1)) { return false; } @@ -1001,6 +1016,34 @@ bool Backend::set_sni_hostname(JSContext *cx, JSObject *backend, JS::HandleValue return true; } +bool Backend::set_client_cert(JSContext *cx, JSObject *backend, JS::HandleValue client_cert_val) { + auto client_cert = JS::ToString(cx, client_cert_val); + if (!client_cert) { + return false; + } + + if (JS_GetStringLength(client_cert) == 0) { + JS_ReportErrorNumberASCII(cx, FastlyGetErrorMessage, nullptr, + JSMSG_BACKEND_CLIENT_CERTIFICATE_CERTIFICATE_EMPTY); + return false; + } + JS::SetReservedSlot(backend, Backend::Slots::ClientCert, JS::StringValue(client_cert)); + return true; +} + +bool Backend::set_client_cert_key(JSContext *cx, JSObject *backend, + JS::HandleValue client_cert_key_val) { + if (!SecretStoreEntry::is_instance(client_cert_key_val)) { + JS_ReportErrorNumberASCII(cx, FastlyGetErrorMessage, nullptr, + JSMSG_BACKEND_CLIENT_CERTIFICATE_KEY_INVALID); + return false; + } + JS::RootedObject client_cert_key_obj(cx, &client_cert_key_val.toObject()); + JS::SetReservedSlot(backend, Backend::Slots::ClientCertKey, + JS::Int32Value(SecretStoreEntry::secret_handle(client_cert_key_obj).handle)); + return true; +} + /// Timeouts for backends must be less than 2^32 milliseconds, or /// about a month and a half. bool Backend::set_timeout_slot(JSContext *cx, JSObject *backend, JS::HandleValue value, @@ -1441,16 +1484,57 @@ bool Backend::constructor(JSContext *cx, unsigned argc, JS::Value *vp) { if (!JS_GetProperty(cx, configuration, "sniHostname", &sni_hostname_val)) { return false; } - auto sni_hostname = JS::ToString(cx, sni_hostname_val); - if (!sni_hostname) { + if (!Backend::set_sni_hostname(cx, backend, sni_hostname_val)) { + return false; + } + } + + JS::RootedValue client_cert_val(cx); + if (!JS_HasProperty(cx, configuration, "clientCertificate", &found)) { + return false; + } + if (found) { + if (!JS_GetProperty(cx, configuration, "clientCertificate", &client_cert_val)) { + return false; + } + if (!client_cert_val.isObject()) { + JS_ReportErrorNumberASCII(cx, FastlyGetErrorMessage, nullptr, + JSMSG_BACKEND_CLIENT_CERTIFICATE_NOT_OBJECT); + return false; + } + JS::RootedObject client_cert_obj(cx, &client_cert_val.toObject()); + + JS::RootedValue client_cert_cert_val(cx); + if (!JS_HasProperty(cx, client_cert_obj, "certificate", &found)) { return false; } - if (JS_GetStringLength(sni_hostname) == 0) { + if (!found) { JS_ReportErrorNumberASCII(cx, FastlyGetErrorMessage, nullptr, - JSMSG_BACKEND_SNI_HOSTNAME_EMPTY); + JSMSG_BACKEND_CLIENT_CERTIFICATE_NO_CERTIFICATE); + return false; + } + if (!JS_GetProperty(cx, client_cert_obj, "certificate", &client_cert_cert_val)) { + return false; + } + if (!Backend::set_client_cert(cx, backend, client_cert_cert_val)) { + return false; + } + + JS::RootedValue client_cert_key_val(cx); + if (!JS_HasProperty(cx, client_cert_obj, "key", &found)) { + return false; + } + if (!found) { + JS_ReportErrorNumberASCII(cx, FastlyGetErrorMessage, nullptr, + JSMSG_BACKEND_CLIENT_CERTIFICATE_KEY_INVALID); + return false; + } + if (!JS_GetProperty(cx, client_cert_obj, "key", &client_cert_key_val)) { + return false; + } + if (!Backend::set_client_cert_key(cx, backend, client_cert_key_val)) { return false; } - JS::SetReservedSlot(backend, Backend::Slots::SniHostname, JS::StringValue(sni_hostname)); } auto result = Backend::register_dynamic_backend(cx, backend); diff --git a/runtime/fastly/builtins/backend.h b/runtime/fastly/builtins/backend.h index a5a6e41c6e..9b7b3b34d3 100644 --- a/runtime/fastly/builtins/backend.h +++ b/runtime/fastly/builtins/backend.h @@ -26,6 +26,8 @@ class Backend : public builtins::BuiltinImpl { Ciphers, SniHostname, DontPool, + ClientCert, + ClientCertKey, Count }; @@ -47,6 +49,9 @@ class Backend : public builtins::BuiltinImpl { static bool set_host_override(JSContext *cx, JSObject *backend, JS::HandleValue hostOverride_val); static bool set_sni_hostname(JSContext *cx, JSObject *backend, JS::HandleValue sniHostname_val); static bool set_name(JSContext *cx, JSObject *backend, JS::HandleValue name_val); + static bool set_client_cert(JSContext *cx, JSObject *backend, JS::HandleValue client_cert_val); + static bool set_client_cert_key(JSContext *cx, JSObject *backend, + JS::HandleValue client_cert_key_val); // static methods static bool exists(JSContext *cx, unsigned argc, JS::Value *vp); diff --git a/runtime/fastly/builtins/secret-store.cpp b/runtime/fastly/builtins/secret-store.cpp index 30d4af17e7..2facccc14e 100644 --- a/runtime/fastly/builtins/secret-store.cpp +++ b/runtime/fastly/builtins/secret-store.cpp @@ -28,7 +28,9 @@ bool SecretStoreEntry::plaintext(JSContext *cx, unsigned argc, JS::Value *vp) { return false; } - JS::RootedString text(cx, JS_NewStringCopyUTF8N(cx, JS::UTF8Chars(ret->begin(), ret->size()))); + JS::RootedString text( + cx, + JS_NewStringCopyUTF8N(cx, JS::UTF8Chars(reinterpret_cast(ret->ptr.get()), ret->len))); if (!text) { return false; } @@ -37,6 +39,39 @@ bool SecretStoreEntry::plaintext(JSContext *cx, unsigned argc, JS::Value *vp) { return true; } +bool SecretStoreEntry::raw_bytes(JSContext *cx, unsigned argc, JS::Value *vp) { + METHOD_HEADER(0) + + // Ensure that we throw an exception for all unexpected host errors. + auto res = SecretStoreEntry::secret_handle(self).plaintext(); + if (auto *err = res.to_err()) { + HANDLE_ERROR(cx, *err); + return false; + } + + auto ret = std::move(res.unwrap()); + if (!ret.has_value()) { + return false; + } + + JS::RootedObject array_buffer( + cx, JS::NewArrayBufferWithContents(cx, ret->len, ret->ptr.get(), + JS::NewArrayBufferOutOfMemory::CallerMustFreeMemory)); + if (!array_buffer) { + JS_ReportOutOfMemory(cx); + return false; + } + + // `array_buffer` now owns `metadata` + static_cast(ret->ptr.release()); + + JS::RootedObject uint8_array(cx, JS_NewUint8ArrayWithBuffer(cx, array_buffer, 0, ret->len)); + + args.rval().setObject(*uint8_array); + + return true; +} + const JSFunctionSpec SecretStoreEntry::static_methods[] = { JS_FS_END, }; @@ -46,7 +81,8 @@ const JSPropertySpec SecretStoreEntry::static_properties[] = { }; const JSFunctionSpec SecretStoreEntry::methods[] = { - JS_FN("plaintext", plaintext, 0, JSPROP_ENUMERATE), JS_FS_END}; + JS_FN("plaintext", plaintext, 0, JSPROP_ENUMERATE), + JS_FN("rawBytes", raw_bytes, 0, JSPROP_ENUMERATE), JS_FS_END}; const JSPropertySpec SecretStoreEntry::properties[] = {JS_PS_END}; @@ -136,7 +172,63 @@ bool SecretStore::get(JSContext *cx, unsigned argc, JS::Value *vp) { return true; } +bool SecretStore::from_bytes(JSContext *cx, unsigned argc, JS::Value *vp) { + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + if (!args.requireAtLeast(cx, "SecretStore.fromBytes", 1)) { + return false; + } + auto bytes = args.get(0); + if (!bytes.isObject()) { + JS_ReportErrorNumberASCII(cx, FastlyGetErrorMessage, nullptr, + JSMSG_SECRET_STORE_FROM_BYTES_INVALID_BUFFER); + return false; + } + + JS::RootedObject bytes_obj(cx, &bytes.toObject()); + + if (!JS::IsArrayBufferObject(bytes_obj) && !JS_IsArrayBufferViewObject(bytes_obj)) { + JS_ReportErrorNumberASCII(cx, FastlyGetErrorMessage, nullptr, + JSMSG_SECRET_STORE_FROM_BYTES_INVALID_BUFFER); + return false; + } + + mozilla::Maybe maybeNoGC; + uint8_t *buf; + size_t length; + if (JS_IsArrayBufferViewObject(bytes_obj)) { + JS::AutoCheckCannotGC noGC; + bool is_shared; + length = JS_GetArrayBufferViewByteLength(bytes_obj); + buf = (uint8_t *)JS_GetArrayBufferViewData(bytes_obj, &is_shared, noGC); + MOZ_ASSERT(!is_shared); + } else if (JS::IsArrayBufferObject(bytes_obj)) { + bool is_shared; + JS::GetArrayBufferLengthAndData(bytes_obj, &length, &is_shared, (uint8_t **)&buf); + } else { + JS_ReportErrorNumberASCII(cx, FastlyGetErrorMessage, nullptr, + JSMSG_SECRET_STORE_FROM_BYTES_INVALID_BUFFER); + return false; + } + + JS::RootedObject entry( + cx, JS_NewObjectWithGivenProto(cx, &SecretStoreEntry::class_, SecretStoreEntry::proto_obj)); + if (!entry) { + return false; + } + + auto res = host_api::SecretStore::from_bytes(buf, length); + if (auto *err = res.to_err()) { + HANDLE_ERROR(cx, *err); + return false; + } + + JS::SetReservedSlot(entry, Slots::Handle, JS::Int32Value(res.unwrap().handle)); + args.rval().setObject(*entry); + return true; +} + const JSFunctionSpec SecretStore::static_methods[] = { + JS_FN("fromBytes", from_bytes, 1, JSPROP_ENUMERATE), JS_FS_END, }; diff --git a/runtime/fastly/builtins/secret-store.h b/runtime/fastly/builtins/secret-store.h index 5138f442a3..15122ee9d2 100644 --- a/runtime/fastly/builtins/secret-store.h +++ b/runtime/fastly/builtins/secret-store.h @@ -19,6 +19,7 @@ class SecretStoreEntry : public builtins::BuiltinImpl { static const JSPropertySpec properties[]; static bool plaintext(JSContext *cx, unsigned argc, JS::Value *vp); + static bool raw_bytes(JSContext *cx, unsigned argc, JS::Value *vp); static host_api::Secret secret_handle(JSObject *obj); static bool constructor(JSContext *cx, unsigned argc, JS::Value *vp); @@ -37,6 +38,7 @@ class SecretStore : public builtins::BuiltinImpl { static const JSPropertySpec properties[]; static bool get(JSContext *cx, unsigned argc, JS::Value *vp); + static bool from_bytes(JSContext *cx, unsigned argc, JS::Value *vp); static host_api::SecretStore secret_store_handle(JSObject *obj); static bool constructor(JSContext *cx, unsigned argc, JS::Value *vp); diff --git a/runtime/fastly/host-api/component/fastly_world.c b/runtime/fastly/host-api/component/fastly_world.c index 77bd5f8a99..0586e1ca60 100644 --- a/runtime/fastly/host-api/component/fastly_world.c +++ b/runtime/fastly/host-api/component/fastly_world.c @@ -1,845 +1,403 @@ -// Generated by `wit-bindgen` 0.9.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.26.0. DO NOT EDIT! #include "fastly_world.h" +#include +#include - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_uap_user_agent_t ok; - fastly_compute_at_edge_uap_error_t err; - } val; -} fastly_world_result_fastly_compute_at_edge_uap_user_agent_fastly_compute_at_edge_uap_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_http_body_error_t err; - } val; -} fastly_world_result_void_fastly_compute_at_edge_http_body_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_http_body_body_handle_t ok; - fastly_compute_at_edge_http_body_error_t err; - } val; -} fastly_world_result_fastly_compute_at_edge_http_body_body_handle_fastly_compute_at_edge_http_body_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_list_u8_t ok; - fastly_compute_at_edge_http_body_error_t err; - } val; -} fastly_world_result_list_u8_fastly_compute_at_edge_http_body_error_t; - -typedef struct { - bool is_err; - union { - uint32_t ok; - fastly_compute_at_edge_http_body_error_t err; - } val; -} fastly_world_result_u32_fastly_compute_at_edge_http_body_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_log_handle_t ok; - fastly_compute_at_edge_log_error_t err; - } val; -} fastly_world_result_fastly_compute_at_edge_log_handle_fastly_compute_at_edge_log_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_log_error_t err; - } val; -} fastly_world_result_void_fastly_compute_at_edge_log_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_http_req_error_t err; - } val; -} fastly_world_result_void_fastly_compute_at_edge_http_req_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_list_u8_t ok; - fastly_compute_at_edge_http_req_error_t err; - } val; -} fastly_world_result_list_u8_fastly_compute_at_edge_http_req_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_string_t ok; - fastly_compute_at_edge_http_req_error_t err; - } val; -} fastly_world_result_string_fastly_compute_at_edge_http_req_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_http_req_request_handle_t ok; - fastly_compute_at_edge_http_req_error_t err; - } val; -} fastly_world_result_fastly_compute_at_edge_http_req_request_handle_fastly_compute_at_edge_http_req_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_list_string_t ok; - fastly_compute_at_edge_http_req_error_t err; - } val; -} fastly_world_result_list_string_fastly_compute_at_edge_http_req_error_t; - -typedef struct { - bool is_err; - union { - uint32_t ok; - fastly_compute_at_edge_http_req_error_t err; - } val; -} fastly_world_result_u32_fastly_compute_at_edge_http_req_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_option_list_u8_t ok; - fastly_compute_at_edge_http_req_error_t err; - } val; -} fastly_world_result_option_list_u8_fastly_compute_at_edge_http_req_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_option_list_list_u8_t ok; - fastly_compute_at_edge_http_req_error_t err; - } val; -} fastly_world_result_option_list_list_u8_fastly_compute_at_edge_http_req_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_http_req_http_version_t ok; - fastly_compute_at_edge_http_req_error_t err; - } val; -} fastly_world_result_fastly_compute_at_edge_http_req_http_version_fastly_compute_at_edge_http_req_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_http_req_response_t ok; - fastly_compute_at_edge_http_req_error_t err; - } val; -} fastly_world_result_fastly_compute_at_edge_http_req_response_fastly_compute_at_edge_http_req_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_http_req_pending_request_handle_t ok; - fastly_compute_at_edge_http_req_error_t err; - } val; -} fastly_world_result_fastly_compute_at_edge_http_req_pending_request_handle_fastly_compute_at_edge_http_req_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_option_fastly_compute_at_edge_http_req_response_t ok; - fastly_compute_at_edge_http_req_error_t err; - } val; -} fastly_world_result_option_fastly_compute_at_edge_http_req_response_fastly_compute_at_edge_http_req_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_tuple2_u32_fastly_compute_at_edge_http_req_response_t ok; - fastly_compute_at_edge_http_req_error_t err; - } val; -} fastly_world_result_tuple2_u32_fastly_compute_at_edge_http_req_response_fastly_compute_at_edge_http_req_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_tuple2_u32_fastly_compute_at_edge_http_req_response_t ok; - fastly_compute_at_edge_http_req_send_error_detail_t err; - } val; -} fastly_world_result_tuple2_u32_fastly_compute_at_edge_http_req_response_fastly_compute_at_edge_http_req_send_error_detail_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_http_resp_response_handle_t ok; - fastly_compute_at_edge_http_resp_error_t err; - } val; -} fastly_world_result_fastly_compute_at_edge_http_resp_response_handle_fastly_compute_at_edge_http_resp_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_list_string_t ok; - fastly_compute_at_edge_http_resp_error_t err; - } val; -} fastly_world_result_list_string_fastly_compute_at_edge_http_resp_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_option_string_t ok; - fastly_compute_at_edge_http_resp_error_t err; - } val; -} fastly_world_result_option_string_fastly_compute_at_edge_http_resp_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_option_list_list_u8_t ok; - fastly_compute_at_edge_http_resp_error_t err; - } val; -} fastly_world_result_option_list_list_u8_fastly_compute_at_edge_http_resp_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_http_resp_error_t err; - } val; -} fastly_world_result_void_fastly_compute_at_edge_http_resp_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_http_resp_http_version_t ok; - fastly_compute_at_edge_http_resp_error_t err; - } val; -} fastly_world_result_fastly_compute_at_edge_http_resp_http_version_fastly_compute_at_edge_http_resp_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_http_resp_http_status_t ok; - fastly_compute_at_edge_http_resp_error_t err; - } val; -} fastly_world_result_fastly_compute_at_edge_http_resp_http_status_fastly_compute_at_edge_http_resp_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_dictionary_handle_t ok; - fastly_compute_at_edge_dictionary_error_t err; - } val; -} fastly_world_result_fastly_compute_at_edge_dictionary_handle_fastly_compute_at_edge_dictionary_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_option_string_t ok; - fastly_compute_at_edge_dictionary_error_t err; - } val; -} fastly_world_result_option_string_fastly_compute_at_edge_dictionary_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_string_t ok; - fastly_compute_at_edge_geo_error_t err; - } val; -} fastly_world_result_string_fastly_compute_at_edge_geo_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_object_store_handle_t ok; - fastly_compute_at_edge_object_store_error_t err; - } val; -} fastly_world_result_fastly_compute_at_edge_object_store_handle_fastly_compute_at_edge_object_store_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_option_fastly_compute_at_edge_object_store_body_handle_t ok; - fastly_compute_at_edge_object_store_error_t err; - } val; -} fastly_world_result_option_fastly_compute_at_edge_object_store_body_handle_fastly_compute_at_edge_object_store_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_object_store_pending_handle_t ok; - fastly_compute_at_edge_object_store_error_t err; - } val; -} fastly_world_result_fastly_compute_at_edge_object_store_pending_handle_fastly_compute_at_edge_object_store_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_object_store_error_t err; - } val; -} fastly_world_result_void_fastly_compute_at_edge_object_store_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_secret_store_store_handle_t ok; - fastly_compute_at_edge_secret_store_error_t err; - } val; -} fastly_world_result_fastly_compute_at_edge_secret_store_store_handle_fastly_compute_at_edge_secret_store_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_option_fastly_compute_at_edge_secret_store_secret_handle_t ok; - fastly_compute_at_edge_secret_store_error_t err; - } val; -} fastly_world_result_option_fastly_compute_at_edge_secret_store_secret_handle_fastly_compute_at_edge_secret_store_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_option_string_t ok; - fastly_compute_at_edge_secret_store_error_t err; - } val; -} fastly_world_result_option_string_fastly_compute_at_edge_secret_store_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_secret_store_secret_handle_t ok; - fastly_compute_at_edge_secret_store_error_t err; - } val; -} fastly_world_result_fastly_compute_at_edge_secret_store_secret_handle_fastly_compute_at_edge_secret_store_error_t; - -typedef struct { - bool is_err; - union { - bool ok; - fastly_compute_at_edge_backend_error_t err; - } val; -} fastly_world_result_bool_fastly_compute_at_edge_backend_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_backend_backend_health_t ok; - fastly_compute_at_edge_backend_error_t err; - } val; -} fastly_world_result_fastly_compute_at_edge_backend_backend_health_fastly_compute_at_edge_backend_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_string_t ok; - fastly_compute_at_edge_backend_error_t err; - } val; -} fastly_world_result_string_fastly_compute_at_edge_backend_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_option_string_t ok; - fastly_compute_at_edge_backend_error_t err; - } val; -} fastly_world_result_option_string_fastly_compute_at_edge_backend_error_t; - -typedef struct { - bool is_err; - union { - uint16_t ok; - fastly_compute_at_edge_backend_error_t err; - } val; -} fastly_world_result_u16_fastly_compute_at_edge_backend_error_t; - -typedef struct { - bool is_err; - union { - uint32_t ok; - fastly_compute_at_edge_backend_error_t err; - } val; -} fastly_world_result_u32_fastly_compute_at_edge_backend_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_backend_tls_version_t ok; - fastly_compute_at_edge_backend_error_t err; - } val; -} fastly_world_result_fastly_compute_at_edge_backend_tls_version_fastly_compute_at_edge_backend_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_option_u32_t ok; - fastly_compute_at_edge_async_io_error_t err; - } val; -} fastly_world_result_option_u32_fastly_compute_at_edge_async_io_error_t; - -typedef struct { - bool is_err; - union { - bool ok; - fastly_compute_at_edge_async_io_error_t err; - } val; -} fastly_world_result_bool_fastly_compute_at_edge_async_io_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_option_string_t ok; - fastly_compute_at_edge_purge_error_t err; - } val; -} fastly_world_result_option_string_fastly_compute_at_edge_purge_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_cache_handle_t ok; - fastly_compute_at_edge_cache_error_t err; - } val; -} fastly_world_result_fastly_compute_at_edge_cache_handle_fastly_compute_at_edge_cache_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_cache_body_handle_t ok; - fastly_compute_at_edge_cache_error_t err; - } val; -} fastly_world_result_fastly_compute_at_edge_cache_body_handle_fastly_compute_at_edge_cache_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_tuple2_fastly_compute_at_edge_cache_body_handle_fastly_compute_at_edge_cache_handle_t ok; - fastly_compute_at_edge_cache_error_t err; - } val; -} fastly_world_result_tuple2_fastly_compute_at_edge_cache_body_handle_fastly_compute_at_edge_cache_handle_fastly_compute_at_edge_cache_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_cache_error_t err; - } val; -} fastly_world_result_void_fastly_compute_at_edge_cache_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_cache_lookup_state_t ok; - fastly_compute_at_edge_cache_error_t err; - } val; -} fastly_world_result_fastly_compute_at_edge_cache_lookup_state_fastly_compute_at_edge_cache_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_list_u8_t ok; - fastly_compute_at_edge_cache_error_t err; - } val; -} fastly_world_result_list_u8_fastly_compute_at_edge_cache_error_t; - -typedef struct { - bool is_err; - union { - uint64_t ok; - fastly_compute_at_edge_cache_error_t err; - } val; -} fastly_world_result_u64_fastly_compute_at_edge_cache_error_t; - -typedef struct { - bool is_err; - union { - bool ok; - fastly_compute_at_edge_edge_rate_limiter_error_t err; - } val; -} fastly_world_result_bool_fastly_compute_at_edge_edge_rate_limiter_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_edge_rate_limiter_error_t err; - } val; -} fastly_world_result_void_fastly_compute_at_edge_edge_rate_limiter_error_t; - -typedef struct { - bool is_err; - union { - uint32_t ok; - fastly_compute_at_edge_edge_rate_limiter_error_t err; - } val; -} fastly_world_result_u32_fastly_compute_at_edge_edge_rate_limiter_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_string_t ok; - fastly_compute_at_edge_device_detection_error_t err; - } val; -} fastly_world_result_string_fastly_compute_at_edge_device_detection_error_t; - -typedef struct { - bool is_err; - union { - } val; -} fastly_world_result_void_void_t; +// Imported Functions from `fastly:compute-at-edge/async-io` __attribute__((__import_module__("fastly:compute-at-edge/async-io"), __import_name__("select"))) -void __wasm_import_fastly_compute_at_edge_async_io_select(int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_async_io_select(uint8_t *, size_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/async-io"), __import_name__("is-ready"))) -void __wasm_import_fastly_compute_at_edge_async_io_is_ready(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_async_io_is_ready(int32_t, uint8_t *); + +// Imported Functions from `fastly:compute-at-edge/backend` __attribute__((__import_module__("fastly:compute-at-edge/backend"), __import_name__("exists"))) -void __wasm_import_fastly_compute_at_edge_backend_exists(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_backend_exists(uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/backend"), __import_name__("is-healthy"))) -void __wasm_import_fastly_compute_at_edge_backend_is_healthy(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_backend_is_healthy(uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/backend"), __import_name__("is-dynamic"))) -void __wasm_import_fastly_compute_at_edge_backend_is_dynamic(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_backend_is_dynamic(uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/backend"), __import_name__("get-host"))) -void __wasm_import_fastly_compute_at_edge_backend_get_host(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_backend_get_host(uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/backend"), __import_name__("get-override-host"))) -void __wasm_import_fastly_compute_at_edge_backend_get_override_host(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_backend_get_override_host(uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/backend"), __import_name__("get-port"))) -void __wasm_import_fastly_compute_at_edge_backend_get_port(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_backend_get_port(uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/backend"), __import_name__("get-connect-timeout-ms"))) -void __wasm_import_fastly_compute_at_edge_backend_get_connect_timeout_ms(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_backend_get_connect_timeout_ms(uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/backend"), __import_name__("get-first-byte-timeout-ms"))) -void __wasm_import_fastly_compute_at_edge_backend_get_first_byte_timeout_ms(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_backend_get_first_byte_timeout_ms(uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/backend"), __import_name__("get-between-bytes-timeout-ms"))) -void __wasm_import_fastly_compute_at_edge_backend_get_between_bytes_timeout_ms(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_backend_get_between_bytes_timeout_ms(uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/backend"), __import_name__("is-ssl"))) -void __wasm_import_fastly_compute_at_edge_backend_is_ssl(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_backend_is_ssl(uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/backend"), __import_name__("get-ssl-min-version"))) -void __wasm_import_fastly_compute_at_edge_backend_get_ssl_min_version(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_backend_get_ssl_min_version(uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/backend"), __import_name__("get-ssl-max-version"))) -void __wasm_import_fastly_compute_at_edge_backend_get_ssl_max_version(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_backend_get_ssl_max_version(uint8_t *, size_t, uint8_t *); + +// Imported Functions from `fastly:compute-at-edge/cache` __attribute__((__import_module__("fastly:compute-at-edge/cache"), __import_name__("lookup"))) -void __wasm_import_fastly_compute_at_edge_cache_lookup(int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_cache_lookup(uint8_t *, size_t, int32_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/cache"), __import_name__("insert"))) -void __wasm_import_fastly_compute_at_edge_cache_insert(int32_t, int32_t, int64_t, int32_t, int32_t, int32_t, int64_t, int64_t, int32_t, int32_t, int64_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_cache_insert(uint8_t *, size_t, int64_t, int32_t, uint8_t *, size_t, int64_t, int64_t, uint8_t *, size_t, int64_t, uint8_t *, size_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/cache"), __import_name__("transaction-lookup"))) -void __wasm_import_fastly_compute_at_edge_cache_transaction_lookup(int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_cache_transaction_lookup(uint8_t *, size_t, int32_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/cache"), __import_name__("transaction-insert"))) -void __wasm_import_fastly_compute_at_edge_cache_transaction_insert(int32_t, int64_t, int32_t, int32_t, int32_t, int64_t, int64_t, int32_t, int32_t, int64_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_cache_transaction_insert(int32_t, int64_t, int32_t, uint8_t *, size_t, int64_t, int64_t, uint8_t *, size_t, int64_t, uint8_t *, size_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/cache"), __import_name__("transaction-insert-and-stream-back"))) -void __wasm_import_fastly_compute_at_edge_cache_transaction_insert_and_stream_back(int32_t, int64_t, int32_t, int32_t, int32_t, int64_t, int64_t, int32_t, int32_t, int64_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_cache_transaction_insert_and_stream_back(int32_t, int64_t, int32_t, uint8_t *, size_t, int64_t, int64_t, uint8_t *, size_t, int64_t, uint8_t *, size_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/cache"), __import_name__("transaction-update"))) -void __wasm_import_fastly_compute_at_edge_cache_transaction_update(int32_t, int64_t, int32_t, int32_t, int32_t, int64_t, int64_t, int32_t, int32_t, int64_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_cache_transaction_update(int32_t, int64_t, int32_t, uint8_t *, size_t, int64_t, int64_t, uint8_t *, size_t, int64_t, uint8_t *, size_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/cache"), __import_name__("transaction-cancel"))) -void __wasm_import_fastly_compute_at_edge_cache_transaction_cancel(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_cache_transaction_cancel(int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/cache"), __import_name__("close"))) -void __wasm_import_fastly_compute_at_edge_cache_close(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_cache_close(int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/cache"), __import_name__("get-state"))) -void __wasm_import_fastly_compute_at_edge_cache_get_state(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_cache_get_state(int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/cache"), __import_name__("get-user-metadata"))) -void __wasm_import_fastly_compute_at_edge_cache_get_user_metadata(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_cache_get_user_metadata(int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/cache"), __import_name__("get-body"))) -void __wasm_import_fastly_compute_at_edge_cache_get_body(int32_t, int64_t, int64_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_cache_get_body(int32_t, int64_t, int64_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/cache"), __import_name__("get-length"))) -void __wasm_import_fastly_compute_at_edge_cache_get_length(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_cache_get_length(int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/cache"), __import_name__("get-max-age-ns"))) -void __wasm_import_fastly_compute_at_edge_cache_get_max_age_ns(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_cache_get_max_age_ns(int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/cache"), __import_name__("get-stale-while-revalidate-ns"))) -void __wasm_import_fastly_compute_at_edge_cache_get_stale_while_revalidate_ns(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_cache_get_stale_while_revalidate_ns(int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/cache"), __import_name__("get-age-ns"))) -void __wasm_import_fastly_compute_at_edge_cache_get_age_ns(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_cache_get_age_ns(int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/cache"), __import_name__("get-hits"))) -void __wasm_import_fastly_compute_at_edge_cache_get_hits(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_cache_get_hits(int32_t, uint8_t *); + +// Imported Functions from `fastly:compute-at-edge/device-detection` __attribute__((__import_module__("fastly:compute-at-edge/device-detection"), __import_name__("lookup"))) -void __wasm_import_fastly_compute_at_edge_device_detection_lookup(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_device_detection_lookup(uint8_t *, size_t, uint8_t *); + +// Imported Functions from `fastly:compute-at-edge/dictionary` __attribute__((__import_module__("fastly:compute-at-edge/dictionary"), __import_name__("open"))) -void __wasm_import_fastly_compute_at_edge_dictionary_open(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_dictionary_open(uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/dictionary"), __import_name__("get"))) -void __wasm_import_fastly_compute_at_edge_dictionary_get(int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_dictionary_get(int32_t, uint8_t *, size_t, uint8_t *); + +// Imported Functions from `fastly:compute-at-edge/edge-rate-limiter` __attribute__((__import_module__("fastly:compute-at-edge/edge-rate-limiter"), __import_name__("check-rate"))) -void __wasm_import_fastly_compute_at_edge_edge_rate_limiter_check_rate(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_fastly_compute_at_edge_edge_rate_limiter_check_rate(uint8_t *, size_t, uint8_t *, size_t, int32_t, int32_t, int32_t, uint8_t *, size_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/edge-rate-limiter"), __import_name__("ratecounter-increment"))) -void __wasm_import_fastly_compute_at_edge_edge_rate_limiter_ratecounter_increment(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_edge_rate_limiter_ratecounter_increment(uint8_t *, size_t, uint8_t *, size_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/edge-rate-limiter"), __import_name__("ratecounter-lookup-rate"))) -void __wasm_import_fastly_compute_at_edge_edge_rate_limiter_ratecounter_lookup_rate(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_edge_rate_limiter_ratecounter_lookup_rate(uint8_t *, size_t, uint8_t *, size_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/edge-rate-limiter"), __import_name__("ratecounter-lookup-count"))) -void __wasm_import_fastly_compute_at_edge_edge_rate_limiter_ratecounter_lookup_count(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_edge_rate_limiter_ratecounter_lookup_count(uint8_t *, size_t, uint8_t *, size_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/edge-rate-limiter"), __import_name__("penaltybox-add"))) -void __wasm_import_fastly_compute_at_edge_edge_rate_limiter_penaltybox_add(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_edge_rate_limiter_penaltybox_add(uint8_t *, size_t, uint8_t *, size_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/edge-rate-limiter"), __import_name__("penaltybox-has"))) -void __wasm_import_fastly_compute_at_edge_edge_rate_limiter_penaltybox_has(int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_edge_rate_limiter_penaltybox_has(uint8_t *, size_t, uint8_t *, size_t, uint8_t *); + +// Imported Functions from `fastly:compute-at-edge/geo` __attribute__((__import_module__("fastly:compute-at-edge/geo"), __import_name__("lookup"))) -void __wasm_import_fastly_compute_at_edge_geo_lookup(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_geo_lookup(uint8_t *, size_t, uint8_t *); + +// Imported Functions from `fastly:compute-at-edge/http-body` __attribute__((__import_module__("fastly:compute-at-edge/http-body"), __import_name__("append"))) -void __wasm_import_fastly_compute_at_edge_http_body_append(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_body_append(int32_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-body"), __import_name__("new"))) -void __wasm_import_fastly_compute_at_edge_http_body_new(int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_body_new(uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-body"), __import_name__("read"))) -void __wasm_import_fastly_compute_at_edge_http_body_read(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_body_read(int32_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-body"), __import_name__("write"))) -void __wasm_import_fastly_compute_at_edge_http_body_write(int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_body_write(int32_t, uint8_t *, size_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-body"), __import_name__("close"))) -void __wasm_import_fastly_compute_at_edge_http_body_close(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_body_close(int32_t, uint8_t *); + +// Imported Functions from `fastly:compute-at-edge/http-req` __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("cache-override-set"))) -void __wasm_import_fastly_compute_at_edge_http_req_cache_override_set(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_cache_override_set(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("downstream-client-ip-addr"))) -void __wasm_import_fastly_compute_at_edge_http_req_downstream_client_ip_addr(int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_downstream_client_ip_addr(uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("downstream-client-request-id"))) -void __wasm_import_fastly_compute_at_edge_http_req_downstream_client_request_id(int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_downstream_client_request_id(uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("downstream-client-h2-fingerprint"))) -void __wasm_import_fastly_compute_at_edge_http_req_downstream_client_h2_fingerprint(int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_downstream_client_h2_fingerprint(uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("downstream-tls-cipher-openssl-name"))) -void __wasm_import_fastly_compute_at_edge_http_req_downstream_tls_cipher_openssl_name(int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_downstream_tls_cipher_openssl_name(uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("downstream-tls-protocol"))) -void __wasm_import_fastly_compute_at_edge_http_req_downstream_tls_protocol(int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_downstream_tls_protocol(uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("downstream-tls-client-hello"))) -void __wasm_import_fastly_compute_at_edge_http_req_downstream_tls_client_hello(int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_downstream_tls_client_hello(uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("downstream-tls-raw-client-certificate"))) -void __wasm_import_fastly_compute_at_edge_http_req_downstream_tls_raw_client_certificate(int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_downstream_tls_raw_client_certificate(uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("downstream-tls-client-cert-verify-result"))) -void __wasm_import_fastly_compute_at_edge_http_req_downstream_tls_client_cert_verify_result(int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_downstream_tls_client_cert_verify_result(uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("downstream-tls-ja3-md5"))) -void __wasm_import_fastly_compute_at_edge_http_req_downstream_tls_ja3_md5(int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_downstream_tls_ja3_md5(uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("new"))) -void __wasm_import_fastly_compute_at_edge_http_req_new(int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_new(uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("header-names-get"))) -void __wasm_import_fastly_compute_at_edge_http_req_header_names_get(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_header_names_get(int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("original-header-names-get"))) -void __wasm_import_fastly_compute_at_edge_http_req_original_header_names_get(int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_original_header_names_get(uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("original-header-count"))) -void __wasm_import_fastly_compute_at_edge_http_req_original_header_count(int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_original_header_count(uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("header-value-get"))) -void __wasm_import_fastly_compute_at_edge_http_req_header_value_get(int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_header_value_get(int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("header-values-get"))) -void __wasm_import_fastly_compute_at_edge_http_req_header_values_get(int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_header_values_get(int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("header-values-set"))) -void __wasm_import_fastly_compute_at_edge_http_req_header_values_set(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_header_values_set(int32_t, uint8_t *, size_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("header-insert"))) -void __wasm_import_fastly_compute_at_edge_http_req_header_insert(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_header_insert(int32_t, uint8_t *, size_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("header-append"))) -void __wasm_import_fastly_compute_at_edge_http_req_header_append(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_header_append(int32_t, uint8_t *, size_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("header-remove"))) -void __wasm_import_fastly_compute_at_edge_http_req_header_remove(int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_header_remove(int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("method-get"))) -void __wasm_import_fastly_compute_at_edge_http_req_method_get(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_method_get(int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("method-set"))) -void __wasm_import_fastly_compute_at_edge_http_req_method_set(int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_method_set(int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("uri-get"))) -void __wasm_import_fastly_compute_at_edge_http_req_uri_get(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_uri_get(int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("uri-set"))) -void __wasm_import_fastly_compute_at_edge_http_req_uri_set(int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_uri_set(int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("version-get"))) -void __wasm_import_fastly_compute_at_edge_http_req_version_get(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_version_get(int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("version-set"))) -void __wasm_import_fastly_compute_at_edge_http_req_version_set(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_version_set(int32_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("send"))) -void __wasm_import_fastly_compute_at_edge_http_req_send(int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_send(int32_t, int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("send-v2"))) -void __wasm_import_fastly_compute_at_edge_http_req_send_v2(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_send_v2(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("send-async"))) -void __wasm_import_fastly_compute_at_edge_http_req_send_async(int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_send_async(int32_t, int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("send-async-streaming"))) -void __wasm_import_fastly_compute_at_edge_http_req_send_async_streaming(int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_send_async_streaming(int32_t, int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("pending-req-poll"))) -void __wasm_import_fastly_compute_at_edge_http_req_pending_req_poll(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_pending_req_poll(int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("pending-req-poll-v2"))) -void __wasm_import_fastly_compute_at_edge_http_req_pending_req_poll_v2(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_pending_req_poll_v2(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("pending-req-wait"))) -void __wasm_import_fastly_compute_at_edge_http_req_pending_req_wait(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_pending_req_wait(int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("pending-req-wait-v2"))) -void __wasm_import_fastly_compute_at_edge_http_req_pending_req_wait_v2(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_pending_req_wait_v2(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("pending-req-select"))) -void __wasm_import_fastly_compute_at_edge_http_req_pending_req_select(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_pending_req_select(uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("pending-req-select-v2"))) -void __wasm_import_fastly_compute_at_edge_http_req_pending_req_select_v2(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_pending_req_select_v2(uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("close"))) -void __wasm_import_fastly_compute_at_edge_http_req_close(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_close(int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("auto-decompress-response-set"))) -void __wasm_import_fastly_compute_at_edge_http_req_auto_decompress_response_set(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_auto_decompress_response_set(int32_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("upgrade-websocket"))) -void __wasm_import_fastly_compute_at_edge_http_req_upgrade_websocket(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_upgrade_websocket(uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("redirect-to-websocket-proxy"))) -void __wasm_import_fastly_compute_at_edge_http_req_redirect_to_websocket_proxy(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_redirect_to_websocket_proxy(uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("redirect-to-grip-proxy"))) -void __wasm_import_fastly_compute_at_edge_http_req_redirect_to_grip_proxy(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_redirect_to_grip_proxy(uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("framing-headers-mode-set"))) -void __wasm_import_fastly_compute_at_edge_http_req_framing_headers_mode_set(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_framing_headers_mode_set(int32_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("register-dynamic-backend"))) -void __wasm_import_fastly_compute_at_edge_http_req_register_dynamic_backend(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_register_dynamic_backend(uint8_t *, uint8_t *); + +// Imported Functions from `fastly:compute-at-edge/http-resp` __attribute__((__import_module__("fastly:compute-at-edge/http-resp"), __import_name__("new"))) -void __wasm_import_fastly_compute_at_edge_http_resp_new(int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_resp_new(uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-resp"), __import_name__("header-names-get"))) -void __wasm_import_fastly_compute_at_edge_http_resp_header_names_get(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_resp_header_names_get(int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-resp"), __import_name__("header-value-get"))) -void __wasm_import_fastly_compute_at_edge_http_resp_header_value_get(int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_resp_header_value_get(int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-resp"), __import_name__("header-values-get"))) -void __wasm_import_fastly_compute_at_edge_http_resp_header_values_get(int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_resp_header_values_get(int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-resp"), __import_name__("header-values-set"))) -void __wasm_import_fastly_compute_at_edge_http_resp_header_values_set(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_resp_header_values_set(int32_t, uint8_t *, size_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-resp"), __import_name__("header-insert"))) -void __wasm_import_fastly_compute_at_edge_http_resp_header_insert(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_resp_header_insert(int32_t, uint8_t *, size_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-resp"), __import_name__("header-append"))) -void __wasm_import_fastly_compute_at_edge_http_resp_header_append(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_resp_header_append(int32_t, uint8_t *, size_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-resp"), __import_name__("header-remove"))) -void __wasm_import_fastly_compute_at_edge_http_resp_header_remove(int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_resp_header_remove(int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-resp"), __import_name__("version-get"))) -void __wasm_import_fastly_compute_at_edge_http_resp_version_get(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_resp_version_get(int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-resp"), __import_name__("version-set"))) -void __wasm_import_fastly_compute_at_edge_http_resp_version_set(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_resp_version_set(int32_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-resp"), __import_name__("send-downstream"))) -void __wasm_import_fastly_compute_at_edge_http_resp_send_downstream(int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_resp_send_downstream(int32_t, int32_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-resp"), __import_name__("status-get"))) -void __wasm_import_fastly_compute_at_edge_http_resp_status_get(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_resp_status_get(int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-resp"), __import_name__("status-set"))) -void __wasm_import_fastly_compute_at_edge_http_resp_status_set(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_resp_status_set(int32_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-resp"), __import_name__("close"))) -void __wasm_import_fastly_compute_at_edge_http_resp_close(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_resp_close(int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-resp"), __import_name__("framing-headers-mode-set"))) -void __wasm_import_fastly_compute_at_edge_http_resp_framing_headers_mode_set(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_resp_framing_headers_mode_set(int32_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-resp"), __import_name__("http-keepalive-mode-set"))) -void __wasm_import_fastly_compute_at_edge_http_resp_http_keepalive_mode_set(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_resp_http_keepalive_mode_set(int32_t, int32_t, uint8_t *); + +// Imported Functions from `fastly:compute-at-edge/log` __attribute__((__import_module__("fastly:compute-at-edge/log"), __import_name__("endpoint-get"))) -void __wasm_import_fastly_compute_at_edge_log_endpoint_get(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_log_endpoint_get(uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/log"), __import_name__("write"))) -void __wasm_import_fastly_compute_at_edge_log_write(int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_log_write(int32_t, uint8_t *, size_t, uint8_t *); + +// Imported Functions from `fastly:compute-at-edge/object-store` __attribute__((__import_module__("fastly:compute-at-edge/object-store"), __import_name__("open"))) -void __wasm_import_fastly_compute_at_edge_object_store_open(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_object_store_open(uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/object-store"), __import_name__("lookup"))) -void __wasm_import_fastly_compute_at_edge_object_store_lookup(int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_object_store_lookup(int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/object-store"), __import_name__("lookup-async"))) -void __wasm_import_fastly_compute_at_edge_object_store_lookup_async(int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_object_store_lookup_async(int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/object-store"), __import_name__("pending-lookup-wait"))) -void __wasm_import_fastly_compute_at_edge_object_store_pending_lookup_wait(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_object_store_pending_lookup_wait(int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/object-store"), __import_name__("delete-async"))) -void __wasm_import_fastly_compute_at_edge_object_store_delete_async(int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_object_store_delete_async(int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/object-store"), __import_name__("pending-delete-wait"))) -void __wasm_import_fastly_compute_at_edge_object_store_pending_delete_wait(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_object_store_pending_delete_wait(int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/object-store"), __import_name__("insert"))) -void __wasm_import_fastly_compute_at_edge_object_store_insert(int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_object_store_insert(int32_t, uint8_t *, size_t, int32_t, uint8_t *); + +// Imported Functions from `fastly:compute-at-edge/purge` __attribute__((__import_module__("fastly:compute-at-edge/purge"), __import_name__("surrogate-key"))) -void __wasm_import_fastly_compute_at_edge_purge_surrogate_key(int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_purge_surrogate_key(uint8_t *, size_t, int32_t, uint8_t *); + +// Imported Functions from `fastly:compute-at-edge/secret-store` __attribute__((__import_module__("fastly:compute-at-edge/secret-store"), __import_name__("open"))) -void __wasm_import_fastly_compute_at_edge_secret_store_open(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_secret_store_open(uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/secret-store"), __import_name__("get"))) -void __wasm_import_fastly_compute_at_edge_secret_store_get(int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_secret_store_get(int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/secret-store"), __import_name__("plaintext"))) -void __wasm_import_fastly_compute_at_edge_secret_store_plaintext(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_secret_store_plaintext(int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/secret-store"), __import_name__("from-bytes"))) -void __wasm_import_fastly_compute_at_edge_secret_store_from_bytes(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_secret_store_from_bytes(uint8_t *, size_t, uint8_t *); + +// Imported Functions from `fastly:compute-at-edge/uap` __attribute__((__import_module__("fastly:compute-at-edge/uap"), __import_name__("parse"))) -void __wasm_import_fastly_compute_at_edge_uap_parse(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_uap_parse(uint8_t *, size_t, uint8_t *); + +// Exported Functions from `fastly:compute-at-edge/reactor` + + +// 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) { + (void) old_size; if (new_size == 0) return (void*) align; void *ret = realloc(ptr, new_size); if (!ret) abort(); @@ -848,17 +406,17 @@ void *cabi_realloc(void *ptr, size_t old_size, size_t align, size_t new_size) { // Component Adapters -bool fastly_compute_at_edge_async_io_select(fastly_world_list_fastly_compute_at_edge_async_io_handle_t *hs, uint32_t timeout_ms, fastly_world_option_u32_t *ret, fastly_compute_at_edge_async_io_error_t *err) { +bool fastly_compute_at_edge_async_io_select(fastly_world_list_handle_t *hs, uint32_t timeout_ms, fastly_world_option_u32_t *ret, fastly_compute_at_edge_async_io_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_async_io_select((int32_t) (*hs).ptr, (int32_t) (*hs).len, (int32_t) (timeout_ms), ptr); - fastly_world_result_option_u32_fastly_compute_at_edge_async_io_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_async_io_select((uint8_t *) (*hs).ptr, (*hs).len, (int32_t) (timeout_ms), ptr); + fastly_compute_at_edge_async_io_result_option_u32_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; fastly_world_option_u32_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 4)))) { + switch ((int32_t) *((uint8_t*) (ptr + 4))) { case 0: { option.is_some = false; break; @@ -869,13 +427,13 @@ bool fastly_compute_at_edge_async_io_select(fastly_world_list_fastly_compute_at_ 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; } } @@ -891,18 +449,18 @@ bool fastly_compute_at_edge_async_io_select(fastly_world_list_fastly_compute_at_ bool fastly_compute_at_edge_async_io_is_ready(fastly_compute_at_edge_async_io_handle_t handle, bool *ret, fastly_compute_at_edge_async_io_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_async_io_is_ready((int32_t) (handle), ptr); - fastly_world_result_bool_fastly_compute_at_edge_async_io_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_async_io_result_bool_error_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; } } @@ -918,18 +476,18 @@ bool fastly_compute_at_edge_async_io_is_ready(fastly_compute_at_edge_async_io_ha bool fastly_compute_at_edge_backend_exists(fastly_world_string_t *backend, bool *ret, fastly_compute_at_edge_backend_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_backend_exists((int32_t) (*backend).ptr, (int32_t) (*backend).len, ptr); - fastly_world_result_bool_fastly_compute_at_edge_backend_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_backend_exists((uint8_t *) (*backend).ptr, (*backend).len, ptr); + fastly_compute_at_edge_backend_result_bool_error_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; } } @@ -945,18 +503,18 @@ bool fastly_compute_at_edge_backend_exists(fastly_world_string_t *backend, bool bool fastly_compute_at_edge_backend_is_healthy(fastly_world_string_t *backend, fastly_compute_at_edge_backend_backend_health_t *ret, fastly_compute_at_edge_backend_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_backend_is_healthy((int32_t) (*backend).ptr, (int32_t) (*backend).len, ptr); - fastly_world_result_fastly_compute_at_edge_backend_backend_health_fastly_compute_at_edge_backend_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_backend_is_healthy((uint8_t *) (*backend).ptr, (*backend).len, ptr); + fastly_compute_at_edge_backend_result_backend_health_error_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; } } @@ -972,18 +530,18 @@ bool fastly_compute_at_edge_backend_is_healthy(fastly_world_string_t *backend, f bool fastly_compute_at_edge_backend_is_dynamic(fastly_world_string_t *backend, bool *ret, fastly_compute_at_edge_backend_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_backend_is_dynamic((int32_t) (*backend).ptr, (int32_t) (*backend).len, ptr); - fastly_world_result_bool_fastly_compute_at_edge_backend_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_backend_is_dynamic((uint8_t *) (*backend).ptr, (*backend).len, ptr); + fastly_compute_at_edge_backend_result_bool_error_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; } } @@ -999,18 +557,18 @@ bool fastly_compute_at_edge_backend_is_dynamic(fastly_world_string_t *backend, b bool fastly_compute_at_edge_backend_get_host(fastly_world_string_t *backend, fastly_world_string_t *ret, fastly_compute_at_edge_backend_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_backend_get_host((int32_t) (*backend).ptr, (int32_t) (*backend).len, ptr); - fastly_world_result_string_fastly_compute_at_edge_backend_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_backend_get_host((uint8_t *) (*backend).ptr, (*backend).len, ptr); + fastly_compute_at_edge_backend_result_string_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (fastly_world_string_t) { (char*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + result.val.ok = (fastly_world_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; } } @@ -1026,31 +584,31 @@ bool fastly_compute_at_edge_backend_get_host(fastly_world_string_t *backend, fas bool fastly_compute_at_edge_backend_get_override_host(fastly_world_string_t *backend, fastly_world_option_string_t *ret, fastly_compute_at_edge_backend_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_backend_get_override_host((int32_t) (*backend).ptr, (int32_t) (*backend).len, ptr); - fastly_world_result_option_string_fastly_compute_at_edge_backend_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_backend_get_override_host((uint8_t *) (*backend).ptr, (*backend).len, ptr); + fastly_compute_at_edge_backend_result_option_string_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; fastly_world_option_string_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 4)))) { + switch ((int32_t) *((uint8_t*) (ptr + 4))) { case 0: { option.is_some = false; break; } case 1: { option.is_some = true; - option.val = (fastly_world_string_t) { (char*)(*((int32_t*) (ptr + 8))), (size_t)(*((int32_t*) (ptr + 12))) }; + option.val = (fastly_world_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 8))), (*((size_t*) (ptr + 12))) }; 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; } } @@ -1066,18 +624,18 @@ bool fastly_compute_at_edge_backend_get_override_host(fastly_world_string_t *bac bool fastly_compute_at_edge_backend_get_port(fastly_world_string_t *backend, uint16_t *ret, fastly_compute_at_edge_backend_error_t *err) { __attribute__((__aligned__(2))) uint8_t ret_area[4]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_backend_get_port((int32_t) (*backend).ptr, (int32_t) (*backend).len, ptr); - fastly_world_result_u16_fastly_compute_at_edge_backend_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_backend_get_port((uint8_t *) (*backend).ptr, (*backend).len, ptr); + fastly_compute_at_edge_backend_result_u16_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 2)))); + result.val.ok = (uint16_t) ((int32_t) *((uint16_t*) (ptr + 2))); 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; } } @@ -1093,10 +651,10 @@ bool fastly_compute_at_edge_backend_get_port(fastly_world_string_t *backend, uin bool fastly_compute_at_edge_backend_get_connect_timeout_ms(fastly_world_string_t *backend, uint32_t *ret, fastly_compute_at_edge_backend_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_backend_get_connect_timeout_ms((int32_t) (*backend).ptr, (int32_t) (*backend).len, ptr); - fastly_world_result_u32_fastly_compute_at_edge_backend_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_backend_get_connect_timeout_ms((uint8_t *) (*backend).ptr, (*backend).len, ptr); + fastly_compute_at_edge_backend_result_u32_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -1104,7 +662,7 @@ bool fastly_compute_at_edge_backend_get_connect_timeout_ms(fastly_world_string_t } 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; } } @@ -1120,10 +678,10 @@ bool fastly_compute_at_edge_backend_get_connect_timeout_ms(fastly_world_string_t bool fastly_compute_at_edge_backend_get_first_byte_timeout_ms(fastly_world_string_t *backend, uint32_t *ret, fastly_compute_at_edge_backend_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_backend_get_first_byte_timeout_ms((int32_t) (*backend).ptr, (int32_t) (*backend).len, ptr); - fastly_world_result_u32_fastly_compute_at_edge_backend_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_backend_get_first_byte_timeout_ms((uint8_t *) (*backend).ptr, (*backend).len, ptr); + fastly_compute_at_edge_backend_result_u32_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -1131,7 +689,7 @@ bool fastly_compute_at_edge_backend_get_first_byte_timeout_ms(fastly_world_strin } 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; } } @@ -1147,10 +705,10 @@ bool fastly_compute_at_edge_backend_get_first_byte_timeout_ms(fastly_world_strin bool fastly_compute_at_edge_backend_get_between_bytes_timeout_ms(fastly_world_string_t *backend, uint32_t *ret, fastly_compute_at_edge_backend_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_backend_get_between_bytes_timeout_ms((int32_t) (*backend).ptr, (int32_t) (*backend).len, ptr); - fastly_world_result_u32_fastly_compute_at_edge_backend_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_backend_get_between_bytes_timeout_ms((uint8_t *) (*backend).ptr, (*backend).len, ptr); + fastly_compute_at_edge_backend_result_u32_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -1158,7 +716,7 @@ bool fastly_compute_at_edge_backend_get_between_bytes_timeout_ms(fastly_world_st } 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; } } @@ -1174,18 +732,18 @@ bool fastly_compute_at_edge_backend_get_between_bytes_timeout_ms(fastly_world_st bool fastly_compute_at_edge_backend_is_ssl(fastly_world_string_t *backend, bool *ret, fastly_compute_at_edge_backend_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_backend_is_ssl((int32_t) (*backend).ptr, (int32_t) (*backend).len, ptr); - fastly_world_result_bool_fastly_compute_at_edge_backend_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_backend_is_ssl((uint8_t *) (*backend).ptr, (*backend).len, ptr); + fastly_compute_at_edge_backend_result_bool_error_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; } } @@ -1201,18 +759,18 @@ bool fastly_compute_at_edge_backend_is_ssl(fastly_world_string_t *backend, bool bool fastly_compute_at_edge_backend_get_ssl_min_version(fastly_world_string_t *backend, fastly_compute_at_edge_backend_tls_version_t *ret, fastly_compute_at_edge_backend_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_backend_get_ssl_min_version((int32_t) (*backend).ptr, (int32_t) (*backend).len, ptr); - fastly_world_result_fastly_compute_at_edge_backend_tls_version_fastly_compute_at_edge_backend_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_backend_get_ssl_min_version((uint8_t *) (*backend).ptr, (*backend).len, ptr); + fastly_compute_at_edge_backend_result_tls_version_error_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; } } @@ -1228,18 +786,18 @@ bool fastly_compute_at_edge_backend_get_ssl_min_version(fastly_world_string_t *b bool fastly_compute_at_edge_backend_get_ssl_max_version(fastly_world_string_t *backend, fastly_compute_at_edge_backend_tls_version_t *ret, fastly_compute_at_edge_backend_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_backend_get_ssl_max_version((int32_t) (*backend).ptr, (int32_t) (*backend).len, ptr); - fastly_world_result_fastly_compute_at_edge_backend_tls_version_fastly_compute_at_edge_backend_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_backend_get_ssl_max_version((uint8_t *) (*backend).ptr, (*backend).len, ptr); + fastly_compute_at_edge_backend_result_tls_version_error_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; } } @@ -1265,10 +823,10 @@ bool fastly_compute_at_edge_cache_lookup(fastly_world_string_t *key, fastly_comp option = 0; option1 = 0; } - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_cache_lookup((int32_t) (*key).ptr, (int32_t) (*key).len, option, option1, ptr); - fastly_world_result_fastly_compute_at_edge_cache_handle_fastly_compute_at_edge_cache_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_cache_lookup((uint8_t *) (*key).ptr, (*key).len, option, option1, ptr); + fastly_compute_at_edge_cache_result_handle_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -1276,7 +834,7 @@ bool fastly_compute_at_edge_cache_lookup(fastly_world_string_t *key, fastly_comp } 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; } } @@ -1292,10 +850,10 @@ bool fastly_compute_at_edge_cache_lookup(fastly_world_string_t *key, fastly_comp bool fastly_compute_at_edge_cache_insert(fastly_world_string_t *key, fastly_compute_at_edge_cache_write_options_t *options, fastly_compute_at_edge_cache_body_handle_t *ret, fastly_compute_at_edge_cache_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_cache_insert((int32_t) (*key).ptr, (int32_t) (*key).len, (int64_t) ((*options).max_age_ns), (int32_t) ((*options).request_headers), (int32_t) ((*options).vary_rule).ptr, (int32_t) ((*options).vary_rule).len, (int64_t) ((*options).initial_age_ns), (int64_t) ((*options).stale_while_revalidate_ns), (int32_t) ((*options).surrogate_keys).ptr, (int32_t) ((*options).surrogate_keys).len, (int64_t) ((*options).length), (int32_t) ((*options).user_metadata).ptr, (int32_t) ((*options).user_metadata).len, (*options).sensitive_data, ptr); - fastly_world_result_fastly_compute_at_edge_cache_body_handle_fastly_compute_at_edge_cache_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_cache_insert((uint8_t *) (*key).ptr, (*key).len, (int64_t) ((*options).max_age_ns), (int32_t) ((*options).request_headers), (uint8_t *) ((*options).vary_rule).ptr, ((*options).vary_rule).len, (int64_t) ((*options).initial_age_ns), (int64_t) ((*options).stale_while_revalidate_ns), (uint8_t *) ((*options).surrogate_keys).ptr, ((*options).surrogate_keys).len, (int64_t) ((*options).length), (uint8_t *) ((*options).user_metadata).ptr, ((*options).user_metadata).len, (*options).sensitive_data, ptr); + fastly_compute_at_edge_cache_result_body_handle_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -1303,7 +861,7 @@ bool fastly_compute_at_edge_cache_insert(fastly_world_string_t *key, fastly_comp } 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; } } @@ -1329,10 +887,10 @@ bool fastly_compute_at_edge_cache_transaction_lookup(fastly_world_string_t *key, option = 0; option1 = 0; } - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_cache_transaction_lookup((int32_t) (*key).ptr, (int32_t) (*key).len, option, option1, ptr); - fastly_world_result_fastly_compute_at_edge_cache_handle_fastly_compute_at_edge_cache_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_cache_transaction_lookup((uint8_t *) (*key).ptr, (*key).len, option, option1, ptr); + fastly_compute_at_edge_cache_result_handle_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -1340,7 +898,7 @@ bool fastly_compute_at_edge_cache_transaction_lookup(fastly_world_string_t *key, } 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; } } @@ -1356,10 +914,10 @@ bool fastly_compute_at_edge_cache_transaction_lookup(fastly_world_string_t *key, bool fastly_compute_at_edge_cache_transaction_insert(fastly_compute_at_edge_cache_handle_t handle, fastly_compute_at_edge_cache_write_options_t *options, fastly_compute_at_edge_cache_body_handle_t *ret, fastly_compute_at_edge_cache_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_cache_transaction_insert((int32_t) (handle), (int64_t) ((*options).max_age_ns), (int32_t) ((*options).request_headers), (int32_t) ((*options).vary_rule).ptr, (int32_t) ((*options).vary_rule).len, (int64_t) ((*options).initial_age_ns), (int64_t) ((*options).stale_while_revalidate_ns), (int32_t) ((*options).surrogate_keys).ptr, (int32_t) ((*options).surrogate_keys).len, (int64_t) ((*options).length), (int32_t) ((*options).user_metadata).ptr, (int32_t) ((*options).user_metadata).len, (*options).sensitive_data, ptr); - fastly_world_result_fastly_compute_at_edge_cache_body_handle_fastly_compute_at_edge_cache_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_cache_transaction_insert((int32_t) (handle), (int64_t) ((*options).max_age_ns), (int32_t) ((*options).request_headers), (uint8_t *) ((*options).vary_rule).ptr, ((*options).vary_rule).len, (int64_t) ((*options).initial_age_ns), (int64_t) ((*options).stale_while_revalidate_ns), (uint8_t *) ((*options).surrogate_keys).ptr, ((*options).surrogate_keys).len, (int64_t) ((*options).length), (uint8_t *) ((*options).user_metadata).ptr, ((*options).user_metadata).len, (*options).sensitive_data, ptr); + fastly_compute_at_edge_cache_result_body_handle_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -1367,7 +925,7 @@ bool fastly_compute_at_edge_cache_transaction_insert(fastly_compute_at_edge_cach } 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; } } @@ -1380,24 +938,24 @@ bool fastly_compute_at_edge_cache_transaction_insert(fastly_compute_at_edge_cach } } -bool fastly_compute_at_edge_cache_transaction_insert_and_stream_back(fastly_compute_at_edge_cache_handle_t handle, fastly_compute_at_edge_cache_write_options_t *options, fastly_world_tuple2_fastly_compute_at_edge_cache_body_handle_fastly_compute_at_edge_cache_handle_t *ret, fastly_compute_at_edge_cache_error_t *err) { +bool fastly_compute_at_edge_cache_transaction_insert_and_stream_back(fastly_compute_at_edge_cache_handle_t handle, fastly_compute_at_edge_cache_write_options_t *options, fastly_world_tuple2_body_handle_handle_t *ret, fastly_compute_at_edge_cache_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_cache_transaction_insert_and_stream_back((int32_t) (handle), (int64_t) ((*options).max_age_ns), (int32_t) ((*options).request_headers), (int32_t) ((*options).vary_rule).ptr, (int32_t) ((*options).vary_rule).len, (int64_t) ((*options).initial_age_ns), (int64_t) ((*options).stale_while_revalidate_ns), (int32_t) ((*options).surrogate_keys).ptr, (int32_t) ((*options).surrogate_keys).len, (int64_t) ((*options).length), (int32_t) ((*options).user_metadata).ptr, (int32_t) ((*options).user_metadata).len, (*options).sensitive_data, ptr); - fastly_world_result_tuple2_fastly_compute_at_edge_cache_body_handle_fastly_compute_at_edge_cache_handle_fastly_compute_at_edge_cache_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_cache_transaction_insert_and_stream_back((int32_t) (handle), (int64_t) ((*options).max_age_ns), (int32_t) ((*options).request_headers), (uint8_t *) ((*options).vary_rule).ptr, ((*options).vary_rule).len, (int64_t) ((*options).initial_age_ns), (int64_t) ((*options).stale_while_revalidate_ns), (uint8_t *) ((*options).surrogate_keys).ptr, ((*options).surrogate_keys).len, (int64_t) ((*options).length), (uint8_t *) ((*options).user_metadata).ptr, ((*options).user_metadata).len, (*options).sensitive_data, ptr); + fastly_compute_at_edge_cache_result_tuple2_body_handle_handle_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (fastly_world_tuple2_fastly_compute_at_edge_cache_body_handle_fastly_compute_at_edge_cache_handle_t) { - (uint32_t) (*((int32_t*) (ptr + 4))), - (uint32_t) (*((int32_t*) (ptr + 8))), + result.val.ok = (fastly_world_tuple2_body_handle_handle_t) { + (fastly_compute_at_edge_cache_body_handle_t) (uint32_t) (*((int32_t*) (ptr + 4))), + (fastly_compute_at_edge_cache_handle_t) (uint32_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; } } @@ -1413,17 +971,17 @@ bool fastly_compute_at_edge_cache_transaction_insert_and_stream_back(fastly_comp bool fastly_compute_at_edge_cache_transaction_update(fastly_compute_at_edge_cache_handle_t handle, fastly_compute_at_edge_cache_write_options_t *options, fastly_compute_at_edge_cache_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_cache_transaction_update((int32_t) (handle), (int64_t) ((*options).max_age_ns), (int32_t) ((*options).request_headers), (int32_t) ((*options).vary_rule).ptr, (int32_t) ((*options).vary_rule).len, (int64_t) ((*options).initial_age_ns), (int64_t) ((*options).stale_while_revalidate_ns), (int32_t) ((*options).surrogate_keys).ptr, (int32_t) ((*options).surrogate_keys).len, (int64_t) ((*options).length), (int32_t) ((*options).user_metadata).ptr, (int32_t) ((*options).user_metadata).len, (*options).sensitive_data, ptr); - fastly_world_result_void_fastly_compute_at_edge_cache_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_cache_transaction_update((int32_t) (handle), (int64_t) ((*options).max_age_ns), (int32_t) ((*options).request_headers), (uint8_t *) ((*options).vary_rule).ptr, ((*options).vary_rule).len, (int64_t) ((*options).initial_age_ns), (int64_t) ((*options).stale_while_revalidate_ns), (uint8_t *) ((*options).surrogate_keys).ptr, ((*options).surrogate_keys).len, (int64_t) ((*options).length), (uint8_t *) ((*options).user_metadata).ptr, ((*options).user_metadata).len, (*options).sensitive_data, ptr); + fastly_compute_at_edge_cache_result_void_error_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; } } @@ -1438,17 +996,17 @@ bool fastly_compute_at_edge_cache_transaction_update(fastly_compute_at_edge_cach bool fastly_compute_at_edge_cache_transaction_cancel(fastly_compute_at_edge_cache_handle_t handle, fastly_compute_at_edge_cache_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_cache_transaction_cancel((int32_t) (handle), ptr); - fastly_world_result_void_fastly_compute_at_edge_cache_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_cache_result_void_error_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; } } @@ -1463,17 +1021,17 @@ bool fastly_compute_at_edge_cache_transaction_cancel(fastly_compute_at_edge_cach bool fastly_compute_at_edge_cache_close(fastly_compute_at_edge_cache_handle_t handle, fastly_compute_at_edge_cache_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_cache_close((int32_t) (handle), ptr); - fastly_world_result_void_fastly_compute_at_edge_cache_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_cache_result_void_error_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; } } @@ -1488,18 +1046,18 @@ bool fastly_compute_at_edge_cache_close(fastly_compute_at_edge_cache_handle_t ha bool fastly_compute_at_edge_cache_get_state(fastly_compute_at_edge_cache_handle_t handle, fastly_compute_at_edge_cache_lookup_state_t *ret, fastly_compute_at_edge_cache_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_cache_get_state((int32_t) (handle), ptr); - fastly_world_result_fastly_compute_at_edge_cache_lookup_state_fastly_compute_at_edge_cache_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_cache_result_lookup_state_error_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; } } @@ -1515,18 +1073,18 @@ bool fastly_compute_at_edge_cache_get_state(fastly_compute_at_edge_cache_handle_ bool fastly_compute_at_edge_cache_get_user_metadata(fastly_compute_at_edge_cache_handle_t handle, fastly_world_list_u8_t *ret, fastly_compute_at_edge_cache_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_cache_get_user_metadata((int32_t) (handle), ptr); - fastly_world_result_list_u8_fastly_compute_at_edge_cache_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_cache_result_list_u8_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (fastly_world_list_u8_t) { (uint8_t*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + result.val.ok = (fastly_world_list_u8_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; } } @@ -1542,10 +1100,10 @@ bool fastly_compute_at_edge_cache_get_user_metadata(fastly_compute_at_edge_cache bool fastly_compute_at_edge_cache_get_body(fastly_compute_at_edge_cache_handle_t handle, fastly_compute_at_edge_cache_get_body_options_t *options, fastly_compute_at_edge_cache_get_body_options_mask_t options_mask, fastly_compute_at_edge_cache_body_handle_t *ret, fastly_compute_at_edge_cache_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_cache_get_body((int32_t) (handle), (int64_t) ((*options).start), (int64_t) ((*options).end), options_mask, ptr); - fastly_world_result_fastly_compute_at_edge_cache_body_handle_fastly_compute_at_edge_cache_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_cache_result_body_handle_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -1553,7 +1111,7 @@ bool fastly_compute_at_edge_cache_get_body(fastly_compute_at_edge_cache_handle_t } 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; } } @@ -1569,10 +1127,10 @@ bool fastly_compute_at_edge_cache_get_body(fastly_compute_at_edge_cache_handle_t bool fastly_compute_at_edge_cache_get_length(fastly_compute_at_edge_cache_handle_t handle, uint64_t *ret, fastly_compute_at_edge_cache_error_t *err) { __attribute__((__aligned__(8))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_cache_get_length((int32_t) (handle), ptr); - fastly_world_result_u64_fastly_compute_at_edge_cache_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_cache_result_u64_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))); @@ -1580,7 +1138,7 @@ bool fastly_compute_at_edge_cache_get_length(fastly_compute_at_edge_cache_handle } 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; } } @@ -1596,10 +1154,10 @@ bool fastly_compute_at_edge_cache_get_length(fastly_compute_at_edge_cache_handle bool fastly_compute_at_edge_cache_get_max_age_ns(fastly_compute_at_edge_cache_handle_t handle, uint64_t *ret, fastly_compute_at_edge_cache_error_t *err) { __attribute__((__aligned__(8))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_cache_get_max_age_ns((int32_t) (handle), ptr); - fastly_world_result_u64_fastly_compute_at_edge_cache_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_cache_result_u64_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))); @@ -1607,7 +1165,7 @@ bool fastly_compute_at_edge_cache_get_max_age_ns(fastly_compute_at_edge_cache_ha } 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; } } @@ -1623,10 +1181,10 @@ bool fastly_compute_at_edge_cache_get_max_age_ns(fastly_compute_at_edge_cache_ha bool fastly_compute_at_edge_cache_get_stale_while_revalidate_ns(fastly_compute_at_edge_cache_handle_t handle, uint64_t *ret, fastly_compute_at_edge_cache_error_t *err) { __attribute__((__aligned__(8))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_cache_get_stale_while_revalidate_ns((int32_t) (handle), ptr); - fastly_world_result_u64_fastly_compute_at_edge_cache_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_cache_result_u64_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))); @@ -1634,7 +1192,7 @@ bool fastly_compute_at_edge_cache_get_stale_while_revalidate_ns(fastly_compute_a } 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; } } @@ -1650,10 +1208,10 @@ bool fastly_compute_at_edge_cache_get_stale_while_revalidate_ns(fastly_compute_a bool fastly_compute_at_edge_cache_get_age_ns(fastly_compute_at_edge_cache_handle_t handle, uint64_t *ret, fastly_compute_at_edge_cache_error_t *err) { __attribute__((__aligned__(8))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_cache_get_age_ns((int32_t) (handle), ptr); - fastly_world_result_u64_fastly_compute_at_edge_cache_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_cache_result_u64_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))); @@ -1661,7 +1219,7 @@ bool fastly_compute_at_edge_cache_get_age_ns(fastly_compute_at_edge_cache_handle } 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; } } @@ -1677,10 +1235,10 @@ bool fastly_compute_at_edge_cache_get_age_ns(fastly_compute_at_edge_cache_handle bool fastly_compute_at_edge_cache_get_hits(fastly_compute_at_edge_cache_handle_t handle, uint64_t *ret, fastly_compute_at_edge_cache_error_t *err) { __attribute__((__aligned__(8))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_cache_get_hits((int32_t) (handle), ptr); - fastly_world_result_u64_fastly_compute_at_edge_cache_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_cache_result_u64_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))); @@ -1688,7 +1246,7 @@ bool fastly_compute_at_edge_cache_get_hits(fastly_compute_at_edge_cache_handle_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; } } @@ -1704,18 +1262,18 @@ bool fastly_compute_at_edge_cache_get_hits(fastly_compute_at_edge_cache_handle_t bool fastly_compute_at_edge_device_detection_lookup(fastly_world_string_t *user_agent, fastly_world_string_t *ret, fastly_compute_at_edge_device_detection_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_device_detection_lookup((int32_t) (*user_agent).ptr, (int32_t) (*user_agent).len, ptr); - fastly_world_result_string_fastly_compute_at_edge_device_detection_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_device_detection_lookup((uint8_t *) (*user_agent).ptr, (*user_agent).len, ptr); + fastly_compute_at_edge_device_detection_result_string_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (fastly_world_string_t) { (char*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + result.val.ok = (fastly_world_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; } } @@ -1731,10 +1289,10 @@ bool fastly_compute_at_edge_device_detection_lookup(fastly_world_string_t *user_ bool fastly_compute_at_edge_dictionary_open(fastly_world_string_t *name, fastly_compute_at_edge_dictionary_handle_t *ret, fastly_compute_at_edge_dictionary_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_dictionary_open((int32_t) (*name).ptr, (int32_t) (*name).len, ptr); - fastly_world_result_fastly_compute_at_edge_dictionary_handle_fastly_compute_at_edge_dictionary_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_dictionary_open((uint8_t *) (*name).ptr, (*name).len, ptr); + fastly_compute_at_edge_dictionary_result_handle_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -1742,7 +1300,7 @@ bool fastly_compute_at_edge_dictionary_open(fastly_world_string_t *name, fastly_ } 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; } } @@ -1758,31 +1316,31 @@ bool fastly_compute_at_edge_dictionary_open(fastly_world_string_t *name, fastly_ bool fastly_compute_at_edge_dictionary_get(fastly_compute_at_edge_dictionary_handle_t h, fastly_world_string_t *key, fastly_world_option_string_t *ret, fastly_compute_at_edge_dictionary_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_dictionary_get((int32_t) (h), (int32_t) (*key).ptr, (int32_t) (*key).len, ptr); - fastly_world_result_option_string_fastly_compute_at_edge_dictionary_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_dictionary_get((int32_t) (h), (uint8_t *) (*key).ptr, (*key).len, ptr); + fastly_compute_at_edge_dictionary_result_option_string_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; fastly_world_option_string_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 4)))) { + switch ((int32_t) *((uint8_t*) (ptr + 4))) { case 0: { option.is_some = false; break; } case 1: { option.is_some = true; - option.val = (fastly_world_string_t) { (char*)(*((int32_t*) (ptr + 8))), (size_t)(*((int32_t*) (ptr + 12))) }; + option.val = (fastly_world_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 8))), (*((size_t*) (ptr + 12))) }; 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; } } @@ -1798,18 +1356,18 @@ bool fastly_compute_at_edge_dictionary_get(fastly_compute_at_edge_dictionary_han bool fastly_compute_at_edge_edge_rate_limiter_check_rate(fastly_world_string_t *rate_counter_name, fastly_world_string_t *entry, uint32_t delta, uint32_t window, uint32_t limit, fastly_world_string_t *penalty_box_name, uint32_t time_to_live, bool *ret, fastly_compute_at_edge_edge_rate_limiter_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_edge_rate_limiter_check_rate((int32_t) (*rate_counter_name).ptr, (int32_t) (*rate_counter_name).len, (int32_t) (*entry).ptr, (int32_t) (*entry).len, (int32_t) (delta), (int32_t) (window), (int32_t) (limit), (int32_t) (*penalty_box_name).ptr, (int32_t) (*penalty_box_name).len, (int32_t) (time_to_live), ptr); - fastly_world_result_bool_fastly_compute_at_edge_edge_rate_limiter_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_edge_rate_limiter_check_rate((uint8_t *) (*rate_counter_name).ptr, (*rate_counter_name).len, (uint8_t *) (*entry).ptr, (*entry).len, (int32_t) (delta), (int32_t) (window), (int32_t) (limit), (uint8_t *) (*penalty_box_name).ptr, (*penalty_box_name).len, (int32_t) (time_to_live), ptr); + fastly_compute_at_edge_edge_rate_limiter_result_bool_error_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; } } @@ -1825,17 +1383,17 @@ bool fastly_compute_at_edge_edge_rate_limiter_check_rate(fastly_world_string_t * bool fastly_compute_at_edge_edge_rate_limiter_ratecounter_increment(fastly_world_string_t *rate_counter_name, fastly_world_string_t *entry, uint32_t delta, fastly_compute_at_edge_edge_rate_limiter_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_edge_rate_limiter_ratecounter_increment((int32_t) (*rate_counter_name).ptr, (int32_t) (*rate_counter_name).len, (int32_t) (*entry).ptr, (int32_t) (*entry).len, (int32_t) (delta), ptr); - fastly_world_result_void_fastly_compute_at_edge_edge_rate_limiter_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_edge_rate_limiter_ratecounter_increment((uint8_t *) (*rate_counter_name).ptr, (*rate_counter_name).len, (uint8_t *) (*entry).ptr, (*entry).len, (int32_t) (delta), ptr); + fastly_compute_at_edge_edge_rate_limiter_result_void_error_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; } } @@ -1850,10 +1408,10 @@ bool fastly_compute_at_edge_edge_rate_limiter_ratecounter_increment(fastly_world bool fastly_compute_at_edge_edge_rate_limiter_ratecounter_lookup_rate(fastly_world_string_t *rate_counter_name, fastly_world_string_t *entry, uint32_t window, uint32_t *ret, fastly_compute_at_edge_edge_rate_limiter_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_edge_rate_limiter_ratecounter_lookup_rate((int32_t) (*rate_counter_name).ptr, (int32_t) (*rate_counter_name).len, (int32_t) (*entry).ptr, (int32_t) (*entry).len, (int32_t) (window), ptr); - fastly_world_result_u32_fastly_compute_at_edge_edge_rate_limiter_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_edge_rate_limiter_ratecounter_lookup_rate((uint8_t *) (*rate_counter_name).ptr, (*rate_counter_name).len, (uint8_t *) (*entry).ptr, (*entry).len, (int32_t) (window), ptr); + fastly_compute_at_edge_edge_rate_limiter_result_u32_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -1861,7 +1419,7 @@ bool fastly_compute_at_edge_edge_rate_limiter_ratecounter_lookup_rate(fastly_wor } 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; } } @@ -1877,10 +1435,10 @@ bool fastly_compute_at_edge_edge_rate_limiter_ratecounter_lookup_rate(fastly_wor bool fastly_compute_at_edge_edge_rate_limiter_ratecounter_lookup_count(fastly_world_string_t *rate_counter_name, fastly_world_string_t *entry, uint32_t duration, uint32_t *ret, fastly_compute_at_edge_edge_rate_limiter_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_edge_rate_limiter_ratecounter_lookup_count((int32_t) (*rate_counter_name).ptr, (int32_t) (*rate_counter_name).len, (int32_t) (*entry).ptr, (int32_t) (*entry).len, (int32_t) (duration), ptr); - fastly_world_result_u32_fastly_compute_at_edge_edge_rate_limiter_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_edge_rate_limiter_ratecounter_lookup_count((uint8_t *) (*rate_counter_name).ptr, (*rate_counter_name).len, (uint8_t *) (*entry).ptr, (*entry).len, (int32_t) (duration), ptr); + fastly_compute_at_edge_edge_rate_limiter_result_u32_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -1888,7 +1446,7 @@ bool fastly_compute_at_edge_edge_rate_limiter_ratecounter_lookup_count(fastly_wo } 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; } } @@ -1904,17 +1462,17 @@ bool fastly_compute_at_edge_edge_rate_limiter_ratecounter_lookup_count(fastly_wo bool fastly_compute_at_edge_edge_rate_limiter_penaltybox_add(fastly_world_string_t *penalty_box_name, fastly_world_string_t *entry, uint32_t time_to_live, fastly_compute_at_edge_edge_rate_limiter_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_edge_rate_limiter_penaltybox_add((int32_t) (*penalty_box_name).ptr, (int32_t) (*penalty_box_name).len, (int32_t) (*entry).ptr, (int32_t) (*entry).len, (int32_t) (time_to_live), ptr); - fastly_world_result_void_fastly_compute_at_edge_edge_rate_limiter_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_edge_rate_limiter_penaltybox_add((uint8_t *) (*penalty_box_name).ptr, (*penalty_box_name).len, (uint8_t *) (*entry).ptr, (*entry).len, (int32_t) (time_to_live), ptr); + fastly_compute_at_edge_edge_rate_limiter_result_void_error_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; } } @@ -1929,18 +1487,18 @@ bool fastly_compute_at_edge_edge_rate_limiter_penaltybox_add(fastly_world_string bool fastly_compute_at_edge_edge_rate_limiter_penaltybox_has(fastly_world_string_t *penalty_box_name, fastly_world_string_t *entry, bool *ret, fastly_compute_at_edge_edge_rate_limiter_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_edge_rate_limiter_penaltybox_has((int32_t) (*penalty_box_name).ptr, (int32_t) (*penalty_box_name).len, (int32_t) (*entry).ptr, (int32_t) (*entry).len, ptr); - fastly_world_result_bool_fastly_compute_at_edge_edge_rate_limiter_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_edge_rate_limiter_penaltybox_has((uint8_t *) (*penalty_box_name).ptr, (*penalty_box_name).len, (uint8_t *) (*entry).ptr, (*entry).len, ptr); + fastly_compute_at_edge_edge_rate_limiter_result_bool_error_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; } } @@ -1956,18 +1514,18 @@ bool fastly_compute_at_edge_edge_rate_limiter_penaltybox_has(fastly_world_string bool fastly_compute_at_edge_geo_lookup(fastly_world_list_u8_t *addr_octets, fastly_world_string_t *ret, fastly_compute_at_edge_geo_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_geo_lookup((int32_t) (*addr_octets).ptr, (int32_t) (*addr_octets).len, ptr); - fastly_world_result_string_fastly_compute_at_edge_geo_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_geo_lookup((uint8_t *) (*addr_octets).ptr, (*addr_octets).len, ptr); + fastly_compute_at_edge_geo_result_string_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (fastly_world_string_t) { (char*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + result.val.ok = (fastly_world_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; } } @@ -1983,17 +1541,17 @@ bool fastly_compute_at_edge_geo_lookup(fastly_world_list_u8_t *addr_octets, fast bool fastly_compute_at_edge_http_body_append(fastly_compute_at_edge_http_body_body_handle_t dest, fastly_compute_at_edge_http_body_body_handle_t src, fastly_compute_at_edge_http_body_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_body_append((int32_t) (dest), (int32_t) (src), ptr); - fastly_world_result_void_fastly_compute_at_edge_http_body_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_body_result_void_error_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; } } @@ -2008,10 +1566,10 @@ bool fastly_compute_at_edge_http_body_append(fastly_compute_at_edge_http_body_bo bool fastly_compute_at_edge_http_body_new(fastly_compute_at_edge_http_body_body_handle_t *ret, fastly_compute_at_edge_http_body_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_body_new(ptr); - fastly_world_result_fastly_compute_at_edge_http_body_body_handle_fastly_compute_at_edge_http_body_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_body_result_body_handle_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -2019,7 +1577,7 @@ bool fastly_compute_at_edge_http_body_new(fastly_compute_at_edge_http_body_body_ } 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; } } @@ -2035,18 +1593,18 @@ bool fastly_compute_at_edge_http_body_new(fastly_compute_at_edge_http_body_body_ bool fastly_compute_at_edge_http_body_read(fastly_compute_at_edge_http_body_body_handle_t h, uint32_t chunk_size, fastly_world_list_u8_t *ret, fastly_compute_at_edge_http_body_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_body_read((int32_t) (h), (int32_t) (chunk_size), ptr); - fastly_world_result_list_u8_fastly_compute_at_edge_http_body_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_body_result_list_u8_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (fastly_world_list_u8_t) { (uint8_t*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + result.val.ok = (fastly_world_list_u8_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; } } @@ -2062,10 +1620,10 @@ bool fastly_compute_at_edge_http_body_read(fastly_compute_at_edge_http_body_body bool fastly_compute_at_edge_http_body_write(fastly_compute_at_edge_http_body_body_handle_t h, fastly_world_list_u8_t *buf, fastly_compute_at_edge_http_body_write_end_t end, uint32_t *ret, fastly_compute_at_edge_http_body_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_body_write((int32_t) (h), (int32_t) (*buf).ptr, (int32_t) (*buf).len, (int32_t) end, ptr); - fastly_world_result_u32_fastly_compute_at_edge_http_body_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_body_write((int32_t) (h), (uint8_t *) (*buf).ptr, (*buf).len, (int32_t) end, ptr); + fastly_compute_at_edge_http_body_result_u32_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -2073,7 +1631,7 @@ bool fastly_compute_at_edge_http_body_write(fastly_compute_at_edge_http_body_bod } 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; } } @@ -2089,17 +1647,17 @@ bool fastly_compute_at_edge_http_body_write(fastly_compute_at_edge_http_body_bod bool fastly_compute_at_edge_http_body_close(fastly_compute_at_edge_http_body_body_handle_t h, fastly_compute_at_edge_http_body_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_body_close((int32_t) (h), ptr); - fastly_world_result_void_fastly_compute_at_edge_http_body_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_body_result_void_error_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; } } @@ -2147,29 +1705,29 @@ bool fastly_compute_at_edge_http_req_cache_override_set(fastly_compute_at_edge_h option5 = 0; } int32_t option8; - int32_t option9; - int32_t option10; + uint8_t * option9; + size_t option10; if ((sk).is_some) { const fastly_world_string_t *payload7 = &(sk).val; option8 = 1; - option9 = (int32_t) (*payload7).ptr; - option10 = (int32_t) (*payload7).len; + option9 = (uint8_t *) (*payload7).ptr; + option10 = (*payload7).len; } else { option8 = 0; option9 = 0; option10 = 0; } - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_cache_override_set((int32_t) (h), tag, option, option1, option4, option5, option8, option9, option10, ptr); - fastly_world_result_void_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_void_error_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; } } @@ -2184,18 +1742,18 @@ bool fastly_compute_at_edge_http_req_cache_override_set(fastly_compute_at_edge_h bool fastly_compute_at_edge_http_req_downstream_client_ip_addr(fastly_world_list_u8_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_downstream_client_ip_addr(ptr); - fastly_world_result_list_u8_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_list_u8_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (fastly_world_list_u8_t) { (uint8_t*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + result.val.ok = (fastly_world_list_u8_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; } } @@ -2211,18 +1769,18 @@ bool fastly_compute_at_edge_http_req_downstream_client_ip_addr(fastly_world_list bool fastly_compute_at_edge_http_req_downstream_client_request_id(fastly_world_string_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_downstream_client_request_id(ptr); - fastly_world_result_string_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_string_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (fastly_world_string_t) { (char*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + result.val.ok = (fastly_world_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; } } @@ -2238,18 +1796,18 @@ bool fastly_compute_at_edge_http_req_downstream_client_request_id(fastly_world_s bool fastly_compute_at_edge_http_req_downstream_client_h2_fingerprint(fastly_world_list_u8_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_downstream_client_h2_fingerprint(ptr); - fastly_world_result_list_u8_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_list_u8_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (fastly_world_list_u8_t) { (uint8_t*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + result.val.ok = (fastly_world_list_u8_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; } } @@ -2265,18 +1823,18 @@ bool fastly_compute_at_edge_http_req_downstream_client_h2_fingerprint(fastly_wor bool fastly_compute_at_edge_http_req_downstream_tls_cipher_openssl_name(fastly_world_string_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_downstream_tls_cipher_openssl_name(ptr); - fastly_world_result_string_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_string_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (fastly_world_string_t) { (char*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + result.val.ok = (fastly_world_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; } } @@ -2292,18 +1850,18 @@ bool fastly_compute_at_edge_http_req_downstream_tls_cipher_openssl_name(fastly_w bool fastly_compute_at_edge_http_req_downstream_tls_protocol(fastly_world_string_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_downstream_tls_protocol(ptr); - fastly_world_result_string_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_string_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (fastly_world_string_t) { (char*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + result.val.ok = (fastly_world_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; } } @@ -2319,18 +1877,18 @@ bool fastly_compute_at_edge_http_req_downstream_tls_protocol(fastly_world_string bool fastly_compute_at_edge_http_req_downstream_tls_client_hello(fastly_world_list_u8_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_downstream_tls_client_hello(ptr); - fastly_world_result_list_u8_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_list_u8_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (fastly_world_list_u8_t) { (uint8_t*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + result.val.ok = (fastly_world_list_u8_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; } } @@ -2346,18 +1904,18 @@ bool fastly_compute_at_edge_http_req_downstream_tls_client_hello(fastly_world_li bool fastly_compute_at_edge_http_req_downstream_tls_raw_client_certificate(fastly_world_list_u8_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_downstream_tls_raw_client_certificate(ptr); - fastly_world_result_list_u8_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_list_u8_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (fastly_world_list_u8_t) { (uint8_t*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + result.val.ok = (fastly_world_list_u8_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; } } @@ -2373,17 +1931,17 @@ bool fastly_compute_at_edge_http_req_downstream_tls_raw_client_certificate(fastl bool fastly_compute_at_edge_http_req_downstream_tls_client_cert_verify_result(fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_downstream_tls_client_cert_verify_result(ptr); - fastly_world_result_void_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_void_error_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; } } @@ -2398,18 +1956,18 @@ bool fastly_compute_at_edge_http_req_downstream_tls_client_cert_verify_result(fa bool fastly_compute_at_edge_http_req_downstream_tls_ja3_md5(fastly_world_list_u8_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_downstream_tls_ja3_md5(ptr); - fastly_world_result_list_u8_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_list_u8_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (fastly_world_list_u8_t) { (uint8_t*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + result.val.ok = (fastly_world_list_u8_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; } } @@ -2425,10 +1983,10 @@ bool fastly_compute_at_edge_http_req_downstream_tls_ja3_md5(fastly_world_list_u8 bool fastly_compute_at_edge_http_req_new(fastly_compute_at_edge_http_req_request_handle_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_new(ptr); - fastly_world_result_fastly_compute_at_edge_http_req_request_handle_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_request_handle_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -2436,7 +1994,7 @@ bool fastly_compute_at_edge_http_req_new(fastly_compute_at_edge_http_req_request } 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; } } @@ -2452,18 +2010,18 @@ bool fastly_compute_at_edge_http_req_new(fastly_compute_at_edge_http_req_request bool fastly_compute_at_edge_http_req_header_names_get(fastly_compute_at_edge_http_req_request_handle_t h, fastly_world_list_string_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_header_names_get((int32_t) (h), ptr); - fastly_world_result_list_string_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_list_string_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (fastly_world_list_string_t) { (fastly_world_string_t*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + result.val.ok = (fastly_world_list_string_t) { (fastly_world_string_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; } } @@ -2479,18 +2037,18 @@ bool fastly_compute_at_edge_http_req_header_names_get(fastly_compute_at_edge_htt bool fastly_compute_at_edge_http_req_original_header_names_get(fastly_world_list_string_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_original_header_names_get(ptr); - fastly_world_result_list_string_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_list_string_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (fastly_world_list_string_t) { (fastly_world_string_t*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + result.val.ok = (fastly_world_list_string_t) { (fastly_world_string_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; } } @@ -2506,10 +2064,10 @@ bool fastly_compute_at_edge_http_req_original_header_names_get(fastly_world_list bool fastly_compute_at_edge_http_req_original_header_count(uint32_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_original_header_count(ptr); - fastly_world_result_u32_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_u32_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -2517,7 +2075,7 @@ bool fastly_compute_at_edge_http_req_original_header_count(uint32_t *ret, fastly } 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; } } @@ -2533,31 +2091,31 @@ bool fastly_compute_at_edge_http_req_original_header_count(uint32_t *ret, fastly bool fastly_compute_at_edge_http_req_header_value_get(fastly_compute_at_edge_http_req_request_handle_t h, fastly_world_string_t *name, fastly_world_option_list_u8_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_req_header_value_get((int32_t) (h), (int32_t) (*name).ptr, (int32_t) (*name).len, ptr); - fastly_world_result_option_list_u8_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_req_header_value_get((int32_t) (h), (uint8_t *) (*name).ptr, (*name).len, ptr); + fastly_compute_at_edge_http_req_result_option_list_u8_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; fastly_world_option_list_u8_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 4)))) { + switch ((int32_t) *((uint8_t*) (ptr + 4))) { case 0: { option.is_some = false; break; } case 1: { option.is_some = true; - option.val = (fastly_world_list_u8_t) { (uint8_t*)(*((int32_t*) (ptr + 8))), (size_t)(*((int32_t*) (ptr + 12))) }; + option.val = (fastly_world_list_u8_t) { (uint8_t*)(*((uint8_t **) (ptr + 8))), (*((size_t*) (ptr + 12))) }; 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; } } @@ -2573,31 +2131,31 @@ bool fastly_compute_at_edge_http_req_header_value_get(fastly_compute_at_edge_htt bool fastly_compute_at_edge_http_req_header_values_get(fastly_compute_at_edge_http_req_request_handle_t h, fastly_world_string_t *name, fastly_world_option_list_list_u8_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_req_header_values_get((int32_t) (h), (int32_t) (*name).ptr, (int32_t) (*name).len, ptr); - fastly_world_result_option_list_list_u8_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_req_header_values_get((int32_t) (h), (uint8_t *) (*name).ptr, (*name).len, ptr); + fastly_compute_at_edge_http_req_result_option_list_list_u8_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; fastly_world_option_list_list_u8_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 4)))) { + switch ((int32_t) *((uint8_t*) (ptr + 4))) { case 0: { option.is_some = false; break; } case 1: { option.is_some = true; - option.val = (fastly_world_list_list_u8_t) { (fastly_world_list_u8_t*)(*((int32_t*) (ptr + 8))), (size_t)(*((int32_t*) (ptr + 12))) }; + option.val = (fastly_world_list_list_u8_t) { (fastly_world_list_u8_t*)(*((uint8_t **) (ptr + 8))), (*((size_t*) (ptr + 12))) }; 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; } } @@ -2613,17 +2171,17 @@ bool fastly_compute_at_edge_http_req_header_values_get(fastly_compute_at_edge_ht bool fastly_compute_at_edge_http_req_header_values_set(fastly_compute_at_edge_http_req_request_handle_t h, fastly_world_string_t *name, fastly_world_list_list_u8_t *values, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_req_header_values_set((int32_t) (h), (int32_t) (*name).ptr, (int32_t) (*name).len, (int32_t) (*values).ptr, (int32_t) (*values).len, ptr); - fastly_world_result_void_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_req_header_values_set((int32_t) (h), (uint8_t *) (*name).ptr, (*name).len, (uint8_t *) (*values).ptr, (*values).len, ptr); + fastly_compute_at_edge_http_req_result_void_error_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; } } @@ -2638,17 +2196,17 @@ bool fastly_compute_at_edge_http_req_header_values_set(fastly_compute_at_edge_ht bool fastly_compute_at_edge_http_req_header_insert(fastly_compute_at_edge_http_req_request_handle_t h, fastly_world_string_t *name, fastly_world_list_u8_t *value, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_req_header_insert((int32_t) (h), (int32_t) (*name).ptr, (int32_t) (*name).len, (int32_t) (*value).ptr, (int32_t) (*value).len, ptr); - fastly_world_result_void_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_req_header_insert((int32_t) (h), (uint8_t *) (*name).ptr, (*name).len, (uint8_t *) (*value).ptr, (*value).len, ptr); + fastly_compute_at_edge_http_req_result_void_error_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; } } @@ -2663,17 +2221,17 @@ bool fastly_compute_at_edge_http_req_header_insert(fastly_compute_at_edge_http_r bool fastly_compute_at_edge_http_req_header_append(fastly_compute_at_edge_http_req_request_handle_t h, fastly_world_string_t *name, fastly_world_list_u8_t *value, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_req_header_append((int32_t) (h), (int32_t) (*name).ptr, (int32_t) (*name).len, (int32_t) (*value).ptr, (int32_t) (*value).len, ptr); - fastly_world_result_void_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_req_header_append((int32_t) (h), (uint8_t *) (*name).ptr, (*name).len, (uint8_t *) (*value).ptr, (*value).len, ptr); + fastly_compute_at_edge_http_req_result_void_error_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; } } @@ -2688,17 +2246,17 @@ bool fastly_compute_at_edge_http_req_header_append(fastly_compute_at_edge_http_r bool fastly_compute_at_edge_http_req_header_remove(fastly_compute_at_edge_http_req_request_handle_t h, fastly_world_string_t *name, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_req_header_remove((int32_t) (h), (int32_t) (*name).ptr, (int32_t) (*name).len, ptr); - fastly_world_result_void_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_req_header_remove((int32_t) (h), (uint8_t *) (*name).ptr, (*name).len, ptr); + fastly_compute_at_edge_http_req_result_void_error_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; } } @@ -2713,18 +2271,18 @@ bool fastly_compute_at_edge_http_req_header_remove(fastly_compute_at_edge_http_r bool fastly_compute_at_edge_http_req_method_get(fastly_compute_at_edge_http_req_request_handle_t h, fastly_world_string_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_method_get((int32_t) (h), ptr); - fastly_world_result_string_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_string_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (fastly_world_string_t) { (char*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + result.val.ok = (fastly_world_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; } } @@ -2740,17 +2298,17 @@ bool fastly_compute_at_edge_http_req_method_get(fastly_compute_at_edge_http_req_ bool fastly_compute_at_edge_http_req_method_set(fastly_compute_at_edge_http_req_request_handle_t h, fastly_world_string_t *method, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_req_method_set((int32_t) (h), (int32_t) (*method).ptr, (int32_t) (*method).len, ptr); - fastly_world_result_void_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_req_method_set((int32_t) (h), (uint8_t *) (*method).ptr, (*method).len, ptr); + fastly_compute_at_edge_http_req_result_void_error_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; } } @@ -2765,18 +2323,18 @@ bool fastly_compute_at_edge_http_req_method_set(fastly_compute_at_edge_http_req_ bool fastly_compute_at_edge_http_req_uri_get(fastly_compute_at_edge_http_req_request_handle_t h, fastly_world_string_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_uri_get((int32_t) (h), ptr); - fastly_world_result_string_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_string_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (fastly_world_string_t) { (char*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + result.val.ok = (fastly_world_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; } } @@ -2792,17 +2350,17 @@ bool fastly_compute_at_edge_http_req_uri_get(fastly_compute_at_edge_http_req_req bool fastly_compute_at_edge_http_req_uri_set(fastly_compute_at_edge_http_req_request_handle_t h, fastly_world_string_t *uri, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_req_uri_set((int32_t) (h), (int32_t) (*uri).ptr, (int32_t) (*uri).len, ptr); - fastly_world_result_void_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_req_uri_set((int32_t) (h), (uint8_t *) (*uri).ptr, (*uri).len, ptr); + fastly_compute_at_edge_http_req_result_void_error_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; } } @@ -2817,18 +2375,18 @@ bool fastly_compute_at_edge_http_req_uri_set(fastly_compute_at_edge_http_req_req bool fastly_compute_at_edge_http_req_version_get(fastly_compute_at_edge_http_req_request_handle_t h, fastly_compute_at_edge_http_req_http_version_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_version_get((int32_t) (h), ptr); - fastly_world_result_fastly_compute_at_edge_http_req_http_version_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_http_version_error_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; } } @@ -2844,17 +2402,17 @@ bool fastly_compute_at_edge_http_req_version_get(fastly_compute_at_edge_http_req bool fastly_compute_at_edge_http_req_version_set(fastly_compute_at_edge_http_req_request_handle_t h, fastly_compute_at_edge_http_req_http_version_t version, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_version_set((int32_t) (h), (int32_t) version, ptr); - fastly_world_result_void_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_void_error_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; } } @@ -2869,21 +2427,21 @@ bool fastly_compute_at_edge_http_req_version_set(fastly_compute_at_edge_http_req bool fastly_compute_at_edge_http_req_send(fastly_compute_at_edge_http_req_request_handle_t h, fastly_compute_at_edge_http_req_body_handle_t b, fastly_world_string_t *backend, fastly_compute_at_edge_http_req_response_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_req_send((int32_t) (h), (int32_t) (b), (int32_t) (*backend).ptr, (int32_t) (*backend).len, ptr); - fastly_world_result_fastly_compute_at_edge_http_req_response_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_req_send((int32_t) (h), (int32_t) (b), (uint8_t *) (*backend).ptr, (*backend).len, ptr); + fastly_compute_at_edge_http_req_result_response_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (fastly_compute_at_edge_http_types_response_t) { - (uint32_t) (*((int32_t*) (ptr + 4))), - (uint32_t) (*((int32_t*) (ptr + 8))), + (fastly_compute_at_edge_http_types_response_handle_t) (uint32_t) (*((int32_t*) (ptr + 4))), + (fastly_compute_at_edge_http_types_body_handle_t) (uint32_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; } } @@ -2899,21 +2457,21 @@ bool fastly_compute_at_edge_http_req_send(fastly_compute_at_edge_http_req_reques bool fastly_compute_at_edge_http_req_send_v2(fastly_compute_at_edge_http_req_request_handle_t h, fastly_compute_at_edge_http_req_send_error_detail_t *s, fastly_compute_at_edge_http_req_body_handle_t b, fastly_world_string_t *backend, fastly_compute_at_edge_http_req_response_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_req_send_v2((int32_t) (h), (int32_t) (*s).tag, (*s).mask, (int32_t) ((*s).dns_error_rcode), (int32_t) ((*s).dns_error_info_code), (int32_t) ((*s).tls_alert_id), (int32_t) (b), (int32_t) (*backend).ptr, (int32_t) (*backend).len, ptr); - fastly_world_result_fastly_compute_at_edge_http_req_response_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_req_send_v2((int32_t) (h), (int32_t) (*s).tag, (*s).mask, (int32_t) ((*s).dns_error_rcode), (int32_t) ((*s).dns_error_info_code), (int32_t) ((*s).tls_alert_id), (int32_t) (b), (uint8_t *) (*backend).ptr, (*backend).len, ptr); + fastly_compute_at_edge_http_req_result_response_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (fastly_compute_at_edge_http_types_response_t) { - (uint32_t) (*((int32_t*) (ptr + 4))), - (uint32_t) (*((int32_t*) (ptr + 8))), + (fastly_compute_at_edge_http_types_response_handle_t) (uint32_t) (*((int32_t*) (ptr + 4))), + (fastly_compute_at_edge_http_types_body_handle_t) (uint32_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; } } @@ -2929,10 +2487,10 @@ bool fastly_compute_at_edge_http_req_send_v2(fastly_compute_at_edge_http_req_req bool fastly_compute_at_edge_http_req_send_async(fastly_compute_at_edge_http_req_request_handle_t h, fastly_compute_at_edge_http_req_body_handle_t b, fastly_world_string_t *backend, fastly_compute_at_edge_http_req_pending_request_handle_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_req_send_async((int32_t) (h), (int32_t) (b), (int32_t) (*backend).ptr, (int32_t) (*backend).len, ptr); - fastly_world_result_fastly_compute_at_edge_http_req_pending_request_handle_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_req_send_async((int32_t) (h), (int32_t) (b), (uint8_t *) (*backend).ptr, (*backend).len, ptr); + fastly_compute_at_edge_http_req_result_pending_request_handle_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -2940,7 +2498,7 @@ bool fastly_compute_at_edge_http_req_send_async(fastly_compute_at_edge_http_req_ } 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; } } @@ -2956,10 +2514,10 @@ bool fastly_compute_at_edge_http_req_send_async(fastly_compute_at_edge_http_req_ bool fastly_compute_at_edge_http_req_send_async_streaming(fastly_compute_at_edge_http_req_request_handle_t h, fastly_compute_at_edge_http_req_body_handle_t b, fastly_world_string_t *backend, fastly_compute_at_edge_http_req_pending_request_handle_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_req_send_async_streaming((int32_t) (h), (int32_t) (b), (int32_t) (*backend).ptr, (int32_t) (*backend).len, ptr); - fastly_world_result_fastly_compute_at_edge_http_req_pending_request_handle_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_req_send_async_streaming((int32_t) (h), (int32_t) (b), (uint8_t *) (*backend).ptr, (*backend).len, ptr); + fastly_compute_at_edge_http_req_result_pending_request_handle_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -2967,7 +2525,7 @@ bool fastly_compute_at_edge_http_req_send_async_streaming(fastly_compute_at_edge } 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; } } @@ -2980,17 +2538,17 @@ bool fastly_compute_at_edge_http_req_send_async_streaming(fastly_compute_at_edge } } -bool fastly_compute_at_edge_http_req_pending_req_poll(fastly_compute_at_edge_http_req_pending_request_handle_t h, fastly_world_option_fastly_compute_at_edge_http_req_response_t *ret, fastly_compute_at_edge_http_req_error_t *err) { +bool fastly_compute_at_edge_http_req_pending_req_poll(fastly_compute_at_edge_http_req_pending_request_handle_t h, fastly_world_option_response_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_pending_req_poll((int32_t) (h), ptr); - fastly_world_result_option_fastly_compute_at_edge_http_req_response_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_option_response_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - fastly_world_option_fastly_compute_at_edge_http_req_response_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 4)))) { + fastly_world_option_response_t option; + switch ((int32_t) *((uint8_t*) (ptr + 4))) { case 0: { option.is_some = false; break; @@ -2998,19 +2556,19 @@ bool fastly_compute_at_edge_http_req_pending_req_poll(fastly_compute_at_edge_htt case 1: { option.is_some = true; option.val = (fastly_compute_at_edge_http_types_response_t) { - (uint32_t) (*((int32_t*) (ptr + 8))), - (uint32_t) (*((int32_t*) (ptr + 12))), + (fastly_compute_at_edge_http_types_response_handle_t) (uint32_t) (*((int32_t*) (ptr + 8))), + (fastly_compute_at_edge_http_types_body_handle_t) (uint32_t) (*((int32_t*) (ptr + 12))), }; 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; } } @@ -3023,17 +2581,17 @@ bool fastly_compute_at_edge_http_req_pending_req_poll(fastly_compute_at_edge_htt } } -bool fastly_compute_at_edge_http_req_pending_req_poll_v2(fastly_compute_at_edge_http_req_pending_request_handle_t h, fastly_compute_at_edge_http_req_send_error_detail_t *s, fastly_world_option_fastly_compute_at_edge_http_req_response_t *ret, fastly_compute_at_edge_http_req_error_t *err) { +bool fastly_compute_at_edge_http_req_pending_req_poll_v2(fastly_compute_at_edge_http_req_pending_request_handle_t h, fastly_compute_at_edge_http_req_send_error_detail_t *s, fastly_world_option_response_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_pending_req_poll_v2((int32_t) (h), (int32_t) (*s).tag, (*s).mask, (int32_t) ((*s).dns_error_rcode), (int32_t) ((*s).dns_error_info_code), (int32_t) ((*s).tls_alert_id), ptr); - fastly_world_result_option_fastly_compute_at_edge_http_req_response_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_option_response_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - fastly_world_option_fastly_compute_at_edge_http_req_response_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 4)))) { + fastly_world_option_response_t option; + switch ((int32_t) *((uint8_t*) (ptr + 4))) { case 0: { option.is_some = false; break; @@ -3041,19 +2599,19 @@ bool fastly_compute_at_edge_http_req_pending_req_poll_v2(fastly_compute_at_edge_ case 1: { option.is_some = true; option.val = (fastly_compute_at_edge_http_types_response_t) { - (uint32_t) (*((int32_t*) (ptr + 8))), - (uint32_t) (*((int32_t*) (ptr + 12))), + (fastly_compute_at_edge_http_types_response_handle_t) (uint32_t) (*((int32_t*) (ptr + 8))), + (fastly_compute_at_edge_http_types_body_handle_t) (uint32_t) (*((int32_t*) (ptr + 12))), }; 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; } } @@ -3069,21 +2627,21 @@ bool fastly_compute_at_edge_http_req_pending_req_poll_v2(fastly_compute_at_edge_ bool fastly_compute_at_edge_http_req_pending_req_wait(fastly_compute_at_edge_http_req_pending_request_handle_t h, fastly_compute_at_edge_http_req_response_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_pending_req_wait((int32_t) (h), ptr); - fastly_world_result_fastly_compute_at_edge_http_req_response_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_response_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (fastly_compute_at_edge_http_types_response_t) { - (uint32_t) (*((int32_t*) (ptr + 4))), - (uint32_t) (*((int32_t*) (ptr + 8))), + (fastly_compute_at_edge_http_types_response_handle_t) (uint32_t) (*((int32_t*) (ptr + 4))), + (fastly_compute_at_edge_http_types_body_handle_t) (uint32_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; } } @@ -3099,21 +2657,21 @@ bool fastly_compute_at_edge_http_req_pending_req_wait(fastly_compute_at_edge_htt bool fastly_compute_at_edge_http_req_pending_req_wait_v2(fastly_compute_at_edge_http_req_pending_request_handle_t h, fastly_compute_at_edge_http_req_send_error_detail_t *s, fastly_compute_at_edge_http_req_response_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_pending_req_wait_v2((int32_t) (h), (int32_t) (*s).tag, (*s).mask, (int32_t) ((*s).dns_error_rcode), (int32_t) ((*s).dns_error_info_code), (int32_t) ((*s).tls_alert_id), ptr); - fastly_world_result_fastly_compute_at_edge_http_req_response_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_response_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (fastly_compute_at_edge_http_types_response_t) { - (uint32_t) (*((int32_t*) (ptr + 4))), - (uint32_t) (*((int32_t*) (ptr + 8))), + (fastly_compute_at_edge_http_types_response_handle_t) (uint32_t) (*((int32_t*) (ptr + 4))), + (fastly_compute_at_edge_http_types_body_handle_t) (uint32_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; } } @@ -3126,27 +2684,27 @@ bool fastly_compute_at_edge_http_req_pending_req_wait_v2(fastly_compute_at_edge_ } } -bool fastly_compute_at_edge_http_req_pending_req_select(fastly_world_list_fastly_compute_at_edge_http_req_pending_request_handle_t *h, fastly_world_tuple2_u32_fastly_compute_at_edge_http_req_response_t *ret, fastly_compute_at_edge_http_req_error_t *err) { +bool fastly_compute_at_edge_http_req_pending_req_select(fastly_world_list_pending_request_handle_t *h, fastly_world_tuple2_u32_response_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_req_pending_req_select((int32_t) (*h).ptr, (int32_t) (*h).len, ptr); - fastly_world_result_tuple2_u32_fastly_compute_at_edge_http_req_response_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_req_pending_req_select((uint8_t *) (*h).ptr, (*h).len, ptr); + fastly_compute_at_edge_http_req_result_tuple2_u32_response_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (fastly_world_tuple2_u32_fastly_compute_at_edge_http_req_response_t) { - (uint32_t) (*((int32_t*) (ptr + 4))), - (fastly_compute_at_edge_http_types_response_t) { - (uint32_t) (*((int32_t*) (ptr + 8))), - (uint32_t) (*((int32_t*) (ptr + 12))), + result.val.ok = (fastly_world_tuple2_u32_response_t) { + (uint32_t) (uint32_t) (*((int32_t*) (ptr + 4))), + (fastly_compute_at_edge_http_req_response_t) (fastly_compute_at_edge_http_types_response_t) { + (fastly_compute_at_edge_http_types_response_handle_t) (uint32_t) (*((int32_t*) (ptr + 8))), + (fastly_compute_at_edge_http_types_body_handle_t) (uint32_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; } } @@ -3159,20 +2717,20 @@ bool fastly_compute_at_edge_http_req_pending_req_select(fastly_world_list_fastly } } -bool fastly_compute_at_edge_http_req_pending_req_select_v2(fastly_world_list_fastly_compute_at_edge_http_req_pending_request_handle_t *h, fastly_world_tuple2_u32_fastly_compute_at_edge_http_req_response_t *ret, fastly_compute_at_edge_http_req_send_error_detail_t *err) { +bool fastly_compute_at_edge_http_req_pending_req_select_v2(fastly_world_list_pending_request_handle_t *h, fastly_world_tuple2_u32_response_t *ret, fastly_compute_at_edge_http_req_send_error_detail_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_req_pending_req_select_v2((int32_t) (*h).ptr, (int32_t) (*h).len, ptr); - fastly_world_result_tuple2_u32_fastly_compute_at_edge_http_req_response_fastly_compute_at_edge_http_req_send_error_detail_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_req_pending_req_select_v2((uint8_t *) (*h).ptr, (*h).len, ptr); + fastly_compute_at_edge_http_req_result_tuple2_u32_response_send_error_detail_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (fastly_world_tuple2_u32_fastly_compute_at_edge_http_req_response_t) { - (uint32_t) (*((int32_t*) (ptr + 4))), - (fastly_compute_at_edge_http_types_response_t) { - (uint32_t) (*((int32_t*) (ptr + 8))), - (uint32_t) (*((int32_t*) (ptr + 12))), + result.val.ok = (fastly_world_tuple2_u32_response_t) { + (uint32_t) (uint32_t) (*((int32_t*) (ptr + 4))), + (fastly_compute_at_edge_http_req_response_t) (fastly_compute_at_edge_http_types_response_t) { + (fastly_compute_at_edge_http_types_response_handle_t) (uint32_t) (*((int32_t*) (ptr + 8))), + (fastly_compute_at_edge_http_types_body_handle_t) (uint32_t) (*((int32_t*) (ptr + 12))), }, }; break; @@ -3180,11 +2738,11 @@ bool fastly_compute_at_edge_http_req_pending_req_select_v2(fastly_world_list_fas case 1: { result.is_err = true; result.val.err = (fastly_compute_at_edge_http_types_send_error_detail_t) { - (int32_t) (*((uint8_t*) (ptr + 4))), - (int32_t) (*((uint8_t*) (ptr + 5))), - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 6)))), - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 8)))), - (uint8_t) ((int32_t) (*((uint8_t*) (ptr + 10)))), + (fastly_compute_at_edge_http_types_send_error_detail_tag_t) (int32_t) *((uint8_t*) (ptr + 4)), + (fastly_compute_at_edge_http_types_send_error_detail_mask_t) (int32_t) *((uint8_t*) (ptr + 5)), + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 6))), + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 8))), + (uint8_t) (uint8_t) ((int32_t) *((uint8_t*) (ptr + 10))), }; break; } @@ -3201,17 +2759,17 @@ bool fastly_compute_at_edge_http_req_pending_req_select_v2(fastly_world_list_fas bool fastly_compute_at_edge_http_req_close(fastly_compute_at_edge_http_req_request_handle_t h, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_close((int32_t) (h), ptr); - fastly_world_result_void_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_void_error_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; } } @@ -3226,17 +2784,17 @@ bool fastly_compute_at_edge_http_req_close(fastly_compute_at_edge_http_req_reque bool fastly_compute_at_edge_http_req_auto_decompress_response_set(fastly_compute_at_edge_http_req_request_handle_t h, fastly_compute_at_edge_http_req_content_encodings_t encodings, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_auto_decompress_response_set((int32_t) (h), encodings, ptr); - fastly_world_result_void_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_void_error_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; } } @@ -3251,17 +2809,17 @@ bool fastly_compute_at_edge_http_req_auto_decompress_response_set(fastly_compute bool fastly_compute_at_edge_http_req_upgrade_websocket(fastly_world_string_t *backend, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_req_upgrade_websocket((int32_t) (*backend).ptr, (int32_t) (*backend).len, ptr); - fastly_world_result_void_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_req_upgrade_websocket((uint8_t *) (*backend).ptr, (*backend).len, ptr); + fastly_compute_at_edge_http_req_result_void_error_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; } } @@ -3276,17 +2834,17 @@ bool fastly_compute_at_edge_http_req_upgrade_websocket(fastly_world_string_t *ba bool fastly_compute_at_edge_http_req_redirect_to_websocket_proxy(fastly_world_string_t *backend, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_req_redirect_to_websocket_proxy((int32_t) (*backend).ptr, (int32_t) (*backend).len, ptr); - fastly_world_result_void_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_req_redirect_to_websocket_proxy((uint8_t *) (*backend).ptr, (*backend).len, ptr); + fastly_compute_at_edge_http_req_result_void_error_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; } } @@ -3301,17 +2859,17 @@ bool fastly_compute_at_edge_http_req_redirect_to_websocket_proxy(fastly_world_st bool fastly_compute_at_edge_http_req_redirect_to_grip_proxy(fastly_world_string_t *backend, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_req_redirect_to_grip_proxy((int32_t) (*backend).ptr, (int32_t) (*backend).len, ptr); - fastly_world_result_void_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_req_redirect_to_grip_proxy((uint8_t *) (*backend).ptr, (*backend).len, ptr); + fastly_compute_at_edge_http_req_result_void_error_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; } } @@ -3326,17 +2884,17 @@ bool fastly_compute_at_edge_http_req_redirect_to_grip_proxy(fastly_world_string_ bool fastly_compute_at_edge_http_req_framing_headers_mode_set(fastly_compute_at_edge_http_req_request_handle_t h, fastly_compute_at_edge_http_req_framing_headers_mode_t mode, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_framing_headers_mode_set((int32_t) (h), (int32_t) mode, ptr); - fastly_world_result_void_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_void_error_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; } } @@ -3351,16 +2909,16 @@ bool fastly_compute_at_edge_http_req_framing_headers_mode_set(fastly_compute_at_ bool fastly_compute_at_edge_http_req_register_dynamic_backend(fastly_world_string_t *prefix, fastly_world_string_t *target, fastly_compute_at_edge_http_req_dynamic_backend_config_t *config, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[124]; - int32_t ptr = (int32_t) &ret_area; - *((int32_t*)(ptr + 4)) = (int32_t) (*prefix).len; - *((int32_t*)(ptr + 0)) = (int32_t) (*prefix).ptr; - *((int32_t*)(ptr + 12)) = (int32_t) (*target).len; - *((int32_t*)(ptr + 8)) = (int32_t) (*target).ptr; + uint8_t *ptr = (uint8_t *) &ret_area; + *((size_t*)(ptr + 4)) = (*prefix).len; + *((uint8_t **)(ptr + 0)) = (uint8_t *) (*prefix).ptr; + *((size_t*)(ptr + 12)) = (*target).len; + *((uint8_t **)(ptr + 8)) = (uint8_t *) (*target).ptr; if (((*config).host_override).is_some) { const fastly_world_string_t *payload0 = &((*config).host_override).val; *((int8_t*)(ptr + 16)) = 1; - *((int32_t*)(ptr + 24)) = (int32_t) (*payload0).len; - *((int32_t*)(ptr + 20)) = (int32_t) (*payload0).ptr; + *((size_t*)(ptr + 24)) = (*payload0).len; + *((uint8_t **)(ptr + 20)) = (uint8_t *) (*payload0).ptr; } else { *((int8_t*)(ptr + 16)) = 0; } @@ -3416,55 +2974,55 @@ bool fastly_compute_at_edge_http_req_register_dynamic_backend(fastly_world_strin if (((*config).cert_hostname).is_some) { const fastly_world_string_t *payload16 = &((*config).cert_hostname).val; *((int8_t*)(ptr + 60)) = 1; - *((int32_t*)(ptr + 68)) = (int32_t) (*payload16).len; - *((int32_t*)(ptr + 64)) = (int32_t) (*payload16).ptr; + *((size_t*)(ptr + 68)) = (*payload16).len; + *((uint8_t **)(ptr + 64)) = (uint8_t *) (*payload16).ptr; } else { *((int8_t*)(ptr + 60)) = 0; } if (((*config).ca_cert).is_some) { const fastly_world_string_t *payload18 = &((*config).ca_cert).val; *((int8_t*)(ptr + 72)) = 1; - *((int32_t*)(ptr + 80)) = (int32_t) (*payload18).len; - *((int32_t*)(ptr + 76)) = (int32_t) (*payload18).ptr; + *((size_t*)(ptr + 80)) = (*payload18).len; + *((uint8_t **)(ptr + 76)) = (uint8_t *) (*payload18).ptr; } else { *((int8_t*)(ptr + 72)) = 0; } if (((*config).ciphers).is_some) { const fastly_world_string_t *payload20 = &((*config).ciphers).val; *((int8_t*)(ptr + 84)) = 1; - *((int32_t*)(ptr + 92)) = (int32_t) (*payload20).len; - *((int32_t*)(ptr + 88)) = (int32_t) (*payload20).ptr; + *((size_t*)(ptr + 92)) = (*payload20).len; + *((uint8_t **)(ptr + 88)) = (uint8_t *) (*payload20).ptr; } else { *((int8_t*)(ptr + 84)) = 0; } if (((*config).sni_hostname).is_some) { const fastly_world_string_t *payload22 = &((*config).sni_hostname).val; *((int8_t*)(ptr + 96)) = 1; - *((int32_t*)(ptr + 104)) = (int32_t) (*payload22).len; - *((int32_t*)(ptr + 100)) = (int32_t) (*payload22).ptr; + *((size_t*)(ptr + 104)) = (*payload22).len; + *((uint8_t **)(ptr + 100)) = (uint8_t *) (*payload22).ptr; } else { *((int8_t*)(ptr + 96)) = 0; } if (((*config).client_cert).is_some) { const fastly_compute_at_edge_http_types_client_cert_config_t *payload24 = &((*config).client_cert).val; *((int8_t*)(ptr + 108)) = 1; - *((int32_t*)(ptr + 116)) = (int32_t) ((*payload24).client_cert).len; - *((int32_t*)(ptr + 112)) = (int32_t) ((*payload24).client_cert).ptr; + *((size_t*)(ptr + 116)) = ((*payload24).client_cert).len; + *((uint8_t **)(ptr + 112)) = (uint8_t *) ((*payload24).client_cert).ptr; *((int32_t*)(ptr + 120)) = (int32_t) ((*payload24).client_key); } else { *((int8_t*)(ptr + 108)) = 0; } - int32_t ptr25 = (int32_t) &ret_area; + uint8_t *ptr25 = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_register_dynamic_backend(ptr, ptr25); - fastly_world_result_void_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr25 + 0)))) { + fastly_compute_at_edge_http_req_result_void_error_t result; + switch ((int32_t) *((uint8_t*) (ptr25 + 0))) { case 0: { result.is_err = false; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr25 + 1))); + result.val.err = (int32_t) *((uint8_t*) (ptr25 + 1)); break; } } @@ -3479,10 +3037,10 @@ bool fastly_compute_at_edge_http_req_register_dynamic_backend(fastly_world_strin bool fastly_compute_at_edge_http_resp_new(fastly_compute_at_edge_http_resp_response_handle_t *ret, fastly_compute_at_edge_http_resp_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_resp_new(ptr); - fastly_world_result_fastly_compute_at_edge_http_resp_response_handle_fastly_compute_at_edge_http_resp_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_resp_result_response_handle_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -3490,7 +3048,7 @@ bool fastly_compute_at_edge_http_resp_new(fastly_compute_at_edge_http_resp_respo } 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; } } @@ -3506,18 +3064,18 @@ bool fastly_compute_at_edge_http_resp_new(fastly_compute_at_edge_http_resp_respo bool fastly_compute_at_edge_http_resp_header_names_get(fastly_compute_at_edge_http_resp_response_handle_t h, fastly_world_list_string_t *ret, fastly_compute_at_edge_http_resp_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_resp_header_names_get((int32_t) (h), ptr); - fastly_world_result_list_string_fastly_compute_at_edge_http_resp_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_resp_result_list_string_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (fastly_world_list_string_t) { (fastly_world_string_t*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + result.val.ok = (fastly_world_list_string_t) { (fastly_world_string_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; } } @@ -3533,31 +3091,31 @@ bool fastly_compute_at_edge_http_resp_header_names_get(fastly_compute_at_edge_ht bool fastly_compute_at_edge_http_resp_header_value_get(fastly_compute_at_edge_http_resp_response_handle_t h, fastly_world_string_t *name, fastly_world_option_string_t *ret, fastly_compute_at_edge_http_resp_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_resp_header_value_get((int32_t) (h), (int32_t) (*name).ptr, (int32_t) (*name).len, ptr); - fastly_world_result_option_string_fastly_compute_at_edge_http_resp_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_resp_header_value_get((int32_t) (h), (uint8_t *) (*name).ptr, (*name).len, ptr); + fastly_compute_at_edge_http_resp_result_option_string_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; fastly_world_option_string_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 4)))) { + switch ((int32_t) *((uint8_t*) (ptr + 4))) { case 0: { option.is_some = false; break; } case 1: { option.is_some = true; - option.val = (fastly_world_string_t) { (char*)(*((int32_t*) (ptr + 8))), (size_t)(*((int32_t*) (ptr + 12))) }; + option.val = (fastly_world_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 8))), (*((size_t*) (ptr + 12))) }; 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; } } @@ -3573,31 +3131,31 @@ bool fastly_compute_at_edge_http_resp_header_value_get(fastly_compute_at_edge_ht bool fastly_compute_at_edge_http_resp_header_values_get(fastly_compute_at_edge_http_resp_response_handle_t h, fastly_world_string_t *name, fastly_world_option_list_list_u8_t *ret, fastly_compute_at_edge_http_resp_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_resp_header_values_get((int32_t) (h), (int32_t) (*name).ptr, (int32_t) (*name).len, ptr); - fastly_world_result_option_list_list_u8_fastly_compute_at_edge_http_resp_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_resp_header_values_get((int32_t) (h), (uint8_t *) (*name).ptr, (*name).len, ptr); + fastly_compute_at_edge_http_resp_result_option_list_list_u8_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; fastly_world_option_list_list_u8_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 4)))) { + switch ((int32_t) *((uint8_t*) (ptr + 4))) { case 0: { option.is_some = false; break; } case 1: { option.is_some = true; - option.val = (fastly_world_list_list_u8_t) { (fastly_world_list_u8_t*)(*((int32_t*) (ptr + 8))), (size_t)(*((int32_t*) (ptr + 12))) }; + option.val = (fastly_world_list_list_u8_t) { (fastly_world_list_u8_t*)(*((uint8_t **) (ptr + 8))), (*((size_t*) (ptr + 12))) }; 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; } } @@ -3613,17 +3171,17 @@ bool fastly_compute_at_edge_http_resp_header_values_get(fastly_compute_at_edge_h bool fastly_compute_at_edge_http_resp_header_values_set(fastly_compute_at_edge_http_resp_response_handle_t h, fastly_world_string_t *name, fastly_world_list_list_u8_t *values, fastly_compute_at_edge_http_resp_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_resp_header_values_set((int32_t) (h), (int32_t) (*name).ptr, (int32_t) (*name).len, (int32_t) (*values).ptr, (int32_t) (*values).len, ptr); - fastly_world_result_void_fastly_compute_at_edge_http_resp_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_resp_header_values_set((int32_t) (h), (uint8_t *) (*name).ptr, (*name).len, (uint8_t *) (*values).ptr, (*values).len, ptr); + fastly_compute_at_edge_http_resp_result_void_error_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; } } @@ -3638,17 +3196,17 @@ bool fastly_compute_at_edge_http_resp_header_values_set(fastly_compute_at_edge_h bool fastly_compute_at_edge_http_resp_header_insert(fastly_compute_at_edge_http_resp_response_handle_t h, fastly_world_string_t *name, fastly_world_list_u8_t *value, fastly_compute_at_edge_http_resp_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_resp_header_insert((int32_t) (h), (int32_t) (*name).ptr, (int32_t) (*name).len, (int32_t) (*value).ptr, (int32_t) (*value).len, ptr); - fastly_world_result_void_fastly_compute_at_edge_http_resp_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_resp_header_insert((int32_t) (h), (uint8_t *) (*name).ptr, (*name).len, (uint8_t *) (*value).ptr, (*value).len, ptr); + fastly_compute_at_edge_http_resp_result_void_error_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; } } @@ -3663,17 +3221,17 @@ bool fastly_compute_at_edge_http_resp_header_insert(fastly_compute_at_edge_http_ bool fastly_compute_at_edge_http_resp_header_append(fastly_compute_at_edge_http_resp_response_handle_t h, fastly_world_string_t *name, fastly_world_list_u8_t *value, fastly_compute_at_edge_http_resp_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_resp_header_append((int32_t) (h), (int32_t) (*name).ptr, (int32_t) (*name).len, (int32_t) (*value).ptr, (int32_t) (*value).len, ptr); - fastly_world_result_void_fastly_compute_at_edge_http_resp_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_resp_header_append((int32_t) (h), (uint8_t *) (*name).ptr, (*name).len, (uint8_t *) (*value).ptr, (*value).len, ptr); + fastly_compute_at_edge_http_resp_result_void_error_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; } } @@ -3688,17 +3246,17 @@ bool fastly_compute_at_edge_http_resp_header_append(fastly_compute_at_edge_http_ bool fastly_compute_at_edge_http_resp_header_remove(fastly_compute_at_edge_http_resp_response_handle_t h, fastly_world_string_t *name, fastly_compute_at_edge_http_resp_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_resp_header_remove((int32_t) (h), (int32_t) (*name).ptr, (int32_t) (*name).len, ptr); - fastly_world_result_void_fastly_compute_at_edge_http_resp_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_resp_header_remove((int32_t) (h), (uint8_t *) (*name).ptr, (*name).len, ptr); + fastly_compute_at_edge_http_resp_result_void_error_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; } } @@ -3713,18 +3271,18 @@ bool fastly_compute_at_edge_http_resp_header_remove(fastly_compute_at_edge_http_ bool fastly_compute_at_edge_http_resp_version_get(fastly_compute_at_edge_http_resp_response_handle_t h, fastly_compute_at_edge_http_resp_http_version_t *ret, fastly_compute_at_edge_http_resp_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_resp_version_get((int32_t) (h), ptr); - fastly_world_result_fastly_compute_at_edge_http_resp_http_version_fastly_compute_at_edge_http_resp_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_resp_result_http_version_error_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; } } @@ -3740,17 +3298,17 @@ bool fastly_compute_at_edge_http_resp_version_get(fastly_compute_at_edge_http_re bool fastly_compute_at_edge_http_resp_version_set(fastly_compute_at_edge_http_resp_response_handle_t h, fastly_compute_at_edge_http_resp_http_version_t version, fastly_compute_at_edge_http_resp_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_resp_version_set((int32_t) (h), (int32_t) version, ptr); - fastly_world_result_void_fastly_compute_at_edge_http_resp_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_resp_result_void_error_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; } } @@ -3765,17 +3323,17 @@ bool fastly_compute_at_edge_http_resp_version_set(fastly_compute_at_edge_http_re bool fastly_compute_at_edge_http_resp_send_downstream(fastly_compute_at_edge_http_resp_response_handle_t h, fastly_compute_at_edge_http_resp_body_handle_t b, bool streaming, fastly_compute_at_edge_http_resp_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_resp_send_downstream((int32_t) (h), (int32_t) (b), streaming, ptr); - fastly_world_result_void_fastly_compute_at_edge_http_resp_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_resp_result_void_error_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; } } @@ -3790,18 +3348,18 @@ bool fastly_compute_at_edge_http_resp_send_downstream(fastly_compute_at_edge_htt bool fastly_compute_at_edge_http_resp_status_get(fastly_compute_at_edge_http_resp_response_handle_t h, fastly_compute_at_edge_http_resp_http_status_t *ret, fastly_compute_at_edge_http_resp_error_t *err) { __attribute__((__aligned__(2))) uint8_t ret_area[4]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_resp_status_get((int32_t) (h), ptr); - fastly_world_result_fastly_compute_at_edge_http_resp_http_status_fastly_compute_at_edge_http_resp_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_resp_result_http_status_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 2)))); + result.val.ok = (uint16_t) ((int32_t) *((uint16_t*) (ptr + 2))); 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; } } @@ -3817,17 +3375,17 @@ bool fastly_compute_at_edge_http_resp_status_get(fastly_compute_at_edge_http_res bool fastly_compute_at_edge_http_resp_status_set(fastly_compute_at_edge_http_resp_response_handle_t h, fastly_compute_at_edge_http_resp_http_status_t status, fastly_compute_at_edge_http_resp_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_resp_status_set((int32_t) (h), (int32_t) (status), ptr); - fastly_world_result_void_fastly_compute_at_edge_http_resp_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_resp_result_void_error_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; } } @@ -3842,17 +3400,17 @@ bool fastly_compute_at_edge_http_resp_status_set(fastly_compute_at_edge_http_res bool fastly_compute_at_edge_http_resp_close(fastly_compute_at_edge_http_resp_response_handle_t h, fastly_compute_at_edge_http_resp_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_resp_close((int32_t) (h), ptr); - fastly_world_result_void_fastly_compute_at_edge_http_resp_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_resp_result_void_error_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; } } @@ -3867,17 +3425,17 @@ bool fastly_compute_at_edge_http_resp_close(fastly_compute_at_edge_http_resp_res bool fastly_compute_at_edge_http_resp_framing_headers_mode_set(fastly_compute_at_edge_http_resp_response_handle_t h, fastly_compute_at_edge_http_resp_framing_headers_mode_t mode, fastly_compute_at_edge_http_resp_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_resp_framing_headers_mode_set((int32_t) (h), (int32_t) mode, ptr); - fastly_world_result_void_fastly_compute_at_edge_http_resp_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_resp_result_void_error_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; } } @@ -3892,17 +3450,17 @@ bool fastly_compute_at_edge_http_resp_framing_headers_mode_set(fastly_compute_at bool fastly_compute_at_edge_http_resp_http_keepalive_mode_set(fastly_compute_at_edge_http_resp_response_handle_t h, fastly_compute_at_edge_http_resp_keepalive_mode_t mode, fastly_compute_at_edge_http_resp_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_resp_http_keepalive_mode_set((int32_t) (h), (int32_t) mode, ptr); - fastly_world_result_void_fastly_compute_at_edge_http_resp_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_resp_result_void_error_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; } } @@ -3917,10 +3475,10 @@ bool fastly_compute_at_edge_http_resp_http_keepalive_mode_set(fastly_compute_at_ bool fastly_compute_at_edge_log_endpoint_get(fastly_world_string_t *name, fastly_compute_at_edge_log_handle_t *ret, fastly_compute_at_edge_log_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_log_endpoint_get((int32_t) (*name).ptr, (int32_t) (*name).len, ptr); - fastly_world_result_fastly_compute_at_edge_log_handle_fastly_compute_at_edge_log_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_log_endpoint_get((uint8_t *) (*name).ptr, (*name).len, ptr); + fastly_compute_at_edge_log_result_handle_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -3928,7 +3486,7 @@ bool fastly_compute_at_edge_log_endpoint_get(fastly_world_string_t *name, fastly } 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; } } @@ -3944,17 +3502,17 @@ bool fastly_compute_at_edge_log_endpoint_get(fastly_world_string_t *name, fastly bool fastly_compute_at_edge_log_write(fastly_compute_at_edge_log_handle_t h, fastly_world_string_t *msg, fastly_compute_at_edge_log_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_log_write((int32_t) (h), (int32_t) (*msg).ptr, (int32_t) (*msg).len, ptr); - fastly_world_result_void_fastly_compute_at_edge_log_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_log_write((int32_t) (h), (uint8_t *) (*msg).ptr, (*msg).len, ptr); + fastly_compute_at_edge_log_result_void_error_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; } } @@ -3969,10 +3527,10 @@ bool fastly_compute_at_edge_log_write(fastly_compute_at_edge_log_handle_t h, fas bool fastly_compute_at_edge_object_store_open(fastly_world_string_t *name, fastly_compute_at_edge_object_store_handle_t *ret, fastly_compute_at_edge_object_store_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_object_store_open((int32_t) (*name).ptr, (int32_t) (*name).len, ptr); - fastly_world_result_fastly_compute_at_edge_object_store_handle_fastly_compute_at_edge_object_store_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_object_store_open((uint8_t *) (*name).ptr, (*name).len, ptr); + fastly_compute_at_edge_object_store_result_handle_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -3980,7 +3538,7 @@ bool fastly_compute_at_edge_object_store_open(fastly_world_string_t *name, fastl } 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; } } @@ -3993,17 +3551,17 @@ bool fastly_compute_at_edge_object_store_open(fastly_world_string_t *name, fastl } } -bool fastly_compute_at_edge_object_store_lookup(fastly_compute_at_edge_object_store_handle_t store, fastly_world_string_t *key, fastly_world_option_fastly_compute_at_edge_object_store_body_handle_t *ret, fastly_compute_at_edge_object_store_error_t *err) { +bool fastly_compute_at_edge_object_store_lookup(fastly_compute_at_edge_object_store_handle_t store, fastly_world_string_t *key, fastly_world_option_body_handle_t *ret, fastly_compute_at_edge_object_store_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_object_store_lookup((int32_t) (store), (int32_t) (*key).ptr, (int32_t) (*key).len, ptr); - fastly_world_result_option_fastly_compute_at_edge_object_store_body_handle_fastly_compute_at_edge_object_store_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_object_store_lookup((int32_t) (store), (uint8_t *) (*key).ptr, (*key).len, ptr); + fastly_compute_at_edge_object_store_result_option_body_handle_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - fastly_world_option_fastly_compute_at_edge_object_store_body_handle_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 4)))) { + fastly_world_option_body_handle_t option; + switch ((int32_t) *((uint8_t*) (ptr + 4))) { case 0: { option.is_some = false; break; @@ -4014,13 +3572,13 @@ bool fastly_compute_at_edge_object_store_lookup(fastly_compute_at_edge_object_st 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; } } @@ -4036,10 +3594,10 @@ bool fastly_compute_at_edge_object_store_lookup(fastly_compute_at_edge_object_st bool fastly_compute_at_edge_object_store_lookup_async(fastly_compute_at_edge_object_store_handle_t store, fastly_world_string_t *key, fastly_compute_at_edge_object_store_pending_handle_t *ret, fastly_compute_at_edge_object_store_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_object_store_lookup_async((int32_t) (store), (int32_t) (*key).ptr, (int32_t) (*key).len, ptr); - fastly_world_result_fastly_compute_at_edge_object_store_pending_handle_fastly_compute_at_edge_object_store_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_object_store_lookup_async((int32_t) (store), (uint8_t *) (*key).ptr, (*key).len, ptr); + fastly_compute_at_edge_object_store_result_pending_handle_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -4047,7 +3605,7 @@ bool fastly_compute_at_edge_object_store_lookup_async(fastly_compute_at_edge_obj } 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; } } @@ -4060,17 +3618,17 @@ bool fastly_compute_at_edge_object_store_lookup_async(fastly_compute_at_edge_obj } } -bool fastly_compute_at_edge_object_store_pending_lookup_wait(fastly_compute_at_edge_object_store_pending_handle_t handle, fastly_world_option_fastly_compute_at_edge_object_store_body_handle_t *ret, fastly_compute_at_edge_object_store_error_t *err) { +bool fastly_compute_at_edge_object_store_pending_lookup_wait(fastly_compute_at_edge_object_store_pending_handle_t handle, fastly_world_option_body_handle_t *ret, fastly_compute_at_edge_object_store_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_object_store_pending_lookup_wait((int32_t) (handle), ptr); - fastly_world_result_option_fastly_compute_at_edge_object_store_body_handle_fastly_compute_at_edge_object_store_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_object_store_result_option_body_handle_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - fastly_world_option_fastly_compute_at_edge_object_store_body_handle_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 4)))) { + fastly_world_option_body_handle_t option; + switch ((int32_t) *((uint8_t*) (ptr + 4))) { case 0: { option.is_some = false; break; @@ -4081,13 +3639,13 @@ bool fastly_compute_at_edge_object_store_pending_lookup_wait(fastly_compute_at_e 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; } } @@ -4103,10 +3661,10 @@ bool fastly_compute_at_edge_object_store_pending_lookup_wait(fastly_compute_at_e bool fastly_compute_at_edge_object_store_delete_async(fastly_compute_at_edge_object_store_handle_t store, fastly_world_string_t *key, fastly_compute_at_edge_object_store_pending_handle_t *ret, fastly_compute_at_edge_object_store_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_object_store_delete_async((int32_t) (store), (int32_t) (*key).ptr, (int32_t) (*key).len, ptr); - fastly_world_result_fastly_compute_at_edge_object_store_pending_handle_fastly_compute_at_edge_object_store_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_object_store_delete_async((int32_t) (store), (uint8_t *) (*key).ptr, (*key).len, ptr); + fastly_compute_at_edge_object_store_result_pending_handle_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -4114,7 +3672,7 @@ bool fastly_compute_at_edge_object_store_delete_async(fastly_compute_at_edge_obj } 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; } } @@ -4130,17 +3688,17 @@ bool fastly_compute_at_edge_object_store_delete_async(fastly_compute_at_edge_obj bool fastly_compute_at_edge_object_store_pending_delete_wait(fastly_compute_at_edge_object_store_pending_handle_t handle, fastly_compute_at_edge_object_store_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_object_store_pending_delete_wait((int32_t) (handle), ptr); - fastly_world_result_void_fastly_compute_at_edge_object_store_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_object_store_result_void_error_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; } } @@ -4155,17 +3713,17 @@ bool fastly_compute_at_edge_object_store_pending_delete_wait(fastly_compute_at_e bool fastly_compute_at_edge_object_store_insert(fastly_compute_at_edge_object_store_handle_t store, fastly_world_string_t *key, fastly_compute_at_edge_object_store_body_handle_t body_handle, fastly_compute_at_edge_object_store_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_object_store_insert((int32_t) (store), (int32_t) (*key).ptr, (int32_t) (*key).len, (int32_t) (body_handle), ptr); - fastly_world_result_void_fastly_compute_at_edge_object_store_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_object_store_insert((int32_t) (store), (uint8_t *) (*key).ptr, (*key).len, (int32_t) (body_handle), ptr); + fastly_compute_at_edge_object_store_result_void_error_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,31 +3738,31 @@ bool fastly_compute_at_edge_object_store_insert(fastly_compute_at_edge_object_st bool fastly_compute_at_edge_purge_surrogate_key(fastly_world_string_t *surrogate_keys, fastly_compute_at_edge_purge_options_mask_t purge_options, fastly_world_option_string_t *ret, fastly_compute_at_edge_purge_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_purge_surrogate_key((int32_t) (*surrogate_keys).ptr, (int32_t) (*surrogate_keys).len, purge_options, ptr); - fastly_world_result_option_string_fastly_compute_at_edge_purge_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_purge_surrogate_key((uint8_t *) (*surrogate_keys).ptr, (*surrogate_keys).len, purge_options, ptr); + fastly_compute_at_edge_purge_result_option_string_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; fastly_world_option_string_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 4)))) { + switch ((int32_t) *((uint8_t*) (ptr + 4))) { case 0: { option.is_some = false; break; } case 1: { option.is_some = true; - option.val = (fastly_world_string_t) { (char*)(*((int32_t*) (ptr + 8))), (size_t)(*((int32_t*) (ptr + 12))) }; + option.val = (fastly_world_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 8))), (*((size_t*) (ptr + 12))) }; 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; } } @@ -4220,10 +3778,10 @@ bool fastly_compute_at_edge_purge_surrogate_key(fastly_world_string_t *surrogate bool fastly_compute_at_edge_secret_store_open(fastly_world_string_t *name, fastly_compute_at_edge_secret_store_store_handle_t *ret, fastly_compute_at_edge_secret_store_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_secret_store_open((int32_t) (*name).ptr, (int32_t) (*name).len, ptr); - fastly_world_result_fastly_compute_at_edge_secret_store_store_handle_fastly_compute_at_edge_secret_store_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_secret_store_open((uint8_t *) (*name).ptr, (*name).len, ptr); + fastly_compute_at_edge_secret_store_result_store_handle_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -4231,7 +3789,7 @@ bool fastly_compute_at_edge_secret_store_open(fastly_world_string_t *name, fastl } 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; } } @@ -4244,17 +3802,17 @@ bool fastly_compute_at_edge_secret_store_open(fastly_world_string_t *name, fastl } } -bool fastly_compute_at_edge_secret_store_get(fastly_compute_at_edge_secret_store_store_handle_t store, fastly_world_string_t *key, fastly_world_option_fastly_compute_at_edge_secret_store_secret_handle_t *ret, fastly_compute_at_edge_secret_store_error_t *err) { +bool fastly_compute_at_edge_secret_store_get(fastly_compute_at_edge_secret_store_store_handle_t store, fastly_world_string_t *key, fastly_world_option_secret_handle_t *ret, fastly_compute_at_edge_secret_store_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_secret_store_get((int32_t) (store), (int32_t) (*key).ptr, (int32_t) (*key).len, ptr); - fastly_world_result_option_fastly_compute_at_edge_secret_store_secret_handle_fastly_compute_at_edge_secret_store_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_secret_store_get((int32_t) (store), (uint8_t *) (*key).ptr, (*key).len, ptr); + fastly_compute_at_edge_secret_store_result_option_secret_handle_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - fastly_world_option_fastly_compute_at_edge_secret_store_secret_handle_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 4)))) { + fastly_world_option_secret_handle_t option; + switch ((int32_t) *((uint8_t*) (ptr + 4))) { case 0: { option.is_some = false; break; @@ -4265,13 +3823,13 @@ bool fastly_compute_at_edge_secret_store_get(fastly_compute_at_edge_secret_store 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; } } @@ -4284,34 +3842,34 @@ bool fastly_compute_at_edge_secret_store_get(fastly_compute_at_edge_secret_store } } -bool fastly_compute_at_edge_secret_store_plaintext(fastly_compute_at_edge_secret_store_secret_handle_t secret, fastly_world_option_string_t *ret, fastly_compute_at_edge_secret_store_error_t *err) { +bool fastly_compute_at_edge_secret_store_plaintext(fastly_compute_at_edge_secret_store_secret_handle_t secret, fastly_world_option_list_u8_t *ret, fastly_compute_at_edge_secret_store_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_secret_store_plaintext((int32_t) (secret), ptr); - fastly_world_result_option_string_fastly_compute_at_edge_secret_store_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_secret_store_result_option_list_u8_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - fastly_world_option_string_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 4)))) { + fastly_world_option_list_u8_t option; + switch ((int32_t) *((uint8_t*) (ptr + 4))) { case 0: { option.is_some = false; break; } case 1: { option.is_some = true; - option.val = (fastly_world_string_t) { (char*)(*((int32_t*) (ptr + 8))), (size_t)(*((int32_t*) (ptr + 12))) }; + option.val = (fastly_world_list_u8_t) { (uint8_t*)(*((uint8_t **) (ptr + 8))), (*((size_t*) (ptr + 12))) }; 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; } } @@ -4324,13 +3882,13 @@ bool fastly_compute_at_edge_secret_store_plaintext(fastly_compute_at_edge_secret } } -bool fastly_compute_at_edge_secret_store_from_bytes(fastly_world_string_t *bytes, fastly_compute_at_edge_secret_store_secret_handle_t *ret, fastly_compute_at_edge_secret_store_error_t *err) { +bool fastly_compute_at_edge_secret_store_from_bytes(fastly_world_list_u8_t *bytes, fastly_compute_at_edge_secret_store_secret_handle_t *ret, fastly_compute_at_edge_secret_store_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_secret_store_from_bytes((int32_t) (*bytes).ptr, (int32_t) (*bytes).len, ptr); - fastly_world_result_fastly_compute_at_edge_secret_store_secret_handle_fastly_compute_at_edge_secret_store_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_secret_store_from_bytes((uint8_t *) (*bytes).ptr, (*bytes).len, ptr); + fastly_compute_at_edge_secret_store_result_secret_handle_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -4338,7 +3896,7 @@ bool fastly_compute_at_edge_secret_store_from_bytes(fastly_world_string_t *bytes } 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; } } @@ -4354,23 +3912,23 @@ bool fastly_compute_at_edge_secret_store_from_bytes(fastly_world_string_t *bytes bool fastly_compute_at_edge_uap_parse(fastly_world_string_t *user_agent, fastly_compute_at_edge_uap_user_agent_t *ret, fastly_compute_at_edge_uap_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[36]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_uap_parse((int32_t) (*user_agent).ptr, (int32_t) (*user_agent).len, ptr); - fastly_world_result_fastly_compute_at_edge_uap_user_agent_fastly_compute_at_edge_uap_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_uap_parse((uint8_t *) (*user_agent).ptr, (*user_agent).len, ptr); + fastly_compute_at_edge_uap_result_user_agent_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (fastly_compute_at_edge_uap_user_agent_t) { - (fastly_world_string_t) { (char*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }, - (fastly_world_string_t) { (char*)(*((int32_t*) (ptr + 12))), (size_t)(*((int32_t*) (ptr + 16))) }, - (fastly_world_string_t) { (char*)(*((int32_t*) (ptr + 20))), (size_t)(*((int32_t*) (ptr + 24))) }, - (fastly_world_string_t) { (char*)(*((int32_t*) (ptr + 28))), (size_t)(*((int32_t*) (ptr + 32))) }, + (fastly_world_string_t) (fastly_world_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 4))), (*((size_t*) (ptr + 8))) }, + (fastly_world_string_t) (fastly_world_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 12))), (*((size_t*) (ptr + 16))) }, + (fastly_world_string_t) (fastly_world_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 20))), (*((size_t*) (ptr + 24))) }, + (fastly_world_string_t) (fastly_world_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 28))), (*((size_t*) (ptr + 32))) }, }; 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; } } @@ -4385,11 +3943,11 @@ bool fastly_compute_at_edge_uap_parse(fastly_world_string_t *user_agent, fastly_ __attribute__((__export_name__("fastly:compute-at-edge/reactor#serve"))) int32_t __wasm_export_exports_fastly_compute_at_edge_reactor_serve(int32_t arg, int32_t arg0) { - fastly_compute_at_edge_reactor_request_t arg1 = (fastly_compute_at_edge_http_types_request_t) { - (uint32_t) (arg), - (uint32_t) (arg0), + exports_fastly_compute_at_edge_reactor_request_t arg1 = (fastly_compute_at_edge_http_types_request_t) { + (fastly_compute_at_edge_http_types_request_handle_t) (uint32_t) (arg), + (fastly_compute_at_edge_http_types_body_handle_t) (uint32_t) (arg0), }; - fastly_world_result_void_void_t ret; + exports_fastly_compute_at_edge_reactor_result_void_void_t ret; ret.is_err = !exports_fastly_compute_at_edge_reactor_serve(&arg1); int32_t result; if ((ret).is_err) { @@ -4400,6 +3958,8 @@ int32_t __wasm_export_exports_fastly_compute_at_edge_reactor_serve(int32_t arg, return result; } +// Ensure that the *_component_type.o object is linked in + extern void __component_type_object_force_link_fastly_world(void); void __component_type_object_force_link_fastly_world_public_use_in_this_compilation_unit(void) { __component_type_object_force_link_fastly_world(); diff --git a/runtime/fastly/host-api/component/fastly_world.h b/runtime/fastly/host-api/component/fastly_world.h index 97a334225b..1f6e48512a 100644 --- a/runtime/fastly/host-api/component/fastly_world.h +++ b/runtime/fastly/host-api/component/fastly_world.h @@ -1,4 +1,4 @@ -// Generated by `wit-bindgen` 0.9.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.26.0. DO NOT EDIT! #ifndef __BINDINGS_FASTLY_WORLD_H #define __BINDINGS_FASTLY_WORLD_H #ifdef __cplusplus @@ -7,14 +7,13 @@ extern "C" { #include #include -#include -#include -typedef struct { - char *ptr; +typedef struct fastly_world_string_t { + uint8_t *ptr; size_t len; } fastly_world_string_t; +// TODO: split this up into function-specific error enums typedef uint8_t fastly_compute_at_edge_types_error_t; // Unknown error value. @@ -66,6 +65,47 @@ typedef uint8_t fastly_compute_at_edge_types_error_t; typedef uint32_t fastly_compute_at_edge_types_secret_handle_t; +typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_async_io_error_t; + +// A handle to an object supporting generic async operations. +// Can be either a `BodyHandle` or a `PendingRequestHandle`. +// +// Each async item has an associated I/O action: +// +// * Pending requests: awaiting the response headers / `Response` object +// * Normal bodies: reading bytes from the body +// * Streaming bodies: writing bytes to the body +// +// For writing bytes, note that there is a large host-side buffer that bytes can eagerly be written +// into, even before the origin itself consumes that data. +typedef uint32_t fastly_compute_at_edge_async_io_handle_t; + +typedef struct { + fastly_compute_at_edge_async_io_handle_t *ptr; + size_t len; +} fastly_world_list_handle_t; + +typedef struct { + bool is_some; + uint32_t val; +} fastly_world_option_u32_t; + +typedef struct { + bool is_err; + union { + fastly_world_option_u32_t ok; + fastly_compute_at_edge_async_io_error_t err; + } val; +} fastly_compute_at_edge_async_io_result_option_u32_error_t; + +typedef struct { + bool is_err; + union { + bool ok; + fastly_compute_at_edge_async_io_error_t err; + } val; +} fastly_compute_at_edge_async_io_result_bool_error_t; + typedef fastly_compute_at_edge_types_secret_handle_t fastly_compute_at_edge_http_types_secret_handle_t; @@ -77,12 +117,12 @@ typedef uint32_t fastly_compute_at_edge_http_types_pending_request_handle_t; typedef uint32_t fastly_compute_at_edge_http_types_response_handle_t; -typedef struct { +typedef struct fastly_compute_at_edge_http_types_request_t { fastly_compute_at_edge_http_types_request_handle_t f0; fastly_compute_at_edge_http_types_body_handle_t f1; } fastly_compute_at_edge_http_types_request_t; -typedef struct { +typedef struct fastly_compute_at_edge_http_types_response_t { fastly_compute_at_edge_http_types_response_handle_t f0; fastly_compute_at_edge_http_types_body_handle_t f1; } fastly_compute_at_edge_http_types_response_t; @@ -165,7 +205,7 @@ typedef uint8_t fastly_compute_at_edge_http_types_send_error_detail_mask_t; #define FASTLY_COMPUTE_AT_EDGE_HTTP_TYPES_SEND_ERROR_DETAIL_MASK_DNS_ERROR_INFO_CODE (1 << 2) #define FASTLY_COMPUTE_AT_EDGE_HTTP_TYPES_SEND_ERROR_DETAIL_MASK_TLS_ALERT_ID (1 << 3) -typedef struct { +typedef struct fastly_compute_at_edge_http_types_send_error_detail_t { fastly_compute_at_edge_http_types_send_error_detail_tag_t tag; fastly_compute_at_edge_http_types_send_error_detail_mask_t mask; uint16_t dns_error_rcode; @@ -198,7 +238,7 @@ typedef uint8_t fastly_compute_at_edge_http_types_tls_version_t; #define FASTLY_COMPUTE_AT_EDGE_HTTP_TYPES_TLS_VERSION_TLS12 2 #define FASTLY_COMPUTE_AT_EDGE_HTTP_TYPES_TLS_VERSION_TLS13 3 -typedef struct { +typedef struct fastly_compute_at_edge_http_types_client_cert_config_t { fastly_world_string_t client_cert; fastly_compute_at_edge_http_types_secret_handle_t client_key; } fastly_compute_at_edge_http_types_client_cert_config_t; @@ -208,11 +248,6 @@ typedef struct { fastly_world_string_t val; } fastly_world_option_string_t; -typedef struct { - bool is_some; - uint32_t val; -} fastly_world_option_u32_t; - typedef struct { bool is_some; bool val; @@ -221,165 +256,305 @@ typedef struct { typedef struct { bool is_some; fastly_compute_at_edge_http_types_tls_version_t val; -} fastly_world_option_fastly_compute_at_edge_http_types_tls_version_t; +} fastly_compute_at_edge_http_types_option_tls_version_t; typedef struct { bool is_some; fastly_compute_at_edge_http_types_client_cert_config_t val; -} fastly_world_option_fastly_compute_at_edge_http_types_client_cert_config_t; +} fastly_compute_at_edge_http_types_option_client_cert_config_t; // Create a backend for later use -typedef struct { +typedef struct fastly_compute_at_edge_http_types_dynamic_backend_config_t { fastly_world_option_string_t host_override; fastly_world_option_u32_t connect_timeout; fastly_world_option_u32_t first_byte_timeout; fastly_world_option_u32_t between_bytes_timeout; fastly_world_option_bool_t use_ssl; fastly_world_option_bool_t dont_pool; - fastly_world_option_fastly_compute_at_edge_http_types_tls_version_t ssl_min_version; - fastly_world_option_fastly_compute_at_edge_http_types_tls_version_t ssl_max_version; + fastly_compute_at_edge_http_types_option_tls_version_t ssl_min_version; + fastly_compute_at_edge_http_types_option_tls_version_t ssl_max_version; fastly_world_option_string_t cert_hostname; fastly_world_option_string_t ca_cert; fastly_world_option_string_t ciphers; fastly_world_option_string_t sni_hostname; - fastly_world_option_fastly_compute_at_edge_http_types_client_cert_config_t client_cert; + fastly_compute_at_edge_http_types_option_client_cert_config_t client_cert; } fastly_compute_at_edge_http_types_dynamic_backend_config_t; typedef uint16_t fastly_compute_at_edge_http_types_http_status_t; -typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_uap_error_t; +typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_backend_error_t; -typedef struct { - fastly_world_string_t family; - fastly_world_string_t major; - fastly_world_string_t minor; - fastly_world_string_t patch; -} fastly_compute_at_edge_uap_user_agent_t; +typedef fastly_compute_at_edge_http_types_tls_version_t + fastly_compute_at_edge_backend_tls_version_t; -typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_http_body_error_t; +typedef uint8_t fastly_compute_at_edge_backend_backend_health_t; -typedef fastly_compute_at_edge_http_types_body_handle_t - fastly_compute_at_edge_http_body_body_handle_t; +#define FASTLY_COMPUTE_AT_EDGE_BACKEND_BACKEND_HEALTH_UNKNOWN 0 +#define FASTLY_COMPUTE_AT_EDGE_BACKEND_BACKEND_HEALTH_HEALTHY 1 +#define FASTLY_COMPUTE_AT_EDGE_BACKEND_BACKEND_HEALTH_UNHEALTHY 2 -typedef uint8_t fastly_compute_at_edge_http_body_write_end_t; +typedef struct { + bool is_err; + union { + bool ok; + fastly_compute_at_edge_backend_error_t err; + } val; +} fastly_compute_at_edge_backend_result_bool_error_t; -#define FASTLY_COMPUTE_AT_EDGE_HTTP_BODY_WRITE_END_BACK 0 -#define FASTLY_COMPUTE_AT_EDGE_HTTP_BODY_WRITE_END_FRONT 1 +typedef struct { + bool is_err; + union { + fastly_compute_at_edge_backend_backend_health_t ok; + fastly_compute_at_edge_backend_error_t err; + } val; +} fastly_compute_at_edge_backend_result_backend_health_error_t; typedef struct { - uint8_t *ptr; - size_t len; -} fastly_world_list_u8_t; + bool is_err; + union { + fastly_world_string_t ok; + fastly_compute_at_edge_backend_error_t err; + } val; +} fastly_compute_at_edge_backend_result_string_error_t; -typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_log_error_t; +typedef struct { + bool is_err; + union { + fastly_world_option_string_t ok; + fastly_compute_at_edge_backend_error_t err; + } val; +} fastly_compute_at_edge_backend_result_option_string_error_t; -typedef uint32_t fastly_compute_at_edge_log_handle_t; +typedef struct { + bool is_err; + union { + uint16_t ok; + fastly_compute_at_edge_backend_error_t err; + } val; +} fastly_compute_at_edge_backend_result_u16_error_t; -typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_http_req_error_t; +typedef struct { + bool is_err; + union { + uint32_t ok; + fastly_compute_at_edge_backend_error_t err; + } val; +} fastly_compute_at_edge_backend_result_u32_error_t; -typedef fastly_compute_at_edge_http_types_body_handle_t - fastly_compute_at_edge_http_req_body_handle_t; +typedef struct { + bool is_err; + union { + fastly_compute_at_edge_backend_tls_version_t ok; + fastly_compute_at_edge_backend_error_t err; + } val; +} fastly_compute_at_edge_backend_result_tls_version_error_t; + +typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_cache_error_t; + +typedef fastly_compute_at_edge_http_types_body_handle_t fastly_compute_at_edge_cache_body_handle_t; typedef fastly_compute_at_edge_http_types_request_handle_t - fastly_compute_at_edge_http_req_request_handle_t; + fastly_compute_at_edge_cache_request_handle_t; -typedef fastly_compute_at_edge_http_types_http_version_t - fastly_compute_at_edge_http_req_http_version_t; +// The outcome of a cache lookup (either bare or as part of a cache transaction) +typedef uint32_t fastly_compute_at_edge_cache_handle_t; -typedef fastly_compute_at_edge_http_types_response_t fastly_compute_at_edge_http_req_response_t; +typedef uint64_t fastly_compute_at_edge_cache_object_length_t; -typedef fastly_compute_at_edge_http_types_pending_request_handle_t - fastly_compute_at_edge_http_req_pending_request_handle_t; +typedef uint64_t fastly_compute_at_edge_cache_duration_ns_t; -typedef fastly_compute_at_edge_http_types_content_encodings_t - fastly_compute_at_edge_http_req_content_encodings_t; +typedef uint64_t fastly_compute_at_edge_cache_cache_hit_count_t; -typedef fastly_compute_at_edge_http_types_framing_headers_mode_t - fastly_compute_at_edge_http_req_framing_headers_mode_t; +typedef struct { + bool is_some; + fastly_compute_at_edge_cache_request_handle_t val; +} fastly_world_option_request_handle_t; -typedef fastly_compute_at_edge_http_types_dynamic_backend_config_t - fastly_compute_at_edge_http_req_dynamic_backend_config_t; +// Extensible options for cache lookup operations currently used for both `lookup` and +// `transaction_lookup`. +typedef struct fastly_compute_at_edge_cache_lookup_options_t { + // * A full request handle, but used only for its headers + fastly_world_option_request_handle_t request_headers; +} fastly_compute_at_edge_cache_lookup_options_t; -typedef fastly_compute_at_edge_http_types_send_error_detail_t - fastly_compute_at_edge_http_req_send_error_detail_t; +typedef struct { + uint8_t *ptr; + size_t len; +} fastly_world_list_u8_t; -typedef uint8_t fastly_compute_at_edge_http_req_cache_override_tag_t; +// Configuration for several hostcalls that write to the cache: +// - `insert` +// - `transaction-insert` +// - `transaction-insert-and-stream-back` +// - `transaction-update` +// +// Some options are only allowed for certain of these hostcalls see `cache-write-options-mask`. +typedef struct fastly_compute_at_edge_cache_write_options_t { + // this is a required field there's no flag for it + fastly_compute_at_edge_cache_duration_ns_t max_age_ns; + // a full request handle, but used only for its headers + fastly_compute_at_edge_cache_request_handle_t request_headers; + // a list of header names separated by spaces + fastly_world_string_t vary_rule; + // The initial age of the object in nanoseconds (default: 0). + // + // This age is used to determine the freshness lifetime of the object as well as to + // prioritize which variant to return if a subsequent lookup matches more than one vary rule + fastly_compute_at_edge_cache_duration_ns_t initial_age_ns; + fastly_compute_at_edge_cache_duration_ns_t stale_while_revalidate_ns; + // a list of surrogate keys separated by spaces + fastly_world_string_t surrogate_keys; + fastly_compute_at_edge_cache_object_length_t length; + fastly_world_list_u8_t user_metadata; + bool sensitive_data; +} fastly_compute_at_edge_cache_write_options_t; -// Do not cache the response to this request, regardless of the origin response's headers. -#define FASTLY_COMPUTE_AT_EDGE_HTTP_REQ_CACHE_OVERRIDE_TAG_PASS (1 << 0) -#define FASTLY_COMPUTE_AT_EDGE_HTTP_REQ_CACHE_OVERRIDE_TAG_TTL (1 << 1) -#define FASTLY_COMPUTE_AT_EDGE_HTTP_REQ_CACHE_OVERRIDE_TAG_STALE_WHILE_REVALIDATE (1 << 2) -#define FASTLY_COMPUTE_AT_EDGE_HTTP_REQ_CACHE_OVERRIDE_TAG_PCI (1 << 3) +typedef uint8_t fastly_compute_at_edge_cache_get_body_options_mask_t; + +#define FASTLY_COMPUTE_AT_EDGE_CACHE_GET_BODY_OPTIONS_MASK_RESERVED (1 << 0) +#define FASTLY_COMPUTE_AT_EDGE_CACHE_GET_BODY_OPTIONS_MASK_START (1 << 1) +#define FASTLY_COMPUTE_AT_EDGE_CACHE_GET_BODY_OPTIONS_MASK_END (1 << 2) + +typedef struct fastly_compute_at_edge_cache_get_body_options_t { + uint64_t start; + uint64_t end; +} fastly_compute_at_edge_cache_get_body_options_t; + +// The status of this lookup (and potential transaction) +typedef uint8_t fastly_compute_at_edge_cache_lookup_state_t; + +// a cached object was found +#define FASTLY_COMPUTE_AT_EDGE_CACHE_LOOKUP_STATE_FOUND (1 << 0) +// the cached object is valid to use (implies found) +#define FASTLY_COMPUTE_AT_EDGE_CACHE_LOOKUP_STATE_USABLE (1 << 1) +// the cached object is stale (but may or may not be valid to use) +#define FASTLY_COMPUTE_AT_EDGE_CACHE_LOOKUP_STATE_STALE (1 << 2) +// this client is requested to insert or revalidate an object +#define FASTLY_COMPUTE_AT_EDGE_CACHE_LOOKUP_STATE_MUST_INSERT_OR_UPDATE (1 << 3) typedef struct { - fastly_world_string_t *ptr; - size_t len; -} fastly_world_list_string_t; + bool is_err; + union { + fastly_compute_at_edge_cache_handle_t ok; + fastly_compute_at_edge_cache_error_t err; + } val; +} fastly_compute_at_edge_cache_result_handle_error_t; typedef struct { - bool is_some; - fastly_world_list_u8_t val; -} fastly_world_option_list_u8_t; + bool is_err; + union { + fastly_compute_at_edge_cache_body_handle_t ok; + fastly_compute_at_edge_cache_error_t err; + } val; +} fastly_compute_at_edge_cache_result_body_handle_error_t; typedef struct { - fastly_world_list_u8_t *ptr; - size_t len; -} fastly_world_list_list_u8_t; + fastly_compute_at_edge_cache_body_handle_t f0; + fastly_compute_at_edge_cache_handle_t f1; +} fastly_world_tuple2_body_handle_handle_t; typedef struct { - bool is_some; - fastly_world_list_list_u8_t val; -} fastly_world_option_list_list_u8_t; + bool is_err; + union { + fastly_world_tuple2_body_handle_handle_t ok; + fastly_compute_at_edge_cache_error_t err; + } val; +} fastly_compute_at_edge_cache_result_tuple2_body_handle_handle_error_t; typedef struct { - bool is_some; - fastly_compute_at_edge_http_req_response_t val; -} fastly_world_option_fastly_compute_at_edge_http_req_response_t; + bool is_err; + union { + fastly_compute_at_edge_cache_error_t err; + } val; +} fastly_compute_at_edge_cache_result_void_error_t; typedef struct { - fastly_compute_at_edge_http_req_pending_request_handle_t *ptr; - size_t len; -} fastly_world_list_fastly_compute_at_edge_http_req_pending_request_handle_t; + bool is_err; + union { + fastly_compute_at_edge_cache_lookup_state_t ok; + fastly_compute_at_edge_cache_error_t err; + } val; +} fastly_compute_at_edge_cache_result_lookup_state_error_t; typedef struct { - uint32_t f0; - fastly_compute_at_edge_http_req_response_t f1; -} fastly_world_tuple2_u32_fastly_compute_at_edge_http_req_response_t; + bool is_err; + union { + fastly_world_list_u8_t ok; + fastly_compute_at_edge_cache_error_t err; + } val; +} fastly_compute_at_edge_cache_result_list_u8_error_t; -typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_http_resp_error_t; +typedef struct { + bool is_err; + union { + uint64_t ok; + fastly_compute_at_edge_cache_error_t err; + } val; +} fastly_compute_at_edge_cache_result_u64_error_t; -typedef fastly_compute_at_edge_http_types_response_handle_t - fastly_compute_at_edge_http_resp_response_handle_t; +typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_device_detection_error_t; -typedef fastly_compute_at_edge_http_types_body_handle_t - fastly_compute_at_edge_http_resp_body_handle_t; +typedef struct { + bool is_err; + union { + fastly_world_string_t ok; + fastly_compute_at_edge_device_detection_error_t err; + } val; +} fastly_compute_at_edge_device_detection_result_string_error_t; -typedef fastly_compute_at_edge_http_types_http_version_t - fastly_compute_at_edge_http_resp_http_version_t; +typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_dictionary_error_t; -typedef fastly_compute_at_edge_http_types_http_status_t - fastly_compute_at_edge_http_resp_http_status_t; +typedef uint32_t fastly_compute_at_edge_dictionary_handle_t; -typedef fastly_compute_at_edge_http_types_framing_headers_mode_t - fastly_compute_at_edge_http_resp_framing_headers_mode_t; +typedef struct { + bool is_err; + union { + fastly_compute_at_edge_dictionary_handle_t ok; + fastly_compute_at_edge_dictionary_error_t err; + } val; +} fastly_compute_at_edge_dictionary_result_handle_error_t; -typedef uint8_t fastly_compute_at_edge_http_resp_keepalive_mode_t; +typedef struct { + bool is_err; + union { + fastly_world_option_string_t ok; + fastly_compute_at_edge_dictionary_error_t err; + } val; +} fastly_compute_at_edge_dictionary_result_option_string_error_t; -#define FASTLY_COMPUTE_AT_EDGE_HTTP_RESP_KEEPALIVE_MODE_AUTOMATIC 0 -#define FASTLY_COMPUTE_AT_EDGE_HTTP_RESP_KEEPALIVE_MODE_NO_KEEPALIVE 1 +typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_edge_rate_limiter_error_t; -typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_dictionary_error_t; +typedef struct { + bool is_err; + union { + bool ok; + fastly_compute_at_edge_edge_rate_limiter_error_t err; + } val; +} fastly_compute_at_edge_edge_rate_limiter_result_bool_error_t; -typedef uint32_t fastly_compute_at_edge_dictionary_handle_t; +typedef struct { + bool is_err; + union { + fastly_compute_at_edge_edge_rate_limiter_error_t err; + } val; +} fastly_compute_at_edge_edge_rate_limiter_result_void_error_t; + +typedef struct { + bool is_err; + union { + uint32_t ok; + fastly_compute_at_edge_edge_rate_limiter_error_t err; + } val; +} fastly_compute_at_edge_edge_rate_limiter_result_u32_error_t; typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_geo_error_t; typedef struct { bool is_some; float val; -} fastly_world_option_float32_t; +} fastly_world_option_f32_t; -typedef struct { +typedef struct fastly_compute_at_edge_geo_geo_data_t { // * The name of the organization associated with as_number. // * // * For example, fastly is the value given for IP addresses under AS-54113. @@ -426,13 +601,13 @@ typedef struct { // * // * Values range from -90.0 to +90.0 inclusive, and are based on the [WGS // 84](https://en.wikipedia.org/wiki/World_Geodetic_System) coordinate reference system. - fastly_world_option_float32_t latitude; + fastly_world_option_f32_t latitude; // * Longitude, in units of degrees from the [IERS Reference // Meridian](https://en.wikipedia.org/wiki/IERS_Reference_Meridian). // * // * Values range from -180.0 to +180.0 inclusive, and are based on the [WGS // 84](https://en.wikipedia.org/wiki/World_Geodetic_System) coordinate reference system. - fastly_world_option_float32_t longitude; + fastly_world_option_f32_t longitude; // * Metro code, representing designated market areas (DMAs) in the United States. fastly_world_option_u32_t metro_code; // * The postal code associated with the IP address. @@ -461,158 +636,460 @@ typedef struct { fastly_world_option_u32_t utc_offset; } fastly_compute_at_edge_geo_geo_data_t; -typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_object_store_error_t; +typedef struct { + bool is_err; + union { + fastly_world_string_t ok; + fastly_compute_at_edge_geo_error_t err; + } val; +} fastly_compute_at_edge_geo_result_string_error_t; + +typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_http_body_error_t; typedef fastly_compute_at_edge_http_types_body_handle_t - fastly_compute_at_edge_object_store_body_handle_t; + fastly_compute_at_edge_http_body_body_handle_t; -typedef uint32_t fastly_compute_at_edge_object_store_handle_t; +typedef uint8_t fastly_compute_at_edge_http_body_write_end_t; -typedef uint32_t fastly_compute_at_edge_object_store_pending_handle_t; +#define FASTLY_COMPUTE_AT_EDGE_HTTP_BODY_WRITE_END_BACK 0 +#define FASTLY_COMPUTE_AT_EDGE_HTTP_BODY_WRITE_END_FRONT 1 typedef struct { - bool is_some; - fastly_compute_at_edge_object_store_body_handle_t val; -} fastly_world_option_fastly_compute_at_edge_object_store_body_handle_t; - -typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_secret_store_error_t; + bool is_err; + union { + fastly_compute_at_edge_http_body_error_t err; + } val; +} fastly_compute_at_edge_http_body_result_void_error_t; -typedef fastly_compute_at_edge_types_secret_handle_t - fastly_compute_at_edge_secret_store_secret_handle_t; +typedef struct { + bool is_err; + union { + fastly_compute_at_edge_http_body_body_handle_t ok; + fastly_compute_at_edge_http_body_error_t err; + } val; +} fastly_compute_at_edge_http_body_result_body_handle_error_t; -typedef uint32_t fastly_compute_at_edge_secret_store_store_handle_t; +typedef struct { + bool is_err; + union { + fastly_world_list_u8_t ok; + fastly_compute_at_edge_http_body_error_t err; + } val; +} fastly_compute_at_edge_http_body_result_list_u8_error_t; typedef struct { - bool is_some; - fastly_compute_at_edge_secret_store_secret_handle_t val; -} fastly_world_option_fastly_compute_at_edge_secret_store_secret_handle_t; + bool is_err; + union { + uint32_t ok; + fastly_compute_at_edge_http_body_error_t err; + } val; +} fastly_compute_at_edge_http_body_result_u32_error_t; -typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_backend_error_t; +typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_http_req_error_t; -typedef fastly_compute_at_edge_http_types_tls_version_t - fastly_compute_at_edge_backend_tls_version_t; +typedef fastly_compute_at_edge_http_types_body_handle_t + fastly_compute_at_edge_http_req_body_handle_t; -typedef uint8_t fastly_compute_at_edge_backend_backend_health_t; +typedef fastly_compute_at_edge_http_types_request_handle_t + fastly_compute_at_edge_http_req_request_handle_t; -#define FASTLY_COMPUTE_AT_EDGE_BACKEND_BACKEND_HEALTH_UNKNOWN 0 -#define FASTLY_COMPUTE_AT_EDGE_BACKEND_BACKEND_HEALTH_HEALTHY 1 -#define FASTLY_COMPUTE_AT_EDGE_BACKEND_BACKEND_HEALTH_UNHEALTHY 2 +typedef fastly_compute_at_edge_http_types_http_version_t + fastly_compute_at_edge_http_req_http_version_t; -typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_async_io_error_t; +typedef fastly_compute_at_edge_http_types_response_t fastly_compute_at_edge_http_req_response_t; -// A handle to an object supporting generic async operations. -// Can be either a `BodyHandle` or a `PendingRequestHandle`. -// -// Each async item has an associated I/O action: -// -// * Pending requests: awaiting the response headers / `Response` object -// * Normal bodies: reading bytes from the body -// * Streaming bodies: writing bytes to the body -// -// For writing bytes, note that there is a large host-side buffer that bytes can eagerly be written -// into, even before the origin itself consumes that data. -typedef uint32_t fastly_compute_at_edge_async_io_handle_t; +typedef fastly_compute_at_edge_http_types_pending_request_handle_t + fastly_compute_at_edge_http_req_pending_request_handle_t; + +typedef fastly_compute_at_edge_http_types_content_encodings_t + fastly_compute_at_edge_http_req_content_encodings_t; + +typedef fastly_compute_at_edge_http_types_framing_headers_mode_t + fastly_compute_at_edge_http_req_framing_headers_mode_t; + +typedef fastly_compute_at_edge_http_types_dynamic_backend_config_t + fastly_compute_at_edge_http_req_dynamic_backend_config_t; + +typedef fastly_compute_at_edge_http_types_send_error_detail_t + fastly_compute_at_edge_http_req_send_error_detail_t; + +typedef uint8_t fastly_compute_at_edge_http_req_cache_override_tag_t; + +// Do not cache the response to this request, regardless of the origin response's headers. +#define FASTLY_COMPUTE_AT_EDGE_HTTP_REQ_CACHE_OVERRIDE_TAG_PASS (1 << 0) +#define FASTLY_COMPUTE_AT_EDGE_HTTP_REQ_CACHE_OVERRIDE_TAG_TTL (1 << 1) +#define FASTLY_COMPUTE_AT_EDGE_HTTP_REQ_CACHE_OVERRIDE_TAG_STALE_WHILE_REVALIDATE (1 << 2) +#define FASTLY_COMPUTE_AT_EDGE_HTTP_REQ_CACHE_OVERRIDE_TAG_PCI (1 << 3) typedef struct { - fastly_compute_at_edge_async_io_handle_t *ptr; + bool is_err; + union { + fastly_compute_at_edge_http_req_error_t err; + } val; +} fastly_compute_at_edge_http_req_result_void_error_t; + +typedef struct { + bool is_err; + union { + fastly_world_list_u8_t ok; + fastly_compute_at_edge_http_req_error_t err; + } val; +} fastly_compute_at_edge_http_req_result_list_u8_error_t; + +typedef struct { + bool is_err; + union { + fastly_world_string_t ok; + fastly_compute_at_edge_http_req_error_t err; + } val; +} fastly_compute_at_edge_http_req_result_string_error_t; + +typedef struct { + bool is_err; + union { + fastly_compute_at_edge_http_req_request_handle_t ok; + fastly_compute_at_edge_http_req_error_t err; + } val; +} fastly_compute_at_edge_http_req_result_request_handle_error_t; + +typedef struct { + fastly_world_string_t *ptr; size_t len; -} fastly_world_list_fastly_compute_at_edge_async_io_handle_t; +} fastly_world_list_string_t; -typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_purge_error_t; +typedef struct { + bool is_err; + union { + fastly_world_list_string_t ok; + fastly_compute_at_edge_http_req_error_t err; + } val; +} fastly_compute_at_edge_http_req_result_list_string_error_t; -typedef uint8_t fastly_compute_at_edge_purge_options_mask_t; +typedef struct { + bool is_err; + union { + uint32_t ok; + fastly_compute_at_edge_http_req_error_t err; + } val; +} fastly_compute_at_edge_http_req_result_u32_error_t; -#define FASTLY_COMPUTE_AT_EDGE_PURGE_OPTIONS_MASK_SOFT_PURGE (1 << 0) -#define FASTLY_COMPUTE_AT_EDGE_PURGE_OPTIONS_MASK_RET_BUF (1 << 1) +typedef struct { + bool is_some; + fastly_world_list_u8_t val; +} fastly_world_option_list_u8_t; -typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_cache_error_t; +typedef struct { + bool is_err; + union { + fastly_world_option_list_u8_t ok; + fastly_compute_at_edge_http_req_error_t err; + } val; +} fastly_compute_at_edge_http_req_result_option_list_u8_error_t; -typedef fastly_compute_at_edge_http_types_body_handle_t fastly_compute_at_edge_cache_body_handle_t; +typedef struct { + fastly_world_list_u8_t *ptr; + size_t len; +} fastly_world_list_list_u8_t; -typedef fastly_compute_at_edge_http_types_request_handle_t - fastly_compute_at_edge_cache_request_handle_t; +typedef struct { + bool is_some; + fastly_world_list_list_u8_t val; +} fastly_world_option_list_list_u8_t; -// The outcome of a cache lookup (either bare or as part of a cache transaction) -typedef uint32_t fastly_compute_at_edge_cache_handle_t; +typedef struct { + bool is_err; + union { + fastly_world_option_list_list_u8_t ok; + fastly_compute_at_edge_http_req_error_t err; + } val; +} fastly_compute_at_edge_http_req_result_option_list_list_u8_error_t; -typedef uint64_t fastly_compute_at_edge_cache_object_length_t; +typedef struct { + bool is_err; + union { + fastly_compute_at_edge_http_req_http_version_t ok; + fastly_compute_at_edge_http_req_error_t err; + } val; +} fastly_compute_at_edge_http_req_result_http_version_error_t; -typedef uint64_t fastly_compute_at_edge_cache_duration_ns_t; +typedef struct { + bool is_err; + union { + fastly_compute_at_edge_http_req_response_t ok; + fastly_compute_at_edge_http_req_error_t err; + } val; +} fastly_compute_at_edge_http_req_result_response_error_t; -typedef uint64_t fastly_compute_at_edge_cache_cache_hit_count_t; +typedef struct { + bool is_err; + union { + fastly_compute_at_edge_http_req_pending_request_handle_t ok; + fastly_compute_at_edge_http_req_error_t err; + } val; +} fastly_compute_at_edge_http_req_result_pending_request_handle_error_t; typedef struct { bool is_some; - fastly_compute_at_edge_cache_request_handle_t val; -} fastly_world_option_fastly_compute_at_edge_cache_request_handle_t; + fastly_compute_at_edge_http_req_response_t val; +} fastly_world_option_response_t; -// Extensible options for cache lookup operations currently used for both `lookup` and -// `transaction_lookup`. typedef struct { - // * A full request handle, but used only for its headers - fastly_world_option_fastly_compute_at_edge_cache_request_handle_t request_headers; -} fastly_compute_at_edge_cache_lookup_options_t; + bool is_err; + union { + fastly_world_option_response_t ok; + fastly_compute_at_edge_http_req_error_t err; + } val; +} fastly_compute_at_edge_http_req_result_option_response_error_t; -// Configuration for several hostcalls that write to the cache: -// - `insert` -// - `transaction-insert` -// - `transaction-insert-and-stream-back` -// - `transaction-update` -// -// Some options are only allowed for certain of these hostcalls see `cache-write-options-mask`. typedef struct { - // this is a required field there's no flag for it - fastly_compute_at_edge_cache_duration_ns_t max_age_ns; - // a full request handle, but used only for its headers - fastly_compute_at_edge_cache_request_handle_t request_headers; - // a list of header names separated by spaces - fastly_world_string_t vary_rule; - // The initial age of the object in nanoseconds (default: 0). - // - // This age is used to determine the freshness lifetime of the object as well as to - // prioritize which variant to return if a subsequent lookup matches more than one vary rule - fastly_compute_at_edge_cache_duration_ns_t initial_age_ns; - fastly_compute_at_edge_cache_duration_ns_t stale_while_revalidate_ns; - // a list of surrogate keys separated by spaces - fastly_world_string_t surrogate_keys; - fastly_compute_at_edge_cache_object_length_t length; - fastly_world_list_u8_t user_metadata; - bool sensitive_data; -} fastly_compute_at_edge_cache_write_options_t; + fastly_compute_at_edge_http_req_pending_request_handle_t *ptr; + size_t len; +} fastly_world_list_pending_request_handle_t; -typedef uint8_t fastly_compute_at_edge_cache_get_body_options_mask_t; +typedef struct { + uint32_t f0; + fastly_compute_at_edge_http_req_response_t f1; +} fastly_world_tuple2_u32_response_t; -#define FASTLY_COMPUTE_AT_EDGE_CACHE_GET_BODY_OPTIONS_MASK_RESERVED (1 << 0) -#define FASTLY_COMPUTE_AT_EDGE_CACHE_GET_BODY_OPTIONS_MASK_START (1 << 1) -#define FASTLY_COMPUTE_AT_EDGE_CACHE_GET_BODY_OPTIONS_MASK_END (1 << 2) +typedef struct { + bool is_err; + union { + fastly_world_tuple2_u32_response_t ok; + fastly_compute_at_edge_http_req_error_t err; + } val; +} fastly_compute_at_edge_http_req_result_tuple2_u32_response_error_t; typedef struct { - uint64_t start; - uint64_t end; -} fastly_compute_at_edge_cache_get_body_options_t; + bool is_err; + union { + fastly_world_tuple2_u32_response_t ok; + fastly_compute_at_edge_http_req_send_error_detail_t err; + } val; +} fastly_compute_at_edge_http_req_result_tuple2_u32_response_send_error_detail_t; -// The status of this lookup (and potential transaction) -typedef uint8_t fastly_compute_at_edge_cache_lookup_state_t; +typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_http_resp_error_t; -// a cached object was found -#define FASTLY_COMPUTE_AT_EDGE_CACHE_LOOKUP_STATE_FOUND (1 << 0) -// the cached object is valid to use (implies found) -#define FASTLY_COMPUTE_AT_EDGE_CACHE_LOOKUP_STATE_USABLE (1 << 1) -// the cached object is stale (but may or may not be valid to use) -#define FASTLY_COMPUTE_AT_EDGE_CACHE_LOOKUP_STATE_STALE (1 << 2) -// this client is requested to insert or revalidate an object -#define FASTLY_COMPUTE_AT_EDGE_CACHE_LOOKUP_STATE_MUST_INSERT_OR_UPDATE (1 << 3) +typedef fastly_compute_at_edge_http_types_response_handle_t + fastly_compute_at_edge_http_resp_response_handle_t; + +typedef fastly_compute_at_edge_http_types_body_handle_t + fastly_compute_at_edge_http_resp_body_handle_t; + +typedef fastly_compute_at_edge_http_types_http_version_t + fastly_compute_at_edge_http_resp_http_version_t; + +typedef fastly_compute_at_edge_http_types_http_status_t + fastly_compute_at_edge_http_resp_http_status_t; + +typedef fastly_compute_at_edge_http_types_framing_headers_mode_t + fastly_compute_at_edge_http_resp_framing_headers_mode_t; + +typedef uint8_t fastly_compute_at_edge_http_resp_keepalive_mode_t; + +#define FASTLY_COMPUTE_AT_EDGE_HTTP_RESP_KEEPALIVE_MODE_AUTOMATIC 0 +#define FASTLY_COMPUTE_AT_EDGE_HTTP_RESP_KEEPALIVE_MODE_NO_KEEPALIVE 1 typedef struct { - fastly_compute_at_edge_cache_body_handle_t f0; - fastly_compute_at_edge_cache_handle_t f1; -} fastly_world_tuple2_fastly_compute_at_edge_cache_body_handle_fastly_compute_at_edge_cache_handle_t; + bool is_err; + union { + fastly_compute_at_edge_http_resp_response_handle_t ok; + fastly_compute_at_edge_http_resp_error_t err; + } val; +} fastly_compute_at_edge_http_resp_result_response_handle_error_t; -typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_edge_rate_limiter_error_t; +typedef struct { + bool is_err; + union { + fastly_world_list_string_t ok; + fastly_compute_at_edge_http_resp_error_t err; + } val; +} fastly_compute_at_edge_http_resp_result_list_string_error_t; -typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_device_detection_error_t; +typedef struct { + bool is_err; + union { + fastly_world_option_string_t ok; + fastly_compute_at_edge_http_resp_error_t err; + } val; +} fastly_compute_at_edge_http_resp_result_option_string_error_t; + +typedef struct { + bool is_err; + union { + fastly_world_option_list_list_u8_t ok; + fastly_compute_at_edge_http_resp_error_t err; + } val; +} fastly_compute_at_edge_http_resp_result_option_list_list_u8_error_t; + +typedef struct { + bool is_err; + union { + fastly_compute_at_edge_http_resp_error_t err; + } val; +} fastly_compute_at_edge_http_resp_result_void_error_t; + +typedef struct { + bool is_err; + union { + fastly_compute_at_edge_http_resp_http_version_t ok; + fastly_compute_at_edge_http_resp_error_t err; + } val; +} fastly_compute_at_edge_http_resp_result_http_version_error_t; + +typedef struct { + bool is_err; + union { + fastly_compute_at_edge_http_resp_http_status_t ok; + fastly_compute_at_edge_http_resp_error_t err; + } val; +} fastly_compute_at_edge_http_resp_result_http_status_error_t; + +typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_log_error_t; + +typedef uint32_t fastly_compute_at_edge_log_handle_t; + +typedef struct { + bool is_err; + union { + fastly_compute_at_edge_log_handle_t ok; + fastly_compute_at_edge_log_error_t err; + } val; +} fastly_compute_at_edge_log_result_handle_error_t; + +typedef struct { + bool is_err; + union { + fastly_compute_at_edge_log_error_t err; + } val; +} fastly_compute_at_edge_log_result_void_error_t; + +typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_object_store_error_t; + +typedef fastly_compute_at_edge_http_types_body_handle_t + fastly_compute_at_edge_object_store_body_handle_t; + +typedef uint32_t fastly_compute_at_edge_object_store_handle_t; + +typedef uint32_t fastly_compute_at_edge_object_store_pending_handle_t; + +typedef struct { + bool is_err; + union { + fastly_compute_at_edge_object_store_handle_t ok; + fastly_compute_at_edge_object_store_error_t err; + } val; +} fastly_compute_at_edge_object_store_result_handle_error_t; + +typedef struct { + bool is_some; + fastly_compute_at_edge_object_store_body_handle_t val; +} fastly_world_option_body_handle_t; + +typedef struct { + bool is_err; + union { + fastly_world_option_body_handle_t ok; + fastly_compute_at_edge_object_store_error_t err; + } val; +} fastly_compute_at_edge_object_store_result_option_body_handle_error_t; + +typedef struct { + bool is_err; + union { + fastly_compute_at_edge_object_store_pending_handle_t ok; + fastly_compute_at_edge_object_store_error_t err; + } val; +} fastly_compute_at_edge_object_store_result_pending_handle_error_t; + +typedef struct { + bool is_err; + union { + fastly_compute_at_edge_object_store_error_t err; + } val; +} fastly_compute_at_edge_object_store_result_void_error_t; + +typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_purge_error_t; + +typedef uint8_t fastly_compute_at_edge_purge_options_mask_t; + +#define FASTLY_COMPUTE_AT_EDGE_PURGE_OPTIONS_MASK_SOFT_PURGE (1 << 0) +#define FASTLY_COMPUTE_AT_EDGE_PURGE_OPTIONS_MASK_RET_BUF (1 << 1) + +typedef struct { + bool is_err; + union { + fastly_world_option_string_t ok; + fastly_compute_at_edge_purge_error_t err; + } val; +} fastly_compute_at_edge_purge_result_option_string_error_t; + +typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_secret_store_error_t; + +typedef fastly_compute_at_edge_types_secret_handle_t + fastly_compute_at_edge_secret_store_secret_handle_t; + +typedef uint32_t fastly_compute_at_edge_secret_store_store_handle_t; + +typedef struct { + bool is_err; + union { + fastly_compute_at_edge_secret_store_store_handle_t ok; + fastly_compute_at_edge_secret_store_error_t err; + } val; +} fastly_compute_at_edge_secret_store_result_store_handle_error_t; + +typedef struct { + bool is_some; + fastly_compute_at_edge_secret_store_secret_handle_t val; +} fastly_world_option_secret_handle_t; + +typedef struct { + bool is_err; + union { + fastly_world_option_secret_handle_t ok; + fastly_compute_at_edge_secret_store_error_t err; + } val; +} fastly_compute_at_edge_secret_store_result_option_secret_handle_error_t; + +typedef struct { + bool is_err; + union { + fastly_world_option_list_u8_t ok; + fastly_compute_at_edge_secret_store_error_t err; + } val; +} fastly_compute_at_edge_secret_store_result_option_list_u8_error_t; + +typedef struct { + bool is_err; + union { + fastly_compute_at_edge_secret_store_secret_handle_t ok; + fastly_compute_at_edge_secret_store_error_t err; + } val; +} fastly_compute_at_edge_secret_store_result_secret_handle_error_t; + +typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_uap_error_t; + +typedef struct fastly_compute_at_edge_uap_user_agent_t { + fastly_world_string_t family; + fastly_world_string_t major; + fastly_world_string_t minor; + fastly_world_string_t patch; +} fastly_compute_at_edge_uap_user_agent_t; -typedef fastly_compute_at_edge_http_types_request_t fastly_compute_at_edge_reactor_request_t; +typedef struct { + bool is_err; + union { + fastly_compute_at_edge_uap_user_agent_t ok; + fastly_compute_at_edge_uap_error_t err; + } val; +} fastly_compute_at_edge_uap_result_user_agent_error_t; + +typedef fastly_compute_at_edge_http_types_request_t + exports_fastly_compute_at_edge_reactor_request_t; + +typedef struct { + bool is_err; +} exports_fastly_compute_at_edge_reactor_result_void_void_t; // Imported Functions from `fastly:compute-at-edge/async-io` // Blocks until one of the given objects is ready for I/O, or the optional timeout expires. @@ -625,9 +1102,10 @@ typedef fastly_compute_at_edge_http_types_request_t fastly_compute_at_edge_react // // Returns the _index_ (not handle!) of the first object that is ready, or // none if the timeout expires before any objects are ready for I/O. -bool fastly_compute_at_edge_async_io_select( - fastly_world_list_fastly_compute_at_edge_async_io_handle_t *hs, uint32_t timeout_ms, - fastly_world_option_u32_t *ret, fastly_compute_at_edge_async_io_error_t *err); +extern bool fastly_compute_at_edge_async_io_select(fastly_world_list_handle_t *hs, + uint32_t timeout_ms, + fastly_world_option_u32_t *ret, + fastly_compute_at_edge_async_io_error_t *err); // Returns 1 if the given async item is "ready" for its associated I/O action, 0 otherwise. // // If an object is ready, the I/O action is guaranteed to complete without blocking. @@ -635,52 +1113,55 @@ bool fastly_compute_at_edge_async_io_select( // Valid object handles includes bodies and pending requests. See the `async_item_handle` // definition for more details, including what I/O actions are associated with each handle // type. -bool fastly_compute_at_edge_async_io_is_ready(fastly_compute_at_edge_async_io_handle_t handle, - bool *ret, - fastly_compute_at_edge_async_io_error_t *err); +extern bool +fastly_compute_at_edge_async_io_is_ready(fastly_compute_at_edge_async_io_handle_t handle, bool *ret, + fastly_compute_at_edge_async_io_error_t *err); // Imported Functions from `fastly:compute-at-edge/backend` -bool fastly_compute_at_edge_backend_exists(fastly_world_string_t *backend, bool *ret, - fastly_compute_at_edge_backend_error_t *err); -bool fastly_compute_at_edge_backend_is_healthy(fastly_world_string_t *backend, - fastly_compute_at_edge_backend_backend_health_t *ret, - fastly_compute_at_edge_backend_error_t *err); +extern bool fastly_compute_at_edge_backend_exists(fastly_world_string_t *backend, bool *ret, + fastly_compute_at_edge_backend_error_t *err); +extern bool +fastly_compute_at_edge_backend_is_healthy(fastly_world_string_t *backend, + fastly_compute_at_edge_backend_backend_health_t *ret, + fastly_compute_at_edge_backend_error_t *err); // Returns `true` if the backend is a "dynamic" backend. -bool fastly_compute_at_edge_backend_is_dynamic(fastly_world_string_t *backend, bool *ret, - fastly_compute_at_edge_backend_error_t *err); +extern bool fastly_compute_at_edge_backend_is_dynamic(fastly_world_string_t *backend, bool *ret, + fastly_compute_at_edge_backend_error_t *err); // Get the host of this backend. -bool fastly_compute_at_edge_backend_get_host(fastly_world_string_t *backend, - fastly_world_string_t *ret, - fastly_compute_at_edge_backend_error_t *err); +extern bool fastly_compute_at_edge_backend_get_host(fastly_world_string_t *backend, + fastly_world_string_t *ret, + fastly_compute_at_edge_backend_error_t *err); // Get the "override host" for this backend. // // This is used to change the `Host` header sent to the backend. See the // Fastly documentation oh this topic here: // https://docs.fastly.com/en/guides/specifying-an-override-host -bool fastly_compute_at_edge_backend_get_override_host(fastly_world_string_t *backend, - fastly_world_option_string_t *ret, - fastly_compute_at_edge_backend_error_t *err); +extern bool +fastly_compute_at_edge_backend_get_override_host(fastly_world_string_t *backend, + fastly_world_option_string_t *ret, + fastly_compute_at_edge_backend_error_t *err); // Get the remote TCP port of the backend connection for the request. -bool fastly_compute_at_edge_backend_get_port(fastly_world_string_t *backend, uint16_t *ret, - fastly_compute_at_edge_backend_error_t *err); +extern bool fastly_compute_at_edge_backend_get_port(fastly_world_string_t *backend, uint16_t *ret, + fastly_compute_at_edge_backend_error_t *err); // Get the connection timeout of the backend. -bool fastly_compute_at_edge_backend_get_connect_timeout_ms( - fastly_world_string_t *backend, uint32_t *ret, fastly_compute_at_edge_backend_error_t *err); +extern bool +fastly_compute_at_edge_backend_get_connect_timeout_ms(fastly_world_string_t *backend, uint32_t *ret, + fastly_compute_at_edge_backend_error_t *err); // Get the first byte timeout of the backend. -bool fastly_compute_at_edge_backend_get_first_byte_timeout_ms( +extern bool fastly_compute_at_edge_backend_get_first_byte_timeout_ms( fastly_world_string_t *backend, uint32_t *ret, fastly_compute_at_edge_backend_error_t *err); // Get the between byte timeout of the backend. -bool fastly_compute_at_edge_backend_get_between_bytes_timeout_ms( +extern bool fastly_compute_at_edge_backend_get_between_bytes_timeout_ms( fastly_world_string_t *backend, uint32_t *ret, fastly_compute_at_edge_backend_error_t *err); // Returns `true` if the backend is configured to use SSL. -bool fastly_compute_at_edge_backend_is_ssl(fastly_world_string_t *backend, bool *ret, - fastly_compute_at_edge_backend_error_t *err); +extern bool fastly_compute_at_edge_backend_is_ssl(fastly_world_string_t *backend, bool *ret, + fastly_compute_at_edge_backend_error_t *err); // Get the minimum SSL version this backend will use. -bool fastly_compute_at_edge_backend_get_ssl_min_version( +extern bool fastly_compute_at_edge_backend_get_ssl_min_version( fastly_world_string_t *backend, fastly_compute_at_edge_backend_tls_version_t *ret, fastly_compute_at_edge_backend_error_t *err); // Get the maximum SSL version this backend will use. -bool fastly_compute_at_edge_backend_get_ssl_max_version( +extern bool fastly_compute_at_edge_backend_get_ssl_max_version( fastly_world_string_t *backend, fastly_compute_at_edge_backend_tls_version_t *ret, fastly_compute_at_edge_backend_error_t *err); @@ -688,23 +1169,21 @@ bool fastly_compute_at_edge_backend_get_ssl_max_version( // Performs a non-request-collapsing cache lookup. // // Returns a result without waiting for any request collapsing that may be ongoing. -bool fastly_compute_at_edge_cache_lookup(fastly_world_string_t *key, - fastly_compute_at_edge_cache_lookup_options_t *options, - fastly_compute_at_edge_cache_handle_t *ret, - fastly_compute_at_edge_cache_error_t *err); +extern bool fastly_compute_at_edge_cache_lookup( + fastly_world_string_t *key, fastly_compute_at_edge_cache_lookup_options_t *options, + fastly_compute_at_edge_cache_handle_t *ret, fastly_compute_at_edge_cache_error_t *err); // Performs a non-request-collapsing cache insertion (or update). // // The returned handle is to a streaming body that is used for writing the object into // the cache. -bool fastly_compute_at_edge_cache_insert(fastly_world_string_t *key, - fastly_compute_at_edge_cache_write_options_t *options, - fastly_compute_at_edge_cache_body_handle_t *ret, - fastly_compute_at_edge_cache_error_t *err); +extern bool fastly_compute_at_edge_cache_insert( + fastly_world_string_t *key, fastly_compute_at_edge_cache_write_options_t *options, + fastly_compute_at_edge_cache_body_handle_t *ret, fastly_compute_at_edge_cache_error_t *err); // The entrypoint to the request-collapsing cache transaction API. // // This operation always participates in request collapsing and may return stale objects. To bypass // request collapsing, use `lookup` and `insert` instead. -bool fastly_compute_at_edge_cache_transaction_lookup( +extern bool fastly_compute_at_edge_cache_transaction_lookup( fastly_world_string_t *key, fastly_compute_at_edge_cache_lookup_options_t *options, fastly_compute_at_edge_cache_handle_t *ret, fastly_compute_at_edge_cache_error_t *err); // Insert an object into the cache with the given metadata. @@ -713,7 +1192,7 @@ bool fastly_compute_at_edge_cache_transaction_lookup( // // The returned handle is to a streaming body that is used for writing the object into // the cache. -bool fastly_compute_at_edge_cache_transaction_insert( +extern bool fastly_compute_at_edge_cache_transaction_insert( fastly_compute_at_edge_cache_handle_t handle, fastly_compute_at_edge_cache_write_options_t *options, fastly_compute_at_edge_cache_body_handle_t *ret, fastly_compute_at_edge_cache_error_t *err); @@ -727,41 +1206,41 @@ bool fastly_compute_at_edge_cache_transaction_insert( // The returned body handle is to a streaming body that is used for writing the object _into_ // the cache. The returned cache handle provides a separate transaction for reading out the // newly cached object to send elsewhere. -bool fastly_compute_at_edge_cache_transaction_insert_and_stream_back( +extern bool fastly_compute_at_edge_cache_transaction_insert_and_stream_back( fastly_compute_at_edge_cache_handle_t handle, fastly_compute_at_edge_cache_write_options_t *options, - fastly_world_tuple2_fastly_compute_at_edge_cache_body_handle_fastly_compute_at_edge_cache_handle_t - *ret, - fastly_compute_at_edge_cache_error_t *err); + fastly_world_tuple2_body_handle_handle_t *ret, fastly_compute_at_edge_cache_error_t *err); // Update the metadata of an object in the cache without changing its data. // // Can only be used in if the cache handle state includes both of the flags: // - `found` // - `must-insert-or-update` -bool fastly_compute_at_edge_cache_transaction_update( +extern bool fastly_compute_at_edge_cache_transaction_update( fastly_compute_at_edge_cache_handle_t handle, fastly_compute_at_edge_cache_write_options_t *options, fastly_compute_at_edge_cache_error_t *err); // Cancel an obligation to provide an object to the cache. // // Useful if there is an error before streaming is possible, e.g. if a backend is unreachable. -bool fastly_compute_at_edge_cache_transaction_cancel(fastly_compute_at_edge_cache_handle_t handle, - fastly_compute_at_edge_cache_error_t *err); +extern bool +fastly_compute_at_edge_cache_transaction_cancel(fastly_compute_at_edge_cache_handle_t handle, + fastly_compute_at_edge_cache_error_t *err); // Close an ongoing interaction with the cache. // // If the cache handle state includes the `$must_insert_or_update` (and hence no insert or // update has been performed), closing the handle cancels any request collapsing, potentially // choosing a new waiter to perform the insertion/update. -bool fastly_compute_at_edge_cache_close(fastly_compute_at_edge_cache_handle_t handle, - fastly_compute_at_edge_cache_error_t *err); -bool fastly_compute_at_edge_cache_get_state(fastly_compute_at_edge_cache_handle_t handle, - fastly_compute_at_edge_cache_lookup_state_t *ret, - fastly_compute_at_edge_cache_error_t *err); +extern bool fastly_compute_at_edge_cache_close(fastly_compute_at_edge_cache_handle_t handle, + fastly_compute_at_edge_cache_error_t *err); +extern bool fastly_compute_at_edge_cache_get_state(fastly_compute_at_edge_cache_handle_t handle, + fastly_compute_at_edge_cache_lookup_state_t *ret, + fastly_compute_at_edge_cache_error_t *err); // Gets the user metadata of the found object, returning `none` if there // was no found object. -bool fastly_compute_at_edge_cache_get_user_metadata(fastly_compute_at_edge_cache_handle_t handle, - fastly_world_list_u8_t *ret, - fastly_compute_at_edge_cache_error_t *err); +extern bool +fastly_compute_at_edge_cache_get_user_metadata(fastly_compute_at_edge_cache_handle_t handle, + fastly_world_list_u8_t *ret, + fastly_compute_at_edge_cache_error_t *err); // Gets a range of the found object body, returning the `optional-none` error if there // was no found object. // @@ -771,352 +1250,370 @@ bool fastly_compute_at_edge_cache_get_user_metadata(fastly_compute_at_edge_cache // Note: until the CacheD protocol is adjusted to fully support this functionality, // the body of objects that are past the stale-while-revalidate period will not // be available, even when other metadata is. -bool fastly_compute_at_edge_cache_get_body( +extern bool fastly_compute_at_edge_cache_get_body( fastly_compute_at_edge_cache_handle_t handle, fastly_compute_at_edge_cache_get_body_options_t *options, fastly_compute_at_edge_cache_get_body_options_mask_t options_mask, fastly_compute_at_edge_cache_body_handle_t *ret, fastly_compute_at_edge_cache_error_t *err); // Gets the content length of the found object, returning the `$none` error if there // was no found object, or no content length was provided. -bool fastly_compute_at_edge_cache_get_length(fastly_compute_at_edge_cache_handle_t handle, - uint64_t *ret, - fastly_compute_at_edge_cache_error_t *err); +extern bool fastly_compute_at_edge_cache_get_length(fastly_compute_at_edge_cache_handle_t handle, + uint64_t *ret, + fastly_compute_at_edge_cache_error_t *err); // Gets the configured max age of the found object, returning the `$none` error if there // was no found object. -bool fastly_compute_at_edge_cache_get_max_age_ns(fastly_compute_at_edge_cache_handle_t handle, - uint64_t *ret, - fastly_compute_at_edge_cache_error_t *err); +extern bool +fastly_compute_at_edge_cache_get_max_age_ns(fastly_compute_at_edge_cache_handle_t handle, + uint64_t *ret, + fastly_compute_at_edge_cache_error_t *err); // Gets the configured stale-while-revalidate period of the found object, returning the // `$none` error if there was no found object. -bool fastly_compute_at_edge_cache_get_stale_while_revalidate_ns( +extern bool fastly_compute_at_edge_cache_get_stale_while_revalidate_ns( fastly_compute_at_edge_cache_handle_t handle, uint64_t *ret, fastly_compute_at_edge_cache_error_t *err); // Gets the age of the found object, returning the `$none` error if there // was no found object. -bool fastly_compute_at_edge_cache_get_age_ns(fastly_compute_at_edge_cache_handle_t handle, - uint64_t *ret, - fastly_compute_at_edge_cache_error_t *err); +extern bool fastly_compute_at_edge_cache_get_age_ns(fastly_compute_at_edge_cache_handle_t handle, + uint64_t *ret, + fastly_compute_at_edge_cache_error_t *err); // Gets the number of cache hits for the found object, returning the `$none` error if there // was no found object. -bool fastly_compute_at_edge_cache_get_hits(fastly_compute_at_edge_cache_handle_t handle, - uint64_t *ret, - fastly_compute_at_edge_cache_error_t *err); +extern bool fastly_compute_at_edge_cache_get_hits(fastly_compute_at_edge_cache_handle_t handle, + uint64_t *ret, + fastly_compute_at_edge_cache_error_t *err); // Imported Functions from `fastly:compute-at-edge/device-detection` -bool fastly_compute_at_edge_device_detection_lookup( +extern bool fastly_compute_at_edge_device_detection_lookup( fastly_world_string_t *user_agent, fastly_world_string_t *ret, fastly_compute_at_edge_device_detection_error_t *err); // Imported Functions from `fastly:compute-at-edge/dictionary` -bool fastly_compute_at_edge_dictionary_open(fastly_world_string_t *name, - fastly_compute_at_edge_dictionary_handle_t *ret, - fastly_compute_at_edge_dictionary_error_t *err); -bool fastly_compute_at_edge_dictionary_get(fastly_compute_at_edge_dictionary_handle_t h, - fastly_world_string_t *key, - fastly_world_option_string_t *ret, - fastly_compute_at_edge_dictionary_error_t *err); +extern bool fastly_compute_at_edge_dictionary_open(fastly_world_string_t *name, + fastly_compute_at_edge_dictionary_handle_t *ret, + fastly_compute_at_edge_dictionary_error_t *err); +extern bool fastly_compute_at_edge_dictionary_get(fastly_compute_at_edge_dictionary_handle_t h, + fastly_world_string_t *key, + fastly_world_option_string_t *ret, + fastly_compute_at_edge_dictionary_error_t *err); // Imported Functions from `fastly:compute-at-edge/edge-rate-limiter` -bool fastly_compute_at_edge_edge_rate_limiter_check_rate( +extern bool fastly_compute_at_edge_edge_rate_limiter_check_rate( fastly_world_string_t *rate_counter_name, fastly_world_string_t *entry, uint32_t delta, uint32_t window, uint32_t limit, fastly_world_string_t *penalty_box_name, uint32_t time_to_live, bool *ret, fastly_compute_at_edge_edge_rate_limiter_error_t *err); -bool fastly_compute_at_edge_edge_rate_limiter_ratecounter_increment( +extern bool fastly_compute_at_edge_edge_rate_limiter_ratecounter_increment( fastly_world_string_t *rate_counter_name, fastly_world_string_t *entry, uint32_t delta, fastly_compute_at_edge_edge_rate_limiter_error_t *err); -bool fastly_compute_at_edge_edge_rate_limiter_ratecounter_lookup_rate( +extern bool fastly_compute_at_edge_edge_rate_limiter_ratecounter_lookup_rate( fastly_world_string_t *rate_counter_name, fastly_world_string_t *entry, uint32_t window, uint32_t *ret, fastly_compute_at_edge_edge_rate_limiter_error_t *err); -bool fastly_compute_at_edge_edge_rate_limiter_ratecounter_lookup_count( +extern bool fastly_compute_at_edge_edge_rate_limiter_ratecounter_lookup_count( fastly_world_string_t *rate_counter_name, fastly_world_string_t *entry, uint32_t duration, uint32_t *ret, fastly_compute_at_edge_edge_rate_limiter_error_t *err); -bool fastly_compute_at_edge_edge_rate_limiter_penaltybox_add( +extern bool fastly_compute_at_edge_edge_rate_limiter_penaltybox_add( fastly_world_string_t *penalty_box_name, fastly_world_string_t *entry, uint32_t time_to_live, fastly_compute_at_edge_edge_rate_limiter_error_t *err); -bool fastly_compute_at_edge_edge_rate_limiter_penaltybox_has( +extern bool fastly_compute_at_edge_edge_rate_limiter_penaltybox_has( fastly_world_string_t *penalty_box_name, fastly_world_string_t *entry, bool *ret, fastly_compute_at_edge_edge_rate_limiter_error_t *err); // Imported Functions from `fastly:compute-at-edge/geo` // JSON string for now -bool fastly_compute_at_edge_geo_lookup(fastly_world_list_u8_t *addr_octets, - fastly_world_string_t *ret, - fastly_compute_at_edge_geo_error_t *err); +extern bool fastly_compute_at_edge_geo_lookup(fastly_world_list_u8_t *addr_octets, + fastly_world_string_t *ret, + fastly_compute_at_edge_geo_error_t *err); // Imported Functions from `fastly:compute-at-edge/http-body` -bool fastly_compute_at_edge_http_body_append(fastly_compute_at_edge_http_body_body_handle_t dest, - fastly_compute_at_edge_http_body_body_handle_t src, - fastly_compute_at_edge_http_body_error_t *err); -bool fastly_compute_at_edge_http_body_new(fastly_compute_at_edge_http_body_body_handle_t *ret, - fastly_compute_at_edge_http_body_error_t *err); -bool fastly_compute_at_edge_http_body_read(fastly_compute_at_edge_http_body_body_handle_t h, - uint32_t chunk_size, fastly_world_list_u8_t *ret, - fastly_compute_at_edge_http_body_error_t *err); -bool fastly_compute_at_edge_http_body_write(fastly_compute_at_edge_http_body_body_handle_t h, - fastly_world_list_u8_t *buf, - fastly_compute_at_edge_http_body_write_end_t end, - uint32_t *ret, - fastly_compute_at_edge_http_body_error_t *err); -bool fastly_compute_at_edge_http_body_close(fastly_compute_at_edge_http_body_body_handle_t h, - fastly_compute_at_edge_http_body_error_t *err); +extern bool +fastly_compute_at_edge_http_body_append(fastly_compute_at_edge_http_body_body_handle_t dest, + fastly_compute_at_edge_http_body_body_handle_t src, + fastly_compute_at_edge_http_body_error_t *err); +extern bool +fastly_compute_at_edge_http_body_new(fastly_compute_at_edge_http_body_body_handle_t *ret, + fastly_compute_at_edge_http_body_error_t *err); +extern bool fastly_compute_at_edge_http_body_read(fastly_compute_at_edge_http_body_body_handle_t h, + uint32_t chunk_size, fastly_world_list_u8_t *ret, + fastly_compute_at_edge_http_body_error_t *err); +extern bool fastly_compute_at_edge_http_body_write(fastly_compute_at_edge_http_body_body_handle_t h, + fastly_world_list_u8_t *buf, + fastly_compute_at_edge_http_body_write_end_t end, + uint32_t *ret, + fastly_compute_at_edge_http_body_error_t *err); +extern bool fastly_compute_at_edge_http_body_close(fastly_compute_at_edge_http_body_body_handle_t h, + fastly_compute_at_edge_http_body_error_t *err); // Imported Functions from `fastly:compute-at-edge/http-req` -bool fastly_compute_at_edge_http_req_cache_override_set( +extern bool fastly_compute_at_edge_http_req_cache_override_set( fastly_compute_at_edge_http_req_request_handle_t h, fastly_compute_at_edge_http_req_cache_override_tag_t tag, uint32_t *maybe_ttl, uint32_t *maybe_stale_while_revalidate, fastly_world_string_t *maybe_sk, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_downstream_client_ip_addr( +extern bool fastly_compute_at_edge_http_req_downstream_client_ip_addr( fastly_world_list_u8_t *ret, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_downstream_client_request_id( +extern bool fastly_compute_at_edge_http_req_downstream_client_request_id( fastly_world_string_t *ret, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_downstream_client_h2_fingerprint( +extern bool fastly_compute_at_edge_http_req_downstream_client_h2_fingerprint( fastly_world_list_u8_t *ret, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_downstream_tls_cipher_openssl_name( +extern bool fastly_compute_at_edge_http_req_downstream_tls_cipher_openssl_name( fastly_world_string_t *ret, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_downstream_tls_protocol( +extern bool fastly_compute_at_edge_http_req_downstream_tls_protocol( fastly_world_string_t *ret, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_downstream_tls_client_hello( +extern bool fastly_compute_at_edge_http_req_downstream_tls_client_hello( fastly_world_list_u8_t *ret, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_downstream_tls_raw_client_certificate( +extern bool fastly_compute_at_edge_http_req_downstream_tls_raw_client_certificate( fastly_world_list_u8_t *ret, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_downstream_tls_client_cert_verify_result( +extern bool fastly_compute_at_edge_http_req_downstream_tls_client_cert_verify_result( fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_downstream_tls_ja3_md5( +extern bool fastly_compute_at_edge_http_req_downstream_tls_ja3_md5( fastly_world_list_u8_t *ret, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_new(fastly_compute_at_edge_http_req_request_handle_t *ret, - fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_header_names_get( - fastly_compute_at_edge_http_req_request_handle_t h, fastly_world_list_string_t *ret, - fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_original_header_names_get( +extern bool +fastly_compute_at_edge_http_req_new(fastly_compute_at_edge_http_req_request_handle_t *ret, + fastly_compute_at_edge_http_req_error_t *err); +extern bool +fastly_compute_at_edge_http_req_header_names_get(fastly_compute_at_edge_http_req_request_handle_t h, + fastly_world_list_string_t *ret, + fastly_compute_at_edge_http_req_error_t *err); +extern bool fastly_compute_at_edge_http_req_original_header_names_get( fastly_world_list_string_t *ret, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_original_header_count( - uint32_t *ret, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_header_value_get( +extern bool +fastly_compute_at_edge_http_req_original_header_count(uint32_t *ret, + fastly_compute_at_edge_http_req_error_t *err); +extern bool fastly_compute_at_edge_http_req_header_value_get( fastly_compute_at_edge_http_req_request_handle_t h, fastly_world_string_t *name, fastly_world_option_list_u8_t *ret, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_header_values_get( +extern bool fastly_compute_at_edge_http_req_header_values_get( fastly_compute_at_edge_http_req_request_handle_t h, fastly_world_string_t *name, fastly_world_option_list_list_u8_t *ret, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_header_values_set( +extern bool fastly_compute_at_edge_http_req_header_values_set( fastly_compute_at_edge_http_req_request_handle_t h, fastly_world_string_t *name, fastly_world_list_list_u8_t *values, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_header_insert( +extern bool fastly_compute_at_edge_http_req_header_insert( fastly_compute_at_edge_http_req_request_handle_t h, fastly_world_string_t *name, fastly_world_list_u8_t *value, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_header_append( +extern bool fastly_compute_at_edge_http_req_header_append( fastly_compute_at_edge_http_req_request_handle_t h, fastly_world_string_t *name, fastly_world_list_u8_t *value, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_header_remove( - fastly_compute_at_edge_http_req_request_handle_t h, fastly_world_string_t *name, - fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_method_get(fastly_compute_at_edge_http_req_request_handle_t h, - fastly_world_string_t *ret, - fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_method_set(fastly_compute_at_edge_http_req_request_handle_t h, - fastly_world_string_t *method, - fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_uri_get(fastly_compute_at_edge_http_req_request_handle_t h, - fastly_world_string_t *ret, - fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_uri_set(fastly_compute_at_edge_http_req_request_handle_t h, - fastly_world_string_t *uri, - fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_version_get( - fastly_compute_at_edge_http_req_request_handle_t h, - fastly_compute_at_edge_http_req_http_version_t *ret, - fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_version_set( +extern bool +fastly_compute_at_edge_http_req_header_remove(fastly_compute_at_edge_http_req_request_handle_t h, + fastly_world_string_t *name, + fastly_compute_at_edge_http_req_error_t *err); +extern bool +fastly_compute_at_edge_http_req_method_get(fastly_compute_at_edge_http_req_request_handle_t h, + fastly_world_string_t *ret, + fastly_compute_at_edge_http_req_error_t *err); +extern bool +fastly_compute_at_edge_http_req_method_set(fastly_compute_at_edge_http_req_request_handle_t h, + fastly_world_string_t *method, + fastly_compute_at_edge_http_req_error_t *err); +extern bool +fastly_compute_at_edge_http_req_uri_get(fastly_compute_at_edge_http_req_request_handle_t h, + fastly_world_string_t *ret, + fastly_compute_at_edge_http_req_error_t *err); +extern bool +fastly_compute_at_edge_http_req_uri_set(fastly_compute_at_edge_http_req_request_handle_t h, + fastly_world_string_t *uri, + fastly_compute_at_edge_http_req_error_t *err); +extern bool +fastly_compute_at_edge_http_req_version_get(fastly_compute_at_edge_http_req_request_handle_t h, + fastly_compute_at_edge_http_req_http_version_t *ret, + fastly_compute_at_edge_http_req_error_t *err); +extern bool +fastly_compute_at_edge_http_req_version_set(fastly_compute_at_edge_http_req_request_handle_t h, + fastly_compute_at_edge_http_req_http_version_t version, + fastly_compute_at_edge_http_req_error_t *err); +extern bool fastly_compute_at_edge_http_req_send(fastly_compute_at_edge_http_req_request_handle_t h, + fastly_compute_at_edge_http_req_body_handle_t b, + fastly_world_string_t *backend, + fastly_compute_at_edge_http_req_response_t *ret, + fastly_compute_at_edge_http_req_error_t *err); +extern bool fastly_compute_at_edge_http_req_send_v2( fastly_compute_at_edge_http_req_request_handle_t h, - fastly_compute_at_edge_http_req_http_version_t version, - fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_send(fastly_compute_at_edge_http_req_request_handle_t h, - fastly_compute_at_edge_http_req_body_handle_t b, - fastly_world_string_t *backend, - fastly_compute_at_edge_http_req_response_t *ret, - fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_send_v2(fastly_compute_at_edge_http_req_request_handle_t h, - fastly_compute_at_edge_http_req_send_error_detail_t *s, - fastly_compute_at_edge_http_req_body_handle_t b, - fastly_world_string_t *backend, - fastly_compute_at_edge_http_req_response_t *ret, - fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_send_async( + fastly_compute_at_edge_http_req_send_error_detail_t *s, + fastly_compute_at_edge_http_req_body_handle_t b, fastly_world_string_t *backend, + fastly_compute_at_edge_http_req_response_t *ret, fastly_compute_at_edge_http_req_error_t *err); +extern bool fastly_compute_at_edge_http_req_send_async( fastly_compute_at_edge_http_req_request_handle_t h, fastly_compute_at_edge_http_req_body_handle_t b, fastly_world_string_t *backend, fastly_compute_at_edge_http_req_pending_request_handle_t *ret, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_send_async_streaming( +extern bool fastly_compute_at_edge_http_req_send_async_streaming( fastly_compute_at_edge_http_req_request_handle_t h, fastly_compute_at_edge_http_req_body_handle_t b, fastly_world_string_t *backend, fastly_compute_at_edge_http_req_pending_request_handle_t *ret, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_pending_req_poll( - fastly_compute_at_edge_http_req_pending_request_handle_t h, - fastly_world_option_fastly_compute_at_edge_http_req_response_t *ret, +extern bool fastly_compute_at_edge_http_req_pending_req_poll( + fastly_compute_at_edge_http_req_pending_request_handle_t h, fastly_world_option_response_t *ret, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_pending_req_poll_v2( +extern bool fastly_compute_at_edge_http_req_pending_req_poll_v2( fastly_compute_at_edge_http_req_pending_request_handle_t h, - fastly_compute_at_edge_http_req_send_error_detail_t *s, - fastly_world_option_fastly_compute_at_edge_http_req_response_t *ret, + fastly_compute_at_edge_http_req_send_error_detail_t *s, fastly_world_option_response_t *ret, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_pending_req_wait( +extern bool fastly_compute_at_edge_http_req_pending_req_wait( fastly_compute_at_edge_http_req_pending_request_handle_t h, fastly_compute_at_edge_http_req_response_t *ret, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_pending_req_wait_v2( +extern bool fastly_compute_at_edge_http_req_pending_req_wait_v2( fastly_compute_at_edge_http_req_pending_request_handle_t h, fastly_compute_at_edge_http_req_send_error_detail_t *s, fastly_compute_at_edge_http_req_response_t *ret, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_pending_req_select( - fastly_world_list_fastly_compute_at_edge_http_req_pending_request_handle_t *h, - fastly_world_tuple2_u32_fastly_compute_at_edge_http_req_response_t *ret, - fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_pending_req_select_v2( - fastly_world_list_fastly_compute_at_edge_http_req_pending_request_handle_t *h, - fastly_world_tuple2_u32_fastly_compute_at_edge_http_req_response_t *ret, +extern bool +fastly_compute_at_edge_http_req_pending_req_select(fastly_world_list_pending_request_handle_t *h, + fastly_world_tuple2_u32_response_t *ret, + fastly_compute_at_edge_http_req_error_t *err); +extern bool fastly_compute_at_edge_http_req_pending_req_select_v2( + fastly_world_list_pending_request_handle_t *h, fastly_world_tuple2_u32_response_t *ret, fastly_compute_at_edge_http_req_send_error_detail_t *err); -bool fastly_compute_at_edge_http_req_close(fastly_compute_at_edge_http_req_request_handle_t h, - fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_auto_decompress_response_set( +extern bool +fastly_compute_at_edge_http_req_close(fastly_compute_at_edge_http_req_request_handle_t h, + fastly_compute_at_edge_http_req_error_t *err); +extern bool fastly_compute_at_edge_http_req_auto_decompress_response_set( fastly_compute_at_edge_http_req_request_handle_t h, fastly_compute_at_edge_http_req_content_encodings_t encodings, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_upgrade_websocket( +extern bool +fastly_compute_at_edge_http_req_upgrade_websocket(fastly_world_string_t *backend, + fastly_compute_at_edge_http_req_error_t *err); +extern bool fastly_compute_at_edge_http_req_redirect_to_websocket_proxy( fastly_world_string_t *backend, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_redirect_to_websocket_proxy( +extern bool fastly_compute_at_edge_http_req_redirect_to_grip_proxy( fastly_world_string_t *backend, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_redirect_to_grip_proxy( - fastly_world_string_t *backend, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_framing_headers_mode_set( +extern bool fastly_compute_at_edge_http_req_framing_headers_mode_set( fastly_compute_at_edge_http_req_request_handle_t h, fastly_compute_at_edge_http_req_framing_headers_mode_t mode, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_register_dynamic_backend( +extern bool fastly_compute_at_edge_http_req_register_dynamic_backend( fastly_world_string_t *prefix, fastly_world_string_t *target, fastly_compute_at_edge_http_req_dynamic_backend_config_t *config, fastly_compute_at_edge_http_req_error_t *err); // Imported Functions from `fastly:compute-at-edge/http-resp` -bool fastly_compute_at_edge_http_resp_new(fastly_compute_at_edge_http_resp_response_handle_t *ret, - fastly_compute_at_edge_http_resp_error_t *err); -bool fastly_compute_at_edge_http_resp_header_names_get( +extern bool +fastly_compute_at_edge_http_resp_new(fastly_compute_at_edge_http_resp_response_handle_t *ret, + fastly_compute_at_edge_http_resp_error_t *err); +extern bool fastly_compute_at_edge_http_resp_header_names_get( fastly_compute_at_edge_http_resp_response_handle_t h, fastly_world_list_string_t *ret, fastly_compute_at_edge_http_resp_error_t *err); -bool fastly_compute_at_edge_http_resp_header_value_get( +extern bool fastly_compute_at_edge_http_resp_header_value_get( fastly_compute_at_edge_http_resp_response_handle_t h, fastly_world_string_t *name, fastly_world_option_string_t *ret, fastly_compute_at_edge_http_resp_error_t *err); -bool fastly_compute_at_edge_http_resp_header_values_get( +extern bool fastly_compute_at_edge_http_resp_header_values_get( fastly_compute_at_edge_http_resp_response_handle_t h, fastly_world_string_t *name, fastly_world_option_list_list_u8_t *ret, fastly_compute_at_edge_http_resp_error_t *err); -bool fastly_compute_at_edge_http_resp_header_values_set( +extern bool fastly_compute_at_edge_http_resp_header_values_set( fastly_compute_at_edge_http_resp_response_handle_t h, fastly_world_string_t *name, fastly_world_list_list_u8_t *values, fastly_compute_at_edge_http_resp_error_t *err); -bool fastly_compute_at_edge_http_resp_header_insert( +extern bool fastly_compute_at_edge_http_resp_header_insert( fastly_compute_at_edge_http_resp_response_handle_t h, fastly_world_string_t *name, fastly_world_list_u8_t *value, fastly_compute_at_edge_http_resp_error_t *err); -bool fastly_compute_at_edge_http_resp_header_append( +extern bool fastly_compute_at_edge_http_resp_header_append( fastly_compute_at_edge_http_resp_response_handle_t h, fastly_world_string_t *name, fastly_world_list_u8_t *value, fastly_compute_at_edge_http_resp_error_t *err); -bool fastly_compute_at_edge_http_resp_header_remove( - fastly_compute_at_edge_http_resp_response_handle_t h, fastly_world_string_t *name, - fastly_compute_at_edge_http_resp_error_t *err); -bool fastly_compute_at_edge_http_resp_version_get( - fastly_compute_at_edge_http_resp_response_handle_t h, - fastly_compute_at_edge_http_resp_http_version_t *ret, - fastly_compute_at_edge_http_resp_error_t *err); -bool fastly_compute_at_edge_http_resp_version_set( +extern bool +fastly_compute_at_edge_http_resp_header_remove(fastly_compute_at_edge_http_resp_response_handle_t h, + fastly_world_string_t *name, + fastly_compute_at_edge_http_resp_error_t *err); +extern bool +fastly_compute_at_edge_http_resp_version_get(fastly_compute_at_edge_http_resp_response_handle_t h, + fastly_compute_at_edge_http_resp_http_version_t *ret, + fastly_compute_at_edge_http_resp_error_t *err); +extern bool fastly_compute_at_edge_http_resp_version_set( fastly_compute_at_edge_http_resp_response_handle_t h, fastly_compute_at_edge_http_resp_http_version_t version, fastly_compute_at_edge_http_resp_error_t *err); -bool fastly_compute_at_edge_http_resp_send_downstream( +extern bool fastly_compute_at_edge_http_resp_send_downstream( fastly_compute_at_edge_http_resp_response_handle_t h, fastly_compute_at_edge_http_resp_body_handle_t b, bool streaming, fastly_compute_at_edge_http_resp_error_t *err); -bool fastly_compute_at_edge_http_resp_status_get( - fastly_compute_at_edge_http_resp_response_handle_t h, - fastly_compute_at_edge_http_resp_http_status_t *ret, - fastly_compute_at_edge_http_resp_error_t *err); -bool fastly_compute_at_edge_http_resp_status_set( - fastly_compute_at_edge_http_resp_response_handle_t h, - fastly_compute_at_edge_http_resp_http_status_t status, - fastly_compute_at_edge_http_resp_error_t *err); -bool fastly_compute_at_edge_http_resp_close(fastly_compute_at_edge_http_resp_response_handle_t h, +extern bool +fastly_compute_at_edge_http_resp_status_get(fastly_compute_at_edge_http_resp_response_handle_t h, + fastly_compute_at_edge_http_resp_http_status_t *ret, + fastly_compute_at_edge_http_resp_error_t *err); +extern bool +fastly_compute_at_edge_http_resp_status_set(fastly_compute_at_edge_http_resp_response_handle_t h, + fastly_compute_at_edge_http_resp_http_status_t status, fastly_compute_at_edge_http_resp_error_t *err); +extern bool +fastly_compute_at_edge_http_resp_close(fastly_compute_at_edge_http_resp_response_handle_t h, + fastly_compute_at_edge_http_resp_error_t *err); // Adjust how this response's framing headers are determined. -bool fastly_compute_at_edge_http_resp_framing_headers_mode_set( +extern bool fastly_compute_at_edge_http_resp_framing_headers_mode_set( fastly_compute_at_edge_http_resp_response_handle_t h, fastly_compute_at_edge_http_resp_framing_headers_mode_t mode, fastly_compute_at_edge_http_resp_error_t *err); -bool fastly_compute_at_edge_http_resp_http_keepalive_mode_set( +extern bool fastly_compute_at_edge_http_resp_http_keepalive_mode_set( fastly_compute_at_edge_http_resp_response_handle_t h, fastly_compute_at_edge_http_resp_keepalive_mode_t mode, fastly_compute_at_edge_http_resp_error_t *err); // Imported Functions from `fastly:compute-at-edge/log` -bool fastly_compute_at_edge_log_endpoint_get(fastly_world_string_t *name, - fastly_compute_at_edge_log_handle_t *ret, +extern bool fastly_compute_at_edge_log_endpoint_get(fastly_world_string_t *name, + fastly_compute_at_edge_log_handle_t *ret, + fastly_compute_at_edge_log_error_t *err); +extern bool fastly_compute_at_edge_log_write(fastly_compute_at_edge_log_handle_t h, + fastly_world_string_t *msg, fastly_compute_at_edge_log_error_t *err); -bool fastly_compute_at_edge_log_write(fastly_compute_at_edge_log_handle_t h, - fastly_world_string_t *msg, - fastly_compute_at_edge_log_error_t *err); // Imported Functions from `fastly:compute-at-edge/object-store` -bool fastly_compute_at_edge_object_store_open(fastly_world_string_t *name, - fastly_compute_at_edge_object_store_handle_t *ret, - fastly_compute_at_edge_object_store_error_t *err); -bool fastly_compute_at_edge_object_store_lookup( +extern bool +fastly_compute_at_edge_object_store_open(fastly_world_string_t *name, + fastly_compute_at_edge_object_store_handle_t *ret, + fastly_compute_at_edge_object_store_error_t *err); +extern bool fastly_compute_at_edge_object_store_lookup( fastly_compute_at_edge_object_store_handle_t store, fastly_world_string_t *key, - fastly_world_option_fastly_compute_at_edge_object_store_body_handle_t *ret, - fastly_compute_at_edge_object_store_error_t *err); -bool fastly_compute_at_edge_object_store_lookup_async( + fastly_world_option_body_handle_t *ret, fastly_compute_at_edge_object_store_error_t *err); +extern bool fastly_compute_at_edge_object_store_lookup_async( fastly_compute_at_edge_object_store_handle_t store, fastly_world_string_t *key, fastly_compute_at_edge_object_store_pending_handle_t *ret, fastly_compute_at_edge_object_store_error_t *err); -bool fastly_compute_at_edge_object_store_pending_lookup_wait( +extern bool fastly_compute_at_edge_object_store_pending_lookup_wait( fastly_compute_at_edge_object_store_pending_handle_t handle, - fastly_world_option_fastly_compute_at_edge_object_store_body_handle_t *ret, - fastly_compute_at_edge_object_store_error_t *err); -bool fastly_compute_at_edge_object_store_delete_async( + fastly_world_option_body_handle_t *ret, fastly_compute_at_edge_object_store_error_t *err); +extern bool fastly_compute_at_edge_object_store_delete_async( fastly_compute_at_edge_object_store_handle_t store, fastly_world_string_t *key, fastly_compute_at_edge_object_store_pending_handle_t *ret, fastly_compute_at_edge_object_store_error_t *err); -bool fastly_compute_at_edge_object_store_pending_delete_wait( +extern bool fastly_compute_at_edge_object_store_pending_delete_wait( fastly_compute_at_edge_object_store_pending_handle_t handle, fastly_compute_at_edge_object_store_error_t *err); -bool fastly_compute_at_edge_object_store_insert( +// Should object store insert return "inserted" bool? +extern bool fastly_compute_at_edge_object_store_insert( fastly_compute_at_edge_object_store_handle_t store, fastly_world_string_t *key, fastly_compute_at_edge_object_store_body_handle_t body_handle, fastly_compute_at_edge_object_store_error_t *err); // Imported Functions from `fastly:compute-at-edge/purge` -bool fastly_compute_at_edge_purge_surrogate_key( +// * +// * A surrogate key can be a max of 1024 characters. +// * A surrogate key must contain only printable ASCII characters (those between `0x21` and +// `0x7E`, inclusive). +// */ +extern bool fastly_compute_at_edge_purge_surrogate_key( fastly_world_string_t *surrogate_keys, fastly_compute_at_edge_purge_options_mask_t purge_options, fastly_world_option_string_t *ret, fastly_compute_at_edge_purge_error_t *err); // Imported Functions from `fastly:compute-at-edge/secret-store` -bool fastly_compute_at_edge_secret_store_open( - fastly_world_string_t *name, fastly_compute_at_edge_secret_store_store_handle_t *ret, - fastly_compute_at_edge_secret_store_error_t *err); -bool fastly_compute_at_edge_secret_store_get( +extern bool +fastly_compute_at_edge_secret_store_open(fastly_world_string_t *name, + fastly_compute_at_edge_secret_store_store_handle_t *ret, + fastly_compute_at_edge_secret_store_error_t *err); +extern bool fastly_compute_at_edge_secret_store_get( fastly_compute_at_edge_secret_store_store_handle_t store, fastly_world_string_t *key, - fastly_world_option_fastly_compute_at_edge_secret_store_secret_handle_t *ret, - fastly_compute_at_edge_secret_store_error_t *err); + fastly_world_option_secret_handle_t *ret, fastly_compute_at_edge_secret_store_error_t *err); bool fastly_compute_at_edge_secret_store_plaintext( - fastly_compute_at_edge_secret_store_secret_handle_t secret, fastly_world_option_string_t *ret, + fastly_compute_at_edge_secret_store_secret_handle_t secret, fastly_world_option_list_u8_t *ret, fastly_compute_at_edge_secret_store_error_t *err); -bool fastly_compute_at_edge_secret_store_from_bytes( - fastly_world_string_t *bytes, fastly_compute_at_edge_secret_store_secret_handle_t *ret, +extern bool fastly_compute_at_edge_secret_store_from_bytes( + fastly_world_list_u8_t *bytes, fastly_compute_at_edge_secret_store_secret_handle_t *ret, fastly_compute_at_edge_secret_store_error_t *err); // Imported Functions from `fastly:compute-at-edge/uap` -bool fastly_compute_at_edge_uap_parse(fastly_world_string_t *user_agent, - fastly_compute_at_edge_uap_user_agent_t *ret, - fastly_compute_at_edge_uap_error_t *err); +extern bool fastly_compute_at_edge_uap_parse(fastly_world_string_t *user_agent, + fastly_compute_at_edge_uap_user_agent_t *ret, + fastly_compute_at_edge_uap_error_t *err); // Exported Functions from `fastly:compute-at-edge/reactor` -bool exports_fastly_compute_at_edge_reactor_serve(fastly_compute_at_edge_reactor_request_t *req); +bool exports_fastly_compute_at_edge_reactor_serve( + exports_fastly_compute_at_edge_reactor_request_t *req); #ifdef __cplusplus } diff --git a/runtime/fastly/host-api/component/fastly_world_adapter.cpp b/runtime/fastly/host-api/component/fastly_world_adapter.cpp index ed045d1a59..9111ee3b28 100644 --- a/runtime/fastly/host-api/component/fastly_world_adapter.cpp +++ b/runtime/fastly/host-api/component/fastly_world_adapter.cpp @@ -129,14 +129,16 @@ bool fastly_compute_at_edge_http_body_close(fastly_compute_at_edge_http_types_bo bool fastly_compute_at_edge_log_endpoint_get(fastly_world_string_t *name, fastly_compute_at_edge_log_handle_t *ret, fastly_compute_at_edge_types_error_t *err) { - return convert_result(fastly::log_endpoint_get(name->ptr, name->len, ret), err); + return convert_result( + fastly::log_endpoint_get(reinterpret_cast(name->ptr), name->len, ret), err); } bool fastly_compute_at_edge_log_write(fastly_compute_at_edge_log_handle_t h, fastly_world_string_t *msg, fastly_compute_at_edge_types_error_t *err) { size_t nwritten = 0; - return convert_result(fastly::log_write(h, msg->ptr, msg->len, &nwritten), err); + return convert_result( + fastly::log_write(h, reinterpret_cast(msg->ptr), msg->len, &nwritten), err); } bool fastly_http_req_body_downstream_get(fastly_compute_at_edge_http_types_request_t *ret, @@ -146,7 +148,9 @@ bool fastly_http_req_body_downstream_get(fastly_compute_at_edge_http_types_reque bool fastly_compute_at_edge_http_req_redirect_to_grip_proxy( fastly_world_string_t *backend, fastly_compute_at_edge_types_error_t *err) { - return convert_result(fastly::req_redirect_to_grip_proxy(backend->ptr, backend->len), err); + return convert_result( + fastly::req_redirect_to_grip_proxy(reinterpret_cast(backend->ptr), backend->len), + err); } int convert_tag(fastly_compute_at_edge_http_req_cache_override_tag_t tag) { @@ -181,8 +185,8 @@ bool fastly_compute_at_edge_http_req_cache_override_set( return convert_result( fastly::req_cache_override_v2_set( h, convert_tag(tag), maybe_ttl == NULL ? 0 : *maybe_ttl, - maybe_stale_while_revalidate == NULL ? 0 : *maybe_stale_while_revalidate, sk_str.ptr, - sk_str.len), + maybe_stale_while_revalidate == NULL ? 0 : *maybe_stale_while_revalidate, + reinterpret_cast(sk_str.ptr), sk_str.len), err); } @@ -202,11 +206,13 @@ bool fastly_compute_at_edge_http_req_downstream_client_ip_addr( bool fastly_compute_at_edge_http_req_downstream_tls_cipher_openssl_name( fastly_world_string_t *ret, fastly_compute_at_edge_types_error_t *err) { auto default_size = 128; - ret->ptr = static_cast(cabi_malloc(default_size, 4)); - auto status = fastly::req_downstream_tls_cipher_openssl_name(ret->ptr, default_size, &ret->len); + ret->ptr = static_cast(cabi_malloc(default_size, 4)); + auto status = fastly::req_downstream_tls_cipher_openssl_name(reinterpret_cast(ret->ptr), + default_size, &ret->len); if (status == FASTLY_COMPUTE_AT_EDGE_TYPES_ERROR_BUFFER_LEN) { cabi_realloc(ret->ptr, default_size, 4, ret->len); - status = fastly::req_downstream_tls_cipher_openssl_name(ret->ptr, ret->len, &ret->len); + status = fastly::req_downstream_tls_cipher_openssl_name(reinterpret_cast(ret->ptr), + ret->len, &ret->len); } return convert_result(status, err); } @@ -214,11 +220,13 @@ bool fastly_compute_at_edge_http_req_downstream_tls_cipher_openssl_name( bool fastly_compute_at_edge_http_req_downstream_tls_protocol( fastly_world_string_t *ret, fastly_compute_at_edge_types_error_t *err) { auto default_size = 32; - ret->ptr = static_cast(cabi_malloc(default_size, 4)); - auto status = fastly::req_downstream_tls_protocol(ret->ptr, default_size, &ret->len); + ret->ptr = static_cast(cabi_malloc(default_size, 4)); + auto status = fastly::req_downstream_tls_protocol(reinterpret_cast(ret->ptr), + default_size, &ret->len); if (status == FASTLY_COMPUTE_AT_EDGE_TYPES_ERROR_BUFFER_LEN) { cabi_realloc(ret->ptr, default_size, 4, ret->len); - status = fastly::req_downstream_tls_protocol(ret->ptr, ret->len, &ret->len); + status = fastly::req_downstream_tls_protocol(reinterpret_cast(ret->ptr), ret->len, + &ret->len); } return convert_result(status, err); } @@ -320,7 +328,7 @@ bool fastly_compute_at_edge_http_req_header_names_get( auto *next = ret->ptr; for (auto &chunk : header_names) { next->len = chunk.length; - next->ptr = chunk.buffer.release(); + next->ptr = reinterpret_cast(chunk.buffer.release()); ++next; } @@ -339,8 +347,9 @@ bool fastly_compute_at_edge_http_req_header_values_get( while (true) { int64_t ending_cursor = 0; size_t length = 0; - auto res = fastly::req_header_values_get(h, name->ptr, name->len, buffer.get(), - HEADER_MAX_LEN, cursor, &ending_cursor, &length); + auto res = fastly::req_header_values_get(h, reinterpret_cast(name->ptr), name->len, + buffer.get(), HEADER_MAX_LEN, cursor, &ending_cursor, + &length); if (!convert_result(res, err)) { return false; } @@ -394,52 +403,60 @@ bool fastly_compute_at_edge_http_req_framing_headers_mode_set( bool fastly_compute_at_edge_http_req_header_insert( fastly_compute_at_edge_http_types_request_handle_t h, fastly_world_string_t *name, fastly_world_list_u8_t *value, fastly_compute_at_edge_types_error_t *err) { - return convert_result(fastly::req_header_insert(h, name->ptr, name->len, value->ptr, value->len), + return convert_result(fastly::req_header_insert(h, reinterpret_cast(name->ptr), name->len, + value->ptr, value->len), err); } bool fastly_compute_at_edge_http_req_header_append( fastly_compute_at_edge_http_types_request_handle_t h, fastly_world_string_t *name, fastly_world_list_u8_t *value, fastly_compute_at_edge_types_error_t *err) { - return convert_result(fastly::req_header_append(h, name->ptr, name->len, value->ptr, value->len), + return convert_result(fastly::req_header_append(h, reinterpret_cast(name->ptr), name->len, + value->ptr, value->len), err); } bool fastly_compute_at_edge_http_req_header_remove( fastly_compute_at_edge_http_types_request_handle_t h, fastly_world_string_t *name, fastly_compute_at_edge_types_error_t *err) { - return convert_result(fastly::req_header_remove(h, name->ptr, name->len), err); + return convert_result( + fastly::req_header_remove(h, reinterpret_cast(name->ptr), name->len), err); } bool fastly_compute_at_edge_http_req_method_get( fastly_compute_at_edge_http_types_request_handle_t h, fastly_world_string_t *ret, fastly_compute_at_edge_types_error_t *err) { - ret->ptr = static_cast(cabi_malloc(METHOD_MAX_LEN, 1)); - return convert_result(fastly::req_method_get(h, ret->ptr, METHOD_MAX_LEN, &ret->len), err); + ret->ptr = static_cast(cabi_malloc(METHOD_MAX_LEN, 1)); + return convert_result( + fastly::req_method_get(h, reinterpret_cast(ret->ptr), METHOD_MAX_LEN, &ret->len), + err); } bool fastly_compute_at_edge_http_req_method_set( fastly_compute_at_edge_http_types_request_handle_t h, fastly_world_string_t *method, fastly_compute_at_edge_types_error_t *err) { - return convert_result(fastly::req_method_set(h, method->ptr, method->len), err); + return convert_result( + fastly::req_method_set(h, reinterpret_cast(method->ptr), method->len), err); } bool fastly_compute_at_edge_http_req_uri_get(fastly_compute_at_edge_http_types_request_handle_t h, fastly_world_string_t *ret, fastly_compute_at_edge_types_error_t *err) { - ret->ptr = static_cast(cabi_malloc(URI_MAX_LEN, 1)); - if (!convert_result(fastly::req_uri_get(h, ret->ptr, URI_MAX_LEN, &ret->len), err)) { + ret->ptr = static_cast(cabi_malloc(URI_MAX_LEN, 1)); + if (!convert_result( + fastly::req_uri_get(h, reinterpret_cast(ret->ptr), URI_MAX_LEN, &ret->len), + err)) { cabi_free(ret->ptr); return false; } - ret->ptr = static_cast(cabi_realloc(ret->ptr, URI_MAX_LEN, 1, ret->len)); + ret->ptr = static_cast(cabi_realloc(ret->ptr, URI_MAX_LEN, 1, ret->len)); return true; } bool fastly_compute_at_edge_http_req_uri_set(fastly_compute_at_edge_http_types_request_handle_t h, fastly_world_string_t *uri, fastly_compute_at_edge_types_error_t *err) { - return convert_result(fastly::req_uri_set(h, uri->ptr, uri->len), err); + return convert_result(fastly::req_uri_set(h, reinterpret_cast(uri->ptr), uri->len), err); } bool fastly_compute_at_edge_http_req_version_get( @@ -459,7 +476,8 @@ bool fastly_compute_at_edge_http_req_send_async( fastly_compute_at_edge_http_types_body_handle_t b, fastly_world_string_t *backend, fastly_compute_at_edge_http_types_pending_request_handle_t *ret, fastly_compute_at_edge_types_error_t *err) { - return convert_result(fastly::req_send_async(h, b, backend->ptr, backend->len, ret), err); + return convert_result( + fastly::req_send_async(h, b, reinterpret_cast(backend->ptr), backend->len, ret), err); } bool fastly_compute_at_edge_http_req_send_async_streaming( @@ -467,7 +485,8 @@ bool fastly_compute_at_edge_http_req_send_async_streaming( fastly_compute_at_edge_http_types_body_handle_t b, fastly_world_string_t *backend, fastly_compute_at_edge_http_types_pending_request_handle_t *ret, fastly_compute_at_edge_types_error_t *err) { - return convert_result(fastly::req_send_async_streaming(h, b, backend->ptr, backend->len, ret), + return convert_result(fastly::req_send_async_streaming( + h, b, reinterpret_cast(backend->ptr), backend->len, ret), err); } @@ -532,27 +551,33 @@ bool fastly_compute_at_edge_http_req_register_dynamic_backend( if (config->sni_hostname.is_some) { backend_config_mask |= BACKEND_CONFIG_SNI_HOSTNAME; } + if (config->client_cert.is_some) { + backend_config_mask |= BACKEND_CONFIG_CLIENT_CERT; + } fastly::DynamicBackendConfig backend_configuration{ - .host_override = config->host_override.val.ptr, + .host_override = reinterpret_cast(config->host_override.val.ptr), .host_override_len = config->host_override.val.len, .connect_timeout_ms = config->connect_timeout.val, .first_byte_timeout_ms = config->first_byte_timeout.val, .between_bytes_timeout_ms = config->between_bytes_timeout.val, .ssl_min_version = config->ssl_min_version.val, .ssl_max_version = config->ssl_max_version.val, - .cert_hostname = config->cert_hostname.val.ptr, + .cert_hostname = reinterpret_cast(config->cert_hostname.val.ptr), .cert_hostname_len = config->cert_hostname.val.len, - .ca_cert = config->ca_cert.val.ptr, + .ca_cert = reinterpret_cast(config->ca_cert.val.ptr), .ca_cert_len = config->ca_cert.val.len, - .ciphers = config->ciphers.val.ptr, + .ciphers = reinterpret_cast(config->ciphers.val.ptr), .ciphers_len = config->ciphers.val.len, - .sni_hostname = config->sni_hostname.val.ptr, + .sni_hostname = reinterpret_cast(config->sni_hostname.val.ptr), .sni_hostname_len = config->sni_hostname.val.len, - }; - return convert_result(fastly::req_register_dynamic_backend(prefix->ptr, prefix->len, target->ptr, - target->len, backend_config_mask, - &backend_configuration), - err); + .client_certificate = reinterpret_cast(config->client_cert.val.client_cert.ptr), + .client_certificate_len = config->client_cert.val.client_cert.len, + .client_key = config->client_cert.val.client_key}; + return convert_result( + fastly::req_register_dynamic_backend(reinterpret_cast(prefix->ptr), prefix->len, + reinterpret_cast(target->ptr), target->len, + backend_config_mask, &backend_configuration), + err); } bool fastly_compute_at_edge_http_resp_new(fastly_compute_at_edge_http_types_response_handle_t *ret, @@ -591,7 +616,7 @@ bool fastly_compute_at_edge_http_resp_header_names_get( (str_max + LIST_ALLOC_SIZE) * sizeof(fastly_world_string_t))); str_max += LIST_ALLOC_SIZE; } - strs[str_cnt].ptr = static_cast(cabi_malloc(i - offset + 1, 1)); + strs[str_cnt].ptr = static_cast(cabi_malloc(i - offset + 1, 1)); strs[str_cnt].len = i - offset; memcpy(strs[str_cnt].ptr, buf + offset, i - offset + 1); offset = i + 1; @@ -623,8 +648,9 @@ bool fastly_compute_at_edge_http_resp_header_values_get( uint32_t cursor = 0; int64_t next_cursor = 0; while (true) { - if (!convert_result(fastly::resp_header_values_get(h, name->ptr, name->len, buf, HEADER_MAX_LEN, - cursor, &next_cursor, &nwritten), + if (!convert_result(fastly::resp_header_values_get(h, reinterpret_cast(name->ptr), + name->len, buf, HEADER_MAX_LEN, cursor, + &next_cursor, &nwritten), err)) { cabi_free(buf); return false; @@ -669,21 +695,24 @@ bool fastly_compute_at_edge_http_resp_header_values_get( bool fastly_compute_at_edge_http_resp_header_insert( fastly_compute_at_edge_http_types_response_handle_t h, fastly_world_string_t *name, fastly_world_list_u8_t *value, fastly_compute_at_edge_types_error_t *err) { - return convert_result(fastly::resp_header_insert(h, name->ptr, name->len, value->ptr, value->len), + return convert_result(fastly::resp_header_insert(h, reinterpret_cast(name->ptr), + name->len, value->ptr, value->len), err); } bool fastly_compute_at_edge_http_resp_header_append( fastly_compute_at_edge_http_types_response_handle_t h, fastly_world_string_t *name, fastly_world_list_u8_t *value, fastly_compute_at_edge_types_error_t *err) { - return convert_result(fastly::resp_header_append(h, name->ptr, name->len, value->ptr, value->len), + return convert_result(fastly::resp_header_append(h, reinterpret_cast(name->ptr), + name->len, value->ptr, value->len), err); } bool fastly_compute_at_edge_http_resp_header_remove( fastly_compute_at_edge_http_types_response_handle_t h, fastly_world_string_t *name, fastly_compute_at_edge_types_error_t *err) { - return convert_result(fastly::resp_header_remove(h, name->ptr, name->len), err); + return convert_result( + fastly::resp_header_remove(h, reinterpret_cast(name->ptr), name->len), err); } bool fastly_compute_at_edge_http_resp_version_get( @@ -729,15 +758,17 @@ bool fastly_compute_at_edge_http_resp_status_set( bool fastly_compute_at_edge_dictionary_open(fastly_world_string_t *name, fastly_compute_at_edge_dictionary_handle_t *ret, fastly_compute_at_edge_types_error_t *err) { - return convert_result(fastly::dictionary_open(name->ptr, name->len, ret), err); + return convert_result( + fastly::dictionary_open(reinterpret_cast(name->ptr), name->len, ret), err); } bool fastly_compute_at_edge_dictionary_get(fastly_compute_at_edge_dictionary_handle_t h, fastly_world_string_t *key, fastly_world_option_string_t *ret, fastly_compute_at_edge_types_error_t *err) { - ret->val.ptr = static_cast(cabi_malloc(DICTIONARY_ENTRY_MAX_LEN, 1)); - if (!convert_result(fastly::dictionary_get(h, key->ptr, key->len, ret->val.ptr, + ret->val.ptr = static_cast(cabi_malloc(DICTIONARY_ENTRY_MAX_LEN, 1)); + if (!convert_result(fastly::dictionary_get(h, reinterpret_cast(key->ptr), key->len, + reinterpret_cast(ret->val.ptr), DICTIONARY_ENTRY_MAX_LEN, &ret->val.len), err)) { if (*err == FASTLY_COMPUTE_AT_EDGE_TYPES_ERROR_OPTIONAL_NONE) { @@ -750,22 +781,24 @@ bool fastly_compute_at_edge_dictionary_get(fastly_compute_at_edge_dictionary_han } ret->is_some = true; ret->val.ptr = - static_cast(cabi_realloc(ret->val.ptr, DICTIONARY_ENTRY_MAX_LEN, 1, ret->val.len)); + static_cast(cabi_realloc(ret->val.ptr, DICTIONARY_ENTRY_MAX_LEN, 1, ret->val.len)); return true; } bool fastly_compute_at_edge_secret_store_open( fastly_world_string_t *name, fastly_compute_at_edge_secret_store_store_handle_t *ret, fastly_compute_at_edge_types_error_t *err) { - return convert_result(fastly::secret_store_open(name->ptr, name->len, ret), err); + return convert_result( + fastly::secret_store_open(reinterpret_cast(name->ptr), name->len, ret), err); } bool fastly_compute_at_edge_secret_store_get( fastly_compute_at_edge_secret_store_store_handle_t store, fastly_world_string_t *key, - fastly_world_option_fastly_compute_at_edge_secret_store_secret_handle_t *ret, - fastly_compute_at_edge_types_error_t *err) { + fastly_world_option_secret_handle_t *ret, fastly_compute_at_edge_types_error_t *err) { ret->val = INVALID_HANDLE; - bool ok = convert_result(fastly::secret_store_get(store, key->ptr, key->len, &ret->val), err); + bool ok = convert_result( + fastly::secret_store_get(store, reinterpret_cast(key->ptr), key->len, &ret->val), + err); if ((!ok && *err == FASTLY_COMPUTE_AT_EDGE_TYPES_ERROR_OPTIONAL_NONE) || ret->val == INVALID_HANDLE) { ret->is_some = false; @@ -776,12 +809,12 @@ bool fastly_compute_at_edge_secret_store_get( } bool fastly_compute_at_edge_secret_store_plaintext( - fastly_compute_at_edge_secret_store_secret_handle_t h, fastly_world_option_string_t *ret, - fastly_compute_at_edge_types_error_t *err) { - ret->val.ptr = static_cast(JS_malloc(CONTEXT, DICTIONARY_ENTRY_MAX_LEN)); - if (!convert_result( - fastly::secret_store_plaintext(h, ret->val.ptr, DICTIONARY_ENTRY_MAX_LEN, &ret->val.len), - err)) { + fastly_compute_at_edge_secret_store_secret_handle_t h, fastly_world_option_list_u8_t *ret, + fastly_compute_at_edge_secret_store_error_t *err) { + ret->val.ptr = static_cast(JS_malloc(CONTEXT, DICTIONARY_ENTRY_MAX_LEN)); + if (!convert_result(fastly::secret_store_plaintext(h, reinterpret_cast(ret->val.ptr), + DICTIONARY_ENTRY_MAX_LEN, &ret->val.len), + err)) { if (*err == FASTLY_COMPUTE_AT_EDGE_TYPES_ERROR_OPTIONAL_NONE) { ret->is_some = false; return true; @@ -791,37 +824,53 @@ bool fastly_compute_at_edge_secret_store_plaintext( } } ret->is_some = true; - ret->val.ptr = static_cast( + ret->val.ptr = static_cast( JS_realloc(CONTEXT, ret->val.ptr, DICTIONARY_ENTRY_MAX_LEN, ret->val.len)); return true; } +bool fastly_compute_at_edge_secret_store_from_bytes( + fastly_world_list_u8_t *bytes, fastly_compute_at_edge_secret_store_secret_handle_t *ret, + fastly_compute_at_edge_secret_store_error_t *err) { + *ret = INVALID_HANDLE; + bool ok = convert_result( + fastly::secret_store_from_bytes(reinterpret_cast(bytes->ptr), bytes->len, ret), err); + if (!ok || *ret == INVALID_HANDLE) { + return false; + } + return true; +} + bool fastly_compute_at_edge_geo_lookup(fastly_world_list_u8_t *addr_octets, fastly_world_string_t *ret, fastly_compute_at_edge_types_error_t *err) { - ret->ptr = static_cast(cabi_malloc(HOSTCALL_BUFFER_LEN, 1)); - if (!convert_result(fastly::geo_lookup(addr_octets->ptr, addr_octets->len, ret->ptr, - HOSTCALL_BUFFER_LEN, &ret->len), + ret->ptr = static_cast(cabi_malloc(HOSTCALL_BUFFER_LEN, 1)); + if (!convert_result(fastly::geo_lookup(addr_octets->ptr, addr_octets->len, + reinterpret_cast(ret->ptr), HOSTCALL_BUFFER_LEN, + &ret->len), err)) { cabi_free(ret->ptr); return false; } - ret->ptr = static_cast(cabi_realloc(ret->ptr, HOSTCALL_BUFFER_LEN, 1, ret->len)); + ret->ptr = static_cast(cabi_realloc(ret->ptr, HOSTCALL_BUFFER_LEN, 1, ret->len)); return true; } bool fastly_compute_at_edge_object_store_open(fastly_world_string_t *name, fastly_compute_at_edge_object_store_handle_t *ret, fastly_compute_at_edge_types_error_t *err) { - return convert_result(fastly::object_store_open(name->ptr, name->len, ret), err); + return convert_result( + fastly::object_store_open(reinterpret_cast(name->ptr), name->len, ret), err); } -bool fastly_compute_at_edge_object_store_lookup( - fastly_compute_at_edge_object_store_handle_t store, fastly_world_string_t *key, - fastly_world_option_fastly_compute_at_edge_object_store_body_handle_t *ret, - fastly_compute_at_edge_types_error_t *err) { +bool fastly_compute_at_edge_object_store_lookup(fastly_compute_at_edge_object_store_handle_t store, + fastly_world_string_t *key, + fastly_world_option_body_handle_t *ret, + fastly_compute_at_edge_types_error_t *err) { ret->val = INVALID_HANDLE; - bool ok = convert_result(fastly::object_store_get(store, key->ptr, key->len, &ret->val), err); + bool ok = convert_result( + fastly::object_store_get(store, reinterpret_cast(key->ptr), key->len, &ret->val), + err); if ((!ok && *err == FASTLY_COMPUTE_AT_EDGE_TYPES_ERROR_OPTIONAL_NONE) || ret->val == INVALID_HANDLE) { ret->is_some = false; @@ -835,12 +884,13 @@ bool fastly_compute_at_edge_object_store_lookup_async( fastly_compute_at_edge_object_store_handle_t store, fastly_world_string_t *key, fastly_compute_at_edge_object_store_pending_handle_t *ret, fastly_compute_at_edge_object_store_error_t *err) { - return convert_result(fastly::object_store_get_async(store, key->ptr, key->len, ret), err); + return convert_result( + fastly::object_store_get_async(store, reinterpret_cast(key->ptr), key->len, ret), + err); } bool fastly_compute_at_edge_object_store_pending_lookup_wait( - fastly_compute_at_edge_object_store_pending_handle_t h, - fastly_world_option_fastly_compute_at_edge_object_store_body_handle_t *ret, + fastly_compute_at_edge_object_store_pending_handle_t h, fastly_world_option_body_handle_t *ret, fastly_compute_at_edge_object_store_error_t *err) { ret->val = INVALID_HANDLE; bool ok = convert_result(fastly::object_store_pending_lookup_wait(h, &ret->val), err); @@ -857,7 +907,9 @@ bool fastly_compute_at_edge_object_store_delete_async( fastly_compute_at_edge_object_store_handle_t store, fastly_world_string_t *key, fastly_compute_at_edge_object_store_pending_handle_t *ret, fastly_compute_at_edge_object_store_error_t *err) { - return convert_result(fastly::object_store_delete_async(store, key->ptr, key->len, ret), err); + return convert_result( + fastly::object_store_delete_async(store, reinterpret_cast(key->ptr), key->len, ret), + err); } bool fastly_compute_at_edge_object_store_pending_delete_wait( @@ -870,12 +922,14 @@ bool fastly_compute_at_edge_object_store_insert( fastly_compute_at_edge_object_store_handle_t store, fastly_world_string_t *key, fastly_compute_at_edge_http_types_body_handle_t body_handle, fastly_compute_at_edge_types_error_t *err) { - return convert_result(fastly::object_store_insert(store, key->ptr, key->len, body_handle), err); + return convert_result( + fastly::object_store_insert(store, reinterpret_cast(key->ptr), key->len, body_handle), + err); } -bool fastly_compute_at_edge_async_io_select( - fastly_world_list_fastly_compute_at_edge_async_io_handle_t *hs, uint32_t timeout_ms, - fastly_world_option_u32_t *ret, fastly_compute_at_edge_types_error_t *err) { +bool fastly_compute_at_edge_async_io_select(fastly_world_list_handle_t *hs, uint32_t timeout_ms, + fastly_world_option_u32_t *ret, + fastly_compute_at_edge_types_error_t *err) { if (!convert_result(fastly::async_select(hs->ptr, hs->len, timeout_ms, &ret->val), err)) { if (*err == FASTLY_COMPUTE_AT_EDGE_TYPES_ERROR_OPTIONAL_NONE) { ret->is_some = false; @@ -914,9 +968,9 @@ bool fastly_compute_at_edge_purge_surrogate_key( ret->is_some = false; - return convert_result( - fastly::purge_surrogate_key(surrogate_key->ptr, surrogate_key->len, options_mask, &options), - err); + return convert_result(fastly::purge_surrogate_key(reinterpret_cast(surrogate_key->ptr), + surrogate_key->len, options_mask, &options), + err); } #define FASTLY_CACHE_LOOKUP_OPTIONS_MASK_RESERVED (1 << 0) @@ -930,8 +984,9 @@ bool fastly_compute_at_edge_cache_lookup(fastly_world_string_t *cache_key, if (options->request_headers.is_some) { options_mask |= FASTLY_CACHE_LOOKUP_OPTIONS_MASK_REQUEST_HEADERS; } - return convert_result( - fastly::cache_lookup(cache_key->ptr, cache_key->len, options_mask, options, ret), err); + return convert_result(fastly::cache_lookup(reinterpret_cast(cache_key->ptr), + cache_key->len, options_mask, options, ret), + err); } #define FASTLY_CACHE_WRITE_OPTIONS_MASK_RESERVED (1 << 0) @@ -987,8 +1042,9 @@ bool fastly_compute_at_edge_cache_insert(fastly_world_string_t *cache_key, if (options->sensitive_data) { options_mask |= FASTLY_CACHE_WRITE_OPTIONS_MASK_SENSITIVE_DATA; } - return convert_result( - fastly::cache_insert(cache_key->ptr, cache_key->len, options_mask, &opts, ret), err); + return convert_result(fastly::cache_insert(reinterpret_cast(cache_key->ptr), + cache_key->len, options_mask, &opts, ret), + err); } bool fastly_compute_at_edge_cache_transaction_insert( @@ -1102,16 +1158,15 @@ bool fastly_compute_at_edge_cache_transaction_lookup( if (options->request_headers.is_some) { options_mask |= FASTLY_CACHE_LOOKUP_OPTIONS_MASK_REQUEST_HEADERS; } - return convert_result( - fastly::cache_transaction_lookup(cache_key->ptr, cache_key->len, options_mask, options, ret), - err); + return convert_result(fastly::cache_transaction_lookup(reinterpret_cast(cache_key->ptr), + cache_key->len, options_mask, options, + ret), + err); } bool fastly_compute_at_edge_cache_transaction_insert_and_stream_back( fastly_compute_at_edge_cache_handle_t handle, fastly_compute_at_edge_cache_write_options_t *options, - fastly_world_tuple2_fastly_compute_at_edge_cache_body_handle_fastly_compute_at_edge_cache_handle_t - *ret, - fastly_compute_at_edge_types_error_t *err) { + fastly_world_tuple2_body_handle_handle_t *ret, fastly_compute_at_edge_types_error_t *err) { uint16_t options_mask = 0; fastly::CacheWriteOptions opts; std::memset(&opts, 0, sizeof(opts)); @@ -1226,7 +1281,9 @@ bool fastly_compute_at_edge_cache_get_hits(fastly_compute_at_edge_cache_handle_t bool fastly_compute_at_edge_backend_exists(fastly_world_string_t *backend, bool *ret, fastly_compute_at_edge_types_error_t *err) { uint32_t ret_int; - if (!convert_result(fastly::backend_exists(backend->ptr, backend->len, &ret_int), err)) { + if (!convert_result( + fastly::backend_exists(reinterpret_cast(backend->ptr), backend->len, &ret_int), + err)) { return false; } *ret = (bool)ret_int; @@ -1252,7 +1309,7 @@ bool fastly_compute_at_edge_backend_is_healthy(fastly_world_string_t *backend, fastly_compute_at_edge_types_error_t *err) { fastly::BACKEND_HEALTH fastly_backend_health; if (!convert_result( - fastly::backend_is_healthy(backend->ptr, backend->len, + fastly::backend_is_healthy(reinterpret_cast(backend->ptr), backend->len, reinterpret_cast(&fastly_backend_health)), err)) { return false; @@ -1265,67 +1322,75 @@ bool fastly_compute_at_edge_edge_rate_limiter_check_rate( fastly_world_string_t *rate_counter_name, fastly_world_string_t *entry, uint32_t delta, uint32_t window, uint32_t limit, fastly_world_string_t *penalty_box_name, uint32_t time_to_live, bool *ret, fastly_compute_at_edge_edge_rate_limiter_error_t *err) { - return convert_result(fastly::check_rate(rate_counter_name->ptr, rate_counter_name->len, - entry->ptr, entry->len, delta, window, limit, - penalty_box_name->ptr, penalty_box_name->len, - time_to_live, ret), - err); + return convert_result( + fastly::check_rate(reinterpret_cast(rate_counter_name->ptr), rate_counter_name->len, + reinterpret_cast(entry->ptr), entry->len, delta, window, limit, + reinterpret_cast(penalty_box_name->ptr), penalty_box_name->len, + time_to_live, ret), + err); } bool fastly_compute_at_edge_edge_rate_limiter_ratecounter_increment( fastly_world_string_t *rate_counter_name, fastly_world_string_t *entry, uint32_t delta, fastly_compute_at_edge_edge_rate_limiter_error_t *err) { - return convert_result(fastly::ratecounter_increment(rate_counter_name->ptr, - rate_counter_name->len, entry->ptr, - entry->len, delta), - err); + return convert_result( + fastly::ratecounter_increment(reinterpret_cast(rate_counter_name->ptr), + rate_counter_name->len, reinterpret_cast(entry->ptr), + entry->len, delta), + err); } bool fastly_compute_at_edge_edge_rate_limiter_ratecounter_lookup_rate( fastly_world_string_t *rate_counter_name, fastly_world_string_t *entry, uint32_t window, uint32_t *ret, fastly_compute_at_edge_edge_rate_limiter_error_t *err) { - return convert_result(fastly::ratecounter_lookup_rate(rate_counter_name->ptr, - rate_counter_name->len, entry->ptr, - entry->len, window, ret), - err); + return convert_result( + fastly::ratecounter_lookup_rate(reinterpret_cast(rate_counter_name->ptr), + rate_counter_name->len, reinterpret_cast(entry->ptr), + entry->len, window, ret), + err); } bool fastly_compute_at_edge_edge_rate_limiter_ratecounter_lookup_count( fastly_world_string_t *rate_counter_name, fastly_world_string_t *entry, uint32_t duration, uint32_t *ret, fastly_compute_at_edge_edge_rate_limiter_error_t *err) { - return convert_result(fastly::ratecounter_lookup_count(rate_counter_name->ptr, - rate_counter_name->len, entry->ptr, - entry->len, duration, ret), - err); + return convert_result( + fastly::ratecounter_lookup_count(reinterpret_cast(rate_counter_name->ptr), + rate_counter_name->len, reinterpret_cast(entry->ptr), + entry->len, duration, ret), + err); } bool fastly_compute_at_edge_edge_rate_limiter_penaltybox_add( fastly_world_string_t *penalty_box_name, fastly_world_string_t *entry, uint32_t time_to_live, fastly_compute_at_edge_edge_rate_limiter_error_t *err) { - return convert_result(fastly::penaltybox_add(penalty_box_name->ptr, penalty_box_name->len, - entry->ptr, entry->len, time_to_live), - err); + return convert_result( + fastly::penaltybox_add(reinterpret_cast(penalty_box_name->ptr), penalty_box_name->len, + reinterpret_cast(entry->ptr), entry->len, time_to_live), + err); } bool fastly_compute_at_edge_edge_rate_limiter_penaltybox_has( fastly_world_string_t *penalty_box_name, fastly_world_string_t *entry, bool *ret, fastly_compute_at_edge_edge_rate_limiter_error_t *err) { - return convert_result(fastly::penaltybox_has(penalty_box_name->ptr, penalty_box_name->len, - entry->ptr, entry->len, ret), - err); + return convert_result( + fastly::penaltybox_has(reinterpret_cast(penalty_box_name->ptr), penalty_box_name->len, + reinterpret_cast(entry->ptr), entry->len, ret), + err); } bool fastly_compute_at_edge_device_detection_lookup( fastly_world_string_t *user_agent, fastly_world_string_t *ret, fastly_compute_at_edge_device_detection_error_t *err) { auto default_size = 1024; - ret->ptr = static_cast(cabi_malloc(default_size, 4)); - auto status = fastly::device_detection_lookup(user_agent->ptr, user_agent->len, ret->ptr, - default_size, &ret->len); + ret->ptr = static_cast(cabi_malloc(default_size, 4)); + auto status = + fastly::device_detection_lookup(reinterpret_cast(user_agent->ptr), user_agent->len, + reinterpret_cast(ret->ptr), default_size, &ret->len); if (status == FASTLY_COMPUTE_AT_EDGE_TYPES_ERROR_BUFFER_LEN) { cabi_realloc(ret->ptr, default_size, 4, ret->len); - status = fastly::device_detection_lookup(user_agent->ptr, user_agent->len, ret->ptr, ret->len, - &ret->len); + status = + fastly::device_detection_lookup(reinterpret_cast(user_agent->ptr), user_agent->len, + reinterpret_cast(ret->ptr), ret->len, &ret->len); } return convert_result(status, err); } \ No newline at end of file diff --git a/runtime/fastly/host-api/component/fastly_world_component_type.o b/runtime/fastly/host-api/component/fastly_world_component_type.o index 2866bde41c..fa524f65e4 100644 Binary files a/runtime/fastly/host-api/component/fastly_world_component_type.o and b/runtime/fastly/host-api/component/fastly_world_component_type.o differ diff --git a/runtime/fastly/host-api/error_numbers.msg b/runtime/fastly/host-api/error_numbers.msg index d4fc4c74a7..07a3a24370 100644 --- a/runtime/fastly/host-api/error_numbers.msg +++ b/runtime/fastly/host-api/error_numbers.msg @@ -76,6 +76,7 @@ MSG_DEF(JSMSG_SECRET_STORE_NAME_CONTAINS_INVALID_CHARACTER, 0, JSEXN_TYPEERR, MSG_DEF(JSMSG_SECRET_STORE_NAME_EMPTY, 0, JSEXN_TYPEERR, "SecretStore constructor: name can not be an empty string") MSG_DEF(JSMSG_SECRET_STORE_NAME_START_WITH_ASCII_ALPHA, 0, JSEXN_TYPEERR, "SecretStore constructor: name must start with an ascii alpabetical character") MSG_DEF(JSMSG_SECRET_STORE_NAME_TOO_LONG, 0, JSEXN_TYPEERR, "SecretStore constructor: name can not be more than 255 characters") +MSG_DEF(JSMSG_SECRET_STORE_FROM_BYTES_INVALID_BUFFER, 0, JSEXN_TYPEERR, "SecretStore.fromBytes: bytes must be an ArrayBuffer or ArrayBufferView object") MSG_DEF(JSMSG_READABLE_STREAM_LOCKED_OR_DISTRUBED, 0, JSEXN_TYPEERR, "Can't use a ReadableStream that's locked or has ever been read from or canceled") MSG_DEF(JSMSG_INVALID_CHARACTER_ERROR, 0, JSEXN_ERR, "String contains an invalid character") MSG_DEF(JSMSG_BACKEND_FROMNAME_BACKEND_DOES_NOT_EXIST, 1, JSEXN_ERR, "Backend.fromName: backend named '{0}' does not exist") @@ -99,6 +100,10 @@ MSG_DEF(JSMSG_BACKEND_TLS_MIN_INVALID, 0, JSEXN_RANGEERR MSG_DEF(JSMSG_BACKEND_TLS_MAX_INVALID, 0, JSEXN_RANGEERR, "Backend constructor: tlsMaxVersion must be either 1, 1.1, 1.2, or 1.3") MSG_DEF(JSMSG_BACKEND_TLS_MIN_GREATER_THAN_TLS_MAX, 0, JSEXN_RANGEERR, "Backend constructor: tlsMinVersion must be less than or equal to tlsMaxVersion") MSG_DEF(JSMSG_BACKEND_PORT_INVALID, 0, JSEXN_RANGEERR, "Backend constructor: port must be more than 0 and less than 2^16 (65,536)") +MSG_DEF(JSMSG_BACKEND_CLIENT_CERTIFICATE_NOT_OBJECT, 0, JSEXN_TYPEERR, "Backend constructor: clientCertificate must be an object containing 'certificate' and 'key' properties") +MSG_DEF(JSMSG_BACKEND_CLIENT_CERTIFICATE_NO_CERTIFICATE, 0, JSEXN_TYPEERR, "Backend constructor: clientCertificate 'certificate' must be a certificate string") +MSG_DEF(JSMSG_BACKEND_CLIENT_CERTIFICATE_CERTIFICATE_EMPTY, 0, JSEXN_TYPEERR, "Backend constructor: clientCertificate 'certificate' can not be an empty string") +MSG_DEF(JSMSG_BACKEND_CLIENT_CERTIFICATE_KEY_INVALID, 0, JSEXN_TYPEERR, "Backend constructor: clientCertificate 'key' must be a SecretStoreEntry instance") MSG_DEF(JSMSG_CACHE_OVERRIDE_MODE_INVALID, 1, JSEXN_TYPEERR, "CacheOverride constructor: 'mode' has to be \"none\", \"pass\", or \"override\", but got \"{0}\"") MSG_DEF(JSMSG_RESPONSE_VALUE_NOT_UINT8ARRAY, 0, JSEXN_TYPEERR, "Can't convert value to Uint8Array while consuming Body") MSG_DEF(JSMSG_RESPONSE_BODY_DISTURBED_OR_LOCKED, 0, JSEXN_TYPEERR, "Response body object should not be disturbed or locked") diff --git a/runtime/fastly/host-api/fastly.h b/runtime/fastly/host-api/fastly.h index 34a4a9ddea..90b19c7688 100644 --- a/runtime/fastly/host-api/fastly.h +++ b/runtime/fastly/host-api/fastly.h @@ -66,6 +66,9 @@ typedef struct DynamicBackendConfig { uint32_t ciphers_len; const char *sni_hostname; uint32_t sni_hostname_len; + const char *client_certificate; + uint32_t client_certificate_len; + fastly_compute_at_edge_secret_store_secret_handle_t client_key; } DynamicBackendConfig; #define INVALID_HANDLE (UINT32_MAX - 1) @@ -363,6 +366,11 @@ WASM_IMPORT("fastly_secret_store", "plaintext") int secret_store_plaintext(fastly_compute_at_edge_secret_store_secret_handle_t secret_handle, char *buf, size_t buf_len, size_t *nwritten); +WASM_IMPORT("fastly_secret_store", "from_bytes") +int secret_store_from_bytes( + char *buf, size_t buf_len, + fastly_compute_at_edge_secret_store_secret_handle_t *opt_secret_handle_out); + // Module fastly_object_store WASM_IMPORT("fastly_object_store", "open") int object_store_open(const char *name, size_t name_len, diff --git a/runtime/fastly/host-api/host_api.cpp b/runtime/fastly/host-api/host_api.cpp index ac5709da9e..a40594a686 100644 --- a/runtime/fastly/host-api/host_api.cpp +++ b/runtime/fastly/host-api/host_api.cpp @@ -21,7 +21,7 @@ size_t api::AsyncTask::select(std::vector *tasks) { for (int i = 0; i < tasks_len; i++) { handles[i] = tasks->at(i)->id(); } - fastly_world_list_fastly_compute_at_edge_async_io_handle_t hs{.ptr = handles, .len = tasks_len}; + fastly_world_list_handle_t hs{.ptr = handles, .len = tasks_len}; fastly_world_option_u32_t ret; fastly_compute_at_edge_types_error_t err = 0; if (!fastly_compute_at_edge_async_io_select(&hs, 0, &ret, &err)) { @@ -46,7 +46,7 @@ fastly_world_list_u8_t span_to_list_u8(std::span span) { fastly_world_string_t string_view_to_world_string(std::string_view str) { return { - .ptr = const_cast(str.data()), + .ptr = const_cast(reinterpret_cast(str.data())), .len = str.size(), }; } @@ -493,7 +493,7 @@ Result> HttpPendingReq::poll() { Result> res; fastly_compute_at_edge_types_error_t err; - fastly_world_option_fastly_compute_at_edge_http_req_response_t ret; + fastly_world_option_response_t ret; if (!fastly_compute_at_edge_http_req_pending_req_poll(this->handle, &ret, &err)) { res.emplace_err(err); } else if (ret.is_some) { @@ -679,6 +679,12 @@ Result HttpReq::register_dynamic_backend(std::string_view name, std::strin backend_config.sni_hostname.val = string_view_to_world_string(*val); } + if (auto &val = config.client_cert) { + backend_config.client_cert.is_some = true; + backend_config.client_cert.val.client_cert = string_view_to_world_string(val->cert); + backend_config.client_cert.val.client_key = val->key; + } + auto name_str = string_view_to_world_string(name); auto target_str = string_view_to_world_string(target); fastly_compute_at_edge_types_error_t err; @@ -1189,7 +1195,7 @@ Result> ObjectStore::lookup(std::string_view name) { Result> res; auto name_str = string_view_to_world_string(name); - fastly_world_option_fastly_compute_at_edge_object_store_body_handle_t ret; + fastly_world_option_body_handle_t ret; fastly_compute_at_edge_types_error_t err; if (!fastly_compute_at_edge_object_store_lookup(this->handle, &name_str, &ret, &err)) { res.emplace_err(err); @@ -1250,7 +1256,7 @@ FastlyResult, FastlyAPIError> ObjectStorePendingLookup:: FastlyResult, FastlyAPIError> res; fastly_compute_at_edge_types_error_t err; - fastly_world_option_fastly_compute_at_edge_object_store_body_handle_t ret; + fastly_world_option_body_handle_t ret; if (!fastly_compute_at_edge_object_store_pending_lookup_wait(this->handle, &ret, &err)) { res.emplace_err(static_cast(err)); } else if (ret.is_some) { @@ -1282,15 +1288,15 @@ FastlyHandle ObjectStorePendingDelete::async_handle() const { return FastlyHandl static_assert(std::is_same_v); static_assert(std::is_same_v); -Result> Secret::plaintext() const { - Result> res; +Result> Secret::plaintext() const { + Result> res; - fastly_world_option_string_t ret; + fastly_world_option_list_u8_t ret; fastly_compute_at_edge_types_error_t err; if (!fastly_compute_at_edge_secret_store_plaintext(this->handle, &ret, &err)) { res.emplace_err(err); } else if (ret.is_some) { - res.emplace(make_host_string(ret.val)); + res.emplace(make_host_bytes(ret.val)); } else { res.emplace(std::nullopt); } @@ -1317,7 +1323,7 @@ Result> SecretStore::get(std::string_view name) { Result> res; auto name_str = string_view_to_world_string(name); - fastly_world_option_fastly_compute_at_edge_secret_store_secret_handle_t ret; + fastly_world_option_secret_handle_t ret; fastly_compute_at_edge_types_error_t err; if (!fastly_compute_at_edge_secret_store_get(this->handle, &name_str, &ret, &err)) { res.emplace_err(err); @@ -1330,6 +1336,21 @@ Result> SecretStore::get(std::string_view name) { return res; } +Result SecretStore::from_bytes(uint8_t *bytes, size_t len) { + Result res; + + fastly_world_list_u8_t bytes_list{const_cast(bytes), len}; + fastly_compute_at_edge_secret_store_secret_handle_t ret; + fastly_compute_at_edge_types_error_t err; + if (!fastly_compute_at_edge_secret_store_from_bytes(&bytes_list, &ret, &err)) { + res.emplace_err(err); + } else { + res.emplace(ret); + } + + return res; +} + bool CacheState::is_found() const { return this->state & FASTLY_COMPUTE_AT_EDGE_CACHE_LOOKUP_STATE_FOUND; } @@ -1494,8 +1515,7 @@ CacheHandle::transaction_insert_and_stream_back(const CacheWriteOptions &opts) { init_write_options(options, opts); fastly_compute_at_edge_types_error_t err; - fastly_world_tuple2_fastly_compute_at_edge_cache_body_handle_fastly_compute_at_edge_cache_handle_t - ret; + fastly_world_tuple2_body_handle_handle_t ret; if (!fastly_compute_at_edge_cache_transaction_insert_and_stream_back(this->handle, &options, &ret, &err)) { res.emplace_err(err); diff --git a/runtime/fastly/host-api/host_api_fastly.h b/runtime/fastly/host-api/host_api_fastly.h index 364e467496..daf39b1dbb 100644 --- a/runtime/fastly/host-api/host_api_fastly.h +++ b/runtime/fastly/host-api/host_api_fastly.h @@ -336,6 +336,11 @@ struct TlsVersion { static TlsVersion version_1_3(); }; +struct ClientCert { + HostString cert; + FastlyHandle key; +}; + struct BackendConfig { std::optional host_override; std::optional connect_timeout; @@ -349,6 +354,7 @@ struct BackendConfig { std::optional ca_cert; std::optional ciphers; std::optional sni_hostname; + std::optional client_cert; }; struct CacheOverrideTag final { @@ -584,7 +590,7 @@ class Secret final { Secret() = default; explicit Secret(FastlyHandle handle) : handle{handle} {} - Result> plaintext() const; + Result> plaintext() const; }; class SecretStore final { @@ -599,6 +605,7 @@ class SecretStore final { static Result open(std::string_view name); Result> get(std::string_view name); + static Result from_bytes(uint8_t *bytes, size_t len); }; struct CacheLookupOptions final { diff --git a/runtime/fastly/host-api/regenerate-world.sh b/runtime/fastly/host-api/regenerate-world.sh new file mode 100755 index 0000000000..2c625e453c --- /dev/null +++ b/runtime/fastly/host-api/regenerate-world.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +# cargo install --git https://github.com/bytecodealliance/wit-bindgen wit-bindgen-cli --no-default-features --features c +wit-bindgen c --no-helpers --out-dir component --world fastly-world wit diff --git a/runtime/fastly/host-api/wit/deps/fastly/compute-at-edge.wit b/runtime/fastly/host-api/wit/deps/fastly/compute-at-edge.wit index bdef728dcf..a8aeb609b4 100644 --- a/runtime/fastly/host-api/wit/deps/fastly/compute-at-edge.wit +++ b/runtime/fastly/host-api/wit/deps/fastly/compute-at-edge.wit @@ -1,4 +1,4 @@ -package fastly:compute-at-edge +package fastly:compute-at-edge; interface types { // TODO: split this up into function-specific error enums @@ -51,20 +51,20 @@ interface types { limit-exceeded } - type secret-handle = u32 + type secret-handle = u32; } interface http-types { - use types.{secret-handle} + use types.{secret-handle}; - type body-handle = u32 + type body-handle = u32; - type request-handle = u32 - type pending-request-handle = u32 - type response-handle = u32 - type request = tuple - type response = tuple + type request-handle = u32; + type pending-request-handle = u32; + type response-handle = u32; + type request = tuple; + type response = tuple; enum send-error-detail-tag { /// The send-error-detail struct has not been populated. @@ -198,7 +198,7 @@ interface http-types { client-cert: option, } - type http-status = u16 + type http-status = u16; } /* @@ -206,7 +206,7 @@ interface http-types { */ interface uap { - use types.{error} + use types.{error}; record user-agent { family: string, @@ -215,7 +215,7 @@ interface uap { patch: string } - parse: func(user-agent: string) -> result + parse: func(user-agent: string) -> result; } /* @@ -223,23 +223,23 @@ interface uap { */ interface http-body { - use types.{error} - use http-types.{body-handle} + use types.{error}; + use http-types.{body-handle}; enum write-end { back, front } - append: func(dest: body-handle, src: body-handle) -> result<_, error> + append: func(dest: body-handle, src: body-handle) -> result<_, error>; - new: func() -> result + new: func() -> result; - read: func(h: body-handle, chunk-size: u32) -> result, error> + read: func(h: body-handle, chunk-size: u32) -> result, error>; - write: func(h: body-handle, buf: list, end: write-end) -> result + write: func(h: body-handle, buf: list, end: write-end) -> result; - close: func(h: body-handle) -> result<_, error> + close: func(h: body-handle) -> result<_, error>; } /* @@ -247,13 +247,13 @@ interface http-body { */ interface log { - use types.{error} + use types.{error}; - type handle = u32 + type handle = u32; - endpoint-get: func(name: string) -> result + endpoint-get: func(name: string) -> result; - write: func(h: handle, msg: string) -> result<_, error> + write: func(h: handle, msg: string) -> result<_, error>; } /* @@ -261,11 +261,11 @@ interface log { */ interface http-req { - use types.{error} + use types.{error}; use http-types.{ body-handle, request-handle, http-version, response, pending-request-handle, content-encodings, framing-headers-mode, dynamic-backend-config, send-error-detail - } + }; flags cache-override-tag { /// Do not cache the response to this request, regardless of the origin response's headers. @@ -275,95 +275,95 @@ interface http-req { pci, } - cache-override-set: func(h: request-handle, tag: cache-override-tag, ttl: option, stale-while-revalidate: option, sk: option) -> result<_, error> + cache-override-set: func(h: request-handle, tag: cache-override-tag, ttl: option, stale-while-revalidate: option, sk: option) -> result<_, error>; - downstream-client-ip-addr: func() -> result, error> + downstream-client-ip-addr: func() -> result, error>; - downstream-client-request-id: func() -> result + downstream-client-request-id: func() -> result; - downstream-client-h2-fingerprint: func() -> result, error> + downstream-client-h2-fingerprint: func() -> result, error>; - downstream-tls-cipher-openssl-name: func() -> result + downstream-tls-cipher-openssl-name: func() -> result; - downstream-tls-protocol: func() -> result + downstream-tls-protocol: func() -> result; - downstream-tls-client-hello: func() -> result, error> + downstream-tls-client-hello: func() -> result, error>; - downstream-tls-raw-client-certificate: func() -> result, error> + downstream-tls-raw-client-certificate: func() -> result, error>; - downstream-tls-client-cert-verify-result: func() -> result<_, error> + downstream-tls-client-cert-verify-result: func() -> result<_, error>; - downstream-tls-ja3-md5: func() -> result, error> + downstream-tls-ja3-md5: func() -> result, error>; - new: func() -> result + new: func() -> result; - header-names-get: func(h: request-handle) -> result, error> + header-names-get: func(h: request-handle) -> result, error>; - original-header-names-get: func() -> result, error> + original-header-names-get: func() -> result, error>; - original-header-count: func() -> result + original-header-count: func() -> result; - header-value-get: func(h: request-handle, name: string) -> result>, error> + header-value-get: func(h: request-handle, name: string) -> result>, error>; - header-values-get: func(h: request-handle, name: string) -> result>>, error> + header-values-get: func(h: request-handle, name: string) -> result>>, error>; - header-values-set: func(h: request-handle, name: string, values: list>) -> result<_, error> + header-values-set: func(h: request-handle, name: string, values: list>) -> result<_, error>; - header-insert: func(h: request-handle, name: string, value: list) -> result<_, error> + header-insert: func(h: request-handle, name: string, value: list) -> result<_, error>; - header-append: func(h: request-handle, name: string, value: list) -> result<_, error> + header-append: func(h: request-handle, name: string, value: list) -> result<_, error>; - header-remove: func(h: request-handle, name: string) -> result<_, error> + header-remove: func(h: request-handle, name: string) -> result<_, error>; - method-get: func(h: request-handle) -> result + method-get: func(h: request-handle) -> result; - method-set: func(h: request-handle, method: string) -> result<_, error> + method-set: func(h: request-handle, method: string) -> result<_, error>; - uri-get: func(h: request-handle) -> result + uri-get: func(h: request-handle) -> result; - uri-set: func(h: request-handle, uri: string) -> result<_, error> + uri-set: func(h: request-handle, uri: string) -> result<_, error>; - version-get: func(h: request-handle) -> result + version-get: func(h: request-handle) -> result; - version-set: func(h: request-handle, version: http-version) -> result<_, error> + version-set: func(h: request-handle, version: http-version) -> result<_, error>; - send: func(h: request-handle, b: body-handle, backend: string) -> result + send: func(h: request-handle, b: body-handle, backend: string) -> result; - send-v2: func(h: request-handle, s: send-error-detail, b: body-handle, backend: string) -> result + send-v2: func(h: request-handle, s: send-error-detail, b: body-handle, backend: string) -> result; - send-async: func(h: request-handle, b: body-handle, backend: string) -> result + send-async: func(h: request-handle, b: body-handle, backend: string) -> result; - send-async-streaming: func(h: request-handle, b: body-handle, backend: string) -> result + send-async-streaming: func(h: request-handle, b: body-handle, backend: string) -> result; - pending-req-poll: func(h: pending-request-handle) -> result, error> - pending-req-poll-v2: func(h: pending-request-handle, s: send-error-detail) -> result, error> + pending-req-poll: func(h: pending-request-handle) -> result, error>; + pending-req-poll-v2: func(h: pending-request-handle, s: send-error-detail) -> result, error>; - pending-req-wait: func(h: pending-request-handle) -> result - pending-req-wait-v2: func(h: pending-request-handle, s: send-error-detail) -> result + pending-req-wait: func(h: pending-request-handle) -> result; + pending-req-wait-v2: func(h: pending-request-handle, s: send-error-detail) -> result; pending-req-select: func(h: list) -> result, error> + >, error>; pending-req-select-v2: func(h: list) -> result, send-error-detail> + >, send-error-detail>; - close: func(h: request-handle) -> result<_, error> + close: func(h: request-handle) -> result<_, error>; - auto-decompress-response-set: func(h: request-handle, encodings: content-encodings) -> result<_, error> + auto-decompress-response-set: func(h: request-handle, encodings: content-encodings) -> result<_, error>; - upgrade-websocket: func(backend: string) -> result<_, error> + upgrade-websocket: func(backend: string) -> result<_, error>; - redirect-to-websocket-proxy: func(backend: string) -> result<_, error> + redirect-to-websocket-proxy: func(backend: string) -> result<_, error>; - redirect-to-grip-proxy: func(backend: string) -> result<_, error> + redirect-to-grip-proxy: func(backend: string) -> result<_, error>; - framing-headers-mode-set: func(h: request-handle, mode: framing-headers-mode) -> result<_, error> + framing-headers-mode-set: func(h: request-handle, mode: framing-headers-mode) -> result<_, error>; - register-dynamic-backend: func(prefix: string, target: string, config: dynamic-backend-config) -> result<_, error> + register-dynamic-backend: func(prefix: string, target: string, config: dynamic-backend-config) -> result<_, error>; } @@ -371,50 +371,50 @@ interface http-req { * Fastly HTTP Resp */ interface http-resp { - use types.{error} + use types.{error}; use http-types.{ response-handle, body-handle, http-version, http-status, framing-headers-mode - } + }; - new: func() -> result + new: func() -> result; - header-names-get: func(h: response-handle) -> result, error> + header-names-get: func(h: response-handle) -> result, error>; - header-value-get: func(h: response-handle, name: string) -> result, error> + header-value-get: func(h: response-handle, name: string) -> result, error>; - header-values-get: func(h: response-handle, name: string) -> result>>, error> + header-values-get: func(h: response-handle, name: string) -> result>>, error>; - header-values-set: func(h: response-handle, name: string, values: list>) -> result<_, error> + header-values-set: func(h: response-handle, name: string, values: list>) -> result<_, error>; - header-insert: func(h: response-handle, name: string, value: list) -> result<_, error> + header-insert: func(h: response-handle, name: string, value: list) -> result<_, error>; - header-append: func(h: response-handle, name: string, value: list) -> result<_, error> + header-append: func(h: response-handle, name: string, value: list) -> result<_, error>; - header-remove: func(h: response-handle, name: string) -> result<_, error> + header-remove: func(h: response-handle, name: string) -> result<_, error>; - version-get: func(h: response-handle) -> result + version-get: func(h: response-handle) -> result; - version-set: func(h: response-handle, version: http-version) -> result<_, error> + version-set: func(h: response-handle, version: http-version) -> result<_, error>; - send-downstream: func(h: response-handle, b: body-handle, streaming: bool) -> result<_, error> + send-downstream: func(h: response-handle, b: body-handle, streaming: bool) -> result<_, error>; - status-get: func(h: response-handle) -> result + status-get: func(h: response-handle) -> result; - status-set: func(h: response-handle, status: http-status) -> result<_, error> + status-set: func(h: response-handle, status: http-status) -> result<_, error>; - close: func(h: response-handle) -> result<_, error> + close: func(h: response-handle) -> result<_, error>; /// Adjust how this response's framing headers are determined. - framing-headers-mode-set: func(h: response-handle, mode: framing-headers-mode) -> result<_, error> + framing-headers-mode-set: func(h: response-handle, mode: framing-headers-mode) -> result<_, error>; enum keepalive-mode { automatic, no-keepalive, } - http-keepalive-mode-set: func(h: response-handle, mode: keepalive-mode) -> result<_, error> + http-keepalive-mode-set: func(h: response-handle, mode: keepalive-mode) -> result<_, error>; } /* @@ -422,20 +422,20 @@ interface http-resp { */ interface dictionary { - use types.{error} + use types.{error}; - type handle = u32 + type handle = u32; - open: func(name: string) -> result + open: func(name: string) -> result; - get: func(h: handle, key: string) -> result, error> + get: func(h: handle, key: string) -> result, error>; } /* * Fastly Geo */ interface geo { - use types.{error} + use types.{error}; record geo-data { /** @@ -559,7 +559,7 @@ interface geo { } /// JSON string for now - lookup: func(addr-octets: list) -> result + lookup: func(addr-octets: list) -> result; } /* @@ -567,23 +567,27 @@ interface geo { */ interface object-store { - use types.{error} + use types.{error}; + + use http-types.{body-handle}; + + type handle = u32; + type pending-handle = u32; - use http-types.{body-handle} + open: func(name: string) -> result; - type handle = u32 - type pending-handle = u32 + lookup: func(store: handle, key: string) -> result, error>; - open: func(name: string) -> result + lookup-async: func(store: handle, key: string) -> result; - lookup: func(store: handle, key: string) -> result, error> + pending-lookup-wait: func(handle: pending-handle) -> result, error>; - lookup-async: func(store: handle, key: string) -> result + delete-async: func(store: handle, key: string) -> result; - pending-lookup-wait: func(handle: pending-handle) -> result, error> + pending-delete-wait: func(handle: pending-handle) -> result<_, error>; // Should object store insert return "inserted" bool? - insert: func(store: handle, key: string, body-handle: body-handle) -> result<_, error> + insert: func(store: handle, key: string, body-handle: body-handle) -> result<_, error>; } @@ -592,27 +596,27 @@ interface object-store { */ interface secret-store { - use types.{error, secret-handle} + use types.{error, secret-handle}; - type store-handle = u32 + type store-handle = u32; - open: func(name: string) -> result + open: func(name: string) -> result; - get: func(store: store-handle, key: string) -> result, error> + get: func(store: store-handle, key: string) -> result, error>; - plaintext: func(secret: secret-handle) -> result, error> + plaintext: func(secret: secret-handle) -> result>, error>; - from-bytes: func(bytes: string) -> result + from-bytes: func(bytes: list) -> result; } /* * Fastly backend */ interface backend { - use types.{error} - use http-types.{tls-version} + use types.{error}; + use http-types.{tls-version}; - exists: func(backend: string) -> result + exists: func(backend: string) -> result; enum backend-health { unknown, @@ -620,47 +624,47 @@ interface backend { unhealthy, } - is-healthy: func(backend: string) -> result + is-healthy: func(backend: string) -> result; /// Returns `true` if the backend is a "dynamic" backend. - is-dynamic: func(backend: string) -> result + is-dynamic: func(backend: string) -> result; /// Get the host of this backend. - get-host: func(backend: string) -> result + get-host: func(backend: string) -> result; /// Get the "override host" for this backend. /// /// This is used to change the `Host` header sent to the backend. See the /// Fastly documentation oh this topic here: https://docs.fastly.com/en/guides/specifying-an-override-host - get-override-host: func(backend: string) -> result, error> + get-override-host: func(backend: string) -> result, error>; /// Get the remote TCP port of the backend connection for the request. - get-port: func(backend: string) -> result + get-port: func(backend: string) -> result; /// Get the connection timeout of the backend. - get-connect-timeout-ms: func(backend: string) -> result + get-connect-timeout-ms: func(backend: string) -> result; /// Get the first byte timeout of the backend. - get-first-byte-timeout-ms: func(backend: string) -> result + get-first-byte-timeout-ms: func(backend: string) -> result; /// Get the between byte timeout of the backend. - get-between-bytes-timeout-ms: func(backend: string) -> result + get-between-bytes-timeout-ms: func(backend: string) -> result; /// Returns `true` if the backend is configured to use SSL. - is-ssl: func(backend: string) -> result + is-ssl: func(backend: string) -> result; /// Get the minimum SSL version this backend will use. - get-ssl-min-version: func(backend: string) -> result + get-ssl-min-version: func(backend: string) -> result; /// Get the maximum SSL version this backend will use. - get-ssl-max-version: func(backend: string) -> result + get-ssl-max-version: func(backend: string) -> result; } /* * Fastly Async IO */ interface async-io { - use types.{error} + use types.{error}; /// A handle to an object supporting generic async operations. /// Can be either a `BodyHandle` or a `PendingRequestHandle`. @@ -673,7 +677,7 @@ interface async-io { /// /// For writing bytes, note that there is a large host-side buffer that bytes can eagerly be written /// into, even before the origin itself consumes that data. - type handle = u32 + type handle = u32; /// Blocks until one of the given objects is ready for I/O, or the optional timeout expires. /// @@ -685,7 +689,7 @@ interface async-io { /// /// Returns the _index_ (not handle!) of the first object that is ready, or /// none if the timeout expires before any objects are ready for I/O. - select: func(hs: list, timeout-ms: u32) -> result, error> + select: func(hs: list, timeout-ms: u32) -> result, error>; /// Returns 1 if the given async item is "ready" for its associated I/O action, 0 otherwise. /// @@ -694,7 +698,7 @@ interface async-io { /// Valid object handles includes bodies and pending requests. See the `async_item_handle` /// definition for more details, including what I/O actions are associated with each handle /// type. - is-ready: func(handle: handle) -> result + is-ready: func(handle: handle) -> result; } /* @@ -702,7 +706,7 @@ interface async-io { */ interface purge { - use types.{error} + use types.{error}; flags options-mask { soft-purge, @@ -713,7 +717,7 @@ interface purge { * A surrogate key can be a max of 1024 characters. * A surrogate key must contain only printable ASCII characters (those between `0x21` and `0x7E`, inclusive). */ - surrogate-key: func(surrogate-keys: string, purge-options: options-mask) -> result, error> + surrogate-key: func(surrogate-keys: string, purge-options: options-mask) -> result, error>; } /* @@ -721,14 +725,14 @@ interface purge { */ interface cache { - use types.{error} - use http-types.{body-handle, request-handle} + use types.{error}; + use http-types.{body-handle, request-handle}; /// The outcome of a cache lookup (either bare or as part of a cache transaction) - type handle = u32 - type object-length = u64 - type duration-ns = u64 - type cache-hit-count = u64 + type handle = u32; + type object-length = u64; + type duration-ns = u64; + type cache-hit-count = u64; /// Extensible options for cache lookup operations currently used for both `lookup` and `transaction_lookup`. record lookup-options { @@ -791,19 +795,19 @@ interface cache { /// Performs a non-request-collapsing cache lookup. /// /// Returns a result without waiting for any request collapsing that may be ongoing. - lookup: func(key: string, options: lookup-options) -> result + lookup: func(key: string, options: lookup-options) -> result; /// Performs a non-request-collapsing cache insertion (or update). /// /// The returned handle is to a streaming body that is used for writing the object into /// the cache. - insert: func(key: string, options: write-options) -> result + insert: func(key: string, options: write-options) -> result; /// The entrypoint to the request-collapsing cache transaction API. /// /// This operation always participates in request collapsing and may return stale objects. To bypass /// request collapsing, use `lookup` and `insert` instead. - transaction-lookup: func(key: string, options: lookup-options) -> result + transaction-lookup: func(key: string, options: lookup-options) -> result; /// Insert an object into the cache with the given metadata. /// @@ -811,7 +815,7 @@ interface cache { /// /// The returned handle is to a streaming body that is used for writing the object into /// the cache. - transaction-insert: func(handle: handle, options: write-options) -> result + transaction-insert: func(handle: handle, options: write-options) -> result; /// Insert an object into the cache with the given metadata, and return a readable stream of the /// bytes as they are stored. @@ -823,32 +827,32 @@ interface cache { /// The returned body handle is to a streaming body that is used for writing the object _into_ /// the cache. The returned cache handle provides a separate transaction for reading out the /// newly cached object to send elsewhere. - transaction-insert-and-stream-back: func(handle: handle, options: write-options) -> result, error> + transaction-insert-and-stream-back: func(handle: handle, options: write-options) -> result, error>; /// Update the metadata of an object in the cache without changing its data. /// /// Can only be used in if the cache handle state includes both of the flags: /// - `found` /// - `must-insert-or-update` - transaction-update: func(handle: handle, options: write-options) -> result<_, error> + transaction-update: func(handle: handle, options: write-options) -> result<_, error>; /// Cancel an obligation to provide an object to the cache. /// /// Useful if there is an error before streaming is possible, e.g. if a backend is unreachable. - transaction-cancel: func(handle: handle) -> result<_, error> + transaction-cancel: func(handle: handle) -> result<_, error>; /// Close an ongoing interaction with the cache. /// /// If the cache handle state includes the `$must_insert_or_update` (and hence no insert or /// update has been performed), closing the handle cancels any request collapsing, potentially /// choosing a new waiter to perform the insertion/update. - close: func(handle: handle) -> result<_, error> + close: func(handle: handle) -> result<_, error>; - get-state: func(handle: handle) -> result + get-state: func(handle: handle) -> result; /// Gets the user metadata of the found object, returning `none` if there /// was no found object. - get-user-metadata: func(handle: handle) -> result, error> + get-user-metadata: func(handle: handle) -> result, error>; /// Gets a range of the found object body, returning the `optional-none` error if there /// was no found object. @@ -859,58 +863,58 @@ interface cache { /// Note: until the CacheD protocol is adjusted to fully support this functionality, /// the body of objects that are past the stale-while-revalidate period will not /// be available, even when other metadata is. - get-body: func(handle: handle, options: get-body-options, options-mask: get-body-options-mask) -> result + get-body: func(handle: handle, options: get-body-options, options-mask: get-body-options-mask) -> result; /// Gets the content length of the found object, returning the `$none` error if there /// was no found object, or no content length was provided. - get-length: func(handle: handle) -> result + get-length: func(handle: handle) -> result; /// Gets the configured max age of the found object, returning the `$none` error if there /// was no found object. - get-max-age-ns: func(handle: handle) -> result + get-max-age-ns: func(handle: handle) -> result; /// Gets the configured stale-while-revalidate period of the found object, returning the /// `$none` error if there was no found object. - get-stale-while-revalidate-ns: func(handle: handle) -> result + get-stale-while-revalidate-ns: func(handle: handle) -> result; /// Gets the age of the found object, returning the `$none` error if there /// was no found object. - get-age-ns: func(handle: handle) -> result + get-age-ns: func(handle: handle) -> result; /// Gets the number of cache hits for the found object, returning the `$none` error if there /// was no found object. - get-hits: func(handle: handle) -> result + get-hits: func(handle: handle) -> result; } interface edge-rate-limiter { - use types.{error} + use types.{error}; - check-rate: func(rate-counter-name: string, entry: string, delta: u32, window: u32, limit: u32, penalty-box-name: string, time-to-live: u32) -> result + check-rate: func(rate-counter-name: string, entry: string, delta: u32, window: u32, limit: u32, penalty-box-name: string, time-to-live: u32) -> result; - ratecounter-increment: func(rate-counter-name: string, entry: string, delta: u32) -> result<_, error> + ratecounter-increment: func(rate-counter-name: string, entry: string, delta: u32) -> result<_, error>; - ratecounter-lookup-rate: func(rate-counter-name: string, entry: string, window: u32) -> result + ratecounter-lookup-rate: func(rate-counter-name: string, entry: string, window: u32) -> result; - ratecounter-lookup-count: func(rate-counter-name: string, entry: string, duration: u32) -> result + ratecounter-lookup-count: func(rate-counter-name: string, entry: string, duration: u32) -> result; - penaltybox-add: func(penalty-box-name: string, entry: string, time-to-live: u32) -> result<_, error> + penaltybox-add: func(penalty-box-name: string, entry: string, time-to-live: u32) -> result<_, error>; - penaltybox-has: func(penalty-box-name: string, entry: string) -> result + penaltybox-has: func(penalty-box-name: string, entry: string) -> result; } interface device-detection { - use types.{error} + use types.{error}; - lookup: func(user-agent: string) -> result + lookup: func(user-agent: string) -> result; } interface reactor { - use http-types.{request} + use http-types.{request}; /// Serve the given request /// /// response handle not currently returned, because in the case of a streamed response /// send downstream must be fully streamed due to the run to completion semantics. - serve: func(req: request) -> result + serve: func(req: request) -> result; } diff --git a/runtime/fastly/host-api/wit/js-compute-runtime.wit b/runtime/fastly/host-api/wit/js-compute-runtime.wit index 1cc34178b0..7d78893f21 100644 --- a/runtime/fastly/host-api/wit/js-compute-runtime.wit +++ b/runtime/fastly/host-api/wit/js-compute-runtime.wit @@ -1,22 +1,22 @@ -package fastly:js-compute-runtime +package fastly:js-compute-runtime; world fastly-world { - import fastly:compute-at-edge/async-io - import fastly:compute-at-edge/backend - import fastly:compute-at-edge/cache - import fastly:compute-at-edge/device-detection - import fastly:compute-at-edge/dictionary - import fastly:compute-at-edge/edge-rate-limiter - import fastly:compute-at-edge/geo - import fastly:compute-at-edge/http-body - import fastly:compute-at-edge/http-req - import fastly:compute-at-edge/http-resp - import fastly:compute-at-edge/log - import fastly:compute-at-edge/object-store - import fastly:compute-at-edge/purge - import fastly:compute-at-edge/secret-store - import fastly:compute-at-edge/uap + import fastly:compute-at-edge/async-io; + import fastly:compute-at-edge/backend; + import fastly:compute-at-edge/cache; + import fastly:compute-at-edge/device-detection; + import fastly:compute-at-edge/dictionary; + import fastly:compute-at-edge/edge-rate-limiter; + import fastly:compute-at-edge/geo; + import fastly:compute-at-edge/http-body; + import fastly:compute-at-edge/http-req; + import fastly:compute-at-edge/http-resp; + import fastly:compute-at-edge/log; + import fastly:compute-at-edge/object-store; + import fastly:compute-at-edge/purge; + import fastly:compute-at-edge/secret-store; + import fastly:compute-at-edge/uap; - export fastly:compute-at-edge/reactor + export fastly:compute-at-edge/reactor; } diff --git a/runtime/js-compute-runtime/builtins/backend.cpp b/runtime/js-compute-runtime/builtins/backend.cpp index cad21d03d0..d346058498 100644 --- a/runtime/js-compute-runtime/builtins/backend.cpp +++ b/runtime/js-compute-runtime/builtins/backend.cpp @@ -17,6 +17,7 @@ #include "js/experimental/TypedData.h" #pragma clang diagnostic pop +#include "./secret-store.h" #include "builtins/backend.h" #include "builtins/request-response.h" #include "core/encode.h" @@ -796,6 +797,18 @@ JS::Result Backend::register_dynamic_backend(JSContext *cx, JS::Han backend_config.sni_hostname.emplace(std::move(sni_hostname_chars)); } + auto client_cert_slot = JS::GetReservedSlot(backend, Backend::Slots::ClientCert); + if (!client_cert_slot.isNullOrUndefined()) { + JS::RootedString client_cert_string(cx, client_cert_slot.toString()); + auto client_cert_chars = core::encode(cx, client_cert_string); + + auto client_cert_key_slot = JS::GetReservedSlot(backend, Backend::Slots::ClientCertKey); + + backend_config.client_cert = + host_api::ClientCert{.cert = std::move(client_cert_chars), + .key = host_api::Secret(client_cert_key_slot.toInt32())}; + } + auto res = host_api::HttpReq::register_dynamic_backend(name_str, target_str, backend_config); if (auto *err = res.to_err()) { HANDLE_ERROR(cx, *err); @@ -995,6 +1008,34 @@ bool Backend::set_sni_hostname(JSContext *cx, JSObject *backend, JS::HandleValue return true; } +bool Backend::set_client_cert(JSContext *cx, JSObject *backend, JS::HandleValue client_cert_val) { + auto client_cert = JS::ToString(cx, client_cert_val); + if (!client_cert) { + return false; + } + + if (JS_GetStringLength(client_cert) == 0) { + JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, + JSMSG_BACKEND_CLIENT_CERTIFICATE_CERTIFICATE_EMPTY); + return false; + } + JS::SetReservedSlot(backend, Backend::Slots::ClientCert, JS::StringValue(client_cert)); + return true; +} + +bool Backend::set_client_cert_key(JSContext *cx, JSObject *backend, + JS::HandleValue client_cert_key_val) { + if (!SecretStoreEntry::is_instance(client_cert_key_val)) { + JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, + JSMSG_BACKEND_CLIENT_CERTIFICATE_KEY_INVALID); + return false; + } + JS::RootedObject client_cert_key_obj(cx, &client_cert_key_val.toObject()); + JS::SetReservedSlot(backend, Backend::Slots::ClientCertKey, + JS::Int32Value(SecretStoreEntry::secret_handle(client_cert_key_obj).handle)); + return true; +} + /// Timeouts for backends must be less than 2^32 milliseconds, or /// about a month and a half. bool Backend::set_timeout_slot(JSContext *cx, JSObject *backend, JS::HandleValue value, @@ -1443,6 +1484,54 @@ bool Backend::constructor(JSContext *cx, unsigned argc, JS::Value *vp) { JS::SetReservedSlot(backend, Backend::Slots::SniHostname, JS::StringValue(sni_hostname)); } + JS::RootedValue client_cert_val(cx); + if (!JS_HasProperty(cx, configuration, "clientCertificate", &found)) { + return false; + } + if (found) { + if (!JS_GetProperty(cx, configuration, "clientCertificate", &client_cert_val)) { + return false; + } + if (!client_cert_val.isObject()) { + JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, + JSMSG_BACKEND_CLIENT_CERTIFICATE_NOT_OBJECT); + return false; + } + JS::RootedObject client_cert_obj(cx, &client_cert_val.toObject()); + + JS::RootedValue client_cert_cert_val(cx); + if (!JS_HasProperty(cx, client_cert_obj, "certificate", &found)) { + return false; + } + if (!found) { + JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, + JSMSG_BACKEND_CLIENT_CERTIFICATE_NO_CERTIFICATE); + return false; + } + if (!JS_GetProperty(cx, client_cert_obj, "certificate", &client_cert_cert_val)) { + return false; + } + if (!Backend::set_client_cert(cx, backend, client_cert_cert_val)) { + return false; + } + + JS::RootedValue client_cert_key_val(cx); + if (!JS_HasProperty(cx, client_cert_obj, "key", &found)) { + return false; + } + if (!found) { + JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, + JSMSG_BACKEND_CLIENT_CERTIFICATE_KEY_INVALID); + return false; + } + if (!JS_GetProperty(cx, client_cert_obj, "key", &client_cert_key_val)) { + return false; + } + if (!Backend::set_client_cert_key(cx, backend, client_cert_key_val)) { + return false; + } + } + auto result = Backend::register_dynamic_backend(cx, backend); if (result.isErr()) { return false; diff --git a/runtime/js-compute-runtime/builtins/backend.h b/runtime/js-compute-runtime/builtins/backend.h index 48014c3c9a..ee8ba65b33 100644 --- a/runtime/js-compute-runtime/builtins/backend.h +++ b/runtime/js-compute-runtime/builtins/backend.h @@ -26,6 +26,8 @@ class Backend : public BuiltinImpl { Ciphers, SniHostname, DontPool, + ClientCert, + ClientCertKey, Count }; @@ -47,6 +49,9 @@ class Backend : public BuiltinImpl { static bool set_host_override(JSContext *cx, JSObject *backend, JS::HandleValue hostOverride_val); static bool set_sni_hostname(JSContext *cx, JSObject *backend, JS::HandleValue sniHostname_val); static bool set_name(JSContext *cx, JSObject *backend, JS::HandleValue name_val); + static bool set_client_cert(JSContext *cx, JSObject *backend, JS::HandleValue client_cert_val); + static bool set_client_cert_key(JSContext *cx, JSObject *backend, + JS::HandleValue client_cert_key_val); // static methods static bool exists(JSContext *cx, unsigned argc, JS::Value *vp); diff --git a/runtime/js-compute-runtime/builtins/secret-store.cpp b/runtime/js-compute-runtime/builtins/secret-store.cpp index 916e30bcfc..10797374b7 100644 --- a/runtime/js-compute-runtime/builtins/secret-store.cpp +++ b/runtime/js-compute-runtime/builtins/secret-store.cpp @@ -24,7 +24,9 @@ bool SecretStoreEntry::plaintext(JSContext *cx, unsigned argc, JS::Value *vp) { return false; } - JS::RootedString text(cx, JS_NewStringCopyUTF8N(cx, JS::UTF8Chars(ret->begin(), ret->size()))); + JS::RootedString text( + cx, + JS_NewStringCopyUTF8N(cx, JS::UTF8Chars(reinterpret_cast(ret->ptr.get()), ret->len))); if (!text) { return false; } @@ -33,6 +35,39 @@ bool SecretStoreEntry::plaintext(JSContext *cx, unsigned argc, JS::Value *vp) { return true; } +bool SecretStoreEntry::raw_bytes(JSContext *cx, unsigned argc, JS::Value *vp) { + METHOD_HEADER(0) + + // Ensure that we throw an exception for all unexpected host errors. + auto res = SecretStoreEntry::secret_handle(self).plaintext(); + if (auto *err = res.to_err()) { + HANDLE_ERROR(cx, *err); + return false; + } + + auto ret = std::move(res.unwrap()); + if (!ret.has_value()) { + return false; + } + + JS::RootedObject array_buffer( + cx, JS::NewArrayBufferWithContents(cx, ret->len, ret->ptr.get(), + JS::NewArrayBufferOutOfMemory::CallerMustFreeMemory)); + if (!array_buffer) { + JS_ReportOutOfMemory(cx); + return false; + } + + // `array_buffer` now owns `metadata` + static_cast(ret->ptr.release()); + + JS::RootedObject uint8_array(cx, JS_NewUint8ArrayWithBuffer(cx, array_buffer, 0, ret->len)); + + args.rval().setObject(*uint8_array); + + return true; +} + const JSFunctionSpec SecretStoreEntry::static_methods[] = { JS_FS_END, }; @@ -42,7 +77,8 @@ const JSPropertySpec SecretStoreEntry::static_properties[] = { }; const JSFunctionSpec SecretStoreEntry::methods[] = { - JS_FN("plaintext", plaintext, 0, JSPROP_ENUMERATE), JS_FS_END}; + JS_FN("plaintext", plaintext, 0, JSPROP_ENUMERATE), + JS_FN("rawBytes", raw_bytes, 0, JSPROP_ENUMERATE), JS_FS_END}; const JSPropertySpec SecretStoreEntry::properties[] = {JS_PS_END}; @@ -136,7 +172,63 @@ bool SecretStore::get(JSContext *cx, unsigned argc, JS::Value *vp) { return true; } +bool SecretStore::from_bytes(JSContext *cx, unsigned argc, JS::Value *vp) { + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + if (!args.requireAtLeast(cx, "SecretStore.fromBytes", 1)) { + return false; + } + auto bytes = args.get(0); + if (!bytes.isObject()) { + JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, + JSMSG_SECRET_STORE_FROM_BYTES_INVALID_BUFFER); + return false; + } + + JS::RootedObject bytes_obj(cx, &bytes.toObject()); + + if (!JS::IsArrayBufferObject(bytes_obj) && !JS_IsArrayBufferViewObject(bytes_obj)) { + JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, + JSMSG_SECRET_STORE_FROM_BYTES_INVALID_BUFFER); + return false; + } + + mozilla::Maybe maybeNoGC; + uint8_t *buf; + size_t length; + if (JS_IsArrayBufferViewObject(bytes_obj)) { + JS::AutoCheckCannotGC noGC; + bool is_shared; + length = JS_GetArrayBufferViewByteLength(bytes_obj); + buf = (uint8_t *)JS_GetArrayBufferViewData(bytes_obj, &is_shared, noGC); + MOZ_ASSERT(!is_shared); + } else if (JS::IsArrayBufferObject(bytes_obj)) { + bool is_shared; + JS::GetArrayBufferLengthAndData(bytes_obj, &length, &is_shared, (uint8_t **)&buf); + } else { + JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, + JSMSG_SECRET_STORE_FROM_BYTES_INVALID_BUFFER); + return false; + } + + JS::RootedObject entry( + cx, JS_NewObjectWithGivenProto(cx, &SecretStoreEntry::class_, SecretStoreEntry::proto_obj)); + if (!entry) { + return false; + } + + auto res = host_api::SecretStore::from_bytes(buf, length); + if (auto *err = res.to_err()) { + HANDLE_ERROR(cx, *err); + return false; + } + + JS::SetReservedSlot(entry, Slots::Handle, JS::Int32Value(res.unwrap().handle)); + args.rval().setObject(*entry); + return true; +} + const JSFunctionSpec SecretStore::static_methods[] = { + JS_FN("fromBytes", from_bytes, 1, JSPROP_ENUMERATE), JS_FS_END, }; diff --git a/runtime/js-compute-runtime/builtins/secret-store.h b/runtime/js-compute-runtime/builtins/secret-store.h index 656824b133..99f26e62fd 100644 --- a/runtime/js-compute-runtime/builtins/secret-store.h +++ b/runtime/js-compute-runtime/builtins/secret-store.h @@ -19,6 +19,7 @@ class SecretStoreEntry : public BuiltinImpl { static const JSPropertySpec properties[]; static bool plaintext(JSContext *cx, unsigned argc, JS::Value *vp); + static bool raw_bytes(JSContext *cx, unsigned argc, JS::Value *vp); static host_api::Secret secret_handle(JSObject *obj); static bool constructor(JSContext *cx, unsigned argc, JS::Value *vp); @@ -39,6 +40,7 @@ class SecretStore : public BuiltinImpl { static const JSPropertySpec properties[]; static bool get(JSContext *cx, unsigned argc, JS::Value *vp); + static bool from_bytes(JSContext *cx, unsigned argc, JS::Value *vp); static host_api::SecretStore secret_store_handle(JSObject *obj); static bool constructor(JSContext *cx, unsigned argc, JS::Value *vp); diff --git a/runtime/js-compute-runtime/error-numbers.msg b/runtime/js-compute-runtime/error-numbers.msg index d4fc4c74a7..07a3a24370 100644 --- a/runtime/js-compute-runtime/error-numbers.msg +++ b/runtime/js-compute-runtime/error-numbers.msg @@ -76,6 +76,7 @@ MSG_DEF(JSMSG_SECRET_STORE_NAME_CONTAINS_INVALID_CHARACTER, 0, JSEXN_TYPEERR, MSG_DEF(JSMSG_SECRET_STORE_NAME_EMPTY, 0, JSEXN_TYPEERR, "SecretStore constructor: name can not be an empty string") MSG_DEF(JSMSG_SECRET_STORE_NAME_START_WITH_ASCII_ALPHA, 0, JSEXN_TYPEERR, "SecretStore constructor: name must start with an ascii alpabetical character") MSG_DEF(JSMSG_SECRET_STORE_NAME_TOO_LONG, 0, JSEXN_TYPEERR, "SecretStore constructor: name can not be more than 255 characters") +MSG_DEF(JSMSG_SECRET_STORE_FROM_BYTES_INVALID_BUFFER, 0, JSEXN_TYPEERR, "SecretStore.fromBytes: bytes must be an ArrayBuffer or ArrayBufferView object") MSG_DEF(JSMSG_READABLE_STREAM_LOCKED_OR_DISTRUBED, 0, JSEXN_TYPEERR, "Can't use a ReadableStream that's locked or has ever been read from or canceled") MSG_DEF(JSMSG_INVALID_CHARACTER_ERROR, 0, JSEXN_ERR, "String contains an invalid character") MSG_DEF(JSMSG_BACKEND_FROMNAME_BACKEND_DOES_NOT_EXIST, 1, JSEXN_ERR, "Backend.fromName: backend named '{0}' does not exist") @@ -99,6 +100,10 @@ MSG_DEF(JSMSG_BACKEND_TLS_MIN_INVALID, 0, JSEXN_RANGEERR MSG_DEF(JSMSG_BACKEND_TLS_MAX_INVALID, 0, JSEXN_RANGEERR, "Backend constructor: tlsMaxVersion must be either 1, 1.1, 1.2, or 1.3") MSG_DEF(JSMSG_BACKEND_TLS_MIN_GREATER_THAN_TLS_MAX, 0, JSEXN_RANGEERR, "Backend constructor: tlsMinVersion must be less than or equal to tlsMaxVersion") MSG_DEF(JSMSG_BACKEND_PORT_INVALID, 0, JSEXN_RANGEERR, "Backend constructor: port must be more than 0 and less than 2^16 (65,536)") +MSG_DEF(JSMSG_BACKEND_CLIENT_CERTIFICATE_NOT_OBJECT, 0, JSEXN_TYPEERR, "Backend constructor: clientCertificate must be an object containing 'certificate' and 'key' properties") +MSG_DEF(JSMSG_BACKEND_CLIENT_CERTIFICATE_NO_CERTIFICATE, 0, JSEXN_TYPEERR, "Backend constructor: clientCertificate 'certificate' must be a certificate string") +MSG_DEF(JSMSG_BACKEND_CLIENT_CERTIFICATE_CERTIFICATE_EMPTY, 0, JSEXN_TYPEERR, "Backend constructor: clientCertificate 'certificate' can not be an empty string") +MSG_DEF(JSMSG_BACKEND_CLIENT_CERTIFICATE_KEY_INVALID, 0, JSEXN_TYPEERR, "Backend constructor: clientCertificate 'key' must be a SecretStoreEntry instance") MSG_DEF(JSMSG_CACHE_OVERRIDE_MODE_INVALID, 1, JSEXN_TYPEERR, "CacheOverride constructor: 'mode' has to be \"none\", \"pass\", or \"override\", but got \"{0}\"") MSG_DEF(JSMSG_RESPONSE_VALUE_NOT_UINT8ARRAY, 0, JSEXN_TYPEERR, "Can't convert value to Uint8Array while consuming Body") MSG_DEF(JSMSG_RESPONSE_BODY_DISTURBED_OR_LOCKED, 0, JSEXN_TYPEERR, "Response body object should not be disturbed or locked") diff --git a/runtime/js-compute-runtime/host_interface/component/fastly_world.c b/runtime/js-compute-runtime/host_interface/component/fastly_world.c index 77bd5f8a99..0586e1ca60 100644 --- a/runtime/js-compute-runtime/host_interface/component/fastly_world.c +++ b/runtime/js-compute-runtime/host_interface/component/fastly_world.c @@ -1,845 +1,403 @@ -// Generated by `wit-bindgen` 0.9.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.26.0. DO NOT EDIT! #include "fastly_world.h" +#include +#include - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_uap_user_agent_t ok; - fastly_compute_at_edge_uap_error_t err; - } val; -} fastly_world_result_fastly_compute_at_edge_uap_user_agent_fastly_compute_at_edge_uap_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_http_body_error_t err; - } val; -} fastly_world_result_void_fastly_compute_at_edge_http_body_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_http_body_body_handle_t ok; - fastly_compute_at_edge_http_body_error_t err; - } val; -} fastly_world_result_fastly_compute_at_edge_http_body_body_handle_fastly_compute_at_edge_http_body_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_list_u8_t ok; - fastly_compute_at_edge_http_body_error_t err; - } val; -} fastly_world_result_list_u8_fastly_compute_at_edge_http_body_error_t; - -typedef struct { - bool is_err; - union { - uint32_t ok; - fastly_compute_at_edge_http_body_error_t err; - } val; -} fastly_world_result_u32_fastly_compute_at_edge_http_body_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_log_handle_t ok; - fastly_compute_at_edge_log_error_t err; - } val; -} fastly_world_result_fastly_compute_at_edge_log_handle_fastly_compute_at_edge_log_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_log_error_t err; - } val; -} fastly_world_result_void_fastly_compute_at_edge_log_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_http_req_error_t err; - } val; -} fastly_world_result_void_fastly_compute_at_edge_http_req_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_list_u8_t ok; - fastly_compute_at_edge_http_req_error_t err; - } val; -} fastly_world_result_list_u8_fastly_compute_at_edge_http_req_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_string_t ok; - fastly_compute_at_edge_http_req_error_t err; - } val; -} fastly_world_result_string_fastly_compute_at_edge_http_req_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_http_req_request_handle_t ok; - fastly_compute_at_edge_http_req_error_t err; - } val; -} fastly_world_result_fastly_compute_at_edge_http_req_request_handle_fastly_compute_at_edge_http_req_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_list_string_t ok; - fastly_compute_at_edge_http_req_error_t err; - } val; -} fastly_world_result_list_string_fastly_compute_at_edge_http_req_error_t; - -typedef struct { - bool is_err; - union { - uint32_t ok; - fastly_compute_at_edge_http_req_error_t err; - } val; -} fastly_world_result_u32_fastly_compute_at_edge_http_req_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_option_list_u8_t ok; - fastly_compute_at_edge_http_req_error_t err; - } val; -} fastly_world_result_option_list_u8_fastly_compute_at_edge_http_req_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_option_list_list_u8_t ok; - fastly_compute_at_edge_http_req_error_t err; - } val; -} fastly_world_result_option_list_list_u8_fastly_compute_at_edge_http_req_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_http_req_http_version_t ok; - fastly_compute_at_edge_http_req_error_t err; - } val; -} fastly_world_result_fastly_compute_at_edge_http_req_http_version_fastly_compute_at_edge_http_req_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_http_req_response_t ok; - fastly_compute_at_edge_http_req_error_t err; - } val; -} fastly_world_result_fastly_compute_at_edge_http_req_response_fastly_compute_at_edge_http_req_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_http_req_pending_request_handle_t ok; - fastly_compute_at_edge_http_req_error_t err; - } val; -} fastly_world_result_fastly_compute_at_edge_http_req_pending_request_handle_fastly_compute_at_edge_http_req_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_option_fastly_compute_at_edge_http_req_response_t ok; - fastly_compute_at_edge_http_req_error_t err; - } val; -} fastly_world_result_option_fastly_compute_at_edge_http_req_response_fastly_compute_at_edge_http_req_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_tuple2_u32_fastly_compute_at_edge_http_req_response_t ok; - fastly_compute_at_edge_http_req_error_t err; - } val; -} fastly_world_result_tuple2_u32_fastly_compute_at_edge_http_req_response_fastly_compute_at_edge_http_req_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_tuple2_u32_fastly_compute_at_edge_http_req_response_t ok; - fastly_compute_at_edge_http_req_send_error_detail_t err; - } val; -} fastly_world_result_tuple2_u32_fastly_compute_at_edge_http_req_response_fastly_compute_at_edge_http_req_send_error_detail_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_http_resp_response_handle_t ok; - fastly_compute_at_edge_http_resp_error_t err; - } val; -} fastly_world_result_fastly_compute_at_edge_http_resp_response_handle_fastly_compute_at_edge_http_resp_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_list_string_t ok; - fastly_compute_at_edge_http_resp_error_t err; - } val; -} fastly_world_result_list_string_fastly_compute_at_edge_http_resp_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_option_string_t ok; - fastly_compute_at_edge_http_resp_error_t err; - } val; -} fastly_world_result_option_string_fastly_compute_at_edge_http_resp_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_option_list_list_u8_t ok; - fastly_compute_at_edge_http_resp_error_t err; - } val; -} fastly_world_result_option_list_list_u8_fastly_compute_at_edge_http_resp_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_http_resp_error_t err; - } val; -} fastly_world_result_void_fastly_compute_at_edge_http_resp_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_http_resp_http_version_t ok; - fastly_compute_at_edge_http_resp_error_t err; - } val; -} fastly_world_result_fastly_compute_at_edge_http_resp_http_version_fastly_compute_at_edge_http_resp_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_http_resp_http_status_t ok; - fastly_compute_at_edge_http_resp_error_t err; - } val; -} fastly_world_result_fastly_compute_at_edge_http_resp_http_status_fastly_compute_at_edge_http_resp_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_dictionary_handle_t ok; - fastly_compute_at_edge_dictionary_error_t err; - } val; -} fastly_world_result_fastly_compute_at_edge_dictionary_handle_fastly_compute_at_edge_dictionary_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_option_string_t ok; - fastly_compute_at_edge_dictionary_error_t err; - } val; -} fastly_world_result_option_string_fastly_compute_at_edge_dictionary_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_string_t ok; - fastly_compute_at_edge_geo_error_t err; - } val; -} fastly_world_result_string_fastly_compute_at_edge_geo_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_object_store_handle_t ok; - fastly_compute_at_edge_object_store_error_t err; - } val; -} fastly_world_result_fastly_compute_at_edge_object_store_handle_fastly_compute_at_edge_object_store_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_option_fastly_compute_at_edge_object_store_body_handle_t ok; - fastly_compute_at_edge_object_store_error_t err; - } val; -} fastly_world_result_option_fastly_compute_at_edge_object_store_body_handle_fastly_compute_at_edge_object_store_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_object_store_pending_handle_t ok; - fastly_compute_at_edge_object_store_error_t err; - } val; -} fastly_world_result_fastly_compute_at_edge_object_store_pending_handle_fastly_compute_at_edge_object_store_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_object_store_error_t err; - } val; -} fastly_world_result_void_fastly_compute_at_edge_object_store_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_secret_store_store_handle_t ok; - fastly_compute_at_edge_secret_store_error_t err; - } val; -} fastly_world_result_fastly_compute_at_edge_secret_store_store_handle_fastly_compute_at_edge_secret_store_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_option_fastly_compute_at_edge_secret_store_secret_handle_t ok; - fastly_compute_at_edge_secret_store_error_t err; - } val; -} fastly_world_result_option_fastly_compute_at_edge_secret_store_secret_handle_fastly_compute_at_edge_secret_store_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_option_string_t ok; - fastly_compute_at_edge_secret_store_error_t err; - } val; -} fastly_world_result_option_string_fastly_compute_at_edge_secret_store_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_secret_store_secret_handle_t ok; - fastly_compute_at_edge_secret_store_error_t err; - } val; -} fastly_world_result_fastly_compute_at_edge_secret_store_secret_handle_fastly_compute_at_edge_secret_store_error_t; - -typedef struct { - bool is_err; - union { - bool ok; - fastly_compute_at_edge_backend_error_t err; - } val; -} fastly_world_result_bool_fastly_compute_at_edge_backend_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_backend_backend_health_t ok; - fastly_compute_at_edge_backend_error_t err; - } val; -} fastly_world_result_fastly_compute_at_edge_backend_backend_health_fastly_compute_at_edge_backend_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_string_t ok; - fastly_compute_at_edge_backend_error_t err; - } val; -} fastly_world_result_string_fastly_compute_at_edge_backend_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_option_string_t ok; - fastly_compute_at_edge_backend_error_t err; - } val; -} fastly_world_result_option_string_fastly_compute_at_edge_backend_error_t; - -typedef struct { - bool is_err; - union { - uint16_t ok; - fastly_compute_at_edge_backend_error_t err; - } val; -} fastly_world_result_u16_fastly_compute_at_edge_backend_error_t; - -typedef struct { - bool is_err; - union { - uint32_t ok; - fastly_compute_at_edge_backend_error_t err; - } val; -} fastly_world_result_u32_fastly_compute_at_edge_backend_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_backend_tls_version_t ok; - fastly_compute_at_edge_backend_error_t err; - } val; -} fastly_world_result_fastly_compute_at_edge_backend_tls_version_fastly_compute_at_edge_backend_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_option_u32_t ok; - fastly_compute_at_edge_async_io_error_t err; - } val; -} fastly_world_result_option_u32_fastly_compute_at_edge_async_io_error_t; - -typedef struct { - bool is_err; - union { - bool ok; - fastly_compute_at_edge_async_io_error_t err; - } val; -} fastly_world_result_bool_fastly_compute_at_edge_async_io_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_option_string_t ok; - fastly_compute_at_edge_purge_error_t err; - } val; -} fastly_world_result_option_string_fastly_compute_at_edge_purge_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_cache_handle_t ok; - fastly_compute_at_edge_cache_error_t err; - } val; -} fastly_world_result_fastly_compute_at_edge_cache_handle_fastly_compute_at_edge_cache_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_cache_body_handle_t ok; - fastly_compute_at_edge_cache_error_t err; - } val; -} fastly_world_result_fastly_compute_at_edge_cache_body_handle_fastly_compute_at_edge_cache_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_tuple2_fastly_compute_at_edge_cache_body_handle_fastly_compute_at_edge_cache_handle_t ok; - fastly_compute_at_edge_cache_error_t err; - } val; -} fastly_world_result_tuple2_fastly_compute_at_edge_cache_body_handle_fastly_compute_at_edge_cache_handle_fastly_compute_at_edge_cache_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_cache_error_t err; - } val; -} fastly_world_result_void_fastly_compute_at_edge_cache_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_cache_lookup_state_t ok; - fastly_compute_at_edge_cache_error_t err; - } val; -} fastly_world_result_fastly_compute_at_edge_cache_lookup_state_fastly_compute_at_edge_cache_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_list_u8_t ok; - fastly_compute_at_edge_cache_error_t err; - } val; -} fastly_world_result_list_u8_fastly_compute_at_edge_cache_error_t; - -typedef struct { - bool is_err; - union { - uint64_t ok; - fastly_compute_at_edge_cache_error_t err; - } val; -} fastly_world_result_u64_fastly_compute_at_edge_cache_error_t; - -typedef struct { - bool is_err; - union { - bool ok; - fastly_compute_at_edge_edge_rate_limiter_error_t err; - } val; -} fastly_world_result_bool_fastly_compute_at_edge_edge_rate_limiter_error_t; - -typedef struct { - bool is_err; - union { - fastly_compute_at_edge_edge_rate_limiter_error_t err; - } val; -} fastly_world_result_void_fastly_compute_at_edge_edge_rate_limiter_error_t; - -typedef struct { - bool is_err; - union { - uint32_t ok; - fastly_compute_at_edge_edge_rate_limiter_error_t err; - } val; -} fastly_world_result_u32_fastly_compute_at_edge_edge_rate_limiter_error_t; - -typedef struct { - bool is_err; - union { - fastly_world_string_t ok; - fastly_compute_at_edge_device_detection_error_t err; - } val; -} fastly_world_result_string_fastly_compute_at_edge_device_detection_error_t; - -typedef struct { - bool is_err; - union { - } val; -} fastly_world_result_void_void_t; +// Imported Functions from `fastly:compute-at-edge/async-io` __attribute__((__import_module__("fastly:compute-at-edge/async-io"), __import_name__("select"))) -void __wasm_import_fastly_compute_at_edge_async_io_select(int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_async_io_select(uint8_t *, size_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/async-io"), __import_name__("is-ready"))) -void __wasm_import_fastly_compute_at_edge_async_io_is_ready(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_async_io_is_ready(int32_t, uint8_t *); + +// Imported Functions from `fastly:compute-at-edge/backend` __attribute__((__import_module__("fastly:compute-at-edge/backend"), __import_name__("exists"))) -void __wasm_import_fastly_compute_at_edge_backend_exists(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_backend_exists(uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/backend"), __import_name__("is-healthy"))) -void __wasm_import_fastly_compute_at_edge_backend_is_healthy(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_backend_is_healthy(uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/backend"), __import_name__("is-dynamic"))) -void __wasm_import_fastly_compute_at_edge_backend_is_dynamic(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_backend_is_dynamic(uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/backend"), __import_name__("get-host"))) -void __wasm_import_fastly_compute_at_edge_backend_get_host(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_backend_get_host(uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/backend"), __import_name__("get-override-host"))) -void __wasm_import_fastly_compute_at_edge_backend_get_override_host(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_backend_get_override_host(uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/backend"), __import_name__("get-port"))) -void __wasm_import_fastly_compute_at_edge_backend_get_port(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_backend_get_port(uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/backend"), __import_name__("get-connect-timeout-ms"))) -void __wasm_import_fastly_compute_at_edge_backend_get_connect_timeout_ms(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_backend_get_connect_timeout_ms(uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/backend"), __import_name__("get-first-byte-timeout-ms"))) -void __wasm_import_fastly_compute_at_edge_backend_get_first_byte_timeout_ms(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_backend_get_first_byte_timeout_ms(uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/backend"), __import_name__("get-between-bytes-timeout-ms"))) -void __wasm_import_fastly_compute_at_edge_backend_get_between_bytes_timeout_ms(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_backend_get_between_bytes_timeout_ms(uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/backend"), __import_name__("is-ssl"))) -void __wasm_import_fastly_compute_at_edge_backend_is_ssl(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_backend_is_ssl(uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/backend"), __import_name__("get-ssl-min-version"))) -void __wasm_import_fastly_compute_at_edge_backend_get_ssl_min_version(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_backend_get_ssl_min_version(uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/backend"), __import_name__("get-ssl-max-version"))) -void __wasm_import_fastly_compute_at_edge_backend_get_ssl_max_version(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_backend_get_ssl_max_version(uint8_t *, size_t, uint8_t *); + +// Imported Functions from `fastly:compute-at-edge/cache` __attribute__((__import_module__("fastly:compute-at-edge/cache"), __import_name__("lookup"))) -void __wasm_import_fastly_compute_at_edge_cache_lookup(int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_cache_lookup(uint8_t *, size_t, int32_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/cache"), __import_name__("insert"))) -void __wasm_import_fastly_compute_at_edge_cache_insert(int32_t, int32_t, int64_t, int32_t, int32_t, int32_t, int64_t, int64_t, int32_t, int32_t, int64_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_cache_insert(uint8_t *, size_t, int64_t, int32_t, uint8_t *, size_t, int64_t, int64_t, uint8_t *, size_t, int64_t, uint8_t *, size_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/cache"), __import_name__("transaction-lookup"))) -void __wasm_import_fastly_compute_at_edge_cache_transaction_lookup(int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_cache_transaction_lookup(uint8_t *, size_t, int32_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/cache"), __import_name__("transaction-insert"))) -void __wasm_import_fastly_compute_at_edge_cache_transaction_insert(int32_t, int64_t, int32_t, int32_t, int32_t, int64_t, int64_t, int32_t, int32_t, int64_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_cache_transaction_insert(int32_t, int64_t, int32_t, uint8_t *, size_t, int64_t, int64_t, uint8_t *, size_t, int64_t, uint8_t *, size_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/cache"), __import_name__("transaction-insert-and-stream-back"))) -void __wasm_import_fastly_compute_at_edge_cache_transaction_insert_and_stream_back(int32_t, int64_t, int32_t, int32_t, int32_t, int64_t, int64_t, int32_t, int32_t, int64_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_cache_transaction_insert_and_stream_back(int32_t, int64_t, int32_t, uint8_t *, size_t, int64_t, int64_t, uint8_t *, size_t, int64_t, uint8_t *, size_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/cache"), __import_name__("transaction-update"))) -void __wasm_import_fastly_compute_at_edge_cache_transaction_update(int32_t, int64_t, int32_t, int32_t, int32_t, int64_t, int64_t, int32_t, int32_t, int64_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_cache_transaction_update(int32_t, int64_t, int32_t, uint8_t *, size_t, int64_t, int64_t, uint8_t *, size_t, int64_t, uint8_t *, size_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/cache"), __import_name__("transaction-cancel"))) -void __wasm_import_fastly_compute_at_edge_cache_transaction_cancel(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_cache_transaction_cancel(int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/cache"), __import_name__("close"))) -void __wasm_import_fastly_compute_at_edge_cache_close(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_cache_close(int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/cache"), __import_name__("get-state"))) -void __wasm_import_fastly_compute_at_edge_cache_get_state(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_cache_get_state(int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/cache"), __import_name__("get-user-metadata"))) -void __wasm_import_fastly_compute_at_edge_cache_get_user_metadata(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_cache_get_user_metadata(int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/cache"), __import_name__("get-body"))) -void __wasm_import_fastly_compute_at_edge_cache_get_body(int32_t, int64_t, int64_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_cache_get_body(int32_t, int64_t, int64_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/cache"), __import_name__("get-length"))) -void __wasm_import_fastly_compute_at_edge_cache_get_length(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_cache_get_length(int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/cache"), __import_name__("get-max-age-ns"))) -void __wasm_import_fastly_compute_at_edge_cache_get_max_age_ns(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_cache_get_max_age_ns(int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/cache"), __import_name__("get-stale-while-revalidate-ns"))) -void __wasm_import_fastly_compute_at_edge_cache_get_stale_while_revalidate_ns(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_cache_get_stale_while_revalidate_ns(int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/cache"), __import_name__("get-age-ns"))) -void __wasm_import_fastly_compute_at_edge_cache_get_age_ns(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_cache_get_age_ns(int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/cache"), __import_name__("get-hits"))) -void __wasm_import_fastly_compute_at_edge_cache_get_hits(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_cache_get_hits(int32_t, uint8_t *); + +// Imported Functions from `fastly:compute-at-edge/device-detection` __attribute__((__import_module__("fastly:compute-at-edge/device-detection"), __import_name__("lookup"))) -void __wasm_import_fastly_compute_at_edge_device_detection_lookup(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_device_detection_lookup(uint8_t *, size_t, uint8_t *); + +// Imported Functions from `fastly:compute-at-edge/dictionary` __attribute__((__import_module__("fastly:compute-at-edge/dictionary"), __import_name__("open"))) -void __wasm_import_fastly_compute_at_edge_dictionary_open(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_dictionary_open(uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/dictionary"), __import_name__("get"))) -void __wasm_import_fastly_compute_at_edge_dictionary_get(int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_dictionary_get(int32_t, uint8_t *, size_t, uint8_t *); + +// Imported Functions from `fastly:compute-at-edge/edge-rate-limiter` __attribute__((__import_module__("fastly:compute-at-edge/edge-rate-limiter"), __import_name__("check-rate"))) -void __wasm_import_fastly_compute_at_edge_edge_rate_limiter_check_rate(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_fastly_compute_at_edge_edge_rate_limiter_check_rate(uint8_t *, size_t, uint8_t *, size_t, int32_t, int32_t, int32_t, uint8_t *, size_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/edge-rate-limiter"), __import_name__("ratecounter-increment"))) -void __wasm_import_fastly_compute_at_edge_edge_rate_limiter_ratecounter_increment(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_edge_rate_limiter_ratecounter_increment(uint8_t *, size_t, uint8_t *, size_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/edge-rate-limiter"), __import_name__("ratecounter-lookup-rate"))) -void __wasm_import_fastly_compute_at_edge_edge_rate_limiter_ratecounter_lookup_rate(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_edge_rate_limiter_ratecounter_lookup_rate(uint8_t *, size_t, uint8_t *, size_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/edge-rate-limiter"), __import_name__("ratecounter-lookup-count"))) -void __wasm_import_fastly_compute_at_edge_edge_rate_limiter_ratecounter_lookup_count(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_edge_rate_limiter_ratecounter_lookup_count(uint8_t *, size_t, uint8_t *, size_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/edge-rate-limiter"), __import_name__("penaltybox-add"))) -void __wasm_import_fastly_compute_at_edge_edge_rate_limiter_penaltybox_add(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_edge_rate_limiter_penaltybox_add(uint8_t *, size_t, uint8_t *, size_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/edge-rate-limiter"), __import_name__("penaltybox-has"))) -void __wasm_import_fastly_compute_at_edge_edge_rate_limiter_penaltybox_has(int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_edge_rate_limiter_penaltybox_has(uint8_t *, size_t, uint8_t *, size_t, uint8_t *); + +// Imported Functions from `fastly:compute-at-edge/geo` __attribute__((__import_module__("fastly:compute-at-edge/geo"), __import_name__("lookup"))) -void __wasm_import_fastly_compute_at_edge_geo_lookup(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_geo_lookup(uint8_t *, size_t, uint8_t *); + +// Imported Functions from `fastly:compute-at-edge/http-body` __attribute__((__import_module__("fastly:compute-at-edge/http-body"), __import_name__("append"))) -void __wasm_import_fastly_compute_at_edge_http_body_append(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_body_append(int32_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-body"), __import_name__("new"))) -void __wasm_import_fastly_compute_at_edge_http_body_new(int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_body_new(uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-body"), __import_name__("read"))) -void __wasm_import_fastly_compute_at_edge_http_body_read(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_body_read(int32_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-body"), __import_name__("write"))) -void __wasm_import_fastly_compute_at_edge_http_body_write(int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_body_write(int32_t, uint8_t *, size_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-body"), __import_name__("close"))) -void __wasm_import_fastly_compute_at_edge_http_body_close(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_body_close(int32_t, uint8_t *); + +// Imported Functions from `fastly:compute-at-edge/http-req` __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("cache-override-set"))) -void __wasm_import_fastly_compute_at_edge_http_req_cache_override_set(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_cache_override_set(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("downstream-client-ip-addr"))) -void __wasm_import_fastly_compute_at_edge_http_req_downstream_client_ip_addr(int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_downstream_client_ip_addr(uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("downstream-client-request-id"))) -void __wasm_import_fastly_compute_at_edge_http_req_downstream_client_request_id(int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_downstream_client_request_id(uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("downstream-client-h2-fingerprint"))) -void __wasm_import_fastly_compute_at_edge_http_req_downstream_client_h2_fingerprint(int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_downstream_client_h2_fingerprint(uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("downstream-tls-cipher-openssl-name"))) -void __wasm_import_fastly_compute_at_edge_http_req_downstream_tls_cipher_openssl_name(int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_downstream_tls_cipher_openssl_name(uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("downstream-tls-protocol"))) -void __wasm_import_fastly_compute_at_edge_http_req_downstream_tls_protocol(int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_downstream_tls_protocol(uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("downstream-tls-client-hello"))) -void __wasm_import_fastly_compute_at_edge_http_req_downstream_tls_client_hello(int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_downstream_tls_client_hello(uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("downstream-tls-raw-client-certificate"))) -void __wasm_import_fastly_compute_at_edge_http_req_downstream_tls_raw_client_certificate(int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_downstream_tls_raw_client_certificate(uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("downstream-tls-client-cert-verify-result"))) -void __wasm_import_fastly_compute_at_edge_http_req_downstream_tls_client_cert_verify_result(int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_downstream_tls_client_cert_verify_result(uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("downstream-tls-ja3-md5"))) -void __wasm_import_fastly_compute_at_edge_http_req_downstream_tls_ja3_md5(int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_downstream_tls_ja3_md5(uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("new"))) -void __wasm_import_fastly_compute_at_edge_http_req_new(int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_new(uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("header-names-get"))) -void __wasm_import_fastly_compute_at_edge_http_req_header_names_get(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_header_names_get(int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("original-header-names-get"))) -void __wasm_import_fastly_compute_at_edge_http_req_original_header_names_get(int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_original_header_names_get(uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("original-header-count"))) -void __wasm_import_fastly_compute_at_edge_http_req_original_header_count(int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_original_header_count(uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("header-value-get"))) -void __wasm_import_fastly_compute_at_edge_http_req_header_value_get(int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_header_value_get(int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("header-values-get"))) -void __wasm_import_fastly_compute_at_edge_http_req_header_values_get(int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_header_values_get(int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("header-values-set"))) -void __wasm_import_fastly_compute_at_edge_http_req_header_values_set(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_header_values_set(int32_t, uint8_t *, size_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("header-insert"))) -void __wasm_import_fastly_compute_at_edge_http_req_header_insert(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_header_insert(int32_t, uint8_t *, size_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("header-append"))) -void __wasm_import_fastly_compute_at_edge_http_req_header_append(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_header_append(int32_t, uint8_t *, size_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("header-remove"))) -void __wasm_import_fastly_compute_at_edge_http_req_header_remove(int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_header_remove(int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("method-get"))) -void __wasm_import_fastly_compute_at_edge_http_req_method_get(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_method_get(int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("method-set"))) -void __wasm_import_fastly_compute_at_edge_http_req_method_set(int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_method_set(int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("uri-get"))) -void __wasm_import_fastly_compute_at_edge_http_req_uri_get(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_uri_get(int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("uri-set"))) -void __wasm_import_fastly_compute_at_edge_http_req_uri_set(int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_uri_set(int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("version-get"))) -void __wasm_import_fastly_compute_at_edge_http_req_version_get(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_version_get(int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("version-set"))) -void __wasm_import_fastly_compute_at_edge_http_req_version_set(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_version_set(int32_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("send"))) -void __wasm_import_fastly_compute_at_edge_http_req_send(int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_send(int32_t, int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("send-v2"))) -void __wasm_import_fastly_compute_at_edge_http_req_send_v2(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_send_v2(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("send-async"))) -void __wasm_import_fastly_compute_at_edge_http_req_send_async(int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_send_async(int32_t, int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("send-async-streaming"))) -void __wasm_import_fastly_compute_at_edge_http_req_send_async_streaming(int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_send_async_streaming(int32_t, int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("pending-req-poll"))) -void __wasm_import_fastly_compute_at_edge_http_req_pending_req_poll(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_pending_req_poll(int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("pending-req-poll-v2"))) -void __wasm_import_fastly_compute_at_edge_http_req_pending_req_poll_v2(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_pending_req_poll_v2(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("pending-req-wait"))) -void __wasm_import_fastly_compute_at_edge_http_req_pending_req_wait(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_pending_req_wait(int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("pending-req-wait-v2"))) -void __wasm_import_fastly_compute_at_edge_http_req_pending_req_wait_v2(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_pending_req_wait_v2(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("pending-req-select"))) -void __wasm_import_fastly_compute_at_edge_http_req_pending_req_select(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_pending_req_select(uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("pending-req-select-v2"))) -void __wasm_import_fastly_compute_at_edge_http_req_pending_req_select_v2(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_pending_req_select_v2(uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("close"))) -void __wasm_import_fastly_compute_at_edge_http_req_close(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_close(int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("auto-decompress-response-set"))) -void __wasm_import_fastly_compute_at_edge_http_req_auto_decompress_response_set(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_auto_decompress_response_set(int32_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("upgrade-websocket"))) -void __wasm_import_fastly_compute_at_edge_http_req_upgrade_websocket(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_upgrade_websocket(uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("redirect-to-websocket-proxy"))) -void __wasm_import_fastly_compute_at_edge_http_req_redirect_to_websocket_proxy(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_redirect_to_websocket_proxy(uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("redirect-to-grip-proxy"))) -void __wasm_import_fastly_compute_at_edge_http_req_redirect_to_grip_proxy(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_redirect_to_grip_proxy(uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("framing-headers-mode-set"))) -void __wasm_import_fastly_compute_at_edge_http_req_framing_headers_mode_set(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_framing_headers_mode_set(int32_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-req"), __import_name__("register-dynamic-backend"))) -void __wasm_import_fastly_compute_at_edge_http_req_register_dynamic_backend(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_req_register_dynamic_backend(uint8_t *, uint8_t *); + +// Imported Functions from `fastly:compute-at-edge/http-resp` __attribute__((__import_module__("fastly:compute-at-edge/http-resp"), __import_name__("new"))) -void __wasm_import_fastly_compute_at_edge_http_resp_new(int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_resp_new(uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-resp"), __import_name__("header-names-get"))) -void __wasm_import_fastly_compute_at_edge_http_resp_header_names_get(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_resp_header_names_get(int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-resp"), __import_name__("header-value-get"))) -void __wasm_import_fastly_compute_at_edge_http_resp_header_value_get(int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_resp_header_value_get(int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-resp"), __import_name__("header-values-get"))) -void __wasm_import_fastly_compute_at_edge_http_resp_header_values_get(int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_resp_header_values_get(int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-resp"), __import_name__("header-values-set"))) -void __wasm_import_fastly_compute_at_edge_http_resp_header_values_set(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_resp_header_values_set(int32_t, uint8_t *, size_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-resp"), __import_name__("header-insert"))) -void __wasm_import_fastly_compute_at_edge_http_resp_header_insert(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_resp_header_insert(int32_t, uint8_t *, size_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-resp"), __import_name__("header-append"))) -void __wasm_import_fastly_compute_at_edge_http_resp_header_append(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_resp_header_append(int32_t, uint8_t *, size_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-resp"), __import_name__("header-remove"))) -void __wasm_import_fastly_compute_at_edge_http_resp_header_remove(int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_resp_header_remove(int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-resp"), __import_name__("version-get"))) -void __wasm_import_fastly_compute_at_edge_http_resp_version_get(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_resp_version_get(int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-resp"), __import_name__("version-set"))) -void __wasm_import_fastly_compute_at_edge_http_resp_version_set(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_resp_version_set(int32_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-resp"), __import_name__("send-downstream"))) -void __wasm_import_fastly_compute_at_edge_http_resp_send_downstream(int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_resp_send_downstream(int32_t, int32_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-resp"), __import_name__("status-get"))) -void __wasm_import_fastly_compute_at_edge_http_resp_status_get(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_resp_status_get(int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-resp"), __import_name__("status-set"))) -void __wasm_import_fastly_compute_at_edge_http_resp_status_set(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_resp_status_set(int32_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-resp"), __import_name__("close"))) -void __wasm_import_fastly_compute_at_edge_http_resp_close(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_resp_close(int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-resp"), __import_name__("framing-headers-mode-set"))) -void __wasm_import_fastly_compute_at_edge_http_resp_framing_headers_mode_set(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_resp_framing_headers_mode_set(int32_t, int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/http-resp"), __import_name__("http-keepalive-mode-set"))) -void __wasm_import_fastly_compute_at_edge_http_resp_http_keepalive_mode_set(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_http_resp_http_keepalive_mode_set(int32_t, int32_t, uint8_t *); + +// Imported Functions from `fastly:compute-at-edge/log` __attribute__((__import_module__("fastly:compute-at-edge/log"), __import_name__("endpoint-get"))) -void __wasm_import_fastly_compute_at_edge_log_endpoint_get(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_log_endpoint_get(uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/log"), __import_name__("write"))) -void __wasm_import_fastly_compute_at_edge_log_write(int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_log_write(int32_t, uint8_t *, size_t, uint8_t *); + +// Imported Functions from `fastly:compute-at-edge/object-store` __attribute__((__import_module__("fastly:compute-at-edge/object-store"), __import_name__("open"))) -void __wasm_import_fastly_compute_at_edge_object_store_open(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_object_store_open(uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/object-store"), __import_name__("lookup"))) -void __wasm_import_fastly_compute_at_edge_object_store_lookup(int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_object_store_lookup(int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/object-store"), __import_name__("lookup-async"))) -void __wasm_import_fastly_compute_at_edge_object_store_lookup_async(int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_object_store_lookup_async(int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/object-store"), __import_name__("pending-lookup-wait"))) -void __wasm_import_fastly_compute_at_edge_object_store_pending_lookup_wait(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_object_store_pending_lookup_wait(int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/object-store"), __import_name__("delete-async"))) -void __wasm_import_fastly_compute_at_edge_object_store_delete_async(int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_object_store_delete_async(int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/object-store"), __import_name__("pending-delete-wait"))) -void __wasm_import_fastly_compute_at_edge_object_store_pending_delete_wait(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_object_store_pending_delete_wait(int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/object-store"), __import_name__("insert"))) -void __wasm_import_fastly_compute_at_edge_object_store_insert(int32_t, int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_object_store_insert(int32_t, uint8_t *, size_t, int32_t, uint8_t *); + +// Imported Functions from `fastly:compute-at-edge/purge` __attribute__((__import_module__("fastly:compute-at-edge/purge"), __import_name__("surrogate-key"))) -void __wasm_import_fastly_compute_at_edge_purge_surrogate_key(int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_purge_surrogate_key(uint8_t *, size_t, int32_t, uint8_t *); + +// Imported Functions from `fastly:compute-at-edge/secret-store` __attribute__((__import_module__("fastly:compute-at-edge/secret-store"), __import_name__("open"))) -void __wasm_import_fastly_compute_at_edge_secret_store_open(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_secret_store_open(uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/secret-store"), __import_name__("get"))) -void __wasm_import_fastly_compute_at_edge_secret_store_get(int32_t, int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_secret_store_get(int32_t, uint8_t *, size_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/secret-store"), __import_name__("plaintext"))) -void __wasm_import_fastly_compute_at_edge_secret_store_plaintext(int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_secret_store_plaintext(int32_t, uint8_t *); __attribute__((__import_module__("fastly:compute-at-edge/secret-store"), __import_name__("from-bytes"))) -void __wasm_import_fastly_compute_at_edge_secret_store_from_bytes(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_secret_store_from_bytes(uint8_t *, size_t, uint8_t *); + +// Imported Functions from `fastly:compute-at-edge/uap` __attribute__((__import_module__("fastly:compute-at-edge/uap"), __import_name__("parse"))) -void __wasm_import_fastly_compute_at_edge_uap_parse(int32_t, int32_t, int32_t); +extern void __wasm_import_fastly_compute_at_edge_uap_parse(uint8_t *, size_t, uint8_t *); + +// Exported Functions from `fastly:compute-at-edge/reactor` + + +// 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) { + (void) old_size; if (new_size == 0) return (void*) align; void *ret = realloc(ptr, new_size); if (!ret) abort(); @@ -848,17 +406,17 @@ void *cabi_realloc(void *ptr, size_t old_size, size_t align, size_t new_size) { // Component Adapters -bool fastly_compute_at_edge_async_io_select(fastly_world_list_fastly_compute_at_edge_async_io_handle_t *hs, uint32_t timeout_ms, fastly_world_option_u32_t *ret, fastly_compute_at_edge_async_io_error_t *err) { +bool fastly_compute_at_edge_async_io_select(fastly_world_list_handle_t *hs, uint32_t timeout_ms, fastly_world_option_u32_t *ret, fastly_compute_at_edge_async_io_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_async_io_select((int32_t) (*hs).ptr, (int32_t) (*hs).len, (int32_t) (timeout_ms), ptr); - fastly_world_result_option_u32_fastly_compute_at_edge_async_io_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_async_io_select((uint8_t *) (*hs).ptr, (*hs).len, (int32_t) (timeout_ms), ptr); + fastly_compute_at_edge_async_io_result_option_u32_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; fastly_world_option_u32_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 4)))) { + switch ((int32_t) *((uint8_t*) (ptr + 4))) { case 0: { option.is_some = false; break; @@ -869,13 +427,13 @@ bool fastly_compute_at_edge_async_io_select(fastly_world_list_fastly_compute_at_ 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; } } @@ -891,18 +449,18 @@ bool fastly_compute_at_edge_async_io_select(fastly_world_list_fastly_compute_at_ bool fastly_compute_at_edge_async_io_is_ready(fastly_compute_at_edge_async_io_handle_t handle, bool *ret, fastly_compute_at_edge_async_io_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_async_io_is_ready((int32_t) (handle), ptr); - fastly_world_result_bool_fastly_compute_at_edge_async_io_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_async_io_result_bool_error_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; } } @@ -918,18 +476,18 @@ bool fastly_compute_at_edge_async_io_is_ready(fastly_compute_at_edge_async_io_ha bool fastly_compute_at_edge_backend_exists(fastly_world_string_t *backend, bool *ret, fastly_compute_at_edge_backend_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_backend_exists((int32_t) (*backend).ptr, (int32_t) (*backend).len, ptr); - fastly_world_result_bool_fastly_compute_at_edge_backend_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_backend_exists((uint8_t *) (*backend).ptr, (*backend).len, ptr); + fastly_compute_at_edge_backend_result_bool_error_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; } } @@ -945,18 +503,18 @@ bool fastly_compute_at_edge_backend_exists(fastly_world_string_t *backend, bool bool fastly_compute_at_edge_backend_is_healthy(fastly_world_string_t *backend, fastly_compute_at_edge_backend_backend_health_t *ret, fastly_compute_at_edge_backend_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_backend_is_healthy((int32_t) (*backend).ptr, (int32_t) (*backend).len, ptr); - fastly_world_result_fastly_compute_at_edge_backend_backend_health_fastly_compute_at_edge_backend_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_backend_is_healthy((uint8_t *) (*backend).ptr, (*backend).len, ptr); + fastly_compute_at_edge_backend_result_backend_health_error_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; } } @@ -972,18 +530,18 @@ bool fastly_compute_at_edge_backend_is_healthy(fastly_world_string_t *backend, f bool fastly_compute_at_edge_backend_is_dynamic(fastly_world_string_t *backend, bool *ret, fastly_compute_at_edge_backend_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_backend_is_dynamic((int32_t) (*backend).ptr, (int32_t) (*backend).len, ptr); - fastly_world_result_bool_fastly_compute_at_edge_backend_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_backend_is_dynamic((uint8_t *) (*backend).ptr, (*backend).len, ptr); + fastly_compute_at_edge_backend_result_bool_error_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; } } @@ -999,18 +557,18 @@ bool fastly_compute_at_edge_backend_is_dynamic(fastly_world_string_t *backend, b bool fastly_compute_at_edge_backend_get_host(fastly_world_string_t *backend, fastly_world_string_t *ret, fastly_compute_at_edge_backend_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_backend_get_host((int32_t) (*backend).ptr, (int32_t) (*backend).len, ptr); - fastly_world_result_string_fastly_compute_at_edge_backend_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_backend_get_host((uint8_t *) (*backend).ptr, (*backend).len, ptr); + fastly_compute_at_edge_backend_result_string_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (fastly_world_string_t) { (char*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + result.val.ok = (fastly_world_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; } } @@ -1026,31 +584,31 @@ bool fastly_compute_at_edge_backend_get_host(fastly_world_string_t *backend, fas bool fastly_compute_at_edge_backend_get_override_host(fastly_world_string_t *backend, fastly_world_option_string_t *ret, fastly_compute_at_edge_backend_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_backend_get_override_host((int32_t) (*backend).ptr, (int32_t) (*backend).len, ptr); - fastly_world_result_option_string_fastly_compute_at_edge_backend_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_backend_get_override_host((uint8_t *) (*backend).ptr, (*backend).len, ptr); + fastly_compute_at_edge_backend_result_option_string_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; fastly_world_option_string_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 4)))) { + switch ((int32_t) *((uint8_t*) (ptr + 4))) { case 0: { option.is_some = false; break; } case 1: { option.is_some = true; - option.val = (fastly_world_string_t) { (char*)(*((int32_t*) (ptr + 8))), (size_t)(*((int32_t*) (ptr + 12))) }; + option.val = (fastly_world_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 8))), (*((size_t*) (ptr + 12))) }; 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; } } @@ -1066,18 +624,18 @@ bool fastly_compute_at_edge_backend_get_override_host(fastly_world_string_t *bac bool fastly_compute_at_edge_backend_get_port(fastly_world_string_t *backend, uint16_t *ret, fastly_compute_at_edge_backend_error_t *err) { __attribute__((__aligned__(2))) uint8_t ret_area[4]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_backend_get_port((int32_t) (*backend).ptr, (int32_t) (*backend).len, ptr); - fastly_world_result_u16_fastly_compute_at_edge_backend_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_backend_get_port((uint8_t *) (*backend).ptr, (*backend).len, ptr); + fastly_compute_at_edge_backend_result_u16_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 2)))); + result.val.ok = (uint16_t) ((int32_t) *((uint16_t*) (ptr + 2))); 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; } } @@ -1093,10 +651,10 @@ bool fastly_compute_at_edge_backend_get_port(fastly_world_string_t *backend, uin bool fastly_compute_at_edge_backend_get_connect_timeout_ms(fastly_world_string_t *backend, uint32_t *ret, fastly_compute_at_edge_backend_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_backend_get_connect_timeout_ms((int32_t) (*backend).ptr, (int32_t) (*backend).len, ptr); - fastly_world_result_u32_fastly_compute_at_edge_backend_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_backend_get_connect_timeout_ms((uint8_t *) (*backend).ptr, (*backend).len, ptr); + fastly_compute_at_edge_backend_result_u32_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -1104,7 +662,7 @@ bool fastly_compute_at_edge_backend_get_connect_timeout_ms(fastly_world_string_t } 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; } } @@ -1120,10 +678,10 @@ bool fastly_compute_at_edge_backend_get_connect_timeout_ms(fastly_world_string_t bool fastly_compute_at_edge_backend_get_first_byte_timeout_ms(fastly_world_string_t *backend, uint32_t *ret, fastly_compute_at_edge_backend_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_backend_get_first_byte_timeout_ms((int32_t) (*backend).ptr, (int32_t) (*backend).len, ptr); - fastly_world_result_u32_fastly_compute_at_edge_backend_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_backend_get_first_byte_timeout_ms((uint8_t *) (*backend).ptr, (*backend).len, ptr); + fastly_compute_at_edge_backend_result_u32_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -1131,7 +689,7 @@ bool fastly_compute_at_edge_backend_get_first_byte_timeout_ms(fastly_world_strin } 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; } } @@ -1147,10 +705,10 @@ bool fastly_compute_at_edge_backend_get_first_byte_timeout_ms(fastly_world_strin bool fastly_compute_at_edge_backend_get_between_bytes_timeout_ms(fastly_world_string_t *backend, uint32_t *ret, fastly_compute_at_edge_backend_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_backend_get_between_bytes_timeout_ms((int32_t) (*backend).ptr, (int32_t) (*backend).len, ptr); - fastly_world_result_u32_fastly_compute_at_edge_backend_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_backend_get_between_bytes_timeout_ms((uint8_t *) (*backend).ptr, (*backend).len, ptr); + fastly_compute_at_edge_backend_result_u32_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -1158,7 +716,7 @@ bool fastly_compute_at_edge_backend_get_between_bytes_timeout_ms(fastly_world_st } 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; } } @@ -1174,18 +732,18 @@ bool fastly_compute_at_edge_backend_get_between_bytes_timeout_ms(fastly_world_st bool fastly_compute_at_edge_backend_is_ssl(fastly_world_string_t *backend, bool *ret, fastly_compute_at_edge_backend_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_backend_is_ssl((int32_t) (*backend).ptr, (int32_t) (*backend).len, ptr); - fastly_world_result_bool_fastly_compute_at_edge_backend_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_backend_is_ssl((uint8_t *) (*backend).ptr, (*backend).len, ptr); + fastly_compute_at_edge_backend_result_bool_error_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; } } @@ -1201,18 +759,18 @@ bool fastly_compute_at_edge_backend_is_ssl(fastly_world_string_t *backend, bool bool fastly_compute_at_edge_backend_get_ssl_min_version(fastly_world_string_t *backend, fastly_compute_at_edge_backend_tls_version_t *ret, fastly_compute_at_edge_backend_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_backend_get_ssl_min_version((int32_t) (*backend).ptr, (int32_t) (*backend).len, ptr); - fastly_world_result_fastly_compute_at_edge_backend_tls_version_fastly_compute_at_edge_backend_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_backend_get_ssl_min_version((uint8_t *) (*backend).ptr, (*backend).len, ptr); + fastly_compute_at_edge_backend_result_tls_version_error_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; } } @@ -1228,18 +786,18 @@ bool fastly_compute_at_edge_backend_get_ssl_min_version(fastly_world_string_t *b bool fastly_compute_at_edge_backend_get_ssl_max_version(fastly_world_string_t *backend, fastly_compute_at_edge_backend_tls_version_t *ret, fastly_compute_at_edge_backend_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_backend_get_ssl_max_version((int32_t) (*backend).ptr, (int32_t) (*backend).len, ptr); - fastly_world_result_fastly_compute_at_edge_backend_tls_version_fastly_compute_at_edge_backend_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_backend_get_ssl_max_version((uint8_t *) (*backend).ptr, (*backend).len, ptr); + fastly_compute_at_edge_backend_result_tls_version_error_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; } } @@ -1265,10 +823,10 @@ bool fastly_compute_at_edge_cache_lookup(fastly_world_string_t *key, fastly_comp option = 0; option1 = 0; } - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_cache_lookup((int32_t) (*key).ptr, (int32_t) (*key).len, option, option1, ptr); - fastly_world_result_fastly_compute_at_edge_cache_handle_fastly_compute_at_edge_cache_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_cache_lookup((uint8_t *) (*key).ptr, (*key).len, option, option1, ptr); + fastly_compute_at_edge_cache_result_handle_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -1276,7 +834,7 @@ bool fastly_compute_at_edge_cache_lookup(fastly_world_string_t *key, fastly_comp } 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; } } @@ -1292,10 +850,10 @@ bool fastly_compute_at_edge_cache_lookup(fastly_world_string_t *key, fastly_comp bool fastly_compute_at_edge_cache_insert(fastly_world_string_t *key, fastly_compute_at_edge_cache_write_options_t *options, fastly_compute_at_edge_cache_body_handle_t *ret, fastly_compute_at_edge_cache_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_cache_insert((int32_t) (*key).ptr, (int32_t) (*key).len, (int64_t) ((*options).max_age_ns), (int32_t) ((*options).request_headers), (int32_t) ((*options).vary_rule).ptr, (int32_t) ((*options).vary_rule).len, (int64_t) ((*options).initial_age_ns), (int64_t) ((*options).stale_while_revalidate_ns), (int32_t) ((*options).surrogate_keys).ptr, (int32_t) ((*options).surrogate_keys).len, (int64_t) ((*options).length), (int32_t) ((*options).user_metadata).ptr, (int32_t) ((*options).user_metadata).len, (*options).sensitive_data, ptr); - fastly_world_result_fastly_compute_at_edge_cache_body_handle_fastly_compute_at_edge_cache_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_cache_insert((uint8_t *) (*key).ptr, (*key).len, (int64_t) ((*options).max_age_ns), (int32_t) ((*options).request_headers), (uint8_t *) ((*options).vary_rule).ptr, ((*options).vary_rule).len, (int64_t) ((*options).initial_age_ns), (int64_t) ((*options).stale_while_revalidate_ns), (uint8_t *) ((*options).surrogate_keys).ptr, ((*options).surrogate_keys).len, (int64_t) ((*options).length), (uint8_t *) ((*options).user_metadata).ptr, ((*options).user_metadata).len, (*options).sensitive_data, ptr); + fastly_compute_at_edge_cache_result_body_handle_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -1303,7 +861,7 @@ bool fastly_compute_at_edge_cache_insert(fastly_world_string_t *key, fastly_comp } 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; } } @@ -1329,10 +887,10 @@ bool fastly_compute_at_edge_cache_transaction_lookup(fastly_world_string_t *key, option = 0; option1 = 0; } - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_cache_transaction_lookup((int32_t) (*key).ptr, (int32_t) (*key).len, option, option1, ptr); - fastly_world_result_fastly_compute_at_edge_cache_handle_fastly_compute_at_edge_cache_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_cache_transaction_lookup((uint8_t *) (*key).ptr, (*key).len, option, option1, ptr); + fastly_compute_at_edge_cache_result_handle_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -1340,7 +898,7 @@ bool fastly_compute_at_edge_cache_transaction_lookup(fastly_world_string_t *key, } 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; } } @@ -1356,10 +914,10 @@ bool fastly_compute_at_edge_cache_transaction_lookup(fastly_world_string_t *key, bool fastly_compute_at_edge_cache_transaction_insert(fastly_compute_at_edge_cache_handle_t handle, fastly_compute_at_edge_cache_write_options_t *options, fastly_compute_at_edge_cache_body_handle_t *ret, fastly_compute_at_edge_cache_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_cache_transaction_insert((int32_t) (handle), (int64_t) ((*options).max_age_ns), (int32_t) ((*options).request_headers), (int32_t) ((*options).vary_rule).ptr, (int32_t) ((*options).vary_rule).len, (int64_t) ((*options).initial_age_ns), (int64_t) ((*options).stale_while_revalidate_ns), (int32_t) ((*options).surrogate_keys).ptr, (int32_t) ((*options).surrogate_keys).len, (int64_t) ((*options).length), (int32_t) ((*options).user_metadata).ptr, (int32_t) ((*options).user_metadata).len, (*options).sensitive_data, ptr); - fastly_world_result_fastly_compute_at_edge_cache_body_handle_fastly_compute_at_edge_cache_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_cache_transaction_insert((int32_t) (handle), (int64_t) ((*options).max_age_ns), (int32_t) ((*options).request_headers), (uint8_t *) ((*options).vary_rule).ptr, ((*options).vary_rule).len, (int64_t) ((*options).initial_age_ns), (int64_t) ((*options).stale_while_revalidate_ns), (uint8_t *) ((*options).surrogate_keys).ptr, ((*options).surrogate_keys).len, (int64_t) ((*options).length), (uint8_t *) ((*options).user_metadata).ptr, ((*options).user_metadata).len, (*options).sensitive_data, ptr); + fastly_compute_at_edge_cache_result_body_handle_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -1367,7 +925,7 @@ bool fastly_compute_at_edge_cache_transaction_insert(fastly_compute_at_edge_cach } 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; } } @@ -1380,24 +938,24 @@ bool fastly_compute_at_edge_cache_transaction_insert(fastly_compute_at_edge_cach } } -bool fastly_compute_at_edge_cache_transaction_insert_and_stream_back(fastly_compute_at_edge_cache_handle_t handle, fastly_compute_at_edge_cache_write_options_t *options, fastly_world_tuple2_fastly_compute_at_edge_cache_body_handle_fastly_compute_at_edge_cache_handle_t *ret, fastly_compute_at_edge_cache_error_t *err) { +bool fastly_compute_at_edge_cache_transaction_insert_and_stream_back(fastly_compute_at_edge_cache_handle_t handle, fastly_compute_at_edge_cache_write_options_t *options, fastly_world_tuple2_body_handle_handle_t *ret, fastly_compute_at_edge_cache_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_cache_transaction_insert_and_stream_back((int32_t) (handle), (int64_t) ((*options).max_age_ns), (int32_t) ((*options).request_headers), (int32_t) ((*options).vary_rule).ptr, (int32_t) ((*options).vary_rule).len, (int64_t) ((*options).initial_age_ns), (int64_t) ((*options).stale_while_revalidate_ns), (int32_t) ((*options).surrogate_keys).ptr, (int32_t) ((*options).surrogate_keys).len, (int64_t) ((*options).length), (int32_t) ((*options).user_metadata).ptr, (int32_t) ((*options).user_metadata).len, (*options).sensitive_data, ptr); - fastly_world_result_tuple2_fastly_compute_at_edge_cache_body_handle_fastly_compute_at_edge_cache_handle_fastly_compute_at_edge_cache_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_cache_transaction_insert_and_stream_back((int32_t) (handle), (int64_t) ((*options).max_age_ns), (int32_t) ((*options).request_headers), (uint8_t *) ((*options).vary_rule).ptr, ((*options).vary_rule).len, (int64_t) ((*options).initial_age_ns), (int64_t) ((*options).stale_while_revalidate_ns), (uint8_t *) ((*options).surrogate_keys).ptr, ((*options).surrogate_keys).len, (int64_t) ((*options).length), (uint8_t *) ((*options).user_metadata).ptr, ((*options).user_metadata).len, (*options).sensitive_data, ptr); + fastly_compute_at_edge_cache_result_tuple2_body_handle_handle_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (fastly_world_tuple2_fastly_compute_at_edge_cache_body_handle_fastly_compute_at_edge_cache_handle_t) { - (uint32_t) (*((int32_t*) (ptr + 4))), - (uint32_t) (*((int32_t*) (ptr + 8))), + result.val.ok = (fastly_world_tuple2_body_handle_handle_t) { + (fastly_compute_at_edge_cache_body_handle_t) (uint32_t) (*((int32_t*) (ptr + 4))), + (fastly_compute_at_edge_cache_handle_t) (uint32_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; } } @@ -1413,17 +971,17 @@ bool fastly_compute_at_edge_cache_transaction_insert_and_stream_back(fastly_comp bool fastly_compute_at_edge_cache_transaction_update(fastly_compute_at_edge_cache_handle_t handle, fastly_compute_at_edge_cache_write_options_t *options, fastly_compute_at_edge_cache_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_cache_transaction_update((int32_t) (handle), (int64_t) ((*options).max_age_ns), (int32_t) ((*options).request_headers), (int32_t) ((*options).vary_rule).ptr, (int32_t) ((*options).vary_rule).len, (int64_t) ((*options).initial_age_ns), (int64_t) ((*options).stale_while_revalidate_ns), (int32_t) ((*options).surrogate_keys).ptr, (int32_t) ((*options).surrogate_keys).len, (int64_t) ((*options).length), (int32_t) ((*options).user_metadata).ptr, (int32_t) ((*options).user_metadata).len, (*options).sensitive_data, ptr); - fastly_world_result_void_fastly_compute_at_edge_cache_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_cache_transaction_update((int32_t) (handle), (int64_t) ((*options).max_age_ns), (int32_t) ((*options).request_headers), (uint8_t *) ((*options).vary_rule).ptr, ((*options).vary_rule).len, (int64_t) ((*options).initial_age_ns), (int64_t) ((*options).stale_while_revalidate_ns), (uint8_t *) ((*options).surrogate_keys).ptr, ((*options).surrogate_keys).len, (int64_t) ((*options).length), (uint8_t *) ((*options).user_metadata).ptr, ((*options).user_metadata).len, (*options).sensitive_data, ptr); + fastly_compute_at_edge_cache_result_void_error_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; } } @@ -1438,17 +996,17 @@ bool fastly_compute_at_edge_cache_transaction_update(fastly_compute_at_edge_cach bool fastly_compute_at_edge_cache_transaction_cancel(fastly_compute_at_edge_cache_handle_t handle, fastly_compute_at_edge_cache_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_cache_transaction_cancel((int32_t) (handle), ptr); - fastly_world_result_void_fastly_compute_at_edge_cache_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_cache_result_void_error_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; } } @@ -1463,17 +1021,17 @@ bool fastly_compute_at_edge_cache_transaction_cancel(fastly_compute_at_edge_cach bool fastly_compute_at_edge_cache_close(fastly_compute_at_edge_cache_handle_t handle, fastly_compute_at_edge_cache_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_cache_close((int32_t) (handle), ptr); - fastly_world_result_void_fastly_compute_at_edge_cache_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_cache_result_void_error_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; } } @@ -1488,18 +1046,18 @@ bool fastly_compute_at_edge_cache_close(fastly_compute_at_edge_cache_handle_t ha bool fastly_compute_at_edge_cache_get_state(fastly_compute_at_edge_cache_handle_t handle, fastly_compute_at_edge_cache_lookup_state_t *ret, fastly_compute_at_edge_cache_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_cache_get_state((int32_t) (handle), ptr); - fastly_world_result_fastly_compute_at_edge_cache_lookup_state_fastly_compute_at_edge_cache_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_cache_result_lookup_state_error_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; } } @@ -1515,18 +1073,18 @@ bool fastly_compute_at_edge_cache_get_state(fastly_compute_at_edge_cache_handle_ bool fastly_compute_at_edge_cache_get_user_metadata(fastly_compute_at_edge_cache_handle_t handle, fastly_world_list_u8_t *ret, fastly_compute_at_edge_cache_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_cache_get_user_metadata((int32_t) (handle), ptr); - fastly_world_result_list_u8_fastly_compute_at_edge_cache_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_cache_result_list_u8_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (fastly_world_list_u8_t) { (uint8_t*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + result.val.ok = (fastly_world_list_u8_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; } } @@ -1542,10 +1100,10 @@ bool fastly_compute_at_edge_cache_get_user_metadata(fastly_compute_at_edge_cache bool fastly_compute_at_edge_cache_get_body(fastly_compute_at_edge_cache_handle_t handle, fastly_compute_at_edge_cache_get_body_options_t *options, fastly_compute_at_edge_cache_get_body_options_mask_t options_mask, fastly_compute_at_edge_cache_body_handle_t *ret, fastly_compute_at_edge_cache_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_cache_get_body((int32_t) (handle), (int64_t) ((*options).start), (int64_t) ((*options).end), options_mask, ptr); - fastly_world_result_fastly_compute_at_edge_cache_body_handle_fastly_compute_at_edge_cache_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_cache_result_body_handle_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -1553,7 +1111,7 @@ bool fastly_compute_at_edge_cache_get_body(fastly_compute_at_edge_cache_handle_t } 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; } } @@ -1569,10 +1127,10 @@ bool fastly_compute_at_edge_cache_get_body(fastly_compute_at_edge_cache_handle_t bool fastly_compute_at_edge_cache_get_length(fastly_compute_at_edge_cache_handle_t handle, uint64_t *ret, fastly_compute_at_edge_cache_error_t *err) { __attribute__((__aligned__(8))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_cache_get_length((int32_t) (handle), ptr); - fastly_world_result_u64_fastly_compute_at_edge_cache_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_cache_result_u64_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))); @@ -1580,7 +1138,7 @@ bool fastly_compute_at_edge_cache_get_length(fastly_compute_at_edge_cache_handle } 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; } } @@ -1596,10 +1154,10 @@ bool fastly_compute_at_edge_cache_get_length(fastly_compute_at_edge_cache_handle bool fastly_compute_at_edge_cache_get_max_age_ns(fastly_compute_at_edge_cache_handle_t handle, uint64_t *ret, fastly_compute_at_edge_cache_error_t *err) { __attribute__((__aligned__(8))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_cache_get_max_age_ns((int32_t) (handle), ptr); - fastly_world_result_u64_fastly_compute_at_edge_cache_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_cache_result_u64_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))); @@ -1607,7 +1165,7 @@ bool fastly_compute_at_edge_cache_get_max_age_ns(fastly_compute_at_edge_cache_ha } 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; } } @@ -1623,10 +1181,10 @@ bool fastly_compute_at_edge_cache_get_max_age_ns(fastly_compute_at_edge_cache_ha bool fastly_compute_at_edge_cache_get_stale_while_revalidate_ns(fastly_compute_at_edge_cache_handle_t handle, uint64_t *ret, fastly_compute_at_edge_cache_error_t *err) { __attribute__((__aligned__(8))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_cache_get_stale_while_revalidate_ns((int32_t) (handle), ptr); - fastly_world_result_u64_fastly_compute_at_edge_cache_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_cache_result_u64_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))); @@ -1634,7 +1192,7 @@ bool fastly_compute_at_edge_cache_get_stale_while_revalidate_ns(fastly_compute_a } 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; } } @@ -1650,10 +1208,10 @@ bool fastly_compute_at_edge_cache_get_stale_while_revalidate_ns(fastly_compute_a bool fastly_compute_at_edge_cache_get_age_ns(fastly_compute_at_edge_cache_handle_t handle, uint64_t *ret, fastly_compute_at_edge_cache_error_t *err) { __attribute__((__aligned__(8))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_cache_get_age_ns((int32_t) (handle), ptr); - fastly_world_result_u64_fastly_compute_at_edge_cache_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_cache_result_u64_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))); @@ -1661,7 +1219,7 @@ bool fastly_compute_at_edge_cache_get_age_ns(fastly_compute_at_edge_cache_handle } 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; } } @@ -1677,10 +1235,10 @@ bool fastly_compute_at_edge_cache_get_age_ns(fastly_compute_at_edge_cache_handle bool fastly_compute_at_edge_cache_get_hits(fastly_compute_at_edge_cache_handle_t handle, uint64_t *ret, fastly_compute_at_edge_cache_error_t *err) { __attribute__((__aligned__(8))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_cache_get_hits((int32_t) (handle), ptr); - fastly_world_result_u64_fastly_compute_at_edge_cache_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_cache_result_u64_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))); @@ -1688,7 +1246,7 @@ bool fastly_compute_at_edge_cache_get_hits(fastly_compute_at_edge_cache_handle_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; } } @@ -1704,18 +1262,18 @@ bool fastly_compute_at_edge_cache_get_hits(fastly_compute_at_edge_cache_handle_t bool fastly_compute_at_edge_device_detection_lookup(fastly_world_string_t *user_agent, fastly_world_string_t *ret, fastly_compute_at_edge_device_detection_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_device_detection_lookup((int32_t) (*user_agent).ptr, (int32_t) (*user_agent).len, ptr); - fastly_world_result_string_fastly_compute_at_edge_device_detection_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_device_detection_lookup((uint8_t *) (*user_agent).ptr, (*user_agent).len, ptr); + fastly_compute_at_edge_device_detection_result_string_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (fastly_world_string_t) { (char*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + result.val.ok = (fastly_world_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; } } @@ -1731,10 +1289,10 @@ bool fastly_compute_at_edge_device_detection_lookup(fastly_world_string_t *user_ bool fastly_compute_at_edge_dictionary_open(fastly_world_string_t *name, fastly_compute_at_edge_dictionary_handle_t *ret, fastly_compute_at_edge_dictionary_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_dictionary_open((int32_t) (*name).ptr, (int32_t) (*name).len, ptr); - fastly_world_result_fastly_compute_at_edge_dictionary_handle_fastly_compute_at_edge_dictionary_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_dictionary_open((uint8_t *) (*name).ptr, (*name).len, ptr); + fastly_compute_at_edge_dictionary_result_handle_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -1742,7 +1300,7 @@ bool fastly_compute_at_edge_dictionary_open(fastly_world_string_t *name, fastly_ } 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; } } @@ -1758,31 +1316,31 @@ bool fastly_compute_at_edge_dictionary_open(fastly_world_string_t *name, fastly_ bool fastly_compute_at_edge_dictionary_get(fastly_compute_at_edge_dictionary_handle_t h, fastly_world_string_t *key, fastly_world_option_string_t *ret, fastly_compute_at_edge_dictionary_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_dictionary_get((int32_t) (h), (int32_t) (*key).ptr, (int32_t) (*key).len, ptr); - fastly_world_result_option_string_fastly_compute_at_edge_dictionary_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_dictionary_get((int32_t) (h), (uint8_t *) (*key).ptr, (*key).len, ptr); + fastly_compute_at_edge_dictionary_result_option_string_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; fastly_world_option_string_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 4)))) { + switch ((int32_t) *((uint8_t*) (ptr + 4))) { case 0: { option.is_some = false; break; } case 1: { option.is_some = true; - option.val = (fastly_world_string_t) { (char*)(*((int32_t*) (ptr + 8))), (size_t)(*((int32_t*) (ptr + 12))) }; + option.val = (fastly_world_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 8))), (*((size_t*) (ptr + 12))) }; 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; } } @@ -1798,18 +1356,18 @@ bool fastly_compute_at_edge_dictionary_get(fastly_compute_at_edge_dictionary_han bool fastly_compute_at_edge_edge_rate_limiter_check_rate(fastly_world_string_t *rate_counter_name, fastly_world_string_t *entry, uint32_t delta, uint32_t window, uint32_t limit, fastly_world_string_t *penalty_box_name, uint32_t time_to_live, bool *ret, fastly_compute_at_edge_edge_rate_limiter_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_edge_rate_limiter_check_rate((int32_t) (*rate_counter_name).ptr, (int32_t) (*rate_counter_name).len, (int32_t) (*entry).ptr, (int32_t) (*entry).len, (int32_t) (delta), (int32_t) (window), (int32_t) (limit), (int32_t) (*penalty_box_name).ptr, (int32_t) (*penalty_box_name).len, (int32_t) (time_to_live), ptr); - fastly_world_result_bool_fastly_compute_at_edge_edge_rate_limiter_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_edge_rate_limiter_check_rate((uint8_t *) (*rate_counter_name).ptr, (*rate_counter_name).len, (uint8_t *) (*entry).ptr, (*entry).len, (int32_t) (delta), (int32_t) (window), (int32_t) (limit), (uint8_t *) (*penalty_box_name).ptr, (*penalty_box_name).len, (int32_t) (time_to_live), ptr); + fastly_compute_at_edge_edge_rate_limiter_result_bool_error_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; } } @@ -1825,17 +1383,17 @@ bool fastly_compute_at_edge_edge_rate_limiter_check_rate(fastly_world_string_t * bool fastly_compute_at_edge_edge_rate_limiter_ratecounter_increment(fastly_world_string_t *rate_counter_name, fastly_world_string_t *entry, uint32_t delta, fastly_compute_at_edge_edge_rate_limiter_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_edge_rate_limiter_ratecounter_increment((int32_t) (*rate_counter_name).ptr, (int32_t) (*rate_counter_name).len, (int32_t) (*entry).ptr, (int32_t) (*entry).len, (int32_t) (delta), ptr); - fastly_world_result_void_fastly_compute_at_edge_edge_rate_limiter_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_edge_rate_limiter_ratecounter_increment((uint8_t *) (*rate_counter_name).ptr, (*rate_counter_name).len, (uint8_t *) (*entry).ptr, (*entry).len, (int32_t) (delta), ptr); + fastly_compute_at_edge_edge_rate_limiter_result_void_error_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; } } @@ -1850,10 +1408,10 @@ bool fastly_compute_at_edge_edge_rate_limiter_ratecounter_increment(fastly_world bool fastly_compute_at_edge_edge_rate_limiter_ratecounter_lookup_rate(fastly_world_string_t *rate_counter_name, fastly_world_string_t *entry, uint32_t window, uint32_t *ret, fastly_compute_at_edge_edge_rate_limiter_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_edge_rate_limiter_ratecounter_lookup_rate((int32_t) (*rate_counter_name).ptr, (int32_t) (*rate_counter_name).len, (int32_t) (*entry).ptr, (int32_t) (*entry).len, (int32_t) (window), ptr); - fastly_world_result_u32_fastly_compute_at_edge_edge_rate_limiter_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_edge_rate_limiter_ratecounter_lookup_rate((uint8_t *) (*rate_counter_name).ptr, (*rate_counter_name).len, (uint8_t *) (*entry).ptr, (*entry).len, (int32_t) (window), ptr); + fastly_compute_at_edge_edge_rate_limiter_result_u32_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -1861,7 +1419,7 @@ bool fastly_compute_at_edge_edge_rate_limiter_ratecounter_lookup_rate(fastly_wor } 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; } } @@ -1877,10 +1435,10 @@ bool fastly_compute_at_edge_edge_rate_limiter_ratecounter_lookup_rate(fastly_wor bool fastly_compute_at_edge_edge_rate_limiter_ratecounter_lookup_count(fastly_world_string_t *rate_counter_name, fastly_world_string_t *entry, uint32_t duration, uint32_t *ret, fastly_compute_at_edge_edge_rate_limiter_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_edge_rate_limiter_ratecounter_lookup_count((int32_t) (*rate_counter_name).ptr, (int32_t) (*rate_counter_name).len, (int32_t) (*entry).ptr, (int32_t) (*entry).len, (int32_t) (duration), ptr); - fastly_world_result_u32_fastly_compute_at_edge_edge_rate_limiter_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_edge_rate_limiter_ratecounter_lookup_count((uint8_t *) (*rate_counter_name).ptr, (*rate_counter_name).len, (uint8_t *) (*entry).ptr, (*entry).len, (int32_t) (duration), ptr); + fastly_compute_at_edge_edge_rate_limiter_result_u32_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -1888,7 +1446,7 @@ bool fastly_compute_at_edge_edge_rate_limiter_ratecounter_lookup_count(fastly_wo } 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; } } @@ -1904,17 +1462,17 @@ bool fastly_compute_at_edge_edge_rate_limiter_ratecounter_lookup_count(fastly_wo bool fastly_compute_at_edge_edge_rate_limiter_penaltybox_add(fastly_world_string_t *penalty_box_name, fastly_world_string_t *entry, uint32_t time_to_live, fastly_compute_at_edge_edge_rate_limiter_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_edge_rate_limiter_penaltybox_add((int32_t) (*penalty_box_name).ptr, (int32_t) (*penalty_box_name).len, (int32_t) (*entry).ptr, (int32_t) (*entry).len, (int32_t) (time_to_live), ptr); - fastly_world_result_void_fastly_compute_at_edge_edge_rate_limiter_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_edge_rate_limiter_penaltybox_add((uint8_t *) (*penalty_box_name).ptr, (*penalty_box_name).len, (uint8_t *) (*entry).ptr, (*entry).len, (int32_t) (time_to_live), ptr); + fastly_compute_at_edge_edge_rate_limiter_result_void_error_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; } } @@ -1929,18 +1487,18 @@ bool fastly_compute_at_edge_edge_rate_limiter_penaltybox_add(fastly_world_string bool fastly_compute_at_edge_edge_rate_limiter_penaltybox_has(fastly_world_string_t *penalty_box_name, fastly_world_string_t *entry, bool *ret, fastly_compute_at_edge_edge_rate_limiter_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_edge_rate_limiter_penaltybox_has((int32_t) (*penalty_box_name).ptr, (int32_t) (*penalty_box_name).len, (int32_t) (*entry).ptr, (int32_t) (*entry).len, ptr); - fastly_world_result_bool_fastly_compute_at_edge_edge_rate_limiter_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_edge_rate_limiter_penaltybox_has((uint8_t *) (*penalty_box_name).ptr, (*penalty_box_name).len, (uint8_t *) (*entry).ptr, (*entry).len, ptr); + fastly_compute_at_edge_edge_rate_limiter_result_bool_error_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; } } @@ -1956,18 +1514,18 @@ bool fastly_compute_at_edge_edge_rate_limiter_penaltybox_has(fastly_world_string bool fastly_compute_at_edge_geo_lookup(fastly_world_list_u8_t *addr_octets, fastly_world_string_t *ret, fastly_compute_at_edge_geo_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_geo_lookup((int32_t) (*addr_octets).ptr, (int32_t) (*addr_octets).len, ptr); - fastly_world_result_string_fastly_compute_at_edge_geo_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_geo_lookup((uint8_t *) (*addr_octets).ptr, (*addr_octets).len, ptr); + fastly_compute_at_edge_geo_result_string_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (fastly_world_string_t) { (char*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + result.val.ok = (fastly_world_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; } } @@ -1983,17 +1541,17 @@ bool fastly_compute_at_edge_geo_lookup(fastly_world_list_u8_t *addr_octets, fast bool fastly_compute_at_edge_http_body_append(fastly_compute_at_edge_http_body_body_handle_t dest, fastly_compute_at_edge_http_body_body_handle_t src, fastly_compute_at_edge_http_body_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_body_append((int32_t) (dest), (int32_t) (src), ptr); - fastly_world_result_void_fastly_compute_at_edge_http_body_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_body_result_void_error_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; } } @@ -2008,10 +1566,10 @@ bool fastly_compute_at_edge_http_body_append(fastly_compute_at_edge_http_body_bo bool fastly_compute_at_edge_http_body_new(fastly_compute_at_edge_http_body_body_handle_t *ret, fastly_compute_at_edge_http_body_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_body_new(ptr); - fastly_world_result_fastly_compute_at_edge_http_body_body_handle_fastly_compute_at_edge_http_body_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_body_result_body_handle_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -2019,7 +1577,7 @@ bool fastly_compute_at_edge_http_body_new(fastly_compute_at_edge_http_body_body_ } 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; } } @@ -2035,18 +1593,18 @@ bool fastly_compute_at_edge_http_body_new(fastly_compute_at_edge_http_body_body_ bool fastly_compute_at_edge_http_body_read(fastly_compute_at_edge_http_body_body_handle_t h, uint32_t chunk_size, fastly_world_list_u8_t *ret, fastly_compute_at_edge_http_body_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_body_read((int32_t) (h), (int32_t) (chunk_size), ptr); - fastly_world_result_list_u8_fastly_compute_at_edge_http_body_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_body_result_list_u8_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (fastly_world_list_u8_t) { (uint8_t*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + result.val.ok = (fastly_world_list_u8_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; } } @@ -2062,10 +1620,10 @@ bool fastly_compute_at_edge_http_body_read(fastly_compute_at_edge_http_body_body bool fastly_compute_at_edge_http_body_write(fastly_compute_at_edge_http_body_body_handle_t h, fastly_world_list_u8_t *buf, fastly_compute_at_edge_http_body_write_end_t end, uint32_t *ret, fastly_compute_at_edge_http_body_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_body_write((int32_t) (h), (int32_t) (*buf).ptr, (int32_t) (*buf).len, (int32_t) end, ptr); - fastly_world_result_u32_fastly_compute_at_edge_http_body_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_body_write((int32_t) (h), (uint8_t *) (*buf).ptr, (*buf).len, (int32_t) end, ptr); + fastly_compute_at_edge_http_body_result_u32_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -2073,7 +1631,7 @@ bool fastly_compute_at_edge_http_body_write(fastly_compute_at_edge_http_body_bod } 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; } } @@ -2089,17 +1647,17 @@ bool fastly_compute_at_edge_http_body_write(fastly_compute_at_edge_http_body_bod bool fastly_compute_at_edge_http_body_close(fastly_compute_at_edge_http_body_body_handle_t h, fastly_compute_at_edge_http_body_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_body_close((int32_t) (h), ptr); - fastly_world_result_void_fastly_compute_at_edge_http_body_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_body_result_void_error_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; } } @@ -2147,29 +1705,29 @@ bool fastly_compute_at_edge_http_req_cache_override_set(fastly_compute_at_edge_h option5 = 0; } int32_t option8; - int32_t option9; - int32_t option10; + uint8_t * option9; + size_t option10; if ((sk).is_some) { const fastly_world_string_t *payload7 = &(sk).val; option8 = 1; - option9 = (int32_t) (*payload7).ptr; - option10 = (int32_t) (*payload7).len; + option9 = (uint8_t *) (*payload7).ptr; + option10 = (*payload7).len; } else { option8 = 0; option9 = 0; option10 = 0; } - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_cache_override_set((int32_t) (h), tag, option, option1, option4, option5, option8, option9, option10, ptr); - fastly_world_result_void_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_void_error_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; } } @@ -2184,18 +1742,18 @@ bool fastly_compute_at_edge_http_req_cache_override_set(fastly_compute_at_edge_h bool fastly_compute_at_edge_http_req_downstream_client_ip_addr(fastly_world_list_u8_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_downstream_client_ip_addr(ptr); - fastly_world_result_list_u8_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_list_u8_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (fastly_world_list_u8_t) { (uint8_t*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + result.val.ok = (fastly_world_list_u8_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; } } @@ -2211,18 +1769,18 @@ bool fastly_compute_at_edge_http_req_downstream_client_ip_addr(fastly_world_list bool fastly_compute_at_edge_http_req_downstream_client_request_id(fastly_world_string_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_downstream_client_request_id(ptr); - fastly_world_result_string_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_string_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (fastly_world_string_t) { (char*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + result.val.ok = (fastly_world_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; } } @@ -2238,18 +1796,18 @@ bool fastly_compute_at_edge_http_req_downstream_client_request_id(fastly_world_s bool fastly_compute_at_edge_http_req_downstream_client_h2_fingerprint(fastly_world_list_u8_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_downstream_client_h2_fingerprint(ptr); - fastly_world_result_list_u8_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_list_u8_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (fastly_world_list_u8_t) { (uint8_t*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + result.val.ok = (fastly_world_list_u8_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; } } @@ -2265,18 +1823,18 @@ bool fastly_compute_at_edge_http_req_downstream_client_h2_fingerprint(fastly_wor bool fastly_compute_at_edge_http_req_downstream_tls_cipher_openssl_name(fastly_world_string_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_downstream_tls_cipher_openssl_name(ptr); - fastly_world_result_string_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_string_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (fastly_world_string_t) { (char*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + result.val.ok = (fastly_world_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; } } @@ -2292,18 +1850,18 @@ bool fastly_compute_at_edge_http_req_downstream_tls_cipher_openssl_name(fastly_w bool fastly_compute_at_edge_http_req_downstream_tls_protocol(fastly_world_string_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_downstream_tls_protocol(ptr); - fastly_world_result_string_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_string_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (fastly_world_string_t) { (char*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + result.val.ok = (fastly_world_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; } } @@ -2319,18 +1877,18 @@ bool fastly_compute_at_edge_http_req_downstream_tls_protocol(fastly_world_string bool fastly_compute_at_edge_http_req_downstream_tls_client_hello(fastly_world_list_u8_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_downstream_tls_client_hello(ptr); - fastly_world_result_list_u8_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_list_u8_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (fastly_world_list_u8_t) { (uint8_t*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + result.val.ok = (fastly_world_list_u8_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; } } @@ -2346,18 +1904,18 @@ bool fastly_compute_at_edge_http_req_downstream_tls_client_hello(fastly_world_li bool fastly_compute_at_edge_http_req_downstream_tls_raw_client_certificate(fastly_world_list_u8_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_downstream_tls_raw_client_certificate(ptr); - fastly_world_result_list_u8_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_list_u8_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (fastly_world_list_u8_t) { (uint8_t*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + result.val.ok = (fastly_world_list_u8_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; } } @@ -2373,17 +1931,17 @@ bool fastly_compute_at_edge_http_req_downstream_tls_raw_client_certificate(fastl bool fastly_compute_at_edge_http_req_downstream_tls_client_cert_verify_result(fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_downstream_tls_client_cert_verify_result(ptr); - fastly_world_result_void_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_void_error_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; } } @@ -2398,18 +1956,18 @@ bool fastly_compute_at_edge_http_req_downstream_tls_client_cert_verify_result(fa bool fastly_compute_at_edge_http_req_downstream_tls_ja3_md5(fastly_world_list_u8_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_downstream_tls_ja3_md5(ptr); - fastly_world_result_list_u8_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_list_u8_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (fastly_world_list_u8_t) { (uint8_t*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + result.val.ok = (fastly_world_list_u8_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; } } @@ -2425,10 +1983,10 @@ bool fastly_compute_at_edge_http_req_downstream_tls_ja3_md5(fastly_world_list_u8 bool fastly_compute_at_edge_http_req_new(fastly_compute_at_edge_http_req_request_handle_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_new(ptr); - fastly_world_result_fastly_compute_at_edge_http_req_request_handle_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_request_handle_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -2436,7 +1994,7 @@ bool fastly_compute_at_edge_http_req_new(fastly_compute_at_edge_http_req_request } 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; } } @@ -2452,18 +2010,18 @@ bool fastly_compute_at_edge_http_req_new(fastly_compute_at_edge_http_req_request bool fastly_compute_at_edge_http_req_header_names_get(fastly_compute_at_edge_http_req_request_handle_t h, fastly_world_list_string_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_header_names_get((int32_t) (h), ptr); - fastly_world_result_list_string_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_list_string_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (fastly_world_list_string_t) { (fastly_world_string_t*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + result.val.ok = (fastly_world_list_string_t) { (fastly_world_string_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; } } @@ -2479,18 +2037,18 @@ bool fastly_compute_at_edge_http_req_header_names_get(fastly_compute_at_edge_htt bool fastly_compute_at_edge_http_req_original_header_names_get(fastly_world_list_string_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_original_header_names_get(ptr); - fastly_world_result_list_string_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_list_string_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (fastly_world_list_string_t) { (fastly_world_string_t*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + result.val.ok = (fastly_world_list_string_t) { (fastly_world_string_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; } } @@ -2506,10 +2064,10 @@ bool fastly_compute_at_edge_http_req_original_header_names_get(fastly_world_list bool fastly_compute_at_edge_http_req_original_header_count(uint32_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_original_header_count(ptr); - fastly_world_result_u32_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_u32_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -2517,7 +2075,7 @@ bool fastly_compute_at_edge_http_req_original_header_count(uint32_t *ret, fastly } 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; } } @@ -2533,31 +2091,31 @@ bool fastly_compute_at_edge_http_req_original_header_count(uint32_t *ret, fastly bool fastly_compute_at_edge_http_req_header_value_get(fastly_compute_at_edge_http_req_request_handle_t h, fastly_world_string_t *name, fastly_world_option_list_u8_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_req_header_value_get((int32_t) (h), (int32_t) (*name).ptr, (int32_t) (*name).len, ptr); - fastly_world_result_option_list_u8_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_req_header_value_get((int32_t) (h), (uint8_t *) (*name).ptr, (*name).len, ptr); + fastly_compute_at_edge_http_req_result_option_list_u8_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; fastly_world_option_list_u8_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 4)))) { + switch ((int32_t) *((uint8_t*) (ptr + 4))) { case 0: { option.is_some = false; break; } case 1: { option.is_some = true; - option.val = (fastly_world_list_u8_t) { (uint8_t*)(*((int32_t*) (ptr + 8))), (size_t)(*((int32_t*) (ptr + 12))) }; + option.val = (fastly_world_list_u8_t) { (uint8_t*)(*((uint8_t **) (ptr + 8))), (*((size_t*) (ptr + 12))) }; 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; } } @@ -2573,31 +2131,31 @@ bool fastly_compute_at_edge_http_req_header_value_get(fastly_compute_at_edge_htt bool fastly_compute_at_edge_http_req_header_values_get(fastly_compute_at_edge_http_req_request_handle_t h, fastly_world_string_t *name, fastly_world_option_list_list_u8_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_req_header_values_get((int32_t) (h), (int32_t) (*name).ptr, (int32_t) (*name).len, ptr); - fastly_world_result_option_list_list_u8_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_req_header_values_get((int32_t) (h), (uint8_t *) (*name).ptr, (*name).len, ptr); + fastly_compute_at_edge_http_req_result_option_list_list_u8_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; fastly_world_option_list_list_u8_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 4)))) { + switch ((int32_t) *((uint8_t*) (ptr + 4))) { case 0: { option.is_some = false; break; } case 1: { option.is_some = true; - option.val = (fastly_world_list_list_u8_t) { (fastly_world_list_u8_t*)(*((int32_t*) (ptr + 8))), (size_t)(*((int32_t*) (ptr + 12))) }; + option.val = (fastly_world_list_list_u8_t) { (fastly_world_list_u8_t*)(*((uint8_t **) (ptr + 8))), (*((size_t*) (ptr + 12))) }; 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; } } @@ -2613,17 +2171,17 @@ bool fastly_compute_at_edge_http_req_header_values_get(fastly_compute_at_edge_ht bool fastly_compute_at_edge_http_req_header_values_set(fastly_compute_at_edge_http_req_request_handle_t h, fastly_world_string_t *name, fastly_world_list_list_u8_t *values, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_req_header_values_set((int32_t) (h), (int32_t) (*name).ptr, (int32_t) (*name).len, (int32_t) (*values).ptr, (int32_t) (*values).len, ptr); - fastly_world_result_void_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_req_header_values_set((int32_t) (h), (uint8_t *) (*name).ptr, (*name).len, (uint8_t *) (*values).ptr, (*values).len, ptr); + fastly_compute_at_edge_http_req_result_void_error_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; } } @@ -2638,17 +2196,17 @@ bool fastly_compute_at_edge_http_req_header_values_set(fastly_compute_at_edge_ht bool fastly_compute_at_edge_http_req_header_insert(fastly_compute_at_edge_http_req_request_handle_t h, fastly_world_string_t *name, fastly_world_list_u8_t *value, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_req_header_insert((int32_t) (h), (int32_t) (*name).ptr, (int32_t) (*name).len, (int32_t) (*value).ptr, (int32_t) (*value).len, ptr); - fastly_world_result_void_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_req_header_insert((int32_t) (h), (uint8_t *) (*name).ptr, (*name).len, (uint8_t *) (*value).ptr, (*value).len, ptr); + fastly_compute_at_edge_http_req_result_void_error_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; } } @@ -2663,17 +2221,17 @@ bool fastly_compute_at_edge_http_req_header_insert(fastly_compute_at_edge_http_r bool fastly_compute_at_edge_http_req_header_append(fastly_compute_at_edge_http_req_request_handle_t h, fastly_world_string_t *name, fastly_world_list_u8_t *value, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_req_header_append((int32_t) (h), (int32_t) (*name).ptr, (int32_t) (*name).len, (int32_t) (*value).ptr, (int32_t) (*value).len, ptr); - fastly_world_result_void_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_req_header_append((int32_t) (h), (uint8_t *) (*name).ptr, (*name).len, (uint8_t *) (*value).ptr, (*value).len, ptr); + fastly_compute_at_edge_http_req_result_void_error_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; } } @@ -2688,17 +2246,17 @@ bool fastly_compute_at_edge_http_req_header_append(fastly_compute_at_edge_http_r bool fastly_compute_at_edge_http_req_header_remove(fastly_compute_at_edge_http_req_request_handle_t h, fastly_world_string_t *name, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_req_header_remove((int32_t) (h), (int32_t) (*name).ptr, (int32_t) (*name).len, ptr); - fastly_world_result_void_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_req_header_remove((int32_t) (h), (uint8_t *) (*name).ptr, (*name).len, ptr); + fastly_compute_at_edge_http_req_result_void_error_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; } } @@ -2713,18 +2271,18 @@ bool fastly_compute_at_edge_http_req_header_remove(fastly_compute_at_edge_http_r bool fastly_compute_at_edge_http_req_method_get(fastly_compute_at_edge_http_req_request_handle_t h, fastly_world_string_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_method_get((int32_t) (h), ptr); - fastly_world_result_string_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_string_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (fastly_world_string_t) { (char*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + result.val.ok = (fastly_world_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; } } @@ -2740,17 +2298,17 @@ bool fastly_compute_at_edge_http_req_method_get(fastly_compute_at_edge_http_req_ bool fastly_compute_at_edge_http_req_method_set(fastly_compute_at_edge_http_req_request_handle_t h, fastly_world_string_t *method, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_req_method_set((int32_t) (h), (int32_t) (*method).ptr, (int32_t) (*method).len, ptr); - fastly_world_result_void_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_req_method_set((int32_t) (h), (uint8_t *) (*method).ptr, (*method).len, ptr); + fastly_compute_at_edge_http_req_result_void_error_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; } } @@ -2765,18 +2323,18 @@ bool fastly_compute_at_edge_http_req_method_set(fastly_compute_at_edge_http_req_ bool fastly_compute_at_edge_http_req_uri_get(fastly_compute_at_edge_http_req_request_handle_t h, fastly_world_string_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_uri_get((int32_t) (h), ptr); - fastly_world_result_string_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_string_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (fastly_world_string_t) { (char*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + result.val.ok = (fastly_world_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; } } @@ -2792,17 +2350,17 @@ bool fastly_compute_at_edge_http_req_uri_get(fastly_compute_at_edge_http_req_req bool fastly_compute_at_edge_http_req_uri_set(fastly_compute_at_edge_http_req_request_handle_t h, fastly_world_string_t *uri, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_req_uri_set((int32_t) (h), (int32_t) (*uri).ptr, (int32_t) (*uri).len, ptr); - fastly_world_result_void_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_req_uri_set((int32_t) (h), (uint8_t *) (*uri).ptr, (*uri).len, ptr); + fastly_compute_at_edge_http_req_result_void_error_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; } } @@ -2817,18 +2375,18 @@ bool fastly_compute_at_edge_http_req_uri_set(fastly_compute_at_edge_http_req_req bool fastly_compute_at_edge_http_req_version_get(fastly_compute_at_edge_http_req_request_handle_t h, fastly_compute_at_edge_http_req_http_version_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_version_get((int32_t) (h), ptr); - fastly_world_result_fastly_compute_at_edge_http_req_http_version_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_http_version_error_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; } } @@ -2844,17 +2402,17 @@ bool fastly_compute_at_edge_http_req_version_get(fastly_compute_at_edge_http_req bool fastly_compute_at_edge_http_req_version_set(fastly_compute_at_edge_http_req_request_handle_t h, fastly_compute_at_edge_http_req_http_version_t version, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_version_set((int32_t) (h), (int32_t) version, ptr); - fastly_world_result_void_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_void_error_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; } } @@ -2869,21 +2427,21 @@ bool fastly_compute_at_edge_http_req_version_set(fastly_compute_at_edge_http_req bool fastly_compute_at_edge_http_req_send(fastly_compute_at_edge_http_req_request_handle_t h, fastly_compute_at_edge_http_req_body_handle_t b, fastly_world_string_t *backend, fastly_compute_at_edge_http_req_response_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_req_send((int32_t) (h), (int32_t) (b), (int32_t) (*backend).ptr, (int32_t) (*backend).len, ptr); - fastly_world_result_fastly_compute_at_edge_http_req_response_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_req_send((int32_t) (h), (int32_t) (b), (uint8_t *) (*backend).ptr, (*backend).len, ptr); + fastly_compute_at_edge_http_req_result_response_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (fastly_compute_at_edge_http_types_response_t) { - (uint32_t) (*((int32_t*) (ptr + 4))), - (uint32_t) (*((int32_t*) (ptr + 8))), + (fastly_compute_at_edge_http_types_response_handle_t) (uint32_t) (*((int32_t*) (ptr + 4))), + (fastly_compute_at_edge_http_types_body_handle_t) (uint32_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; } } @@ -2899,21 +2457,21 @@ bool fastly_compute_at_edge_http_req_send(fastly_compute_at_edge_http_req_reques bool fastly_compute_at_edge_http_req_send_v2(fastly_compute_at_edge_http_req_request_handle_t h, fastly_compute_at_edge_http_req_send_error_detail_t *s, fastly_compute_at_edge_http_req_body_handle_t b, fastly_world_string_t *backend, fastly_compute_at_edge_http_req_response_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_req_send_v2((int32_t) (h), (int32_t) (*s).tag, (*s).mask, (int32_t) ((*s).dns_error_rcode), (int32_t) ((*s).dns_error_info_code), (int32_t) ((*s).tls_alert_id), (int32_t) (b), (int32_t) (*backend).ptr, (int32_t) (*backend).len, ptr); - fastly_world_result_fastly_compute_at_edge_http_req_response_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_req_send_v2((int32_t) (h), (int32_t) (*s).tag, (*s).mask, (int32_t) ((*s).dns_error_rcode), (int32_t) ((*s).dns_error_info_code), (int32_t) ((*s).tls_alert_id), (int32_t) (b), (uint8_t *) (*backend).ptr, (*backend).len, ptr); + fastly_compute_at_edge_http_req_result_response_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (fastly_compute_at_edge_http_types_response_t) { - (uint32_t) (*((int32_t*) (ptr + 4))), - (uint32_t) (*((int32_t*) (ptr + 8))), + (fastly_compute_at_edge_http_types_response_handle_t) (uint32_t) (*((int32_t*) (ptr + 4))), + (fastly_compute_at_edge_http_types_body_handle_t) (uint32_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; } } @@ -2929,10 +2487,10 @@ bool fastly_compute_at_edge_http_req_send_v2(fastly_compute_at_edge_http_req_req bool fastly_compute_at_edge_http_req_send_async(fastly_compute_at_edge_http_req_request_handle_t h, fastly_compute_at_edge_http_req_body_handle_t b, fastly_world_string_t *backend, fastly_compute_at_edge_http_req_pending_request_handle_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_req_send_async((int32_t) (h), (int32_t) (b), (int32_t) (*backend).ptr, (int32_t) (*backend).len, ptr); - fastly_world_result_fastly_compute_at_edge_http_req_pending_request_handle_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_req_send_async((int32_t) (h), (int32_t) (b), (uint8_t *) (*backend).ptr, (*backend).len, ptr); + fastly_compute_at_edge_http_req_result_pending_request_handle_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -2940,7 +2498,7 @@ bool fastly_compute_at_edge_http_req_send_async(fastly_compute_at_edge_http_req_ } 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; } } @@ -2956,10 +2514,10 @@ bool fastly_compute_at_edge_http_req_send_async(fastly_compute_at_edge_http_req_ bool fastly_compute_at_edge_http_req_send_async_streaming(fastly_compute_at_edge_http_req_request_handle_t h, fastly_compute_at_edge_http_req_body_handle_t b, fastly_world_string_t *backend, fastly_compute_at_edge_http_req_pending_request_handle_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_req_send_async_streaming((int32_t) (h), (int32_t) (b), (int32_t) (*backend).ptr, (int32_t) (*backend).len, ptr); - fastly_world_result_fastly_compute_at_edge_http_req_pending_request_handle_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_req_send_async_streaming((int32_t) (h), (int32_t) (b), (uint8_t *) (*backend).ptr, (*backend).len, ptr); + fastly_compute_at_edge_http_req_result_pending_request_handle_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -2967,7 +2525,7 @@ bool fastly_compute_at_edge_http_req_send_async_streaming(fastly_compute_at_edge } 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; } } @@ -2980,17 +2538,17 @@ bool fastly_compute_at_edge_http_req_send_async_streaming(fastly_compute_at_edge } } -bool fastly_compute_at_edge_http_req_pending_req_poll(fastly_compute_at_edge_http_req_pending_request_handle_t h, fastly_world_option_fastly_compute_at_edge_http_req_response_t *ret, fastly_compute_at_edge_http_req_error_t *err) { +bool fastly_compute_at_edge_http_req_pending_req_poll(fastly_compute_at_edge_http_req_pending_request_handle_t h, fastly_world_option_response_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_pending_req_poll((int32_t) (h), ptr); - fastly_world_result_option_fastly_compute_at_edge_http_req_response_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_option_response_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - fastly_world_option_fastly_compute_at_edge_http_req_response_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 4)))) { + fastly_world_option_response_t option; + switch ((int32_t) *((uint8_t*) (ptr + 4))) { case 0: { option.is_some = false; break; @@ -2998,19 +2556,19 @@ bool fastly_compute_at_edge_http_req_pending_req_poll(fastly_compute_at_edge_htt case 1: { option.is_some = true; option.val = (fastly_compute_at_edge_http_types_response_t) { - (uint32_t) (*((int32_t*) (ptr + 8))), - (uint32_t) (*((int32_t*) (ptr + 12))), + (fastly_compute_at_edge_http_types_response_handle_t) (uint32_t) (*((int32_t*) (ptr + 8))), + (fastly_compute_at_edge_http_types_body_handle_t) (uint32_t) (*((int32_t*) (ptr + 12))), }; 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; } } @@ -3023,17 +2581,17 @@ bool fastly_compute_at_edge_http_req_pending_req_poll(fastly_compute_at_edge_htt } } -bool fastly_compute_at_edge_http_req_pending_req_poll_v2(fastly_compute_at_edge_http_req_pending_request_handle_t h, fastly_compute_at_edge_http_req_send_error_detail_t *s, fastly_world_option_fastly_compute_at_edge_http_req_response_t *ret, fastly_compute_at_edge_http_req_error_t *err) { +bool fastly_compute_at_edge_http_req_pending_req_poll_v2(fastly_compute_at_edge_http_req_pending_request_handle_t h, fastly_compute_at_edge_http_req_send_error_detail_t *s, fastly_world_option_response_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_pending_req_poll_v2((int32_t) (h), (int32_t) (*s).tag, (*s).mask, (int32_t) ((*s).dns_error_rcode), (int32_t) ((*s).dns_error_info_code), (int32_t) ((*s).tls_alert_id), ptr); - fastly_world_result_option_fastly_compute_at_edge_http_req_response_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_option_response_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - fastly_world_option_fastly_compute_at_edge_http_req_response_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 4)))) { + fastly_world_option_response_t option; + switch ((int32_t) *((uint8_t*) (ptr + 4))) { case 0: { option.is_some = false; break; @@ -3041,19 +2599,19 @@ bool fastly_compute_at_edge_http_req_pending_req_poll_v2(fastly_compute_at_edge_ case 1: { option.is_some = true; option.val = (fastly_compute_at_edge_http_types_response_t) { - (uint32_t) (*((int32_t*) (ptr + 8))), - (uint32_t) (*((int32_t*) (ptr + 12))), + (fastly_compute_at_edge_http_types_response_handle_t) (uint32_t) (*((int32_t*) (ptr + 8))), + (fastly_compute_at_edge_http_types_body_handle_t) (uint32_t) (*((int32_t*) (ptr + 12))), }; 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; } } @@ -3069,21 +2627,21 @@ bool fastly_compute_at_edge_http_req_pending_req_poll_v2(fastly_compute_at_edge_ bool fastly_compute_at_edge_http_req_pending_req_wait(fastly_compute_at_edge_http_req_pending_request_handle_t h, fastly_compute_at_edge_http_req_response_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_pending_req_wait((int32_t) (h), ptr); - fastly_world_result_fastly_compute_at_edge_http_req_response_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_response_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (fastly_compute_at_edge_http_types_response_t) { - (uint32_t) (*((int32_t*) (ptr + 4))), - (uint32_t) (*((int32_t*) (ptr + 8))), + (fastly_compute_at_edge_http_types_response_handle_t) (uint32_t) (*((int32_t*) (ptr + 4))), + (fastly_compute_at_edge_http_types_body_handle_t) (uint32_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; } } @@ -3099,21 +2657,21 @@ bool fastly_compute_at_edge_http_req_pending_req_wait(fastly_compute_at_edge_htt bool fastly_compute_at_edge_http_req_pending_req_wait_v2(fastly_compute_at_edge_http_req_pending_request_handle_t h, fastly_compute_at_edge_http_req_send_error_detail_t *s, fastly_compute_at_edge_http_req_response_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_pending_req_wait_v2((int32_t) (h), (int32_t) (*s).tag, (*s).mask, (int32_t) ((*s).dns_error_rcode), (int32_t) ((*s).dns_error_info_code), (int32_t) ((*s).tls_alert_id), ptr); - fastly_world_result_fastly_compute_at_edge_http_req_response_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_response_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (fastly_compute_at_edge_http_types_response_t) { - (uint32_t) (*((int32_t*) (ptr + 4))), - (uint32_t) (*((int32_t*) (ptr + 8))), + (fastly_compute_at_edge_http_types_response_handle_t) (uint32_t) (*((int32_t*) (ptr + 4))), + (fastly_compute_at_edge_http_types_body_handle_t) (uint32_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; } } @@ -3126,27 +2684,27 @@ bool fastly_compute_at_edge_http_req_pending_req_wait_v2(fastly_compute_at_edge_ } } -bool fastly_compute_at_edge_http_req_pending_req_select(fastly_world_list_fastly_compute_at_edge_http_req_pending_request_handle_t *h, fastly_world_tuple2_u32_fastly_compute_at_edge_http_req_response_t *ret, fastly_compute_at_edge_http_req_error_t *err) { +bool fastly_compute_at_edge_http_req_pending_req_select(fastly_world_list_pending_request_handle_t *h, fastly_world_tuple2_u32_response_t *ret, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_req_pending_req_select((int32_t) (*h).ptr, (int32_t) (*h).len, ptr); - fastly_world_result_tuple2_u32_fastly_compute_at_edge_http_req_response_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_req_pending_req_select((uint8_t *) (*h).ptr, (*h).len, ptr); + fastly_compute_at_edge_http_req_result_tuple2_u32_response_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (fastly_world_tuple2_u32_fastly_compute_at_edge_http_req_response_t) { - (uint32_t) (*((int32_t*) (ptr + 4))), - (fastly_compute_at_edge_http_types_response_t) { - (uint32_t) (*((int32_t*) (ptr + 8))), - (uint32_t) (*((int32_t*) (ptr + 12))), + result.val.ok = (fastly_world_tuple2_u32_response_t) { + (uint32_t) (uint32_t) (*((int32_t*) (ptr + 4))), + (fastly_compute_at_edge_http_req_response_t) (fastly_compute_at_edge_http_types_response_t) { + (fastly_compute_at_edge_http_types_response_handle_t) (uint32_t) (*((int32_t*) (ptr + 8))), + (fastly_compute_at_edge_http_types_body_handle_t) (uint32_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; } } @@ -3159,20 +2717,20 @@ bool fastly_compute_at_edge_http_req_pending_req_select(fastly_world_list_fastly } } -bool fastly_compute_at_edge_http_req_pending_req_select_v2(fastly_world_list_fastly_compute_at_edge_http_req_pending_request_handle_t *h, fastly_world_tuple2_u32_fastly_compute_at_edge_http_req_response_t *ret, fastly_compute_at_edge_http_req_send_error_detail_t *err) { +bool fastly_compute_at_edge_http_req_pending_req_select_v2(fastly_world_list_pending_request_handle_t *h, fastly_world_tuple2_u32_response_t *ret, fastly_compute_at_edge_http_req_send_error_detail_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_req_pending_req_select_v2((int32_t) (*h).ptr, (int32_t) (*h).len, ptr); - fastly_world_result_tuple2_u32_fastly_compute_at_edge_http_req_response_fastly_compute_at_edge_http_req_send_error_detail_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_req_pending_req_select_v2((uint8_t *) (*h).ptr, (*h).len, ptr); + fastly_compute_at_edge_http_req_result_tuple2_u32_response_send_error_detail_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (fastly_world_tuple2_u32_fastly_compute_at_edge_http_req_response_t) { - (uint32_t) (*((int32_t*) (ptr + 4))), - (fastly_compute_at_edge_http_types_response_t) { - (uint32_t) (*((int32_t*) (ptr + 8))), - (uint32_t) (*((int32_t*) (ptr + 12))), + result.val.ok = (fastly_world_tuple2_u32_response_t) { + (uint32_t) (uint32_t) (*((int32_t*) (ptr + 4))), + (fastly_compute_at_edge_http_req_response_t) (fastly_compute_at_edge_http_types_response_t) { + (fastly_compute_at_edge_http_types_response_handle_t) (uint32_t) (*((int32_t*) (ptr + 8))), + (fastly_compute_at_edge_http_types_body_handle_t) (uint32_t) (*((int32_t*) (ptr + 12))), }, }; break; @@ -3180,11 +2738,11 @@ bool fastly_compute_at_edge_http_req_pending_req_select_v2(fastly_world_list_fas case 1: { result.is_err = true; result.val.err = (fastly_compute_at_edge_http_types_send_error_detail_t) { - (int32_t) (*((uint8_t*) (ptr + 4))), - (int32_t) (*((uint8_t*) (ptr + 5))), - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 6)))), - (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 8)))), - (uint8_t) ((int32_t) (*((uint8_t*) (ptr + 10)))), + (fastly_compute_at_edge_http_types_send_error_detail_tag_t) (int32_t) *((uint8_t*) (ptr + 4)), + (fastly_compute_at_edge_http_types_send_error_detail_mask_t) (int32_t) *((uint8_t*) (ptr + 5)), + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 6))), + (uint16_t) (uint16_t) ((int32_t) *((uint16_t*) (ptr + 8))), + (uint8_t) (uint8_t) ((int32_t) *((uint8_t*) (ptr + 10))), }; break; } @@ -3201,17 +2759,17 @@ bool fastly_compute_at_edge_http_req_pending_req_select_v2(fastly_world_list_fas bool fastly_compute_at_edge_http_req_close(fastly_compute_at_edge_http_req_request_handle_t h, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_close((int32_t) (h), ptr); - fastly_world_result_void_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_void_error_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; } } @@ -3226,17 +2784,17 @@ bool fastly_compute_at_edge_http_req_close(fastly_compute_at_edge_http_req_reque bool fastly_compute_at_edge_http_req_auto_decompress_response_set(fastly_compute_at_edge_http_req_request_handle_t h, fastly_compute_at_edge_http_req_content_encodings_t encodings, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_auto_decompress_response_set((int32_t) (h), encodings, ptr); - fastly_world_result_void_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_void_error_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; } } @@ -3251,17 +2809,17 @@ bool fastly_compute_at_edge_http_req_auto_decompress_response_set(fastly_compute bool fastly_compute_at_edge_http_req_upgrade_websocket(fastly_world_string_t *backend, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_req_upgrade_websocket((int32_t) (*backend).ptr, (int32_t) (*backend).len, ptr); - fastly_world_result_void_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_req_upgrade_websocket((uint8_t *) (*backend).ptr, (*backend).len, ptr); + fastly_compute_at_edge_http_req_result_void_error_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; } } @@ -3276,17 +2834,17 @@ bool fastly_compute_at_edge_http_req_upgrade_websocket(fastly_world_string_t *ba bool fastly_compute_at_edge_http_req_redirect_to_websocket_proxy(fastly_world_string_t *backend, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_req_redirect_to_websocket_proxy((int32_t) (*backend).ptr, (int32_t) (*backend).len, ptr); - fastly_world_result_void_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_req_redirect_to_websocket_proxy((uint8_t *) (*backend).ptr, (*backend).len, ptr); + fastly_compute_at_edge_http_req_result_void_error_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; } } @@ -3301,17 +2859,17 @@ bool fastly_compute_at_edge_http_req_redirect_to_websocket_proxy(fastly_world_st bool fastly_compute_at_edge_http_req_redirect_to_grip_proxy(fastly_world_string_t *backend, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_req_redirect_to_grip_proxy((int32_t) (*backend).ptr, (int32_t) (*backend).len, ptr); - fastly_world_result_void_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_req_redirect_to_grip_proxy((uint8_t *) (*backend).ptr, (*backend).len, ptr); + fastly_compute_at_edge_http_req_result_void_error_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; } } @@ -3326,17 +2884,17 @@ bool fastly_compute_at_edge_http_req_redirect_to_grip_proxy(fastly_world_string_ bool fastly_compute_at_edge_http_req_framing_headers_mode_set(fastly_compute_at_edge_http_req_request_handle_t h, fastly_compute_at_edge_http_req_framing_headers_mode_t mode, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_framing_headers_mode_set((int32_t) (h), (int32_t) mode, ptr); - fastly_world_result_void_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_req_result_void_error_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; } } @@ -3351,16 +2909,16 @@ bool fastly_compute_at_edge_http_req_framing_headers_mode_set(fastly_compute_at_ bool fastly_compute_at_edge_http_req_register_dynamic_backend(fastly_world_string_t *prefix, fastly_world_string_t *target, fastly_compute_at_edge_http_req_dynamic_backend_config_t *config, fastly_compute_at_edge_http_req_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[124]; - int32_t ptr = (int32_t) &ret_area; - *((int32_t*)(ptr + 4)) = (int32_t) (*prefix).len; - *((int32_t*)(ptr + 0)) = (int32_t) (*prefix).ptr; - *((int32_t*)(ptr + 12)) = (int32_t) (*target).len; - *((int32_t*)(ptr + 8)) = (int32_t) (*target).ptr; + uint8_t *ptr = (uint8_t *) &ret_area; + *((size_t*)(ptr + 4)) = (*prefix).len; + *((uint8_t **)(ptr + 0)) = (uint8_t *) (*prefix).ptr; + *((size_t*)(ptr + 12)) = (*target).len; + *((uint8_t **)(ptr + 8)) = (uint8_t *) (*target).ptr; if (((*config).host_override).is_some) { const fastly_world_string_t *payload0 = &((*config).host_override).val; *((int8_t*)(ptr + 16)) = 1; - *((int32_t*)(ptr + 24)) = (int32_t) (*payload0).len; - *((int32_t*)(ptr + 20)) = (int32_t) (*payload0).ptr; + *((size_t*)(ptr + 24)) = (*payload0).len; + *((uint8_t **)(ptr + 20)) = (uint8_t *) (*payload0).ptr; } else { *((int8_t*)(ptr + 16)) = 0; } @@ -3416,55 +2974,55 @@ bool fastly_compute_at_edge_http_req_register_dynamic_backend(fastly_world_strin if (((*config).cert_hostname).is_some) { const fastly_world_string_t *payload16 = &((*config).cert_hostname).val; *((int8_t*)(ptr + 60)) = 1; - *((int32_t*)(ptr + 68)) = (int32_t) (*payload16).len; - *((int32_t*)(ptr + 64)) = (int32_t) (*payload16).ptr; + *((size_t*)(ptr + 68)) = (*payload16).len; + *((uint8_t **)(ptr + 64)) = (uint8_t *) (*payload16).ptr; } else { *((int8_t*)(ptr + 60)) = 0; } if (((*config).ca_cert).is_some) { const fastly_world_string_t *payload18 = &((*config).ca_cert).val; *((int8_t*)(ptr + 72)) = 1; - *((int32_t*)(ptr + 80)) = (int32_t) (*payload18).len; - *((int32_t*)(ptr + 76)) = (int32_t) (*payload18).ptr; + *((size_t*)(ptr + 80)) = (*payload18).len; + *((uint8_t **)(ptr + 76)) = (uint8_t *) (*payload18).ptr; } else { *((int8_t*)(ptr + 72)) = 0; } if (((*config).ciphers).is_some) { const fastly_world_string_t *payload20 = &((*config).ciphers).val; *((int8_t*)(ptr + 84)) = 1; - *((int32_t*)(ptr + 92)) = (int32_t) (*payload20).len; - *((int32_t*)(ptr + 88)) = (int32_t) (*payload20).ptr; + *((size_t*)(ptr + 92)) = (*payload20).len; + *((uint8_t **)(ptr + 88)) = (uint8_t *) (*payload20).ptr; } else { *((int8_t*)(ptr + 84)) = 0; } if (((*config).sni_hostname).is_some) { const fastly_world_string_t *payload22 = &((*config).sni_hostname).val; *((int8_t*)(ptr + 96)) = 1; - *((int32_t*)(ptr + 104)) = (int32_t) (*payload22).len; - *((int32_t*)(ptr + 100)) = (int32_t) (*payload22).ptr; + *((size_t*)(ptr + 104)) = (*payload22).len; + *((uint8_t **)(ptr + 100)) = (uint8_t *) (*payload22).ptr; } else { *((int8_t*)(ptr + 96)) = 0; } if (((*config).client_cert).is_some) { const fastly_compute_at_edge_http_types_client_cert_config_t *payload24 = &((*config).client_cert).val; *((int8_t*)(ptr + 108)) = 1; - *((int32_t*)(ptr + 116)) = (int32_t) ((*payload24).client_cert).len; - *((int32_t*)(ptr + 112)) = (int32_t) ((*payload24).client_cert).ptr; + *((size_t*)(ptr + 116)) = ((*payload24).client_cert).len; + *((uint8_t **)(ptr + 112)) = (uint8_t *) ((*payload24).client_cert).ptr; *((int32_t*)(ptr + 120)) = (int32_t) ((*payload24).client_key); } else { *((int8_t*)(ptr + 108)) = 0; } - int32_t ptr25 = (int32_t) &ret_area; + uint8_t *ptr25 = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_req_register_dynamic_backend(ptr, ptr25); - fastly_world_result_void_fastly_compute_at_edge_http_req_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr25 + 0)))) { + fastly_compute_at_edge_http_req_result_void_error_t result; + switch ((int32_t) *((uint8_t*) (ptr25 + 0))) { case 0: { result.is_err = false; break; } case 1: { result.is_err = true; - result.val.err = (int32_t) (*((uint8_t*) (ptr25 + 1))); + result.val.err = (int32_t) *((uint8_t*) (ptr25 + 1)); break; } } @@ -3479,10 +3037,10 @@ bool fastly_compute_at_edge_http_req_register_dynamic_backend(fastly_world_strin bool fastly_compute_at_edge_http_resp_new(fastly_compute_at_edge_http_resp_response_handle_t *ret, fastly_compute_at_edge_http_resp_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_resp_new(ptr); - fastly_world_result_fastly_compute_at_edge_http_resp_response_handle_fastly_compute_at_edge_http_resp_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_resp_result_response_handle_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -3490,7 +3048,7 @@ bool fastly_compute_at_edge_http_resp_new(fastly_compute_at_edge_http_resp_respo } 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; } } @@ -3506,18 +3064,18 @@ bool fastly_compute_at_edge_http_resp_new(fastly_compute_at_edge_http_resp_respo bool fastly_compute_at_edge_http_resp_header_names_get(fastly_compute_at_edge_http_resp_response_handle_t h, fastly_world_list_string_t *ret, fastly_compute_at_edge_http_resp_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_resp_header_names_get((int32_t) (h), ptr); - fastly_world_result_list_string_fastly_compute_at_edge_http_resp_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_resp_result_list_string_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (fastly_world_list_string_t) { (fastly_world_string_t*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }; + result.val.ok = (fastly_world_list_string_t) { (fastly_world_string_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; } } @@ -3533,31 +3091,31 @@ bool fastly_compute_at_edge_http_resp_header_names_get(fastly_compute_at_edge_ht bool fastly_compute_at_edge_http_resp_header_value_get(fastly_compute_at_edge_http_resp_response_handle_t h, fastly_world_string_t *name, fastly_world_option_string_t *ret, fastly_compute_at_edge_http_resp_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_resp_header_value_get((int32_t) (h), (int32_t) (*name).ptr, (int32_t) (*name).len, ptr); - fastly_world_result_option_string_fastly_compute_at_edge_http_resp_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_resp_header_value_get((int32_t) (h), (uint8_t *) (*name).ptr, (*name).len, ptr); + fastly_compute_at_edge_http_resp_result_option_string_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; fastly_world_option_string_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 4)))) { + switch ((int32_t) *((uint8_t*) (ptr + 4))) { case 0: { option.is_some = false; break; } case 1: { option.is_some = true; - option.val = (fastly_world_string_t) { (char*)(*((int32_t*) (ptr + 8))), (size_t)(*((int32_t*) (ptr + 12))) }; + option.val = (fastly_world_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 8))), (*((size_t*) (ptr + 12))) }; 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; } } @@ -3573,31 +3131,31 @@ bool fastly_compute_at_edge_http_resp_header_value_get(fastly_compute_at_edge_ht bool fastly_compute_at_edge_http_resp_header_values_get(fastly_compute_at_edge_http_resp_response_handle_t h, fastly_world_string_t *name, fastly_world_option_list_list_u8_t *ret, fastly_compute_at_edge_http_resp_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_resp_header_values_get((int32_t) (h), (int32_t) (*name).ptr, (int32_t) (*name).len, ptr); - fastly_world_result_option_list_list_u8_fastly_compute_at_edge_http_resp_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_resp_header_values_get((int32_t) (h), (uint8_t *) (*name).ptr, (*name).len, ptr); + fastly_compute_at_edge_http_resp_result_option_list_list_u8_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; fastly_world_option_list_list_u8_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 4)))) { + switch ((int32_t) *((uint8_t*) (ptr + 4))) { case 0: { option.is_some = false; break; } case 1: { option.is_some = true; - option.val = (fastly_world_list_list_u8_t) { (fastly_world_list_u8_t*)(*((int32_t*) (ptr + 8))), (size_t)(*((int32_t*) (ptr + 12))) }; + option.val = (fastly_world_list_list_u8_t) { (fastly_world_list_u8_t*)(*((uint8_t **) (ptr + 8))), (*((size_t*) (ptr + 12))) }; 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; } } @@ -3613,17 +3171,17 @@ bool fastly_compute_at_edge_http_resp_header_values_get(fastly_compute_at_edge_h bool fastly_compute_at_edge_http_resp_header_values_set(fastly_compute_at_edge_http_resp_response_handle_t h, fastly_world_string_t *name, fastly_world_list_list_u8_t *values, fastly_compute_at_edge_http_resp_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_resp_header_values_set((int32_t) (h), (int32_t) (*name).ptr, (int32_t) (*name).len, (int32_t) (*values).ptr, (int32_t) (*values).len, ptr); - fastly_world_result_void_fastly_compute_at_edge_http_resp_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_resp_header_values_set((int32_t) (h), (uint8_t *) (*name).ptr, (*name).len, (uint8_t *) (*values).ptr, (*values).len, ptr); + fastly_compute_at_edge_http_resp_result_void_error_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; } } @@ -3638,17 +3196,17 @@ bool fastly_compute_at_edge_http_resp_header_values_set(fastly_compute_at_edge_h bool fastly_compute_at_edge_http_resp_header_insert(fastly_compute_at_edge_http_resp_response_handle_t h, fastly_world_string_t *name, fastly_world_list_u8_t *value, fastly_compute_at_edge_http_resp_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_resp_header_insert((int32_t) (h), (int32_t) (*name).ptr, (int32_t) (*name).len, (int32_t) (*value).ptr, (int32_t) (*value).len, ptr); - fastly_world_result_void_fastly_compute_at_edge_http_resp_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_resp_header_insert((int32_t) (h), (uint8_t *) (*name).ptr, (*name).len, (uint8_t *) (*value).ptr, (*value).len, ptr); + fastly_compute_at_edge_http_resp_result_void_error_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; } } @@ -3663,17 +3221,17 @@ bool fastly_compute_at_edge_http_resp_header_insert(fastly_compute_at_edge_http_ bool fastly_compute_at_edge_http_resp_header_append(fastly_compute_at_edge_http_resp_response_handle_t h, fastly_world_string_t *name, fastly_world_list_u8_t *value, fastly_compute_at_edge_http_resp_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_resp_header_append((int32_t) (h), (int32_t) (*name).ptr, (int32_t) (*name).len, (int32_t) (*value).ptr, (int32_t) (*value).len, ptr); - fastly_world_result_void_fastly_compute_at_edge_http_resp_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_resp_header_append((int32_t) (h), (uint8_t *) (*name).ptr, (*name).len, (uint8_t *) (*value).ptr, (*value).len, ptr); + fastly_compute_at_edge_http_resp_result_void_error_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; } } @@ -3688,17 +3246,17 @@ bool fastly_compute_at_edge_http_resp_header_append(fastly_compute_at_edge_http_ bool fastly_compute_at_edge_http_resp_header_remove(fastly_compute_at_edge_http_resp_response_handle_t h, fastly_world_string_t *name, fastly_compute_at_edge_http_resp_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_http_resp_header_remove((int32_t) (h), (int32_t) (*name).ptr, (int32_t) (*name).len, ptr); - fastly_world_result_void_fastly_compute_at_edge_http_resp_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_http_resp_header_remove((int32_t) (h), (uint8_t *) (*name).ptr, (*name).len, ptr); + fastly_compute_at_edge_http_resp_result_void_error_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; } } @@ -3713,18 +3271,18 @@ bool fastly_compute_at_edge_http_resp_header_remove(fastly_compute_at_edge_http_ bool fastly_compute_at_edge_http_resp_version_get(fastly_compute_at_edge_http_resp_response_handle_t h, fastly_compute_at_edge_http_resp_http_version_t *ret, fastly_compute_at_edge_http_resp_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_resp_version_get((int32_t) (h), ptr); - fastly_world_result_fastly_compute_at_edge_http_resp_http_version_fastly_compute_at_edge_http_resp_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_resp_result_http_version_error_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; } } @@ -3740,17 +3298,17 @@ bool fastly_compute_at_edge_http_resp_version_get(fastly_compute_at_edge_http_re bool fastly_compute_at_edge_http_resp_version_set(fastly_compute_at_edge_http_resp_response_handle_t h, fastly_compute_at_edge_http_resp_http_version_t version, fastly_compute_at_edge_http_resp_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_resp_version_set((int32_t) (h), (int32_t) version, ptr); - fastly_world_result_void_fastly_compute_at_edge_http_resp_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_resp_result_void_error_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; } } @@ -3765,17 +3323,17 @@ bool fastly_compute_at_edge_http_resp_version_set(fastly_compute_at_edge_http_re bool fastly_compute_at_edge_http_resp_send_downstream(fastly_compute_at_edge_http_resp_response_handle_t h, fastly_compute_at_edge_http_resp_body_handle_t b, bool streaming, fastly_compute_at_edge_http_resp_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_resp_send_downstream((int32_t) (h), (int32_t) (b), streaming, ptr); - fastly_world_result_void_fastly_compute_at_edge_http_resp_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_resp_result_void_error_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; } } @@ -3790,18 +3348,18 @@ bool fastly_compute_at_edge_http_resp_send_downstream(fastly_compute_at_edge_htt bool fastly_compute_at_edge_http_resp_status_get(fastly_compute_at_edge_http_resp_response_handle_t h, fastly_compute_at_edge_http_resp_http_status_t *ret, fastly_compute_at_edge_http_resp_error_t *err) { __attribute__((__aligned__(2))) uint8_t ret_area[4]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_resp_status_get((int32_t) (h), ptr); - fastly_world_result_fastly_compute_at_edge_http_resp_http_status_fastly_compute_at_edge_http_resp_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_resp_result_http_status_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - result.val.ok = (uint16_t) ((int32_t) (*((uint16_t*) (ptr + 2)))); + result.val.ok = (uint16_t) ((int32_t) *((uint16_t*) (ptr + 2))); 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; } } @@ -3817,17 +3375,17 @@ bool fastly_compute_at_edge_http_resp_status_get(fastly_compute_at_edge_http_res bool fastly_compute_at_edge_http_resp_status_set(fastly_compute_at_edge_http_resp_response_handle_t h, fastly_compute_at_edge_http_resp_http_status_t status, fastly_compute_at_edge_http_resp_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_resp_status_set((int32_t) (h), (int32_t) (status), ptr); - fastly_world_result_void_fastly_compute_at_edge_http_resp_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_resp_result_void_error_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; } } @@ -3842,17 +3400,17 @@ bool fastly_compute_at_edge_http_resp_status_set(fastly_compute_at_edge_http_res bool fastly_compute_at_edge_http_resp_close(fastly_compute_at_edge_http_resp_response_handle_t h, fastly_compute_at_edge_http_resp_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_resp_close((int32_t) (h), ptr); - fastly_world_result_void_fastly_compute_at_edge_http_resp_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_resp_result_void_error_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; } } @@ -3867,17 +3425,17 @@ bool fastly_compute_at_edge_http_resp_close(fastly_compute_at_edge_http_resp_res bool fastly_compute_at_edge_http_resp_framing_headers_mode_set(fastly_compute_at_edge_http_resp_response_handle_t h, fastly_compute_at_edge_http_resp_framing_headers_mode_t mode, fastly_compute_at_edge_http_resp_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_resp_framing_headers_mode_set((int32_t) (h), (int32_t) mode, ptr); - fastly_world_result_void_fastly_compute_at_edge_http_resp_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_resp_result_void_error_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; } } @@ -3892,17 +3450,17 @@ bool fastly_compute_at_edge_http_resp_framing_headers_mode_set(fastly_compute_at bool fastly_compute_at_edge_http_resp_http_keepalive_mode_set(fastly_compute_at_edge_http_resp_response_handle_t h, fastly_compute_at_edge_http_resp_keepalive_mode_t mode, fastly_compute_at_edge_http_resp_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_http_resp_http_keepalive_mode_set((int32_t) (h), (int32_t) mode, ptr); - fastly_world_result_void_fastly_compute_at_edge_http_resp_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_http_resp_result_void_error_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; } } @@ -3917,10 +3475,10 @@ bool fastly_compute_at_edge_http_resp_http_keepalive_mode_set(fastly_compute_at_ bool fastly_compute_at_edge_log_endpoint_get(fastly_world_string_t *name, fastly_compute_at_edge_log_handle_t *ret, fastly_compute_at_edge_log_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_log_endpoint_get((int32_t) (*name).ptr, (int32_t) (*name).len, ptr); - fastly_world_result_fastly_compute_at_edge_log_handle_fastly_compute_at_edge_log_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_log_endpoint_get((uint8_t *) (*name).ptr, (*name).len, ptr); + fastly_compute_at_edge_log_result_handle_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -3928,7 +3486,7 @@ bool fastly_compute_at_edge_log_endpoint_get(fastly_world_string_t *name, fastly } 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; } } @@ -3944,17 +3502,17 @@ bool fastly_compute_at_edge_log_endpoint_get(fastly_world_string_t *name, fastly bool fastly_compute_at_edge_log_write(fastly_compute_at_edge_log_handle_t h, fastly_world_string_t *msg, fastly_compute_at_edge_log_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_log_write((int32_t) (h), (int32_t) (*msg).ptr, (int32_t) (*msg).len, ptr); - fastly_world_result_void_fastly_compute_at_edge_log_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_log_write((int32_t) (h), (uint8_t *) (*msg).ptr, (*msg).len, ptr); + fastly_compute_at_edge_log_result_void_error_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; } } @@ -3969,10 +3527,10 @@ bool fastly_compute_at_edge_log_write(fastly_compute_at_edge_log_handle_t h, fas bool fastly_compute_at_edge_object_store_open(fastly_world_string_t *name, fastly_compute_at_edge_object_store_handle_t *ret, fastly_compute_at_edge_object_store_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_object_store_open((int32_t) (*name).ptr, (int32_t) (*name).len, ptr); - fastly_world_result_fastly_compute_at_edge_object_store_handle_fastly_compute_at_edge_object_store_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_object_store_open((uint8_t *) (*name).ptr, (*name).len, ptr); + fastly_compute_at_edge_object_store_result_handle_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -3980,7 +3538,7 @@ bool fastly_compute_at_edge_object_store_open(fastly_world_string_t *name, fastl } 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; } } @@ -3993,17 +3551,17 @@ bool fastly_compute_at_edge_object_store_open(fastly_world_string_t *name, fastl } } -bool fastly_compute_at_edge_object_store_lookup(fastly_compute_at_edge_object_store_handle_t store, fastly_world_string_t *key, fastly_world_option_fastly_compute_at_edge_object_store_body_handle_t *ret, fastly_compute_at_edge_object_store_error_t *err) { +bool fastly_compute_at_edge_object_store_lookup(fastly_compute_at_edge_object_store_handle_t store, fastly_world_string_t *key, fastly_world_option_body_handle_t *ret, fastly_compute_at_edge_object_store_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_object_store_lookup((int32_t) (store), (int32_t) (*key).ptr, (int32_t) (*key).len, ptr); - fastly_world_result_option_fastly_compute_at_edge_object_store_body_handle_fastly_compute_at_edge_object_store_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_object_store_lookup((int32_t) (store), (uint8_t *) (*key).ptr, (*key).len, ptr); + fastly_compute_at_edge_object_store_result_option_body_handle_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - fastly_world_option_fastly_compute_at_edge_object_store_body_handle_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 4)))) { + fastly_world_option_body_handle_t option; + switch ((int32_t) *((uint8_t*) (ptr + 4))) { case 0: { option.is_some = false; break; @@ -4014,13 +3572,13 @@ bool fastly_compute_at_edge_object_store_lookup(fastly_compute_at_edge_object_st 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; } } @@ -4036,10 +3594,10 @@ bool fastly_compute_at_edge_object_store_lookup(fastly_compute_at_edge_object_st bool fastly_compute_at_edge_object_store_lookup_async(fastly_compute_at_edge_object_store_handle_t store, fastly_world_string_t *key, fastly_compute_at_edge_object_store_pending_handle_t *ret, fastly_compute_at_edge_object_store_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_object_store_lookup_async((int32_t) (store), (int32_t) (*key).ptr, (int32_t) (*key).len, ptr); - fastly_world_result_fastly_compute_at_edge_object_store_pending_handle_fastly_compute_at_edge_object_store_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_object_store_lookup_async((int32_t) (store), (uint8_t *) (*key).ptr, (*key).len, ptr); + fastly_compute_at_edge_object_store_result_pending_handle_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -4047,7 +3605,7 @@ bool fastly_compute_at_edge_object_store_lookup_async(fastly_compute_at_edge_obj } 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; } } @@ -4060,17 +3618,17 @@ bool fastly_compute_at_edge_object_store_lookup_async(fastly_compute_at_edge_obj } } -bool fastly_compute_at_edge_object_store_pending_lookup_wait(fastly_compute_at_edge_object_store_pending_handle_t handle, fastly_world_option_fastly_compute_at_edge_object_store_body_handle_t *ret, fastly_compute_at_edge_object_store_error_t *err) { +bool fastly_compute_at_edge_object_store_pending_lookup_wait(fastly_compute_at_edge_object_store_pending_handle_t handle, fastly_world_option_body_handle_t *ret, fastly_compute_at_edge_object_store_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_object_store_pending_lookup_wait((int32_t) (handle), ptr); - fastly_world_result_option_fastly_compute_at_edge_object_store_body_handle_fastly_compute_at_edge_object_store_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_object_store_result_option_body_handle_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - fastly_world_option_fastly_compute_at_edge_object_store_body_handle_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 4)))) { + fastly_world_option_body_handle_t option; + switch ((int32_t) *((uint8_t*) (ptr + 4))) { case 0: { option.is_some = false; break; @@ -4081,13 +3639,13 @@ bool fastly_compute_at_edge_object_store_pending_lookup_wait(fastly_compute_at_e 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; } } @@ -4103,10 +3661,10 @@ bool fastly_compute_at_edge_object_store_pending_lookup_wait(fastly_compute_at_e bool fastly_compute_at_edge_object_store_delete_async(fastly_compute_at_edge_object_store_handle_t store, fastly_world_string_t *key, fastly_compute_at_edge_object_store_pending_handle_t *ret, fastly_compute_at_edge_object_store_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_object_store_delete_async((int32_t) (store), (int32_t) (*key).ptr, (int32_t) (*key).len, ptr); - fastly_world_result_fastly_compute_at_edge_object_store_pending_handle_fastly_compute_at_edge_object_store_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_object_store_delete_async((int32_t) (store), (uint8_t *) (*key).ptr, (*key).len, ptr); + fastly_compute_at_edge_object_store_result_pending_handle_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -4114,7 +3672,7 @@ bool fastly_compute_at_edge_object_store_delete_async(fastly_compute_at_edge_obj } 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; } } @@ -4130,17 +3688,17 @@ bool fastly_compute_at_edge_object_store_delete_async(fastly_compute_at_edge_obj bool fastly_compute_at_edge_object_store_pending_delete_wait(fastly_compute_at_edge_object_store_pending_handle_t handle, fastly_compute_at_edge_object_store_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_object_store_pending_delete_wait((int32_t) (handle), ptr); - fastly_world_result_void_fastly_compute_at_edge_object_store_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_object_store_result_void_error_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; } } @@ -4155,17 +3713,17 @@ bool fastly_compute_at_edge_object_store_pending_delete_wait(fastly_compute_at_e bool fastly_compute_at_edge_object_store_insert(fastly_compute_at_edge_object_store_handle_t store, fastly_world_string_t *key, fastly_compute_at_edge_object_store_body_handle_t body_handle, fastly_compute_at_edge_object_store_error_t *err) { __attribute__((__aligned__(1))) uint8_t ret_area[2]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_object_store_insert((int32_t) (store), (int32_t) (*key).ptr, (int32_t) (*key).len, (int32_t) (body_handle), ptr); - fastly_world_result_void_fastly_compute_at_edge_object_store_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_object_store_insert((int32_t) (store), (uint8_t *) (*key).ptr, (*key).len, (int32_t) (body_handle), ptr); + fastly_compute_at_edge_object_store_result_void_error_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,31 +3738,31 @@ bool fastly_compute_at_edge_object_store_insert(fastly_compute_at_edge_object_st bool fastly_compute_at_edge_purge_surrogate_key(fastly_world_string_t *surrogate_keys, fastly_compute_at_edge_purge_options_mask_t purge_options, fastly_world_option_string_t *ret, fastly_compute_at_edge_purge_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_purge_surrogate_key((int32_t) (*surrogate_keys).ptr, (int32_t) (*surrogate_keys).len, purge_options, ptr); - fastly_world_result_option_string_fastly_compute_at_edge_purge_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_purge_surrogate_key((uint8_t *) (*surrogate_keys).ptr, (*surrogate_keys).len, purge_options, ptr); + fastly_compute_at_edge_purge_result_option_string_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; fastly_world_option_string_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 4)))) { + switch ((int32_t) *((uint8_t*) (ptr + 4))) { case 0: { option.is_some = false; break; } case 1: { option.is_some = true; - option.val = (fastly_world_string_t) { (char*)(*((int32_t*) (ptr + 8))), (size_t)(*((int32_t*) (ptr + 12))) }; + option.val = (fastly_world_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 8))), (*((size_t*) (ptr + 12))) }; 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; } } @@ -4220,10 +3778,10 @@ bool fastly_compute_at_edge_purge_surrogate_key(fastly_world_string_t *surrogate bool fastly_compute_at_edge_secret_store_open(fastly_world_string_t *name, fastly_compute_at_edge_secret_store_store_handle_t *ret, fastly_compute_at_edge_secret_store_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_secret_store_open((int32_t) (*name).ptr, (int32_t) (*name).len, ptr); - fastly_world_result_fastly_compute_at_edge_secret_store_store_handle_fastly_compute_at_edge_secret_store_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_secret_store_open((uint8_t *) (*name).ptr, (*name).len, ptr); + fastly_compute_at_edge_secret_store_result_store_handle_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -4231,7 +3789,7 @@ bool fastly_compute_at_edge_secret_store_open(fastly_world_string_t *name, fastl } 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; } } @@ -4244,17 +3802,17 @@ bool fastly_compute_at_edge_secret_store_open(fastly_world_string_t *name, fastl } } -bool fastly_compute_at_edge_secret_store_get(fastly_compute_at_edge_secret_store_store_handle_t store, fastly_world_string_t *key, fastly_world_option_fastly_compute_at_edge_secret_store_secret_handle_t *ret, fastly_compute_at_edge_secret_store_error_t *err) { +bool fastly_compute_at_edge_secret_store_get(fastly_compute_at_edge_secret_store_store_handle_t store, fastly_world_string_t *key, fastly_world_option_secret_handle_t *ret, fastly_compute_at_edge_secret_store_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[12]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_secret_store_get((int32_t) (store), (int32_t) (*key).ptr, (int32_t) (*key).len, ptr); - fastly_world_result_option_fastly_compute_at_edge_secret_store_secret_handle_fastly_compute_at_edge_secret_store_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_secret_store_get((int32_t) (store), (uint8_t *) (*key).ptr, (*key).len, ptr); + fastly_compute_at_edge_secret_store_result_option_secret_handle_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - fastly_world_option_fastly_compute_at_edge_secret_store_secret_handle_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 4)))) { + fastly_world_option_secret_handle_t option; + switch ((int32_t) *((uint8_t*) (ptr + 4))) { case 0: { option.is_some = false; break; @@ -4265,13 +3823,13 @@ bool fastly_compute_at_edge_secret_store_get(fastly_compute_at_edge_secret_store 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; } } @@ -4284,34 +3842,34 @@ bool fastly_compute_at_edge_secret_store_get(fastly_compute_at_edge_secret_store } } -bool fastly_compute_at_edge_secret_store_plaintext(fastly_compute_at_edge_secret_store_secret_handle_t secret, fastly_world_option_string_t *ret, fastly_compute_at_edge_secret_store_error_t *err) { +bool fastly_compute_at_edge_secret_store_plaintext(fastly_compute_at_edge_secret_store_secret_handle_t secret, fastly_world_option_list_u8_t *ret, fastly_compute_at_edge_secret_store_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[16]; - int32_t ptr = (int32_t) &ret_area; + uint8_t *ptr = (uint8_t *) &ret_area; __wasm_import_fastly_compute_at_edge_secret_store_plaintext((int32_t) (secret), ptr); - fastly_world_result_option_string_fastly_compute_at_edge_secret_store_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + fastly_compute_at_edge_secret_store_result_option_list_u8_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; - fastly_world_option_string_t option; - switch ((int32_t) (*((uint8_t*) (ptr + 4)))) { + fastly_world_option_list_u8_t option; + switch ((int32_t) *((uint8_t*) (ptr + 4))) { case 0: { option.is_some = false; break; } case 1: { option.is_some = true; - option.val = (fastly_world_string_t) { (char*)(*((int32_t*) (ptr + 8))), (size_t)(*((int32_t*) (ptr + 12))) }; + option.val = (fastly_world_list_u8_t) { (uint8_t*)(*((uint8_t **) (ptr + 8))), (*((size_t*) (ptr + 12))) }; 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; } } @@ -4324,13 +3882,13 @@ bool fastly_compute_at_edge_secret_store_plaintext(fastly_compute_at_edge_secret } } -bool fastly_compute_at_edge_secret_store_from_bytes(fastly_world_string_t *bytes, fastly_compute_at_edge_secret_store_secret_handle_t *ret, fastly_compute_at_edge_secret_store_error_t *err) { +bool fastly_compute_at_edge_secret_store_from_bytes(fastly_world_list_u8_t *bytes, fastly_compute_at_edge_secret_store_secret_handle_t *ret, fastly_compute_at_edge_secret_store_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[8]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_secret_store_from_bytes((int32_t) (*bytes).ptr, (int32_t) (*bytes).len, ptr); - fastly_world_result_fastly_compute_at_edge_secret_store_secret_handle_fastly_compute_at_edge_secret_store_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_secret_store_from_bytes((uint8_t *) (*bytes).ptr, (*bytes).len, ptr); + fastly_compute_at_edge_secret_store_result_secret_handle_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (uint32_t) (*((int32_t*) (ptr + 4))); @@ -4338,7 +3896,7 @@ bool fastly_compute_at_edge_secret_store_from_bytes(fastly_world_string_t *bytes } 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; } } @@ -4354,23 +3912,23 @@ bool fastly_compute_at_edge_secret_store_from_bytes(fastly_world_string_t *bytes bool fastly_compute_at_edge_uap_parse(fastly_world_string_t *user_agent, fastly_compute_at_edge_uap_user_agent_t *ret, fastly_compute_at_edge_uap_error_t *err) { __attribute__((__aligned__(4))) uint8_t ret_area[36]; - int32_t ptr = (int32_t) &ret_area; - __wasm_import_fastly_compute_at_edge_uap_parse((int32_t) (*user_agent).ptr, (int32_t) (*user_agent).len, ptr); - fastly_world_result_fastly_compute_at_edge_uap_user_agent_fastly_compute_at_edge_uap_error_t result; - switch ((int32_t) (*((uint8_t*) (ptr + 0)))) { + uint8_t *ptr = (uint8_t *) &ret_area; + __wasm_import_fastly_compute_at_edge_uap_parse((uint8_t *) (*user_agent).ptr, (*user_agent).len, ptr); + fastly_compute_at_edge_uap_result_user_agent_error_t result; + switch ((int32_t) *((uint8_t*) (ptr + 0))) { case 0: { result.is_err = false; result.val.ok = (fastly_compute_at_edge_uap_user_agent_t) { - (fastly_world_string_t) { (char*)(*((int32_t*) (ptr + 4))), (size_t)(*((int32_t*) (ptr + 8))) }, - (fastly_world_string_t) { (char*)(*((int32_t*) (ptr + 12))), (size_t)(*((int32_t*) (ptr + 16))) }, - (fastly_world_string_t) { (char*)(*((int32_t*) (ptr + 20))), (size_t)(*((int32_t*) (ptr + 24))) }, - (fastly_world_string_t) { (char*)(*((int32_t*) (ptr + 28))), (size_t)(*((int32_t*) (ptr + 32))) }, + (fastly_world_string_t) (fastly_world_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 4))), (*((size_t*) (ptr + 8))) }, + (fastly_world_string_t) (fastly_world_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 12))), (*((size_t*) (ptr + 16))) }, + (fastly_world_string_t) (fastly_world_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 20))), (*((size_t*) (ptr + 24))) }, + (fastly_world_string_t) (fastly_world_string_t) { (uint8_t*)(*((uint8_t **) (ptr + 28))), (*((size_t*) (ptr + 32))) }, }; 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; } } @@ -4385,11 +3943,11 @@ bool fastly_compute_at_edge_uap_parse(fastly_world_string_t *user_agent, fastly_ __attribute__((__export_name__("fastly:compute-at-edge/reactor#serve"))) int32_t __wasm_export_exports_fastly_compute_at_edge_reactor_serve(int32_t arg, int32_t arg0) { - fastly_compute_at_edge_reactor_request_t arg1 = (fastly_compute_at_edge_http_types_request_t) { - (uint32_t) (arg), - (uint32_t) (arg0), + exports_fastly_compute_at_edge_reactor_request_t arg1 = (fastly_compute_at_edge_http_types_request_t) { + (fastly_compute_at_edge_http_types_request_handle_t) (uint32_t) (arg), + (fastly_compute_at_edge_http_types_body_handle_t) (uint32_t) (arg0), }; - fastly_world_result_void_void_t ret; + exports_fastly_compute_at_edge_reactor_result_void_void_t ret; ret.is_err = !exports_fastly_compute_at_edge_reactor_serve(&arg1); int32_t result; if ((ret).is_err) { @@ -4400,6 +3958,8 @@ int32_t __wasm_export_exports_fastly_compute_at_edge_reactor_serve(int32_t arg, return result; } +// Ensure that the *_component_type.o object is linked in + extern void __component_type_object_force_link_fastly_world(void); void __component_type_object_force_link_fastly_world_public_use_in_this_compilation_unit(void) { __component_type_object_force_link_fastly_world(); diff --git a/runtime/js-compute-runtime/host_interface/component/fastly_world.h b/runtime/js-compute-runtime/host_interface/component/fastly_world.h index def7e0254b..1f6e48512a 100644 --- a/runtime/js-compute-runtime/host_interface/component/fastly_world.h +++ b/runtime/js-compute-runtime/host_interface/component/fastly_world.h @@ -1,20 +1,19 @@ -// Generated by `wit-bindgen` 0.9.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.26.0. DO NOT EDIT! #ifndef __BINDINGS_FASTLY_WORLD_H #define __BINDINGS_FASTLY_WORLD_H #ifdef __cplusplus extern "C" { #endif -#include -#include -#include #include +#include -typedef struct { - char*ptr; +typedef struct fastly_world_string_t { + uint8_t *ptr; size_t len; } fastly_world_string_t; +// TODO: split this up into function-specific error enums typedef uint8_t fastly_compute_at_edge_types_error_t; // Unknown error value. @@ -59,14 +58,56 @@ typedef uint8_t fastly_compute_at_edge_types_error_t; // Invalid HTTP status. #define FASTLY_COMPUTE_AT_EDGE_TYPES_ERROR_HTTP_INVALID_STATUS 12 // Limit exceeded -// +// // This is returned when an attempt to allocate a resource has exceeded the maximum number of // resources permitted. For example, creating too many response handles. #define FASTLY_COMPUTE_AT_EDGE_TYPES_ERROR_LIMIT_EXCEEDED 13 typedef uint32_t fastly_compute_at_edge_types_secret_handle_t; -typedef fastly_compute_at_edge_types_secret_handle_t fastly_compute_at_edge_http_types_secret_handle_t; +typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_async_io_error_t; + +// A handle to an object supporting generic async operations. +// Can be either a `BodyHandle` or a `PendingRequestHandle`. +// +// Each async item has an associated I/O action: +// +// * Pending requests: awaiting the response headers / `Response` object +// * Normal bodies: reading bytes from the body +// * Streaming bodies: writing bytes to the body +// +// For writing bytes, note that there is a large host-side buffer that bytes can eagerly be written +// into, even before the origin itself consumes that data. +typedef uint32_t fastly_compute_at_edge_async_io_handle_t; + +typedef struct { + fastly_compute_at_edge_async_io_handle_t *ptr; + size_t len; +} fastly_world_list_handle_t; + +typedef struct { + bool is_some; + uint32_t val; +} fastly_world_option_u32_t; + +typedef struct { + bool is_err; + union { + fastly_world_option_u32_t ok; + fastly_compute_at_edge_async_io_error_t err; + } val; +} fastly_compute_at_edge_async_io_result_option_u32_error_t; + +typedef struct { + bool is_err; + union { + bool ok; + fastly_compute_at_edge_async_io_error_t err; + } val; +} fastly_compute_at_edge_async_io_result_bool_error_t; + +typedef fastly_compute_at_edge_types_secret_handle_t + fastly_compute_at_edge_http_types_secret_handle_t; typedef uint32_t fastly_compute_at_edge_http_types_body_handle_t; @@ -76,12 +117,12 @@ typedef uint32_t fastly_compute_at_edge_http_types_pending_request_handle_t; typedef uint32_t fastly_compute_at_edge_http_types_response_handle_t; -typedef struct { +typedef struct fastly_compute_at_edge_http_types_request_t { fastly_compute_at_edge_http_types_request_handle_t f0; fastly_compute_at_edge_http_types_body_handle_t f1; } fastly_compute_at_edge_http_types_request_t; -typedef struct { +typedef struct fastly_compute_at_edge_http_types_response_t { fastly_compute_at_edge_http_types_response_handle_t f0; fastly_compute_at_edge_http_types_body_handle_t f1; } fastly_compute_at_edge_http_types_response_t; @@ -124,7 +165,8 @@ typedef uint8_t fastly_compute_at_edge_http_types_send_error_detail_tag_t; #define FASTLY_COMPUTE_AT_EDGE_HTTP_TYPES_SEND_ERROR_DETAIL_TAG_HTTP_INCOMPLETE_RESPONSE 13 // The system received a response to the request whose header section was considered too // large. -#define FASTLY_COMPUTE_AT_EDGE_HTTP_TYPES_SEND_ERROR_DETAIL_TAG_HTTP_RESPONSE_HEADER_SECTION_TOO_LARGE 14 +#define FASTLY_COMPUTE_AT_EDGE_HTTP_TYPES_SEND_ERROR_DETAIL_TAG_HTTP_RESPONSE_HEADER_SECTION_TOO_LARGE \ + 14 // The system received a response to the request whose body was considered too large. #define FASTLY_COMPUTE_AT_EDGE_HTTP_TYPES_SEND_ERROR_DETAIL_TAG_HTTP_RESPONSE_BODY_TOO_LARGE 15 // The system reached a configured time limit waiting for the complete response. @@ -152,7 +194,7 @@ typedef uint8_t fastly_compute_at_edge_http_types_send_error_detail_tag_t; #define FASTLY_COMPUTE_AT_EDGE_HTTP_TYPES_SEND_ERROR_DETAIL_TAG_TLS_PROTOCOL_ERROR 24 // Mask representing which fields are understood by the guest, and which have been set by the host. -// +// // When the guest calls hostcalls with a mask, it should set every bit in the mask that corresponds // to a defined flag. This signals the host to write only to fields with a set bit, allowing // forward compatibility for existing guest programs even after new fields are added to the struct. @@ -163,7 +205,7 @@ typedef uint8_t fastly_compute_at_edge_http_types_send_error_detail_mask_t; #define FASTLY_COMPUTE_AT_EDGE_HTTP_TYPES_SEND_ERROR_DETAIL_MASK_DNS_ERROR_INFO_CODE (1 << 2) #define FASTLY_COMPUTE_AT_EDGE_HTTP_TYPES_SEND_ERROR_DETAIL_MASK_TLS_ALERT_ID (1 << 3) -typedef struct { +typedef struct fastly_compute_at_edge_http_types_send_error_detail_t { fastly_compute_at_edge_http_types_send_error_detail_tag_t tag; fastly_compute_at_edge_http_types_send_error_detail_mask_t mask; uint16_t dns_error_rcode; @@ -196,7 +238,7 @@ typedef uint8_t fastly_compute_at_edge_http_types_tls_version_t; #define FASTLY_COMPUTE_AT_EDGE_HTTP_TYPES_TLS_VERSION_TLS12 2 #define FASTLY_COMPUTE_AT_EDGE_HTTP_TYPES_TLS_VERSION_TLS13 3 -typedef struct { +typedef struct fastly_compute_at_edge_http_types_client_cert_config_t { fastly_world_string_t client_cert; fastly_compute_at_edge_http_types_secret_handle_t client_key; } fastly_compute_at_edge_http_types_client_cert_config_t; @@ -206,11 +248,6 @@ typedef struct { fastly_world_string_t val; } fastly_world_option_string_t; -typedef struct { - bool is_some; - uint32_t val; -} fastly_world_option_u32_t; - typedef struct { bool is_some; bool val; @@ -219,151 +256,305 @@ typedef struct { typedef struct { bool is_some; fastly_compute_at_edge_http_types_tls_version_t val; -} fastly_world_option_fastly_compute_at_edge_http_types_tls_version_t; +} fastly_compute_at_edge_http_types_option_tls_version_t; typedef struct { bool is_some; fastly_compute_at_edge_http_types_client_cert_config_t val; -} fastly_world_option_fastly_compute_at_edge_http_types_client_cert_config_t; +} fastly_compute_at_edge_http_types_option_client_cert_config_t; // Create a backend for later use -typedef struct { +typedef struct fastly_compute_at_edge_http_types_dynamic_backend_config_t { fastly_world_option_string_t host_override; fastly_world_option_u32_t connect_timeout; fastly_world_option_u32_t first_byte_timeout; fastly_world_option_u32_t between_bytes_timeout; fastly_world_option_bool_t use_ssl; fastly_world_option_bool_t dont_pool; - fastly_world_option_fastly_compute_at_edge_http_types_tls_version_t ssl_min_version; - fastly_world_option_fastly_compute_at_edge_http_types_tls_version_t ssl_max_version; + fastly_compute_at_edge_http_types_option_tls_version_t ssl_min_version; + fastly_compute_at_edge_http_types_option_tls_version_t ssl_max_version; fastly_world_option_string_t cert_hostname; fastly_world_option_string_t ca_cert; fastly_world_option_string_t ciphers; fastly_world_option_string_t sni_hostname; - fastly_world_option_fastly_compute_at_edge_http_types_client_cert_config_t client_cert; + fastly_compute_at_edge_http_types_option_client_cert_config_t client_cert; } fastly_compute_at_edge_http_types_dynamic_backend_config_t; typedef uint16_t fastly_compute_at_edge_http_types_http_status_t; -typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_uap_error_t; +typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_backend_error_t; + +typedef fastly_compute_at_edge_http_types_tls_version_t + fastly_compute_at_edge_backend_tls_version_t; + +typedef uint8_t fastly_compute_at_edge_backend_backend_health_t; + +#define FASTLY_COMPUTE_AT_EDGE_BACKEND_BACKEND_HEALTH_UNKNOWN 0 +#define FASTLY_COMPUTE_AT_EDGE_BACKEND_BACKEND_HEALTH_HEALTHY 1 +#define FASTLY_COMPUTE_AT_EDGE_BACKEND_BACKEND_HEALTH_UNHEALTHY 2 typedef struct { - fastly_world_string_t family; - fastly_world_string_t major; - fastly_world_string_t minor; - fastly_world_string_t patch; -} fastly_compute_at_edge_uap_user_agent_t; + bool is_err; + union { + bool ok; + fastly_compute_at_edge_backend_error_t err; + } val; +} fastly_compute_at_edge_backend_result_bool_error_t; -typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_http_body_error_t; +typedef struct { + bool is_err; + union { + fastly_compute_at_edge_backend_backend_health_t ok; + fastly_compute_at_edge_backend_error_t err; + } val; +} fastly_compute_at_edge_backend_result_backend_health_error_t; -typedef fastly_compute_at_edge_http_types_body_handle_t fastly_compute_at_edge_http_body_body_handle_t; +typedef struct { + bool is_err; + union { + fastly_world_string_t ok; + fastly_compute_at_edge_backend_error_t err; + } val; +} fastly_compute_at_edge_backend_result_string_error_t; -typedef uint8_t fastly_compute_at_edge_http_body_write_end_t; +typedef struct { + bool is_err; + union { + fastly_world_option_string_t ok; + fastly_compute_at_edge_backend_error_t err; + } val; +} fastly_compute_at_edge_backend_result_option_string_error_t; -#define FASTLY_COMPUTE_AT_EDGE_HTTP_BODY_WRITE_END_BACK 0 -#define FASTLY_COMPUTE_AT_EDGE_HTTP_BODY_WRITE_END_FRONT 1 +typedef struct { + bool is_err; + union { + uint16_t ok; + fastly_compute_at_edge_backend_error_t err; + } val; +} fastly_compute_at_edge_backend_result_u16_error_t; typedef struct { - uint8_t *ptr; - size_t len; -} fastly_world_list_u8_t; + bool is_err; + union { + uint32_t ok; + fastly_compute_at_edge_backend_error_t err; + } val; +} fastly_compute_at_edge_backend_result_u32_error_t; -typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_log_error_t; +typedef struct { + bool is_err; + union { + fastly_compute_at_edge_backend_tls_version_t ok; + fastly_compute_at_edge_backend_error_t err; + } val; +} fastly_compute_at_edge_backend_result_tls_version_error_t; -typedef uint32_t fastly_compute_at_edge_log_handle_t; +typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_cache_error_t; -typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_http_req_error_t; +typedef fastly_compute_at_edge_http_types_body_handle_t fastly_compute_at_edge_cache_body_handle_t; -typedef fastly_compute_at_edge_http_types_body_handle_t fastly_compute_at_edge_http_req_body_handle_t; +typedef fastly_compute_at_edge_http_types_request_handle_t + fastly_compute_at_edge_cache_request_handle_t; -typedef fastly_compute_at_edge_http_types_request_handle_t fastly_compute_at_edge_http_req_request_handle_t; +// The outcome of a cache lookup (either bare or as part of a cache transaction) +typedef uint32_t fastly_compute_at_edge_cache_handle_t; -typedef fastly_compute_at_edge_http_types_http_version_t fastly_compute_at_edge_http_req_http_version_t; +typedef uint64_t fastly_compute_at_edge_cache_object_length_t; -typedef fastly_compute_at_edge_http_types_response_t fastly_compute_at_edge_http_req_response_t; +typedef uint64_t fastly_compute_at_edge_cache_duration_ns_t; -typedef fastly_compute_at_edge_http_types_pending_request_handle_t fastly_compute_at_edge_http_req_pending_request_handle_t; +typedef uint64_t fastly_compute_at_edge_cache_cache_hit_count_t; + +typedef struct { + bool is_some; + fastly_compute_at_edge_cache_request_handle_t val; +} fastly_world_option_request_handle_t; + +// Extensible options for cache lookup operations currently used for both `lookup` and +// `transaction_lookup`. +typedef struct fastly_compute_at_edge_cache_lookup_options_t { + // * A full request handle, but used only for its headers + fastly_world_option_request_handle_t request_headers; +} fastly_compute_at_edge_cache_lookup_options_t; + +typedef struct { + uint8_t *ptr; + size_t len; +} fastly_world_list_u8_t; + +// Configuration for several hostcalls that write to the cache: +// - `insert` +// - `transaction-insert` +// - `transaction-insert-and-stream-back` +// - `transaction-update` +// +// Some options are only allowed for certain of these hostcalls see `cache-write-options-mask`. +typedef struct fastly_compute_at_edge_cache_write_options_t { + // this is a required field there's no flag for it + fastly_compute_at_edge_cache_duration_ns_t max_age_ns; + // a full request handle, but used only for its headers + fastly_compute_at_edge_cache_request_handle_t request_headers; + // a list of header names separated by spaces + fastly_world_string_t vary_rule; + // The initial age of the object in nanoseconds (default: 0). + // + // This age is used to determine the freshness lifetime of the object as well as to + // prioritize which variant to return if a subsequent lookup matches more than one vary rule + fastly_compute_at_edge_cache_duration_ns_t initial_age_ns; + fastly_compute_at_edge_cache_duration_ns_t stale_while_revalidate_ns; + // a list of surrogate keys separated by spaces + fastly_world_string_t surrogate_keys; + fastly_compute_at_edge_cache_object_length_t length; + fastly_world_list_u8_t user_metadata; + bool sensitive_data; +} fastly_compute_at_edge_cache_write_options_t; -typedef fastly_compute_at_edge_http_types_content_encodings_t fastly_compute_at_edge_http_req_content_encodings_t; +typedef uint8_t fastly_compute_at_edge_cache_get_body_options_mask_t; -typedef fastly_compute_at_edge_http_types_framing_headers_mode_t fastly_compute_at_edge_http_req_framing_headers_mode_t; +#define FASTLY_COMPUTE_AT_EDGE_CACHE_GET_BODY_OPTIONS_MASK_RESERVED (1 << 0) +#define FASTLY_COMPUTE_AT_EDGE_CACHE_GET_BODY_OPTIONS_MASK_START (1 << 1) +#define FASTLY_COMPUTE_AT_EDGE_CACHE_GET_BODY_OPTIONS_MASK_END (1 << 2) -typedef fastly_compute_at_edge_http_types_dynamic_backend_config_t fastly_compute_at_edge_http_req_dynamic_backend_config_t; +typedef struct fastly_compute_at_edge_cache_get_body_options_t { + uint64_t start; + uint64_t end; +} fastly_compute_at_edge_cache_get_body_options_t; -typedef fastly_compute_at_edge_http_types_send_error_detail_t fastly_compute_at_edge_http_req_send_error_detail_t; +// The status of this lookup (and potential transaction) +typedef uint8_t fastly_compute_at_edge_cache_lookup_state_t; -typedef uint8_t fastly_compute_at_edge_http_req_cache_override_tag_t; +// a cached object was found +#define FASTLY_COMPUTE_AT_EDGE_CACHE_LOOKUP_STATE_FOUND (1 << 0) +// the cached object is valid to use (implies found) +#define FASTLY_COMPUTE_AT_EDGE_CACHE_LOOKUP_STATE_USABLE (1 << 1) +// the cached object is stale (but may or may not be valid to use) +#define FASTLY_COMPUTE_AT_EDGE_CACHE_LOOKUP_STATE_STALE (1 << 2) +// this client is requested to insert or revalidate an object +#define FASTLY_COMPUTE_AT_EDGE_CACHE_LOOKUP_STATE_MUST_INSERT_OR_UPDATE (1 << 3) -// Do not cache the response to this request, regardless of the origin response's headers. -#define FASTLY_COMPUTE_AT_EDGE_HTTP_REQ_CACHE_OVERRIDE_TAG_PASS (1 << 0) -#define FASTLY_COMPUTE_AT_EDGE_HTTP_REQ_CACHE_OVERRIDE_TAG_TTL (1 << 1) -#define FASTLY_COMPUTE_AT_EDGE_HTTP_REQ_CACHE_OVERRIDE_TAG_STALE_WHILE_REVALIDATE (1 << 2) -#define FASTLY_COMPUTE_AT_EDGE_HTTP_REQ_CACHE_OVERRIDE_TAG_PCI (1 << 3) +typedef struct { + bool is_err; + union { + fastly_compute_at_edge_cache_handle_t ok; + fastly_compute_at_edge_cache_error_t err; + } val; +} fastly_compute_at_edge_cache_result_handle_error_t; typedef struct { - fastly_world_string_t *ptr; - size_t len; -} fastly_world_list_string_t; + bool is_err; + union { + fastly_compute_at_edge_cache_body_handle_t ok; + fastly_compute_at_edge_cache_error_t err; + } val; +} fastly_compute_at_edge_cache_result_body_handle_error_t; typedef struct { - bool is_some; - fastly_world_list_u8_t val; -} fastly_world_option_list_u8_t; + fastly_compute_at_edge_cache_body_handle_t f0; + fastly_compute_at_edge_cache_handle_t f1; +} fastly_world_tuple2_body_handle_handle_t; typedef struct { - fastly_world_list_u8_t *ptr; - size_t len; -} fastly_world_list_list_u8_t; + bool is_err; + union { + fastly_world_tuple2_body_handle_handle_t ok; + fastly_compute_at_edge_cache_error_t err; + } val; +} fastly_compute_at_edge_cache_result_tuple2_body_handle_handle_error_t; typedef struct { - bool is_some; - fastly_world_list_list_u8_t val; -} fastly_world_option_list_list_u8_t; + bool is_err; + union { + fastly_compute_at_edge_cache_error_t err; + } val; +} fastly_compute_at_edge_cache_result_void_error_t; typedef struct { - bool is_some; - fastly_compute_at_edge_http_req_response_t val; -} fastly_world_option_fastly_compute_at_edge_http_req_response_t; + bool is_err; + union { + fastly_compute_at_edge_cache_lookup_state_t ok; + fastly_compute_at_edge_cache_error_t err; + } val; +} fastly_compute_at_edge_cache_result_lookup_state_error_t; typedef struct { - fastly_compute_at_edge_http_req_pending_request_handle_t *ptr; - size_t len; -} fastly_world_list_fastly_compute_at_edge_http_req_pending_request_handle_t; + bool is_err; + union { + fastly_world_list_u8_t ok; + fastly_compute_at_edge_cache_error_t err; + } val; +} fastly_compute_at_edge_cache_result_list_u8_error_t; typedef struct { - uint32_t f0; - fastly_compute_at_edge_http_req_response_t f1; -} fastly_world_tuple2_u32_fastly_compute_at_edge_http_req_response_t; + bool is_err; + union { + uint64_t ok; + fastly_compute_at_edge_cache_error_t err; + } val; +} fastly_compute_at_edge_cache_result_u64_error_t; -typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_http_resp_error_t; +typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_device_detection_error_t; -typedef fastly_compute_at_edge_http_types_response_handle_t fastly_compute_at_edge_http_resp_response_handle_t; +typedef struct { + bool is_err; + union { + fastly_world_string_t ok; + fastly_compute_at_edge_device_detection_error_t err; + } val; +} fastly_compute_at_edge_device_detection_result_string_error_t; -typedef fastly_compute_at_edge_http_types_body_handle_t fastly_compute_at_edge_http_resp_body_handle_t; +typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_dictionary_error_t; -typedef fastly_compute_at_edge_http_types_http_version_t fastly_compute_at_edge_http_resp_http_version_t; +typedef uint32_t fastly_compute_at_edge_dictionary_handle_t; -typedef fastly_compute_at_edge_http_types_http_status_t fastly_compute_at_edge_http_resp_http_status_t; +typedef struct { + bool is_err; + union { + fastly_compute_at_edge_dictionary_handle_t ok; + fastly_compute_at_edge_dictionary_error_t err; + } val; +} fastly_compute_at_edge_dictionary_result_handle_error_t; -typedef fastly_compute_at_edge_http_types_framing_headers_mode_t fastly_compute_at_edge_http_resp_framing_headers_mode_t; +typedef struct { + bool is_err; + union { + fastly_world_option_string_t ok; + fastly_compute_at_edge_dictionary_error_t err; + } val; +} fastly_compute_at_edge_dictionary_result_option_string_error_t; -typedef uint8_t fastly_compute_at_edge_http_resp_keepalive_mode_t; +typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_edge_rate_limiter_error_t; -#define FASTLY_COMPUTE_AT_EDGE_HTTP_RESP_KEEPALIVE_MODE_AUTOMATIC 0 -#define FASTLY_COMPUTE_AT_EDGE_HTTP_RESP_KEEPALIVE_MODE_NO_KEEPALIVE 1 +typedef struct { + bool is_err; + union { + bool ok; + fastly_compute_at_edge_edge_rate_limiter_error_t err; + } val; +} fastly_compute_at_edge_edge_rate_limiter_result_bool_error_t; -typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_dictionary_error_t; +typedef struct { + bool is_err; + union { + fastly_compute_at_edge_edge_rate_limiter_error_t err; + } val; +} fastly_compute_at_edge_edge_rate_limiter_result_void_error_t; -typedef uint32_t fastly_compute_at_edge_dictionary_handle_t; +typedef struct { + bool is_err; + union { + uint32_t ok; + fastly_compute_at_edge_edge_rate_limiter_error_t err; + } val; +} fastly_compute_at_edge_edge_rate_limiter_result_u32_error_t; typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_geo_error_t; typedef struct { bool is_some; float val; -} fastly_world_option_float32_t; +} fastly_world_option_f32_t; -typedef struct { +typedef struct fastly_compute_at_edge_geo_geo_data_t { // * The name of the organization associated with as_number. // * // * For example, fastly is the value given for IP addresses under AS-54113. @@ -372,7 +563,8 @@ typedef struct { fastly_world_option_u32_t as_number; // * The telephone area code associated with an IP address. // * - // * These are only available for IP addresses in the United States, its territories, and Canada. + // * These are only available for IP addresses in the United States, its territories, and + // Canada. fastly_world_option_u32_t area_code; // * City or town name. fastly_world_option_string_t city; @@ -382,37 +574,50 @@ typedef struct { fastly_world_option_string_t conn_type; // * Continent. fastly_world_option_string_t continent; - // * A two-character [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) country code for the country associated with an IP address. + // * A two-character [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) country code for the + // country associated with an IP address. // * - // * The US country code is returned for IP addresses associated with overseas United States military bases. + // * The US country code is returned for IP addresses associated with overseas United States + // military bases. // * - // * These values include subdivisions that are assigned their own country codes in ISO 3166-1. For example, subdivisions NO-21 and NO-22 are presented with the country code SJ for Svalbard and the Jan Mayen Islands. + // * These values include subdivisions that are assigned their own country codes in ISO + // 3166-1. For example, subdivisions NO-21 and NO-22 are presented with the country code SJ + // for Svalbard and the Jan Mayen Islands. fastly_world_option_string_t country_code; - // * A three-character [ISO 3166-1 alpha-3](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3) country code for the country associated with the IP address. + // * A three-character [ISO 3166-1 alpha-3](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3) + // country code for the country associated with the IP address. // * - // * The USA country code is returned for IP addresses associated with overseas United States military bases. + // * The USA country code is returned for IP addresses associated with overseas United States + // military bases. fastly_world_option_string_t country_code3; // * Country name. // * - // * This field is the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) English short name for a country. + // * This field is the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) English short + // name for a country. fastly_world_option_string_t country_name; // * Time zone offset from Greenwich Mean Time (GMT) for `city`. fastly_world_option_string_t gmt_offset; // * Latitude, in units of degrees from the equator. // * - // * Values range from -90.0 to +90.0 inclusive, and are based on the [WGS 84](https://en.wikipedia.org/wiki/World_Geodetic_System) coordinate reference system. - fastly_world_option_float32_t latitude; - // * Longitude, in units of degrees from the [IERS Reference Meridian](https://en.wikipedia.org/wiki/IERS_Reference_Meridian). + // * Values range from -90.0 to +90.0 inclusive, and are based on the [WGS + // 84](https://en.wikipedia.org/wiki/World_Geodetic_System) coordinate reference system. + fastly_world_option_f32_t latitude; + // * Longitude, in units of degrees from the [IERS Reference + // Meridian](https://en.wikipedia.org/wiki/IERS_Reference_Meridian). // * - // * Values range from -180.0 to +180.0 inclusive, and are based on the [WGS 84](https://en.wikipedia.org/wiki/World_Geodetic_System) coordinate reference system. - fastly_world_option_float32_t longitude; + // * Values range from -180.0 to +180.0 inclusive, and are based on the [WGS + // 84](https://en.wikipedia.org/wiki/World_Geodetic_System) coordinate reference system. + fastly_world_option_f32_t longitude; // * Metro code, representing designated market areas (DMAs) in the United States. fastly_world_option_u32_t metro_code; // * The postal code associated with the IP address. // * - // * These are available for some IP addresses in Australia, Canada, France, Germany, Italy, Spain, Switzerland, the United Kingdom, and the United States. + // * These are available for some IP addresses in Australia, Canada, France, Germany, Italy, + // Spain, Switzerland, the United Kingdom, and the United States. // * - // * For Canadian postal codes, this is the first 3 characters. For the United Kingdom, this is the first 2-4 characters (outward code). For countries with alphanumeric postal codes, this field is a lowercase transliteration. + // * For Canadian postal codes, this is the first 3 characters. For the United Kingdom, this + // is the first 2-4 characters (outward code). For countries with alphanumeric postal codes, + // this field is a lowercase transliteration. fastly_world_option_string_t postal_code; // * Client proxy description. fastly_world_option_string_t proxy_description; @@ -420,406 +625,995 @@ typedef struct { fastly_world_option_string_t proxy_type; // * [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2) country subdivision code. // * - // * For countries with multiple levels of subdivision (for example, nations within the United Kingdom), this variable gives the more specific subdivision. + // * For countries with multiple levels of subdivision (for example, nations within the United + // Kingdom), this variable gives the more specific subdivision. // * - // * This field can be None for countries that do not have ISO country subdivision codes. For example, None is given for IP addresses assigned to the Ã…land Islands (country code AX, illustrated below). + // * This field can be None for countries that do not have ISO country subdivision codes. For + // example, None is given for IP addresses assigned to the Ã…land Islands (country code AX, + // illustrated below). fastly_world_option_string_t region; // * Time zone offset from coordinated universal time (UTC) for `city`. fastly_world_option_u32_t utc_offset; } fastly_compute_at_edge_geo_geo_data_t; -typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_object_store_error_t; +typedef struct { + bool is_err; + union { + fastly_world_string_t ok; + fastly_compute_at_edge_geo_error_t err; + } val; +} fastly_compute_at_edge_geo_result_string_error_t; -typedef fastly_compute_at_edge_http_types_body_handle_t fastly_compute_at_edge_object_store_body_handle_t; +typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_http_body_error_t; -typedef uint32_t fastly_compute_at_edge_object_store_handle_t; +typedef fastly_compute_at_edge_http_types_body_handle_t + fastly_compute_at_edge_http_body_body_handle_t; -typedef uint32_t fastly_compute_at_edge_object_store_pending_handle_t; +typedef uint8_t fastly_compute_at_edge_http_body_write_end_t; + +#define FASTLY_COMPUTE_AT_EDGE_HTTP_BODY_WRITE_END_BACK 0 +#define FASTLY_COMPUTE_AT_EDGE_HTTP_BODY_WRITE_END_FRONT 1 typedef struct { - bool is_some; - fastly_compute_at_edge_object_store_body_handle_t val; -} fastly_world_option_fastly_compute_at_edge_object_store_body_handle_t; + bool is_err; + union { + fastly_compute_at_edge_http_body_error_t err; + } val; +} fastly_compute_at_edge_http_body_result_void_error_t; -typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_secret_store_error_t; +typedef struct { + bool is_err; + union { + fastly_compute_at_edge_http_body_body_handle_t ok; + fastly_compute_at_edge_http_body_error_t err; + } val; +} fastly_compute_at_edge_http_body_result_body_handle_error_t; -typedef fastly_compute_at_edge_types_secret_handle_t fastly_compute_at_edge_secret_store_secret_handle_t; +typedef struct { + bool is_err; + union { + fastly_world_list_u8_t ok; + fastly_compute_at_edge_http_body_error_t err; + } val; +} fastly_compute_at_edge_http_body_result_list_u8_error_t; -typedef uint32_t fastly_compute_at_edge_secret_store_store_handle_t; +typedef struct { + bool is_err; + union { + uint32_t ok; + fastly_compute_at_edge_http_body_error_t err; + } val; +} fastly_compute_at_edge_http_body_result_u32_error_t; + +typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_http_req_error_t; + +typedef fastly_compute_at_edge_http_types_body_handle_t + fastly_compute_at_edge_http_req_body_handle_t; + +typedef fastly_compute_at_edge_http_types_request_handle_t + fastly_compute_at_edge_http_req_request_handle_t; + +typedef fastly_compute_at_edge_http_types_http_version_t + fastly_compute_at_edge_http_req_http_version_t; + +typedef fastly_compute_at_edge_http_types_response_t fastly_compute_at_edge_http_req_response_t; + +typedef fastly_compute_at_edge_http_types_pending_request_handle_t + fastly_compute_at_edge_http_req_pending_request_handle_t; + +typedef fastly_compute_at_edge_http_types_content_encodings_t + fastly_compute_at_edge_http_req_content_encodings_t; + +typedef fastly_compute_at_edge_http_types_framing_headers_mode_t + fastly_compute_at_edge_http_req_framing_headers_mode_t; + +typedef fastly_compute_at_edge_http_types_dynamic_backend_config_t + fastly_compute_at_edge_http_req_dynamic_backend_config_t; + +typedef fastly_compute_at_edge_http_types_send_error_detail_t + fastly_compute_at_edge_http_req_send_error_detail_t; + +typedef uint8_t fastly_compute_at_edge_http_req_cache_override_tag_t; + +// Do not cache the response to this request, regardless of the origin response's headers. +#define FASTLY_COMPUTE_AT_EDGE_HTTP_REQ_CACHE_OVERRIDE_TAG_PASS (1 << 0) +#define FASTLY_COMPUTE_AT_EDGE_HTTP_REQ_CACHE_OVERRIDE_TAG_TTL (1 << 1) +#define FASTLY_COMPUTE_AT_EDGE_HTTP_REQ_CACHE_OVERRIDE_TAG_STALE_WHILE_REVALIDATE (1 << 2) +#define FASTLY_COMPUTE_AT_EDGE_HTTP_REQ_CACHE_OVERRIDE_TAG_PCI (1 << 3) + +typedef struct { + bool is_err; + union { + fastly_compute_at_edge_http_req_error_t err; + } val; +} fastly_compute_at_edge_http_req_result_void_error_t; + +typedef struct { + bool is_err; + union { + fastly_world_list_u8_t ok; + fastly_compute_at_edge_http_req_error_t err; + } val; +} fastly_compute_at_edge_http_req_result_list_u8_error_t; + +typedef struct { + bool is_err; + union { + fastly_world_string_t ok; + fastly_compute_at_edge_http_req_error_t err; + } val; +} fastly_compute_at_edge_http_req_result_string_error_t; + +typedef struct { + bool is_err; + union { + fastly_compute_at_edge_http_req_request_handle_t ok; + fastly_compute_at_edge_http_req_error_t err; + } val; +} fastly_compute_at_edge_http_req_result_request_handle_error_t; + +typedef struct { + fastly_world_string_t *ptr; + size_t len; +} fastly_world_list_string_t; + +typedef struct { + bool is_err; + union { + fastly_world_list_string_t ok; + fastly_compute_at_edge_http_req_error_t err; + } val; +} fastly_compute_at_edge_http_req_result_list_string_error_t; + +typedef struct { + bool is_err; + union { + uint32_t ok; + fastly_compute_at_edge_http_req_error_t err; + } val; +} fastly_compute_at_edge_http_req_result_u32_error_t; typedef struct { bool is_some; - fastly_compute_at_edge_secret_store_secret_handle_t val; -} fastly_world_option_fastly_compute_at_edge_secret_store_secret_handle_t; + fastly_world_list_u8_t val; +} fastly_world_option_list_u8_t; -typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_backend_error_t; +typedef struct { + bool is_err; + union { + fastly_world_option_list_u8_t ok; + fastly_compute_at_edge_http_req_error_t err; + } val; +} fastly_compute_at_edge_http_req_result_option_list_u8_error_t; -typedef fastly_compute_at_edge_http_types_tls_version_t fastly_compute_at_edge_backend_tls_version_t; +typedef struct { + fastly_world_list_u8_t *ptr; + size_t len; +} fastly_world_list_list_u8_t; -typedef uint8_t fastly_compute_at_edge_backend_backend_health_t; +typedef struct { + bool is_some; + fastly_world_list_list_u8_t val; +} fastly_world_option_list_list_u8_t; -#define FASTLY_COMPUTE_AT_EDGE_BACKEND_BACKEND_HEALTH_UNKNOWN 0 -#define FASTLY_COMPUTE_AT_EDGE_BACKEND_BACKEND_HEALTH_HEALTHY 1 -#define FASTLY_COMPUTE_AT_EDGE_BACKEND_BACKEND_HEALTH_UNHEALTHY 2 +typedef struct { + bool is_err; + union { + fastly_world_option_list_list_u8_t ok; + fastly_compute_at_edge_http_req_error_t err; + } val; +} fastly_compute_at_edge_http_req_result_option_list_list_u8_error_t; -typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_async_io_error_t; +typedef struct { + bool is_err; + union { + fastly_compute_at_edge_http_req_http_version_t ok; + fastly_compute_at_edge_http_req_error_t err; + } val; +} fastly_compute_at_edge_http_req_result_http_version_error_t; -// A handle to an object supporting generic async operations. -// Can be either a `BodyHandle` or a `PendingRequestHandle`. -// -// Each async item has an associated I/O action: -// -// * Pending requests: awaiting the response headers / `Response` object -// * Normal bodies: reading bytes from the body -// * Streaming bodies: writing bytes to the body -// -// For writing bytes, note that there is a large host-side buffer that bytes can eagerly be written -// into, even before the origin itself consumes that data. -typedef uint32_t fastly_compute_at_edge_async_io_handle_t; +typedef struct { + bool is_err; + union { + fastly_compute_at_edge_http_req_response_t ok; + fastly_compute_at_edge_http_req_error_t err; + } val; +} fastly_compute_at_edge_http_req_result_response_error_t; typedef struct { - fastly_compute_at_edge_async_io_handle_t *ptr; + bool is_err; + union { + fastly_compute_at_edge_http_req_pending_request_handle_t ok; + fastly_compute_at_edge_http_req_error_t err; + } val; +} fastly_compute_at_edge_http_req_result_pending_request_handle_error_t; + +typedef struct { + bool is_some; + fastly_compute_at_edge_http_req_response_t val; +} fastly_world_option_response_t; + +typedef struct { + bool is_err; + union { + fastly_world_option_response_t ok; + fastly_compute_at_edge_http_req_error_t err; + } val; +} fastly_compute_at_edge_http_req_result_option_response_error_t; + +typedef struct { + fastly_compute_at_edge_http_req_pending_request_handle_t *ptr; size_t len; -} fastly_world_list_fastly_compute_at_edge_async_io_handle_t; +} fastly_world_list_pending_request_handle_t; -typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_purge_error_t; +typedef struct { + uint32_t f0; + fastly_compute_at_edge_http_req_response_t f1; +} fastly_world_tuple2_u32_response_t; -typedef uint8_t fastly_compute_at_edge_purge_options_mask_t; +typedef struct { + bool is_err; + union { + fastly_world_tuple2_u32_response_t ok; + fastly_compute_at_edge_http_req_error_t err; + } val; +} fastly_compute_at_edge_http_req_result_tuple2_u32_response_error_t; -#define FASTLY_COMPUTE_AT_EDGE_PURGE_OPTIONS_MASK_SOFT_PURGE (1 << 0) -#define FASTLY_COMPUTE_AT_EDGE_PURGE_OPTIONS_MASK_RET_BUF (1 << 1) +typedef struct { + bool is_err; + union { + fastly_world_tuple2_u32_response_t ok; + fastly_compute_at_edge_http_req_send_error_detail_t err; + } val; +} fastly_compute_at_edge_http_req_result_tuple2_u32_response_send_error_detail_t; -typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_cache_error_t; +typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_http_resp_error_t; -typedef fastly_compute_at_edge_http_types_body_handle_t fastly_compute_at_edge_cache_body_handle_t; +typedef fastly_compute_at_edge_http_types_response_handle_t + fastly_compute_at_edge_http_resp_response_handle_t; -typedef fastly_compute_at_edge_http_types_request_handle_t fastly_compute_at_edge_cache_request_handle_t; +typedef fastly_compute_at_edge_http_types_body_handle_t + fastly_compute_at_edge_http_resp_body_handle_t; -// The outcome of a cache lookup (either bare or as part of a cache transaction) -typedef uint32_t fastly_compute_at_edge_cache_handle_t; +typedef fastly_compute_at_edge_http_types_http_version_t + fastly_compute_at_edge_http_resp_http_version_t; -typedef uint64_t fastly_compute_at_edge_cache_object_length_t; +typedef fastly_compute_at_edge_http_types_http_status_t + fastly_compute_at_edge_http_resp_http_status_t; -typedef uint64_t fastly_compute_at_edge_cache_duration_ns_t; +typedef fastly_compute_at_edge_http_types_framing_headers_mode_t + fastly_compute_at_edge_http_resp_framing_headers_mode_t; -typedef uint64_t fastly_compute_at_edge_cache_cache_hit_count_t; +typedef uint8_t fastly_compute_at_edge_http_resp_keepalive_mode_t; + +#define FASTLY_COMPUTE_AT_EDGE_HTTP_RESP_KEEPALIVE_MODE_AUTOMATIC 0 +#define FASTLY_COMPUTE_AT_EDGE_HTTP_RESP_KEEPALIVE_MODE_NO_KEEPALIVE 1 + +typedef struct { + bool is_err; + union { + fastly_compute_at_edge_http_resp_response_handle_t ok; + fastly_compute_at_edge_http_resp_error_t err; + } val; +} fastly_compute_at_edge_http_resp_result_response_handle_error_t; + +typedef struct { + bool is_err; + union { + fastly_world_list_string_t ok; + fastly_compute_at_edge_http_resp_error_t err; + } val; +} fastly_compute_at_edge_http_resp_result_list_string_error_t; + +typedef struct { + bool is_err; + union { + fastly_world_option_string_t ok; + fastly_compute_at_edge_http_resp_error_t err; + } val; +} fastly_compute_at_edge_http_resp_result_option_string_error_t; + +typedef struct { + bool is_err; + union { + fastly_world_option_list_list_u8_t ok; + fastly_compute_at_edge_http_resp_error_t err; + } val; +} fastly_compute_at_edge_http_resp_result_option_list_list_u8_error_t; + +typedef struct { + bool is_err; + union { + fastly_compute_at_edge_http_resp_error_t err; + } val; +} fastly_compute_at_edge_http_resp_result_void_error_t; + +typedef struct { + bool is_err; + union { + fastly_compute_at_edge_http_resp_http_version_t ok; + fastly_compute_at_edge_http_resp_error_t err; + } val; +} fastly_compute_at_edge_http_resp_result_http_version_error_t; + +typedef struct { + bool is_err; + union { + fastly_compute_at_edge_http_resp_http_status_t ok; + fastly_compute_at_edge_http_resp_error_t err; + } val; +} fastly_compute_at_edge_http_resp_result_http_status_error_t; + +typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_log_error_t; + +typedef uint32_t fastly_compute_at_edge_log_handle_t; + +typedef struct { + bool is_err; + union { + fastly_compute_at_edge_log_handle_t ok; + fastly_compute_at_edge_log_error_t err; + } val; +} fastly_compute_at_edge_log_result_handle_error_t; + +typedef struct { + bool is_err; + union { + fastly_compute_at_edge_log_error_t err; + } val; +} fastly_compute_at_edge_log_result_void_error_t; + +typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_object_store_error_t; + +typedef fastly_compute_at_edge_http_types_body_handle_t + fastly_compute_at_edge_object_store_body_handle_t; + +typedef uint32_t fastly_compute_at_edge_object_store_handle_t; + +typedef uint32_t fastly_compute_at_edge_object_store_pending_handle_t; + +typedef struct { + bool is_err; + union { + fastly_compute_at_edge_object_store_handle_t ok; + fastly_compute_at_edge_object_store_error_t err; + } val; +} fastly_compute_at_edge_object_store_result_handle_error_t; typedef struct { bool is_some; - fastly_compute_at_edge_cache_request_handle_t val; -} fastly_world_option_fastly_compute_at_edge_cache_request_handle_t; + fastly_compute_at_edge_object_store_body_handle_t val; +} fastly_world_option_body_handle_t; -// Extensible options for cache lookup operations currently used for both `lookup` and `transaction_lookup`. typedef struct { - // * A full request handle, but used only for its headers - fastly_world_option_fastly_compute_at_edge_cache_request_handle_t request_headers; -} fastly_compute_at_edge_cache_lookup_options_t; + bool is_err; + union { + fastly_world_option_body_handle_t ok; + fastly_compute_at_edge_object_store_error_t err; + } val; +} fastly_compute_at_edge_object_store_result_option_body_handle_error_t; -// Configuration for several hostcalls that write to the cache: -// - `insert` -// - `transaction-insert` -// - `transaction-insert-and-stream-back` -// - `transaction-update` -// -// Some options are only allowed for certain of these hostcalls see `cache-write-options-mask`. typedef struct { - // this is a required field there's no flag for it - fastly_compute_at_edge_cache_duration_ns_t max_age_ns; - // a full request handle, but used only for its headers - fastly_compute_at_edge_cache_request_handle_t request_headers; - // a list of header names separated by spaces - fastly_world_string_t vary_rule; - // The initial age of the object in nanoseconds (default: 0). - // - // This age is used to determine the freshness lifetime of the object as well as to - // prioritize which variant to return if a subsequent lookup matches more than one vary rule - fastly_compute_at_edge_cache_duration_ns_t initial_age_ns; - fastly_compute_at_edge_cache_duration_ns_t stale_while_revalidate_ns; - // a list of surrogate keys separated by spaces - fastly_world_string_t surrogate_keys; - fastly_compute_at_edge_cache_object_length_t length; - fastly_world_list_u8_t user_metadata; - bool sensitive_data; -} fastly_compute_at_edge_cache_write_options_t; + bool is_err; + union { + fastly_compute_at_edge_object_store_pending_handle_t ok; + fastly_compute_at_edge_object_store_error_t err; + } val; +} fastly_compute_at_edge_object_store_result_pending_handle_error_t; -typedef uint8_t fastly_compute_at_edge_cache_get_body_options_mask_t; +typedef struct { + bool is_err; + union { + fastly_compute_at_edge_object_store_error_t err; + } val; +} fastly_compute_at_edge_object_store_result_void_error_t; -#define FASTLY_COMPUTE_AT_EDGE_CACHE_GET_BODY_OPTIONS_MASK_RESERVED (1 << 0) -#define FASTLY_COMPUTE_AT_EDGE_CACHE_GET_BODY_OPTIONS_MASK_START (1 << 1) -#define FASTLY_COMPUTE_AT_EDGE_CACHE_GET_BODY_OPTIONS_MASK_END (1 << 2) +typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_purge_error_t; + +typedef uint8_t fastly_compute_at_edge_purge_options_mask_t; + +#define FASTLY_COMPUTE_AT_EDGE_PURGE_OPTIONS_MASK_SOFT_PURGE (1 << 0) +#define FASTLY_COMPUTE_AT_EDGE_PURGE_OPTIONS_MASK_RET_BUF (1 << 1) typedef struct { - uint64_t start; - uint64_t end; -} fastly_compute_at_edge_cache_get_body_options_t; + bool is_err; + union { + fastly_world_option_string_t ok; + fastly_compute_at_edge_purge_error_t err; + } val; +} fastly_compute_at_edge_purge_result_option_string_error_t; -// The status of this lookup (and potential transaction) -typedef uint8_t fastly_compute_at_edge_cache_lookup_state_t; +typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_secret_store_error_t; -// a cached object was found -#define FASTLY_COMPUTE_AT_EDGE_CACHE_LOOKUP_STATE_FOUND (1 << 0) -// the cached object is valid to use (implies found) -#define FASTLY_COMPUTE_AT_EDGE_CACHE_LOOKUP_STATE_USABLE (1 << 1) -// the cached object is stale (but may or may not be valid to use) -#define FASTLY_COMPUTE_AT_EDGE_CACHE_LOOKUP_STATE_STALE (1 << 2) -// this client is requested to insert or revalidate an object -#define FASTLY_COMPUTE_AT_EDGE_CACHE_LOOKUP_STATE_MUST_INSERT_OR_UPDATE (1 << 3) +typedef fastly_compute_at_edge_types_secret_handle_t + fastly_compute_at_edge_secret_store_secret_handle_t; + +typedef uint32_t fastly_compute_at_edge_secret_store_store_handle_t; typedef struct { - fastly_compute_at_edge_cache_body_handle_t f0; - fastly_compute_at_edge_cache_handle_t f1; -} fastly_world_tuple2_fastly_compute_at_edge_cache_body_handle_fastly_compute_at_edge_cache_handle_t; + bool is_err; + union { + fastly_compute_at_edge_secret_store_store_handle_t ok; + fastly_compute_at_edge_secret_store_error_t err; + } val; +} fastly_compute_at_edge_secret_store_result_store_handle_error_t; -typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_edge_rate_limiter_error_t; +typedef struct { + bool is_some; + fastly_compute_at_edge_secret_store_secret_handle_t val; +} fastly_world_option_secret_handle_t; -typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_device_detection_error_t; +typedef struct { + bool is_err; + union { + fastly_world_option_secret_handle_t ok; + fastly_compute_at_edge_secret_store_error_t err; + } val; +} fastly_compute_at_edge_secret_store_result_option_secret_handle_error_t; + +typedef struct { + bool is_err; + union { + fastly_world_option_list_u8_t ok; + fastly_compute_at_edge_secret_store_error_t err; + } val; +} fastly_compute_at_edge_secret_store_result_option_list_u8_error_t; + +typedef struct { + bool is_err; + union { + fastly_compute_at_edge_secret_store_secret_handle_t ok; + fastly_compute_at_edge_secret_store_error_t err; + } val; +} fastly_compute_at_edge_secret_store_result_secret_handle_error_t; -typedef fastly_compute_at_edge_http_types_request_t fastly_compute_at_edge_reactor_request_t; +typedef fastly_compute_at_edge_types_error_t fastly_compute_at_edge_uap_error_t; + +typedef struct fastly_compute_at_edge_uap_user_agent_t { + fastly_world_string_t family; + fastly_world_string_t major; + fastly_world_string_t minor; + fastly_world_string_t patch; +} fastly_compute_at_edge_uap_user_agent_t; + +typedef struct { + bool is_err; + union { + fastly_compute_at_edge_uap_user_agent_t ok; + fastly_compute_at_edge_uap_error_t err; + } val; +} fastly_compute_at_edge_uap_result_user_agent_error_t; + +typedef fastly_compute_at_edge_http_types_request_t + exports_fastly_compute_at_edge_reactor_request_t; + +typedef struct { + bool is_err; +} exports_fastly_compute_at_edge_reactor_result_void_void_t; // Imported Functions from `fastly:compute-at-edge/async-io` // Blocks until one of the given objects is ready for I/O, or the optional timeout expires. -// +// // Valid object handles includes bodies and pending requests. See the `async_item_handle` // definition for more details, including what I/O actions are associated with each handle // type. -// +// // The timeout is specified in milliseconds, or 0 if no timeout is desired. -// +// // Returns the _index_ (not handle!) of the first object that is ready, or // none if the timeout expires before any objects are ready for I/O. -bool fastly_compute_at_edge_async_io_select(fastly_world_list_fastly_compute_at_edge_async_io_handle_t *hs, uint32_t timeout_ms, fastly_world_option_u32_t *ret, fastly_compute_at_edge_async_io_error_t *err); +extern bool fastly_compute_at_edge_async_io_select(fastly_world_list_handle_t *hs, + uint32_t timeout_ms, + fastly_world_option_u32_t *ret, + fastly_compute_at_edge_async_io_error_t *err); // Returns 1 if the given async item is "ready" for its associated I/O action, 0 otherwise. -// +// // If an object is ready, the I/O action is guaranteed to complete without blocking. -// +// // Valid object handles includes bodies and pending requests. See the `async_item_handle` // definition for more details, including what I/O actions are associated with each handle // type. -bool fastly_compute_at_edge_async_io_is_ready(fastly_compute_at_edge_async_io_handle_t handle, bool *ret, fastly_compute_at_edge_async_io_error_t *err); +extern bool +fastly_compute_at_edge_async_io_is_ready(fastly_compute_at_edge_async_io_handle_t handle, bool *ret, + fastly_compute_at_edge_async_io_error_t *err); // Imported Functions from `fastly:compute-at-edge/backend` -bool fastly_compute_at_edge_backend_exists(fastly_world_string_t *backend, bool *ret, fastly_compute_at_edge_backend_error_t *err); -bool fastly_compute_at_edge_backend_is_healthy(fastly_world_string_t *backend, fastly_compute_at_edge_backend_backend_health_t *ret, fastly_compute_at_edge_backend_error_t *err); +extern bool fastly_compute_at_edge_backend_exists(fastly_world_string_t *backend, bool *ret, + fastly_compute_at_edge_backend_error_t *err); +extern bool +fastly_compute_at_edge_backend_is_healthy(fastly_world_string_t *backend, + fastly_compute_at_edge_backend_backend_health_t *ret, + fastly_compute_at_edge_backend_error_t *err); // Returns `true` if the backend is a "dynamic" backend. -bool fastly_compute_at_edge_backend_is_dynamic(fastly_world_string_t *backend, bool *ret, fastly_compute_at_edge_backend_error_t *err); +extern bool fastly_compute_at_edge_backend_is_dynamic(fastly_world_string_t *backend, bool *ret, + fastly_compute_at_edge_backend_error_t *err); // Get the host of this backend. -bool fastly_compute_at_edge_backend_get_host(fastly_world_string_t *backend, fastly_world_string_t *ret, fastly_compute_at_edge_backend_error_t *err); +extern bool fastly_compute_at_edge_backend_get_host(fastly_world_string_t *backend, + fastly_world_string_t *ret, + fastly_compute_at_edge_backend_error_t *err); // Get the "override host" for this backend. -// +// // This is used to change the `Host` header sent to the backend. See the -// Fastly documentation oh this topic here: https://docs.fastly.com/en/guides/specifying-an-override-host -bool fastly_compute_at_edge_backend_get_override_host(fastly_world_string_t *backend, fastly_world_option_string_t *ret, fastly_compute_at_edge_backend_error_t *err); +// Fastly documentation oh this topic here: +// https://docs.fastly.com/en/guides/specifying-an-override-host +extern bool +fastly_compute_at_edge_backend_get_override_host(fastly_world_string_t *backend, + fastly_world_option_string_t *ret, + fastly_compute_at_edge_backend_error_t *err); // Get the remote TCP port of the backend connection for the request. -bool fastly_compute_at_edge_backend_get_port(fastly_world_string_t *backend, uint16_t *ret, fastly_compute_at_edge_backend_error_t *err); +extern bool fastly_compute_at_edge_backend_get_port(fastly_world_string_t *backend, uint16_t *ret, + fastly_compute_at_edge_backend_error_t *err); // Get the connection timeout of the backend. -bool fastly_compute_at_edge_backend_get_connect_timeout_ms(fastly_world_string_t *backend, uint32_t *ret, fastly_compute_at_edge_backend_error_t *err); +extern bool +fastly_compute_at_edge_backend_get_connect_timeout_ms(fastly_world_string_t *backend, uint32_t *ret, + fastly_compute_at_edge_backend_error_t *err); // Get the first byte timeout of the backend. -bool fastly_compute_at_edge_backend_get_first_byte_timeout_ms(fastly_world_string_t *backend, uint32_t *ret, fastly_compute_at_edge_backend_error_t *err); +extern bool fastly_compute_at_edge_backend_get_first_byte_timeout_ms( + fastly_world_string_t *backend, uint32_t *ret, fastly_compute_at_edge_backend_error_t *err); // Get the between byte timeout of the backend. -bool fastly_compute_at_edge_backend_get_between_bytes_timeout_ms(fastly_world_string_t *backend, uint32_t *ret, fastly_compute_at_edge_backend_error_t *err); +extern bool fastly_compute_at_edge_backend_get_between_bytes_timeout_ms( + fastly_world_string_t *backend, uint32_t *ret, fastly_compute_at_edge_backend_error_t *err); // Returns `true` if the backend is configured to use SSL. -bool fastly_compute_at_edge_backend_is_ssl(fastly_world_string_t *backend, bool *ret, fastly_compute_at_edge_backend_error_t *err); +extern bool fastly_compute_at_edge_backend_is_ssl(fastly_world_string_t *backend, bool *ret, + fastly_compute_at_edge_backend_error_t *err); // Get the minimum SSL version this backend will use. -bool fastly_compute_at_edge_backend_get_ssl_min_version(fastly_world_string_t *backend, fastly_compute_at_edge_backend_tls_version_t *ret, fastly_compute_at_edge_backend_error_t *err); +extern bool fastly_compute_at_edge_backend_get_ssl_min_version( + fastly_world_string_t *backend, fastly_compute_at_edge_backend_tls_version_t *ret, + fastly_compute_at_edge_backend_error_t *err); // Get the maximum SSL version this backend will use. -bool fastly_compute_at_edge_backend_get_ssl_max_version(fastly_world_string_t *backend, fastly_compute_at_edge_backend_tls_version_t *ret, fastly_compute_at_edge_backend_error_t *err); +extern bool fastly_compute_at_edge_backend_get_ssl_max_version( + fastly_world_string_t *backend, fastly_compute_at_edge_backend_tls_version_t *ret, + fastly_compute_at_edge_backend_error_t *err); // Imported Functions from `fastly:compute-at-edge/cache` // Performs a non-request-collapsing cache lookup. -// +// // Returns a result without waiting for any request collapsing that may be ongoing. -bool fastly_compute_at_edge_cache_lookup(fastly_world_string_t *key, fastly_compute_at_edge_cache_lookup_options_t *options, fastly_compute_at_edge_cache_handle_t *ret, fastly_compute_at_edge_cache_error_t *err); +extern bool fastly_compute_at_edge_cache_lookup( + fastly_world_string_t *key, fastly_compute_at_edge_cache_lookup_options_t *options, + fastly_compute_at_edge_cache_handle_t *ret, fastly_compute_at_edge_cache_error_t *err); // Performs a non-request-collapsing cache insertion (or update). -// +// // The returned handle is to a streaming body that is used for writing the object into // the cache. -bool fastly_compute_at_edge_cache_insert(fastly_world_string_t *key, fastly_compute_at_edge_cache_write_options_t *options, fastly_compute_at_edge_cache_body_handle_t *ret, fastly_compute_at_edge_cache_error_t *err); +extern bool fastly_compute_at_edge_cache_insert( + fastly_world_string_t *key, fastly_compute_at_edge_cache_write_options_t *options, + fastly_compute_at_edge_cache_body_handle_t *ret, fastly_compute_at_edge_cache_error_t *err); // The entrypoint to the request-collapsing cache transaction API. -// +// // This operation always participates in request collapsing and may return stale objects. To bypass // request collapsing, use `lookup` and `insert` instead. -bool fastly_compute_at_edge_cache_transaction_lookup(fastly_world_string_t *key, fastly_compute_at_edge_cache_lookup_options_t *options, fastly_compute_at_edge_cache_handle_t *ret, fastly_compute_at_edge_cache_error_t *err); +extern bool fastly_compute_at_edge_cache_transaction_lookup( + fastly_world_string_t *key, fastly_compute_at_edge_cache_lookup_options_t *options, + fastly_compute_at_edge_cache_handle_t *ret, fastly_compute_at_edge_cache_error_t *err); // Insert an object into the cache with the given metadata. -// +// // Can only be used in if the cache handle state includes the `must-insert-or-update` flag. -// +// // The returned handle is to a streaming body that is used for writing the object into // the cache. -bool fastly_compute_at_edge_cache_transaction_insert(fastly_compute_at_edge_cache_handle_t handle, fastly_compute_at_edge_cache_write_options_t *options, fastly_compute_at_edge_cache_body_handle_t *ret, fastly_compute_at_edge_cache_error_t *err); +extern bool fastly_compute_at_edge_cache_transaction_insert( + fastly_compute_at_edge_cache_handle_t handle, + fastly_compute_at_edge_cache_write_options_t *options, + fastly_compute_at_edge_cache_body_handle_t *ret, fastly_compute_at_edge_cache_error_t *err); // Insert an object into the cache with the given metadata, and return a readable stream of the // bytes as they are stored. -// +// // This helps avoid the "slow reader" problem on a teed stream, for example when a program wishes // to store a backend request in the cache while simultaneously streaming to a client in an HTTP // response. -// +// // The returned body handle is to a streaming body that is used for writing the object _into_ // the cache. The returned cache handle provides a separate transaction for reading out the // newly cached object to send elsewhere. -bool fastly_compute_at_edge_cache_transaction_insert_and_stream_back(fastly_compute_at_edge_cache_handle_t handle, fastly_compute_at_edge_cache_write_options_t *options, fastly_world_tuple2_fastly_compute_at_edge_cache_body_handle_fastly_compute_at_edge_cache_handle_t *ret, fastly_compute_at_edge_cache_error_t *err); +extern bool fastly_compute_at_edge_cache_transaction_insert_and_stream_back( + fastly_compute_at_edge_cache_handle_t handle, + fastly_compute_at_edge_cache_write_options_t *options, + fastly_world_tuple2_body_handle_handle_t *ret, fastly_compute_at_edge_cache_error_t *err); // Update the metadata of an object in the cache without changing its data. -// +// // Can only be used in if the cache handle state includes both of the flags: // - `found` // - `must-insert-or-update` -bool fastly_compute_at_edge_cache_transaction_update(fastly_compute_at_edge_cache_handle_t handle, fastly_compute_at_edge_cache_write_options_t *options, fastly_compute_at_edge_cache_error_t *err); +extern bool fastly_compute_at_edge_cache_transaction_update( + fastly_compute_at_edge_cache_handle_t handle, + fastly_compute_at_edge_cache_write_options_t *options, + fastly_compute_at_edge_cache_error_t *err); // Cancel an obligation to provide an object to the cache. -// +// // Useful if there is an error before streaming is possible, e.g. if a backend is unreachable. -bool fastly_compute_at_edge_cache_transaction_cancel(fastly_compute_at_edge_cache_handle_t handle, fastly_compute_at_edge_cache_error_t *err); +extern bool +fastly_compute_at_edge_cache_transaction_cancel(fastly_compute_at_edge_cache_handle_t handle, + fastly_compute_at_edge_cache_error_t *err); // Close an ongoing interaction with the cache. -// +// // If the cache handle state includes the `$must_insert_or_update` (and hence no insert or // update has been performed), closing the handle cancels any request collapsing, potentially // choosing a new waiter to perform the insertion/update. -bool fastly_compute_at_edge_cache_close(fastly_compute_at_edge_cache_handle_t handle, fastly_compute_at_edge_cache_error_t *err); -bool fastly_compute_at_edge_cache_get_state(fastly_compute_at_edge_cache_handle_t handle, fastly_compute_at_edge_cache_lookup_state_t *ret, fastly_compute_at_edge_cache_error_t *err); +extern bool fastly_compute_at_edge_cache_close(fastly_compute_at_edge_cache_handle_t handle, + fastly_compute_at_edge_cache_error_t *err); +extern bool fastly_compute_at_edge_cache_get_state(fastly_compute_at_edge_cache_handle_t handle, + fastly_compute_at_edge_cache_lookup_state_t *ret, + fastly_compute_at_edge_cache_error_t *err); // Gets the user metadata of the found object, returning `none` if there // was no found object. -bool fastly_compute_at_edge_cache_get_user_metadata(fastly_compute_at_edge_cache_handle_t handle, fastly_world_list_u8_t *ret, fastly_compute_at_edge_cache_error_t *err); +extern bool +fastly_compute_at_edge_cache_get_user_metadata(fastly_compute_at_edge_cache_handle_t handle, + fastly_world_list_u8_t *ret, + fastly_compute_at_edge_cache_error_t *err); // Gets a range of the found object body, returning the `optional-none` error if there // was no found object. -// +// // The returned `body_handle` must be closed before calling this function again on the same // `cache_handle`. -// +// // Note: until the CacheD protocol is adjusted to fully support this functionality, // the body of objects that are past the stale-while-revalidate period will not // be available, even when other metadata is. -bool fastly_compute_at_edge_cache_get_body(fastly_compute_at_edge_cache_handle_t handle, fastly_compute_at_edge_cache_get_body_options_t *options, fastly_compute_at_edge_cache_get_body_options_mask_t options_mask, fastly_compute_at_edge_cache_body_handle_t *ret, fastly_compute_at_edge_cache_error_t *err); +extern bool fastly_compute_at_edge_cache_get_body( + fastly_compute_at_edge_cache_handle_t handle, + fastly_compute_at_edge_cache_get_body_options_t *options, + fastly_compute_at_edge_cache_get_body_options_mask_t options_mask, + fastly_compute_at_edge_cache_body_handle_t *ret, fastly_compute_at_edge_cache_error_t *err); // Gets the content length of the found object, returning the `$none` error if there // was no found object, or no content length was provided. -bool fastly_compute_at_edge_cache_get_length(fastly_compute_at_edge_cache_handle_t handle, uint64_t *ret, fastly_compute_at_edge_cache_error_t *err); +extern bool fastly_compute_at_edge_cache_get_length(fastly_compute_at_edge_cache_handle_t handle, + uint64_t *ret, + fastly_compute_at_edge_cache_error_t *err); // Gets the configured max age of the found object, returning the `$none` error if there // was no found object. -bool fastly_compute_at_edge_cache_get_max_age_ns(fastly_compute_at_edge_cache_handle_t handle, uint64_t *ret, fastly_compute_at_edge_cache_error_t *err); +extern bool +fastly_compute_at_edge_cache_get_max_age_ns(fastly_compute_at_edge_cache_handle_t handle, + uint64_t *ret, + fastly_compute_at_edge_cache_error_t *err); // Gets the configured stale-while-revalidate period of the found object, returning the // `$none` error if there was no found object. -bool fastly_compute_at_edge_cache_get_stale_while_revalidate_ns(fastly_compute_at_edge_cache_handle_t handle, uint64_t *ret, fastly_compute_at_edge_cache_error_t *err); +extern bool fastly_compute_at_edge_cache_get_stale_while_revalidate_ns( + fastly_compute_at_edge_cache_handle_t handle, uint64_t *ret, + fastly_compute_at_edge_cache_error_t *err); // Gets the age of the found object, returning the `$none` error if there // was no found object. -bool fastly_compute_at_edge_cache_get_age_ns(fastly_compute_at_edge_cache_handle_t handle, uint64_t *ret, fastly_compute_at_edge_cache_error_t *err); +extern bool fastly_compute_at_edge_cache_get_age_ns(fastly_compute_at_edge_cache_handle_t handle, + uint64_t *ret, + fastly_compute_at_edge_cache_error_t *err); // Gets the number of cache hits for the found object, returning the `$none` error if there // was no found object. -bool fastly_compute_at_edge_cache_get_hits(fastly_compute_at_edge_cache_handle_t handle, uint64_t *ret, fastly_compute_at_edge_cache_error_t *err); +extern bool fastly_compute_at_edge_cache_get_hits(fastly_compute_at_edge_cache_handle_t handle, + uint64_t *ret, + fastly_compute_at_edge_cache_error_t *err); // Imported Functions from `fastly:compute-at-edge/device-detection` -bool fastly_compute_at_edge_device_detection_lookup(fastly_world_string_t *user_agent, fastly_world_string_t *ret, fastly_compute_at_edge_device_detection_error_t *err); +extern bool fastly_compute_at_edge_device_detection_lookup( + fastly_world_string_t *user_agent, fastly_world_string_t *ret, + fastly_compute_at_edge_device_detection_error_t *err); // Imported Functions from `fastly:compute-at-edge/dictionary` -bool fastly_compute_at_edge_dictionary_open(fastly_world_string_t *name, fastly_compute_at_edge_dictionary_handle_t *ret, fastly_compute_at_edge_dictionary_error_t *err); -bool fastly_compute_at_edge_dictionary_get(fastly_compute_at_edge_dictionary_handle_t h, fastly_world_string_t *key, fastly_world_option_string_t *ret, fastly_compute_at_edge_dictionary_error_t *err); +extern bool fastly_compute_at_edge_dictionary_open(fastly_world_string_t *name, + fastly_compute_at_edge_dictionary_handle_t *ret, + fastly_compute_at_edge_dictionary_error_t *err); +extern bool fastly_compute_at_edge_dictionary_get(fastly_compute_at_edge_dictionary_handle_t h, + fastly_world_string_t *key, + fastly_world_option_string_t *ret, + fastly_compute_at_edge_dictionary_error_t *err); // Imported Functions from `fastly:compute-at-edge/edge-rate-limiter` -bool fastly_compute_at_edge_edge_rate_limiter_check_rate(fastly_world_string_t *rate_counter_name, fastly_world_string_t *entry, uint32_t delta, uint32_t window, uint32_t limit, fastly_world_string_t *penalty_box_name, uint32_t time_to_live, bool *ret, fastly_compute_at_edge_edge_rate_limiter_error_t *err); -bool fastly_compute_at_edge_edge_rate_limiter_ratecounter_increment(fastly_world_string_t *rate_counter_name, fastly_world_string_t *entry, uint32_t delta, fastly_compute_at_edge_edge_rate_limiter_error_t *err); -bool fastly_compute_at_edge_edge_rate_limiter_ratecounter_lookup_rate(fastly_world_string_t *rate_counter_name, fastly_world_string_t *entry, uint32_t window, uint32_t *ret, fastly_compute_at_edge_edge_rate_limiter_error_t *err); -bool fastly_compute_at_edge_edge_rate_limiter_ratecounter_lookup_count(fastly_world_string_t *rate_counter_name, fastly_world_string_t *entry, uint32_t duration, uint32_t *ret, fastly_compute_at_edge_edge_rate_limiter_error_t *err); -bool fastly_compute_at_edge_edge_rate_limiter_penaltybox_add(fastly_world_string_t *penalty_box_name, fastly_world_string_t *entry, uint32_t time_to_live, fastly_compute_at_edge_edge_rate_limiter_error_t *err); -bool fastly_compute_at_edge_edge_rate_limiter_penaltybox_has(fastly_world_string_t *penalty_box_name, fastly_world_string_t *entry, bool *ret, fastly_compute_at_edge_edge_rate_limiter_error_t *err); +extern bool fastly_compute_at_edge_edge_rate_limiter_check_rate( + fastly_world_string_t *rate_counter_name, fastly_world_string_t *entry, uint32_t delta, + uint32_t window, uint32_t limit, fastly_world_string_t *penalty_box_name, uint32_t time_to_live, + bool *ret, fastly_compute_at_edge_edge_rate_limiter_error_t *err); +extern bool fastly_compute_at_edge_edge_rate_limiter_ratecounter_increment( + fastly_world_string_t *rate_counter_name, fastly_world_string_t *entry, uint32_t delta, + fastly_compute_at_edge_edge_rate_limiter_error_t *err); +extern bool fastly_compute_at_edge_edge_rate_limiter_ratecounter_lookup_rate( + fastly_world_string_t *rate_counter_name, fastly_world_string_t *entry, uint32_t window, + uint32_t *ret, fastly_compute_at_edge_edge_rate_limiter_error_t *err); +extern bool fastly_compute_at_edge_edge_rate_limiter_ratecounter_lookup_count( + fastly_world_string_t *rate_counter_name, fastly_world_string_t *entry, uint32_t duration, + uint32_t *ret, fastly_compute_at_edge_edge_rate_limiter_error_t *err); +extern bool fastly_compute_at_edge_edge_rate_limiter_penaltybox_add( + fastly_world_string_t *penalty_box_name, fastly_world_string_t *entry, uint32_t time_to_live, + fastly_compute_at_edge_edge_rate_limiter_error_t *err); +extern bool fastly_compute_at_edge_edge_rate_limiter_penaltybox_has( + fastly_world_string_t *penalty_box_name, fastly_world_string_t *entry, bool *ret, + fastly_compute_at_edge_edge_rate_limiter_error_t *err); // Imported Functions from `fastly:compute-at-edge/geo` // JSON string for now -bool fastly_compute_at_edge_geo_lookup(fastly_world_list_u8_t *addr_octets, fastly_world_string_t *ret, fastly_compute_at_edge_geo_error_t *err); +extern bool fastly_compute_at_edge_geo_lookup(fastly_world_list_u8_t *addr_octets, + fastly_world_string_t *ret, + fastly_compute_at_edge_geo_error_t *err); // Imported Functions from `fastly:compute-at-edge/http-body` -bool fastly_compute_at_edge_http_body_append(fastly_compute_at_edge_http_body_body_handle_t dest, fastly_compute_at_edge_http_body_body_handle_t src, fastly_compute_at_edge_http_body_error_t *err); -bool fastly_compute_at_edge_http_body_new(fastly_compute_at_edge_http_body_body_handle_t *ret, fastly_compute_at_edge_http_body_error_t *err); -bool fastly_compute_at_edge_http_body_read(fastly_compute_at_edge_http_body_body_handle_t h, uint32_t chunk_size, fastly_world_list_u8_t *ret, fastly_compute_at_edge_http_body_error_t *err); -bool fastly_compute_at_edge_http_body_write(fastly_compute_at_edge_http_body_body_handle_t h, fastly_world_list_u8_t *buf, fastly_compute_at_edge_http_body_write_end_t end, uint32_t *ret, fastly_compute_at_edge_http_body_error_t *err); -bool fastly_compute_at_edge_http_body_close(fastly_compute_at_edge_http_body_body_handle_t h, fastly_compute_at_edge_http_body_error_t *err); +extern bool +fastly_compute_at_edge_http_body_append(fastly_compute_at_edge_http_body_body_handle_t dest, + fastly_compute_at_edge_http_body_body_handle_t src, + fastly_compute_at_edge_http_body_error_t *err); +extern bool +fastly_compute_at_edge_http_body_new(fastly_compute_at_edge_http_body_body_handle_t *ret, + fastly_compute_at_edge_http_body_error_t *err); +extern bool fastly_compute_at_edge_http_body_read(fastly_compute_at_edge_http_body_body_handle_t h, + uint32_t chunk_size, fastly_world_list_u8_t *ret, + fastly_compute_at_edge_http_body_error_t *err); +extern bool fastly_compute_at_edge_http_body_write(fastly_compute_at_edge_http_body_body_handle_t h, + fastly_world_list_u8_t *buf, + fastly_compute_at_edge_http_body_write_end_t end, + uint32_t *ret, + fastly_compute_at_edge_http_body_error_t *err); +extern bool fastly_compute_at_edge_http_body_close(fastly_compute_at_edge_http_body_body_handle_t h, + fastly_compute_at_edge_http_body_error_t *err); // Imported Functions from `fastly:compute-at-edge/http-req` -bool fastly_compute_at_edge_http_req_cache_override_set(fastly_compute_at_edge_http_req_request_handle_t h, fastly_compute_at_edge_http_req_cache_override_tag_t tag, uint32_t *maybe_ttl, uint32_t *maybe_stale_while_revalidate, fastly_world_string_t *maybe_sk, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_downstream_client_ip_addr(fastly_world_list_u8_t *ret, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_downstream_client_request_id(fastly_world_string_t *ret, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_downstream_client_h2_fingerprint(fastly_world_list_u8_t *ret, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_downstream_tls_cipher_openssl_name(fastly_world_string_t *ret, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_downstream_tls_protocol(fastly_world_string_t *ret, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_downstream_tls_client_hello(fastly_world_list_u8_t *ret, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_downstream_tls_raw_client_certificate(fastly_world_list_u8_t *ret, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_downstream_tls_client_cert_verify_result(fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_downstream_tls_ja3_md5(fastly_world_list_u8_t *ret, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_new(fastly_compute_at_edge_http_req_request_handle_t *ret, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_header_names_get(fastly_compute_at_edge_http_req_request_handle_t h, fastly_world_list_string_t *ret, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_original_header_names_get(fastly_world_list_string_t *ret, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_original_header_count(uint32_t *ret, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_header_value_get(fastly_compute_at_edge_http_req_request_handle_t h, fastly_world_string_t *name, fastly_world_option_list_u8_t *ret, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_header_values_get(fastly_compute_at_edge_http_req_request_handle_t h, fastly_world_string_t *name, fastly_world_option_list_list_u8_t *ret, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_header_values_set(fastly_compute_at_edge_http_req_request_handle_t h, fastly_world_string_t *name, fastly_world_list_list_u8_t *values, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_header_insert(fastly_compute_at_edge_http_req_request_handle_t h, fastly_world_string_t *name, fastly_world_list_u8_t *value, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_header_append(fastly_compute_at_edge_http_req_request_handle_t h, fastly_world_string_t *name, fastly_world_list_u8_t *value, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_header_remove(fastly_compute_at_edge_http_req_request_handle_t h, fastly_world_string_t *name, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_method_get(fastly_compute_at_edge_http_req_request_handle_t h, fastly_world_string_t *ret, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_method_set(fastly_compute_at_edge_http_req_request_handle_t h, fastly_world_string_t *method, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_uri_get(fastly_compute_at_edge_http_req_request_handle_t h, fastly_world_string_t *ret, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_uri_set(fastly_compute_at_edge_http_req_request_handle_t h, fastly_world_string_t *uri, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_version_get(fastly_compute_at_edge_http_req_request_handle_t h, fastly_compute_at_edge_http_req_http_version_t *ret, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_version_set(fastly_compute_at_edge_http_req_request_handle_t h, fastly_compute_at_edge_http_req_http_version_t version, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_send(fastly_compute_at_edge_http_req_request_handle_t h, fastly_compute_at_edge_http_req_body_handle_t b, fastly_world_string_t *backend, fastly_compute_at_edge_http_req_response_t *ret, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_send_v2(fastly_compute_at_edge_http_req_request_handle_t h, fastly_compute_at_edge_http_req_send_error_detail_t *s, fastly_compute_at_edge_http_req_body_handle_t b, fastly_world_string_t *backend, fastly_compute_at_edge_http_req_response_t *ret, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_send_async(fastly_compute_at_edge_http_req_request_handle_t h, fastly_compute_at_edge_http_req_body_handle_t b, fastly_world_string_t *backend, fastly_compute_at_edge_http_req_pending_request_handle_t *ret, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_send_async_streaming(fastly_compute_at_edge_http_req_request_handle_t h, fastly_compute_at_edge_http_req_body_handle_t b, fastly_world_string_t *backend, fastly_compute_at_edge_http_req_pending_request_handle_t *ret, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_pending_req_poll(fastly_compute_at_edge_http_req_pending_request_handle_t h, fastly_world_option_fastly_compute_at_edge_http_req_response_t *ret, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_pending_req_poll_v2(fastly_compute_at_edge_http_req_pending_request_handle_t h, fastly_compute_at_edge_http_req_send_error_detail_t *s, fastly_world_option_fastly_compute_at_edge_http_req_response_t *ret, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_pending_req_wait(fastly_compute_at_edge_http_req_pending_request_handle_t h, fastly_compute_at_edge_http_req_response_t *ret, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_pending_req_wait_v2(fastly_compute_at_edge_http_req_pending_request_handle_t h, fastly_compute_at_edge_http_req_send_error_detail_t *s, fastly_compute_at_edge_http_req_response_t *ret, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_pending_req_select(fastly_world_list_fastly_compute_at_edge_http_req_pending_request_handle_t *h, fastly_world_tuple2_u32_fastly_compute_at_edge_http_req_response_t *ret, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_pending_req_select_v2(fastly_world_list_fastly_compute_at_edge_http_req_pending_request_handle_t *h, fastly_world_tuple2_u32_fastly_compute_at_edge_http_req_response_t *ret, fastly_compute_at_edge_http_req_send_error_detail_t *err); -bool fastly_compute_at_edge_http_req_close(fastly_compute_at_edge_http_req_request_handle_t h, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_auto_decompress_response_set(fastly_compute_at_edge_http_req_request_handle_t h, fastly_compute_at_edge_http_req_content_encodings_t encodings, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_upgrade_websocket(fastly_world_string_t *backend, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_redirect_to_websocket_proxy(fastly_world_string_t *backend, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_redirect_to_grip_proxy(fastly_world_string_t *backend, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_framing_headers_mode_set(fastly_compute_at_edge_http_req_request_handle_t h, fastly_compute_at_edge_http_req_framing_headers_mode_t mode, fastly_compute_at_edge_http_req_error_t *err); -bool fastly_compute_at_edge_http_req_register_dynamic_backend(fastly_world_string_t *prefix, fastly_world_string_t *target, fastly_compute_at_edge_http_req_dynamic_backend_config_t *config, fastly_compute_at_edge_http_req_error_t *err); +extern bool fastly_compute_at_edge_http_req_cache_override_set( + fastly_compute_at_edge_http_req_request_handle_t h, + fastly_compute_at_edge_http_req_cache_override_tag_t tag, uint32_t *maybe_ttl, + uint32_t *maybe_stale_while_revalidate, fastly_world_string_t *maybe_sk, + fastly_compute_at_edge_http_req_error_t *err); +extern bool fastly_compute_at_edge_http_req_downstream_client_ip_addr( + fastly_world_list_u8_t *ret, fastly_compute_at_edge_http_req_error_t *err); +extern bool fastly_compute_at_edge_http_req_downstream_client_request_id( + fastly_world_string_t *ret, fastly_compute_at_edge_http_req_error_t *err); +extern bool fastly_compute_at_edge_http_req_downstream_client_h2_fingerprint( + fastly_world_list_u8_t *ret, fastly_compute_at_edge_http_req_error_t *err); +extern bool fastly_compute_at_edge_http_req_downstream_tls_cipher_openssl_name( + fastly_world_string_t *ret, fastly_compute_at_edge_http_req_error_t *err); +extern bool fastly_compute_at_edge_http_req_downstream_tls_protocol( + fastly_world_string_t *ret, fastly_compute_at_edge_http_req_error_t *err); +extern bool fastly_compute_at_edge_http_req_downstream_tls_client_hello( + fastly_world_list_u8_t *ret, fastly_compute_at_edge_http_req_error_t *err); +extern bool fastly_compute_at_edge_http_req_downstream_tls_raw_client_certificate( + fastly_world_list_u8_t *ret, fastly_compute_at_edge_http_req_error_t *err); +extern bool fastly_compute_at_edge_http_req_downstream_tls_client_cert_verify_result( + fastly_compute_at_edge_http_req_error_t *err); +extern bool fastly_compute_at_edge_http_req_downstream_tls_ja3_md5( + fastly_world_list_u8_t *ret, fastly_compute_at_edge_http_req_error_t *err); +extern bool +fastly_compute_at_edge_http_req_new(fastly_compute_at_edge_http_req_request_handle_t *ret, + fastly_compute_at_edge_http_req_error_t *err); +extern bool +fastly_compute_at_edge_http_req_header_names_get(fastly_compute_at_edge_http_req_request_handle_t h, + fastly_world_list_string_t *ret, + fastly_compute_at_edge_http_req_error_t *err); +extern bool fastly_compute_at_edge_http_req_original_header_names_get( + fastly_world_list_string_t *ret, fastly_compute_at_edge_http_req_error_t *err); +extern bool +fastly_compute_at_edge_http_req_original_header_count(uint32_t *ret, + fastly_compute_at_edge_http_req_error_t *err); +extern bool fastly_compute_at_edge_http_req_header_value_get( + fastly_compute_at_edge_http_req_request_handle_t h, fastly_world_string_t *name, + fastly_world_option_list_u8_t *ret, fastly_compute_at_edge_http_req_error_t *err); +extern bool fastly_compute_at_edge_http_req_header_values_get( + fastly_compute_at_edge_http_req_request_handle_t h, fastly_world_string_t *name, + fastly_world_option_list_list_u8_t *ret, fastly_compute_at_edge_http_req_error_t *err); +extern bool fastly_compute_at_edge_http_req_header_values_set( + fastly_compute_at_edge_http_req_request_handle_t h, fastly_world_string_t *name, + fastly_world_list_list_u8_t *values, fastly_compute_at_edge_http_req_error_t *err); +extern bool fastly_compute_at_edge_http_req_header_insert( + fastly_compute_at_edge_http_req_request_handle_t h, fastly_world_string_t *name, + fastly_world_list_u8_t *value, fastly_compute_at_edge_http_req_error_t *err); +extern bool fastly_compute_at_edge_http_req_header_append( + fastly_compute_at_edge_http_req_request_handle_t h, fastly_world_string_t *name, + fastly_world_list_u8_t *value, fastly_compute_at_edge_http_req_error_t *err); +extern bool +fastly_compute_at_edge_http_req_header_remove(fastly_compute_at_edge_http_req_request_handle_t h, + fastly_world_string_t *name, + fastly_compute_at_edge_http_req_error_t *err); +extern bool +fastly_compute_at_edge_http_req_method_get(fastly_compute_at_edge_http_req_request_handle_t h, + fastly_world_string_t *ret, + fastly_compute_at_edge_http_req_error_t *err); +extern bool +fastly_compute_at_edge_http_req_method_set(fastly_compute_at_edge_http_req_request_handle_t h, + fastly_world_string_t *method, + fastly_compute_at_edge_http_req_error_t *err); +extern bool +fastly_compute_at_edge_http_req_uri_get(fastly_compute_at_edge_http_req_request_handle_t h, + fastly_world_string_t *ret, + fastly_compute_at_edge_http_req_error_t *err); +extern bool +fastly_compute_at_edge_http_req_uri_set(fastly_compute_at_edge_http_req_request_handle_t h, + fastly_world_string_t *uri, + fastly_compute_at_edge_http_req_error_t *err); +extern bool +fastly_compute_at_edge_http_req_version_get(fastly_compute_at_edge_http_req_request_handle_t h, + fastly_compute_at_edge_http_req_http_version_t *ret, + fastly_compute_at_edge_http_req_error_t *err); +extern bool +fastly_compute_at_edge_http_req_version_set(fastly_compute_at_edge_http_req_request_handle_t h, + fastly_compute_at_edge_http_req_http_version_t version, + fastly_compute_at_edge_http_req_error_t *err); +extern bool fastly_compute_at_edge_http_req_send(fastly_compute_at_edge_http_req_request_handle_t h, + fastly_compute_at_edge_http_req_body_handle_t b, + fastly_world_string_t *backend, + fastly_compute_at_edge_http_req_response_t *ret, + fastly_compute_at_edge_http_req_error_t *err); +extern bool fastly_compute_at_edge_http_req_send_v2( + fastly_compute_at_edge_http_req_request_handle_t h, + fastly_compute_at_edge_http_req_send_error_detail_t *s, + fastly_compute_at_edge_http_req_body_handle_t b, fastly_world_string_t *backend, + fastly_compute_at_edge_http_req_response_t *ret, fastly_compute_at_edge_http_req_error_t *err); +extern bool fastly_compute_at_edge_http_req_send_async( + fastly_compute_at_edge_http_req_request_handle_t h, + fastly_compute_at_edge_http_req_body_handle_t b, fastly_world_string_t *backend, + fastly_compute_at_edge_http_req_pending_request_handle_t *ret, + fastly_compute_at_edge_http_req_error_t *err); +extern bool fastly_compute_at_edge_http_req_send_async_streaming( + fastly_compute_at_edge_http_req_request_handle_t h, + fastly_compute_at_edge_http_req_body_handle_t b, fastly_world_string_t *backend, + fastly_compute_at_edge_http_req_pending_request_handle_t *ret, + fastly_compute_at_edge_http_req_error_t *err); +extern bool fastly_compute_at_edge_http_req_pending_req_poll( + fastly_compute_at_edge_http_req_pending_request_handle_t h, fastly_world_option_response_t *ret, + fastly_compute_at_edge_http_req_error_t *err); +extern bool fastly_compute_at_edge_http_req_pending_req_poll_v2( + fastly_compute_at_edge_http_req_pending_request_handle_t h, + fastly_compute_at_edge_http_req_send_error_detail_t *s, fastly_world_option_response_t *ret, + fastly_compute_at_edge_http_req_error_t *err); +extern bool fastly_compute_at_edge_http_req_pending_req_wait( + fastly_compute_at_edge_http_req_pending_request_handle_t h, + fastly_compute_at_edge_http_req_response_t *ret, fastly_compute_at_edge_http_req_error_t *err); +extern bool fastly_compute_at_edge_http_req_pending_req_wait_v2( + fastly_compute_at_edge_http_req_pending_request_handle_t h, + fastly_compute_at_edge_http_req_send_error_detail_t *s, + fastly_compute_at_edge_http_req_response_t *ret, fastly_compute_at_edge_http_req_error_t *err); +extern bool +fastly_compute_at_edge_http_req_pending_req_select(fastly_world_list_pending_request_handle_t *h, + fastly_world_tuple2_u32_response_t *ret, + fastly_compute_at_edge_http_req_error_t *err); +extern bool fastly_compute_at_edge_http_req_pending_req_select_v2( + fastly_world_list_pending_request_handle_t *h, fastly_world_tuple2_u32_response_t *ret, + fastly_compute_at_edge_http_req_send_error_detail_t *err); +extern bool +fastly_compute_at_edge_http_req_close(fastly_compute_at_edge_http_req_request_handle_t h, + fastly_compute_at_edge_http_req_error_t *err); +extern bool fastly_compute_at_edge_http_req_auto_decompress_response_set( + fastly_compute_at_edge_http_req_request_handle_t h, + fastly_compute_at_edge_http_req_content_encodings_t encodings, + fastly_compute_at_edge_http_req_error_t *err); +extern bool +fastly_compute_at_edge_http_req_upgrade_websocket(fastly_world_string_t *backend, + fastly_compute_at_edge_http_req_error_t *err); +extern bool fastly_compute_at_edge_http_req_redirect_to_websocket_proxy( + fastly_world_string_t *backend, fastly_compute_at_edge_http_req_error_t *err); +extern bool fastly_compute_at_edge_http_req_redirect_to_grip_proxy( + fastly_world_string_t *backend, fastly_compute_at_edge_http_req_error_t *err); +extern bool fastly_compute_at_edge_http_req_framing_headers_mode_set( + fastly_compute_at_edge_http_req_request_handle_t h, + fastly_compute_at_edge_http_req_framing_headers_mode_t mode, + fastly_compute_at_edge_http_req_error_t *err); +extern bool fastly_compute_at_edge_http_req_register_dynamic_backend( + fastly_world_string_t *prefix, fastly_world_string_t *target, + fastly_compute_at_edge_http_req_dynamic_backend_config_t *config, + fastly_compute_at_edge_http_req_error_t *err); // Imported Functions from `fastly:compute-at-edge/http-resp` -bool fastly_compute_at_edge_http_resp_new(fastly_compute_at_edge_http_resp_response_handle_t *ret, fastly_compute_at_edge_http_resp_error_t *err); -bool fastly_compute_at_edge_http_resp_header_names_get(fastly_compute_at_edge_http_resp_response_handle_t h, fastly_world_list_string_t *ret, fastly_compute_at_edge_http_resp_error_t *err); -bool fastly_compute_at_edge_http_resp_header_value_get(fastly_compute_at_edge_http_resp_response_handle_t h, fastly_world_string_t *name, fastly_world_option_string_t *ret, fastly_compute_at_edge_http_resp_error_t *err); -bool fastly_compute_at_edge_http_resp_header_values_get(fastly_compute_at_edge_http_resp_response_handle_t h, fastly_world_string_t *name, fastly_world_option_list_list_u8_t *ret, fastly_compute_at_edge_http_resp_error_t *err); -bool fastly_compute_at_edge_http_resp_header_values_set(fastly_compute_at_edge_http_resp_response_handle_t h, fastly_world_string_t *name, fastly_world_list_list_u8_t *values, fastly_compute_at_edge_http_resp_error_t *err); -bool fastly_compute_at_edge_http_resp_header_insert(fastly_compute_at_edge_http_resp_response_handle_t h, fastly_world_string_t *name, fastly_world_list_u8_t *value, fastly_compute_at_edge_http_resp_error_t *err); -bool fastly_compute_at_edge_http_resp_header_append(fastly_compute_at_edge_http_resp_response_handle_t h, fastly_world_string_t *name, fastly_world_list_u8_t *value, fastly_compute_at_edge_http_resp_error_t *err); -bool fastly_compute_at_edge_http_resp_header_remove(fastly_compute_at_edge_http_resp_response_handle_t h, fastly_world_string_t *name, fastly_compute_at_edge_http_resp_error_t *err); -bool fastly_compute_at_edge_http_resp_version_get(fastly_compute_at_edge_http_resp_response_handle_t h, fastly_compute_at_edge_http_resp_http_version_t *ret, fastly_compute_at_edge_http_resp_error_t *err); -bool fastly_compute_at_edge_http_resp_version_set(fastly_compute_at_edge_http_resp_response_handle_t h, fastly_compute_at_edge_http_resp_http_version_t version, fastly_compute_at_edge_http_resp_error_t *err); -bool fastly_compute_at_edge_http_resp_send_downstream(fastly_compute_at_edge_http_resp_response_handle_t h, fastly_compute_at_edge_http_resp_body_handle_t b, bool streaming, fastly_compute_at_edge_http_resp_error_t *err); -bool fastly_compute_at_edge_http_resp_status_get(fastly_compute_at_edge_http_resp_response_handle_t h, fastly_compute_at_edge_http_resp_http_status_t *ret, fastly_compute_at_edge_http_resp_error_t *err); -bool fastly_compute_at_edge_http_resp_status_set(fastly_compute_at_edge_http_resp_response_handle_t h, fastly_compute_at_edge_http_resp_http_status_t status, fastly_compute_at_edge_http_resp_error_t *err); -bool fastly_compute_at_edge_http_resp_close(fastly_compute_at_edge_http_resp_response_handle_t h, fastly_compute_at_edge_http_resp_error_t *err); +extern bool +fastly_compute_at_edge_http_resp_new(fastly_compute_at_edge_http_resp_response_handle_t *ret, + fastly_compute_at_edge_http_resp_error_t *err); +extern bool fastly_compute_at_edge_http_resp_header_names_get( + fastly_compute_at_edge_http_resp_response_handle_t h, fastly_world_list_string_t *ret, + fastly_compute_at_edge_http_resp_error_t *err); +extern bool fastly_compute_at_edge_http_resp_header_value_get( + fastly_compute_at_edge_http_resp_response_handle_t h, fastly_world_string_t *name, + fastly_world_option_string_t *ret, fastly_compute_at_edge_http_resp_error_t *err); +extern bool fastly_compute_at_edge_http_resp_header_values_get( + fastly_compute_at_edge_http_resp_response_handle_t h, fastly_world_string_t *name, + fastly_world_option_list_list_u8_t *ret, fastly_compute_at_edge_http_resp_error_t *err); +extern bool fastly_compute_at_edge_http_resp_header_values_set( + fastly_compute_at_edge_http_resp_response_handle_t h, fastly_world_string_t *name, + fastly_world_list_list_u8_t *values, fastly_compute_at_edge_http_resp_error_t *err); +extern bool fastly_compute_at_edge_http_resp_header_insert( + fastly_compute_at_edge_http_resp_response_handle_t h, fastly_world_string_t *name, + fastly_world_list_u8_t *value, fastly_compute_at_edge_http_resp_error_t *err); +extern bool fastly_compute_at_edge_http_resp_header_append( + fastly_compute_at_edge_http_resp_response_handle_t h, fastly_world_string_t *name, + fastly_world_list_u8_t *value, fastly_compute_at_edge_http_resp_error_t *err); +extern bool +fastly_compute_at_edge_http_resp_header_remove(fastly_compute_at_edge_http_resp_response_handle_t h, + fastly_world_string_t *name, + fastly_compute_at_edge_http_resp_error_t *err); +extern bool +fastly_compute_at_edge_http_resp_version_get(fastly_compute_at_edge_http_resp_response_handle_t h, + fastly_compute_at_edge_http_resp_http_version_t *ret, + fastly_compute_at_edge_http_resp_error_t *err); +extern bool fastly_compute_at_edge_http_resp_version_set( + fastly_compute_at_edge_http_resp_response_handle_t h, + fastly_compute_at_edge_http_resp_http_version_t version, + fastly_compute_at_edge_http_resp_error_t *err); +extern bool fastly_compute_at_edge_http_resp_send_downstream( + fastly_compute_at_edge_http_resp_response_handle_t h, + fastly_compute_at_edge_http_resp_body_handle_t b, bool streaming, + fastly_compute_at_edge_http_resp_error_t *err); +extern bool +fastly_compute_at_edge_http_resp_status_get(fastly_compute_at_edge_http_resp_response_handle_t h, + fastly_compute_at_edge_http_resp_http_status_t *ret, + fastly_compute_at_edge_http_resp_error_t *err); +extern bool +fastly_compute_at_edge_http_resp_status_set(fastly_compute_at_edge_http_resp_response_handle_t h, + fastly_compute_at_edge_http_resp_http_status_t status, + fastly_compute_at_edge_http_resp_error_t *err); +extern bool +fastly_compute_at_edge_http_resp_close(fastly_compute_at_edge_http_resp_response_handle_t h, + fastly_compute_at_edge_http_resp_error_t *err); // Adjust how this response's framing headers are determined. -bool fastly_compute_at_edge_http_resp_framing_headers_mode_set(fastly_compute_at_edge_http_resp_response_handle_t h, fastly_compute_at_edge_http_resp_framing_headers_mode_t mode, fastly_compute_at_edge_http_resp_error_t *err); -bool fastly_compute_at_edge_http_resp_http_keepalive_mode_set(fastly_compute_at_edge_http_resp_response_handle_t h, fastly_compute_at_edge_http_resp_keepalive_mode_t mode, fastly_compute_at_edge_http_resp_error_t *err); +extern bool fastly_compute_at_edge_http_resp_framing_headers_mode_set( + fastly_compute_at_edge_http_resp_response_handle_t h, + fastly_compute_at_edge_http_resp_framing_headers_mode_t mode, + fastly_compute_at_edge_http_resp_error_t *err); +extern bool fastly_compute_at_edge_http_resp_http_keepalive_mode_set( + fastly_compute_at_edge_http_resp_response_handle_t h, + fastly_compute_at_edge_http_resp_keepalive_mode_t mode, + fastly_compute_at_edge_http_resp_error_t *err); // Imported Functions from `fastly:compute-at-edge/log` -bool fastly_compute_at_edge_log_endpoint_get(fastly_world_string_t *name, fastly_compute_at_edge_log_handle_t *ret, fastly_compute_at_edge_log_error_t *err); -bool fastly_compute_at_edge_log_write(fastly_compute_at_edge_log_handle_t h, fastly_world_string_t *msg, fastly_compute_at_edge_log_error_t *err); +extern bool fastly_compute_at_edge_log_endpoint_get(fastly_world_string_t *name, + fastly_compute_at_edge_log_handle_t *ret, + fastly_compute_at_edge_log_error_t *err); +extern bool fastly_compute_at_edge_log_write(fastly_compute_at_edge_log_handle_t h, + fastly_world_string_t *msg, + fastly_compute_at_edge_log_error_t *err); // Imported Functions from `fastly:compute-at-edge/object-store` -bool fastly_compute_at_edge_object_store_open(fastly_world_string_t *name, fastly_compute_at_edge_object_store_handle_t *ret, fastly_compute_at_edge_object_store_error_t *err); -bool fastly_compute_at_edge_object_store_lookup(fastly_compute_at_edge_object_store_handle_t store, fastly_world_string_t *key, fastly_world_option_fastly_compute_at_edge_object_store_body_handle_t *ret, fastly_compute_at_edge_object_store_error_t *err); -bool fastly_compute_at_edge_object_store_lookup_async(fastly_compute_at_edge_object_store_handle_t store, fastly_world_string_t *key, fastly_compute_at_edge_object_store_pending_handle_t *ret, fastly_compute_at_edge_object_store_error_t *err); -bool fastly_compute_at_edge_object_store_pending_lookup_wait(fastly_compute_at_edge_object_store_pending_handle_t handle, fastly_world_option_fastly_compute_at_edge_object_store_body_handle_t *ret, fastly_compute_at_edge_object_store_error_t *err); -bool fastly_compute_at_edge_object_store_delete_async(fastly_compute_at_edge_object_store_handle_t store, fastly_world_string_t *key, fastly_compute_at_edge_object_store_pending_handle_t *ret, fastly_compute_at_edge_object_store_error_t *err); -bool fastly_compute_at_edge_object_store_pending_delete_wait(fastly_compute_at_edge_object_store_pending_handle_t handle, fastly_compute_at_edge_object_store_error_t *err); -bool fastly_compute_at_edge_object_store_insert(fastly_compute_at_edge_object_store_handle_t store, fastly_world_string_t *key, fastly_compute_at_edge_object_store_body_handle_t body_handle, fastly_compute_at_edge_object_store_error_t *err); +extern bool +fastly_compute_at_edge_object_store_open(fastly_world_string_t *name, + fastly_compute_at_edge_object_store_handle_t *ret, + fastly_compute_at_edge_object_store_error_t *err); +extern bool fastly_compute_at_edge_object_store_lookup( + fastly_compute_at_edge_object_store_handle_t store, fastly_world_string_t *key, + fastly_world_option_body_handle_t *ret, fastly_compute_at_edge_object_store_error_t *err); +extern bool fastly_compute_at_edge_object_store_lookup_async( + fastly_compute_at_edge_object_store_handle_t store, fastly_world_string_t *key, + fastly_compute_at_edge_object_store_pending_handle_t *ret, + fastly_compute_at_edge_object_store_error_t *err); +extern bool fastly_compute_at_edge_object_store_pending_lookup_wait( + fastly_compute_at_edge_object_store_pending_handle_t handle, + fastly_world_option_body_handle_t *ret, fastly_compute_at_edge_object_store_error_t *err); +extern bool fastly_compute_at_edge_object_store_delete_async( + fastly_compute_at_edge_object_store_handle_t store, fastly_world_string_t *key, + fastly_compute_at_edge_object_store_pending_handle_t *ret, + fastly_compute_at_edge_object_store_error_t *err); +extern bool fastly_compute_at_edge_object_store_pending_delete_wait( + fastly_compute_at_edge_object_store_pending_handle_t handle, + fastly_compute_at_edge_object_store_error_t *err); +// Should object store insert return "inserted" bool? +extern bool fastly_compute_at_edge_object_store_insert( + fastly_compute_at_edge_object_store_handle_t store, fastly_world_string_t *key, + fastly_compute_at_edge_object_store_body_handle_t body_handle, + fastly_compute_at_edge_object_store_error_t *err); // Imported Functions from `fastly:compute-at-edge/purge` -bool fastly_compute_at_edge_purge_surrogate_key(fastly_world_string_t *surrogate_keys, fastly_compute_at_edge_purge_options_mask_t purge_options, fastly_world_option_string_t *ret, fastly_compute_at_edge_purge_error_t *err); +// * +// * A surrogate key can be a max of 1024 characters. +// * A surrogate key must contain only printable ASCII characters (those between `0x21` and +// `0x7E`, inclusive). +// */ +extern bool fastly_compute_at_edge_purge_surrogate_key( + fastly_world_string_t *surrogate_keys, + fastly_compute_at_edge_purge_options_mask_t purge_options, fastly_world_option_string_t *ret, + fastly_compute_at_edge_purge_error_t *err); // Imported Functions from `fastly:compute-at-edge/secret-store` -bool fastly_compute_at_edge_secret_store_open(fastly_world_string_t *name, fastly_compute_at_edge_secret_store_store_handle_t *ret, fastly_compute_at_edge_secret_store_error_t *err); -bool fastly_compute_at_edge_secret_store_get(fastly_compute_at_edge_secret_store_store_handle_t store, fastly_world_string_t *key, fastly_world_option_fastly_compute_at_edge_secret_store_secret_handle_t *ret, fastly_compute_at_edge_secret_store_error_t *err); -bool fastly_compute_at_edge_secret_store_plaintext(fastly_compute_at_edge_secret_store_secret_handle_t secret, fastly_world_option_string_t *ret, fastly_compute_at_edge_secret_store_error_t *err); -bool fastly_compute_at_edge_secret_store_from_bytes(fastly_world_string_t *bytes, fastly_compute_at_edge_secret_store_secret_handle_t *ret, fastly_compute_at_edge_secret_store_error_t *err); +extern bool +fastly_compute_at_edge_secret_store_open(fastly_world_string_t *name, + fastly_compute_at_edge_secret_store_store_handle_t *ret, + fastly_compute_at_edge_secret_store_error_t *err); +extern bool fastly_compute_at_edge_secret_store_get( + fastly_compute_at_edge_secret_store_store_handle_t store, fastly_world_string_t *key, + fastly_world_option_secret_handle_t *ret, fastly_compute_at_edge_secret_store_error_t *err); +bool fastly_compute_at_edge_secret_store_plaintext( + fastly_compute_at_edge_secret_store_secret_handle_t secret, fastly_world_option_list_u8_t *ret, + fastly_compute_at_edge_secret_store_error_t *err); +extern bool fastly_compute_at_edge_secret_store_from_bytes( + fastly_world_list_u8_t *bytes, fastly_compute_at_edge_secret_store_secret_handle_t *ret, + fastly_compute_at_edge_secret_store_error_t *err); // Imported Functions from `fastly:compute-at-edge/uap` -bool fastly_compute_at_edge_uap_parse(fastly_world_string_t *user_agent, fastly_compute_at_edge_uap_user_agent_t *ret, fastly_compute_at_edge_uap_error_t *err); +extern bool fastly_compute_at_edge_uap_parse(fastly_world_string_t *user_agent, + fastly_compute_at_edge_uap_user_agent_t *ret, + fastly_compute_at_edge_uap_error_t *err); // Exported Functions from `fastly:compute-at-edge/reactor` -bool exports_fastly_compute_at_edge_reactor_serve(fastly_compute_at_edge_reactor_request_t *req); +bool exports_fastly_compute_at_edge_reactor_serve( + exports_fastly_compute_at_edge_reactor_request_t *req); #ifdef __cplusplus } diff --git a/runtime/js-compute-runtime/host_interface/component/fastly_world_adapter.cpp b/runtime/js-compute-runtime/host_interface/component/fastly_world_adapter.cpp index 15fc4083e7..9111ee3b28 100644 --- a/runtime/js-compute-runtime/host_interface/component/fastly_world_adapter.cpp +++ b/runtime/js-compute-runtime/host_interface/component/fastly_world_adapter.cpp @@ -8,9 +8,9 @@ #include "jsapi.h" #pragma clang diagnostic pop -#include "core/allocator.h" +#include "../../../StarlingMonkey/runtime/allocator.h" +#include "../fastly.h" #include "fastly_world.h" -#include "host_interface/fastly.h" // Ensure that all the things we want to use the hostcall buffer for actually // fit into the buffer. @@ -129,14 +129,16 @@ bool fastly_compute_at_edge_http_body_close(fastly_compute_at_edge_http_types_bo bool fastly_compute_at_edge_log_endpoint_get(fastly_world_string_t *name, fastly_compute_at_edge_log_handle_t *ret, fastly_compute_at_edge_types_error_t *err) { - return convert_result(fastly::log_endpoint_get(name->ptr, name->len, ret), err); + return convert_result( + fastly::log_endpoint_get(reinterpret_cast(name->ptr), name->len, ret), err); } bool fastly_compute_at_edge_log_write(fastly_compute_at_edge_log_handle_t h, fastly_world_string_t *msg, fastly_compute_at_edge_types_error_t *err) { size_t nwritten = 0; - return convert_result(fastly::log_write(h, msg->ptr, msg->len, &nwritten), err); + return convert_result( + fastly::log_write(h, reinterpret_cast(msg->ptr), msg->len, &nwritten), err); } bool fastly_http_req_body_downstream_get(fastly_compute_at_edge_http_types_request_t *ret, @@ -146,7 +148,9 @@ bool fastly_http_req_body_downstream_get(fastly_compute_at_edge_http_types_reque bool fastly_compute_at_edge_http_req_redirect_to_grip_proxy( fastly_world_string_t *backend, fastly_compute_at_edge_types_error_t *err) { - return convert_result(fastly::req_redirect_to_grip_proxy(backend->ptr, backend->len), err); + return convert_result( + fastly::req_redirect_to_grip_proxy(reinterpret_cast(backend->ptr), backend->len), + err); } int convert_tag(fastly_compute_at_edge_http_req_cache_override_tag_t tag) { @@ -181,8 +185,8 @@ bool fastly_compute_at_edge_http_req_cache_override_set( return convert_result( fastly::req_cache_override_v2_set( h, convert_tag(tag), maybe_ttl == NULL ? 0 : *maybe_ttl, - maybe_stale_while_revalidate == NULL ? 0 : *maybe_stale_while_revalidate, sk_str.ptr, - sk_str.len), + maybe_stale_while_revalidate == NULL ? 0 : *maybe_stale_while_revalidate, + reinterpret_cast(sk_str.ptr), sk_str.len), err); } @@ -202,11 +206,13 @@ bool fastly_compute_at_edge_http_req_downstream_client_ip_addr( bool fastly_compute_at_edge_http_req_downstream_tls_cipher_openssl_name( fastly_world_string_t *ret, fastly_compute_at_edge_types_error_t *err) { auto default_size = 128; - ret->ptr = static_cast(cabi_malloc(default_size, 4)); - auto status = fastly::req_downstream_tls_cipher_openssl_name(ret->ptr, default_size, &ret->len); + ret->ptr = static_cast(cabi_malloc(default_size, 4)); + auto status = fastly::req_downstream_tls_cipher_openssl_name(reinterpret_cast(ret->ptr), + default_size, &ret->len); if (status == FASTLY_COMPUTE_AT_EDGE_TYPES_ERROR_BUFFER_LEN) { cabi_realloc(ret->ptr, default_size, 4, ret->len); - status = fastly::req_downstream_tls_cipher_openssl_name(ret->ptr, ret->len, &ret->len); + status = fastly::req_downstream_tls_cipher_openssl_name(reinterpret_cast(ret->ptr), + ret->len, &ret->len); } return convert_result(status, err); } @@ -214,11 +220,13 @@ bool fastly_compute_at_edge_http_req_downstream_tls_cipher_openssl_name( bool fastly_compute_at_edge_http_req_downstream_tls_protocol( fastly_world_string_t *ret, fastly_compute_at_edge_types_error_t *err) { auto default_size = 32; - ret->ptr = static_cast(cabi_malloc(default_size, 4)); - auto status = fastly::req_downstream_tls_protocol(ret->ptr, default_size, &ret->len); + ret->ptr = static_cast(cabi_malloc(default_size, 4)); + auto status = fastly::req_downstream_tls_protocol(reinterpret_cast(ret->ptr), + default_size, &ret->len); if (status == FASTLY_COMPUTE_AT_EDGE_TYPES_ERROR_BUFFER_LEN) { cabi_realloc(ret->ptr, default_size, 4, ret->len); - status = fastly::req_downstream_tls_protocol(ret->ptr, ret->len, &ret->len); + status = fastly::req_downstream_tls_protocol(reinterpret_cast(ret->ptr), ret->len, + &ret->len); } return convert_result(status, err); } @@ -320,7 +328,7 @@ bool fastly_compute_at_edge_http_req_header_names_get( auto *next = ret->ptr; for (auto &chunk : header_names) { next->len = chunk.length; - next->ptr = chunk.buffer.release(); + next->ptr = reinterpret_cast(chunk.buffer.release()); ++next; } @@ -339,8 +347,9 @@ bool fastly_compute_at_edge_http_req_header_values_get( while (true) { int64_t ending_cursor = 0; size_t length = 0; - auto res = fastly::req_header_values_get(h, name->ptr, name->len, buffer.get(), - HEADER_MAX_LEN, cursor, &ending_cursor, &length); + auto res = fastly::req_header_values_get(h, reinterpret_cast(name->ptr), name->len, + buffer.get(), HEADER_MAX_LEN, cursor, &ending_cursor, + &length); if (!convert_result(res, err)) { return false; } @@ -394,52 +403,60 @@ bool fastly_compute_at_edge_http_req_framing_headers_mode_set( bool fastly_compute_at_edge_http_req_header_insert( fastly_compute_at_edge_http_types_request_handle_t h, fastly_world_string_t *name, fastly_world_list_u8_t *value, fastly_compute_at_edge_types_error_t *err) { - return convert_result(fastly::req_header_insert(h, name->ptr, name->len, value->ptr, value->len), + return convert_result(fastly::req_header_insert(h, reinterpret_cast(name->ptr), name->len, + value->ptr, value->len), err); } bool fastly_compute_at_edge_http_req_header_append( fastly_compute_at_edge_http_types_request_handle_t h, fastly_world_string_t *name, fastly_world_list_u8_t *value, fastly_compute_at_edge_types_error_t *err) { - return convert_result(fastly::req_header_append(h, name->ptr, name->len, value->ptr, value->len), + return convert_result(fastly::req_header_append(h, reinterpret_cast(name->ptr), name->len, + value->ptr, value->len), err); } bool fastly_compute_at_edge_http_req_header_remove( fastly_compute_at_edge_http_types_request_handle_t h, fastly_world_string_t *name, fastly_compute_at_edge_types_error_t *err) { - return convert_result(fastly::req_header_remove(h, name->ptr, name->len), err); + return convert_result( + fastly::req_header_remove(h, reinterpret_cast(name->ptr), name->len), err); } bool fastly_compute_at_edge_http_req_method_get( fastly_compute_at_edge_http_types_request_handle_t h, fastly_world_string_t *ret, fastly_compute_at_edge_types_error_t *err) { - ret->ptr = static_cast(cabi_malloc(METHOD_MAX_LEN, 1)); - return convert_result(fastly::req_method_get(h, ret->ptr, METHOD_MAX_LEN, &ret->len), err); + ret->ptr = static_cast(cabi_malloc(METHOD_MAX_LEN, 1)); + return convert_result( + fastly::req_method_get(h, reinterpret_cast(ret->ptr), METHOD_MAX_LEN, &ret->len), + err); } bool fastly_compute_at_edge_http_req_method_set( fastly_compute_at_edge_http_types_request_handle_t h, fastly_world_string_t *method, fastly_compute_at_edge_types_error_t *err) { - return convert_result(fastly::req_method_set(h, method->ptr, method->len), err); + return convert_result( + fastly::req_method_set(h, reinterpret_cast(method->ptr), method->len), err); } bool fastly_compute_at_edge_http_req_uri_get(fastly_compute_at_edge_http_types_request_handle_t h, fastly_world_string_t *ret, fastly_compute_at_edge_types_error_t *err) { - ret->ptr = static_cast(cabi_malloc(URI_MAX_LEN, 1)); - if (!convert_result(fastly::req_uri_get(h, ret->ptr, URI_MAX_LEN, &ret->len), err)) { + ret->ptr = static_cast(cabi_malloc(URI_MAX_LEN, 1)); + if (!convert_result( + fastly::req_uri_get(h, reinterpret_cast(ret->ptr), URI_MAX_LEN, &ret->len), + err)) { cabi_free(ret->ptr); return false; } - ret->ptr = static_cast(cabi_realloc(ret->ptr, URI_MAX_LEN, 1, ret->len)); + ret->ptr = static_cast(cabi_realloc(ret->ptr, URI_MAX_LEN, 1, ret->len)); return true; } bool fastly_compute_at_edge_http_req_uri_set(fastly_compute_at_edge_http_types_request_handle_t h, fastly_world_string_t *uri, fastly_compute_at_edge_types_error_t *err) { - return convert_result(fastly::req_uri_set(h, uri->ptr, uri->len), err); + return convert_result(fastly::req_uri_set(h, reinterpret_cast(uri->ptr), uri->len), err); } bool fastly_compute_at_edge_http_req_version_get( @@ -459,7 +476,8 @@ bool fastly_compute_at_edge_http_req_send_async( fastly_compute_at_edge_http_types_body_handle_t b, fastly_world_string_t *backend, fastly_compute_at_edge_http_types_pending_request_handle_t *ret, fastly_compute_at_edge_types_error_t *err) { - return convert_result(fastly::req_send_async(h, b, backend->ptr, backend->len, ret), err); + return convert_result( + fastly::req_send_async(h, b, reinterpret_cast(backend->ptr), backend->len, ret), err); } bool fastly_compute_at_edge_http_req_send_async_streaming( @@ -467,7 +485,8 @@ bool fastly_compute_at_edge_http_req_send_async_streaming( fastly_compute_at_edge_http_types_body_handle_t b, fastly_world_string_t *backend, fastly_compute_at_edge_http_types_pending_request_handle_t *ret, fastly_compute_at_edge_types_error_t *err) { - return convert_result(fastly::req_send_async_streaming(h, b, backend->ptr, backend->len, ret), + return convert_result(fastly::req_send_async_streaming( + h, b, reinterpret_cast(backend->ptr), backend->len, ret), err); } @@ -532,27 +551,33 @@ bool fastly_compute_at_edge_http_req_register_dynamic_backend( if (config->sni_hostname.is_some) { backend_config_mask |= BACKEND_CONFIG_SNI_HOSTNAME; } + if (config->client_cert.is_some) { + backend_config_mask |= BACKEND_CONFIG_CLIENT_CERT; + } fastly::DynamicBackendConfig backend_configuration{ - .host_override = config->host_override.val.ptr, + .host_override = reinterpret_cast(config->host_override.val.ptr), .host_override_len = config->host_override.val.len, .connect_timeout_ms = config->connect_timeout.val, .first_byte_timeout_ms = config->first_byte_timeout.val, .between_bytes_timeout_ms = config->between_bytes_timeout.val, .ssl_min_version = config->ssl_min_version.val, .ssl_max_version = config->ssl_max_version.val, - .cert_hostname = config->cert_hostname.val.ptr, + .cert_hostname = reinterpret_cast(config->cert_hostname.val.ptr), .cert_hostname_len = config->cert_hostname.val.len, - .ca_cert = config->ca_cert.val.ptr, + .ca_cert = reinterpret_cast(config->ca_cert.val.ptr), .ca_cert_len = config->ca_cert.val.len, - .ciphers = config->ciphers.val.ptr, + .ciphers = reinterpret_cast(config->ciphers.val.ptr), .ciphers_len = config->ciphers.val.len, - .sni_hostname = config->sni_hostname.val.ptr, + .sni_hostname = reinterpret_cast(config->sni_hostname.val.ptr), .sni_hostname_len = config->sni_hostname.val.len, - }; - return convert_result(fastly::req_register_dynamic_backend(prefix->ptr, prefix->len, target->ptr, - target->len, backend_config_mask, - &backend_configuration), - err); + .client_certificate = reinterpret_cast(config->client_cert.val.client_cert.ptr), + .client_certificate_len = config->client_cert.val.client_cert.len, + .client_key = config->client_cert.val.client_key}; + return convert_result( + fastly::req_register_dynamic_backend(reinterpret_cast(prefix->ptr), prefix->len, + reinterpret_cast(target->ptr), target->len, + backend_config_mask, &backend_configuration), + err); } bool fastly_compute_at_edge_http_resp_new(fastly_compute_at_edge_http_types_response_handle_t *ret, @@ -591,7 +616,7 @@ bool fastly_compute_at_edge_http_resp_header_names_get( (str_max + LIST_ALLOC_SIZE) * sizeof(fastly_world_string_t))); str_max += LIST_ALLOC_SIZE; } - strs[str_cnt].ptr = static_cast(cabi_malloc(i - offset + 1, 1)); + strs[str_cnt].ptr = static_cast(cabi_malloc(i - offset + 1, 1)); strs[str_cnt].len = i - offset; memcpy(strs[str_cnt].ptr, buf + offset, i - offset + 1); offset = i + 1; @@ -623,8 +648,9 @@ bool fastly_compute_at_edge_http_resp_header_values_get( uint32_t cursor = 0; int64_t next_cursor = 0; while (true) { - if (!convert_result(fastly::resp_header_values_get(h, name->ptr, name->len, buf, HEADER_MAX_LEN, - cursor, &next_cursor, &nwritten), + if (!convert_result(fastly::resp_header_values_get(h, reinterpret_cast(name->ptr), + name->len, buf, HEADER_MAX_LEN, cursor, + &next_cursor, &nwritten), err)) { cabi_free(buf); return false; @@ -669,21 +695,24 @@ bool fastly_compute_at_edge_http_resp_header_values_get( bool fastly_compute_at_edge_http_resp_header_insert( fastly_compute_at_edge_http_types_response_handle_t h, fastly_world_string_t *name, fastly_world_list_u8_t *value, fastly_compute_at_edge_types_error_t *err) { - return convert_result(fastly::resp_header_insert(h, name->ptr, name->len, value->ptr, value->len), + return convert_result(fastly::resp_header_insert(h, reinterpret_cast(name->ptr), + name->len, value->ptr, value->len), err); } bool fastly_compute_at_edge_http_resp_header_append( fastly_compute_at_edge_http_types_response_handle_t h, fastly_world_string_t *name, fastly_world_list_u8_t *value, fastly_compute_at_edge_types_error_t *err) { - return convert_result(fastly::resp_header_append(h, name->ptr, name->len, value->ptr, value->len), + return convert_result(fastly::resp_header_append(h, reinterpret_cast(name->ptr), + name->len, value->ptr, value->len), err); } bool fastly_compute_at_edge_http_resp_header_remove( fastly_compute_at_edge_http_types_response_handle_t h, fastly_world_string_t *name, fastly_compute_at_edge_types_error_t *err) { - return convert_result(fastly::resp_header_remove(h, name->ptr, name->len), err); + return convert_result( + fastly::resp_header_remove(h, reinterpret_cast(name->ptr), name->len), err); } bool fastly_compute_at_edge_http_resp_version_get( @@ -729,15 +758,17 @@ bool fastly_compute_at_edge_http_resp_status_set( bool fastly_compute_at_edge_dictionary_open(fastly_world_string_t *name, fastly_compute_at_edge_dictionary_handle_t *ret, fastly_compute_at_edge_types_error_t *err) { - return convert_result(fastly::dictionary_open(name->ptr, name->len, ret), err); + return convert_result( + fastly::dictionary_open(reinterpret_cast(name->ptr), name->len, ret), err); } bool fastly_compute_at_edge_dictionary_get(fastly_compute_at_edge_dictionary_handle_t h, fastly_world_string_t *key, fastly_world_option_string_t *ret, fastly_compute_at_edge_types_error_t *err) { - ret->val.ptr = static_cast(cabi_malloc(DICTIONARY_ENTRY_MAX_LEN, 1)); - if (!convert_result(fastly::dictionary_get(h, key->ptr, key->len, ret->val.ptr, + ret->val.ptr = static_cast(cabi_malloc(DICTIONARY_ENTRY_MAX_LEN, 1)); + if (!convert_result(fastly::dictionary_get(h, reinterpret_cast(key->ptr), key->len, + reinterpret_cast(ret->val.ptr), DICTIONARY_ENTRY_MAX_LEN, &ret->val.len), err)) { if (*err == FASTLY_COMPUTE_AT_EDGE_TYPES_ERROR_OPTIONAL_NONE) { @@ -750,22 +781,24 @@ bool fastly_compute_at_edge_dictionary_get(fastly_compute_at_edge_dictionary_han } ret->is_some = true; ret->val.ptr = - static_cast(cabi_realloc(ret->val.ptr, DICTIONARY_ENTRY_MAX_LEN, 1, ret->val.len)); + static_cast(cabi_realloc(ret->val.ptr, DICTIONARY_ENTRY_MAX_LEN, 1, ret->val.len)); return true; } bool fastly_compute_at_edge_secret_store_open( fastly_world_string_t *name, fastly_compute_at_edge_secret_store_store_handle_t *ret, fastly_compute_at_edge_types_error_t *err) { - return convert_result(fastly::secret_store_open(name->ptr, name->len, ret), err); + return convert_result( + fastly::secret_store_open(reinterpret_cast(name->ptr), name->len, ret), err); } bool fastly_compute_at_edge_secret_store_get( fastly_compute_at_edge_secret_store_store_handle_t store, fastly_world_string_t *key, - fastly_world_option_fastly_compute_at_edge_secret_store_secret_handle_t *ret, - fastly_compute_at_edge_types_error_t *err) { + fastly_world_option_secret_handle_t *ret, fastly_compute_at_edge_types_error_t *err) { ret->val = INVALID_HANDLE; - bool ok = convert_result(fastly::secret_store_get(store, key->ptr, key->len, &ret->val), err); + bool ok = convert_result( + fastly::secret_store_get(store, reinterpret_cast(key->ptr), key->len, &ret->val), + err); if ((!ok && *err == FASTLY_COMPUTE_AT_EDGE_TYPES_ERROR_OPTIONAL_NONE) || ret->val == INVALID_HANDLE) { ret->is_some = false; @@ -776,12 +809,12 @@ bool fastly_compute_at_edge_secret_store_get( } bool fastly_compute_at_edge_secret_store_plaintext( - fastly_compute_at_edge_secret_store_secret_handle_t h, fastly_world_option_string_t *ret, - fastly_compute_at_edge_types_error_t *err) { - ret->val.ptr = static_cast(JS_malloc(CONTEXT, DICTIONARY_ENTRY_MAX_LEN)); - if (!convert_result( - fastly::secret_store_plaintext(h, ret->val.ptr, DICTIONARY_ENTRY_MAX_LEN, &ret->val.len), - err)) { + fastly_compute_at_edge_secret_store_secret_handle_t h, fastly_world_option_list_u8_t *ret, + fastly_compute_at_edge_secret_store_error_t *err) { + ret->val.ptr = static_cast(JS_malloc(CONTEXT, DICTIONARY_ENTRY_MAX_LEN)); + if (!convert_result(fastly::secret_store_plaintext(h, reinterpret_cast(ret->val.ptr), + DICTIONARY_ENTRY_MAX_LEN, &ret->val.len), + err)) { if (*err == FASTLY_COMPUTE_AT_EDGE_TYPES_ERROR_OPTIONAL_NONE) { ret->is_some = false; return true; @@ -791,37 +824,53 @@ bool fastly_compute_at_edge_secret_store_plaintext( } } ret->is_some = true; - ret->val.ptr = static_cast( + ret->val.ptr = static_cast( JS_realloc(CONTEXT, ret->val.ptr, DICTIONARY_ENTRY_MAX_LEN, ret->val.len)); return true; } +bool fastly_compute_at_edge_secret_store_from_bytes( + fastly_world_list_u8_t *bytes, fastly_compute_at_edge_secret_store_secret_handle_t *ret, + fastly_compute_at_edge_secret_store_error_t *err) { + *ret = INVALID_HANDLE; + bool ok = convert_result( + fastly::secret_store_from_bytes(reinterpret_cast(bytes->ptr), bytes->len, ret), err); + if (!ok || *ret == INVALID_HANDLE) { + return false; + } + return true; +} + bool fastly_compute_at_edge_geo_lookup(fastly_world_list_u8_t *addr_octets, fastly_world_string_t *ret, fastly_compute_at_edge_types_error_t *err) { - ret->ptr = static_cast(cabi_malloc(HOSTCALL_BUFFER_LEN, 1)); - if (!convert_result(fastly::geo_lookup(addr_octets->ptr, addr_octets->len, ret->ptr, - HOSTCALL_BUFFER_LEN, &ret->len), + ret->ptr = static_cast(cabi_malloc(HOSTCALL_BUFFER_LEN, 1)); + if (!convert_result(fastly::geo_lookup(addr_octets->ptr, addr_octets->len, + reinterpret_cast(ret->ptr), HOSTCALL_BUFFER_LEN, + &ret->len), err)) { cabi_free(ret->ptr); return false; } - ret->ptr = static_cast(cabi_realloc(ret->ptr, HOSTCALL_BUFFER_LEN, 1, ret->len)); + ret->ptr = static_cast(cabi_realloc(ret->ptr, HOSTCALL_BUFFER_LEN, 1, ret->len)); return true; } bool fastly_compute_at_edge_object_store_open(fastly_world_string_t *name, fastly_compute_at_edge_object_store_handle_t *ret, fastly_compute_at_edge_types_error_t *err) { - return convert_result(fastly::object_store_open(name->ptr, name->len, ret), err); + return convert_result( + fastly::object_store_open(reinterpret_cast(name->ptr), name->len, ret), err); } -bool fastly_compute_at_edge_object_store_lookup( - fastly_compute_at_edge_object_store_handle_t store, fastly_world_string_t *key, - fastly_world_option_fastly_compute_at_edge_object_store_body_handle_t *ret, - fastly_compute_at_edge_types_error_t *err) { +bool fastly_compute_at_edge_object_store_lookup(fastly_compute_at_edge_object_store_handle_t store, + fastly_world_string_t *key, + fastly_world_option_body_handle_t *ret, + fastly_compute_at_edge_types_error_t *err) { ret->val = INVALID_HANDLE; - bool ok = convert_result(fastly::object_store_get(store, key->ptr, key->len, &ret->val), err); + bool ok = convert_result( + fastly::object_store_get(store, reinterpret_cast(key->ptr), key->len, &ret->val), + err); if ((!ok && *err == FASTLY_COMPUTE_AT_EDGE_TYPES_ERROR_OPTIONAL_NONE) || ret->val == INVALID_HANDLE) { ret->is_some = false; @@ -835,12 +884,13 @@ bool fastly_compute_at_edge_object_store_lookup_async( fastly_compute_at_edge_object_store_handle_t store, fastly_world_string_t *key, fastly_compute_at_edge_object_store_pending_handle_t *ret, fastly_compute_at_edge_object_store_error_t *err) { - return convert_result(fastly::object_store_get_async(store, key->ptr, key->len, ret), err); + return convert_result( + fastly::object_store_get_async(store, reinterpret_cast(key->ptr), key->len, ret), + err); } bool fastly_compute_at_edge_object_store_pending_lookup_wait( - fastly_compute_at_edge_object_store_pending_handle_t h, - fastly_world_option_fastly_compute_at_edge_object_store_body_handle_t *ret, + fastly_compute_at_edge_object_store_pending_handle_t h, fastly_world_option_body_handle_t *ret, fastly_compute_at_edge_object_store_error_t *err) { ret->val = INVALID_HANDLE; bool ok = convert_result(fastly::object_store_pending_lookup_wait(h, &ret->val), err); @@ -857,7 +907,9 @@ bool fastly_compute_at_edge_object_store_delete_async( fastly_compute_at_edge_object_store_handle_t store, fastly_world_string_t *key, fastly_compute_at_edge_object_store_pending_handle_t *ret, fastly_compute_at_edge_object_store_error_t *err) { - return convert_result(fastly::object_store_delete_async(store, key->ptr, key->len, ret), err); + return convert_result( + fastly::object_store_delete_async(store, reinterpret_cast(key->ptr), key->len, ret), + err); } bool fastly_compute_at_edge_object_store_pending_delete_wait( @@ -870,12 +922,14 @@ bool fastly_compute_at_edge_object_store_insert( fastly_compute_at_edge_object_store_handle_t store, fastly_world_string_t *key, fastly_compute_at_edge_http_types_body_handle_t body_handle, fastly_compute_at_edge_types_error_t *err) { - return convert_result(fastly::object_store_insert(store, key->ptr, key->len, body_handle), err); + return convert_result( + fastly::object_store_insert(store, reinterpret_cast(key->ptr), key->len, body_handle), + err); } -bool fastly_compute_at_edge_async_io_select( - fastly_world_list_fastly_compute_at_edge_async_io_handle_t *hs, uint32_t timeout_ms, - fastly_world_option_u32_t *ret, fastly_compute_at_edge_types_error_t *err) { +bool fastly_compute_at_edge_async_io_select(fastly_world_list_handle_t *hs, uint32_t timeout_ms, + fastly_world_option_u32_t *ret, + fastly_compute_at_edge_types_error_t *err) { if (!convert_result(fastly::async_select(hs->ptr, hs->len, timeout_ms, &ret->val), err)) { if (*err == FASTLY_COMPUTE_AT_EDGE_TYPES_ERROR_OPTIONAL_NONE) { ret->is_some = false; @@ -914,9 +968,9 @@ bool fastly_compute_at_edge_purge_surrogate_key( ret->is_some = false; - return convert_result( - fastly::purge_surrogate_key(surrogate_key->ptr, surrogate_key->len, options_mask, &options), - err); + return convert_result(fastly::purge_surrogate_key(reinterpret_cast(surrogate_key->ptr), + surrogate_key->len, options_mask, &options), + err); } #define FASTLY_CACHE_LOOKUP_OPTIONS_MASK_RESERVED (1 << 0) @@ -930,8 +984,9 @@ bool fastly_compute_at_edge_cache_lookup(fastly_world_string_t *cache_key, if (options->request_headers.is_some) { options_mask |= FASTLY_CACHE_LOOKUP_OPTIONS_MASK_REQUEST_HEADERS; } - return convert_result( - fastly::cache_lookup(cache_key->ptr, cache_key->len, options_mask, options, ret), err); + return convert_result(fastly::cache_lookup(reinterpret_cast(cache_key->ptr), + cache_key->len, options_mask, options, ret), + err); } #define FASTLY_CACHE_WRITE_OPTIONS_MASK_RESERVED (1 << 0) @@ -987,8 +1042,9 @@ bool fastly_compute_at_edge_cache_insert(fastly_world_string_t *cache_key, if (options->sensitive_data) { options_mask |= FASTLY_CACHE_WRITE_OPTIONS_MASK_SENSITIVE_DATA; } - return convert_result( - fastly::cache_insert(cache_key->ptr, cache_key->len, options_mask, &opts, ret), err); + return convert_result(fastly::cache_insert(reinterpret_cast(cache_key->ptr), + cache_key->len, options_mask, &opts, ret), + err); } bool fastly_compute_at_edge_cache_transaction_insert( @@ -1102,16 +1158,15 @@ bool fastly_compute_at_edge_cache_transaction_lookup( if (options->request_headers.is_some) { options_mask |= FASTLY_CACHE_LOOKUP_OPTIONS_MASK_REQUEST_HEADERS; } - return convert_result( - fastly::cache_transaction_lookup(cache_key->ptr, cache_key->len, options_mask, options, ret), - err); + return convert_result(fastly::cache_transaction_lookup(reinterpret_cast(cache_key->ptr), + cache_key->len, options_mask, options, + ret), + err); } bool fastly_compute_at_edge_cache_transaction_insert_and_stream_back( fastly_compute_at_edge_cache_handle_t handle, fastly_compute_at_edge_cache_write_options_t *options, - fastly_world_tuple2_fastly_compute_at_edge_cache_body_handle_fastly_compute_at_edge_cache_handle_t - *ret, - fastly_compute_at_edge_types_error_t *err) { + fastly_world_tuple2_body_handle_handle_t *ret, fastly_compute_at_edge_types_error_t *err) { uint16_t options_mask = 0; fastly::CacheWriteOptions opts; std::memset(&opts, 0, sizeof(opts)); @@ -1226,7 +1281,9 @@ bool fastly_compute_at_edge_cache_get_hits(fastly_compute_at_edge_cache_handle_t bool fastly_compute_at_edge_backend_exists(fastly_world_string_t *backend, bool *ret, fastly_compute_at_edge_types_error_t *err) { uint32_t ret_int; - if (!convert_result(fastly::backend_exists(backend->ptr, backend->len, &ret_int), err)) { + if (!convert_result( + fastly::backend_exists(reinterpret_cast(backend->ptr), backend->len, &ret_int), + err)) { return false; } *ret = (bool)ret_int; @@ -1252,7 +1309,7 @@ bool fastly_compute_at_edge_backend_is_healthy(fastly_world_string_t *backend, fastly_compute_at_edge_types_error_t *err) { fastly::BACKEND_HEALTH fastly_backend_health; if (!convert_result( - fastly::backend_is_healthy(backend->ptr, backend->len, + fastly::backend_is_healthy(reinterpret_cast(backend->ptr), backend->len, reinterpret_cast(&fastly_backend_health)), err)) { return false; @@ -1265,67 +1322,75 @@ bool fastly_compute_at_edge_edge_rate_limiter_check_rate( fastly_world_string_t *rate_counter_name, fastly_world_string_t *entry, uint32_t delta, uint32_t window, uint32_t limit, fastly_world_string_t *penalty_box_name, uint32_t time_to_live, bool *ret, fastly_compute_at_edge_edge_rate_limiter_error_t *err) { - return convert_result(fastly::check_rate(rate_counter_name->ptr, rate_counter_name->len, - entry->ptr, entry->len, delta, window, limit, - penalty_box_name->ptr, penalty_box_name->len, - time_to_live, ret), - err); + return convert_result( + fastly::check_rate(reinterpret_cast(rate_counter_name->ptr), rate_counter_name->len, + reinterpret_cast(entry->ptr), entry->len, delta, window, limit, + reinterpret_cast(penalty_box_name->ptr), penalty_box_name->len, + time_to_live, ret), + err); } bool fastly_compute_at_edge_edge_rate_limiter_ratecounter_increment( fastly_world_string_t *rate_counter_name, fastly_world_string_t *entry, uint32_t delta, fastly_compute_at_edge_edge_rate_limiter_error_t *err) { - return convert_result(fastly::ratecounter_increment(rate_counter_name->ptr, - rate_counter_name->len, entry->ptr, - entry->len, delta), - err); + return convert_result( + fastly::ratecounter_increment(reinterpret_cast(rate_counter_name->ptr), + rate_counter_name->len, reinterpret_cast(entry->ptr), + entry->len, delta), + err); } bool fastly_compute_at_edge_edge_rate_limiter_ratecounter_lookup_rate( fastly_world_string_t *rate_counter_name, fastly_world_string_t *entry, uint32_t window, uint32_t *ret, fastly_compute_at_edge_edge_rate_limiter_error_t *err) { - return convert_result(fastly::ratecounter_lookup_rate(rate_counter_name->ptr, - rate_counter_name->len, entry->ptr, - entry->len, window, ret), - err); + return convert_result( + fastly::ratecounter_lookup_rate(reinterpret_cast(rate_counter_name->ptr), + rate_counter_name->len, reinterpret_cast(entry->ptr), + entry->len, window, ret), + err); } bool fastly_compute_at_edge_edge_rate_limiter_ratecounter_lookup_count( fastly_world_string_t *rate_counter_name, fastly_world_string_t *entry, uint32_t duration, uint32_t *ret, fastly_compute_at_edge_edge_rate_limiter_error_t *err) { - return convert_result(fastly::ratecounter_lookup_count(rate_counter_name->ptr, - rate_counter_name->len, entry->ptr, - entry->len, duration, ret), - err); + return convert_result( + fastly::ratecounter_lookup_count(reinterpret_cast(rate_counter_name->ptr), + rate_counter_name->len, reinterpret_cast(entry->ptr), + entry->len, duration, ret), + err); } bool fastly_compute_at_edge_edge_rate_limiter_penaltybox_add( fastly_world_string_t *penalty_box_name, fastly_world_string_t *entry, uint32_t time_to_live, fastly_compute_at_edge_edge_rate_limiter_error_t *err) { - return convert_result(fastly::penaltybox_add(penalty_box_name->ptr, penalty_box_name->len, - entry->ptr, entry->len, time_to_live), - err); + return convert_result( + fastly::penaltybox_add(reinterpret_cast(penalty_box_name->ptr), penalty_box_name->len, + reinterpret_cast(entry->ptr), entry->len, time_to_live), + err); } bool fastly_compute_at_edge_edge_rate_limiter_penaltybox_has( fastly_world_string_t *penalty_box_name, fastly_world_string_t *entry, bool *ret, fastly_compute_at_edge_edge_rate_limiter_error_t *err) { - return convert_result(fastly::penaltybox_has(penalty_box_name->ptr, penalty_box_name->len, - entry->ptr, entry->len, ret), - err); + return convert_result( + fastly::penaltybox_has(reinterpret_cast(penalty_box_name->ptr), penalty_box_name->len, + reinterpret_cast(entry->ptr), entry->len, ret), + err); } bool fastly_compute_at_edge_device_detection_lookup( fastly_world_string_t *user_agent, fastly_world_string_t *ret, fastly_compute_at_edge_device_detection_error_t *err) { auto default_size = 1024; - ret->ptr = static_cast(cabi_malloc(default_size, 4)); - auto status = fastly::device_detection_lookup(user_agent->ptr, user_agent->len, ret->ptr, - default_size, &ret->len); + ret->ptr = static_cast(cabi_malloc(default_size, 4)); + auto status = + fastly::device_detection_lookup(reinterpret_cast(user_agent->ptr), user_agent->len, + reinterpret_cast(ret->ptr), default_size, &ret->len); if (status == FASTLY_COMPUTE_AT_EDGE_TYPES_ERROR_BUFFER_LEN) { cabi_realloc(ret->ptr, default_size, 4, ret->len); - status = fastly::device_detection_lookup(user_agent->ptr, user_agent->len, ret->ptr, ret->len, - &ret->len); + status = + fastly::device_detection_lookup(reinterpret_cast(user_agent->ptr), user_agent->len, + reinterpret_cast(ret->ptr), ret->len, &ret->len); } return convert_result(status, err); } \ No newline at end of file diff --git a/runtime/js-compute-runtime/host_interface/component/fastly_world_component_type.o b/runtime/js-compute-runtime/host_interface/component/fastly_world_component_type.o index 2866bde41c..fa524f65e4 100644 Binary files a/runtime/js-compute-runtime/host_interface/component/fastly_world_component_type.o and b/runtime/js-compute-runtime/host_interface/component/fastly_world_component_type.o differ diff --git a/runtime/js-compute-runtime/host_interface/fastly.h b/runtime/js-compute-runtime/host_interface/fastly.h index 2f783b611a..90b19c7688 100644 --- a/runtime/js-compute-runtime/host_interface/fastly.h +++ b/runtime/js-compute-runtime/host_interface/fastly.h @@ -8,7 +8,7 @@ extern "C" { #include #include -#include "host_interface/component/fastly_world.h" +#include "./component/fastly_world.h" namespace fastly { @@ -66,6 +66,9 @@ typedef struct DynamicBackendConfig { uint32_t ciphers_len; const char *sni_hostname; uint32_t sni_hostname_len; + const char *client_certificate; + uint32_t client_certificate_len; + fastly_compute_at_edge_secret_store_secret_handle_t client_key; } DynamicBackendConfig; #define INVALID_HANDLE (UINT32_MAX - 1) @@ -363,6 +366,11 @@ WASM_IMPORT("fastly_secret_store", "plaintext") int secret_store_plaintext(fastly_compute_at_edge_secret_store_secret_handle_t secret_handle, char *buf, size_t buf_len, size_t *nwritten); +WASM_IMPORT("fastly_secret_store", "from_bytes") +int secret_store_from_bytes( + char *buf, size_t buf_len, + fastly_compute_at_edge_secret_store_secret_handle_t *opt_secret_handle_out); + // Module fastly_object_store WASM_IMPORT("fastly_object_store", "open") int object_store_open(const char *name, size_t name_len, diff --git a/runtime/js-compute-runtime/host_interface/host_api.cpp b/runtime/js-compute-runtime/host_interface/host_api.cpp index 3d89baf197..f65b532c43 100644 --- a/runtime/js-compute-runtime/host_interface/host_api.cpp +++ b/runtime/js-compute-runtime/host_interface/host_api.cpp @@ -21,7 +21,7 @@ fastly_world_list_u8_t span_to_list_u8(std::span span) { fastly_world_string_t string_view_to_world_string(std::string_view str) { return { - .ptr = const_cast(str.data()), + .ptr = const_cast(reinterpret_cast(str.data())), .len = str.size(), }; } @@ -86,10 +86,9 @@ Result> AsyncHandle::select(const std::vector> res; static_assert(sizeof(AsyncHandle) == sizeof(fastly_compute_at_edge_async_io_handle_t)); - fastly_world_list_fastly_compute_at_edge_async_io_handle_t hs{ - .ptr = reinterpret_cast( - const_cast(handles.data())), - .len = handles.size()}; + fastly_world_list_handle_t hs{.ptr = reinterpret_cast( + const_cast(handles.data())), + .len = handles.size()}; fastly_world_option_u32_t ret; fastly_compute_at_edge_types_error_t err; if (!fastly_compute_at_edge_async_io_select(&hs, timeout_ms, &ret, &err)) { @@ -439,7 +438,7 @@ Result> HttpPendingReq::poll() { Result> res; fastly_compute_at_edge_types_error_t err; - fastly_world_option_fastly_compute_at_edge_http_req_response_t ret; + fastly_world_option_response_t ret; if (!fastly_compute_at_edge_http_req_pending_req_poll(this->handle, &ret, &err)) { res.emplace_err(err); } else if (ret.is_some) { @@ -625,6 +624,12 @@ Result HttpReq::register_dynamic_backend(std::string_view name, std::strin backend_config.sni_hostname.val = string_view_to_world_string(*val); } + if (auto &val = config.client_cert) { + backend_config.client_cert.is_some = true; + backend_config.client_cert.val.client_cert = string_view_to_world_string(val->cert); + backend_config.client_cert.val.client_key = val->key.handle; + } + auto name_str = string_view_to_world_string(name); auto target_str = string_view_to_world_string(target); fastly_compute_at_edge_types_error_t err; @@ -1135,7 +1140,7 @@ Result> ObjectStore::lookup(std::string_view name) { Result> res; auto name_str = string_view_to_world_string(name); - fastly_world_option_fastly_compute_at_edge_object_store_body_handle_t ret; + fastly_world_option_body_handle_t ret; fastly_compute_at_edge_types_error_t err; if (!fastly_compute_at_edge_object_store_lookup(this->handle, &name_str, &ret, &err)) { res.emplace_err(err); @@ -1196,7 +1201,7 @@ Result, FastlyError> ObjectStorePendingLookup::wait() { Result, FastlyError> res; fastly_compute_at_edge_types_error_t err; - fastly_world_option_fastly_compute_at_edge_object_store_body_handle_t ret; + fastly_world_option_body_handle_t ret; if (!fastly_compute_at_edge_object_store_pending_lookup_wait(this->handle, &ret, &err)) { res.emplace_err(err); } else if (ret.is_some) { @@ -1229,15 +1234,15 @@ static_assert(std::is_same_v); -Result> Secret::plaintext() const { - Result> res; +Result> Secret::plaintext() const { + Result> res; - fastly_world_option_string_t ret; + fastly_world_option_list_u8_t ret; fastly_compute_at_edge_types_error_t err; if (!fastly_compute_at_edge_secret_store_plaintext(this->handle, &ret, &err)) { res.emplace_err(err); } else if (ret.is_some) { - res.emplace(make_host_string(ret.val)); + res.emplace(make_host_bytes(ret.val)); } else { res.emplace(std::nullopt); } @@ -1264,7 +1269,7 @@ Result> SecretStore::get(std::string_view name) { Result> res; auto name_str = string_view_to_world_string(name); - fastly_world_option_fastly_compute_at_edge_secret_store_secret_handle_t ret; + fastly_world_option_secret_handle_t ret; fastly_compute_at_edge_types_error_t err; if (!fastly_compute_at_edge_secret_store_get(this->handle, &name_str, &ret, &err)) { res.emplace_err(err); @@ -1307,6 +1312,21 @@ Result Random::get_u32() { return res; } +Result SecretStore::from_bytes(uint8_t *bytes, size_t len) { + Result res; + + fastly_world_list_u8_t bytes_list{const_cast(bytes), len}; + fastly_compute_at_edge_secret_store_secret_handle_t ret; + fastly_compute_at_edge_types_error_t err; + if (!fastly_compute_at_edge_secret_store_from_bytes(&bytes_list, &ret, &err)) { + res.emplace_err(err); + } else { + res.emplace(ret); + } + + return res; +} + bool CacheState::is_found() const { return this->state & FASTLY_COMPUTE_AT_EDGE_CACHE_LOOKUP_STATE_FOUND; } @@ -1471,8 +1491,7 @@ CacheHandle::transaction_insert_and_stream_back(const CacheWriteOptions &opts) { init_write_options(options, opts); fastly_compute_at_edge_types_error_t err; - fastly_world_tuple2_fastly_compute_at_edge_cache_body_handle_fastly_compute_at_edge_cache_handle_t - ret; + fastly_world_tuple2_body_handle_handle_t ret; if (!fastly_compute_at_edge_cache_transaction_insert_and_stream_back(this->handle, &options, &ret, &err)) { res.emplace_err(err); diff --git a/runtime/js-compute-runtime/host_interface/host_api.h b/runtime/js-compute-runtime/host_interface/host_api.h index f45f698726..41af8b6e7a 100644 --- a/runtime/js-compute-runtime/host_interface/host_api.h +++ b/runtime/js-compute-runtime/host_interface/host_api.h @@ -389,6 +389,39 @@ struct TlsVersion { static TlsVersion version_1_3(); }; +class Secret final { +public: + using Handle = uint32_t; + + Handle handle = UINT32_MAX - 1; + + Secret() = default; + explicit Secret(Handle handle) : handle{handle} {} + + Result> plaintext() const; +}; + +class SecretStore final { +public: + using Handle = uint32_t; + + Handle handle = UINT32_MAX - 1; + + SecretStore() = default; + explicit SecretStore(Handle handle) : handle{handle} {} + + static Result open(std::string_view name); + + Result> get(std::string_view name); + + static Result from_bytes(uint8_t *bytes, size_t len); +}; + +struct ClientCert { + HostString cert; + Secret key; +}; + struct BackendConfig { std::optional host_override; std::optional connect_timeout; @@ -402,6 +435,7 @@ struct BackendConfig { std::optional ca_cert; std::optional ciphers; std::optional sni_hostname; + std::optional client_cert; }; struct CacheOverrideTag final { @@ -644,32 +678,6 @@ class ObjectStorePendingDelete final { AsyncHandle async_handle() const; }; -class Secret final { -public: - using Handle = uint32_t; - - Handle handle = UINT32_MAX - 1; - - Secret() = default; - explicit Secret(Handle handle) : handle{handle} {} - - Result> plaintext() const; -}; - -class SecretStore final { -public: - using Handle = uint32_t; - - Handle handle = UINT32_MAX - 1; - - SecretStore() = default; - explicit SecretStore(Handle handle) : handle{handle} {} - - static Result open(std::string_view name); - - Result> get(std::string_view name); -}; - class Random final { public: static Result get_bytes(size_t num_bytes); diff --git a/runtime/js-compute-runtime/host_interface/wit/deps/fastly/compute-at-edge.wit b/runtime/js-compute-runtime/host_interface/wit/deps/fastly/compute-at-edge.wit index 8ef41bdbf1..a8aeb609b4 100644 --- a/runtime/js-compute-runtime/host_interface/wit/deps/fastly/compute-at-edge.wit +++ b/runtime/js-compute-runtime/host_interface/wit/deps/fastly/compute-at-edge.wit @@ -1,4 +1,4 @@ -package fastly:compute-at-edge +package fastly:compute-at-edge; interface types { // TODO: split this up into function-specific error enums @@ -51,20 +51,20 @@ interface types { limit-exceeded } - type secret-handle = u32 + type secret-handle = u32; } interface http-types { - use types.{secret-handle} + use types.{secret-handle}; - type body-handle = u32 + type body-handle = u32; - type request-handle = u32 - type pending-request-handle = u32 - type response-handle = u32 - type request = tuple - type response = tuple + type request-handle = u32; + type pending-request-handle = u32; + type response-handle = u32; + type request = tuple; + type response = tuple; enum send-error-detail-tag { /// The send-error-detail struct has not been populated. @@ -198,7 +198,7 @@ interface http-types { client-cert: option, } - type http-status = u16 + type http-status = u16; } /* @@ -206,7 +206,7 @@ interface http-types { */ interface uap { - use types.{error} + use types.{error}; record user-agent { family: string, @@ -215,7 +215,7 @@ interface uap { patch: string } - parse: func(user-agent: string) -> result + parse: func(user-agent: string) -> result; } /* @@ -223,23 +223,23 @@ interface uap { */ interface http-body { - use types.{error} - use http-types.{body-handle} + use types.{error}; + use http-types.{body-handle}; enum write-end { back, front } - append: func(dest: body-handle, src: body-handle) -> result<_, error> + append: func(dest: body-handle, src: body-handle) -> result<_, error>; - new: func() -> result + new: func() -> result; - read: func(h: body-handle, chunk-size: u32) -> result, error> + read: func(h: body-handle, chunk-size: u32) -> result, error>; - write: func(h: body-handle, buf: list, end: write-end) -> result + write: func(h: body-handle, buf: list, end: write-end) -> result; - close: func(h: body-handle) -> result<_, error> + close: func(h: body-handle) -> result<_, error>; } /* @@ -247,13 +247,13 @@ interface http-body { */ interface log { - use types.{error} + use types.{error}; - type handle = u32 + type handle = u32; - endpoint-get: func(name: string) -> result + endpoint-get: func(name: string) -> result; - write: func(h: handle, msg: string) -> result<_, error> + write: func(h: handle, msg: string) -> result<_, error>; } /* @@ -261,11 +261,11 @@ interface log { */ interface http-req { - use types.{error} + use types.{error}; use http-types.{ body-handle, request-handle, http-version, response, pending-request-handle, content-encodings, framing-headers-mode, dynamic-backend-config, send-error-detail - } + }; flags cache-override-tag { /// Do not cache the response to this request, regardless of the origin response's headers. @@ -275,95 +275,95 @@ interface http-req { pci, } - cache-override-set: func(h: request-handle, tag: cache-override-tag, ttl: option, stale-while-revalidate: option, sk: option) -> result<_, error> + cache-override-set: func(h: request-handle, tag: cache-override-tag, ttl: option, stale-while-revalidate: option, sk: option) -> result<_, error>; - downstream-client-ip-addr: func() -> result, error> + downstream-client-ip-addr: func() -> result, error>; - downstream-client-request-id: func() -> result + downstream-client-request-id: func() -> result; - downstream-client-h2-fingerprint: func() -> result, error> + downstream-client-h2-fingerprint: func() -> result, error>; - downstream-tls-cipher-openssl-name: func() -> result + downstream-tls-cipher-openssl-name: func() -> result; - downstream-tls-protocol: func() -> result + downstream-tls-protocol: func() -> result; - downstream-tls-client-hello: func() -> result, error> + downstream-tls-client-hello: func() -> result, error>; - downstream-tls-raw-client-certificate: func() -> result, error> + downstream-tls-raw-client-certificate: func() -> result, error>; - downstream-tls-client-cert-verify-result: func() -> result<_, error> + downstream-tls-client-cert-verify-result: func() -> result<_, error>; - downstream-tls-ja3-md5: func() -> result, error> + downstream-tls-ja3-md5: func() -> result, error>; - new: func() -> result + new: func() -> result; - header-names-get: func(h: request-handle) -> result, error> + header-names-get: func(h: request-handle) -> result, error>; - original-header-names-get: func() -> result, error> + original-header-names-get: func() -> result, error>; - original-header-count: func() -> result + original-header-count: func() -> result; - header-value-get: func(h: request-handle, name: string) -> result>, error> + header-value-get: func(h: request-handle, name: string) -> result>, error>; - header-values-get: func(h: request-handle, name: string) -> result>>, error> + header-values-get: func(h: request-handle, name: string) -> result>>, error>; - header-values-set: func(h: request-handle, name: string, values: list>) -> result<_, error> + header-values-set: func(h: request-handle, name: string, values: list>) -> result<_, error>; - header-insert: func(h: request-handle, name: string, value: list) -> result<_, error> + header-insert: func(h: request-handle, name: string, value: list) -> result<_, error>; - header-append: func(h: request-handle, name: string, value: list) -> result<_, error> + header-append: func(h: request-handle, name: string, value: list) -> result<_, error>; - header-remove: func(h: request-handle, name: string) -> result<_, error> + header-remove: func(h: request-handle, name: string) -> result<_, error>; - method-get: func(h: request-handle) -> result + method-get: func(h: request-handle) -> result; - method-set: func(h: request-handle, method: string) -> result<_, error> + method-set: func(h: request-handle, method: string) -> result<_, error>; - uri-get: func(h: request-handle) -> result + uri-get: func(h: request-handle) -> result; - uri-set: func(h: request-handle, uri: string) -> result<_, error> + uri-set: func(h: request-handle, uri: string) -> result<_, error>; - version-get: func(h: request-handle) -> result + version-get: func(h: request-handle) -> result; - version-set: func(h: request-handle, version: http-version) -> result<_, error> + version-set: func(h: request-handle, version: http-version) -> result<_, error>; - send: func(h: request-handle, b: body-handle, backend: string) -> result + send: func(h: request-handle, b: body-handle, backend: string) -> result; - send-v2: func(h: request-handle, s: send-error-detail, b: body-handle, backend: string) -> result + send-v2: func(h: request-handle, s: send-error-detail, b: body-handle, backend: string) -> result; - send-async: func(h: request-handle, b: body-handle, backend: string) -> result + send-async: func(h: request-handle, b: body-handle, backend: string) -> result; - send-async-streaming: func(h: request-handle, b: body-handle, backend: string) -> result + send-async-streaming: func(h: request-handle, b: body-handle, backend: string) -> result; - pending-req-poll: func(h: pending-request-handle) -> result, error> - pending-req-poll-v2: func(h: pending-request-handle, s: send-error-detail) -> result, error> + pending-req-poll: func(h: pending-request-handle) -> result, error>; + pending-req-poll-v2: func(h: pending-request-handle, s: send-error-detail) -> result, error>; - pending-req-wait: func(h: pending-request-handle) -> result - pending-req-wait-v2: func(h: pending-request-handle, s: send-error-detail) -> result + pending-req-wait: func(h: pending-request-handle) -> result; + pending-req-wait-v2: func(h: pending-request-handle, s: send-error-detail) -> result; pending-req-select: func(h: list) -> result, error> + >, error>; pending-req-select-v2: func(h: list) -> result, send-error-detail> + >, send-error-detail>; - close: func(h: request-handle) -> result<_, error> + close: func(h: request-handle) -> result<_, error>; - auto-decompress-response-set: func(h: request-handle, encodings: content-encodings) -> result<_, error> + auto-decompress-response-set: func(h: request-handle, encodings: content-encodings) -> result<_, error>; - upgrade-websocket: func(backend: string) -> result<_, error> + upgrade-websocket: func(backend: string) -> result<_, error>; - redirect-to-websocket-proxy: func(backend: string) -> result<_, error> + redirect-to-websocket-proxy: func(backend: string) -> result<_, error>; - redirect-to-grip-proxy: func(backend: string) -> result<_, error> + redirect-to-grip-proxy: func(backend: string) -> result<_, error>; - framing-headers-mode-set: func(h: request-handle, mode: framing-headers-mode) -> result<_, error> + framing-headers-mode-set: func(h: request-handle, mode: framing-headers-mode) -> result<_, error>; - register-dynamic-backend: func(prefix: string, target: string, config: dynamic-backend-config) -> result<_, error> + register-dynamic-backend: func(prefix: string, target: string, config: dynamic-backend-config) -> result<_, error>; } @@ -371,50 +371,50 @@ interface http-req { * Fastly HTTP Resp */ interface http-resp { - use types.{error} + use types.{error}; use http-types.{ response-handle, body-handle, http-version, http-status, framing-headers-mode - } + }; - new: func() -> result + new: func() -> result; - header-names-get: func(h: response-handle) -> result, error> + header-names-get: func(h: response-handle) -> result, error>; - header-value-get: func(h: response-handle, name: string) -> result, error> + header-value-get: func(h: response-handle, name: string) -> result, error>; - header-values-get: func(h: response-handle, name: string) -> result>>, error> + header-values-get: func(h: response-handle, name: string) -> result>>, error>; - header-values-set: func(h: response-handle, name: string, values: list>) -> result<_, error> + header-values-set: func(h: response-handle, name: string, values: list>) -> result<_, error>; - header-insert: func(h: response-handle, name: string, value: list) -> result<_, error> + header-insert: func(h: response-handle, name: string, value: list) -> result<_, error>; - header-append: func(h: response-handle, name: string, value: list) -> result<_, error> + header-append: func(h: response-handle, name: string, value: list) -> result<_, error>; - header-remove: func(h: response-handle, name: string) -> result<_, error> + header-remove: func(h: response-handle, name: string) -> result<_, error>; - version-get: func(h: response-handle) -> result + version-get: func(h: response-handle) -> result; - version-set: func(h: response-handle, version: http-version) -> result<_, error> + version-set: func(h: response-handle, version: http-version) -> result<_, error>; - send-downstream: func(h: response-handle, b: body-handle, streaming: bool) -> result<_, error> + send-downstream: func(h: response-handle, b: body-handle, streaming: bool) -> result<_, error>; - status-get: func(h: response-handle) -> result + status-get: func(h: response-handle) -> result; - status-set: func(h: response-handle, status: http-status) -> result<_, error> + status-set: func(h: response-handle, status: http-status) -> result<_, error>; - close: func(h: response-handle) -> result<_, error> + close: func(h: response-handle) -> result<_, error>; /// Adjust how this response's framing headers are determined. - framing-headers-mode-set: func(h: response-handle, mode: framing-headers-mode) -> result<_, error> + framing-headers-mode-set: func(h: response-handle, mode: framing-headers-mode) -> result<_, error>; enum keepalive-mode { automatic, no-keepalive, } - http-keepalive-mode-set: func(h: response-handle, mode: keepalive-mode) -> result<_, error> + http-keepalive-mode-set: func(h: response-handle, mode: keepalive-mode) -> result<_, error>; } /* @@ -422,20 +422,20 @@ interface http-resp { */ interface dictionary { - use types.{error} + use types.{error}; - type handle = u32 + type handle = u32; - open: func(name: string) -> result + open: func(name: string) -> result; - get: func(h: handle, key: string) -> result, error> + get: func(h: handle, key: string) -> result, error>; } /* * Fastly Geo */ interface geo { - use types.{error} + use types.{error}; record geo-data { /** @@ -559,7 +559,7 @@ interface geo { } /// JSON string for now - lookup: func(addr-octets: list) -> result + lookup: func(addr-octets: list) -> result; } /* @@ -567,27 +567,27 @@ interface geo { */ interface object-store { - use types.{error} + use types.{error}; - use http-types.{body-handle} + use http-types.{body-handle}; - type handle = u32 - type pending-handle = u32 + type handle = u32; + type pending-handle = u32; - open: func(name: string) -> result + open: func(name: string) -> result; - lookup: func(store: handle, key: string) -> result, error> + lookup: func(store: handle, key: string) -> result, error>; - lookup-async: func(store: handle, key: string) -> result + lookup-async: func(store: handle, key: string) -> result; - pending-lookup-wait: func(handle: pending-handle) -> result, error> + pending-lookup-wait: func(handle: pending-handle) -> result, error>; - delete-async: func(store: handle, key: string) -> result + delete-async: func(store: handle, key: string) -> result; - pending-delete-wait: func(handle: pending-handle) -> result<_, error> + pending-delete-wait: func(handle: pending-handle) -> result<_, error>; // Should object store insert return "inserted" bool? - insert: func(store: handle, key: string, body-handle: body-handle) -> result<_, error> + insert: func(store: handle, key: string, body-handle: body-handle) -> result<_, error>; } @@ -596,27 +596,27 @@ interface object-store { */ interface secret-store { - use types.{error, secret-handle} + use types.{error, secret-handle}; - type store-handle = u32 + type store-handle = u32; - open: func(name: string) -> result + open: func(name: string) -> result; - get: func(store: store-handle, key: string) -> result, error> + get: func(store: store-handle, key: string) -> result, error>; - plaintext: func(secret: secret-handle) -> result, error> + plaintext: func(secret: secret-handle) -> result>, error>; - from-bytes: func(bytes: string) -> result + from-bytes: func(bytes: list) -> result; } /* * Fastly backend */ interface backend { - use types.{error} - use http-types.{tls-version} + use types.{error}; + use http-types.{tls-version}; - exists: func(backend: string) -> result + exists: func(backend: string) -> result; enum backend-health { unknown, @@ -624,47 +624,47 @@ interface backend { unhealthy, } - is-healthy: func(backend: string) -> result + is-healthy: func(backend: string) -> result; /// Returns `true` if the backend is a "dynamic" backend. - is-dynamic: func(backend: string) -> result + is-dynamic: func(backend: string) -> result; /// Get the host of this backend. - get-host: func(backend: string) -> result + get-host: func(backend: string) -> result; /// Get the "override host" for this backend. /// /// This is used to change the `Host` header sent to the backend. See the /// Fastly documentation oh this topic here: https://docs.fastly.com/en/guides/specifying-an-override-host - get-override-host: func(backend: string) -> result, error> + get-override-host: func(backend: string) -> result, error>; /// Get the remote TCP port of the backend connection for the request. - get-port: func(backend: string) -> result + get-port: func(backend: string) -> result; /// Get the connection timeout of the backend. - get-connect-timeout-ms: func(backend: string) -> result + get-connect-timeout-ms: func(backend: string) -> result; /// Get the first byte timeout of the backend. - get-first-byte-timeout-ms: func(backend: string) -> result + get-first-byte-timeout-ms: func(backend: string) -> result; /// Get the between byte timeout of the backend. - get-between-bytes-timeout-ms: func(backend: string) -> result + get-between-bytes-timeout-ms: func(backend: string) -> result; /// Returns `true` if the backend is configured to use SSL. - is-ssl: func(backend: string) -> result + is-ssl: func(backend: string) -> result; /// Get the minimum SSL version this backend will use. - get-ssl-min-version: func(backend: string) -> result + get-ssl-min-version: func(backend: string) -> result; /// Get the maximum SSL version this backend will use. - get-ssl-max-version: func(backend: string) -> result + get-ssl-max-version: func(backend: string) -> result; } /* * Fastly Async IO */ interface async-io { - use types.{error} + use types.{error}; /// A handle to an object supporting generic async operations. /// Can be either a `BodyHandle` or a `PendingRequestHandle`. @@ -677,7 +677,7 @@ interface async-io { /// /// For writing bytes, note that there is a large host-side buffer that bytes can eagerly be written /// into, even before the origin itself consumes that data. - type handle = u32 + type handle = u32; /// Blocks until one of the given objects is ready for I/O, or the optional timeout expires. /// @@ -689,7 +689,7 @@ interface async-io { /// /// Returns the _index_ (not handle!) of the first object that is ready, or /// none if the timeout expires before any objects are ready for I/O. - select: func(hs: list, timeout-ms: u32) -> result, error> + select: func(hs: list, timeout-ms: u32) -> result, error>; /// Returns 1 if the given async item is "ready" for its associated I/O action, 0 otherwise. /// @@ -698,7 +698,7 @@ interface async-io { /// Valid object handles includes bodies and pending requests. See the `async_item_handle` /// definition for more details, including what I/O actions are associated with each handle /// type. - is-ready: func(handle: handle) -> result + is-ready: func(handle: handle) -> result; } /* @@ -706,7 +706,7 @@ interface async-io { */ interface purge { - use types.{error} + use types.{error}; flags options-mask { soft-purge, @@ -717,7 +717,7 @@ interface purge { * A surrogate key can be a max of 1024 characters. * A surrogate key must contain only printable ASCII characters (those between `0x21` and `0x7E`, inclusive). */ - surrogate-key: func(surrogate-keys: string, purge-options: options-mask) -> result, error> + surrogate-key: func(surrogate-keys: string, purge-options: options-mask) -> result, error>; } /* @@ -725,14 +725,14 @@ interface purge { */ interface cache { - use types.{error} - use http-types.{body-handle, request-handle} + use types.{error}; + use http-types.{body-handle, request-handle}; /// The outcome of a cache lookup (either bare or as part of a cache transaction) - type handle = u32 - type object-length = u64 - type duration-ns = u64 - type cache-hit-count = u64 + type handle = u32; + type object-length = u64; + type duration-ns = u64; + type cache-hit-count = u64; /// Extensible options for cache lookup operations currently used for both `lookup` and `transaction_lookup`. record lookup-options { @@ -795,19 +795,19 @@ interface cache { /// Performs a non-request-collapsing cache lookup. /// /// Returns a result without waiting for any request collapsing that may be ongoing. - lookup: func(key: string, options: lookup-options) -> result + lookup: func(key: string, options: lookup-options) -> result; /// Performs a non-request-collapsing cache insertion (or update). /// /// The returned handle is to a streaming body that is used for writing the object into /// the cache. - insert: func(key: string, options: write-options) -> result + insert: func(key: string, options: write-options) -> result; /// The entrypoint to the request-collapsing cache transaction API. /// /// This operation always participates in request collapsing and may return stale objects. To bypass /// request collapsing, use `lookup` and `insert` instead. - transaction-lookup: func(key: string, options: lookup-options) -> result + transaction-lookup: func(key: string, options: lookup-options) -> result; /// Insert an object into the cache with the given metadata. /// @@ -815,7 +815,7 @@ interface cache { /// /// The returned handle is to a streaming body that is used for writing the object into /// the cache. - transaction-insert: func(handle: handle, options: write-options) -> result + transaction-insert: func(handle: handle, options: write-options) -> result; /// Insert an object into the cache with the given metadata, and return a readable stream of the /// bytes as they are stored. @@ -827,32 +827,32 @@ interface cache { /// The returned body handle is to a streaming body that is used for writing the object _into_ /// the cache. The returned cache handle provides a separate transaction for reading out the /// newly cached object to send elsewhere. - transaction-insert-and-stream-back: func(handle: handle, options: write-options) -> result, error> + transaction-insert-and-stream-back: func(handle: handle, options: write-options) -> result, error>; /// Update the metadata of an object in the cache without changing its data. /// /// Can only be used in if the cache handle state includes both of the flags: /// - `found` /// - `must-insert-or-update` - transaction-update: func(handle: handle, options: write-options) -> result<_, error> + transaction-update: func(handle: handle, options: write-options) -> result<_, error>; /// Cancel an obligation to provide an object to the cache. /// /// Useful if there is an error before streaming is possible, e.g. if a backend is unreachable. - transaction-cancel: func(handle: handle) -> result<_, error> + transaction-cancel: func(handle: handle) -> result<_, error>; /// Close an ongoing interaction with the cache. /// /// If the cache handle state includes the `$must_insert_or_update` (and hence no insert or /// update has been performed), closing the handle cancels any request collapsing, potentially /// choosing a new waiter to perform the insertion/update. - close: func(handle: handle) -> result<_, error> + close: func(handle: handle) -> result<_, error>; - get-state: func(handle: handle) -> result + get-state: func(handle: handle) -> result; /// Gets the user metadata of the found object, returning `none` if there /// was no found object. - get-user-metadata: func(handle: handle) -> result, error> + get-user-metadata: func(handle: handle) -> result, error>; /// Gets a range of the found object body, returning the `optional-none` error if there /// was no found object. @@ -863,58 +863,58 @@ interface cache { /// Note: until the CacheD protocol is adjusted to fully support this functionality, /// the body of objects that are past the stale-while-revalidate period will not /// be available, even when other metadata is. - get-body: func(handle: handle, options: get-body-options, options-mask: get-body-options-mask) -> result + get-body: func(handle: handle, options: get-body-options, options-mask: get-body-options-mask) -> result; /// Gets the content length of the found object, returning the `$none` error if there /// was no found object, or no content length was provided. - get-length: func(handle: handle) -> result + get-length: func(handle: handle) -> result; /// Gets the configured max age of the found object, returning the `$none` error if there /// was no found object. - get-max-age-ns: func(handle: handle) -> result + get-max-age-ns: func(handle: handle) -> result; /// Gets the configured stale-while-revalidate period of the found object, returning the /// `$none` error if there was no found object. - get-stale-while-revalidate-ns: func(handle: handle) -> result + get-stale-while-revalidate-ns: func(handle: handle) -> result; /// Gets the age of the found object, returning the `$none` error if there /// was no found object. - get-age-ns: func(handle: handle) -> result + get-age-ns: func(handle: handle) -> result; /// Gets the number of cache hits for the found object, returning the `$none` error if there /// was no found object. - get-hits: func(handle: handle) -> result + get-hits: func(handle: handle) -> result; } interface edge-rate-limiter { - use types.{error} + use types.{error}; - check-rate: func(rate-counter-name: string, entry: string, delta: u32, window: u32, limit: u32, penalty-box-name: string, time-to-live: u32) -> result + check-rate: func(rate-counter-name: string, entry: string, delta: u32, window: u32, limit: u32, penalty-box-name: string, time-to-live: u32) -> result; - ratecounter-increment: func(rate-counter-name: string, entry: string, delta: u32) -> result<_, error> + ratecounter-increment: func(rate-counter-name: string, entry: string, delta: u32) -> result<_, error>; - ratecounter-lookup-rate: func(rate-counter-name: string, entry: string, window: u32) -> result + ratecounter-lookup-rate: func(rate-counter-name: string, entry: string, window: u32) -> result; - ratecounter-lookup-count: func(rate-counter-name: string, entry: string, duration: u32) -> result + ratecounter-lookup-count: func(rate-counter-name: string, entry: string, duration: u32) -> result; - penaltybox-add: func(penalty-box-name: string, entry: string, time-to-live: u32) -> result<_, error> + penaltybox-add: func(penalty-box-name: string, entry: string, time-to-live: u32) -> result<_, error>; - penaltybox-has: func(penalty-box-name: string, entry: string) -> result + penaltybox-has: func(penalty-box-name: string, entry: string) -> result; } interface device-detection { - use types.{error} + use types.{error}; - lookup: func(user-agent: string) -> result + lookup: func(user-agent: string) -> result; } interface reactor { - use http-types.{request} + use http-types.{request}; /// Serve the given request /// /// response handle not currently returned, because in the case of a streamed response /// send downstream must be fully streamed due to the run to completion semantics. - serve: func(req: request) -> result + serve: func(req: request) -> result; } diff --git a/runtime/js-compute-runtime/host_interface/wit/js-compute-runtime.wit b/runtime/js-compute-runtime/host_interface/wit/js-compute-runtime.wit index 1cc34178b0..7d78893f21 100644 --- a/runtime/js-compute-runtime/host_interface/wit/js-compute-runtime.wit +++ b/runtime/js-compute-runtime/host_interface/wit/js-compute-runtime.wit @@ -1,22 +1,22 @@ -package fastly:js-compute-runtime +package fastly:js-compute-runtime; world fastly-world { - import fastly:compute-at-edge/async-io - import fastly:compute-at-edge/backend - import fastly:compute-at-edge/cache - import fastly:compute-at-edge/device-detection - import fastly:compute-at-edge/dictionary - import fastly:compute-at-edge/edge-rate-limiter - import fastly:compute-at-edge/geo - import fastly:compute-at-edge/http-body - import fastly:compute-at-edge/http-req - import fastly:compute-at-edge/http-resp - import fastly:compute-at-edge/log - import fastly:compute-at-edge/object-store - import fastly:compute-at-edge/purge - import fastly:compute-at-edge/secret-store - import fastly:compute-at-edge/uap + import fastly:compute-at-edge/async-io; + import fastly:compute-at-edge/backend; + import fastly:compute-at-edge/cache; + import fastly:compute-at-edge/device-detection; + import fastly:compute-at-edge/dictionary; + import fastly:compute-at-edge/edge-rate-limiter; + import fastly:compute-at-edge/geo; + import fastly:compute-at-edge/http-body; + import fastly:compute-at-edge/http-req; + import fastly:compute-at-edge/http-resp; + import fastly:compute-at-edge/log; + import fastly:compute-at-edge/object-store; + import fastly:compute-at-edge/purge; + import fastly:compute-at-edge/secret-store; + import fastly:compute-at-edge/uap; - export fastly:compute-at-edge/reactor + export fastly:compute-at-edge/reactor; } diff --git a/runtime/js-compute-runtime/impl/main_component.cpp b/runtime/js-compute-runtime/impl/main_component.cpp index 87a9eba862..ae65b9233b 100644 --- a/runtime/js-compute-runtime/impl/main_component.cpp +++ b/runtime/js-compute-runtime/impl/main_component.cpp @@ -4,7 +4,8 @@ int main() { return 0; } -bool exports_fastly_compute_at_edge_reactor_serve(fastly_compute_at_edge_reactor_request_t *req) { +bool exports_fastly_compute_at_edge_reactor_serve( + exports_fastly_compute_at_edge_reactor_request_t *req) { host_api::Request request{host_api::HttpReq{req->f0}, host_api::HttpBody{req->f1}}; return reactor_main(request); } diff --git a/test-d/backend.test-d.ts b/test-d/backend.test-d.ts index 3b4576f57d..f317718435 100644 --- a/test-d/backend.test-d.ts +++ b/test-d/backend.test-d.ts @@ -1,5 +1,5 @@ /// -import { Backend, BackendConfiguration } from "fastly:backend"; +import { Backend } from "fastly:backend"; import {expectError, expectType} from 'tsd'; // Backend @@ -20,7 +20,7 @@ import {expectError, expectType} from 'tsd'; expectType(new Backend({name: 'eu', target: 'www.example.com', certificateHostname: 'example.com',})) expectType(new Backend({name: 'eu', target: 'www.example.com', caCertificate: '',})) expectType(new Backend({name: 'eu', target: 'www.example.com', ciphers: 'DEFAULT',})) - expectType(new Backend({name: 'eu', target: 'www.example.com', sniHostname: 'example.com',})) + expectType(new Backend({name: 'eu', target: 'www.example.com', sniHostname: 'example.com',})) const backend = new Backend({name: 'eu', target: 'www.example.com'}) expectType(backend.toString()) } diff --git a/types/backend.d.ts b/types/backend.d.ts index 43600b8496..fbf97a1dab 100644 --- a/types/backend.d.ts +++ b/types/backend.d.ts @@ -1,3 +1,5 @@ +/// + declare module 'fastly:backend' { interface BackendConfiguration { /** @@ -107,6 +109,15 @@ declare module 'fastly:backend' { * @throws {TypeError} Throws a TypeError if the value is an empty string. */ sniHostname?: string; + /** + * Set the client certificate to be provided to the server during the initial TLS handshake. + * + * @throws {TypeError} Throws a TypeError if the value is not an object of the correct type. + */ + clientCertificate?: { + certificate: string, + key: import('fastly:secret-store').SecretStoreEntry, + } } /** diff --git a/types/secret-store.d.ts b/types/secret-store.d.ts index 9ac549509b..313d271d56 100644 --- a/types/secret-store.d.ts +++ b/types/secret-store.d.ts @@ -12,13 +12,33 @@ declare module "fastly:secret-store" { * @throws {TypeError} Throws an `TypeError` if the provided key is longer than 256 characters. */ get(key: string): Promise; + + /** + * Constructs a local in-memory SecretStoreEntry from the provided bytes, + * useful for passing bytes to APIs that only take a SecretStoreEntry. + * + * Note: This is not the recommended way to obtain secrets, instead use {@link get}. + */ + static fromBytes(bytes: ArrayBufferView | ArrayBuffer): SecretStoreEntry; } class SecretStoreEntry { constructor(name: string); /** - * Get the plaintext value of the SecretStoreEntry. + * Get the plaintext value of the SecretStoreEntry as a UTF8 string. + * + * Note: Using this method will bring the secret into user memory, + * always avoid using this method when possible, instead passing + * the secret directly. */ plaintext(): string; + /** + * Get the raw byte value of the SecretStoreEntry as a Uint8Array. + * + * Note: Using this method will bring the secret into user memory, + * always avoid using this method when possible, instead passing + * the secret directly. + */ + rawBytes(): Uint8Array; } } diff --git a/yarn.lock b/yarn.lock index 434b43b7d4..b3e6e43181 100644 --- a/yarn.lock +++ b/yarn.lock @@ -38,23 +38,23 @@ resolved "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@bytecodealliance/jco@^0.10.0": - version "0.10.0" - resolved "https://registry.npmjs.org/@bytecodealliance/jco/-/jco-0.10.0.tgz" - integrity sha512-nzYRN//4MuNcTX4/aLxuCCoFcUJNxq+WD9jBhivTrljlG1QzM2x6ESzJv+pfmO5RZ19FQamVXzoUjyaVknRwXA== - dependencies: - "@bytecodealliance/preview2-shim" "0.0.12" - binaryen "^111.0.0" - chalk-template "^0.4.0" - commander "^9.4.1" - mkdirp "^1.0.4" - ora "^6.1.2" - terser "^5.16.1" - -"@bytecodealliance/preview2-shim@0.0.12": - version "0.0.12" - resolved "https://registry.npmjs.org/@bytecodealliance/preview2-shim/-/preview2-shim-0.0.12.tgz" - integrity sha512-X+KpYrNB2LKKLzP7XcgNfu0zN3Gr3yTw4RGcj0k8k1MMUuwQdc/Mg+lzD6mEBHOLmVgvH5L1323Jy/+CHpnjKg== +"@bytecodealliance/jco@^1.2.4": + version "1.2.4" + resolved "https://registry.yarnpkg.com/@bytecodealliance/jco/-/jco-1.2.4.tgz#0798a0659bf9f882ab4fb5254411d6eb9f460e59" + integrity sha512-uuOm9UkYqWp5uElYDNzlhjbdrAmczEvETgQdI1hFTk79h+mrmHPRV32pgRP5o1eHVwMIpuk4XQkDIhFbksurUw== + dependencies: + "@bytecodealliance/preview2-shim" "^0.16.2" + binaryen "^116.0.0" + chalk-template "^1" + commander "^12" + mkdirp "^3" + ora "^8" + terser "^5" + +"@bytecodealliance/preview2-shim@^0.16.2": + version "0.16.2" + resolved "https://registry.yarnpkg.com/@bytecodealliance/preview2-shim/-/preview2-shim-0.16.2.tgz#bb6a37a041d0e11a81c7092f2e1797bfc464b7e4" + integrity sha512-36MwesmbLSf3Y5/OHcS85iBaF0N92CQ4gpjtDVKSbrjxmrBKCWlWVfoQ03F/cqDg8k5K7pzVaVBH0XBIbTCfTQ== "@bytecodealliance/wizer-darwin-arm64@3.0.1": version "3.0.1" @@ -502,24 +502,10 @@ balanced-match@^1.0.0: resolved "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz" integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== -base64-js@^1.3.1: - version "1.5.1" - resolved "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz" - integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== - -binaryen@^111.0.0: - version "111.0.0" - resolved "https://registry.npmjs.org/binaryen/-/binaryen-111.0.0.tgz" - integrity sha512-PEXOSHFO85aj1aP4t+KGzvxQ00qXbjCysWlsDjlGkP1e9owNiYdpEkLej21Ax8LDD7xJ01rEmJDqZ/JPoW2GXw== - -bl@^5.0.0: - version "5.1.0" - resolved "https://registry.npmjs.org/bl/-/bl-5.1.0.tgz" - integrity sha512-tv1ZJHLfTDnXE6tMHv73YgSJaWR2AFuPwMntBe7XL/GBFHnT0CLnsHMogfk5+GzCDC5ZWarSCYaIGATZt9dNsQ== - dependencies: - buffer "^6.0.3" - inherits "^2.0.4" - readable-stream "^3.4.0" +binaryen@^116.0.0: + version "116.0.0" + resolved "https://registry.yarnpkg.com/binaryen/-/binaryen-116.0.0.tgz#ad79fb939246138fb128d9438d5574152ece39fe" + integrity sha512-Hp0dXC6Cb/rTwWEoUS2BRghObE7g/S9umKtxuTDt3f61G6fNTE/YVew/ezyy3IdHcLx3f17qfh6LwETgCfvWkQ== brace-expansion@^1.1.7: version "1.1.11" @@ -561,14 +547,6 @@ buffer-from@^1.0.0: resolved "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz" integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== -buffer@^6.0.3: - version "6.0.3" - resolved "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz" - integrity sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA== - dependencies: - base64-js "^1.3.1" - ieee754 "^1.2.1" - c8@^7.11.3: version "7.14.0" resolved "https://registry.npmjs.org/c8/-/c8-7.14.0.tgz" @@ -606,12 +584,12 @@ camelcase@^5.3.1: resolved "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz" integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== -chalk-template@^0.4.0: - version "0.4.0" - resolved "https://registry.npmjs.org/chalk-template/-/chalk-template-0.4.0.tgz" - integrity sha512-/ghrgmhfY8RaSdeo43hNXxpoHAtxdbskUHjPpfqUWGttFgycUhYPGx3YZBCnUCvOa7Doivn1IZec3DEGFoMgLg== +chalk-template@^1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/chalk-template/-/chalk-template-1.1.0.tgz#ffc55db6dd745e9394b85327c8ac8466edb7a7b1" + integrity sha512-T2VJbcDuZQ0Tb2EWwSotMPJjgpy1/tGee1BTpUNsGZ/qgNjV2t7Mvu+d4600U564nbLesN1x2dPL+xii174Ekg== dependencies: - chalk "^4.1.2" + chalk "^5.2.0" chalk@^2.0.0: version "2.4.2" @@ -622,7 +600,7 @@ chalk@^2.0.0: escape-string-regexp "^1.0.5" supports-color "^5.3.0" -chalk@^4.0.0, chalk@^4.1.0, chalk@^4.1.2: +chalk@^4.0.0, chalk@^4.1.0: version "4.1.2" resolved "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz" integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== @@ -630,9 +608,9 @@ chalk@^4.0.0, chalk@^4.1.0, chalk@^4.1.2: ansi-styles "^4.1.0" supports-color "^7.1.0" -chalk@^5.0.0: +chalk@^5.2.0, chalk@^5.3.0: version "5.3.0" - resolved "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-5.3.0.tgz#67c20a7ebef70e7f3970a01f90fa210cb6860385" integrity sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w== character-entities@^2.0.0: @@ -647,10 +625,10 @@ cli-cursor@^4.0.0: dependencies: restore-cursor "^4.0.0" -cli-spinners@^2.6.1: - version "2.9.0" - resolved "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.0.tgz" - integrity sha512-4/aL9X3Wh0yiMQlE+eeRhWP6vclO3QRtw1JHKIT0FFUs5FjpFmESqtMvYZ0+lbzBw900b95mS0hohy+qn2VK/g== +cli-spinners@^2.9.2: + version "2.9.2" + resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-2.9.2.tgz#1773a8f4b9c4d6ac31563df53b3fc1d79462fe41" + integrity sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg== cliui@^7.0.2: version "7.0.4" @@ -661,11 +639,6 @@ cliui@^7.0.2: strip-ansi "^6.0.0" wrap-ansi "^7.0.0" -clone@^1.0.2: - version "1.0.4" - resolved "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz" - integrity sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg== - color-convert@^1.9.0: version "1.9.3" resolved "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz" @@ -690,16 +663,16 @@ color-name@~1.1.4: resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz" integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== +commander@^12: + version "12.1.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-12.1.0.tgz#01423b36f501259fdaac4d0e4d60c96c991585d3" + integrity sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA== + commander@^2.20.0: version "2.20.3" resolved "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz" integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== -commander@^9.4.1: - version "9.5.0" - resolved "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz" - integrity sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ== - concat-map@0.0.1: version "0.0.1" resolved "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz" @@ -751,13 +724,6 @@ deep-is@^0.1.3: resolved "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz" integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== -defaults@^1.0.3: - version "1.0.4" - resolved "https://registry.npmjs.org/defaults/-/defaults-1.0.4.tgz" - integrity sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A== - dependencies: - clone "^1.0.2" - dequal@^2.0.0: version "2.0.3" resolved "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz" @@ -789,6 +755,11 @@ doctrine@^3.0.0: dependencies: esutils "^2.0.2" +emoji-regex@^10.3.0: + version "10.3.0" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-10.3.0.tgz#76998b9268409eb3dae3de989254d456e70cfe23" + integrity sha512-QpLs9D9v9kArv4lfDEgg1X/gN5XLnf/A6l9cs8SPZLRZR3ZkY9+kwIQTxm+fsSej5UMYGE8fdoaZVIBlqG0XTw== + emoji-regex@^8.0.0: version "8.0.0" resolved "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz" @@ -1070,6 +1041,11 @@ get-caller-file@^2.0.5: resolved "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz" integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== +get-east-asian-width@^1.0.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/get-east-asian-width/-/get-east-asian-width-1.2.0.tgz#5e6ebd9baee6fb8b7b6bd505221065f0cd91f64e" + integrity sha512-2nk+7SIVb14QrgXFHcm84tD4bKQz0RxPuMT8Ag5KPOq7J5fEmAg0UbXdTOSHqNuHSU28k55qnceesxXRZGzKWA== + glob-parent@^5.1.2: version "5.1.2" resolved "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz" @@ -1170,11 +1146,6 @@ html-escaper@^2.0.0: resolved "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz" integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg== -ieee754@^1.2.1: - version "1.2.1" - resolved "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz" - integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== - ignore@^5.2.0: version "5.2.4" resolved "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz" @@ -1206,7 +1177,7 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2, inherits@^2.0.3, inherits@^2.0.4: +inherits@2: version "2.0.4" resolved "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== @@ -1275,11 +1246,16 @@ is-unicode-supported@^0.1.0: resolved "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz" integrity sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw== -is-unicode-supported@^1.1.0: +is-unicode-supported@^1.3.0: version "1.3.0" - resolved "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-1.3.0.tgz" + resolved "https://registry.yarnpkg.com/is-unicode-supported/-/is-unicode-supported-1.3.0.tgz#d824984b616c292a2e198207d4a609983842f714" integrity sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ== +is-unicode-supported@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-unicode-supported/-/is-unicode-supported-2.0.0.tgz#fdf32df9ae98ff6ab2cedc155a5a6e895701c451" + integrity sha512-FRdAyx5lusK1iHG0TWpVtk9+1i+GjrzRffhDg4ovQ7mcidMQ6mj+MhKPmvh7Xwyv5gIS06ns49CA7Sqg7lC22Q== + isexe@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz" @@ -1404,13 +1380,13 @@ log-symbols@^4.0.0: chalk "^4.1.0" is-unicode-supported "^0.1.0" -log-symbols@^5.1.0: - version "5.1.0" - resolved "https://registry.npmjs.org/log-symbols/-/log-symbols-5.1.0.tgz" - integrity sha512-l0x2DvrW294C9uDCoQe1VSU4gf529FkSZ6leBl4TiqZH/e+0R7hSfHQBNut2mNygDgHwvYHfFLn6Oxb3VWj2rA== +log-symbols@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-6.0.0.tgz#bb95e5f05322651cac30c0feb6404f9f2a8a9439" + integrity sha512-i24m8rpwhmPIS4zscNzK6MSEhk0DUWa/8iYQWxhffV8jkI4Phvs3F+quL5xvS0gdQR0FyTCMMH33Y78dDTzzIw== dependencies: - chalk "^5.0.0" - is-unicode-supported "^1.1.0" + chalk "^5.3.0" + is-unicode-supported "^1.3.0" longest-streak@^3.0.0: version "3.1.0" @@ -1758,10 +1734,10 @@ minimist@^1.2.6: resolved "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz" integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== -mkdirp@^1.0.4: - version "1.0.4" - resolved "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz" - integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== +mkdirp@^3: + version "3.0.1" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-3.0.1.tgz#e44e4c5607fb279c168241713cc6e0fea9adcb50" + integrity sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg== ms@2.1.2: version "2.1.2" @@ -1819,20 +1795,20 @@ optionator@^0.9.3: prelude-ls "^1.2.1" type-check "^0.4.0" -ora@^6.1.2: - version "6.3.1" - resolved "https://registry.npmjs.org/ora/-/ora-6.3.1.tgz" - integrity sha512-ERAyNnZOfqM+Ao3RAvIXkYh5joP220yf59gVe2X/cI6SiCxIdi4c9HZKZD8R6q/RDXEje1THBju6iExiSsgJaQ== +ora@^8: + version "8.0.1" + resolved "https://registry.yarnpkg.com/ora/-/ora-8.0.1.tgz#6dcb9250a629642cbe0d2df3a6331ad6f7a2af3e" + integrity sha512-ANIvzobt1rls2BDny5fWZ3ZVKyD6nscLvfFRpQgfWsythlcsVUC9kL0zq6j2Z5z9wwp1kd7wpsD/T9qNPVLCaQ== dependencies: - chalk "^5.0.0" + chalk "^5.3.0" cli-cursor "^4.0.0" - cli-spinners "^2.6.1" + cli-spinners "^2.9.2" is-interactive "^2.0.0" - is-unicode-supported "^1.1.0" - log-symbols "^5.1.0" - stdin-discarder "^0.1.0" - strip-ansi "^7.0.1" - wcwidth "^1.0.1" + is-unicode-supported "^2.0.0" + log-symbols "^6.0.0" + stdin-discarder "^0.2.1" + string-width "^7.0.0" + strip-ansi "^7.1.0" p-limit@^2.2.0: version "2.3.0" @@ -1974,15 +1950,6 @@ read-pkg@^5.2.0: parse-json "^5.0.0" type-fest "^0.6.0" -readable-stream@^3.4.0: - version "3.6.2" - resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz" - integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA== - dependencies: - inherits "^2.0.3" - string_decoder "^1.1.1" - util-deprecate "^1.0.1" - redent@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz" @@ -2087,11 +2054,6 @@ run-parallel@^1.1.9: dependencies: queue-microtask "^1.2.2" -safe-buffer@~5.2.0: - version "5.2.1" - resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz" - integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== - same-object@^1.0.2: version "1.0.2" resolved "https://registry.npmjs.org/same-object/-/same-object-1.0.2.tgz" @@ -2175,12 +2137,10 @@ stackframe@^1.3.4: resolved "https://registry.npmjs.org/stackframe/-/stackframe-1.3.4.tgz" integrity sha512-oeVtt7eWQS+Na6F//S4kJ2K2VbRlS9D43mAlMyVpVWovy9o+jfgH8O9agzANzaiLjclA0oYzUXEM4PurhSUChw== -stdin-discarder@^0.1.0: - version "0.1.0" - resolved "https://registry.npmjs.org/stdin-discarder/-/stdin-discarder-0.1.0.tgz" - integrity sha512-xhV7w8S+bUwlPTb4bAOUQhv8/cSS5offJuX8GQGq32ONF0ZtDWKfkdomM3HMRA+LhX6um/FZ0COqlwsjD53LeQ== - dependencies: - bl "^5.0.0" +stdin-discarder@^0.2.1: + version "0.2.2" + resolved "https://registry.yarnpkg.com/stdin-discarder/-/stdin-discarder-0.2.2.tgz#390037f44c4ae1a1ae535c5fe38dc3aba8d997be" + integrity sha512-UhDfHmA92YAlNnCfhmq0VeNL5bDbiZGg7sZ2IvPsXubGkiNa9EC+tUTsjBRsYUAz87btI6/1wf4XoVvQ3uRnmQ== string-width@^4.1.0, string-width@^4.2.0: version "4.2.3" @@ -2191,12 +2151,14 @@ string-width@^4.1.0, string-width@^4.2.0: is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.1" -string_decoder@^1.1.1: - version "1.3.0" - resolved "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz" - integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== +string-width@^7.0.0: + version "7.1.0" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-7.1.0.tgz#d994252935224729ea3719c49f7206dc9c46550a" + integrity sha512-SEIJCWiX7Kg4c129n48aDRwLbFb2LJmXXFrWBG4NGaRtMQ3myKPKbwrD1BKqQn74oCoNMBVrfDEr5M9YxCsrkw== dependencies: - safe-buffer "~5.2.0" + emoji-regex "^10.3.0" + get-east-asian-width "^1.0.0" + strip-ansi "^7.1.0" strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" @@ -2205,9 +2167,9 @@ strip-ansi@^6.0.0, strip-ansi@^6.0.1: dependencies: ansi-regex "^5.0.1" -strip-ansi@^7.0.1: +strip-ansi@^7.1.0: version "7.1.0" - resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45" integrity sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ== dependencies: ansi-regex "^6.0.1" @@ -2251,10 +2213,10 @@ supports-preserve-symlinks-flag@^1.0.0: resolved "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz" integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== -terser@^5.16.1: - version "5.19.2" - resolved "https://registry.npmjs.org/terser/-/terser-5.19.2.tgz" - integrity sha512-qC5+dmecKJA4cpYxRa5aVkKehYsQKc+AHeKl0Oe62aYjBL8ZA33tTljktDHJSaxxMnbI5ZYw+o/S2DxxLu8OfA== +terser@^5: + version "5.31.0" + resolved "https://registry.yarnpkg.com/terser/-/terser-5.31.0.tgz#06eef86f17007dbad4593f11a574c7f5eb02c6a1" + integrity sha512-Q1JFAoUKE5IMfI4Z/lkE/E6+SwgzO+x4tq4v1AyBLRj8VSYvRO6A/rQrPg1yud4g0En9EKI1TvFRF2tQFcoUkg== dependencies: "@jridgewell/source-map" "^0.3.3" acorn "^8.8.2" @@ -2421,11 +2383,6 @@ uri-js@^4.2.2: dependencies: punycode "^2.1.0" -util-deprecate@^1.0.1: - version "1.0.2" - resolved "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz" - integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== - v8-to-istanbul@^9.0.0: version "9.1.0" resolved "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.1.0.tgz" @@ -2460,13 +2417,6 @@ vfile@^6.0.0: unist-util-stringify-position "^4.0.0" vfile-message "^4.0.0" -wcwidth@^1.0.1: - version "1.0.1" - resolved "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz" - integrity sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg== - dependencies: - defaults "^1.0.3" - which@^2.0.1: version "2.0.2" resolved "https://registry.npmjs.org/which/-/which-2.0.2.tgz"