2 * Copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License version 2.1 as published by the Free Software Foundation.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 * @author Lukasz Pawelczyk (l.pawelczyk@samsung.com)
21 * @brief A definition of a ContainerConfig struct
24 #ifndef LXCPP_CONTAINER_CONFIG_HPP
25 #define LXCPP_CONTAINER_CONFIG_HPP
27 #include "lxcpp/logger-config.hpp"
28 #include "lxcpp/network-config.hpp"
29 #include "lxcpp/terminal-config.hpp"
30 #include "lxcpp/provision-config.hpp"
32 #include <config/config.hpp>
33 #include <config/fields.hpp>
37 #include <sys/types.h>
43 struct ContainerConfig {
45 * Name of the container.
47 * Set: by constructor, cannot be changed afterwards.
53 * Path of the root directory of the container.
55 * Set: by contstructor, cannot be changed afterwards.
58 std::string mRootPath;
61 * Pid of the guard process.
63 * Set: automatically by the guard process itself.
69 * Pid of the container's init process.
71 * Set: automatically by the guard process.
77 * Container network configration
79 * Set: by container network config methods
82 NetworkConfig mNetwork;
85 * Argv of the container's init process to be executed.
86 * The path has to be relative to the RootPath.
91 std::vector<std::string> mInit;
94 * Logger to be configured inside the guard process. This logger
95 * reconfiguration is due to the fact that guard looses standard file
96 * descriptors and might loose access to other files by mount namespace
97 * usage. Hence an option to set some other logger that will work
98 * regardless. E.g. PersistentFile.
103 LoggerConfig mLogger;
106 * Configuration for terminal(s), from API point of view, only their number.
108 * Set: setTerminalCount()
111 TerminalsConfig mTerminals;
114 * Namespace types used to create the container
116 * Set: setNamespaces()
117 * Get: getNamespaces()
122 * available files/dirs/mounts/links
124 * Set: by container provision manipulation methods
125 * Get: getFiles(), getMounts(), getLinks()
127 ProvisionConfig mProvisions;
129 ContainerConfig() : mGuardPid(-1), mInitPid(-1), mNamespaces(0) {}
149 #endif // LXCPP_CONTAINER_CONFIG_HPP