Loading...
Searching...
No Matches
ipc_server
Go to the documentation of this file.
// vi:set ft=cpp: -*- Mode: C++ -*-
/*
* (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
* Alexander Warg <warg@os.inf.tu-dresden.de>,
* Torsten Frenzel <frenzel@os.inf.tu-dresden.de>
* economic rights: Technische Universität Dresden (Germany)
*
* License: see LICENSE.spdx (in this directory or the directories above)
*/
#pragma once
#include <l4/sys/capability>
#include <l4/sys/typeinfo_svr>
#include <l4/sys/err.h>
#include <l4/cxx/ipc_stream>
#include <l4/sys/cxx/ipc_epiface>
#include <l4/sys/cxx/ipc_server_loop>
#include <l4/cxx/type_traits>
#include <l4/cxx/exceptions>
namespace L4 {
class Server_object : public Epiface
{
public:
virtual int dispatch(unsigned long rights, Ipc::Iostream &ios) = 0;
l4_msgtag_t dispatch(l4_msgtag_t tag, unsigned rights, l4_utcb_t *utcb) override
{
L4::Ipc::Iostream ios(utcb);
ios.tag() = tag;
int r = dispatch(rights, ios);
return ios.prepare_ipc(r);
}
Cap<Kobject> obj_cap() const
{ return cap_cast<Kobject>(Epiface::obj_cap()); }
};
template<typename IFACE, typename BASE = L4::Server_object>
struct Server_object_t : BASE
{
typedef IFACE Interface;
typename BASE::Demand get_buffer_demand() const override
{ return typename L4::Kobject_typeid<IFACE>::Demand(); }
int dispatch_meta_request(L4::Ipc::Iostream &ios)
{ return L4::Util::handle_meta_request<IFACE>(ios); }
template<typename THIS>
static int proto_dispatch(THIS *self, l4_umword_t rights, L4::Ipc::Iostream &ios)
{
l4_msgtag_t t;
ios >> t;
return Kobject_typeid<IFACE>::proto_dispatch(self, t.label(), rights, ios);
}
};
template<typename Derived, typename IFACE, typename BASE = L4::Server_object>
struct Server_object_x : Server_object_t<IFACE, BASE>
{
int dispatch(l4_umword_t r, L4::Ipc::Iostream &ios)
{
return Server_object_t<IFACE, BASE>::proto_dispatch(static_cast<Derived *>(this),
r, ios);
}
};
struct Irq_handler_object : Server_object_t<Kobject> {};
}
capability
L4::Cap related definitions.
L4::Cap
C++ interface for capabilities.
Definition capability.h:224
L4::Ipc::Iostream
Input/Output stream for IPC [un]marshalling.
Definition ipc_stream:790
L4::Server_object
Abstract server object to be used with L4::Server and L4::Basic_registry.
Definition ipc_server:39
L4::Server_object::dispatch
virtual int dispatch(unsigned long rights, Ipc::Iostream &ios)=0
The abstract handler for client requests to the object.
L4::Server_object::dispatch
l4_msgtag_t dispatch(l4_msgtag_t tag, unsigned rights, l4_utcb_t *utcb) override
The abstract handler for client requests to the object.
Definition ipc_server:60
err.h
Error codes.
exceptions
Base exceptions.
l4_umword_t
unsigned long l4_umword_t
Unsigned machine word.
Definition l4int.h:40
l4_utcb_t
struct l4_utcb_t l4_utcb_t
Opaque type for the UTCB.
Definition utcb.h:56
ipc_stream
IPC stream.
L4
L4 low-level kernel interface.
Definition l4sys-l4f-groups.dox:50
L4::cap_cast
Cap< T > cap_cast(Cap< F > const &c) noexcept
static_cast for capabilities.
Definition capability.h:416
L4::Epiface::obj_cap
Stored_cap obj_cap() const
Get the capability to the kernel object belonging to this object.
Definition ipc_epiface:206
L4::Irq_handler_object
Server object base class for handling IRQ messages.
Definition ipc_server:161
L4::Kobject_typeid::proto_dispatch
static int proto_dispatch(THIS *self, long proto, A1 a1, A2 &a2)
Protocol based server-side dispatch function.
Definition __typeinfo.h:660
L4::Kobject_typeid::Demand
T::__Kobject_typeid::Demand Demand
Data type expressing the static demand of receive buffers in a server.
Definition __typeinfo.h:622
L4::Server_object_t
Base class (template) for server implementing server objects.
Definition ipc_server:81
L4::Server_object_t::proto_dispatch
static int proto_dispatch(THIS *self, l4_umword_t rights, L4::Ipc::Iostream &ios)
Implementation of protocol-based dispatch for this server object.
Definition ipc_server:114
L4::Server_object_t::dispatch_meta_request
int dispatch_meta_request(L4::Ipc::Iostream &ios)
Implementation of the meta protocol based on IFACE.
Definition ipc_server:99
L4::Server_object_t::Interface
IFACE Interface
Data type of the IPC interface definition.
Definition ipc_server:83
L4::Server_object_t::get_buffer_demand
BASE::Demand get_buffer_demand() const override
Definition ipc_server:86
L4::Server_object_x
Helper class to implement p_dispatch based server objects.
Definition ipc_server:144
L4::Server_object_x::dispatch
int dispatch(l4_umword_t r, L4::Ipc::Iostream &ios)
Implementation forwarding to p_dispatch().
Definition ipc_server:146
l4_msgtag_t
Message tag data structure.
Definition types.h:154
l4_msgtag_t::label
long label() const L4_NOTHROW
Get the protocol value.
Definition types.h:158
typeinfo_svr
Type information server template.