diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index edff3d5a5c490399c3ef70bd4eb5a7239811c3d3..289dd5da02153218ae20d074446724601febabac 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -52,7 +52,6 @@ set(SOURCES anbox/network/message_processor.h anbox/network/connector.h anbox/network/connection_creator.h - anbox/network/qemu_pipe_connection_creator.cpp anbox/network/published_socket_connector.cpp anbox/network/connections.h anbox/network/socket_connection.cpp @@ -67,16 +66,17 @@ set(SOURCES anbox/input/manager.cpp anbox/input/device.cpp - anbox/support/null_message_processor.cpp - anbox/support/qemud_message_processor.cpp - anbox/support/boot_properties_message_processor.cpp - anbox/support/hwcontrol_message_processor.cpp - anbox/support/sensors_message_processor.cpp - anbox/support/camera_message_processor.cpp - anbox/support/fingerprint_message_processor.cpp - anbox/support/gsm_message_processor.cpp - anbox/support/at_parser.cpp - anbox/support/bootanimation_message_processor.cpp + anbox/qemu/pipe_connection_creator.cpp + anbox/qemu/null_message_processor.cpp + anbox/qemu/qemud_message_processor.cpp + anbox/qemu/boot_properties_message_processor.cpp + anbox/qemu/hwcontrol_message_processor.cpp + anbox/qemu/sensors_message_processor.cpp + anbox/qemu/camera_message_processor.cpp + anbox/qemu/fingerprint_message_processor.cpp + anbox/qemu/gsm_message_processor.cpp + anbox/qemu/at_parser.cpp + anbox/qemu/bootanimation_message_processor.cpp anbox/bridge/constants.h anbox/bridge/connection_creator.cpp diff --git a/src/anbox/cmds/run.cpp b/src/anbox/cmds/run.cpp index de04e4e46b1691262387687c7883c678c57ee580..ccd87f983eeb26c6e147856dd3e11d7dd87ba40f 100644 --- a/src/anbox/cmds/run.cpp +++ b/src/anbox/cmds/run.cpp @@ -27,7 +27,7 @@ #include "anbox/common/dispatcher.h" #include "anbox/cmds/run.h" #include "anbox/network/published_socket_connector.h" -#include "anbox/network/qemu_pipe_connection_creator.h" +#include "anbox/qemu/pipe_connection_creator.h" #include "anbox/graphics/gl_renderer_server.h" #include "anbox/input/manager.h" #include "anbox/bridge/connection_creator.h" @@ -109,9 +109,9 @@ anbox::cmds::Run::Run(const BusFactory& bus_factory) auto qemu_pipe_connector = std::make_shared( utils::string_format("%s/qemu_pipe", config::data_path()), rt, - std::make_shared(rt, - renderer->socket_path(), - icon_)); + std::make_shared(rt, + renderer->socket_path(), + icon_)); auto android_api_stub = std::make_shared(); diff --git a/src/anbox/input/device.cpp b/src/anbox/input/device.cpp index 42674a0595134009e5c00d957c52e540234fcd56..8367fbf01ab20335c67a5b83266f6f3860e7fd77 100644 --- a/src/anbox/input/device.cpp +++ b/src/anbox/input/device.cpp @@ -19,7 +19,7 @@ #include "anbox/network/delegate_connection_creator.h" #include "anbox/network/delegate_message_processor.h" #include "anbox/network/socket_messenger.h" -#include "anbox/support/null_message_processor.h" +#include "anbox/qemu/null_message_processor.h" #include "anbox/logger.h" #include @@ -163,7 +163,7 @@ void Device::new_client(std::shared_ptr(socket); auto const& connection = std::make_shared( messenger, messenger, next_id(), connections_, - std::make_shared()); + std::make_shared()); connections_->add(connection); diff --git a/src/anbox/support/at_parser.cpp b/src/anbox/qemu/at_parser.cpp similarity index 96% rename from src/anbox/support/at_parser.cpp rename to src/anbox/qemu/at_parser.cpp index 759e2d431467fc82833392c661efe068589ffeb1..7b052cd810fd764437c78c2eacb992597489353f 100644 --- a/src/anbox/support/at_parser.cpp +++ b/src/anbox/qemu/at_parser.cpp @@ -15,12 +15,12 @@ * */ -#include "anbox/support/at_parser.h" +#include "anbox/qemu//at_parser.h" #include "anbox/utils.h" #include "anbox/logger.h" namespace anbox { -namespace support { +namespace qemu { AtParser::AtParser() { } @@ -70,5 +70,5 @@ void AtParser::processs_command(const std::string &command) { handler(real_command); } -} // namespace support +} // namespace qemu } // namespace anbox diff --git a/src/anbox/support/at_parser.h b/src/anbox/qemu/at_parser.h similarity index 91% rename from src/anbox/support/at_parser.h rename to src/anbox/qemu/at_parser.h index 13f95b24e444ec5888a7380fbcd1b6289a511285..6ca57e150c4db322befbf5215d881f69d6463377 100644 --- a/src/anbox/support/at_parser.h +++ b/src/anbox/qemu/at_parser.h @@ -15,8 +15,8 @@ * */ -#ifndef ANBOX_SUPPORT_AT_PARSER_H_ -#define ANBOX_SUPPORT_AT_PARSER_H_ +#ifndef ANBOX_QEMU_AT_PARSER_H_ +#define ANBOX_QEMU_AT_PARSER_H_ #include #include @@ -26,7 +26,7 @@ #include "anbox/do_not_copy_or_move.h" namespace anbox { -namespace support { +namespace qemu { class AtParser { public: typedef std::function CommandHandler; @@ -42,7 +42,7 @@ private: std::map handlers_; }; -} // namespace support +} // namespace qemu } // namespace anbox #endif diff --git a/src/anbox/support/boot_properties_message_processor.cpp b/src/anbox/qemu/boot_properties_message_processor.cpp similarity index 96% rename from src/anbox/support/boot_properties_message_processor.cpp rename to src/anbox/qemu/boot_properties_message_processor.cpp index d118fd20b199ebcb53e731ac9a41a80cac458893..d0e812475bbe173761bb189f51dca8f012c1af84 100644 --- a/src/anbox/support/boot_properties_message_processor.cpp +++ b/src/anbox/qemu/boot_properties_message_processor.cpp @@ -15,11 +15,11 @@ * */ -#include "anbox/support/boot_properties_message_processor.h" +#include "anbox/qemu//boot_properties_message_processor.h" #include "anbox/logger.h" namespace anbox { -namespace support { +namespace qemu { BootPropertiesMessageProcessor::BootPropertiesMessageProcessor(const std::shared_ptr &messenger) : QemudMessageProcessor(messenger) { } @@ -74,5 +74,5 @@ void BootPropertiesMessageProcessor::list_properties() { finish_message(); } -} // namespace support +} // namespace qemu } // namespace anbox diff --git a/src/anbox/support/boot_properties_message_processor.h b/src/anbox/qemu/boot_properties_message_processor.h similarity index 85% rename from src/anbox/support/boot_properties_message_processor.h rename to src/anbox/qemu/boot_properties_message_processor.h index c281fd57ec28a9f61a0ab4f149f790bd5fb1c39e..3960826f6ee627606a8d0f45980af596552b8859 100644 --- a/src/anbox/support/boot_properties_message_processor.h +++ b/src/anbox/qemu/boot_properties_message_processor.h @@ -15,13 +15,13 @@ * */ -#ifndef ANBOX_SUPPORT_BOOT_PROPERTIES_MESSAGE_PROCESSOR_H_ -#define ANBOX_SUPPORT_BOOT_PROPERTIES_MESSAGE_PROCESSOR_H_ +#ifndef ANBOX_QEMU_BOOT_PROPERTIES_MESSAGE_PROCESSOR_H_ +#define ANBOX_QEMU_BOOT_PROPERTIES_MESSAGE_PROCESSOR_H_ -#include "anbox/support/qemud_message_processor.h" +#include "anbox/qemu//qemud_message_processor.h" namespace anbox { -namespace support { +namespace qemu { class BootPropertiesMessageProcessor : public QemudMessageProcessor { public: BootPropertiesMessageProcessor(const std::shared_ptr &messenger); diff --git a/src/anbox/support/bootanimation_message_processor.cpp b/src/anbox/qemu/bootanimation_message_processor.cpp similarity index 94% rename from src/anbox/support/bootanimation_message_processor.cpp rename to src/anbox/qemu/bootanimation_message_processor.cpp index a36a85f7803a5ab93de430558f84e7e8b6a59c47..398cbce8cb20264a3f0e4eff77887ef06e4ecb7d 100644 --- a/src/anbox/support/bootanimation_message_processor.cpp +++ b/src/anbox/qemu/bootanimation_message_processor.cpp @@ -16,12 +16,12 @@ */ #include "anbox/logger.h" -#include "anbox/support/bootanimation_message_processor.h" +#include "anbox/qemu//bootanimation_message_processor.h" #include namespace anbox { -namespace support { +namespace qemu { BootAnimationMessageProcessor::BootAnimationMessageProcessor(const std::shared_ptr &messenger, const std::string &icon_path) : QemudMessageProcessor(messenger), @@ -48,5 +48,5 @@ void BootAnimationMessageProcessor::retrieve_icon() { } } -} // namespace support +} // namespace qemu } // namespace anbox diff --git a/src/anbox/support/bootanimation_message_processor.h b/src/anbox/qemu/bootanimation_message_processor.h similarity index 86% rename from src/anbox/support/bootanimation_message_processor.h rename to src/anbox/qemu/bootanimation_message_processor.h index 3fb747b18dca21e8ba4e17f95ff2ee76761aabe7..4158c1a8e76eb08466b632e037151c43b176e9eb 100644 --- a/src/anbox/support/bootanimation_message_processor.h +++ b/src/anbox/qemu/bootanimation_message_processor.h @@ -15,13 +15,13 @@ * */ -#ifndef ANBOX_SUPPORT_BOOT_ANIMATION_MESSAGE_PROCESSOR_H_ -#define ANBOX_SUPPORT_BOOT_ANIMATION_MESSAGE_PROCESSOR_H_ +#ifndef ANBOX_QEMU_BOOT_ANIMATION_MESSAGE_PROCESSOR_H_ +#define ANBOX_QEMU_BOOT_ANIMATION_MESSAGE_PROCESSOR_H_ -#include "anbox/support/qemud_message_processor.h" +#include "anbox/qemu//qemud_message_processor.h" namespace anbox { -namespace support { +namespace qemu { class BootAnimationMessageProcessor : public QemudMessageProcessor { public: BootAnimationMessageProcessor(const std::shared_ptr &messenger, diff --git a/src/anbox/support/camera_message_processor.cpp b/src/anbox/qemu/camera_message_processor.cpp similarity index 95% rename from src/anbox/support/camera_message_processor.cpp rename to src/anbox/qemu/camera_message_processor.cpp index 985e2031b281743464b169e6c513b13eb6267ae6..c7c9c6b47a19fd9eeb0955c59784f40f0d115877 100644 --- a/src/anbox/support/camera_message_processor.cpp +++ b/src/anbox/qemu/camera_message_processor.cpp @@ -16,10 +16,10 @@ */ #include "anbox/logger.h" -#include "anbox/support/camera_message_processor.h" +#include "anbox/qemu/camera_message_processor.h" namespace anbox { -namespace support { +namespace qemu { CameraMessageProcessor::CameraMessageProcessor(const std::shared_ptr &messenger) : messenger_(messenger) { } @@ -65,5 +65,5 @@ void CameraMessageProcessor::list() { snprintf(buf, 5, "\n"); messenger_->send(buf, strlen(buf)); } -} // namespace support +} // namespace qemu } // namespace anbox diff --git a/src/anbox/support/camera_message_processor.h b/src/anbox/qemu/camera_message_processor.h similarity index 91% rename from src/anbox/support/camera_message_processor.h rename to src/anbox/qemu/camera_message_processor.h index 593b113a35367321ad22c99973e794c4de6e34f9..ec603cec8f4903ff70c5724d606587ba7dd021d2 100644 --- a/src/anbox/support/camera_message_processor.h +++ b/src/anbox/qemu/camera_message_processor.h @@ -15,14 +15,14 @@ * */ -#ifndef ANBOX_SUPPORT_CAMERA_MESSAGE_PROCESSOR_H_ -#define ANBOX_SUPPORT_CAMERA_MESSAGE_PROCESSOR_H_ +#ifndef ANBOX_QEMU_CAMERA_MESSAGE_PROCESSOR_H_ +#define ANBOX_QEMU_CAMERA_MESSAGE_PROCESSOR_H_ #include "anbox/network/message_processor.h" #include "anbox/network/socket_messenger.h" namespace anbox { -namespace support { +namespace qemu { class CameraMessageProcessor : public network::MessageProcessor { public: CameraMessageProcessor(const std::shared_ptr &messenger); diff --git a/src/anbox/support/fingerprint_message_processor.cpp b/src/anbox/qemu/fingerprint_message_processor.cpp similarity index 92% rename from src/anbox/support/fingerprint_message_processor.cpp rename to src/anbox/qemu/fingerprint_message_processor.cpp index a68dc50f8eca917661ee0ab3c30fd3a9a7bdb3c6..eb256a3bc9ddd41360623843f540dfa9853b38b0 100644 --- a/src/anbox/support/fingerprint_message_processor.cpp +++ b/src/anbox/qemu/fingerprint_message_processor.cpp @@ -16,10 +16,10 @@ */ #include "anbox/logger.h" -#include "anbox/support/fingerprint_message_processor.h" +#include "anbox/qemu/fingerprint_message_processor.h" namespace anbox { -namespace support { +namespace qemu { FingerprintMessageProcessor::FingerprintMessageProcessor(const std::shared_ptr &messenger) : QemudMessageProcessor(messenger) { } @@ -39,5 +39,5 @@ void FingerprintMessageProcessor::listen() { messenger_->send(buf, strlen(buf)); finish_message(); } -} // namespace support +} // namespace qemu } // namespace anbox diff --git a/src/anbox/support/fingerprint_message_processor.h b/src/anbox/qemu/fingerprint_message_processor.h similarity index 85% rename from src/anbox/support/fingerprint_message_processor.h rename to src/anbox/qemu/fingerprint_message_processor.h index 7fcda83bca2a060cd93bd782555f167735769058..885f772af32a66b1609144118234d3dd35e70a29 100644 --- a/src/anbox/support/fingerprint_message_processor.h +++ b/src/anbox/qemu/fingerprint_message_processor.h @@ -15,13 +15,13 @@ * */ -#ifndef ANBOX_SUPPORT_FINGERPRINT_MESSAGE_PROCESSOR_H_ -#define ANBOX_SUPPORT_FINGERPRINT_MESSAGE_PROCESSOR_H_ +#ifndef ANBOX_QEMU_FINGERPRINT_MESSAGE_PROCESSOR_H_ +#define ANBOX_QEMU_FINGERPRINT_MESSAGE_PROCESSOR_H_ -#include "anbox/support/qemud_message_processor.h" +#include "anbox/qemu/qemud_message_processor.h" namespace anbox { -namespace support { +namespace qemu { class FingerprintMessageProcessor : public QemudMessageProcessor { public: FingerprintMessageProcessor(const std::shared_ptr &messenger); diff --git a/src/anbox/support/gsm_message_processor.cpp b/src/anbox/qemu/gsm_message_processor.cpp similarity index 96% rename from src/anbox/support/gsm_message_processor.cpp rename to src/anbox/qemu/gsm_message_processor.cpp index 0b137c73b73800338fea3c867acf7443514dce15..1973587ea0461def67b72a197812f5ec29d55c9a 100644 --- a/src/anbox/support/gsm_message_processor.cpp +++ b/src/anbox/qemu/gsm_message_processor.cpp @@ -16,8 +16,8 @@ */ #include "anbox/logger.h" -#include "anbox/support/gsm_message_processor.h" -#include "anbox/support/at_parser.h" +#include "anbox/qemu/gsm_message_processor.h" +#include "anbox/qemu/at_parser.h" #include #include @@ -25,7 +25,7 @@ using namespace std::placeholders; namespace anbox { -namespace support { +namespace qemu { GsmMessageProcessor::GsmMessageProcessor(const std::shared_ptr &messenger) : messenger_(messenger), parser_(std::make_shared()) { @@ -107,5 +107,5 @@ void GsmMessageProcessor::handle_cfun(const std::string &command) { else if (utils::string_starts_with(command, "+CFUN=")) send_reply(""); } -} // namespace support +} // namespace qemu } // namespace anbox diff --git a/src/anbox/support/gsm_message_processor.h b/src/anbox/qemu/gsm_message_processor.h similarity index 93% rename from src/anbox/support/gsm_message_processor.h rename to src/anbox/qemu/gsm_message_processor.h index be818ab92a12c9c7cbe6b881130251b98fa6c375..c644d819e2a7419f1472d87390b6ac002f695dd9 100644 --- a/src/anbox/support/gsm_message_processor.h +++ b/src/anbox/qemu/gsm_message_processor.h @@ -15,14 +15,14 @@ * */ -#ifndef ANBOX_SUPPORT_GSM_MESSAGE_PROCESSOR_H_ -#define ANBOX_SUPPORT_GSM_MESSAGE_PROCESSOR_H_ +#ifndef ANBOX_QEMU_GSM_MESSAGE_PROCESSOR_H_ +#define ANBOX_QEMU_GSM_MESSAGE_PROCESSOR_H_ #include "anbox/network/message_processor.h" #include "anbox/network/socket_messenger.h" namespace anbox { -namespace support { +namespace qemu { class AtParser; class GsmMessageProcessor : public network::MessageProcessor { public: diff --git a/src/anbox/support/hwcontrol_message_processor.cpp b/src/anbox/qemu/hwcontrol_message_processor.cpp similarity index 93% rename from src/anbox/support/hwcontrol_message_processor.cpp rename to src/anbox/qemu/hwcontrol_message_processor.cpp index 4e92af4cca8bcc99345fa06c605df6737fd3d1fb..39f7a3049d26d642706ddc37cbe7ef6a44717530 100644 --- a/src/anbox/support/hwcontrol_message_processor.cpp +++ b/src/anbox/qemu/hwcontrol_message_processor.cpp @@ -15,11 +15,11 @@ * */ -#include "anbox/support/hwcontrol_message_processor.h" +#include "anbox/qemu/hwcontrol_message_processor.h" #include "anbox/logger.h" namespace anbox { -namespace support { +namespace qemu { HwControlMessageProcessor::HwControlMessageProcessor(const std::shared_ptr &messenger) : QemudMessageProcessor(messenger) { } @@ -37,5 +37,5 @@ void HwControlMessageProcessor::handle_command(const std::string &command) { else DEBUG("Unknown command '%s'", command); } -} // namespace support +} // namespace qemu } // namespace anbox diff --git a/src/anbox/support/hwcontrol_message_processor.h b/src/anbox/qemu/hwcontrol_message_processor.h similarity index 85% rename from src/anbox/support/hwcontrol_message_processor.h rename to src/anbox/qemu/hwcontrol_message_processor.h index aba926236111959962e95c0a775695e024775543..5cf5ba4a57047668cd39714bfad9f08d64a24981 100644 --- a/src/anbox/support/hwcontrol_message_processor.h +++ b/src/anbox/qemu/hwcontrol_message_processor.h @@ -15,13 +15,13 @@ * */ -#ifndef ANBOX_SUPPORT_HWCONTROL_MESSAGE_PROCESSOR_H_ -#define ANBOX_SUPPORT_HWCONTROL_MESSAGE_PROCESSOR_H_ +#ifndef ANBOX_QEMU_HWCONTROL_MESSAGE_PROCESSOR_H_ +#define ANBOX_QEMU_HWCONTROL_MESSAGE_PROCESSOR_H_ -#include "anbox/support/qemud_message_processor.h" +#include "anbox/qemu/qemud_message_processor.h" namespace anbox { -namespace support { +namespace qemu { class HwControlMessageProcessor : public QemudMessageProcessor { public: HwControlMessageProcessor(const std::shared_ptr &messenger); diff --git a/src/anbox/support/null_message_processor.cpp b/src/anbox/qemu/null_message_processor.cpp similarity index 91% rename from src/anbox/support/null_message_processor.cpp rename to src/anbox/qemu/null_message_processor.cpp index 581acbc71738c25d2e60d1bdf505535694e61443..798e2b733b997b0dda6d19f66cbcc2bc47a7cb76 100644 --- a/src/anbox/support/null_message_processor.cpp +++ b/src/anbox/qemu/null_message_processor.cpp @@ -15,14 +15,14 @@ * */ -#include "anbox/support/null_message_processor.h" +#include "anbox/qemu/null_message_processor.h" #include "anbox/utils.h" #include "anbox/logger.h" #include namespace anbox { -namespace support { +namespace qemu { NullMessageProcessor::NullMessageProcessor() { } @@ -33,5 +33,5 @@ bool NullMessageProcessor::process_data(const std::vector &data) { DEBUG("Received: %s", utils::hex_dump(data.data(), data.size())); return true; } -} // namespace support +} // namespace qemu } // namespace anbox diff --git a/src/anbox/support/null_message_processor.h b/src/anbox/qemu/null_message_processor.h similarity index 89% rename from src/anbox/support/null_message_processor.h rename to src/anbox/qemu/null_message_processor.h index 8b399a29f6bf2861213cf9ca95d91668e24bf590..5a7acb4f02e3c48f04001469d037607f83693dfb 100644 --- a/src/anbox/support/null_message_processor.h +++ b/src/anbox/qemu/null_message_processor.h @@ -15,13 +15,13 @@ * */ -#ifndef ANBOX_SUPPORT_NULL_MESSAGE_PROCESSOR_H_ -#define ANBOX_SUPPORT_NULL_MESSAGE_PROCESSOR_H_ +#ifndef ANBOX_QEMU_NULL_MESSAGE_PROCESSOR_H_ +#define ANBOX_QEMU_NULL_MESSAGE_PROCESSOR_H_ #include "anbox/network/message_processor.h" namespace anbox { -namespace support { +namespace qemu { class NullMessageProcessor : public network::MessageProcessor { public: NullMessageProcessor(); diff --git a/src/anbox/network/qemu_pipe_connection_creator.cpp b/src/anbox/qemu/pipe_connection_creator.cpp similarity index 64% rename from src/anbox/network/qemu_pipe_connection_creator.cpp rename to src/anbox/qemu/pipe_connection_creator.cpp index 62e6c31a6d4ac917b627313f2dbeeaeb62731b43..499929a150c37f9d44f0af65556e7c5eaa3e115b 100644 --- a/src/anbox/network/qemu_pipe_connection_creator.cpp +++ b/src/anbox/qemu/pipe_connection_creator.cpp @@ -18,52 +18,52 @@ #include #include "anbox/logger.h" -#include "anbox/network/qemu_pipe_connection_creator.h" #include "anbox/network/socket_messenger.h" #include "anbox/graphics/opengles_message_processor.h" -#include "anbox/support/boot_properties_message_processor.h" -#include "anbox/support/null_message_processor.h" -#include "anbox/support/hwcontrol_message_processor.h" -#include "anbox/support/sensors_message_processor.h" -#include "anbox/support/camera_message_processor.h" -#include "anbox/support/fingerprint_message_processor.h" -#include "anbox/support/gsm_message_processor.h" -#include "anbox/support/bootanimation_message_processor.h" +#include "anbox/qemu/pipe_connection_creator.h" +#include "anbox/qemu/boot_properties_message_processor.h" +#include "anbox/qemu/null_message_processor.h" +#include "anbox/qemu/hwcontrol_message_processor.h" +#include "anbox/qemu/sensors_message_processor.h" +#include "anbox/qemu/camera_message_processor.h" +#include "anbox/qemu/fingerprint_message_processor.h" +#include "anbox/qemu/gsm_message_processor.h" +#include "anbox/qemu/bootanimation_message_processor.h" namespace ba = boost::asio; namespace anbox { -namespace network { -QemuPipeConnectionCreator::QemuPipeConnectionCreator(const std::shared_ptr &rt, - const std::string &renderer_socket_path, - const std::string &boot_animation_icon_path) : +namespace qemu { +PipeConnectionCreator::PipeConnectionCreator(const std::shared_ptr &rt, + const std::string &renderer_socket_path, + const std::string &boot_animation_icon_path) : runtime_(rt), next_connection_id_(0), - connections_(std::make_shared>()), + connections_(std::make_shared>()), renderer_socket_path_(renderer_socket_path), boot_animation_icon_path_(boot_animation_icon_path) { } -QemuPipeConnectionCreator::~QemuPipeConnectionCreator() { +PipeConnectionCreator::~PipeConnectionCreator() { } -void QemuPipeConnectionCreator::create_connection_for( +void PipeConnectionCreator::create_connection_for( std::shared_ptr const& socket) { - auto const messenger = std::make_shared(socket); + auto const messenger = std::make_shared(socket); const auto type = identify_client(messenger); auto const processor = create_processor(type, messenger); if (!processor) BOOST_THROW_EXCEPTION(std::runtime_error("Unhandled client type")); - auto const& connection = std::make_shared( + auto const& connection = std::make_shared( messenger, messenger, next_id(), connections_, processor); connections_->add(connection); connection->read_next_message(); } -QemuPipeConnectionCreator::client_type QemuPipeConnectionCreator::identify_client( - std::shared_ptr const& messenger) { +PipeConnectionCreator::client_type PipeConnectionCreator::identify_client( + std::shared_ptr const& messenger) { // The client will identify itself as first thing by writing a string // in the format 'pipe:[:]\0' to the channel. @@ -104,31 +104,30 @@ QemuPipeConnectionCreator::client_type QemuPipeConnectionCreator::identify_clien return client_type::invalid; } -std::shared_ptr QemuPipeConnectionCreator::create_processor(const client_type &type, const std::shared_ptr &messenger) { +std::shared_ptr PipeConnectionCreator::create_processor(const client_type &type, const std::shared_ptr &messenger) { if (type == client_type::opengles) return std::make_shared(renderer_socket_path_, runtime_, messenger); else if (type == client_type::qemud_boot_properties) - return std::make_shared(messenger); + return std::make_shared(messenger); else if (type == client_type::qemud_hw_control) - return std::make_shared(messenger); + return std::make_shared(messenger); else if (type == client_type::qemud_sensors) - return std::make_shared(messenger); + return std::make_shared(messenger); else if (type == client_type::qemud_camera) - return std::make_shared(messenger); + return std::make_shared(messenger); else if (type == client_type::qemud_fingerprint) - return std::make_shared(messenger); + return std::make_shared(messenger); else if (type == client_type::qemud_gsm) - return std::make_shared(messenger); + return std::make_shared(messenger); else if (type == client_type::bootanimation) - return std::make_shared(messenger, boot_animation_icon_path_); + return std::make_shared(messenger, boot_animation_icon_path_); - return std::make_shared(); + return std::make_shared(); } -int QemuPipeConnectionCreator::next_id() +int PipeConnectionCreator::next_id() { return next_connection_id_.fetch_add(1); } - +} // namespace qemu } // namespace anbox -} // namespace network diff --git a/src/anbox/network/qemu_pipe_connection_creator.h b/src/anbox/qemu/pipe_connection_creator.h similarity index 78% rename from src/anbox/network/qemu_pipe_connection_creator.h rename to src/anbox/qemu/pipe_connection_creator.h index bb13a605a89df7f2cfab456c4c5a3ea2ad29586b..c63b4923ef9387f919bf16890bd5ca3cd8d74afd 100644 --- a/src/anbox/network/qemu_pipe_connection_creator.h +++ b/src/anbox/qemu/pipe_connection_creator.h @@ -30,15 +30,14 @@ #include "anbox/network/socket_messenger.h" namespace anbox { -namespace network { - -class QemuPipeConnectionCreator : public ConnectionCreator { +namespace qemu { +class PipeConnectionCreator : public network::ConnectionCreator { public: - QemuPipeConnectionCreator( + PipeConnectionCreator( const std::shared_ptr &rt, const std::string &renderer_socket_path, const std::string &boot_animation_icon_path); - ~QemuPipeConnectionCreator() noexcept; + ~PipeConnectionCreator() noexcept; void create_connection_for( std::shared_ptr const& socket) override; @@ -58,18 +57,18 @@ public: private: int next_id(); - client_type identify_client(std::shared_ptr const& messenger); - std::shared_ptr create_processor( - const client_type &type, const std::shared_ptr &messenger); + client_type identify_client(std::shared_ptr const& messenger); + std::shared_ptr create_processor( + const client_type &type, const std::shared_ptr &messenger); std::shared_ptr runtime_; std::atomic next_connection_id_; - std::shared_ptr> const connections_; + std::shared_ptr> const connections_; std::string renderer_socket_path_; std::string boot_animation_icon_path_; }; +} // namespace qemu } // namespace anbox -} // namespace network #endif diff --git a/src/anbox/support/qemud_message_processor.cpp b/src/anbox/qemu/qemud_message_processor.cpp similarity index 96% rename from src/anbox/support/qemud_message_processor.cpp rename to src/anbox/qemu/qemud_message_processor.cpp index 73663eaf884f44cde48809b2873d2965d478a29e..80fa4b643558ce1a22ecdf89a7685e27ad9a8c80 100644 --- a/src/anbox/support/qemud_message_processor.cpp +++ b/src/anbox/qemu/qemud_message_processor.cpp @@ -15,7 +15,7 @@ * */ -#include "anbox/support/qemud_message_processor.h" +#include "anbox/qemu/qemud_message_processor.h" #include "anbox/utils.h" #include "anbox/logger.h" @@ -26,7 +26,7 @@ static constexpr const long header_size{4}; } namespace anbox { -namespace support { +namespace qemu { QemudMessageProcessor::QemudMessageProcessor(const std::shared_ptr &messenger) : messenger_(messenger) { } @@ -83,5 +83,5 @@ void QemudMessageProcessor::finish_message() { // Send terminating NULL byte messenger_->send(static_cast(""), 1); } -} // namespace support +} // namespace qemu } // namespace anbox diff --git a/src/anbox/support/qemud_message_processor.h b/src/anbox/qemu/qemud_message_processor.h similarity index 92% rename from src/anbox/support/qemud_message_processor.h rename to src/anbox/qemu/qemud_message_processor.h index e57e853d4cbe1dbf0dd877645ec3c5232c3c6ef9..eee7fdf67a71c0a13bb09eb54c0b16529afd4870 100644 --- a/src/anbox/support/qemud_message_processor.h +++ b/src/anbox/qemu/qemud_message_processor.h @@ -15,14 +15,14 @@ * */ -#ifndef ANBOX_SUPPORT_QEMUD_MESSAGE_PROCESSOR_H_ -#define ANBOX_SUPPORT_QEMUD_MESSAGE_PROCESSOR_H_ +#ifndef ANBOX_QEMU_QEMUD_MESSAGE_PROCESSOR_H_ +#define ANBOX_QEMU_QEMUD_MESSAGE_PROCESSOR_H_ #include "anbox/network/message_processor.h" #include "anbox/network/socket_messenger.h" namespace anbox { -namespace support { +namespace qemu { class QemudMessageProcessor : public network::MessageProcessor { public: QemudMessageProcessor(const std::shared_ptr &messenger); diff --git a/src/anbox/support/sensors_message_processor.cpp b/src/anbox/qemu/sensors_message_processor.cpp similarity index 93% rename from src/anbox/support/sensors_message_processor.cpp rename to src/anbox/qemu/sensors_message_processor.cpp index ff8978380d45b90841dfa64b0ce643a1969fd970..4aca92b90b82c885ccf9f6ca8240044164efe71b 100644 --- a/src/anbox/support/sensors_message_processor.cpp +++ b/src/anbox/qemu/sensors_message_processor.cpp @@ -16,10 +16,10 @@ */ #include "anbox/logger.h" -#include "anbox/support/sensors_message_processor.h" +#include "anbox/qemu/sensors_message_processor.h" namespace anbox { -namespace support { +namespace qemu { SensorsMessageProcessor::SensorsMessageProcessor(const std::shared_ptr &messenger) : QemudMessageProcessor(messenger) { } @@ -42,5 +42,5 @@ void SensorsMessageProcessor::list_sensors() { messenger_->send(buf, strlen(buf)); finish_message(); } -} // namespace support +} // namespace qemu } // namespace anbox diff --git a/src/anbox/support/sensors_message_processor.h b/src/anbox/qemu/sensors_message_processor.h similarity index 85% rename from src/anbox/support/sensors_message_processor.h rename to src/anbox/qemu/sensors_message_processor.h index fd94646651218a3724518e2642c19e86d053bf77..95b4aeb7b6324b6a4843deac2476bb189d283256 100644 --- a/src/anbox/support/sensors_message_processor.h +++ b/src/anbox/qemu/sensors_message_processor.h @@ -15,13 +15,13 @@ * */ -#ifndef ANBOX_SUPPORT_SENSORS_MESSAGE_PROCESSOR_H_ -#define ANBOX_SUPPORT_SENSORS_MESSAGE_PROCESSOR_H_ +#ifndef ANBOX_QEMU_SENSORS_MESSAGE_PROCESSOR_H_ +#define ANBOX_QEMU_SENSORS_MESSAGE_PROCESSOR_H_ -#include "anbox/support/qemud_message_processor.h" +#include "anbox/qemu/qemud_message_processor.h" namespace anbox { -namespace support { +namespace qemu { class SensorsMessageProcessor : public QemudMessageProcessor { public: SensorsMessageProcessor(const std::shared_ptr &messenger); diff --git a/src/anbox/support/telephony_manager.cpp b/src/anbox/qemu/telephony_manager.cpp similarity index 93% rename from src/anbox/support/telephony_manager.cpp rename to src/anbox/qemu/telephony_manager.cpp index e612ad90ffc99be5ddde8dff7fdf7bd52ad24f80..25c44deb6548ec84bc3d53e860cfa61faa059a95 100644 --- a/src/anbox/support/telephony_manager.cpp +++ b/src/anbox/qemu/telephony_manager.cpp @@ -15,12 +15,12 @@ * */ -#include "anbox/support/telephony_manager.h" +#include "anbox/qemu/telephony_manager.h" #include "anbox/dbus/ofono.h" #include "anbox/logger.h" namespace anbox { -namespace support { +namespace qemu { TelephonyManager::TelephonyManager(const core::dbus::Bus::Ptr &bus) : bus_(bus) { ofono_ = core::dbus::Service::use_service(bus_, "org.ofono"); @@ -34,5 +34,5 @@ TelephonyManager::TelephonyManager(const core::dbus::Bus::Ptr &bus) : TelephonyManager::~TelephonyManager() { } -} // namespace support +} // namespace qemu } // namespace anbox diff --git a/src/anbox/support/telephony_manager.h b/src/anbox/qemu/telephony_manager.h similarity index 88% rename from src/anbox/support/telephony_manager.h rename to src/anbox/qemu/telephony_manager.h index 23600cd33e6254d8d56529d1c7f6816ccf202101..97425611de1cc1af7bb2c7ca9c9a5d53859c54db 100644 --- a/src/anbox/support/telephony_manager.h +++ b/src/anbox/qemu/telephony_manager.h @@ -15,15 +15,15 @@ * */ -#ifndef ANBOX_SUPPORT_TELEPHONY_MANAGER_H_ -#define ANBOX_SUPPORT_TELEPHONY_MANAGER_H_ +#ifndef ANBOX_QEMU_TELEPHONY_MANAGER_H_ +#define ANBOX_QEMU_TELEPHONY_MANAGER_H_ #include #include #include namespace anbox { -namespace support { +namespace qemu { class TelephonyManager { public: TelephonyManager(const core::dbus::Bus::Ptr &bus); @@ -34,7 +34,7 @@ private: core::dbus::Service::Ptr ofono_; core::dbus::Object::Ptr modem_; }; -} // namespace support +} // namespace qemu } // namespace anbox #endif diff --git a/tests/anbox/support/at_parser_tests.cpp b/tests/anbox/support/at_parser_tests.cpp index 043263249f4bb29987000c8f75040a6cd176e3c4..c316ea9d3df759da0e996afc5749dc18c2238934 100644 --- a/tests/anbox/support/at_parser_tests.cpp +++ b/tests/anbox/support/at_parser_tests.cpp @@ -15,14 +15,14 @@ * */ -#include "anbox/support/at_parser.h" +#include "anbox/qemu/at_parser.h" #include #include TEST(AtParser, BasicCommands) { - anbox::support::AtParser parser; + anbox::qemu::AtParser parser; std::string command = "ATE0Q0V1\nATE0Q0V1\n"; std::vector data;