From a53699af19a4cffbc593cdb8a9d74fc7c6084d85 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Thu, 15 Jan 2026 16:58:20 -0800 Subject: [PATCH] Update xqd.h to avoid the old "env" ABI. Add `import_module` and `import_name` directives to the declarations in xqd.h so that the code doesn't depend on the legacy "env" ABI. --- linuxdoom-1.10/xqd.h | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/linuxdoom-1.10/xqd.h b/linuxdoom-1.10/xqd.h index 6ef5f5b05..b12adc066 100644 --- a/linuxdoom-1.10/xqd.h +++ b/linuxdoom-1.10/xqd.h @@ -88,17 +88,23 @@ typedef struct { // TODO ACF 2019-12-05: nicer type for the return value (XqdStatus) +__attribute__((import_module("fastly_http_body"), import_name("append"))) int xqd_body_append(BodyHandle dst_handle, BodyHandle src_handle); +__attribute__((import_module("fastly_http_body"), import_name("new"))) int xqd_body_new(BodyHandle *handle_out); +__attribute__((import_module("fastly_http_body"), import_name("read"))) int xqd_body_read(BodyHandle body_handle, char *buf, size_t buf_len, size_t *nread); +__attribute__((import_module("fastly_http_body"), import_name("write"))) int xqd_body_write(BodyHandle body_handle, const char *buf, size_t buf_len, BodyWriteEnd end, size_t *nwritten); +__attribute__((import_module("fastly_abi"), import_name("init"))) int xqd_init(uint64_t abi_version); +__attribute__((import_module("fastly_http_req"), import_name("body_downstream_get"))) int xqd_req_body_downstream_get(RequestHandle *req_handle_out, BodyHandle *body_handle_out); /** @@ -116,95 +122,129 @@ int xqd_req_body_downstream_get(RequestHandle *req_handle_out, BodyHandle *body_ * xqd_req_cache_override_v2_set also includes an optional Surrogate-Key which will be set or added * to any received from the origin. */ +__attribute__((import_module("fastly_http_req"), import_name("cache_override_set"))) int xqd_req_cache_override_set(RequestHandle req_handle, int tag, uint32_t ttl, uint32_t stale_while_revalidate); +__attribute__((import_module("fastly_http_req"), import_name("cache_override_v2_set"))) int xqd_req_cache_override_v2_set(RequestHandle req_handle, int tag, uint32_t ttl, uint32_t stale_while_revalidate, const char *surrogate_key, size_t surrogate_key_len); +__attribute__((import_module("fastly_http_req"), import_name("header_append"))) int xqd_req_header_append(RequestHandle req_handle, const char *name, size_t name_len, const char *value, size_t value_len); +__attribute__((import_module("fastly_http_req"), import_name("header_insert"))) int xqd_req_header_insert(RequestHandle req_handle, const char *name, size_t name_len, const char *value, size_t value_len); +__attribute__((import_module("fastly_http_req"), import_name("header_remove"))) int xqd_req_header_remove(RequestHandle req_handle, const char *name, size_t name_len); +__attribute__((import_module("fastly_http_req"), import_name("header_names_get"))) int xqd_req_header_names_get(RequestHandle req_handle, char *buf, size_t buf_len, uint32_t cursor, int64_t *ending_cursor, size_t *nwritten); +__attribute__((import_module("fastly_http_req"), import_name("header_value_get"))) int xqd_req_header_value_get(RequestHandle req_handle, const char *name, size_t name_len, char *value, size_t value_max_len, size_t *nwritten); +__attribute__((import_module("fastly_http_req"), import_name("header_values_get"))) int xqd_req_header_values_get(RequestHandle req_handle, const char *name, size_t name_len, char *buf, size_t buf_len, uint32_t cursor, int64_t *ending_cursor, size_t *nwritten); +__attribute__((import_module("fastly_http_req"), import_name("header_values_set"))) int xqd_req_header_values_set(RequestHandle req_handle, const char *name, size_t name_len, const char *values, size_t values_len); +__attribute__((import_module("fastly_http_req"), import_name("method_get"))) int xqd_req_method_get(RequestHandle req_handle, char *method, size_t method_max_len, size_t *nwritten); +__attribute__((import_module("fastly_http_req"), import_name("method_set"))) int xqd_req_method_set(RequestHandle req_handle, const char *method, size_t method_len); +__attribute__((import_module("fastly_http_req"), import_name("new"))) int xqd_req_new(RequestHandle *req_handle); +__attribute__((import_module("fastly_http_req"), import_name("send"))) int xqd_req_send(RequestHandle req_handle, BodyHandle body_handle, const char *backend, size_t backend_len, ResponseHandle *resp_handle_out, BodyHandle *resp_body_handle_out); +__attribute__((import_module("fastly_http_req"), import_name("uri_get"))) int xqd_req_uri_get(RequestHandle req_handle, char *uri, size_t uri_max_len, size_t *nwritten); +__attribute__((import_module("fastly_http_req"), import_name("uri_set"))) int xqd_req_uri_set(RequestHandle req_handle, const char *uri, size_t uri_len); +__attribute__((import_module("fastly_http_req"), import_name("version_get"))) int xqd_req_version_get(RequestHandle req_handle, uint32_t *version); +__attribute__((import_module("fastly_http_req"), import_name("version_set"))) int xqd_req_version_set(RequestHandle req_handle, uint32_t version); +__attribute__((import_module("fastly_http_resp"), import_name("header_append"))) int xqd_resp_header_append(ResponseHandle resp_handle, const char *name, size_t name_len, const char *value, size_t value_len); +__attribute__((import_module("fastly_http_resp"), import_name("header_insert"))) int xqd_resp_header_insert(ResponseHandle resp_handle, const char *name, size_t name_len, const char *value, size_t value_len); +__attribute__((import_module("fastly_http_resp"), import_name("header_remove"))) int xqd_resp_header_remove(ResponseHandle resp_handle, const char *name, size_t name_len); +__attribute__((import_module("fastly_http_resp"), import_name("header_names_get"))) int xqd_resp_header_names_get(ResponseHandle resp_handle, char *buf, size_t buf_len, uint32_t cursor, int64_t *ending_cursor, size_t *nwritten); +__attribute__((import_module("fastly_http_resp"), import_name("header_value_get"))) int xqd_resp_header_value_get(ResponseHandle resp_handle, const char *name, size_t name_len, char *value, size_t value_max_len, size_t *nwritten); +__attribute__((import_module("fastly_http_resp"), import_name("header_values_get"))) int xqd_resp_header_values_get(ResponseHandle resp_handle, const char *name, size_t name_len, char *buf, size_t buf_len, uint32_t cursor, int64_t *ending_cursor, size_t *nwritten); +__attribute__((import_module("fastly_http_resp"), import_name("header_values_set"))) int xqd_resp_header_values_set(ResponseHandle resp_handle, const char *name, size_t name_len, const char *buf, size_t buf_len); +__attribute__((import_module("fastly_http_resp"), import_name("new"))) int xqd_resp_new(ResponseHandle *resp_handle_out); +__attribute__((import_module("fastly_http_resp"), import_name("send_downstream"))) int xqd_resp_send_downstream(ResponseHandle resp_handle, BodyHandle body_handle, uint32_t streaming); +__attribute__((import_module("fastly_http_resp"), import_name("status_get"))) int xqd_resp_status_get(ResponseHandle resp_handle, uint16_t *status); +__attribute__((import_module("fastly_http_resp"), import_name("status_set"))) int xqd_resp_status_set(ResponseHandle resp_handle, uint16_t status); +__attribute__((import_module("fastly_http_resp"), import_name("version_get"))) int xqd_resp_version_get(ResponseHandle resp_handle, uint32_t *version); +__attribute__((import_module("fastly_http_resp"), import_name("version_set"))) int xqd_resp_version_set(ResponseHandle resp_handle, uint32_t version); +__attribute__((import_module("fastly_uap"), import_name("parse"))) int xqd_uap_parse(const char *user_agent, size_t user_agent_len, char *family, size_t family_max_len, size_t *family_nwritten, char *major, size_t major_max_len, size_t *major_nwritten, char *minor, size_t minor_max_len, size_t *minor_nwritten, char *patch, size_t patch_max_len, size_t *patch_nwritten); +__attribute__((import_module("fastly_log"), import_name("endpoint_get"))) int xqd_log_endpoint_get(const char *name, size_t name_len, LogEndpointHandle *endpoint_handle); +__attribute__((import_module("fastly_log"), import_name("write"))) int xqd_log_write(LogEndpointHandle endpoint_handle, const char* msg, size_t msg_len, size_t *nwritten); +__attribute__((import_module("fastly_http_req"), import_name("original_header_count"))) int xqd_req_original_header_count(uint32_t *count); __attribute__((import_module("fastly_cache")))