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_MANAGEMENT_API_STUB_H_
19 #define ANBOX_CONTAINER_MANAGEMENT_API_STUB_H_
21 #include "anbox/common/wait_handle.h"
22 #include "anbox/container/configuration.h"
23 #include "anbox/do_not_copy_or_move.h"
32 } // namespace protobuf
37 class ManagementApiStub : public DoNotCopyOrMove {
39 ManagementApiStub(const std::shared_ptr<rpc::Channel> &channel);
42 void start_container(const Configuration &configuration);
43 void stop_container();
46 template <typename Response>
48 Request() : response(std::make_shared<Response>()), success(true) {}
49 std::shared_ptr<Response> response;
51 common::WaitHandle wh;
54 void container_started(Request<protobuf::rpc::Void> *request);
55 void container_stopped(Request<protobuf::rpc::Void> *request);
57 mutable std::mutex mutex_;
58 std::shared_ptr<rpc::Channel> channel_;
59 static const std::chrono::milliseconds stop_waiting_timeout;
61 } // namespace container