aboutsummaryrefslogtreecommitdiffstats
path: root/liblfjail/jail.hh
blob: 380c63ef70a4b0a0b02598f255dfb5604b85d0f6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
 * This source code is released into the public domain.
 */

#ifndef	LFJAIL_JAIL_HH
#define	LFJAIL_JAIL_HH

#include "context.hh"

namespace lfjail {

struct jail {
	std::string name;
	std::string root_path;
};

// Fetch the configuration for a jail by name.  If the jail doesn't exist,
// returns nothing.  If another error occurs loading the config, throws
// an exception.
std::optional<jail> get_jail_config(context const &, std::string_view name);

// Write (or overwrite) the configuration for a jail by name.
void set_jail_config(context const &, jail const &);

// Return true if a jail by the given name exists.
bool jail_exists(context const &, std::string_view name);

// Destroy a jail.  This removes the configuration file and its datasets.
void jail_destroy(context const &, jail const &);

// Install packages in a jail.
void jail_install(context const &, jail const &);

// Return a list of configured jails.
std::vector<jail> jail_list(context const &);

} // namespace lfjail

#endif	// !LFJAIL_JAIL_HH