1 | /* Copyright © 2005-2009 Roger Leigh <rleigh@debian.org> |
---|
2 | * |
---|
3 | * schroot is free software: you can redistribute it and/or modify it |
---|
4 | * under the terms of the GNU General Public License as published by |
---|
5 | * the Free Software Foundation, either version 3 of the License, or |
---|
6 | * (at your option) any later version. |
---|
7 | * |
---|
8 | * schroot is distributed in the hope that it will be useful, but |
---|
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
11 | * General Public License for more details. |
---|
12 | * |
---|
13 | * You should have received a copy of the GNU General Public License |
---|
14 | * along with this program. If not, see |
---|
15 | * <http://www.gnu.org/licenses/>. |
---|
16 | * |
---|
17 | *********************************************************************/ |
---|
18 | |
---|
19 | #ifndef SBUILD_CHROOT_FACET_SESSION_CLONABLE_H |
---|
20 | #define SBUILD_CHROOT_FACET_SESSION_CLONABLE_H |
---|
21 | |
---|
22 | #include <sbuild/sbuild-chroot-facet.h> |
---|
23 | |
---|
24 | namespace sbuild |
---|
25 | { |
---|
26 | |
---|
27 | /** |
---|
28 | * Chroot support for creation of sessions. |
---|
29 | * |
---|
30 | * A chroot may offer a "session" facet to signal restorable or |
---|
31 | * parallel chroot environment usage. This facet allows the chroot |
---|
32 | * to support session creation. |
---|
33 | */ |
---|
34 | class chroot_facet_session_clonable : public chroot_facet |
---|
35 | { |
---|
36 | public: |
---|
37 | /// A shared_ptr to a chroot facet object. |
---|
38 | typedef std::tr1::shared_ptr<chroot_facet_session_clonable> ptr; |
---|
39 | |
---|
40 | /// A shared_ptr to a const chroot facet object. |
---|
41 | typedef std::tr1::shared_ptr<const chroot_facet_session_clonable> const_ptr; |
---|
42 | |
---|
43 | private: |
---|
44 | /// The constructor. |
---|
45 | chroot_facet_session_clonable (); |
---|
46 | |
---|
47 | public: |
---|
48 | /// The destructor. |
---|
49 | virtual ~chroot_facet_session_clonable (); |
---|
50 | |
---|
51 | /** |
---|
52 | * Create a chroot facet. |
---|
53 | * |
---|
54 | * @returns a shared_ptr to the new chroot facet. |
---|
55 | */ |
---|
56 | static ptr |
---|
57 | create (); |
---|
58 | |
---|
59 | virtual chroot_facet::ptr |
---|
60 | clone () const; |
---|
61 | |
---|
62 | virtual std::string const& |
---|
63 | get_name () const; |
---|
64 | |
---|
65 | /** |
---|
66 | * Set the defaults in the cloned session chroot. |
---|
67 | * |
---|
68 | * @param clone the chroot to set up. |
---|
69 | * @param session_id the identifier for the new session. |
---|
70 | * @param user the user creating the session. |
---|
71 | */ |
---|
72 | virtual void |
---|
73 | clone_session_setup (chroot::ptr& clone, |
---|
74 | std::string const& session_id, |
---|
75 | std::string const& user, |
---|
76 | bool root) const; |
---|
77 | |
---|
78 | virtual void |
---|
79 | setup_env (chroot const& chroot, |
---|
80 | environment& env) const; |
---|
81 | |
---|
82 | virtual chroot::session_flags |
---|
83 | get_session_flags (chroot const& chroot) const; |
---|
84 | |
---|
85 | virtual void |
---|
86 | get_details (chroot const& chroot, |
---|
87 | format_detail& detail) const; |
---|
88 | |
---|
89 | virtual void |
---|
90 | get_keyfile (chroot const& chroot, |
---|
91 | keyfile& keyfile) const; |
---|
92 | |
---|
93 | virtual void |
---|
94 | set_keyfile (chroot& chroot, |
---|
95 | keyfile const& keyfile, |
---|
96 | string_list& used_keys); |
---|
97 | }; |
---|
98 | |
---|
99 | } |
---|
100 | |
---|
101 | #endif /* SBUILD_CHROOT_FACET_SESSION_CLONABLE_H */ |
---|
102 | |
---|
103 | /* |
---|
104 | * Local Variables: |
---|
105 | * mode:C++ |
---|
106 | * End: |
---|
107 | */ |
---|