1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
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 DISTRIBUTEDINPUTSTUB_FUZZER_H
17 #define DISTRIBUTEDINPUTSTUB_FUZZER_H
18 
19 #define FUZZ_PROJECT_NAME "distributedinputstub_fuzzer.cpp"
20 
21 #include "constants_dinput.h"
22 #include "dinput_errcode.h"
23 #include "distributed_input_sink_stub.h"
24 #include "distributed_input_source_stub.h"
25 
26 namespace OHOS {
27 namespace DistributedHardware {
28 
29 class DistributedInputSinkStubFuzz : public
30     OHOS::DistributedHardware::DistributedInput::DistributedInputSinkStub {
31 public:
32     DistributedInputSinkStubFuzz() = default;
33     virtual ~DistributedInputSinkStubFuzz() = default;
34     int32_t Init();
35     int32_t Release();
36     int32_t RegisterGetSinkScreenInfosCallback(sptr<DistributedInput::IGetSinkScreenInfosCallback> callback);
37     int32_t NotifyStartDScreen(const DistributedInput::SrcScreenInfo &remoteCtrlInfo);
38     int32_t NotifyStopDScreen(const std::string &srcScreenInfoKey);
39     int32_t RegisterSharingDhIdListener(sptr<DistributedInput::ISharingDhIdListener> sharingDhIdListener);
40 };
41 
42 class DInputSourceCallBackStubFuzz : public
43     OHOS::DistributedHardware::DistributedInput::DistributedInputSourceStub {
44 public:
45     DInputSourceCallBackStubFuzz() = default;
46     virtual ~DInputSourceCallBackStubFuzz() = default;
47     int32_t Init();
48     int32_t Release() ;
49     int32_t RegisterDistributedHardware(
50         const std::string &devId, const std::string &dhId, const std::string &parameters,
51         sptr<DistributedInput::IRegisterDInputCallback> callback);
52     int32_t UnregisterDistributedHardware(
53         const std::string &devId, const std::string &dhId, sptr<DistributedInput::IUnregisterDInputCallback> callback);
54     int32_t PrepareRemoteInput(const std::string &deviceId, sptr<DistributedInput::IPrepareDInputCallback> callback);
55     int32_t UnprepareRemoteInput(const std::string &deviceId,
56         sptr<DistributedInput::IUnprepareDInputCallback> callback);
57     int32_t StartRemoteInput(
58         const std::string &deviceId, const uint32_t &inputTypes,
59         sptr<DistributedInput::IStartDInputCallback> callback);
60     int32_t StopRemoteInput(
61         const std::string &deviceId, const uint32_t &inputTypes,
62         sptr<DistributedInput::IStopDInputCallback> callback);
63     int32_t StartRemoteInput(const std::string &srcId, const std::string &sinkId, const uint32_t &inputTypes,
64         sptr<DistributedInput::IStartDInputCallback> callback);
65     int32_t StopRemoteInput(const std::string &srcId, const std::string &sinkId, const uint32_t &inputTypes,
66         sptr<DistributedInput::IStopDInputCallback> callback);
67     int32_t PrepareRemoteInput(const std::string &srcId, const std::string &sinkId,
68         sptr<DistributedInput::IPrepareDInputCallback> callback);
69     int32_t UnprepareRemoteInput(const std::string &srcId, const std::string &sinkId,
70         sptr<DistributedInput::IUnprepareDInputCallback> callback);
71     int32_t StartRemoteInput(const std::string &sinkId, const std::vector<std::string> &dhIds,
72         sptr<DistributedInput::IStartStopDInputsCallback> callback);
73     int32_t StopRemoteInput(const std::string &sinkId, const std::vector<std::string> &dhIds,
74         sptr<DistributedInput::IStartStopDInputsCallback> callback);
75     int32_t StartRemoteInput(const std::string &srcId, const std::string &sinkId,
76         const std::vector<std::string> &dhIds, sptr<DistributedInput::IStartStopDInputsCallback> callback);
77     int32_t StopRemoteInput(const std::string &srcId, const std::string &sinkId,
78         const std::vector<std::string> &dhIds, sptr<DistributedInput::IStartStopDInputsCallback> callback);
79 
80     int32_t RegisterAddWhiteListCallback(sptr<DistributedInput::IAddWhiteListInfosCallback> addWhiteListCallback);
81     int32_t RegisterDelWhiteListCallback(sptr<DistributedInput::IDelWhiteListInfosCallback> delWhiteListCallback);
82     int32_t RegisterSimulationEventListener(sptr<DistributedInput::ISimulationEventListener> listener);
83     int32_t UnregisterSimulationEventListener(sptr<DistributedInput::ISimulationEventListener> listener);
84     int32_t RegisterSessionStateCb(sptr<DistributedInput::ISessionStateCallback> callback);
85     int32_t UnregisterSessionStateCb();
86     void OnResult(const std::string &deviceId, const std::string &strJson);
87     std::string deviceId_;
88     std::string strJson_;
89 };
90 } // namespace DistributedHardware
91 } // namespace OHOS
92 #endif