sbuild  1.7.1
loopback.h
1 /* Copyright © 2005-2013 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_LOOPBACK_H
20 #define SBUILD_CHROOT_FACET_LOOPBACK_H
21 
22 #include <sbuild/chroot/chroot.h>
23 #include <sbuild/chroot/facet/facet.h>
24 #include <sbuild/chroot/facet/session-setup.h>
25 #include <sbuild/chroot/facet/storage.h>
26 
27 namespace sbuild
28 {
29  namespace chroot
30  {
31  namespace facet
32  {
33 
39  class loopback : public facet,
40  public storage,
41  public session_setup
42  {
43  public:
46 
48  typedef std::shared_ptr<loopback> ptr;
49 
51  typedef std::shared_ptr<const loopback> const_ptr;
52 
53  protected:
55  loopback ();
56 
58  loopback (const loopback& rhs);
59 
60  void
62  bool copy);
63 
64  friend class chroot;
65 
66  public:
68  virtual ~loopback ();
69 
70  virtual std::string const&
71  get_name () const;
72 
78  static ptr
79  create ();
80 
82  clone () const;
83 
89  std::string const&
90  get_filename () const;
91 
97  void
98  set_filename (const std::string& filename);
99 
100  virtual std::string
101  get_path () const;
102 
103  virtual void
104  setup_env (environment& env) const;
105 
106  protected:
107  virtual void
108  setup_lock (chroot::setup_type type,
109  bool lock,
110  int status);
111 
112  virtual void
113  get_details (format_detail& detail) const;
114 
115  virtual void
116  get_used_keys (string_list& used_keys) const;
117 
118  virtual void
119  get_keyfile (keyfile& keyfile) const;
120 
121  virtual void
122  set_keyfile (const keyfile& keyfile);
123 
124  virtual void
125  chroot_session_setup (const chroot& parent,
126  const std::string& session_id,
127  const std::string& alias,
128  const std::string& user,
129  bool root);
130 
131  private:
133  std::string filename;
134  };
135 
136  }
137  }
138 }
139 
140 #endif /* SBUILD_CHROOT_FACET_LOOPBACK_H */
141 
142 /*
143  * Local Variables:
144  * mode:C++
145  * End:
146  */