2 * Copyright (C) 2016 Simon Fels <morphis@gravedo.de>
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3, as published
6 * by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 #ifndef ANBOX_CONTAINER_CLIENT_H_
19 #define ANBOX_CONTAINER_CLIENT_H_
21 #include "anbox/container/configuration.h"
22 #include "anbox/runtime.h"
26 class PendingCallCache;
28 class MessageProcessor;
31 class LocalSocketMessenger;
32 } // namespace network
34 class ManagementApiStub;
37 typedef std::function<void()> TerminateCallback;
39 Client(const std::shared_ptr<Runtime> &rt);
42 void start(const Configuration &configuration);
45 void register_terminate_handler(const TerminateCallback &callback);
48 void read_next_message();
49 void on_read_size(const boost::system::error_code &ec,
50 std::size_t bytes_read);
52 std::shared_ptr<network::LocalSocketMessenger> messenger_;
53 std::shared_ptr<rpc::PendingCallCache> pending_calls_;
54 std::shared_ptr<rpc::Channel> rpc_channel_;
55 std::shared_ptr<ManagementApiStub> management_api_;
56 std::shared_ptr<rpc::MessageProcessor> processor_;
57 std::array<std::uint8_t, 8192> buffer_;
58 TerminateCallback terminate_callback_;
60 } // namespace container