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"
31 #include <config/config.hpp>
32 #include <config/fields.hpp>
36 #include <sys/types.h>
42 struct ContainerConfig {
44 * Name of the container.
46 * Set: by constructor, cannot be changed afterwards.
52 * Path of the root directory of the container.
54 * Set: by contstructor, cannot be changed afterwards.
57 std::string mRootPath;
60 * Pid of the guard process.
62 * Set: automatically by the guard process itself.
68 * Pid of the container's init process.
70 * Set: automatically by the guard process.
76 * Container network configration
78 * Set: by container network config methods
81 NetworkConfig mNetwork;
84 * Argv of the container's init process to be executed.
85 * The path has to be relative to the RootPath.
90 std::vector<std::string> mInit;
93 * Logger to be configured inside the guard process. This logger
94 * reconfiguration is due to the fact that guard looses standard file
95 * descriptors and might loose access to other files by mount namespace
96 * usage. Hence an option to set some other logger that will work
97 * regardless. E.g. PersistentFile.
102 LoggerConfig mLogger;
105 * Configuration for terminal(s), from API point of view, only their number.
107 * Set: setTerminalCount()
110 TerminalsConfig mTerminals;
113 * Namespace types used to create the container
115 * Set: setNamespaces()
120 ContainerConfig() : mGuardPid(-1), mInitPid(-1), mNamespaces(0) {}
139 #endif // LXCPP_CONTAINER_CONFIG_HPP