genode/repos/base/src/include/base/internal/ipc_server.h

70 lines
1.6 KiB
C++

/*
* \brief IPC server
* \author Norman Feske
* \date 2016-03-16
*/
/*
* Copyright (C) 2016-2017 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
#ifndef _INCLUDE__BASE__INTERNAL__IPC_SERVER_H_
#define _INCLUDE__BASE__INTERNAL__IPC_SERVER_H_
/* Genode includes */
#include <base/stdint.h>
#include <base/ipc.h>
#include <base/rpc_server.h>
namespace Genode {
struct Ipc_server;
/**
* Send reply to caller
*/
void ipc_reply(Native_capability caller, Rpc_exception_code,
Msgbuf_base &snd_msg);
typedef Native_capability Reply_capability;
struct Rpc_request
{
Reply_capability caller { };
unsigned long badge = ~0;
Rpc_request() { }
Rpc_request(Reply_capability caller, unsigned long badge)
: caller(caller), badge(badge) { }
};
/**
* Send result of previous RPC request and wait for new one
*/
Rpc_request ipc_reply_wait(Reply_capability const &caller,
Rpc_exception_code reply_exc,
Msgbuf_base &reply_msg,
Msgbuf_base &request_msg,
Rpc_entrypoint::Native_context &native_context);
}
class Genode::Ipc_server : public Native_capability
{
private:
Rpc_entrypoint::Native_context& _native_context;
public:
Ipc_server(Rpc_entrypoint::Native_context& native_context);
~Ipc_server();
};
#endif /* _INCLUDE__BASE__INTERNAL__IPC_SERVER_H_ */