Expand description
proxy-wasm ABI constants and types (DW-055).
The proxy-wasm ABI is the standard interface between a WebAssembly
plugin and the host proxy. The spec lives at
https://github.com/proxy-wasm/spec. This module defines the
constants the host and plugin exchange over the ABI boundary; the
host implementation (the import functions the plugin calls back to)
lives in super::host, and the plugin lifecycle (the exports the
host calls) lives in super::instance.
Only the HTTP filter subset is implemented (dwara is an HTTP
gateway, not a TCP proxy): the stream-context calls
(proxy_on_downstream_data, proxy_on_upstream_data, etc.) are
stubbed to Continue, and the TCP/context-creation exports are
called but their actions are treated as Continue-only.
Constants§
- ACTION_
CONTINUE - Continue processing — the request/response proceeds normally.
- ACTION_
END_ STREAM - End the stream — short-circuit the request (e.g. after
proxy_send_http_response). No further phase callbacks fire. - ACTION_
PAUSE - Pause for a host async operation — the plugin dispatched an HTTP
callout (
proxy_http_call) and awaits its response callback (proxy-wasm Action value 1; the Rust SDK’sAction::Pause). - BUFFER_
CALLOUT_ RESPONSE_ BODY - Buffer type: HTTP callout response body (
proxy_get_buffer_bytes; proxy-wasm BufferType 4, what the SDK’sget_http_call_response_bodyreads). - BUFFER_
CALLOUT_ RESPONSE_ HEADERS - Map type: HTTP callout response headers (proxy-wasm MapType 6, the
map
proxy_on_http_call_responsecallbacks read viaproxy_get_header_map_pairs/proxy_get_header_map_value). - BUFFER_
CALLOUT_ RESPONSE_ TRAILERS - Map type: HTTP callout response trailers (proxy-wasm MapType 7). Not plumbed (the sync callout transport never surfaces trailers); reads answer empty and writes are accepted and discarded, like the request/response trailer maps.
- BUFFER_
PLUGIN_ CONFIGURATION - Buffer type: Plugin configuration (passed to
proxy_on_configure). - BUFFER_
REQUEST_ BODY - Buffer type: HTTP request body (
proxy_get/set_buffer_bytes). - BUFFER_
REQUEST_ HEADERS - Map type: HTTP request headers (header-map hostcalls).
- BUFFER_
REQUEST_ TRAILERS - Map type: HTTP request trailers (header-map hostcalls).
- BUFFER_
RESPONSE_ BODY - Buffer type: HTTP response body (
proxy_get/set_buffer_bytes). - BUFFER_
RESPONSE_ HEADERS - Map type: HTTP response headers (header-map hostcalls).
- BUFFER_
RESPONSE_ TRAILERS - Map type: HTTP response trailers (header-map hostcalls).
- BUFFER_
VM_ CONFIGURATION - Buffer type: VM configuration (passed to
proxy_on_vm_start). - CLOSE_
LOCAL - CLOSE_
REMOTE - CLOSE_
UNKNOWN - LOG_
CRITICAL - LOG_
DEBUG - LOG_
ERROR - LOG_
INFO - LOG_
TRACE - LOG_
WARN
Functions§
- deserialize_
header_ map - Deserialize a LEGACY-layout header map (dwara’s
proxy_send_http_responsespelling only) back into pairs. ReturnsNoneon a truncated/corrupt buffer. The spec-named hostcalls usedeserialize_header_map_specinstead. - deserialize_
header_ map_ spec - Deserialize a spec/SDK proxy-wasm wire-layout header map (the
format
serialize_header_map_specproduces and the Rust proxy-wasm SDK’sutils::deserialize_map, hostcalls.rs ~line 1305, parses). An empty buffer is an empty map (the SDK’s convention); any truncated or corrupt buffer returnsNone(the SDK would panic on itsunwraps — the host fails the hostcall instead). - serialize_
header_ map - Serialize a list of (key, value) header pairs into dwara’s LEGACY
wire layout (dwara’s own
proxy_send_http_responsespelling only): a sequence of (u32 key_len, key bytes, u32 val_len, val bytes) tuples, big-endian. The spec-named hostcalls useserialize_header_map_specinstead. - serialize_
header_ map_ spec - Serialize a list of (key, value) header pairs into the spec/SDK
proxy-wasm wire layout (mirrors the Rust proxy-wasm SDK’s
utils::serialize_map, hostcalls.rs ~line 1265): LE u32 entry count, then the LE u32 (key_len, value_len) length table, then the NUL-terminated strings. An empty map serializes to exactly the 4-byte LE count 0 — the bytes the SDK passes forsend_http_responsewith empty headers.