L4Re - L4 Runtime Environment
cmd_control
1 // -*- Mode: C++ -*-
2 // vim:ft=cpp
3 /*
4  * Copyright (C) 2016 Kernkonzept GmbH.
5  * Author(s): Sarah Hoffmann <sarah.hoffmann@kernkonzept.com>
6  *
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.
9  */
10 #pragma once
11 
12 #include <l4/sys/cxx/ipc_epiface>
13 #include <l4/sys/cxx/ipc_string>
14 
15 namespace L4Re { namespace Ned {
16 
20 class Cmd_control : public L4::Kobject_0t<Cmd_control>
21 {
22  L4_INLINE_RPC_NF(long, execute, (L4::Ipc::String<> cmd,
23  L4::Ipc::Array<char> &result));
24 
25 public:
43  long execute(L4::Ipc::String<> cmd) noexcept
44  {
45  L4::Ipc::Array<char> res(0, NULL);
46  return execute_t::call(c(), cmd, res);
47  }
48 
65  long execute(L4::Ipc::String<> cmd,
66  L4::Ipc::String<char> *result) noexcept
67  {
68  L4::Ipc::Array<char> res(result->length, result->data);
69  long r = execute_t::call(c(), cmd, res);
70  if (r >= 0)
71  result->length = res.length;
72  return r;
73  }
74 
76 };
77 
78 } } // namespace
Standard list of RPCs of an interface.
Definition: __typeinfo.h:438
L4Re C++ Interfaces.
Definition: backend:25
Direct control interface for Ned.
Definition: cmd_control:20
long execute(L4::Ipc::String<> cmd, L4::Ipc::String< char > *result) noexcept
Execute the given Lua code.
Definition: cmd_control:65
L4::Cap< Class > c() const
Get the capability to ourselves.
Definition: __typeinfo.h:779
Array data type for dynamically sized arrays in RPCs.
Definition: ipc_array:85
long execute(L4::Ipc::String<> cmd) noexcept
Execute the given Lua code.
Definition: cmd_control:43
#define L4_INLINE_RPC_NF(res, name, args...)
Define an inline RPC call type (the type only, no callable).
Definition: ipc_iface:429