1 /*
2  * (c) 2008-2009 Alexander Warg <warg@os.inf.tu-dresden.de>
3  *     economic rights: Technische Universität Dresden (Germany)
4  *
5  * This file is part of TUD:OS and distributed under the terms of the
6  * GNU General Public License 2.
7  * Please see the COPYING-GPL-2 file for details.
8  */
9 #pragma once
10 
11 #include <l4/cxx/hlist>
12 #include <l4/cxx/weak_ref>
13 #include <l4/sys/cxx/ipc_epiface>
14 
15 
16 namespace Moe
17 {
18 
19 class Server_object
20 : public L4::Epiface,
21   public cxx::H_list_item_t<Server_object>
22 {
23 public:
24   /**
25    * List of dynamic server objects.
26    *
27    * The list is ordered by factory ownership. All objects that
28    * have been allocated with a given factory follow directly
29    * after the factory object in the list. This property also holds
30    * recursively.
31    */
32   typedef cxx::H_list_t<Server_object> Obj_list;
33 
34   virtual ~Server_object();
35 
36   void add_weak_ref(cxx::Weak_ref_base *obj) const;
37   void remove_weak_ref(cxx::Weak_ref_base *obj) const;
38 
39 private:
40   mutable cxx::Weak_ref_base::List _weak_ptrs;
41   mutable L4::Cap<void> _weak_cap;
42 };
43 
44 /**
45  * Handler class for stale requests from servers that have been
46  * deregistered.
47  */
48 struct Null_handler : L4::Epiface_t<Null_handler, L4::Kobject>
49 {};
50 
51 } // namespace
52