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 | /* Paths to exclude from backup */
|
---|
62 | char *exclude_paths;
|
---|
63 | /* Paths to include onto the backup */
|
---|
64 | char *include_paths;
|
---|
65 | /* Which mode should be activated by default*/
|
---|
66 | char *ui_mode;
|
---|
67 | /* Activate automatic restore ? */
|
---|
68 | bool automatic_restore;
|
---|
69 | /* Scratch directory */
|
---|
70 | char *scratch_dir;
|
---|
71 | /* Temporary directory main path */
|
---|
72 | char *tmp_dir;
|
---|
73 | /* Images creation dir */
|
---|
74 | char *images_dir;
|
---|
75 | };
|
---|
76 |
|
---|
77 | /* mondorestore structure storing conf info
|
---|
78 | * each field of the configuration file should have an entry here
|
---|
79 | */
|
---|
80 | struct mr_rs_conf {
|
---|
81 | /* Default media size */
|
---|
82 | int media_size;
|
---|
83 | /* Default device of media */
|
---|
84 | char *media_device;
|
---|
85 | /* Is the CD tray manual ? */
|
---|
86 | bool manual_tray;
|
---|
87 | /* Default log level */
|
---|
88 | int log_level;
|
---|
89 | /* default prefix for ISO names */
|
---|
90 | char *prefix;
|
---|
91 | /* External tape blocksize */
|
---|
92 | int external_tape_blocksize;
|
---|
93 | /* Internal tape blocksize */
|
---|
94 | int internal_tape_blocksize;
|
---|
95 | /* Boot loader to use */
|
---|
96 | char *boot_loader;
|
---|
97 | /* Differential backup ? */
|
---|
98 | bool differential;
|
---|
99 | /* Default compression tool */
|
---|
100 | char *compression_tool;
|
---|
101 | /* Which mode should be activated by default*/
|
---|
102 | char *ui_mode;
|
---|
103 | /* Activate automatic restore ? */
|
---|
104 | bool automatic_restore;
|
---|
105 | /* Images creation dir */
|
---|
106 | char *images_dir;
|
---|
107 | };
|
---|
108 |
|
---|
109 | /* functions (public methods) */
|
---|
110 |
|
---|
111 | /*initialization and closing*/
|
---|
112 | extern int mr_conf_open(const char *filename);
|
---|
113 | extern void mr_conf_close(void);
|
---|
114 |
|
---|
115 | /*read integer number (under a string format to be freed later on) after string str in the current file*/
|
---|
116 | /* use atoi after */
|
---|
117 | extern char *mr_conf_iread(const char *field_name);
|
---|
118 |
|
---|
119 | /*read double/float number (under a string format to be freed later on) after string str in the current file*/
|
---|
120 | /* use atof after */
|
---|
121 | extern char *mr_conf_fread(const char *field_name);
|
---|
122 |
|
---|
123 | /*read boolean (under a string format to be freed later on) after string str in the current file*/
|
---|
124 | /* use mr_atob after */
|
---|
125 | extern char *mr_conf_bread(const char *field_name);
|
---|
126 |
|
---|
127 | /*
|
---|
128 | * read string after string str in the current file.
|
---|
129 | * This function allocates the string which has to be freed later on
|
---|
130 | */
|
---|
131 | extern char *mr_conf_sread(const char *field_name);
|
---|
132 |
|
---|
133 | #endif /* MR_CONF_H */
|
---|