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 Mateusz Malicki (m.malicki2@samsung.com)
21 * @brief ContainerImpl definition
24 #include "lxcpp/container-impl.hpp"
25 #include "lxcpp/exception.hpp"
26 #include "lxcpp/process.hpp"
27 #include "lxcpp/filesystem.hpp"
28 #include "lxcpp/namespace.hpp"
29 #include "lxcpp/capability.hpp"
30 #include "lxcpp/commands/attach-manager.hpp"
32 #include "utils/exception.hpp"
35 #include <sys/mount.h>
39 ContainerImpl::ContainerImpl()
43 ContainerImpl::~ContainerImpl()
47 std::string ContainerImpl::getName()
49 throw NotImplementedException();
52 void ContainerImpl::setName(const std::string& /* name */)
54 throw NotImplementedException();
57 void ContainerImpl::start()
59 throw NotImplementedException();
62 void ContainerImpl::stop()
64 throw NotImplementedException();
67 void ContainerImpl::freeze()
69 throw NotImplementedException();
72 void ContainerImpl::unfreeze()
74 throw NotImplementedException();
77 void ContainerImpl::reboot()
79 throw NotImplementedException();
82 pid_t ContainerImpl::getInitPid() const
87 void ContainerImpl::create()
89 throw NotImplementedException();
92 void ContainerImpl::destroy()
94 throw NotImplementedException();
97 void ContainerImpl::setRootPath(const std::string& /* path */)
99 throw NotImplementedException();
102 std::string ContainerImpl::getRootPath()
104 throw NotImplementedException();
107 void ContainerImpl::attach(Container::AttachCall& call,
108 const std::string& cwdInContainer)
110 AttachManager attachManager(*this);
111 // TODO: Env variables should agree with the ones already in the container
112 attachManager.attach(call,
116 /*envInContainer*/{{"container","lxcpp"}} );
119 const std::vector<Namespace>& ContainerImpl::getNamespaces() const
125 void ContainerImpl::addInterfaceConfig(const std::string& hostif,
126 const std::string& zoneif,
130 mInterfaceConfig.push_back(NetworkInterfaceConfig(hostif,zoneif,type,mode));
133 void ContainerImpl::addAddrConfig(const std::string& /*ifname*/, const InetAddr& /*addr*/)
135 throw NotImplementedException();
138 std::vector<std::string> ContainerImpl::getInterfaces()
140 return NetworkInterface::getInterfaces(getInitPid());
143 NetworkInterfaceInfo ContainerImpl::getInterfaceInfo(const std::string& /*ifname*/)
145 throw NotImplementedException();
148 void ContainerImpl::createInterface(const std::string& hostif,
149 const std::string& zoneif,
153 NetworkInterface ni(*this, zoneif);
154 ni.create(hostif, type, mode);
157 void ContainerImpl::destroyInterface(const std::string& /*ifname*/)
159 throw NotImplementedException();
162 void ContainerImpl::setUp(const std::string& /*ifname*/)
164 throw NotImplementedException();
167 void ContainerImpl::setDown(const std::string& /*ifname*/)
169 throw NotImplementedException();
172 void ContainerImpl::addAddr(const std::string& /*ifname*/, const InetAddr& /*addr*/)
174 throw NotImplementedException();
177 void ContainerImpl::delAddr(const std::string& /*ifname*/, const InetAddr& /*addr*/)
179 throw NotImplementedException();