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;
if (!server.
registry()->register_obj(&calc,
"calc_server").is_valid())
{
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 substractions and negations.\n");
return 0;
}