Client/Server example using C++ infrastructure – Server implementation.
Client/Server example using C++ infrastructure – Server implementation.
#include <stdio.h>
#include <l4/re/util/object_registry>
#include <l4/re/util/br_manager>
#include <l4/sys/cxx/ipc_epiface>
#include "shared.h"
class Calculation_server :
public L4::Epiface_t<Calculation_server, Calc>
{
public:
{
res = a - b;
return 0;
}
{
res = -a;
return 0;
}
};
int
main()
{
static Calculation_server calc;
{
printf("Could not register my service, is there a 'calc_server' in the caps table?\n");
return 1;
}
printf("Welcome to the calculation server!\n"
"I can do subtractions and negations.\n");
return 0;
}
L4::Cap< void > register_obj(L4::Epiface *o, char const *service) override
Register a new server object to a pre-allocated receive endpoint.
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.
unsigned int l4_uint32_t
Unsigned 32bit value.
Epiface implementation for Kobject-based interface implementations.