28#include <l4/sys/cxx/ipc_server_loop>
36namespace L4Re {
namespace Util {
60 struct Null_handler :
L4::Epiface_t<Null_handler, L4::Kobject>
69 Null_handler _null_handler;
79 : _server(
L4Re::
Env::env()->main_thread()),
80 _factory(
L4Re::
Env::env()->factory()),
95 : _server(server), _factory(factory), _sif(sif)
104 Demand
const &demand)
115 err =
l4_error(ep->bind_thread(_server,
id));
123 Demand
const &demand)
129 return _register_ep(o, cap, demand);
138 auto cap = L4Re::Util::make_unique_cap<L4::Kobject>();
144 err =
l4_error(_factory->create_gate(cap.get(), _server,
id));
152 return cap.release();
156 Demand
const &demand)
162 auto cap = L4Re::Util::make_unique_cap<L4::Irq>();
168 err =
l4_error(_factory->create(cap.get()));
176 err =
l4_error(cap->bind_thread(_server,
id));
180 return cap.release();
187 static Demand _get_buffer_demand(T *,
207 return _register_ep(o, service, _get_buffer_demand(o));
224 return _register_gate(o, _get_buffer_demand(o));
240 return _register_irq(o, _get_buffer_demand(o));
262 return _register_ep(o, ep, _get_buffer_demand(o));
278 L4::Epiface::Stored_cap c;
280 if (!o || !o->
obj_cap().is_valid())
293 _server->modify_senders(todo);
306template<
typename LOOP_HOOKS = L4::Ipc_svr::Default_loop_hooks >
333 : _registry(this, server, factory)
344 : _registry(this, server, factory)
359 { Base::template loop<L4::Runtime_error, Object_registry &>(_registry, utcb); }
C++ interface of the initial environment that is provided to an L4 task.
static Env const * env() noexcept
Returns the initial environment for the current task.
L4::Cap< T > get_cap(char const *name, unsigned l) const noexcept
Get the capability selector for the object named name.
A registry that manages server objects and their attached IPC gates for a single server loop for a sp...
L4::Cap< L4::Rcv_endpoint > register_obj(L4::Epiface *o, L4::Cap< L4::Rcv_endpoint > ep) override
Register a handler for an already existing interrupt.
L4::Cap< L4::Irq > register_irq_obj(L4::Epiface *o) override
Register a handler for an interrupt.
L4::Cap< void > register_obj(L4::Epiface *o, char const *service) override
Register a new server object to a pre-allocated receive endpoint.
L4::Cap< void > register_obj(L4::Epiface *o) override
Register a new server object on a newly allocated capability.
Object_registry(L4::Ipc_svr::Server_iface *sif, L4::Cap< L4::Thread > server, L4::Cap< L4::Factory > factory)
Create a registry for arbitrary threads.
Object_registry(L4::Ipc_svr::Server_iface *sif)
Create a registry for the main thread of the task using the default factory.
void unregister_obj(L4::Epiface *o, bool unmap=true) override
Remove a server object from the handler list.
A server loop object which has a Object_registry included.
Object_registry const * registry() const
Return registry of this server loop.
void L4_NORETURN loop(l4_utcb_t *utcb=l4_utcb())
Start the server loop.
Registry_server(L4::Cap< L4::Thread > server, L4::Cap< L4::Factory > factory)
Create a new server loop object for an arbitrary thread and factory.
Registry_server(l4_utcb_t *, L4::Cap< L4::Thread > server, L4::Cap< L4::Factory > factory)
Create a new server loop object for an arbitrary thread and factory.
Registry_server()
Create a new server loop object for the main thread of the task.
Object_registry * registry()
Return registry of this server loop.
This registry returns the corresponding server object based on the label of an Ipc_gate.
bool is_valid() const noexcept
Test whether the capability is a valid capability index (i.e., not L4_INVALID_CAP).
C++ interface for capabilities.
Interface for server-loop related functions.
L4::Type_info::Demand Demand
Data type expressing server-side demand for receive buffers.
virtual int alloc_buffer_demand(Demand const &demand)=0
Tells the server to allocate buffers for the given demand.
Interface for kernel objects that allow to receive IPC from them.
Abstract interface for object registries.
virtual L4::Cap< L4::Irq > register_irq_obj(L4::Epiface *o)=0
Register o as server-side object for asynchronous IRQs.
Basic server loop for handling client requests.
Class wrapping a list of rules which modify the sender label of IPC messages inbound to this thread.
int add(l4_umword_t match_mask, l4_umword_t match, l4_umword_t del_bits, l4_umword_t add_bits) noexcept
Add a rule.
Common factory related definitions.
unsigned long l4_umword_t
Unsigned machine word.
long l4_error(l4_msgtag_t tag) L4_NOTHROW
Get IPC error code if any or message tag label otherwise for an IPC call.
@ L4_FP_ALL_SPACES
Flag to tell the unmap operation to revoke permissions from all child mappings including the mapping ...
struct l4_utcb_t l4_utcb_t
Opaque type for the UTCB.
l4_utcb_t * l4_utcb(void) L4_NOTHROW L4_PURE
Get the UTCB address.
_Cap_alloc & cap_alloc
Capability allocator.
#define L4_NORETURN
Noreturn function attribute.
#define L4_DEPRECATED(s)
Mark symbol deprecated.
The C++ IPC gate interface.
Epiface implementation for Kobject-based interface implementations.
Base class for interface implementations.
Stored_cap obj_cap() const
Get the capability to the kernel object belonging to this object.
virtual Demand get_buffer_demand() const =0
Get the server-side receive buffer demand for this object.
int set_server(Server_iface *srv, Cap< void > cap, bool managed=false)
Set server registration info for the object.
T::__Kobject_typeid::Demand Demand
Data type expressing the static demand of receive buffers in a server.
Common thread related definitions.
Common task related definitions.
Unique_cap / Unique_del_cap.