1 | /* mr_conf.h |
---|
2 | * |
---|
3 | * $Id$ |
---|
4 | * |
---|
5 | * based on parse_conf.h (c)2002-2004 Anton Kulchitsky mailto:anton@kulchitsky.org |
---|
6 | * Reviewed for mondorescue (c) 2006-2007 Bruno Cornec <bruno@mondorescue.org> |
---|
7 | * |
---|
8 | * Header file of mr_conf: a very small and simple |
---|
9 | * library for mondorescue configuration file reading |
---|
10 | * |
---|
11 | * Provided under the GPLv2 |
---|
12 | */ |
---|
13 | |
---|
14 | #ifndef MR_CONF_H |
---|
15 | #define MR_CONF_H |
---|
16 | |
---|
17 | #include "mr_types.h" |
---|
18 | |
---|
19 | /* mondoarchive structure storing conf info |
---|
20 | * each field of the configuration file should have an entry here |
---|
21 | */ |
---|
22 | struct mr_ar_conf { |
---|
23 | /* MINDI: ISO image CLI command to use */ |
---|
24 | char *iso_creation_cmd; |
---|
25 | /* MINDI: ISO image common creation options */ |
---|
26 | char *iso_creation_opt; |
---|
27 | /* ISO Burning CLI command to use */ |
---|
28 | char *iso_burning_cmd; |
---|
29 | /* ISO Burning device to use (optional) */ |
---|
30 | char *iso_burning_dev; |
---|
31 | /* ISO Burning CLI command options */ |
---|
32 | char *iso_burning_opt; |
---|
33 | /* ISO Burning Speed */ |
---|
34 | int iso_burning_speed; |
---|
35 | /* Default size of media */ |
---|
36 | int media_size; |
---|
37 | /* Default device of media */ |
---|
38 | char *media_device; |
---|
39 | /* Is the CD tray manual ? */ |
---|
40 | bool manual_tray; |
---|
41 | /* Default log level */ |
---|
42 | int log_level; |
---|
43 | /* default prefix for ISO names */ |
---|
44 | char *prefix; |
---|
45 | /* External tape blocksize */ |
---|
46 | int external_tape_blocksize; |
---|
47 | /* Internal tape blocksize */ |
---|
48 | int internal_tape_blocksize; |
---|
49 | /* Kernel to use */ |
---|
50 | char *kernel; |
---|
51 | /* Additional modules to support */ |
---|
52 | char *additional_modules; |
---|
53 | /* Boot loader to use */ |
---|
54 | char *boot_loader; |
---|
55 | /* Differential backup ? */ |
---|
56 | bool differential; |
---|
57 | /* Default compression tool */ |
---|
58 | char *compression_tool; |
---|
59 | /* Default compression level */ |
---|
60 | int compression_level; |
---|
61 | /* Subdir for ISO images on HDD */ |
---|
62 | char *subdir; |
---|
63 | /* Paths to exclude from backup */ |
---|
64 | char *exclude_paths; |
---|
65 | /* Paths to include onto the backup */ |
---|
66 | char *include_paths; |
---|
67 | /* Which mode should be activated by default*/ |
---|
68 | char *ui_mode; |
---|
69 | /* Activate automatic restore ? */ |
---|
70 | bool automatic_restore; |
---|
71 | /* Scratch directory */ |
---|
72 | char *scratch_dir; |
---|
73 | /* Temporary directory main path */ |
---|
74 | char *tmp_dir; |
---|
75 | /* Images creation dir */ |
---|
76 | char *images_dir; |
---|
77 | }; |
---|
78 | |
---|
79 | /* mondorestore structure storing conf info |
---|
80 | * each field of the configuration file should have an entry here |
---|
81 | */ |
---|
82 | struct mr_rs_conf { |
---|
83 | /* Default media size */ |
---|
84 | int media_size; |
---|
85 | /* Default device of media */ |
---|
86 | char *media_device; |
---|
87 | /* Is the CD tray manual ? */ |
---|
88 | bool manual_tray; |
---|
89 | /* Default log level */ |
---|
90 | int log_level; |
---|
91 | /* default prefix for ISO names */ |
---|
92 | char *prefix; |
---|
93 | /* External tape blocksize */ |
---|
94 | int external_tape_blocksize; |
---|
95 | /* Internal tape blocksize */ |
---|
96 | int internal_tape_blocksize; |
---|
97 | /* Boot loader to use */ |
---|
98 | char *boot_loader; |
---|
99 | /* Differential backup ? */ |
---|
100 | bool differential; |
---|
101 | /* Default compression tool */ |
---|
102 | char *compression_tool; |
---|
103 | /* Which mode should be activated by default*/ |
---|
104 | char *ui_mode; |
---|
105 | /* Activate automatic restore ? */ |
---|
106 | bool automatic_restore; |
---|
107 | /* Images creation dir */ |
---|
108 | char *images_dir; |
---|
109 | }; |
---|
110 | |
---|
111 | /* functions (public methods) */ |
---|
112 | |
---|
113 | /*initialization and closing*/ |
---|
114 | extern int mr_conf_open(const char *filename); |
---|
115 | extern void mr_conf_close(void); |
---|
116 | |
---|
117 | /*read integer number (under a string format to be freed later on) after string str in the current file*/ |
---|
118 | /* use atoi after */ |
---|
119 | extern char *mr_conf_iread(const char *field_name); |
---|
120 | |
---|
121 | /*read double/float number (under a string format to be freed later on) after string str in the current file*/ |
---|
122 | /* use atof after */ |
---|
123 | extern char *mr_conf_fread(const char *field_name); |
---|
124 | |
---|
125 | /*read boolean (under a string format to be freed later on) after string str in the current file*/ |
---|
126 | /* use mr_atob after */ |
---|
127 | extern char *mr_conf_bread(const char *field_name); |
---|
128 | |
---|
129 | /* |
---|
130 | * read string after string str in the current file. |
---|
131 | * This function allocates the string which has to be freed later on |
---|
132 | */ |
---|
133 | extern char *mr_conf_sread(const char *field_name); |
---|
134 | |
---|
135 | #endif /* MR_CONF_H */ |
---|