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 SANITIZERD_ZIPHELPER_H
17 #define SANITIZERD_ZIPHELPER_H
18 #include <algorithm>
19 #include <string>
20 #include <vector>
21 #include <sys/types.h>
22 
23 namespace OHOS {
24 namespace HiviewDFX {
25 constexpr unsigned BUF_SIZE = 1024;
26 constexpr unsigned MAX_PROCESS_PATH = 1024;
27 constexpr int MIN_APP_USERID = 10000;
28 constexpr uint32_t MAX_NAME_LENGTH = 4096;
29 constexpr int AID_ROOT   = 0;
30 constexpr int AID_SYSTEM = 1000;
31 constexpr mode_t DEFAULT_LOG_FILE_MODE = 0644;
32 constexpr mode_t DEFAULT_LOG_DIR_MODE = 0775;
33 const std::string DEVICE_OHOS_VERSION_PARAM = "hw_sc.build.os.version";
34 const std::string EMPTY_PARAM = "";
35 
36 typedef struct DfxBundleInfo {
37     bool isPreInstalled;
38     uint32_t versionCode;
39     std::string versionName;
40 } DfxBundleInfo;
41 
42 bool IsModuleNameValid(const std::string& name);
43 std::string GetApplicationNameById(int32_t uid);
44 bool GetDfxBundleInfo(const std::string& bundleName, DfxBundleInfo& bundleInfo);
45 
46 } // namespace HiviewDFX
47 } // namespace OHOS
48 
49 #endif // SANITIZERD_ZIPHELPER_H
50