1/*
2 * Copyright (c) Huawei Technologies Co., Ltd. 2021. All rights reserved.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16#ifndef PLUGIN_SERVICE_IMPL_H
17#define PLUGIN_SERVICE_IMPL_H
18
19#include "logging.h"
20#include "plugin_service.ipc.h"
21#include "socket_context.h"
22class PluginService;
23
24using GetCommandResponsePtr = STD_PTR(shared, ::GetCommandResponse);
25
26class PluginServiceImpl final : public IPluginServiceServer {
27public:
28    explicit PluginServiceImpl(PluginService& p);
29    ~PluginServiceImpl();
30    bool RegisterPlugin(SocketContext& context, ::RegisterPluginRequest& request,
31                        ::RegisterPluginResponse& response) override;
32    bool UnregisterPlugin(SocketContext& context, ::UnregisterPluginRequest& request,
33                          ::UnregisterPluginResponse& response) override;
34    bool GetCommand(SocketContext& context, ::GetCommandRequest& request, ::GetCommandResponse& response) override;
35    bool NotifyResult(SocketContext& context, ::NotifyResultRequest& request,
36                      ::NotifyResultResponse& response) override;
37    bool PushCommand(SocketContext& context, GetCommandResponsePtr command);
38    bool SendHeartBeat(SocketContext& context);
39
40private:
41    PluginService* pluginService;
42};
43
44#endif // PLUGIN_SERVICE_IMPL_H
45