diff --git a/bundle.json b/bundle.json index ebc2d1e910395973792e72ee4296959039d7e215..39a237c6e9eb842f7ac06b3f99d7a550266fc53f 100755 --- a/bundle.json +++ b/bundle.json @@ -93,6 +93,7 @@ "//foundation/distributedhardware/distributed_input/utils/test:test", "//foundation/distributedhardware/distributed_input/dfx_utils/test:test", "//foundation/distributedhardware/distributed_input/interfaces/ipc/test:test", + "//foundation/distributedhardware/distributed_input/interfaces/ipc/test/fuzztest:fuzztest", "//foundation/distributedhardware/distributed_input/inputdevicehandler/test:test", "//foundation/distributedhardware/distributed_input/services/state/test:test" ] diff --git a/interfaces/ipc/test/fuzztest/BUILD.gn b/interfaces/ipc/test/fuzztest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..ffeef231b613a352f56966b2f4c157635dd07d81 --- /dev/null +++ b/interfaces/ipc/test/fuzztest/BUILD.gn @@ -0,0 +1,18 @@ +# Copyright (c) 2024 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +group("fuzztest") { + testonly = true + + deps = [ "distributedinputstub_fuzzer:fuzztest" ] +} diff --git a/interfaces/ipc/test/fuzztest/distributedinputstub_fuzzer/BUILD.gn b/interfaces/ipc/test/fuzztest/distributedinputstub_fuzzer/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..d9a68988c749da8d81942d6285bf5d2e1ffb877e --- /dev/null +++ b/interfaces/ipc/test/fuzztest/distributedinputstub_fuzzer/BUILD.gn @@ -0,0 +1,141 @@ +# Copyright (c) 2024 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#####################hydra-fuzz################### +import("//build/config/features.gni") +import("//build/test.gni") +import("../../../../../distributedinput.gni") + +##############################fuzztest########################################## +ohos_fuzztest("DistributedInputStubFuzzTest") { + module_out_path = fuzz_test_path + + fuzz_config_file = "${ipc_path}/test/fuzztest/distributedinputstub_fuzzer" + + include_dirs = [ + "${av_transport_path}/common/include", + "${innerkits_path}/include", + "${innerkits_path}/ipc/include", + "${innerkits_path}/src", + "${ipc_path}/include", + "${ipc_path}/src", + "${services_source_path}/sourcemanager/include", + "${frameworks_path}/include", + "${distributedinput_path}/inputdevicehandler/include", + "${common_path}/include", + "${services_state_path}/include", + "${service_common}/include", + "${services_source_path}/inputinject/include", + "${services_source_path}/transport/include", + "${dfx_utils_path}/include", + "${utils_path}/include", + "${fwk_interfaces_path}/include", + "${fwk_interfaces_path}/include/ipc", + "${common_path}/test/mock", + "${distributedinput_path}/services/transportbase/include", + "${distributedinput_path}/utils/include", + "${distributedinput_path}/services/state/include", + ] + + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + "-Dprivate=public", + "-Dprotected=public", + ] + sources = [ + "${common_path}/include/input_hub.cpp", + "${common_path}/test/mock/socket_mock.cpp", + "${common_path}/test/mock/softbus_bus_center_mock.cpp", + "${distributedinput_path}/services/transportbase/src/distributed_input_transport_base.cpp", + "${distributedinput_path}/utils/src/dinput_context.cpp", + "${distributedinput_path}/utils/src/dinput_utils_tool.cpp", + "${ipc_path}/src/add_white_list_infos_call_back_proxy.cpp", + "${ipc_path}/src/add_white_list_infos_call_back_stub.cpp", + "${ipc_path}/src/del_white_list_infos_call_back_proxy.cpp", + "${ipc_path}/src/del_white_list_infos_call_back_stub.cpp", + "${ipc_path}/src/distributed_input_sink_proxy.cpp", + "${ipc_path}/src/distributed_input_sink_stub.cpp", + "${ipc_path}/src/distributed_input_source_proxy.cpp", + "${ipc_path}/src/distributed_input_source_stub.cpp", + "${ipc_path}/src/get_sink_screen_infos_call_back_proxy.cpp", + "${ipc_path}/src/get_sink_screen_infos_call_back_stub.cpp", + "${ipc_path}/src/prepare_d_input_call_back_proxy.cpp", + "${ipc_path}/src/prepare_d_input_call_back_stub.cpp", + "${ipc_path}/src/register_d_input_call_back_proxy.cpp", + "${ipc_path}/src/register_d_input_call_back_stub.cpp", + "${ipc_path}/src/start_d_input_call_back_proxy.cpp", + "${ipc_path}/src/start_d_input_call_back_stub.cpp", + "${ipc_path}/src/stop_d_input_call_back_proxy.cpp", + "${ipc_path}/src/stop_d_input_call_back_stub.cpp", + "${ipc_path}/src/unprepare_d_input_call_back_proxy.cpp", + "${ipc_path}/src/unprepare_d_input_call_back_stub.cpp", + "${ipc_path}/src/unregister_d_input_call_back_proxy.cpp", + "${ipc_path}/src/unregister_d_input_call_back_stub.cpp", + "${services_source_path}/inputinject/src/distributed_input_inject.cpp", + "${services_source_path}/inputinject/src/distributed_input_node_manager.cpp", + "${services_source_path}/inputinject/src/virtual_device.cpp", + "${services_source_path}/sourcemanager/src/dinput_source_listener.cpp", + "${services_source_path}/sourcemanager/src/dinput_source_manager_event_handler.cpp", + "${services_source_path}/sourcemanager/src/distributed_input_source_event_handler.cpp", + "${services_source_path}/sourcemanager/src/distributed_input_source_manager.cpp", + "${services_source_path}/sourcemanager/src/distributed_input_source_sa_cli_mgr.cpp", + "${services_source_path}/transport/src/distributed_input_source_transport.cpp", + "distributedinputstub_fuzzer.cpp", + ] + + deps = [ + "${dfx_utils_path}:libdinput_dfx_utils", + "${distributedinput_path}/services/state:libdinput_sink_state", + "${innerkits_path}:libdinput_sdk", + "${services_source_path}/transport:libdinput_source_trans", + "${utils_path}:libdinput_utils", + "//third_party/libevdev:libevdev", + ] + + external_deps = [ + "access_token:libaccesstoken_sdk", + "access_token:libnativetoken", + "access_token:libtoken_setproc", + "access_token:libtokenid_sdk", + "c_utils:utils", + "distributed_hardware_fwk:distributedhardwareutils", + "distributed_hardware_fwk:libdhfwk_sdk", + "eventhandler:libeventhandler", + "hicollie:libhicollie", + "hilog:libhilog", + "hisysevent:libhisysevent", + "hitrace:hitrace_meter", + "ipc:ipc_core", + "json:nlohmann_json_static", + "openssl:libcrypto_shared", + "safwk:system_ability_fwk", + "samgr:samgr_proxy", + ] + + defines = [ + "HI_LOG_ENABLE", + "DH_LOG_TAG=\"DistributedInputStubFuzzTest\"", + "LOG_DOMAIN=0xD004120", + ] +} + +############################################################################### +group("fuzztest") { + testonly = true + + deps = [ ":DistributedInputStubFuzzTest" ] +} +############################################################################### diff --git a/interfaces/ipc/test/fuzztest/distributedinputstub_fuzzer/corpus/init b/interfaces/ipc/test/fuzztest/distributedinputstub_fuzzer/corpus/init new file mode 100644 index 0000000000000000000000000000000000000000..7e96755ef6733c8a899d0d1b9b409ac5b0630860 --- /dev/null +++ b/interfaces/ipc/test/fuzztest/distributedinputstub_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# Copyright (c) 2024 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FUZZ \ No newline at end of file diff --git a/interfaces/ipc/test/fuzztest/distributedinputstub_fuzzer/distributedinputstub_fuzzer.cpp b/interfaces/ipc/test/fuzztest/distributedinputstub_fuzzer/distributedinputstub_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..50264efbdeaf8f21807e233eec49f8bc556983fc --- /dev/null +++ b/interfaces/ipc/test/fuzztest/distributedinputstub_fuzzer/distributedinputstub_fuzzer.cpp @@ -0,0 +1,953 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "distributedinputstub_fuzzer.h" + +#include "add_white_list_infos_call_back_stub.h" +#include "del_white_list_infos_call_back_stub.h" +#include "get_sink_screen_infos_call_back_stub.h" +#include "input_node_listener_stub.h" +#include "prepare_d_input_call_back_stub.h" +#include "register_d_input_call_back_stub.h" +#include "register_session_state_callback_stub.h" +#include "sharing_dhid_listener_stub.h" +#include "simulation_event_listener_stub.h" +#include "start_d_input_call_back_stub.h" +#include "start_stop_d_inputs_call_back_stub.h" +#include "start_stop_result_call_back_stub.h" +#include "stop_d_input_call_back_stub.h" +#include "unprepare_d_input_call_back_stub.h" +#include "unregister_d_input_call_back_stub.h" + +namespace OHOS { +namespace DistributedHardware { + +class MyAddWhiteListInfosCallbackStub : public DistributedInput::AddWhiteListInfosCallbackStub { +public: + void OnResult(const std::string &deviceId, const std::string &strJson) override + { + return; + } +}; + +void AddWhiteListInfosCallbackStubFuzzTest(const uint8_t *data, size_t size) +{ + if ((data == nullptr) || (size < sizeof(int32_t))) { + return; + } + MessageParcel pdata; + MessageParcel reply; + MessageOption option; + pdata.WriteInterfaceToken(DistributedInput::AddWhiteListInfosCallbackStub::GetDescriptor()); + uint32_t code = *(reinterpret_cast(data)); + if (code == (uint32_t)DistributedInput::IAddWhiteListInfosCallback::Message::RESULT) { + uint32_t tag = *(reinterpret_cast(data)); + std::string value(reinterpret_cast(data), size); + pdata.WriteUint32(tag); + pdata.WriteString(value); + } else { + int32_t fd = *(reinterpret_cast(data)); + int32_t len = *(reinterpret_cast(data)); + std::string name(reinterpret_cast(data), size); + pdata.WriteFileDescriptor(fd); + pdata.WriteInt32(len); + pdata.WriteString(name); + } + sptr addWhiteListInfos(new (std::nothrow) + MyAddWhiteListInfosCallbackStub()); + addWhiteListInfos->OnRemoteRequest(code, pdata, reply, option); +} + +class MyDelWhiteListInfosCallbackStub : public DistributedInput::DelWhiteListInfosCallbackStub { +public: + void OnResult(const std::string &deviceId) override + { + return; + } +}; + +void DelWhiteListInfosCallbackStubFuzzTest(const uint8_t *data, size_t size) +{ + if ((data == nullptr) || (size < sizeof(int32_t))) { + return; + } + MessageParcel pdata; + MessageParcel reply; + MessageOption option; + uint32_t code = *(reinterpret_cast(data)); + pdata.WriteInterfaceToken(DistributedInput::DelWhiteListInfosCallbackStub::GetDescriptor()); + if (code == (uint32_t)DistributedInput::IDelWhiteListInfosCallback::Message::RESULT) { + uint32_t tag = *(reinterpret_cast(data)); + std::string value(reinterpret_cast(data), size); + pdata.WriteUint32(tag); + pdata.WriteString(value); + } else { + int32_t fd = *(reinterpret_cast(data)); + int32_t len = *(reinterpret_cast(data)); + std::string name(reinterpret_cast(data), size); + pdata.WriteFileDescriptor(fd); + pdata.WriteInt32(len); + pdata.WriteString(name); + } + + sptr delWhiteListInfos(new (std::nothrow) + MyDelWhiteListInfosCallbackStub()); + delWhiteListInfos->OnRemoteRequest(code, pdata, reply, option); +} + +int32_t DistributedInputSinkStubFuzz::Init() +{ + return DistributedInput::DH_SUCCESS; +} + +int32_t DistributedInputSinkStubFuzz::Release() +{ + return DistributedInput::DH_SUCCESS; +} + +int32_t DistributedInputSinkStubFuzz::RegisterGetSinkScreenInfosCallback( + sptr callback) +{ + (void)callback; + return DistributedInput::DH_SUCCESS; +} + +int32_t DistributedInputSinkStubFuzz::NotifyStartDScreen( + const DistributedInput::SrcScreenInfo &remoteCtrlInfo) +{ + (void)remoteCtrlInfo; + return DistributedInput::DH_SUCCESS; +} + +int32_t DistributedInputSinkStubFuzz::NotifyStopDScreen( + const std::string &srcScreenInfoKey) +{ + (void)srcScreenInfoKey; + return DistributedInput::DH_SUCCESS; +} + +int32_t DistributedInputSinkStubFuzz::RegisterSharingDhIdListener( + sptr sharingDhIdListener) +{ + (void)sharingDhIdListener; + return DistributedInput::DH_SUCCESS; +} + +void DistributedInputSinkStubFuzzTest(const uint8_t *data, size_t size) +{ + if ((data == nullptr) || (size < sizeof(int32_t))) { + return; + } + MessageParcel pdata; + MessageParcel reply; + MessageOption option; + pdata.WriteInterfaceToken(DistributedInput::DistributedInputSinkStub::GetDescriptor()); + uint32_t code = *(reinterpret_cast(data)); + uint32_t type = *(reinterpret_cast(data)); + std::string content(reinterpret_cast(data), size); + std::string devId(reinterpret_cast(data), size); + pdata.WriteUint32(type); + pdata.WriteString(content); + pdata.WriteString(devId); + + sptr distributedInputSinkStub(new (std::nothrow) + DistributedInputSinkStubFuzz()); + distributedInputSinkStub->HasEnableDHPermission(); + distributedInputSinkStub->OnRemoteRequest(code, pdata, reply, option); + distributedInputSinkStub->InitInner(pdata, reply, option); + distributedInputSinkStub->ReleaseInner(pdata, reply, option); + distributedInputSinkStub->NotifyStartDScreenInner(pdata, reply, option); + distributedInputSinkStub->NotifyStopDScreenInner(pdata, reply, option); + distributedInputSinkStub->RegisterSharingDhIdListenerInner(pdata, reply, option); + distributedInputSinkStub->RegisterGetSinkScreenInfosInner(pdata, reply, option); +} + +int32_t DInputSourceCallBackStubFuzz::Init() +{ + return DistributedInput::DH_SUCCESS; +} + +int32_t DInputSourceCallBackStubFuzz::Release() +{ + return DistributedInput::DH_SUCCESS; +} + +int32_t DInputSourceCallBackStubFuzz::RegisterDistributedHardware( + const std::string &devId, const std::string &dhId, const std::string ¶meters, + sptr callback) +{ + (void)devId; + (void)dhId; + (void)parameters; + (void)callback; + return DistributedInput::DH_SUCCESS; +} + +int32_t DInputSourceCallBackStubFuzz::UnregisterDistributedHardware( + const std::string &devId, const std::string &dhId, + sptr callback) +{ + (void)devId; + (void)dhId; + (void)callback; + return DistributedInput::DH_SUCCESS; +} + +int32_t DInputSourceCallBackStubFuzz::PrepareRemoteInput( + const std::string &deviceId, sptr callback) +{ + (void)deviceId; + (void)callback; + return DistributedInput::DH_SUCCESS; +} + +int32_t DInputSourceCallBackStubFuzz::UnprepareRemoteInput( + const std::string &deviceId, sptr callback) +{ + (void)deviceId; + (void)callback; + return DistributedInput::DH_SUCCESS; +} + +int32_t DInputSourceCallBackStubFuzz::StartRemoteInput( + const std::string &deviceId, const uint32_t &inputTypes, sptr callback) +{ + (void)deviceId; + (void)inputTypes; + (void)callback; + return DistributedInput::DH_SUCCESS; +} + +int32_t DInputSourceCallBackStubFuzz::StopRemoteInput( + const std::string &deviceId, const uint32_t &inputTypes, sptr callback) +{ + (void)deviceId; + (void)inputTypes; + (void)callback; + return DistributedInput::DH_SUCCESS; +} + +int32_t DInputSourceCallBackStubFuzz::StartRemoteInput( + const std::string &srcId, const std::string &sinkId, const uint32_t &inputTypes, + sptr callback) +{ + (void)srcId; + (void)sinkId; + (void)inputTypes; + (void)callback; + return DistributedInput::DH_SUCCESS; +} + +int32_t DInputSourceCallBackStubFuzz::StopRemoteInput( + const std::string &srcId, const std::string &sinkId, const uint32_t &inputTypes, + sptr callback) +{ + (void)srcId; + (void)sinkId; + (void)inputTypes; + (void)callback; + return DistributedInput::DH_SUCCESS; +} + +int32_t DInputSourceCallBackStubFuzz::PrepareRemoteInput( + const std::string &srcId, const std::string &sinkId, + sptr callback) +{ + (void)srcId; + (void)sinkId; + (void)callback; + return DistributedInput::DH_SUCCESS; +} + +int32_t DInputSourceCallBackStubFuzz::UnprepareRemoteInput( + const std::string &srcId, const std::string &sinkId, + sptr callback) +{ + (void)srcId; + (void)sinkId; + (void)callback; + return DistributedInput::DH_SUCCESS; +} + +int32_t DInputSourceCallBackStubFuzz::StartRemoteInput( + const std::string &sinkId, const std::vector &dhIds, + sptr callback) +{ + (void)sinkId; + (void)dhIds; + (void)callback; + return DistributedInput::DH_SUCCESS; +} + +int32_t DInputSourceCallBackStubFuzz::StopRemoteInput( + const std::string &sinkId, const std::vector &dhIds, + sptr callback) +{ + (void)sinkId; + (void)dhIds; + (void)callback; + return DistributedInput::DH_SUCCESS; +} + +int32_t DInputSourceCallBackStubFuzz::StartRemoteInput( + const std::string &srcId, const std::string &sinkId, + const std::vector &dhIds, sptr callback) +{ + (void)srcId; + (void)sinkId; + (void)dhIds; + (void)callback; + return DistributedInput::DH_SUCCESS; +} + +int32_t DInputSourceCallBackStubFuzz::StopRemoteInput( + const std::string &srcId, const std::string &sinkId, + const std::vector &dhIds, sptr callback) +{ + (void)srcId; + (void)sinkId; + (void)dhIds; + (void)callback; + return DistributedInput::DH_SUCCESS; +} + +int32_t DInputSourceCallBackStubFuzz::RegisterAddWhiteListCallback( + sptr addWhiteListCallback) +{ + (void)addWhiteListCallback; + return DistributedInput::DH_SUCCESS; +} + +int32_t DInputSourceCallBackStubFuzz::RegisterDelWhiteListCallback( + sptr delWhiteListCallback) +{ + (void)delWhiteListCallback; + return DistributedInput::DH_SUCCESS; +} + +int32_t DInputSourceCallBackStubFuzz::RegisterSimulationEventListener( + sptr listener) +{ + (void)listener; + return DistributedInput::DH_SUCCESS; +} + +int32_t DInputSourceCallBackStubFuzz::UnregisterSimulationEventListener( + sptr listener) +{ + (void)listener; + return DistributedInput::DH_SUCCESS; +} + +int32_t DInputSourceCallBackStubFuzz::RegisterSessionStateCb( + sptr callback) +{ + (void)callback; + return DistributedInput::DH_SUCCESS; +} + +int32_t DInputSourceCallBackStubFuzz::UnregisterSessionStateCb() +{ + return DistributedInput::DH_SUCCESS; +} + +void DInputSourceCallBackStubFuzz::OnResult(const std::string &deviceId, + const std::string &strJson) +{ + deviceId_ = deviceId; + strJson_ = strJson; +} + +void DistributedInputSourceStubFuzzTest(const uint8_t *data, size_t size) +{ + if ((data == nullptr) || (size < sizeof(int32_t))) { + return; + } + MessageParcel pdata; + MessageParcel reply; + MessageOption option; + pdata.WriteInterfaceToken(DistributedInput::DistributedInputSourceStub::GetDescriptor()); + uint32_t code = *(reinterpret_cast(data)); + uint32_t type = *(reinterpret_cast(data)); + std::string content(reinterpret_cast(data), size); + std::string devId(reinterpret_cast(data), size); + pdata.WriteUint32(type); + pdata.WriteString(content); + pdata.WriteString(devId); + + sptr distributedInputSourceStub(new (std::nothrow) + DInputSourceCallBackStubFuzz()); + distributedInputSourceStub->RegRespFunMap(); + distributedInputSourceStub->HasEnableDHPermission(); + distributedInputSourceStub->HasAccessDHPermission(); + distributedInputSourceStub->HandleInitDistributedHardware(reply); + distributedInputSourceStub->HandleReleaseDistributedHardware(reply); + distributedInputSourceStub->HandleRegisterDistributedHardware(pdata, reply); + distributedInputSourceStub->HandleUnregisterDistributedHardware(pdata, reply); + distributedInputSourceStub->HandlePrepareRemoteInput(pdata, reply); + distributedInputSourceStub->HandleUnprepareRemoteInput(pdata, reply); + distributedInputSourceStub->HandleStartRemoteInput(pdata, reply); + distributedInputSourceStub->HandleStopRemoteInput(pdata, reply); + distributedInputSourceStub->HandleStartRelayTypeRemoteInput(pdata, reply); + distributedInputSourceStub->HandleStopRelayTypeRemoteInput(pdata, reply); + distributedInputSourceStub->HandlePrepareRelayRemoteInput(pdata, reply); + distributedInputSourceStub->HandleUnprepareRelayRemoteInput(pdata, reply); + distributedInputSourceStub->HandleStartDhidRemoteInput(pdata, reply); + distributedInputSourceStub->HandleStopDhidRemoteInput(pdata, reply); + distributedInputSourceStub->HandleStartRelayDhidRemoteInput(pdata, reply); + distributedInputSourceStub->HandleStopRelayDhidRemoteInput(pdata, reply); + distributedInputSourceStub->HandleRegisterAddWhiteListCallback(pdata, reply); + distributedInputSourceStub->HandleRegisterDelWhiteListCallback(pdata, reply); + distributedInputSourceStub->HandleRegisterSimulationEventListener(pdata, reply); + distributedInputSourceStub->HandleUnregisterSimulationEventListener(pdata, reply); + distributedInputSourceStub->HandleRegisterSessionStateCb(pdata, reply); + distributedInputSourceStub->HandleUnregisterSessionStateCb(pdata, reply); + distributedInputSourceStub->OnRemoteRequest(code, pdata, reply, option); +} + +class MyGetSinkScreenInfosCallbackStub : public DistributedInput::GetSinkScreenInfosCallbackStub { +public: + void OnResult(const std::string &deviceId) override + { + return; + } +}; + +void GetSinkScreenInfosCallbackStubFuzzTest(const uint8_t *data, size_t size) +{ + if ((data == nullptr) || (size < sizeof(int32_t))) { + return; + } + MessageParcel pdata; + MessageParcel reply; + MessageOption option; + uint32_t code = *(reinterpret_cast(data)); + pdata.WriteInterfaceToken(DistributedInput::GetSinkScreenInfosCallbackStub::GetDescriptor()); + if (code == (uint32_t)DistributedInput::IGetSinkScreenInfosCallback::Message::RESULT) { + uint32_t tag = *(reinterpret_cast(data)); + std::string value(reinterpret_cast(data), size); + pdata.WriteUint32(tag); + pdata.WriteString(value); + } else { + int32_t fd = *(reinterpret_cast(data)); + int32_t len = *(reinterpret_cast(data)); + std::string name(reinterpret_cast(data), size); + pdata.WriteFileDescriptor(fd); + pdata.WriteInt32(len); + pdata.WriteString(name); + } + + sptr getSinkScreenInfosCbStub(new (std::nothrow) + MyGetSinkScreenInfosCallbackStub()); + getSinkScreenInfosCbStub->OnRemoteRequest(code, pdata, reply, option); +} + +class MyInputNodeListenerStub : public DistributedInput::InputNodeListenerStub { +public: + void OnNodeOnLine(const std::string srcDevId, const std::string sinkDevId, + const std::string sinkNodeId, const std::string sinkNodeDesc) override + { + return; + } + + void OnNodeOffLine(const std::string srcDevId, const std::string sinkDevId, + const std::string sinkNodeId) override + { + return; + } +}; + +void InputNodeListenerStubFuzzTest(const uint8_t *data, size_t size) +{ + if ((data == nullptr) || (size < sizeof(int32_t))) { + return; + } + MessageParcel pdata; + MessageParcel reply; + MessageOption option; + uint32_t code = *(reinterpret_cast(data)); + pdata.WriteInterfaceToken(DistributedInput::InputNodeListenerStub::GetDescriptor()); + if (code == (uint32_t)DistributedInput::InputNodeListener::Message::RESULT_ON) { + uint32_t tag = *(reinterpret_cast(data)); + std::string value(reinterpret_cast(data), size); + pdata.WriteUint32(tag); + pdata.WriteString(value); + } else if (code == (uint32_t)DistributedInput::InputNodeListener::Message::RESULT_OFF) { + int32_t fd = *(reinterpret_cast(data)); + int32_t len = *(reinterpret_cast(data)); + std::string name(reinterpret_cast(data), size); + pdata.WriteFileDescriptor(fd); + pdata.WriteInt32(len); + pdata.WriteString(name); + } else { + uint32_t type = *(reinterpret_cast(data)); + std::string content(reinterpret_cast(data), size); + std::string devId(reinterpret_cast(data), size); + pdata.WriteUint32(type); + pdata.WriteString(content); + pdata.WriteString(devId); + } + + sptr inputNodeListenerStub(new (std::nothrow) + MyInputNodeListenerStub()); + inputNodeListenerStub->OnRemoteRequest(code, pdata, reply, option); +} + +class MyPrepareDInputCallbackStub : public DistributedInput::PrepareDInputCallbackStub { +public: + void OnResult(const std::string &devId, const int32_t &status) override + { + return; + } +}; + +void PrepareDInputCallbackStubFuzzTest(const uint8_t *data, size_t size) +{ + if ((data == nullptr) || (size < sizeof(int32_t))) { + return; + } + MessageParcel pdata; + MessageParcel reply; + MessageOption option; + uint32_t code = *(reinterpret_cast(data)); + pdata.WriteInterfaceToken(DistributedInput::PrepareDInputCallbackStub::GetDescriptor()); + if (code == (uint32_t)DistributedInput::IPrepareDInputCallback::Message::RESULT) { + uint32_t tag = *(reinterpret_cast(data)); + std::string value(reinterpret_cast(data), size); + pdata.WriteUint32(tag); + pdata.WriteString(value); + } else { + int32_t fd = *(reinterpret_cast(data)); + int32_t len = *(reinterpret_cast(data)); + std::string name(reinterpret_cast(data), size); + pdata.WriteFileDescriptor(fd); + pdata.WriteInt32(len); + pdata.WriteString(name); + } + sptr prepareDInputCallbackStub(new (std::nothrow) + MyPrepareDInputCallbackStub()); + prepareDInputCallbackStub->OnRemoteRequest(code, pdata, reply, option); +} + +class MyRegisterDInputCallbackStub : public DistributedInput::RegisterDInputCallbackStub { +public: + void OnResult(const std::string &devId, const std::string &dhId, const int32_t &status) override + { + return; + } +}; + +void RegisterDInputCallbackStubFuzzTest(const uint8_t *data, size_t size) +{ + if ((data == nullptr) || (size < sizeof(int32_t))) { + return; + } + MessageParcel pdata; + MessageParcel reply; + MessageOption option; + uint32_t code = *(reinterpret_cast(data)); + pdata.WriteInterfaceToken(DistributedInput::RegisterDInputCallbackStub::GetDescriptor()); + if (code == (uint32_t)DistributedInput::IRegisterDInputCallback::Message::RESULT) { + uint32_t tag = *(reinterpret_cast(data)); + std::string value(reinterpret_cast(data), size); + pdata.WriteUint32(tag); + pdata.WriteString(value); + } else { + int32_t fd = *(reinterpret_cast(data)); + int32_t len = *(reinterpret_cast(data)); + std::string name(reinterpret_cast(data), size); + pdata.WriteFileDescriptor(fd); + pdata.WriteInt32(len); + pdata.WriteString(name); + } + sptr registerDInputCallbackStub(new (std::nothrow) + MyRegisterDInputCallbackStub()); + registerDInputCallbackStub->OnRemoteRequest(code, pdata, reply, option); +} + +class MyRegisterSessionStateCallbackStub : public DistributedInput::RegisterSessionStateCallbackStub { +public: + void OnResult(const std::string &devId, const uint32_t status) override + { + return; + } +}; + +void RegisterSessionStateCallbackStubFuzzTest(const uint8_t *data, size_t size) +{ + if ((data == nullptr) || (size < sizeof(int32_t))) { + return; + } + MessageParcel pdata; + MessageParcel reply; + MessageOption option; + uint32_t code = *(reinterpret_cast(data)); + pdata.WriteInterfaceToken(DistributedInput::RegisterSessionStateCallbackStub::GetDescriptor()); + if (code == (uint32_t)DistributedInput::ISessionStateCallback::Message::RESULT) { + uint32_t tag = *(reinterpret_cast(data)); + std::string value(reinterpret_cast(data), size); + pdata.WriteUint32(tag); + pdata.WriteString(value); + } else { + int32_t fd = *(reinterpret_cast(data)); + int32_t len = *(reinterpret_cast(data)); + std::string name(reinterpret_cast(data), size); + pdata.WriteFileDescriptor(fd); + pdata.WriteInt32(len); + pdata.WriteString(name); + } + sptr registerSessionStateCbkStub(new (std::nothrow) + MyRegisterSessionStateCallbackStub()); + registerSessionStateCbkStub->OnRemoteRequest(code, pdata, reply, option); +} + +class MySharingDhIdListenerStub : public DistributedInput::SharingDhIdListenerStub { +public: + int32_t OnSharing(std::string dhId) override + { + return 0; + } + + int32_t OnNoSharing(std::string dhId) override + { + return 0; + } +}; + +void SharingDhIdListenerStubFuzzTest(const uint8_t *data, size_t size) +{ + if ((data == nullptr) || (size < sizeof(int32_t))) { + return; + } + MessageParcel pdata; + MessageParcel reply; + MessageOption option; + uint32_t code = *(reinterpret_cast(data)); + pdata.WriteInterfaceToken(DistributedInput::SharingDhIdListenerStub::GetDescriptor()); + if (code == (uint32_t)DistributedInput::ISharingDhIdListener::Message::SHARING) { + uint32_t tag = *(reinterpret_cast(data)); + std::string value(reinterpret_cast(data), size); + pdata.WriteUint32(tag); + pdata.WriteString(value); + } else if (code == (uint32_t)DistributedInput::ISharingDhIdListener::Message::NO_SHARING) { + int32_t fd = *(reinterpret_cast(data)); + int32_t len = *(reinterpret_cast(data)); + std::string name(reinterpret_cast(data), size); + pdata.WriteFileDescriptor(fd); + pdata.WriteInt32(len); + pdata.WriteString(name); + } else { + uint32_t type = *(reinterpret_cast(data)); + std::string content(reinterpret_cast(data), size); + std::string devId(reinterpret_cast(data), size); + pdata.WriteUint32(type); + pdata.WriteString(content); + pdata.WriteString(devId); + } + sptr sharingDhIdListenerStub(new (std::nothrow) + MySharingDhIdListenerStub()); + sharingDhIdListenerStub->OnRemoteRequest(code, pdata, reply, option); +} + +class MySimulationEventListenerStub : public DistributedInput::SimulationEventListenerStub { +public: + int32_t OnSimulationEvent(uint32_t type, uint32_t code, int32_t value) override + { + return 0; + } +}; + +void SimulationEventListenerStubFuzzTest(const uint8_t *data, size_t size) +{ + if ((data == nullptr) || (size < sizeof(int32_t))) { + return; + } + MessageParcel pdata; + MessageParcel reply; + MessageOption option; + uint32_t code = *(reinterpret_cast(data)); + pdata.WriteInterfaceToken(DistributedInput::SimulationEventListenerStub::GetDescriptor()); + if (code == (uint32_t)DistributedInput::ISimulationEventListener::Message::RESULT_ON) { + uint32_t tag = *(reinterpret_cast(data)); + std::string value(reinterpret_cast(data), size); + pdata.WriteUint32(tag); + pdata.WriteString(value); + } else { + int32_t fd = *(reinterpret_cast(data)); + int32_t len = *(reinterpret_cast(data)); + std::string name(reinterpret_cast(data), size); + pdata.WriteFileDescriptor(fd); + pdata.WriteInt32(len); + pdata.WriteString(name); + } + sptr simulationEventListenerStub(new (std::nothrow) + MySimulationEventListenerStub()); + simulationEventListenerStub->OnRemoteRequest(code, pdata, reply, option); +} + +class MyStartDInputCallbackStub : public DistributedInput::StartDInputCallbackStub { +public: + void OnResult(const std::string &devId, const uint32_t &inputTypes, const int32_t &status) override + { + return; + } +}; + +void StartDInputCallbackStubFuzzTest(const uint8_t *data, size_t size) +{ + if ((data == nullptr) || (size < sizeof(int32_t))) { + return; + } + MessageParcel pdata; + MessageParcel reply; + MessageOption option; + uint32_t code = *(reinterpret_cast(data)); + pdata.WriteInterfaceToken(DistributedInput::StartDInputCallbackStub::GetDescriptor()); + if (code == (uint32_t)DistributedInput::IStartDInputCallback::Message::RESULT) { + uint32_t tag = *(reinterpret_cast(data)); + std::string value(reinterpret_cast(data), size); + pdata.WriteUint32(tag); + pdata.WriteString(value); + } else { + int32_t fd = *(reinterpret_cast(data)); + int32_t len = *(reinterpret_cast(data)); + std::string name(reinterpret_cast(data), size); + pdata.WriteFileDescriptor(fd); + pdata.WriteInt32(len); + pdata.WriteString(name); + } + sptr startDInputCallbackStub(new (std::nothrow) + MyStartDInputCallbackStub()); + startDInputCallbackStub->OnRemoteRequest(code, pdata, reply, option); +} + +class MyStartStopDInputsCallbackStub : public DistributedInput::StartStopDInputsCallbackStub { +public: + void OnResultDhids(const std::string &devId, const int32_t &status) override + { + return; + } +}; + +void StartStopDInputsCallbackStubFuzzTest(const uint8_t *data, size_t size) +{ + if ((data == nullptr) || (size < sizeof(int32_t))) { + return; + } + MessageParcel pdata; + MessageParcel reply; + MessageOption option; + uint32_t code = *(reinterpret_cast(data)); + pdata.WriteInterfaceToken(DistributedInput::StartStopDInputsCallbackStub::GetDescriptor()); + if (code == (uint32_t)DistributedInput::IStartStopDInputsCallback::Message::RESULT_STRING) { + uint32_t tag = *(reinterpret_cast(data)); + std::string value(reinterpret_cast(data), size); + pdata.WriteUint32(tag); + pdata.WriteString(value); + } else { + int32_t fd = *(reinterpret_cast(data)); + int32_t len = *(reinterpret_cast(data)); + std::string name(reinterpret_cast(data), size); + pdata.WriteFileDescriptor(fd); + pdata.WriteInt32(len); + pdata.WriteString(name); + } + sptr startStopDInputsCallbackStub(new (std::nothrow) + MyStartStopDInputsCallbackStub()); + startStopDInputsCallbackStub->OnRemoteRequest(code, pdata, reply, option); +} + +class MyStartStopResultCallbackStub : public DistributedInput::StartStopResultCallbackStub { +public: + void OnStart(const std::string &srcId, const std::string &sinkId, + std::vector &dhIds) override + { + return; + } + void OnStop(const std::string &srcId, const std::string &sinkId, + std::vector &dhIds) override + { + return; + } +}; + +void StartStopResultCallbackStubFuzzTest(const uint8_t *data, size_t size) +{ + if ((data == nullptr) || (size < sizeof(int32_t))) { + return; + } + MessageParcel pdata; + MessageParcel reply; + MessageOption option; + uint32_t code = *(reinterpret_cast(data)); + pdata.WriteInterfaceToken(DistributedInput::StartStopResultCallbackStub::GetDescriptor()); + if (code == (uint32_t)DistributedInput::IStartStopResultCallback::Message::RESULT_START) { + uint32_t tag = *(reinterpret_cast(data)); + std::string value(reinterpret_cast(data), size); + pdata.WriteUint32(tag); + pdata.WriteString(value); + } else if (code == (uint32_t)DistributedInput::IStartStopResultCallback::Message::RESULT_STOP) { + int32_t fd = *(reinterpret_cast(data)); + int32_t len = *(reinterpret_cast(data)); + std::string name(reinterpret_cast(data), size); + pdata.WriteFileDescriptor(fd); + pdata.WriteInt32(len); + pdata.WriteString(name); + } else { + uint32_t type = *(reinterpret_cast(data)); + std::string content(reinterpret_cast(data), size); + std::string devId(reinterpret_cast(data), size); + pdata.WriteUint32(type); + pdata.WriteString(content); + pdata.WriteString(devId); + } + sptr startStopResultCallbackStub(new (std::nothrow) + MyStartStopResultCallbackStub()); + startStopResultCallbackStub->OnRemoteRequest(code, pdata, reply, option); +} + +class MyStopDInputCallbackStub : public DistributedInput::StopDInputCallbackStub { +public: + void OnResult(const std::string &devId, const uint32_t &inputTypes, const int32_t &status) override + { + return; + } +}; + +void StopDInputCallbackStubFuzzTest(const uint8_t *data, size_t size) +{ + if ((data == nullptr) || (size < sizeof(int32_t))) { + return; + } + MessageParcel pdata; + MessageParcel reply; + MessageOption option; + uint32_t code = *(reinterpret_cast(data)); + pdata.WriteInterfaceToken(DistributedInput::StopDInputCallbackStub::GetDescriptor()); + if (code == (uint32_t)DistributedInput::IStopDInputCallback::Message::RESULT) { + uint32_t tag = *(reinterpret_cast(data)); + std::string value(reinterpret_cast(data), size); + pdata.WriteUint32(tag); + pdata.WriteString(value); + } else { + int32_t fd = *(reinterpret_cast(data)); + int32_t len = *(reinterpret_cast(data)); + std::string name(reinterpret_cast(data), size); + pdata.WriteFileDescriptor(fd); + pdata.WriteInt32(len); + pdata.WriteString(name); + } + sptr stopDInputCallbackStub(new (std::nothrow) + MyStopDInputCallbackStub()); + stopDInputCallbackStub->OnRemoteRequest(code, pdata, reply, option); +} + +class MyUnprepareDInputCallbackStub : public DistributedInput::UnprepareDInputCallbackStub { +public: + void OnResult(const std::string &devId, const int32_t &status) override + { + return; + } +}; + +void UnprepareDInputCallbackStubFuzzTest(const uint8_t *data, size_t size) +{ + if ((data == nullptr) || (size < sizeof(int32_t))) { + return; + } + MessageParcel pdata; + MessageParcel reply; + MessageOption option; + uint32_t code = *(reinterpret_cast(data)); + pdata.WriteInterfaceToken(DistributedInput::UnprepareDInputCallbackStub::GetDescriptor()); + if (code == (uint32_t)DistributedInput::IUnprepareDInputCallback::Message::RESULT) { + uint32_t tag = *(reinterpret_cast(data)); + std::string value(reinterpret_cast(data), size); + pdata.WriteUint32(tag); + pdata.WriteString(value); + } else { + int32_t fd = *(reinterpret_cast(data)); + int32_t len = *(reinterpret_cast(data)); + std::string name(reinterpret_cast(data), size); + pdata.WriteFileDescriptor(fd); + pdata.WriteInt32(len); + pdata.WriteString(name); + } + sptr unprepareDInputCallbackStub(new (std::nothrow) + MyUnprepareDInputCallbackStub()); + unprepareDInputCallbackStub->OnRemoteRequest(code, pdata, reply, option); +} + +class MyUnregisterDInputCallbackStub : public DistributedInput::UnregisterDInputCallbackStub { +public: + void OnResult(const std::string &devId, const std::string &dhId, const int32_t &status) override + { + return; + } +}; + +void UnregisterDInputCallbackStubFuzzTest(const uint8_t *data, size_t size) +{ + if ((data == nullptr) || (size < sizeof(int32_t))) { + return; + } + MessageParcel pdata; + MessageParcel reply; + MessageOption option; + uint32_t code = *(reinterpret_cast(data)); + pdata.WriteInterfaceToken(DistributedInput::UnregisterDInputCallbackStub::GetDescriptor()); + if (code == (uint32_t)DistributedInput::IUnprepareDInputCallback::Message::RESULT) { + uint32_t tag = *(reinterpret_cast(data)); + std::string value(reinterpret_cast(data), size); + pdata.WriteUint32(tag); + pdata.WriteString(value); + } else { + int32_t fd = *(reinterpret_cast(data)); + int32_t len = *(reinterpret_cast(data)); + std::string name(reinterpret_cast(data), size); + pdata.WriteFileDescriptor(fd); + pdata.WriteInt32(len); + pdata.WriteString(name); + } + sptr unregisterDInputCallbackStub(new (std::nothrow) + MyUnregisterDInputCallbackStub()); + unregisterDInputCallbackStub->OnRemoteRequest(code, pdata, reply, option); +} +} // namespace DistributedHardware +} // namespace OHOS + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +{ + /* Run your code on data */ + OHOS::DistributedHardware::AddWhiteListInfosCallbackStubFuzzTest(data, size); + OHOS::DistributedHardware::DelWhiteListInfosCallbackStubFuzzTest(data, size); + OHOS::DistributedHardware::DistributedInputSinkStubFuzzTest(data, size); + OHOS::DistributedHardware::DistributedInputSourceStubFuzzTest(data, size); + OHOS::DistributedHardware::GetSinkScreenInfosCallbackStubFuzzTest(data, size); + OHOS::DistributedHardware::InputNodeListenerStubFuzzTest(data, size); + OHOS::DistributedHardware::PrepareDInputCallbackStubFuzzTest(data, size); + OHOS::DistributedHardware::RegisterDInputCallbackStubFuzzTest(data, size); + OHOS::DistributedHardware::RegisterSessionStateCallbackStubFuzzTest(data, size); + OHOS::DistributedHardware::SharingDhIdListenerStubFuzzTest(data, size); + OHOS::DistributedHardware::SimulationEventListenerStubFuzzTest(data, size); + OHOS::DistributedHardware::StartDInputCallbackStubFuzzTest(data, size); + OHOS::DistributedHardware::StartStopDInputsCallbackStubFuzzTest(data, size); + OHOS::DistributedHardware::StartStopResultCallbackStubFuzzTest(data, size); + OHOS::DistributedHardware::StopDInputCallbackStubFuzzTest(data, size); + OHOS::DistributedHardware::UnprepareDInputCallbackStubFuzzTest(data, size); + OHOS::DistributedHardware::UnregisterDInputCallbackStubFuzzTest(data, size); + return 0; +} \ No newline at end of file diff --git a/interfaces/ipc/test/fuzztest/distributedinputstub_fuzzer/distributedinputstub_fuzzer.h b/interfaces/ipc/test/fuzztest/distributedinputstub_fuzzer/distributedinputstub_fuzzer.h new file mode 100644 index 0000000000000000000000000000000000000000..bce6b17da590b50a7f71ee0781e88c9db5a3774c --- /dev/null +++ b/interfaces/ipc/test/fuzztest/distributedinputstub_fuzzer/distributedinputstub_fuzzer.h @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef DISTRIBUTEDINPUTSTUB_FUZZER_H +#define DISTRIBUTEDINPUTSTUB_FUZZER_H + +#define FUZZ_PROJECT_NAME "distributedinputstub_fuzzer.cpp" + +#include "constants_dinput.h" +#include "dinput_errcode.h" +#include "distributed_input_sink_stub.h" +#include "distributed_input_source_stub.h" + +namespace OHOS { +namespace DistributedHardware { + +class DistributedInputSinkStubFuzz : public + OHOS::DistributedHardware::DistributedInput::DistributedInputSinkStub { +public: + DistributedInputSinkStubFuzz() = default; + virtual ~DistributedInputSinkStubFuzz() = default; + int32_t Init(); + int32_t Release(); + int32_t RegisterGetSinkScreenInfosCallback(sptr callback); + int32_t NotifyStartDScreen(const DistributedInput::SrcScreenInfo &remoteCtrlInfo); + int32_t NotifyStopDScreen(const std::string &srcScreenInfoKey); + int32_t RegisterSharingDhIdListener(sptr sharingDhIdListener); +}; + +class DInputSourceCallBackStubFuzz : public + OHOS::DistributedHardware::DistributedInput::DistributedInputSourceStub { +public: + DInputSourceCallBackStubFuzz() = default; + virtual ~DInputSourceCallBackStubFuzz() = default; + int32_t Init(); + int32_t Release() ; + int32_t RegisterDistributedHardware( + const std::string &devId, const std::string &dhId, const std::string ¶meters, + sptr callback); + int32_t UnregisterDistributedHardware( + const std::string &devId, const std::string &dhId, sptr callback); + int32_t PrepareRemoteInput(const std::string &deviceId, sptr callback); + int32_t UnprepareRemoteInput(const std::string &deviceId, + sptr callback); + int32_t StartRemoteInput( + const std::string &deviceId, const uint32_t &inputTypes, + sptr callback); + int32_t StopRemoteInput( + const std::string &deviceId, const uint32_t &inputTypes, + sptr callback); + int32_t StartRemoteInput(const std::string &srcId, const std::string &sinkId, const uint32_t &inputTypes, + sptr callback); + int32_t StopRemoteInput(const std::string &srcId, const std::string &sinkId, const uint32_t &inputTypes, + sptr callback); + int32_t PrepareRemoteInput(const std::string &srcId, const std::string &sinkId, + sptr callback); + int32_t UnprepareRemoteInput(const std::string &srcId, const std::string &sinkId, + sptr callback); + int32_t StartRemoteInput(const std::string &sinkId, const std::vector &dhIds, + sptr callback); + int32_t StopRemoteInput(const std::string &sinkId, const std::vector &dhIds, + sptr callback); + int32_t StartRemoteInput(const std::string &srcId, const std::string &sinkId, + const std::vector &dhIds, sptr callback); + int32_t StopRemoteInput(const std::string &srcId, const std::string &sinkId, + const std::vector &dhIds, sptr callback); + + int32_t RegisterAddWhiteListCallback(sptr addWhiteListCallback); + int32_t RegisterDelWhiteListCallback(sptr delWhiteListCallback); + int32_t RegisterSimulationEventListener(sptr listener); + int32_t UnregisterSimulationEventListener(sptr listener); + int32_t RegisterSessionStateCb(sptr callback); + int32_t UnregisterSessionStateCb(); + void OnResult(const std::string &deviceId, const std::string &strJson); + std::string deviceId_; + std::string strJson_; +}; +} // namespace DistributedHardware +} // namespace OHOS +#endif \ No newline at end of file diff --git a/interfaces/ipc/test/fuzztest/distributedinputstub_fuzzer/project.xml b/interfaces/ipc/test/fuzztest/distributedinputstub_fuzzer/project.xml new file mode 100644 index 0000000000000000000000000000000000000000..7133b2b92440904a5ed04b838733acea0f97486a --- /dev/null +++ b/interfaces/ipc/test/fuzztest/distributedinputstub_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + +