2012-05-30 18:13:09 +00:00
|
|
|
/*
|
|
|
|
* \brief Signal session interface
|
|
|
|
* \author Martin Stein
|
|
|
|
* \date 2012-05-05
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2013-01-10 20:44:47 +00:00
|
|
|
* Copyright (C) 2012-2013 Genode Labs GmbH
|
2012-05-30 18:13:09 +00:00
|
|
|
*
|
|
|
|
* This file is part of the Genode OS framework, which is distributed
|
|
|
|
* under the terms of the GNU General Public License version 2.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _INCLUDE__SIGNAL_SESSION__SIGNAL_SESSION_H_
|
|
|
|
#define _INCLUDE__SIGNAL_SESSION__SIGNAL_SESSION_H_
|
|
|
|
|
|
|
|
/* Genode includes */
|
|
|
|
#include <base/capability.h>
|
|
|
|
#include <base/exception.h>
|
|
|
|
#include <session/session.h>
|
|
|
|
|
|
|
|
namespace Genode
|
|
|
|
{
|
|
|
|
class Signal_receiver;
|
|
|
|
class Signal_context;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The 'dst' of this cap is used to communicate the ID of the
|
|
|
|
* corresponding signal-receiver kernel-object or 0 if the cap is invalid.
|
|
|
|
*/
|
|
|
|
typedef Capability<Signal_receiver> Signal_receiver_capability;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The 'dst' of this cap is used to communicate the ID of the
|
|
|
|
* corresponding signal-context kernel-object or 0 if the cap is invalid.
|
|
|
|
*/
|
|
|
|
typedef Capability<Signal_context> Signal_context_capability;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Signal session interface
|
|
|
|
*/
|
|
|
|
struct Signal_session : Session
|
|
|
|
{
|
|
|
|
class Out_of_metadata : public Exception { };
|
|
|
|
|
|
|
|
/**
|
|
|
|
* String that can be used to refer to this service
|
|
|
|
*/
|
|
|
|
static const char * service_name() { return "SIGNAL"; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Destructor
|
|
|
|
*/
|
|
|
|
virtual ~Signal_session() { }
|
|
|
|
|
|
|
|
/**
|
2013-09-11 21:30:57 +00:00
|
|
|
* Create and manage a new signal receiver
|
2012-05-30 18:13:09 +00:00
|
|
|
*
|
|
|
|
* \return a cap that acts as reference to the created object
|
|
|
|
*
|
|
|
|
* \throw Out_of_metadata
|
2013-09-11 21:30:57 +00:00
|
|
|
* \throw Exception
|
2012-05-30 18:13:09 +00:00
|
|
|
*/
|
|
|
|
virtual Signal_receiver_capability alloc_receiver() = 0;
|
|
|
|
|
|
|
|
/**
|
2013-09-11 21:30:57 +00:00
|
|
|
* Create and manage a new signal context
|
2012-05-30 18:13:09 +00:00
|
|
|
*
|
|
|
|
* \param r names the signal receiver that shall provide
|
|
|
|
* the new context
|
|
|
|
* \param imprint every signal that occures on the new context gets
|
|
|
|
* signed with this value
|
|
|
|
*
|
|
|
|
* \return a cap that acts as reference to the created object
|
|
|
|
*
|
|
|
|
* \throw Out_of_metadata
|
2013-09-11 21:30:57 +00:00
|
|
|
* \throw Exception
|
2012-05-30 18:13:09 +00:00
|
|
|
*/
|
|
|
|
virtual Signal_context_capability
|
2013-09-11 21:30:57 +00:00
|
|
|
alloc_context(Signal_receiver_capability r,
|
2012-12-19 13:46:48 +00:00
|
|
|
unsigned const imprint) = 0;
|
2012-05-30 18:13:09 +00:00
|
|
|
|
2013-02-18 12:58:09 +00:00
|
|
|
/**
|
2013-09-11 21:30:57 +00:00
|
|
|
* Free a signal context
|
2013-02-18 12:58:09 +00:00
|
|
|
*
|
|
|
|
* \param cap capability of signal-context to release
|
2013-09-11 21:30:57 +00:00
|
|
|
*
|
|
|
|
* \throw Exception
|
2013-02-18 12:58:09 +00:00
|
|
|
*/
|
|
|
|
virtual void free_context(Signal_context_capability cap) = 0;
|
|
|
|
|
2013-09-11 21:30:57 +00:00
|
|
|
|
2012-05-30 18:13:09 +00:00
|
|
|
/*********************
|
|
|
|
** RPC declaration **
|
|
|
|
*********************/
|
|
|
|
|
|
|
|
GENODE_RPC_THROW(Rpc_alloc_receiver, Signal_receiver_capability,
|
2013-09-11 21:30:57 +00:00
|
|
|
alloc_receiver, GENODE_TYPE_LIST(Out_of_metadata,
|
|
|
|
Exception));
|
2012-05-30 18:13:09 +00:00
|
|
|
GENODE_RPC_THROW(Rpc_alloc_context, Signal_context_capability,
|
2013-09-11 21:30:57 +00:00
|
|
|
alloc_context, GENODE_TYPE_LIST(Out_of_metadata,
|
|
|
|
Exception), Signal_receiver_capability, unsigned);
|
|
|
|
GENODE_RPC_THROW(Rpc_free_context, void, free_context,
|
|
|
|
GENODE_TYPE_LIST(Exception),
|
|
|
|
Signal_context_capability);
|
2012-05-30 18:13:09 +00:00
|
|
|
|
2013-02-18 12:58:09 +00:00
|
|
|
GENODE_RPC_INTERFACE(Rpc_alloc_receiver, Rpc_alloc_context,
|
|
|
|
Rpc_free_context);
|
2012-05-30 18:13:09 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* _INCLUDE__SIGNAL_SESSION__SIGNAL_SESSION_H_ */
|
|
|
|
|