X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=blobdiff_plain;f=src%2Ftype3_AndroidCloud%2Fanbox-master%2Fsrc%2Fanbox%2Fcontainer%2Fmanagement_api_stub.h;fp=src%2Ftype3_AndroidCloud%2Fanbox-master%2Fsrc%2Fanbox%2Fcontainer%2Fmanagement_api_stub.h;h=e40df94ead2f59e392abc99e3e273618313bf846;hb=e26c1ec581be598521517829adba8c8dd23a768f;hp=0000000000000000000000000000000000000000;hpb=6699c1aea74eeb0eb400e6299079f0c7576f716f;p=iec.git diff --git a/src/type3_AndroidCloud/anbox-master/src/anbox/container/management_api_stub.h b/src/type3_AndroidCloud/anbox-master/src/anbox/container/management_api_stub.h new file mode 100644 index 0000000..e40df94 --- /dev/null +++ b/src/type3_AndroidCloud/anbox-master/src/anbox/container/management_api_stub.h @@ -0,0 +1,64 @@ +/* + * 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_MANAGEMENT_API_STUB_H_ +#define ANBOX_CONTAINER_MANAGEMENT_API_STUB_H_ + +#include "anbox/common/wait_handle.h" +#include "anbox/container/configuration.h" +#include "anbox/do_not_copy_or_move.h" + +#include + +namespace anbox { +namespace protobuf { +namespace rpc { +class Void; +} // namespace rpc +} // namespace protobuf +namespace rpc { +class Channel; +} // namespace rpc +namespace container { +class ManagementApiStub : public DoNotCopyOrMove { + public: + ManagementApiStub(const std::shared_ptr &channel); + ~ManagementApiStub(); + + void start_container(const Configuration &configuration); + void stop_container(); + + private: + template + struct Request { + Request() : response(std::make_shared()), success(true) {} + std::shared_ptr response; + bool success; + common::WaitHandle wh; + }; + + void container_started(Request *request); + void container_stopped(Request *request); + + mutable std::mutex mutex_; + std::shared_ptr channel_; + static const std::chrono::milliseconds stop_waiting_timeout; +}; +} // namespace container +} // namespace anbox + +#endif