1
/*
2
* \brief Root interface
3
* \author Norman Feske
4
* \date 2006-05-11
5
*/
6
7
/*
8
* Copyright (C) 2006-2013 Genode Labs GmbH
9
*
10
* This file is part of the Genode OS framework, which is distributed
11
* under the terms of the GNU General Public License version 2.
12
*/
13
14
#
ifndef _INCLUDE__ROOT__ROOT_H_
15
#
define _INCLUDE__ROOT__ROOT_H_
16
17
#
include <base/exception.h>
18
#
include <base/rpc.h>
19
#
include <base/rpc_args.h>
20
#
include <base/affinity.h>
21
#
include <session/capability.h>
22
23
namespace
Genode {
24
25
struct
Root;
26
template
<
typename
>
struct
Typed_root;
27
}
28
29
30
struct
Genode::
Root
31
{
32
/*********************
33
** Exception types **
34
*********************/
35
36
class
Exception :
public
::
Genode::
Exception
{
}
;
37
class
Unavailable :
public
Exception
{
}
;
38
class
Quota_exceeded :
public
Exception
{
}
;
39
class
Invalid_args :
public
Exception
{
}
;
40
41
typedef
Rpc_in_buffer<
160
>
Session_args
;
42
typedef
Rpc_in_buffer<
160
>
Upgrade_args
;
43
44
virtual
~
Root(
)
{
}
45
46
/**
47
* Create session
48
*
49
* \throw Unavailable
50
* \throw Quota_exceeded
51
* \throw Invalid_args
52
*
53
* \return capability to new session
54
*/
55
virtual
Session_capability
session(
Session_args const
&
args
,
56
Affinity const
&
affinity
)
=
0
;
57
58
/**
59
* Extend resource donation to an existing session
60
*/
61
virtual
void
upgrade(
Session_capability
session
,
Upgrade_args const
&
args
)
=
0
;
62
63
/**
64
* Close session
65
*/
66
virtual
void
close(
Session_capability
session
)
=
0
;
67
68
69
/*********************
70
** RPC declaration **
71
*********************/
72
73
GENODE_RPC_THROW
(
Rpc_session,
Session_capability,
session,
74
GENODE_TYPE_LIST
(
Unavailable,
Quota_exceeded,
Invalid_args)
,
75
Session_args const
&
,
Affinity const
&
)
;
76
GENODE_RPC_THROW
(
Rpc_upgrade,
void,
upgrade,
77
GENODE_TYPE_LIST
(
Invalid_args)
,
78
Session_capability,
Upgrade_args const
&
)
;
79
GENODE_RPC
(
Rpc_close,
void,
close,
Session_capability)
;
80
81
GENODE_RPC_INTERFACE
(
Rpc_session,
Rpc_upgrade,
Rpc_close)
;
82
}
;
83
84
85
/**
86
* Root interface supplemented with information about the managed
87
* session type
88
*
89
* This class template is used to automatically propagate the
90
* correct session type to `Parent::announce()` when announcing
91
* a service.
92
*/
93
template
<
typename
SESSION_TYPE
>
94
struct
Genode::
Typed_root :
Root
95
{
96
typedef
SESSION_TYPE Session_type
;
97
}
;
98
99
#
endif /* _INCLUDE__ROOT__ROOT_H_ */