/* * Copyright (C) 2016 Simon Fels * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranties of * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program. If not, see . * */ #ifndef ANBOX_CONTAINER_SERVICE_H_ #define ANBOX_CONTAINER_SERVICE_H_ #include "anbox/common/dispatcher.h" #include "anbox/container/container.h" #include "anbox/network/connections.h" #include "anbox/network/credentials.h" #include "anbox/network/published_socket_connector.h" #include "anbox/network/socket_connection.h" #include "anbox/runtime.h" namespace anbox { namespace container { class Service : public std::enable_shared_from_this { public: struct Configuration { bool privileged = false; bool rootfs_overlay = true; std::string container_network_address; std::string container_network_gateway; std::vector container_network_dns_servers; }; static std::shared_ptr create(const std::shared_ptr &rt, const Configuration &config); ~Service(); private: Service(const std::shared_ptr &rt, const Configuration &config); int next_id(); void new_client(std::shared_ptr< boost::asio::local::stream_protocol::socket> const &socket); std::shared_ptr dispatcher_; std::shared_ptr connector_; std::atomic next_connection_id_; std::shared_ptr> connections_; std::shared_ptr backend_; Configuration config_; }; } // namespace container } // namespace anbox #endif