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 16 #ifndef UDMF_SERVICE_STUB_H 17 #define UDMF_SERVICE_STUB_H 18 19 #include <map> 20 #include <string> 21 22 #include "feature/feature_system.h" 23 #include "message_parcel.h" 24 25 #include "distributeddata_udmf_ipc_interface_code.h" 26 #include "error_code.h" 27 #include "udmf_service.h" 28 29 namespace OHOS { 30 namespace UDMF { 31 /* 32 * UDMF server stub 33 */ 34 class UdmfServiceStub : public UdmfService, public DistributedData::FeatureSystem::Feature { 35 public: 36 int OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply) override; 37 38 private: 39 int32_t OnSetData(MessageParcel &data, MessageParcel &reply); 40 int32_t OnGetData(MessageParcel &data, MessageParcel &reply); 41 int32_t OnGetBatchData(MessageParcel &data, MessageParcel &reply); 42 int32_t OnUpdateData(MessageParcel &data, MessageParcel &reply); 43 int32_t OnDeleteData(MessageParcel &data, MessageParcel &reply); 44 int32_t OnGetSummary(MessageParcel &data, MessageParcel &reply); 45 int32_t OnAddPrivilege(MessageParcel &data, MessageParcel &reply); 46 int32_t OnSync(MessageParcel &data, MessageParcel &reply); 47 48 using Handler = int32_t (UdmfServiceStub::*)(MessageParcel &data, MessageParcel &reply); 49 static constexpr Handler HANDLERS[static_cast<uint32_t>(UdmfServiceInterfaceCode::CODE_BUTT)] = { 50 &UdmfServiceStub::OnSetData, 51 &UdmfServiceStub::OnGetData, 52 &UdmfServiceStub::OnGetBatchData, 53 &UdmfServiceStub::OnUpdateData, 54 &UdmfServiceStub::OnDeleteData, 55 &UdmfServiceStub::OnGetSummary, 56 &UdmfServiceStub::OnAddPrivilege, 57 &UdmfServiceStub::OnSync 58 }; 59 }; 60 } // namespace UDMF 61 } // namespace OHOS 62 #endif // UDMF_SERVICE_STUB_H 63