4 * Copyright (C) 2016, 2024 Kernkonzept GmbH.
5 * Author(s): Sarah Hoffmann <sarah.hoffmann@kernkonzept.com>
7 * License: see LICENSE.spdx (in this directory or the directories above)
11#include <l4/sys/cxx/ipc_epiface>
12#include <l4/sys/cxx/ipc_string>
14namespace L4Re { namespace Ned {
17 * Direct control interface for Ned.
19class Cmd_control : public L4::Kobject_0t<Cmd_control>
21 L4_INLINE_RPC_NF(long, execute, (L4::Ipc::String<> cmd,
22 L4::Ipc::Array<char> &result));
26 * Execute the given Lua code.
28 * \param[in] cmd String with Lua code to execute.
30 * \retval L4_EOK Code was successfully executed.
31 * \retval -L4_EINVAL Code could not be parsed.
32 * \retval -L4_EIO Error during code execution.
34 * The code is executed using the global Lua state of ned
35 * which is retained between successive calls to execute.
36 * Thus you may define data in one call to execute and use
37 * it in a subsequent call.
39 * This function does not return any results from the execution
40 * of the Lua code itself.
42 long execute(L4::Ipc::String<> cmd) noexcept
44 L4::Ipc::Array<char> res(0, NULL);
45 return execute_t::call(c(), cmd, res);
49 * Execute the given Lua code.
51 * \param[in] cmd String with Lua code to execute.
52 * \param[out] result The first return value of the Lua code block
55 * \retval L4_EOK Code was successfully executed.
56 * \retval -L4_EINVAL Code could not be parsed.
57 * \retval -L4_EIO Error during code execution.
59 * The code is executed using the global Lua state of ned
60 * which is retained between successive calls to execute.
61 * Thus you may define data in one call to execute and use
62 * it in a subsequent call.
64 long execute(L4::Ipc::String<> cmd,
65 L4::Ipc::String<char> *result) noexcept
67 L4::Ipc::Array<char> res(result->length, result->data);
68 long r = execute_t::call(c(), cmd, res);
70 result->length = res.length;
74 typedef L4::Typeid::Rpcs<execute_t> Rpcs;