SET(COMMON_FOLDER ${PROJECT_SOURCE_DIR}/common)
SET(LIBS_FOLDER ${PROJECT_SOURCE_DIR}/libs)
SET(LOGGER_FOLDER ${PROJECT_SOURCE_DIR}/libs/logger)
+SET(LXCPP_FOLDER ${PROJECT_SOURCE_DIR}/libs/lxcpp)
SET(DBUS_FOLDER ${PROJECT_SOURCE_DIR}/libs/dbus)
SET(CONFIG_FOLDER ${PROJECT_SOURCE_DIR}/libs/config)
SET(IPC_FOLDER ${PROJECT_SOURCE_DIR}/libs/ipc)
SET(VSM_UNIT_TESTS_IPC_SOCKET_PATH ${RUN_DIR}/vasum-ipc-unit-tests.socket)
ADD_SUBDIRECTORY(${LOGGER_FOLDER})
+ADD_SUBDIRECTORY(${LXCPP_FOLDER})
ADD_SUBDIRECTORY(${DBUS_FOLDER})
ADD_SUBDIRECTORY(${CONFIG_FOLDER})
ADD_SUBDIRECTORY(${IPC_FOLDER})
--- /dev/null
+# Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+# @file CMakeLists.txt
+# @author Mateusz Malicki (m.malicki2@samsung.com)
+#
+
+PROJECT(lxcpp)
+
+MESSAGE(STATUS "")
+MESSAGE(STATUS "Generating makefile for the liblxcpp...")
+FILE(GLOB HEADERS *.hpp)
+FILE(GLOB SRCS *.cpp *.hpp)
+
+SET(_LIB_VERSION_ "${VERSION}")
+SET(_LIB_SOVERSION_ "0")
+SET(PC_FILE "lib${PROJECT_NAME}.pc")
+
+## Setup target ################################################################
+ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES
+ SOVERSION ${_LIB_SOVERSION_}
+ VERSION ${_LIB_VERSION_}
+)
+
+## Link libraries ##############################################################
+INCLUDE_DIRECTORIES(${LIBS_FOLDER})
+
+## Generate the pc file ########################################################
+CONFIGURE_FILE(${PC_FILE}.in ${CMAKE_CURRENT_BINARY_DIR}/${PC_FILE} @ONLY)
+
+## Install #####################################################################
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PC_FILE}
+ DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+
+INSTALL(TARGETS ${PROJECT_NAME}
+ DESTINATION ${LIB_INSTALL_DIR}
+ COMPONENT RuntimeLibraries)
+
+INSTALL(FILES ${HEADERS}
+ DESTINATION ${INCLUDE_INSTALL_DIR}/lxcpp)
--- /dev/null
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Contact: Mateusz Malicki <m.malicki2@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+/**
+ * @file
+ * @author Mateusz Malicki (m.malicki2@samsung.com)
+ * @brief ContainerImpl definition
+ */
+
+#include <lxcpp/container-impl.hpp>
+#include <lxcpp/exception.hpp>
+
+namespace lxcpp {
+
+ContainerImpl::ContainerImpl()
+{
+}
+
+ContainerImpl::~ContainerImpl()
+{
+}
+
+std::string ContainerImpl::getName()
+{
+ throw NotImplemented();
+}
+
+void ContainerImpl::setName(const std::string& /* name */)
+{
+ throw NotImplemented();
+}
+
+void ContainerImpl::start()
+{
+ throw NotImplemented();
+}
+
+void ContainerImpl::stop()
+{
+ throw NotImplemented();
+}
+
+void ContainerImpl::freeze()
+{
+ throw NotImplemented();
+}
+
+void ContainerImpl::unfreeze()
+{
+ throw NotImplemented();
+}
+
+void ContainerImpl::reboot()
+{
+ throw NotImplemented();
+}
+
+int ContainerImpl::getInitPid()
+{
+ throw NotImplemented();
+}
+
+void ContainerImpl::create()
+{
+ throw NotImplemented();
+}
+
+void ContainerImpl::destroy()
+{
+ throw NotImplemented();
+}
+
+void ContainerImpl::setRootPath(const std::string& /* path */)
+{
+ throw NotImplemented();
+}
+
+std::string getRootPath()
+{
+ throw NotImplemented();
+}
+
+} // namespace lxcpp
--- /dev/null
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Contact: Mateusz Malicki <m.malicki2@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+/**
+ * @file
+ * @author Mateusz Malicki (m.malicki2@samsung.com)
+ * @brief ContainerImpl main class
+ */
+
+#ifndef LXCPP_CONTAINER_IMPL_HPP
+#define LXCPP_CONTAINER_IMPL_HPP
+
+#include <lxcpp/container.hpp>
+
+namespace lxcpp {
+
+class ContainerImpl : public virtual Container {
+public:
+ ContainerImpl();
+ ~ContainerImpl();
+
+ std::string getName();
+ void setName(const std::string& name);
+
+ //Execution actions
+ void start();
+ void stop();
+ void freeze();
+ void unfreeze();
+ void reboot();
+ int getInitPid();
+
+ //Filesystem actions
+ void create();
+ void destroy();
+ void setRootPath(const std::string& path);
+ std::string getRootPath();
+};
+
+} // namespace lxcpp
+
+#endif // LXCPP_CONTAINER_IMPL_HPP
--- /dev/null
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Contact: Mateusz Malicki <m.malicki2@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+/**
+ * @file
+ * @author Mateusz Malicki (m.malicki2@samsung.com)
+ * @brief Container interface
+ */
+
+#ifndef LXCPP_CONTAINER_HPP
+#define LXCPP_CONTAINER_HPP
+
+#include <string>
+
+namespace lxcpp {
+
+class Container {
+public:
+ virtual ~Container();
+
+ virtual std::string getName() = 0;
+ virtual void setName(const std::string& name) = 0;
+
+ //Execution actions
+ virtual void start() = 0;
+ virtual void stop() = 0;
+ virtual void freeze() = 0;
+ virtual void unfreeze() = 0;
+ virtual void reboot() = 0;
+ virtual int getInitPid() = 0;
+
+ //Filesystem actions
+ virtual void create() = 0;
+ virtual void destroy() = 0;
+ virtual void setRootPath(const std::string& path) = 0;
+ virtual std::string getRootPath() = 0;
+};
+
+} // namespace lxcpp
+
+#endif // LXCPP_CONTAINER_HPP
--- /dev/null
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Contact: Mateusz Malicki <m.malicki2@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+/**
+ * @file
+ * @author Mateusz Malicki (m.malicki2@samsung.com)
+ * @brief lxcpp's exceptions definitions
+ */
+
+#ifndef LXCPP_EXCEPTION_HPP
+#define LXCPP_EXCEPTION_HPP
+
+#include <stdexcept>
+
+namespace lxcpp {
+
+class ContainerException : std::runtime_error
+{
+public:
+ ContainerException(const std::string& what) : std::runtime_error(what) {}
+};
+
+class NotImplemented : ContainerException
+{
+public:
+ NotImplemented() : ContainerException(std::string()) {}
+};
+
+} // namespace lxcpp
+
+#endif // LXCPP_EXCEPTION_HPP
--- /dev/null
+# Package Information for pkg-config
+
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=@CMAKE_INSTALL_PREFIX@
+libdir=@LIB_INSTALL_DIR@
+includedir=@INCLUDE_INSTALL_DIR@
+
+Name: liblxcpp
+Description: Lxc library
+Version: @_LIB_VERSION_@
+Libs: -L${libdir} -llxcpp
+Cflags: -I${includedir}
--- /dev/null
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Contact: Mateusz Malicki <m.malicki2@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+/**
+ * @file
+ * @author Mateusz Malicki (m.malicki2@samsung.com)
+ * @brief lxcpp container factory definition
+ */
+
+#include <lxcpp/container-impl.hpp>
+
+namespace lxcpp {
+
+Container* createContainer()
+{
+ return new ContainerImpl();
+}
+
+} // namespace lxcpp
--- /dev/null
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Contact: Mateusz Malicki <m.malicki2@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+/**
+ * @file
+ * @author Mateusz Malicki (m.malicki2@samsung.com)
+ * @brief LXCpp factory declaration
+ */
+
+#ifndef LXCPP_LXCPP_HPP
+#define LXCPP_LXCPP_HPP
+
+#include <lxcpp/container.hpp>
+
+namespace lxcpp {
+
+Container* createContainer();
+
+} // namespace lxcpp
+
+#endif // LXCPP_LXCPP_HPP
%{_libdir}/libIpc.so
%{_includedir}/vasum-tools/ipc
%{_libdir}/pkgconfig/libIpc.pc
+
+## liblxcpp Package ###########################################################
+%package -n liblxcpp
+Summary: lxcpp library
+Group: Security/Other
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
+
+%description -n liblxcpp
+The package provides liblxcpp library.
+
+%post -n liblxcpp -p /sbin/ldconfig
+
+%postun -n liblxcpp -p /sbin/ldconfig
+
+%files -n liblxcpp
+%defattr(644,root,root,755)
+%{_libdir}/liblxcpp.so.0
+%attr(755,root,root) %{_libdir}/liblxcpp.so.%{version}
+
+%package -n liblxcpp-devel
+Summary: Development lxcpp library
+Group: Development/Libraries
+Requires: liblxcpp = %{epoch}:%{version}-%{release}
+
+%description -n liblxcpp-devel
+The package provides liblxcpp development tools and libs.
+
+%files -n liblxcpp-devel
+%defattr(644,root,root,755)
+%{_libdir}/liblxcpp.so
+%{_includedir}/lxcpp
+%{_libdir}/pkgconfig/liblxcpp.pc