4 * Copyright (C) 2016 Kernkonzept GmbH.
5 * Author(s): Sarah Hoffmann <sarah.hoffmann@kernkonzept.com>
7 * This file is distributed under the terms of the GNU General Public
8 * License, version 2. Please see the COPYING-GPL-2 file for details.
12#include <l4/sys/cxx/ipc_epiface>
13#include <l4/sys/cxx/ipc_string>
15namespace L4Re { namespace Ned {
18 * Direct control interface for Ned.
20class Cmd_control : public L4::Kobject_0t<Cmd_control>
22 L4_INLINE_RPC_NF(long, execute, (L4::Ipc::String<> cmd,
23 L4::Ipc::Array<char> &result));
27 * Execute the given Lua code.
29 * \param[in] cmd String with Lua code to execute.
31 * \retval L4_EOK Code was successfully executed.
32 * \retval -L4_EINVAL Code could not be parsed.
33 * \retval -L4_EIO Error during code execution.
35 * The code is executed using the global Lua state of ned
36 * which is retained between successive calls to execute.
37 * Thus you may define data in one call to execute and use
38 * it in a subsequent call.
40 * This function does not return any results from the execution
41 * of the Lua code itself.
43 long execute(L4::Ipc::String<> cmd) noexcept
45 L4::Ipc::Array<char> res(0, NULL);
46 return execute_t::call(c(), cmd, res);
50 * Execute the given Lua code.
52 * \param[in] cmd String with Lua code to execute.
53 * \param[out] result The first return value of the Lua code block
56 * \retval L4_EOK Code was successfully executed.
57 * \retval -L4_EINVAL Code could not be parsed.
58 * \retval -L4_EIO Error during code execution.
60 * The code is executed using the global Lua state of ned
61 * which is retained between successive calls to execute.
62 * Thus you may define data in one call to execute and use
63 * it in a subsequent call.
65 long execute(L4::Ipc::String<> cmd,
66 L4::Ipc::String<char> *result) noexcept
68 L4::Ipc::Array<char> res(result->length, result->data);
69 long r = execute_t::call(c(), cmd, res);
71 result->length = res.length;
75 typedef L4::Typeid::Rpcs<execute_t> Rpcs;