Commit graph

6 commits

Author SHA1 Message Date
Jo-Philipp Wich
8c852b656b ucode: write ucode runtime exceptions to stderr
Write unhandled exceptions in invoked ucode method handlers to stderr in
order to simplify debugging failing scripts.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-09-21 23:25:00 +02:00
Jo-Philipp Wich
e80d0b2d77 ucode: pass-through ubus_rpc_session argument
Allow the special `ubus_rpc_session` method call argument even if it is not
specified in the policy.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-09-12 15:36:14 +02:00
Jo-Philipp Wich
0d02243086 ucode: initialize module search path early
Ensure that the default module search path is initialized before compiling
ucode handler scripts in order to support compile time import statements.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-09-12 13:46:18 +02:00
Jo-Philipp Wich
ae5afea283 ucode: parse ucode plugin scripts in raw mode, init search path
It makes little sense to execute rpcd ucode plugin scripts in template
mode since those scripts are supposed to output structured JSON data,
so change the parse config to compile scripts in raw mode.

Also initialize the default library search path which is required in
recent ucode versions.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-08-12 21:14:27 +02:00
Jo-Philipp Wich
909f2a0476 ucode: adjust to latest ucode api
The public libucode api has been revised to return and expect an
uc_program_t pointer instead of a main function reference.

The program (former main function) is also not implicitly released
by uc_vm_execute() anymore.

Adjust the ucode plugin accordingly to match the new requirements.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-02-07 09:55:20 +01:00
Jo-Philipp Wich
4c532bfed2 ucode: add ucode interpreter plugin
The rpcd ucode plugin allows utilizing ucode scripts to register ubus
objects and to implement the objects method callbacks.

Upon startup, rpcd will compile and execute each ucode script in
`$INSTALL_PREFIX/share/ucode/` and register ubus proxy objects and
methods definitions according to the signature returned by the script.

Refer to examples/ucode/example-plugin.uc for details of the signature
format.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-12-08 20:09:24 +01:00