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 FILE_ACCESS_SERVICE_STUB_H 17 #define FILE_ACCESS_SERVICE_STUB_H 18 19 #include <map> 20 21 #include "ifile_access_service_base.h" 22 #include "iremote_stub.h" 23 #include "refbase.h" 24 25 namespace OHOS { 26 namespace FileAccessFwk { 27 class FileAccessServiceStub : public IRemoteStub<IFileAccessServiceBase> { 28 public: 29 FileAccessServiceStub(); 30 virtual ~FileAccessServiceStub(); 31 int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; 32 33 protected: 34 virtual int32_t CleanAllNotify (Uri uri, const std::shared_ptr<ConnectExtensionInfo> &info) = 0; 35 36 private: 37 ErrCode CmdOnChange(MessageParcel &data, MessageParcel &reply); 38 ErrCode CmdRegisterNotify(MessageParcel &data, MessageParcel &reply); 39 ErrCode CmdUnregisterNotify(MessageParcel &data, MessageParcel &reply); 40 ErrCode CmdGetExensionProxy(MessageParcel &data, MessageParcel &reply); 41 ErrCode CmdConnectFileExtAbility(MessageParcel &data, MessageParcel &reply); 42 ErrCode CmdDisConnectFileExtAbility(MessageParcel &data, MessageParcel &reply); 43 bool CheckCallingPermission(const std::string &permission); 44 using RequestFuncType = int (FileAccessServiceStub::*)(MessageParcel &data, MessageParcel &reply); 45 std::map<uint32_t, RequestFuncType> stubFuncMap_; 46 }; 47 } // namespace FileAccessFwk 48 } // namespace OHOS 49 #endif // FILE_ACCESS_SERVICE_STUB_H 50