1 /* 2 * Copyright (c) 2024 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 OHOS_DISTRIBUTED_SCHED_UTILS_H 17 #define OHOS_DISTRIBUTED_SCHED_UTILS_H 18 19 #include "cJSON.h" 20 #include <initializer_list> 21 #include <string> 22 23 #include "parcel.h" 24 25 namespace OHOS { 26 namespace DistributedSchedule { 27 constexpr static int32_t INVALID_MISSION_ID = -1; 28 const std::string BASE_64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; 29 30 bool IsValidPath(const std::string &inFilePath, std::string &realFilePath); 31 bool UpdateAllowAppList(const std::string &cfgJsonStr); 32 int32_t LoadContinueConfig(); 33 bool CheckBundleContinueConfig(const std::string &bundleName); 34 int32_t GetCurrentMissionId(); 35 std::string ParcelToBase64Str(const Parcel& parcel); 36 int32_t Base64StrToParcel(const std::string& rawStr, Parcel& parcel); 37 std::string Base64Encode(const unsigned char *toEncode, unsigned int len); 38 std::string Base64Decode(const std::string& basicString); 39 bool IsBase64(unsigned char c); 40 std::string GetAnonymStr(const std::string &value); 41 std::string GetAnonymInt32(const int32_t value); 42 bool IsInt32(const cJSON *paramValue); 43 bool IsString(const cJSON *paramValue); 44 bool CJsonParamCheck(const cJSON *jsonObj, const std::initializer_list<std::string> &keys); 45 bool GetOsInfoFromDM(const std::string &dmInfoEx, int32_t &osType, std::string &osVersion); 46 } // namespace DistributedSchedule 47 } // namespace OHOS 48 #endif // OHOS_DISTRIBUTED_SCHED_UTILS_H 49