@@ -74,6 +74,7 @@ plugin:
74
74
75
75
* `validateConfiguration`: May be called to validate the configuration data that
76
76
will be passed to a plugin on startup, e.g. in the control plane.
77
+ * `onCreate`: called when context is created.
77
78
* `onStart`: called on plugin start.
78
79
* `onConfigure`: called on plugin start, and any time configuration subsequently
79
80
changes.
@@ -371,6 +372,22 @@ for representing and updating metrics:
371
372
Metrics can be subdivided by tags, using similar structure to [Envoy
372
373
statistics](https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/observability/statistics).
373
374
375
+ ## Foreign function interface (FFI)
376
+
377
+ Hosts can make additional hostcalls available for plugins to call via the
378
+ foreign function interface. Plugin code can invoke such hostcalls via the
379
+ `proxy_call_foreign_function` hostcall defined in [proxy_wasm_externs.h], which
380
+ specifies the foreign hostcall to invoke by a string name.
381
+
382
+ Hosts can also invoke callbacks for events outside of those defined by the
383
+ Proxy-Wasm spec, which are dispatched to the plugin via calls to
384
+ `ContextBase::onForeignFunction`. These calls use an integer function ID to
385
+ identify the foreign callback to invoke.
386
+
387
+ With both foreign hostcalls and callbacks, the plugin and host must agree
388
+ out-of-band on what hostcalls/callbacks will be available. For API details, see
389
+ associated doc comments in [proxy_wasm_externs.h] and [proxy_wasm_api.h].
390
+
374
391
## Example
375
392
376
393
Some of the concepts and APIs described above are illustrated by the example
@@ -430,10 +447,9 @@ The main files containing the Proxy-Wasm C++ SDK API and implementation are
430
447
listed below:
431
448
432
449
* [ proxy_wasm_api.h] : main SDK API definition and implementation
450
+ * [ proxy_wasm_externs.h] : declarations for ABI-level hostcalls and callbacks
433
451
* [ proxy_wasm_common.h] ( ../proxy_wasm_common.h ) : supporting types for the API
434
452
* [ proxy_wasm_enums.h] ( ../proxy_wasm_enums.h ) : supporting enums for the API
435
- * [ proxy_wasm_externs.h] ( ../proxy_wasm_externs.h ) : declarations for ABI-level
436
- hostcalls and callbacks
437
453
* [ proxy_wasm_intrinsics.js] ( ../proxy_wasm_intrinsics.js ) : list of Proxy-Wasm
438
454
ABI hostcalls, for use by [ Emscripten] ( https://emscripten.org )
439
455
* [ proxy_wasm_intrinsics.proto] ( ../proxy_wasm_intrinsics.proto ) : protobuf types
@@ -451,4 +467,5 @@ listed below:
451
467
[ HTTP callouts ] : #http-callouts
452
468
[ gRPC callouts ] : #grpc-callouts
453
469
[ proxy_wasm_api.h ] : ../proxy_wasm_api.h
470
+ [ proxy_wasm_externs.h ] : ../proxy_wasm_externs.h
454
471
[ http_wasm_example.cc ] : ../example/http_wasm_example.cc
0 commit comments