config: Use same type to store all bools
[platform/core/system/crash-worker.git] / src / shared / config.h
1 /*
2  * crash-manager
3  * Copyright (c) 2019 Samsung Electronics Co., Ltd.
4  *
5  * Licensed under the Apache License, Version 2.0 (the License);
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 #ifndef __DEF_CONFIG_H_
18 #define __DEF_CONFIG_H_
19
20 #include <stdbool.h>
21
22 /* Configuration default values */
23 /* note: 0 means unlimited */
24 #define SYSTEM_MAX_USE       0
25 #define SYSTEM_KEEP_FREE     0
26 #define MAX_RETENTION_SEC    0
27 #define MAX_CRASH_DUMP       0
28 #define DUMP_CORE            1
29 #define ALLOW_ZIP            1
30
31 #define CRASH_SECTION        "CrashManager"
32
33 enum ReportType {
34         REP_TYPE_INVALID = -1,
35         REP_TYPE_INFO = 0,
36         REP_TYPE_FULL,
37         REP_TYPE_DEFAULT = REP_TYPE_FULL,
38 };
39
40 typedef struct config {
41         bool allow_zip;
42         bool dump_core;
43         int system_max_use;
44         int system_keep_free;
45         int max_retention_sec;
46         int max_crash_dump;
47         enum ReportType report_type;
48         char *crash_root_path;
49         char *extra_script;
50 } config_t;
51
52
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
56
57 bool config_init(config_t *c, const char *const path);
58 void config_free(config_t *c);
59
60 #ifdef __cplusplus
61 }
62 #endif
63
64 /**
65  * @}
66  */
67 #endif