1 /* 2 * Copyright (c) 2021 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 STORAGE_DAEMON_CILENT_H 17 #define STORAGE_DAEMON_CILENT_H 18 19 #include <mutex> 20 #include <iostream> 21 #include <vector> 22 #include <sys/types.h> 23 24 #include "crypto/key_ctrl.h" 25 #include "iremote_proxy.h" 26 #include "ipc/istorage_daemon.h" 27 #include "ipc/storage_daemon.h" 28 #include "ipc/storage_daemon_proxy.h" 29 30 namespace OHOS { 31 namespace StorageDaemon { 32 class StorageDaemonClient { 33 public: 34 static int32_t StartUser(int32_t userId); 35 static int32_t StopUser(int32_t userId); 36 static int32_t PrepareUserSpace(uint32_t userId, const std::string &volumId, uint32_t flags); 37 static int32_t DestroyUserSpace(uint32_t userId, const std::string &volumId, uint32_t flags); 38 static int32_t InitGlobalKey(void); 39 static int32_t InitGlobalUserKeys(void); 40 static int32_t GenerateUserKeys(uint32_t userId, uint32_t flags); 41 static int32_t DeleteUserKeys(uint32_t userId); 42 static int32_t UpdateUserAuth(uint32_t userId, std::string auth, std::string compSecret); 43 static int32_t ActiveUserKey(uint32_t userId, std::string auth, std::string compSecret); 44 static int32_t InactiveUserKey(uint32_t userId); 45 static int32_t FscryptEnable(const std::string &fscryptOptions); 46 47 private: 48 static sptr<IStorageDaemon> GetStorageDaemonProxy(void); 49 static bool CheckServiceStatus(uint32_t serviceFlags); 50 }; 51 } // StorageDaemon 52 } // OHOS 53 54 #endif