13fc297bdSopenharmony_ci/*
23fc297bdSopenharmony_ci * Copyright (c) 2024-2024 Huawei Device Co., Ltd.
33fc297bdSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
43fc297bdSopenharmony_ci * you may not use this file except in compliance with the License.
53fc297bdSopenharmony_ci * You may obtain a copy of the License at
63fc297bdSopenharmony_ci *
73fc297bdSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
83fc297bdSopenharmony_ci *
93fc297bdSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
103fc297bdSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
113fc297bdSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
123fc297bdSopenharmony_ci * See the License for the specific language governing permissions and
133fc297bdSopenharmony_ci * limitations under the License.
143fc297bdSopenharmony_ci */
153fc297bdSopenharmony_ci
163fc297bdSopenharmony_ci#include "setstatus_fuzzer.h"
173fc297bdSopenharmony_ci#include "socperf_fuzz_mock.h"
183fc297bdSopenharmony_ci#include "socperf_ipc_interface_code.h"
193fc297bdSopenharmony_ci
203fc297bdSopenharmony_cinamespace OHOS {
213fc297bdSopenharmony_cinamespace SOCPERF {
223fc297bdSopenharmony_ci    bool TestSetStatus(const uint8_t* data, size_t size)
233fc297bdSopenharmony_ci    {
243fc297bdSopenharmony_ci        SocperfStubTest socPerfStub;
253fc297bdSopenharmony_ci        MessageParcel request;
263fc297bdSopenharmony_ci        request.WriteInterfaceToken(SocPerfStub::GetDescriptor());
273fc297bdSopenharmony_ci        request.WriteBuffer(data, size);
283fc297bdSopenharmony_ci        MessageParcel reply;
293fc297bdSopenharmony_ci        MessageOption option;
303fc297bdSopenharmony_ci        uint32_t requestIpcId = static_cast<uint32_t>(SocPerfInterfaceCode::TRANS_IPC_ID_SET_STATUS);
313fc297bdSopenharmony_ci        socPerfStub.OnRemoteRequest(requestIpcId, request, reply, option);
323fc297bdSopenharmony_ci        return true;
333fc297bdSopenharmony_ci    }
343fc297bdSopenharmony_ci} // namespace SOCPERF
353fc297bdSopenharmony_ci} // namespace OHOS
363fc297bdSopenharmony_ci
373fc297bdSopenharmony_ci/* Fuzzer entry point */
383fc297bdSopenharmony_ciextern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
393fc297bdSopenharmony_ci{
403fc297bdSopenharmony_ci    OHOS::SOCPERF::MockProcess();
413fc297bdSopenharmony_ci    OHOS::SOCPERF::TestSetStatus(data, size);
423fc297bdSopenharmony_ci    return 0;
433fc297bdSopenharmony_ci}
443fc297bdSopenharmony_ci
45