1 /*
2 * Copyright (c) 2023 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 #ifndef KVSTORE_DATA_SERVICE_STUB_H
16 #define KVSTORE_DATA_SERVICE_STUB_H
17 #include "ikvstore_data_service.h"
18 #include "distributeddata_ipc_interface_code.h"
19 namespace OHOS::DistributedKv {
20 class API_EXPORT KvStoreDataServiceStub : public IRemoteStub<IKvStoreDataService> {
21 public:
22    int OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply,
23        MessageOption &option) override;
24 
25 private:
26    int32_t GetFeatureInterfaceOnRemote(MessageParcel &data, MessageParcel &reply);
27    int32_t RegisterClientDeathObserverOnRemote(MessageParcel &data, MessageParcel &reply);
28    int32_t ClearAppStorageOnRemote(MessageParcel &data, MessageParcel &reply);
29 
30    using RequestHandler = int32_t (KvStoreDataServiceStub::*)(MessageParcel &, MessageParcel &);
31    using code = KvStoreDataServiceInterfaceCode;
32    static constexpr RequestHandler HANDLERS[static_cast<uint32_t>(code::SERVICE_CMD_LAST)] = {
33        &KvStoreDataServiceStub::GetFeatureInterfaceOnRemote,
34        &KvStoreDataServiceStub::RegisterClientDeathObserverOnRemote,
35        &KvStoreDataServiceStub::ClearAppStorageOnRemote,
36    };
37 };
38 } // namespace OHOS::DistributedKv
39 #endif // KVSTORE_DATA_SERVICE_STUB_H
40