Module abi

Module abi 

Source
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’s Action::Pause).
BUFFER_CALLOUT_RESPONSE_BODY
Buffer type: HTTP callout response body (proxy_get_buffer_bytes; proxy-wasm BufferType 4, what the SDK’s get_http_call_response_body reads).
BUFFER_CALLOUT_RESPONSE_HEADERS
Map type: HTTP callout response headers (proxy-wasm MapType 6, the map proxy_on_http_call_response callbacks read via proxy_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_response spelling only) back into pairs. Returns None on a truncated/corrupt buffer. The spec-named hostcalls use deserialize_header_map_spec instead.
deserialize_header_map_spec
Deserialize a spec/SDK proxy-wasm wire-layout header map (the format serialize_header_map_spec produces and the Rust proxy-wasm SDK’s utils::deserialize_map, hostcalls.rs ~line 1305, parses). An empty buffer is an empty map (the SDK’s convention); any truncated or corrupt buffer returns None (the SDK would panic on its unwraps — 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_response spelling only): a sequence of (u32 key_len, key bytes, u32 val_len, val bytes) tuples, big-endian. The spec-named hostcalls use serialize_header_map_spec instead.
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 for send_http_response with empty headers.