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 #include "distributedinputstub_fuzzer.h"
17
18 #include <fuzzer/FuzzedDataProvider.h>
19
20 #include "add_white_list_infos_call_back_stub.h"
21 #include "del_white_list_infos_call_back_stub.h"
22 #include "get_sink_screen_infos_call_back_stub.h"
23 #include "input_node_listener_stub.h"
24 #include "prepare_d_input_call_back_stub.h"
25 #include "register_d_input_call_back_stub.h"
26 #include "register_session_state_callback_stub.h"
27 #include "sharing_dhid_listener_stub.h"
28 #include "simulation_event_listener_stub.h"
29 #include "start_d_input_call_back_stub.h"
30 #include "start_stop_d_inputs_call_back_stub.h"
31 #include "start_stop_result_call_back_stub.h"
32 #include "stop_d_input_call_back_stub.h"
33 #include "unprepare_d_input_call_back_stub.h"
34 #include "unregister_d_input_call_back_stub.h"
35
36 namespace OHOS {
37 namespace DistributedHardware {
38
39 class MyAddWhiteListInfosCallbackStub : public DistributedInput::AddWhiteListInfosCallbackStub {
40 public:
OnResult(const std::string & deviceId,const std::string & strJson)41 void OnResult(const std::string &deviceId, const std::string &strJson) override
42 {
43 return;
44 }
45 };
46
AddWhiteListInfosCallbackStubFuzzTest(const uint8_t * data,size_t size)47 void AddWhiteListInfosCallbackStubFuzzTest(const uint8_t *data, size_t size)
48 {
49 if ((data == nullptr) || (size < sizeof(int32_t))) {
50 return;
51 }
52 MessageParcel pdata;
53 MessageParcel reply;
54 MessageOption option;
55 FuzzedDataProvider fdp(data, size);
56 pdata.WriteInterfaceToken(DistributedInput::AddWhiteListInfosCallbackStub::GetDescriptor());
57 uint32_t code = fdp.ConsumeIntegral<uint32_t>();
58 if (code == (uint32_t)DistributedInput::IAddWhiteListInfosCallback::Message::RESULT) {
59 uint32_t tag = fdp.ConsumeIntegral<uint32_t>();
60 std::string value = fdp.ConsumeRandomLengthString();
61 pdata.WriteUint32(tag);
62 pdata.WriteString(value);
63 } else {
64 int32_t fd = fdp.ConsumeIntegral<int32_t>();
65 int32_t len = fdp.ConsumeIntegral<int32_t>();
66 std::string name = fdp.ConsumeRandomLengthString();
67 pdata.WriteFileDescriptor(fd);
68 pdata.WriteInt32(len);
69 pdata.WriteString(name);
70 }
71 sptr<DistributedInput::AddWhiteListInfosCallbackStub> addWhiteListInfos(new (std::nothrow)
72 MyAddWhiteListInfosCallbackStub());
73 if (addWhiteListInfos == nullptr) {
74 return;
75 }
76 addWhiteListInfos->OnRemoteRequest(code, pdata, reply, option);
77 }
78
79 class MyDelWhiteListInfosCallbackStub : public DistributedInput::DelWhiteListInfosCallbackStub {
80 public:
OnResult(const std::string & deviceId)81 void OnResult(const std::string &deviceId) override
82 {
83 return;
84 }
85 };
86
DelWhiteListInfosCallbackStubFuzzTest(const uint8_t * data,size_t size)87 void DelWhiteListInfosCallbackStubFuzzTest(const uint8_t *data, size_t size)
88 {
89 if ((data == nullptr) || (size < sizeof(int32_t))) {
90 return;
91 }
92 MessageParcel pdata;
93 MessageParcel reply;
94 MessageOption option;
95 FuzzedDataProvider fdp(data, size);
96 uint32_t code = fdp.ConsumeIntegral<uint32_t>();
97 pdata.WriteInterfaceToken(DistributedInput::DelWhiteListInfosCallbackStub::GetDescriptor());
98 if (code == (uint32_t)DistributedInput::IDelWhiteListInfosCallback::Message::RESULT) {
99 uint32_t tag = fdp.ConsumeIntegral<uint32_t>();
100 std::string value = fdp.ConsumeRandomLengthString();
101 pdata.WriteUint32(tag);
102 pdata.WriteString(value);
103 } else {
104 int32_t fd = fdp.ConsumeIntegral<int32_t>();
105 int32_t len = fdp.ConsumeIntegral<int32_t>();
106 std::string name = fdp.ConsumeRandomLengthString();
107 pdata.WriteFileDescriptor(fd);
108 pdata.WriteInt32(len);
109 pdata.WriteString(name);
110 }
111
112 sptr<DistributedInput::DelWhiteListInfosCallbackStub> delWhiteListInfos(new (std::nothrow)
113 MyDelWhiteListInfosCallbackStub());
114 if (delWhiteListInfos == nullptr) {
115 return;
116 }
117 delWhiteListInfos->OnRemoteRequest(code, pdata, reply, option);
118 }
119
Init()120 int32_t DistributedInputSinkStubFuzz::Init()
121 {
122 return DistributedInput::DH_SUCCESS;
123 }
124
Release()125 int32_t DistributedInputSinkStubFuzz::Release()
126 {
127 return DistributedInput::DH_SUCCESS;
128 }
129
RegisterGetSinkScreenInfosCallback(sptr<DistributedInput::IGetSinkScreenInfosCallback> callback)130 int32_t DistributedInputSinkStubFuzz::RegisterGetSinkScreenInfosCallback(
131 sptr<DistributedInput::IGetSinkScreenInfosCallback> callback)
132 {
133 (void)callback;
134 return DistributedInput::DH_SUCCESS;
135 }
136
NotifyStartDScreen(const DistributedInput::SrcScreenInfo & remoteCtrlInfo)137 int32_t DistributedInputSinkStubFuzz::NotifyStartDScreen(
138 const DistributedInput::SrcScreenInfo &remoteCtrlInfo)
139 {
140 (void)remoteCtrlInfo;
141 return DistributedInput::DH_SUCCESS;
142 }
143
NotifyStopDScreen(const std::string & srcScreenInfoKey)144 int32_t DistributedInputSinkStubFuzz::NotifyStopDScreen(
145 const std::string &srcScreenInfoKey)
146 {
147 (void)srcScreenInfoKey;
148 return DistributedInput::DH_SUCCESS;
149 }
150
RegisterSharingDhIdListener(sptr<DistributedInput::ISharingDhIdListener> sharingDhIdListener)151 int32_t DistributedInputSinkStubFuzz::RegisterSharingDhIdListener(
152 sptr<DistributedInput::ISharingDhIdListener> sharingDhIdListener)
153 {
154 (void)sharingDhIdListener;
155 return DistributedInput::DH_SUCCESS;
156 }
157
DistributedInputSinkStubFuzzTest(const uint8_t * data,size_t size)158 void DistributedInputSinkStubFuzzTest(const uint8_t *data, size_t size)
159 {
160 if ((data == nullptr) || (size < sizeof(int32_t))) {
161 return;
162 }
163 MessageParcel pdata;
164 MessageParcel reply;
165 MessageOption option;
166 FuzzedDataProvider fdp(data, size);
167 pdata.WriteInterfaceToken(DistributedInput::DistributedInputSinkStub::GetDescriptor());
168 uint32_t code = fdp.ConsumeIntegral<uint32_t>();
169 uint32_t type = fdp.ConsumeIntegral<uint32_t>();
170 std::string content = fdp.ConsumeRandomLengthString();
171 std::string devId = fdp.ConsumeRandomLengthString();
172 pdata.WriteUint32(type);
173 pdata.WriteString(content);
174 pdata.WriteString(devId);
175
176 sptr<DistributedInput::DistributedInputSinkStub> distributedInputSinkStub(new (std::nothrow)
177 DistributedInputSinkStubFuzz());
178 if (distributedInputSinkStub == nullptr) {
179 return;
180 }
181 distributedInputSinkStub->HasEnableDHPermission();
182 distributedInputSinkStub->OnRemoteRequest(code, pdata, reply, option);
183 distributedInputSinkStub->InitInner(pdata, reply, option);
184 distributedInputSinkStub->ReleaseInner(pdata, reply, option);
185 distributedInputSinkStub->NotifyStartDScreenInner(pdata, reply, option);
186 distributedInputSinkStub->NotifyStopDScreenInner(pdata, reply, option);
187 distributedInputSinkStub->RegisterSharingDhIdListenerInner(pdata, reply, option);
188 distributedInputSinkStub->RegisterGetSinkScreenInfosInner(pdata, reply, option);
189 }
190
Init()191 int32_t DInputSourceCallBackStubFuzz::Init()
192 {
193 return DistributedInput::DH_SUCCESS;
194 }
195
Release()196 int32_t DInputSourceCallBackStubFuzz::Release()
197 {
198 return DistributedInput::DH_SUCCESS;
199 }
200
RegisterDistributedHardware(const std::string & devId,const std::string & dhId,const std::string & parameters,sptr<DistributedInput::IRegisterDInputCallback> callback)201 int32_t DInputSourceCallBackStubFuzz::RegisterDistributedHardware(
202 const std::string &devId, const std::string &dhId, const std::string ¶meters,
203 sptr<DistributedInput::IRegisterDInputCallback> callback)
204 {
205 (void)devId;
206 (void)dhId;
207 (void)parameters;
208 (void)callback;
209 return DistributedInput::DH_SUCCESS;
210 }
211
UnregisterDistributedHardware(const std::string & devId,const std::string & dhId,sptr<DistributedInput::IUnregisterDInputCallback> callback)212 int32_t DInputSourceCallBackStubFuzz::UnregisterDistributedHardware(
213 const std::string &devId, const std::string &dhId,
214 sptr<DistributedInput::IUnregisterDInputCallback> callback)
215 {
216 (void)devId;
217 (void)dhId;
218 (void)callback;
219 return DistributedInput::DH_SUCCESS;
220 }
221
PrepareRemoteInput(const std::string & deviceId,sptr<DistributedInput::IPrepareDInputCallback> callback)222 int32_t DInputSourceCallBackStubFuzz::PrepareRemoteInput(
223 const std::string &deviceId, sptr<DistributedInput::IPrepareDInputCallback> callback)
224 {
225 (void)deviceId;
226 (void)callback;
227 return DistributedInput::DH_SUCCESS;
228 }
229
UnprepareRemoteInput(const std::string & deviceId,sptr<DistributedInput::IUnprepareDInputCallback> callback)230 int32_t DInputSourceCallBackStubFuzz::UnprepareRemoteInput(
231 const std::string &deviceId, sptr<DistributedInput::IUnprepareDInputCallback> callback)
232 {
233 (void)deviceId;
234 (void)callback;
235 return DistributedInput::DH_SUCCESS;
236 }
237
StartRemoteInput(const std::string & deviceId,const uint32_t & inputTypes,sptr<DistributedInput::IStartDInputCallback> callback)238 int32_t DInputSourceCallBackStubFuzz::StartRemoteInput(
239 const std::string &deviceId, const uint32_t &inputTypes, sptr<DistributedInput::IStartDInputCallback> callback)
240 {
241 (void)deviceId;
242 (void)inputTypes;
243 (void)callback;
244 return DistributedInput::DH_SUCCESS;
245 }
246
StopRemoteInput(const std::string & deviceId,const uint32_t & inputTypes,sptr<DistributedInput::IStopDInputCallback> callback)247 int32_t DInputSourceCallBackStubFuzz::StopRemoteInput(
248 const std::string &deviceId, const uint32_t &inputTypes, sptr<DistributedInput::IStopDInputCallback> callback)
249 {
250 (void)deviceId;
251 (void)inputTypes;
252 (void)callback;
253 return DistributedInput::DH_SUCCESS;
254 }
255
StartRemoteInput(const std::string & srcId,const std::string & sinkId,const uint32_t & inputTypes,sptr<DistributedInput::IStartDInputCallback> callback)256 int32_t DInputSourceCallBackStubFuzz::StartRemoteInput(
257 const std::string &srcId, const std::string &sinkId, const uint32_t &inputTypes,
258 sptr<DistributedInput::IStartDInputCallback> callback)
259 {
260 (void)srcId;
261 (void)sinkId;
262 (void)inputTypes;
263 (void)callback;
264 return DistributedInput::DH_SUCCESS;
265 }
266
StopRemoteInput(const std::string & srcId,const std::string & sinkId,const uint32_t & inputTypes,sptr<DistributedInput::IStopDInputCallback> callback)267 int32_t DInputSourceCallBackStubFuzz::StopRemoteInput(
268 const std::string &srcId, const std::string &sinkId, const uint32_t &inputTypes,
269 sptr<DistributedInput::IStopDInputCallback> callback)
270 {
271 (void)srcId;
272 (void)sinkId;
273 (void)inputTypes;
274 (void)callback;
275 return DistributedInput::DH_SUCCESS;
276 }
277
PrepareRemoteInput(const std::string & srcId,const std::string & sinkId,sptr<DistributedInput::IPrepareDInputCallback> callback)278 int32_t DInputSourceCallBackStubFuzz::PrepareRemoteInput(
279 const std::string &srcId, const std::string &sinkId,
280 sptr<DistributedInput::IPrepareDInputCallback> callback)
281 {
282 (void)srcId;
283 (void)sinkId;
284 (void)callback;
285 return DistributedInput::DH_SUCCESS;
286 }
287
UnprepareRemoteInput(const std::string & srcId,const std::string & sinkId,sptr<DistributedInput::IUnprepareDInputCallback> callback)288 int32_t DInputSourceCallBackStubFuzz::UnprepareRemoteInput(
289 const std::string &srcId, const std::string &sinkId,
290 sptr<DistributedInput::IUnprepareDInputCallback> callback)
291 {
292 (void)srcId;
293 (void)sinkId;
294 (void)callback;
295 return DistributedInput::DH_SUCCESS;
296 }
297
StartRemoteInput(const std::string & sinkId,const std::vector<std::string> & dhIds,sptr<DistributedInput::IStartStopDInputsCallback> callback)298 int32_t DInputSourceCallBackStubFuzz::StartRemoteInput(
299 const std::string &sinkId, const std::vector<std::string> &dhIds,
300 sptr<DistributedInput::IStartStopDInputsCallback> callback)
301 {
302 (void)sinkId;
303 (void)dhIds;
304 (void)callback;
305 return DistributedInput::DH_SUCCESS;
306 }
307
StopRemoteInput(const std::string & sinkId,const std::vector<std::string> & dhIds,sptr<DistributedInput::IStartStopDInputsCallback> callback)308 int32_t DInputSourceCallBackStubFuzz::StopRemoteInput(
309 const std::string &sinkId, const std::vector<std::string> &dhIds,
310 sptr<DistributedInput::IStartStopDInputsCallback> callback)
311 {
312 (void)sinkId;
313 (void)dhIds;
314 (void)callback;
315 return DistributedInput::DH_SUCCESS;
316 }
317
StartRemoteInput(const std::string & srcId,const std::string & sinkId,const std::vector<std::string> & dhIds,sptr<DistributedInput::IStartStopDInputsCallback> callback)318 int32_t DInputSourceCallBackStubFuzz::StartRemoteInput(
319 const std::string &srcId, const std::string &sinkId,
320 const std::vector<std::string> &dhIds, sptr<DistributedInput::IStartStopDInputsCallback> callback)
321 {
322 (void)srcId;
323 (void)sinkId;
324 (void)dhIds;
325 (void)callback;
326 return DistributedInput::DH_SUCCESS;
327 }
328
StopRemoteInput(const std::string & srcId,const std::string & sinkId,const std::vector<std::string> & dhIds,sptr<DistributedInput::IStartStopDInputsCallback> callback)329 int32_t DInputSourceCallBackStubFuzz::StopRemoteInput(
330 const std::string &srcId, const std::string &sinkId,
331 const std::vector<std::string> &dhIds, sptr<DistributedInput::IStartStopDInputsCallback> callback)
332 {
333 (void)srcId;
334 (void)sinkId;
335 (void)dhIds;
336 (void)callback;
337 return DistributedInput::DH_SUCCESS;
338 }
339
RegisterAddWhiteListCallback(sptr<DistributedInput::IAddWhiteListInfosCallback> addWhiteListCallback)340 int32_t DInputSourceCallBackStubFuzz::RegisterAddWhiteListCallback(
341 sptr<DistributedInput::IAddWhiteListInfosCallback> addWhiteListCallback)
342 {
343 (void)addWhiteListCallback;
344 return DistributedInput::DH_SUCCESS;
345 }
346
RegisterDelWhiteListCallback(sptr<DistributedInput::IDelWhiteListInfosCallback> delWhiteListCallback)347 int32_t DInputSourceCallBackStubFuzz::RegisterDelWhiteListCallback(
348 sptr<DistributedInput::IDelWhiteListInfosCallback> delWhiteListCallback)
349 {
350 (void)delWhiteListCallback;
351 return DistributedInput::DH_SUCCESS;
352 }
353
RegisterSimulationEventListener(sptr<DistributedInput::ISimulationEventListener> listener)354 int32_t DInputSourceCallBackStubFuzz::RegisterSimulationEventListener(
355 sptr<DistributedInput::ISimulationEventListener> listener)
356 {
357 (void)listener;
358 return DistributedInput::DH_SUCCESS;
359 }
360
UnregisterSimulationEventListener(sptr<DistributedInput::ISimulationEventListener> listener)361 int32_t DInputSourceCallBackStubFuzz::UnregisterSimulationEventListener(
362 sptr<DistributedInput::ISimulationEventListener> listener)
363 {
364 (void)listener;
365 return DistributedInput::DH_SUCCESS;
366 }
367
RegisterSessionStateCb(sptr<DistributedInput::ISessionStateCallback> callback)368 int32_t DInputSourceCallBackStubFuzz::RegisterSessionStateCb(
369 sptr<DistributedInput::ISessionStateCallback> callback)
370 {
371 (void)callback;
372 return DistributedInput::DH_SUCCESS;
373 }
374
UnregisterSessionStateCb()375 int32_t DInputSourceCallBackStubFuzz::UnregisterSessionStateCb()
376 {
377 return DistributedInput::DH_SUCCESS;
378 }
379
OnResult(const std::string & deviceId,const std::string & strJson)380 void DInputSourceCallBackStubFuzz::OnResult(const std::string &deviceId,
381 const std::string &strJson)
382 {
383 deviceId_ = deviceId;
384 strJson_ = strJson;
385 }
386
DistributedInputSourceStubFuzzTest(const uint8_t * data,size_t size)387 void DistributedInputSourceStubFuzzTest(const uint8_t *data, size_t size)
388 {
389 if ((data == nullptr) || (size < sizeof(int32_t))) {
390 return;
391 }
392 MessageParcel pdata;
393 MessageParcel reply;
394 MessageOption option;
395 FuzzedDataProvider fdp(data, size);
396 pdata.WriteInterfaceToken(DistributedInput::DistributedInputSourceStub::GetDescriptor());
397 uint32_t code = fdp.ConsumeIntegral<uint32_t>();
398 uint32_t type = fdp.ConsumeIntegral<uint32_t>();
399 std::string content = fdp.ConsumeRandomLengthString();
400 std::string devId = fdp.ConsumeRandomLengthString();
401 pdata.WriteUint32(type);
402 pdata.WriteString(content);
403 pdata.WriteString(devId);
404
405 sptr<DistributedInput::DistributedInputSourceStub> distributedInputSourceStub(new (std::nothrow)
406 DInputSourceCallBackStubFuzz());
407 if (distributedInputSourceStub == nullptr) {
408 return;
409 }
410 distributedInputSourceStub->HasEnableDHPermission();
411 distributedInputSourceStub->HasAccessDHPermission();
412 distributedInputSourceStub->HandleInitDistributedHardware(reply);
413 distributedInputSourceStub->HandleReleaseDistributedHardware(reply);
414 distributedInputSourceStub->HandleRegisterDistributedHardware(pdata, reply);
415 distributedInputSourceStub->HandleUnregisterDistributedHardware(pdata, reply);
416 distributedInputSourceStub->HandlePrepareRemoteInput(pdata, reply);
417 distributedInputSourceStub->HandleUnprepareRemoteInput(pdata, reply);
418 distributedInputSourceStub->HandleStartRemoteInput(pdata, reply);
419 distributedInputSourceStub->HandleStopRemoteInput(pdata, reply);
420 distributedInputSourceStub->HandleStartRelayTypeRemoteInput(pdata, reply);
421 distributedInputSourceStub->HandleStopRelayTypeRemoteInput(pdata, reply);
422 distributedInputSourceStub->HandlePrepareRelayRemoteInput(pdata, reply);
423 distributedInputSourceStub->HandleUnprepareRelayRemoteInput(pdata, reply);
424 distributedInputSourceStub->HandleStartDhidRemoteInput(pdata, reply);
425 distributedInputSourceStub->HandleStopDhidRemoteInput(pdata, reply);
426 distributedInputSourceStub->HandleStartRelayDhidRemoteInput(pdata, reply);
427 distributedInputSourceStub->HandleStopRelayDhidRemoteInput(pdata, reply);
428 distributedInputSourceStub->HandleRegisterAddWhiteListCallback(pdata, reply);
429 distributedInputSourceStub->HandleRegisterDelWhiteListCallback(pdata, reply);
430 distributedInputSourceStub->HandleRegisterSimulationEventListener(pdata, reply);
431 distributedInputSourceStub->HandleUnregisterSimulationEventListener(pdata, reply);
432 distributedInputSourceStub->HandleRegisterSessionStateCb(pdata, reply);
433 distributedInputSourceStub->HandleUnregisterSessionStateCb(pdata, reply);
434 distributedInputSourceStub->OnRemoteRequest(code, pdata, reply, option);
435 }
436
437 class MyGetSinkScreenInfosCallbackStub : public DistributedInput::GetSinkScreenInfosCallbackStub {
438 public:
OnResult(const std::string & deviceId)439 void OnResult(const std::string &deviceId) override
440 {
441 return;
442 }
443 };
444
GetSinkScreenInfosCallbackStubFuzzTest(const uint8_t * data,size_t size)445 void GetSinkScreenInfosCallbackStubFuzzTest(const uint8_t *data, size_t size)
446 {
447 if ((data == nullptr) || (size < sizeof(int32_t))) {
448 return;
449 }
450 MessageParcel pdata;
451 MessageParcel reply;
452 MessageOption option;
453 FuzzedDataProvider fdp(data, size);
454 uint32_t code = fdp.ConsumeIntegral<uint32_t>();
455 pdata.WriteInterfaceToken(DistributedInput::GetSinkScreenInfosCallbackStub::GetDescriptor());
456 if (code == (uint32_t)DistributedInput::IGetSinkScreenInfosCallback::Message::RESULT) {
457 uint32_t tag = fdp.ConsumeIntegral<uint32_t>();
458 std::string value = fdp.ConsumeRandomLengthString();
459 pdata.WriteUint32(tag);
460 pdata.WriteString(value);
461 } else {
462 int32_t fd = fdp.ConsumeIntegral<int32_t>();
463 int32_t len = fdp.ConsumeIntegral<int32_t>();
464 std::string name = fdp.ConsumeRandomLengthString();
465 pdata.WriteFileDescriptor(fd);
466 pdata.WriteInt32(len);
467 pdata.WriteString(name);
468 }
469
470 sptr<DistributedInput::GetSinkScreenInfosCallbackStub> getSinkScreenInfosCbStub(new (std::nothrow)
471 MyGetSinkScreenInfosCallbackStub());
472 if (getSinkScreenInfosCbStub == nullptr) {
473 return;
474 }
475 getSinkScreenInfosCbStub->OnRemoteRequest(code, pdata, reply, option);
476 }
477
478 class MyInputNodeListenerStub : public DistributedInput::InputNodeListenerStub {
479 public:
OnNodeOnLine(const std::string & srcDevId,const std::string & sinkDevId,const std::string & sinkNodeId,const std::string & sinkNodeDesc)480 void OnNodeOnLine(const std::string &srcDevId, const std::string &sinkDevId,
481 const std::string &sinkNodeId, const std::string &sinkNodeDesc) override
482 {
483 (void)srcDevId;
484 (void)sinkDevId;
485 (void)sinkNodeId;
486 (void)sinkNodeDesc;
487 return;
488 }
489
OnNodeOffLine(const std::string & srcDevId,const std::string & sinkDevId,const std::string & sinkNodeId)490 void OnNodeOffLine(const std::string &srcDevId, const std::string &sinkDevId,
491 const std::string &sinkNodeId) override
492 {
493 (void)srcDevId;
494 (void)sinkDevId;
495 (void)sinkNodeId;
496 return;
497 }
498 };
499
InputNodeListenerStubFuzzTest(const uint8_t * data,size_t size)500 void InputNodeListenerStubFuzzTest(const uint8_t *data, size_t size)
501 {
502 if ((data == nullptr) || (size < sizeof(int32_t))) {
503 return;
504 }
505 MessageParcel pdata;
506 MessageParcel reply;
507 MessageOption option;
508 FuzzedDataProvider fdp(data, size);
509 uint32_t code = fdp.ConsumeIntegral<uint32_t>();
510 pdata.WriteInterfaceToken(DistributedInput::InputNodeListenerStub::GetDescriptor());
511 if (code == (uint32_t)DistributedInput::InputNodeListener::Message::RESULT_ON) {
512 uint32_t tag = fdp.ConsumeIntegral<uint32_t>();
513 std::string value = fdp.ConsumeRandomLengthString();
514 pdata.WriteUint32(tag);
515 pdata.WriteString(value);
516 } else if (code == (uint32_t)DistributedInput::InputNodeListener::Message::RESULT_OFF) {
517 int32_t fd = fdp.ConsumeIntegral<int32_t>();
518 int32_t len = fdp.ConsumeIntegral<int32_t>();
519 std::string name = fdp.ConsumeRandomLengthString();
520 pdata.WriteFileDescriptor(fd);
521 pdata.WriteInt32(len);
522 pdata.WriteString(name);
523 } else {
524 uint32_t type = fdp.ConsumeIntegral<uint32_t>();
525 std::string content = fdp.ConsumeRandomLengthString();
526 std::string devId = fdp.ConsumeRandomLengthString();
527 pdata.WriteUint32(type);
528 pdata.WriteString(content);
529 pdata.WriteString(devId);
530 }
531
532 sptr<DistributedInput::InputNodeListenerStub> inputNodeListenerStub(new (std::nothrow)
533 MyInputNodeListenerStub());
534 if (inputNodeListenerStub == nullptr) {
535 return;
536 }
537 inputNodeListenerStub->OnRemoteRequest(code, pdata, reply, option);
538 }
539
540 class MyPrepareDInputCallbackStub : public DistributedInput::PrepareDInputCallbackStub {
541 public:
OnResult(const std::string & devId,const int32_t & status)542 void OnResult(const std::string &devId, const int32_t &status) override
543 {
544 return;
545 }
546 };
547
PrepareDInputCallbackStubFuzzTest(const uint8_t * data,size_t size)548 void PrepareDInputCallbackStubFuzzTest(const uint8_t *data, size_t size)
549 {
550 if ((data == nullptr) || (size < sizeof(int32_t))) {
551 return;
552 }
553 MessageParcel pdata;
554 MessageParcel reply;
555 MessageOption option;
556 FuzzedDataProvider fdp(data, size);
557 uint32_t code = fdp.ConsumeIntegral<uint32_t>();
558 pdata.WriteInterfaceToken(DistributedInput::PrepareDInputCallbackStub::GetDescriptor());
559 if (code == (uint32_t)DistributedInput::IPrepareDInputCallback::Message::RESULT) {
560 uint32_t tag = fdp.ConsumeIntegral<uint32_t>();
561 std::string value = fdp.ConsumeRandomLengthString();
562 pdata.WriteUint32(tag);
563 pdata.WriteString(value);
564 } else {
565 int32_t fd = fdp.ConsumeIntegral<int32_t>();
566 int32_t len = fdp.ConsumeIntegral<int32_t>();
567 std::string name = fdp.ConsumeRandomLengthString();
568 pdata.WriteFileDescriptor(fd);
569 pdata.WriteInt32(len);
570 pdata.WriteString(name);
571 }
572 sptr<DistributedInput::PrepareDInputCallbackStub> prepareDInputCallbackStub(new (std::nothrow)
573 MyPrepareDInputCallbackStub());
574 if (prepareDInputCallbackStub == nullptr) {
575 return;
576 }
577 prepareDInputCallbackStub->OnRemoteRequest(code, pdata, reply, option);
578 }
579
580 class MyRegisterDInputCallbackStub : public DistributedInput::RegisterDInputCallbackStub {
581 public:
OnResult(const std::string & devId,const std::string & dhId,const int32_t & status)582 void OnResult(const std::string &devId, const std::string &dhId, const int32_t &status) override
583 {
584 return;
585 }
586 };
587
RegisterDInputCallbackStubFuzzTest(const uint8_t * data,size_t size)588 void RegisterDInputCallbackStubFuzzTest(const uint8_t *data, size_t size)
589 {
590 if ((data == nullptr) || (size < sizeof(int32_t))) {
591 return;
592 }
593 MessageParcel pdata;
594 MessageParcel reply;
595 MessageOption option;
596 FuzzedDataProvider fdp(data, size);
597 uint32_t code = fdp.ConsumeIntegral<uint32_t>();
598 pdata.WriteInterfaceToken(DistributedInput::RegisterDInputCallbackStub::GetDescriptor());
599 if (code == (uint32_t)DistributedInput::IRegisterDInputCallback::Message::RESULT) {
600 uint32_t tag = fdp.ConsumeIntegral<uint32_t>();
601 std::string value = fdp.ConsumeRandomLengthString();
602 pdata.WriteUint32(tag);
603 pdata.WriteString(value);
604 } else {
605 int32_t fd = fdp.ConsumeIntegral<int32_t>();
606 int32_t len = fdp.ConsumeIntegral<int32_t>();
607 std::string name = fdp.ConsumeRandomLengthString();
608 pdata.WriteFileDescriptor(fd);
609 pdata.WriteInt32(len);
610 pdata.WriteString(name);
611 }
612 sptr<DistributedInput::RegisterDInputCallbackStub> registerDInputCallbackStub(new (std::nothrow)
613 MyRegisterDInputCallbackStub());
614 if (registerDInputCallbackStub == nullptr) {
615 return;
616 }
617 registerDInputCallbackStub->OnRemoteRequest(code, pdata, reply, option);
618 }
619
620 class MyRegisterSessionStateCallbackStub : public DistributedInput::RegisterSessionStateCallbackStub {
621 public:
OnResult(const std::string & devId,const uint32_t status)622 void OnResult(const std::string &devId, const uint32_t status) override
623 {
624 return;
625 }
626 };
627
RegisterSessionStateCallbackStubFuzzTest(const uint8_t * data,size_t size)628 void RegisterSessionStateCallbackStubFuzzTest(const uint8_t *data, size_t size)
629 {
630 if ((data == nullptr) || (size < sizeof(int32_t))) {
631 return;
632 }
633 MessageParcel pdata;
634 MessageParcel reply;
635 MessageOption option;
636 FuzzedDataProvider fdp(data, size);
637 uint32_t code = fdp.ConsumeIntegral<uint32_t>();
638 pdata.WriteInterfaceToken(DistributedInput::RegisterSessionStateCallbackStub::GetDescriptor());
639 if (code == (uint32_t)DistributedInput::ISessionStateCallback::Message::RESULT) {
640 uint32_t tag = fdp.ConsumeIntegral<uint32_t>();
641 std::string value = fdp.ConsumeRandomLengthString();
642 pdata.WriteUint32(tag);
643 pdata.WriteString(value);
644 } else {
645 int32_t fd = fdp.ConsumeIntegral<int32_t>();
646 int32_t len = fdp.ConsumeIntegral<int32_t>();
647 std::string name = fdp.ConsumeRandomLengthString();
648 pdata.WriteFileDescriptor(fd);
649 pdata.WriteInt32(len);
650 pdata.WriteString(name);
651 }
652 sptr<DistributedInput::RegisterSessionStateCallbackStub> registerSessionStateCbkStub(new (std::nothrow)
653 MyRegisterSessionStateCallbackStub());
654 if (registerSessionStateCbkStub == nullptr) {
655 return;
656 }
657 registerSessionStateCbkStub->OnRemoteRequest(code, pdata, reply, option);
658 }
659
660 class MySharingDhIdListenerStub : public DistributedInput::SharingDhIdListenerStub {
661 public:
OnSharing(const std::string & dhId)662 int32_t OnSharing(const std::string &dhId) override
663 {
664 (void)dhId;
665 return 0;
666 }
667
OnNoSharing(const std::string & dhId)668 int32_t OnNoSharing(const std::string &dhId) override
669 {
670 (void)dhId;
671 return 0;
672 }
673 };
674
SharingDhIdListenerStubFuzzTest(const uint8_t * data,size_t size)675 void SharingDhIdListenerStubFuzzTest(const uint8_t *data, size_t size)
676 {
677 if ((data == nullptr) || (size < sizeof(int32_t))) {
678 return;
679 }
680 MessageParcel pdata;
681 MessageParcel reply;
682 MessageOption option;
683 FuzzedDataProvider fdp(data, size);
684 uint32_t code = fdp.ConsumeIntegral<uint32_t>();
685 pdata.WriteInterfaceToken(DistributedInput::SharingDhIdListenerStub::GetDescriptor());
686 if (code == (uint32_t)DistributedInput::ISharingDhIdListener::Message::SHARING) {
687 uint32_t tag = fdp.ConsumeIntegral<uint32_t>();
688 std::string value = fdp.ConsumeRandomLengthString();
689 pdata.WriteUint32(tag);
690 pdata.WriteString(value);
691 } else if (code == (uint32_t)DistributedInput::ISharingDhIdListener::Message::NO_SHARING) {
692 int32_t fd = fdp.ConsumeIntegral<int32_t>();
693 int32_t len = fdp.ConsumeIntegral<int32_t>();
694 std::string name = fdp.ConsumeRandomLengthString();
695 pdata.WriteFileDescriptor(fd);
696 pdata.WriteInt32(len);
697 pdata.WriteString(name);
698 } else {
699 uint32_t type = fdp.ConsumeIntegral<uint32_t>();
700 std::string content = fdp.ConsumeRandomLengthString();
701 std::string devId = fdp.ConsumeRandomLengthString();
702 pdata.WriteUint32(type);
703 pdata.WriteString(content);
704 pdata.WriteString(devId);
705 }
706 sptr<DistributedInput::SharingDhIdListenerStub> sharingDhIdListenerStub(new (std::nothrow)
707 MySharingDhIdListenerStub());
708 if (sharingDhIdListenerStub == nullptr) {
709 return;
710 }
711 sharingDhIdListenerStub->OnRemoteRequest(code, pdata, reply, option);
712 }
713
714 class MySimulationEventListenerStub : public DistributedInput::SimulationEventListenerStub {
715 public:
OnSimulationEvent(uint32_t type,uint32_t code,int32_t value)716 int32_t OnSimulationEvent(uint32_t type, uint32_t code, int32_t value) override
717 {
718 return 0;
719 }
720 };
721
SimulationEventListenerStubFuzzTest(const uint8_t * data,size_t size)722 void SimulationEventListenerStubFuzzTest(const uint8_t *data, size_t size)
723 {
724 if ((data == nullptr) || (size < sizeof(int32_t))) {
725 return;
726 }
727 MessageParcel pdata;
728 MessageParcel reply;
729 MessageOption option;
730 FuzzedDataProvider fdp(data, size);
731 uint32_t code = fdp.ConsumeIntegral<uint32_t>();
732 pdata.WriteInterfaceToken(DistributedInput::SimulationEventListenerStub::GetDescriptor());
733 if (code == (uint32_t)DistributedInput::ISimulationEventListener::Message::RESULT_ON) {
734 uint32_t tag = fdp.ConsumeIntegral<uint32_t>();
735 std::string value = fdp.ConsumeRandomLengthString();
736 pdata.WriteUint32(tag);
737 pdata.WriteString(value);
738 } else {
739 int32_t fd = fdp.ConsumeIntegral<int32_t>();
740 int32_t len = fdp.ConsumeIntegral<int32_t>();
741 std::string name = fdp.ConsumeRandomLengthString();
742 pdata.WriteFileDescriptor(fd);
743 pdata.WriteInt32(len);
744 pdata.WriteString(name);
745 }
746 sptr<DistributedInput::SimulationEventListenerStub> simulationEventListenerStub(new (std::nothrow)
747 MySimulationEventListenerStub());
748 if (simulationEventListenerStub == nullptr) {
749 return;
750 }
751 simulationEventListenerStub->OnRemoteRequest(code, pdata, reply, option);
752 }
753
754 class MyStartDInputCallbackStub : public DistributedInput::StartDInputCallbackStub {
755 public:
OnResult(const std::string & devId,const uint32_t & inputTypes,const int32_t & status)756 void OnResult(const std::string &devId, const uint32_t &inputTypes, const int32_t &status) override
757 {
758 return;
759 }
760 };
761
StartDInputCallbackStubFuzzTest(const uint8_t * data,size_t size)762 void StartDInputCallbackStubFuzzTest(const uint8_t *data, size_t size)
763 {
764 if ((data == nullptr) || (size < sizeof(int32_t))) {
765 return;
766 }
767 MessageParcel pdata;
768 MessageParcel reply;
769 MessageOption option;
770 FuzzedDataProvider fdp(data, size);
771 uint32_t code = fdp.ConsumeIntegral<uint32_t>();
772 pdata.WriteInterfaceToken(DistributedInput::StartDInputCallbackStub::GetDescriptor());
773 if (code == (uint32_t)DistributedInput::IStartDInputCallback::Message::RESULT) {
774 uint32_t tag = fdp.ConsumeIntegral<uint32_t>();
775 std::string value = fdp.ConsumeRandomLengthString();
776 pdata.WriteUint32(tag);
777 pdata.WriteString(value);
778 } else {
779 int32_t fd = fdp.ConsumeIntegral<int32_t>();
780 int32_t len = fdp.ConsumeIntegral<int32_t>();
781 std::string name = fdp.ConsumeRandomLengthString();
782 pdata.WriteFileDescriptor(fd);
783 pdata.WriteInt32(len);
784 pdata.WriteString(name);
785 }
786 sptr<DistributedInput::StartDInputCallbackStub> startDInputCallbackStub(new (std::nothrow)
787 MyStartDInputCallbackStub());
788 if (startDInputCallbackStub == nullptr) {
789 return;
790 }
791 startDInputCallbackStub->OnRemoteRequest(code, pdata, reply, option);
792 }
793
794 class MyStartStopDInputsCallbackStub : public DistributedInput::StartStopDInputsCallbackStub {
795 public:
OnResultDhids(const std::string & devId,const int32_t & status)796 void OnResultDhids(const std::string &devId, const int32_t &status) override
797 {
798 return;
799 }
800 };
801
StartStopDInputsCallbackStubFuzzTest(const uint8_t * data,size_t size)802 void StartStopDInputsCallbackStubFuzzTest(const uint8_t *data, size_t size)
803 {
804 if ((data == nullptr) || (size < sizeof(int32_t))) {
805 return;
806 }
807 MessageParcel pdata;
808 MessageParcel reply;
809 MessageOption option;
810 FuzzedDataProvider fdp(data, size);
811 uint32_t code = fdp.ConsumeIntegral<uint32_t>();
812 pdata.WriteInterfaceToken(DistributedInput::StartStopDInputsCallbackStub::GetDescriptor());
813 if (code == (uint32_t)DistributedInput::IStartStopDInputsCallback::Message::RESULT_STRING) {
814 uint32_t tag = fdp.ConsumeIntegral<uint32_t>();
815 std::string value = fdp.ConsumeRandomLengthString();
816 pdata.WriteUint32(tag);
817 pdata.WriteString(value);
818 } else {
819 int32_t fd = fdp.ConsumeIntegral<int32_t>();
820 int32_t len = fdp.ConsumeIntegral<int32_t>();
821 std::string name = fdp.ConsumeRandomLengthString();
822 pdata.WriteFileDescriptor(fd);
823 pdata.WriteInt32(len);
824 pdata.WriteString(name);
825 }
826 sptr<DistributedInput::StartStopDInputsCallbackStub> startStopDInputsCallbackStub(new (std::nothrow)
827 MyStartStopDInputsCallbackStub());
828 if (startStopDInputsCallbackStub == nullptr) {
829 return;
830 }
831 startStopDInputsCallbackStub->OnRemoteRequest(code, pdata, reply, option);
832 }
833
834 class MyStartStopResultCallbackStub : public DistributedInput::StartStopResultCallbackStub {
835 public:
OnStart(const std::string & srcId,const std::string & sinkId,std::vector<std::string> & dhIds)836 void OnStart(const std::string &srcId, const std::string &sinkId,
837 std::vector<std::string> &dhIds) override
838 {
839 return;
840 }
OnStop(const std::string & srcId,const std::string & sinkId,std::vector<std::string> & dhIds)841 void OnStop(const std::string &srcId, const std::string &sinkId,
842 std::vector<std::string> &dhIds) override
843 {
844 return;
845 }
846 };
847
StartStopResultCallbackStubFuzzTest(const uint8_t * data,size_t size)848 void StartStopResultCallbackStubFuzzTest(const uint8_t *data, size_t size)
849 {
850 if ((data == nullptr) || (size < sizeof(int32_t))) {
851 return;
852 }
853 MessageParcel pdata;
854 MessageParcel reply;
855 MessageOption option;
856 FuzzedDataProvider fdp(data, size);
857 uint32_t code = fdp.ConsumeIntegral<uint32_t>();
858 pdata.WriteInterfaceToken(DistributedInput::StartStopResultCallbackStub::GetDescriptor());
859 if (code == (uint32_t)DistributedInput::IStartStopResultCallback::Message::RESULT_START) {
860 uint32_t tag = fdp.ConsumeIntegral<uint32_t>();
861 std::string value = fdp.ConsumeRandomLengthString();
862 pdata.WriteUint32(tag);
863 pdata.WriteString(value);
864 } else if (code == (uint32_t)DistributedInput::IStartStopResultCallback::Message::RESULT_STOP) {
865 int32_t fd = fdp.ConsumeIntegral<int32_t>();
866 int32_t len = fdp.ConsumeIntegral<int32_t>();
867 std::string name = fdp.ConsumeRandomLengthString();
868 pdata.WriteFileDescriptor(fd);
869 pdata.WriteInt32(len);
870 pdata.WriteString(name);
871 } else {
872 uint32_t type = fdp.ConsumeIntegral<uint32_t>();
873 std::string content = fdp.ConsumeRandomLengthString();
874 std::string devId = fdp.ConsumeRandomLengthString();
875 pdata.WriteUint32(type);
876 pdata.WriteString(content);
877 pdata.WriteString(devId);
878 }
879 sptr<DistributedInput::StartStopResultCallbackStub> startStopResultCallbackStub(new (std::nothrow)
880 MyStartStopResultCallbackStub());
881 if (startStopResultCallbackStub == nullptr) {
882 return;
883 }
884 startStopResultCallbackStub->OnRemoteRequest(code, pdata, reply, option);
885 }
886
887 class MyStopDInputCallbackStub : public DistributedInput::StopDInputCallbackStub {
888 public:
OnResult(const std::string & devId,const uint32_t & inputTypes,const int32_t & status)889 void OnResult(const std::string &devId, const uint32_t &inputTypes, const int32_t &status) override
890 {
891 return;
892 }
893 };
894
StopDInputCallbackStubFuzzTest(const uint8_t * data,size_t size)895 void StopDInputCallbackStubFuzzTest(const uint8_t *data, size_t size)
896 {
897 if ((data == nullptr) || (size < sizeof(int32_t))) {
898 return;
899 }
900 MessageParcel pdata;
901 MessageParcel reply;
902 MessageOption option;
903 FuzzedDataProvider fdp(data, size);
904 uint32_t code = fdp.ConsumeIntegral<uint32_t>();
905 pdata.WriteInterfaceToken(DistributedInput::StopDInputCallbackStub::GetDescriptor());
906 if (code == (uint32_t)DistributedInput::IStopDInputCallback::Message::RESULT) {
907 uint32_t tag = fdp.ConsumeIntegral<uint32_t>();
908 std::string value = fdp.ConsumeRandomLengthString();
909 pdata.WriteUint32(tag);
910 pdata.WriteString(value);
911 } else {
912 int32_t fd = fdp.ConsumeIntegral<int32_t>();
913 int32_t len = fdp.ConsumeIntegral<int32_t>();
914 std::string name = fdp.ConsumeRandomLengthString();
915 pdata.WriteFileDescriptor(fd);
916 pdata.WriteInt32(len);
917 pdata.WriteString(name);
918 }
919 sptr<DistributedInput::StopDInputCallbackStub> stopDInputCallbackStub(new (std::nothrow)
920 MyStopDInputCallbackStub());
921 if (stopDInputCallbackStub == nullptr) {
922 return;
923 }
924 stopDInputCallbackStub->OnRemoteRequest(code, pdata, reply, option);
925 }
926
927 class MyUnprepareDInputCallbackStub : public DistributedInput::UnprepareDInputCallbackStub {
928 public:
OnResult(const std::string & devId,const int32_t & status)929 void OnResult(const std::string &devId, const int32_t &status) override
930 {
931 return;
932 }
933 };
934
UnprepareDInputCallbackStubFuzzTest(const uint8_t * data,size_t size)935 void UnprepareDInputCallbackStubFuzzTest(const uint8_t *data, size_t size)
936 {
937 if ((data == nullptr) || (size < sizeof(int32_t))) {
938 return;
939 }
940 MessageParcel pdata;
941 MessageParcel reply;
942 MessageOption option;
943 FuzzedDataProvider fdp(data, size);
944 uint32_t code = fdp.ConsumeIntegral<uint32_t>();
945 pdata.WriteInterfaceToken(DistributedInput::UnprepareDInputCallbackStub::GetDescriptor());
946 if (code == (uint32_t)DistributedInput::IUnprepareDInputCallback::Message::RESULT) {
947 uint32_t tag = fdp.ConsumeIntegral<uint32_t>();
948 std::string value = fdp.ConsumeRandomLengthString();
949 pdata.WriteUint32(tag);
950 pdata.WriteString(value);
951 } else {
952 int32_t fd = fdp.ConsumeIntegral<int32_t>();
953 int32_t len = fdp.ConsumeIntegral<int32_t>();
954 std::string name = fdp.ConsumeRandomLengthString();
955 pdata.WriteFileDescriptor(fd);
956 pdata.WriteInt32(len);
957 pdata.WriteString(name);
958 }
959 sptr<DistributedInput::UnprepareDInputCallbackStub> unprepareDInputCallbackStub(new (std::nothrow)
960 MyUnprepareDInputCallbackStub());
961 if (unprepareDInputCallbackStub == nullptr) {
962 return;
963 }
964 unprepareDInputCallbackStub->OnRemoteRequest(code, pdata, reply, option);
965 }
966
967 class MyUnregisterDInputCallbackStub : public DistributedInput::UnregisterDInputCallbackStub {
968 public:
OnResult(const std::string & devId,const std::string & dhId,const int32_t & status)969 void OnResult(const std::string &devId, const std::string &dhId, const int32_t &status) override
970 {
971 return;
972 }
973 };
974
UnregisterDInputCallbackStubFuzzTest(const uint8_t * data,size_t size)975 void UnregisterDInputCallbackStubFuzzTest(const uint8_t *data, size_t size)
976 {
977 if ((data == nullptr) || (size < sizeof(int32_t))) {
978 return;
979 }
980 MessageParcel pdata;
981 MessageParcel reply;
982 MessageOption option;
983 FuzzedDataProvider fdp(data, size);
984 uint32_t code = fdp.ConsumeIntegral<uint32_t>();
985 pdata.WriteInterfaceToken(DistributedInput::UnregisterDInputCallbackStub::GetDescriptor());
986 if (code == (uint32_t)DistributedInput::IUnprepareDInputCallback::Message::RESULT) {
987 uint32_t tag = fdp.ConsumeIntegral<uint32_t>();
988 std::string value = fdp.ConsumeRandomLengthString();
989 pdata.WriteUint32(tag);
990 pdata.WriteString(value);
991 } else {
992 int32_t fd = fdp.ConsumeIntegral<int32_t>();
993 int32_t len = fdp.ConsumeIntegral<int32_t>();
994 std::string name = fdp.ConsumeRandomLengthString();
995 pdata.WriteFileDescriptor(fd);
996 pdata.WriteInt32(len);
997 pdata.WriteString(name);
998 }
999 sptr<DistributedInput::UnregisterDInputCallbackStub> unregisterDInputCallbackStub(new (std::nothrow)
1000 MyUnregisterDInputCallbackStub());
1001 if (unregisterDInputCallbackStub == nullptr) {
1002 return;
1003 }
1004 unregisterDInputCallbackStub->OnRemoteRequest(code, pdata, reply, option);
1005 }
1006 } // namespace DistributedHardware
1007 } // namespace OHOS
1008
1009 /* Fuzzer entry point */
LLVMFuzzerTestOneInput(const uint8_t * data,size_t size)1010 extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
1011 {
1012 /* Run your code on data */
1013 OHOS::DistributedHardware::AddWhiteListInfosCallbackStubFuzzTest(data, size);
1014 OHOS::DistributedHardware::DelWhiteListInfosCallbackStubFuzzTest(data, size);
1015 OHOS::DistributedHardware::DistributedInputSinkStubFuzzTest(data, size);
1016 OHOS::DistributedHardware::DistributedInputSourceStubFuzzTest(data, size);
1017 OHOS::DistributedHardware::GetSinkScreenInfosCallbackStubFuzzTest(data, size);
1018 OHOS::DistributedHardware::InputNodeListenerStubFuzzTest(data, size);
1019 OHOS::DistributedHardware::PrepareDInputCallbackStubFuzzTest(data, size);
1020 OHOS::DistributedHardware::RegisterDInputCallbackStubFuzzTest(data, size);
1021 OHOS::DistributedHardware::RegisterSessionStateCallbackStubFuzzTest(data, size);
1022 OHOS::DistributedHardware::SharingDhIdListenerStubFuzzTest(data, size);
1023 OHOS::DistributedHardware::SimulationEventListenerStubFuzzTest(data, size);
1024 OHOS::DistributedHardware::StartDInputCallbackStubFuzzTest(data, size);
1025 OHOS::DistributedHardware::StartStopDInputsCallbackStubFuzzTest(data, size);
1026 OHOS::DistributedHardware::StartStopResultCallbackStubFuzzTest(data, size);
1027 OHOS::DistributedHardware::StopDInputCallbackStubFuzzTest(data, size);
1028 OHOS::DistributedHardware::UnprepareDInputCallbackStubFuzzTest(data, size);
1029 OHOS::DistributedHardware::UnregisterDInputCallbackStubFuzzTest(data, size);
1030 return 0;
1031 }
1032