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 <string>
21 
22 #include "parcel.h"
23 
24 namespace OHOS {
25 namespace DistributedSchedule {
26 constexpr static int32_t INVALID_MISSION_ID = -1;
27 const std::string BASE_64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
28 
29 bool IsValidPath(const std::string &inFilePath, std::string &realFilePath);
30 bool UpdateAllowAppList(const std::string &cfgJsonStr);
31 int32_t LoadContinueConfig();
32 bool CheckBundleContinueConfig(const std::string &bundleName);
33 int32_t GetCurrentMissionId();
34 std::string ParcelToBase64Str(const Parcel& parcel);
35 int32_t Base64StrToParcel(const std::string& rawStr, Parcel& parcel);
36 std::string Base64Encode(const unsigned char *toEncode, unsigned int len);
37 std::string Base64Decode(const std::string& basicString);
38 bool IsBase64(unsigned char c);
39 std::string GetAnonymStr(const std::string &value);
40 std::string GetAnonymInt32(const int32_t value);
41 } // namespace DistributedSchedule
42 } // namespace OHOS
43 #endif // OHOS_DISTRIBUTED_SCHED_UTILS_H
44