L4Re - L4 Runtime Environment
ipc_gate
Go to the documentation of this file.
1 // vi:set ft=cpp: -*- Mode: C++ -*-
2 /**
3  * \file
4  * The C++ IPC gate interface.
5  */
6 /*
7  * (c) 2009-2010 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
8  * Alexander Warg <warg@os.inf.tu-dresden.de>
9  * economic rights: Technische Universit├Ąt Dresden (Germany)
10  *
11  * This file is part of TUD:OS and distributed under the terms of the
12  * GNU General Public License 2.
13  * Please see the COPYING-GPL-2 file for details.
14  *
15  * As a special exception, you may use this file as part of a free software
16  * library without restriction. Specifically, if other files instantiate
17  * templates or use macros or inline functions from this file, or you compile
18  * this file and link it with other files to produce an executable, this
19  * file does not by itself cause the resulting executable to be covered by
20  * the GNU General Public License. This exception does not however
21  * invalidate any other reasons why the executable file might be covered by
22  * the GNU General Public License.
23  */
24 #pragma once
25 
26 #include <l4/sys/ipc_gate.h>
27 #include <l4/sys/capability>
28 #include <l4/sys/rcv_endpoint>
29 #include <l4/sys/cxx/ipc_iface>
30 
31 namespace L4 {
32 
33 class Thread;
34 
35 /**
36  * The C++ IPC gate interface.
37  *
38  * IPC gates are used to create secure communication channels between
39  * protection domains. An IPC gate can be created using the L4::Factory
40  * interface. L4::Ipc_gate::bind_thread() binds an L4::Thread as the receiver
41  * of all messages to an IPC gate.
42  *
43  * The bind_thread() call allows to assign each IPC gate a kernel protected,
44  * machine-word sized payload called a *label*. It securely identifies the
45  * gate. The two least significant bits of the *label* are ORed with the
46  * L4_CAP_FPAGE_S and L4_CAP_FPAGE_W bits stored in the capability when
47  * transfered to the receiver. This means the *label* should usually have its
48  * two least significant bits set to zero. The *label* is only visible in the
49  * #L4::Task which is running the thread the IPC gate was bound to and cannot
50  * be altered by the sender.
51  *
52  * \includefile{l4/sys/ipc_gate}
53  *
54  * For the C interface refer to the C \ref l4_kernel_object_gate_api.
55  */
56 class L4_EXPORT Ipc_gate :
57  public Kobject_t<Ipc_gate, Rcv_endpoint, L4_PROTO_KOBJECT,
58  Type_info::Demand_t<1> >
59 {
60 public:
61  /**
62  * Get information about the IPC-gate.
63  *
64  * \param[out] label The label of the IPC gate is returned here.
65  *
66  * \return System call return tag.
67  */
68  L4_INLINE_RPC_OP(L4_IPC_GATE_GET_INFO_OP,
69  l4_msgtag_t, get_infos, (l4_umword_t *label));
70 
71  typedef L4::Typeid::Rpcs_sys<bind_thread_t, get_infos_t> Rpcs;
72 };
73 
74 }