haeberlen@ira.uka.de
#include <idl4glue.h>
#include "logger-server.h"
#include <if/iflocator.h>
#include <if/iflocator.h>
#include <stdio.h>
#include <sdi/panic.h>
#include "root.h"
namespace {
const size_t BUFSIZE = 256;
char buf1[BUFSIZE];
char buf2[BUFSIZE];
}
IDL4_INLINE void logger_LogMessage_implementation(CORBA_Object caller, const logmessage_t message, idl4_server_environment *_env)
{
L4_ThreadId_t callerid = caller;
printf("%lx: %s\n", callerid.raw, message);
}
IDL4_PUBLISH_LOGGER_LOGMESSAGE(logger_LogMessage_implementation);
void *logger_vtable_1[LOGGER_DEFAULT_VTABLE_SIZE] = LOGGER_DEFAULT_VTABLE_1;
void *logger_vtable_discard[LOGGER_DEFAULT_VTABLE_SIZE] = LOGGER_DEFAULT_VTABLE_DISCARD;
void **logger_itable[2] = { logger_vtable_discard, logger_vtable_1 };
void logger_server()
{
L4_ThreadId_t partner;
L4_MsgTag_t msgtag;
idl4_msgbuf_t msgbuf;
long cnt;
idl4_msgbuf_init(&msgbuf);
idl4_msgbuf_add_buffer(&msgbuf, buf1, BUFSIZE);
idl4_msgbuf_add_buffer(&msgbuf, buf2, BUFSIZE);
while (true) {
partner = L4_nilthread;
msgtag.raw = 0;
cnt = 0;
while (1) {
idl4_msgbuf_sync(&msgbuf);
idl4_reply_and_wait(&partner, &msgtag, &msgbuf, &cnt);
if (idl4_is_error(&msgtag))
break;
idl4_process_request(&partner, &msgtag, &msgbuf, &cnt, logger_itable[idl4_get_interface_id(&msgtag) & LOGGER_IID_MASK][idl4_get_function_id(&msgtag) & LOGGER_FID_MASK]);
}
}
}
void logger_discard()
{
panic ("logger message discarded");
}