1#============================================================= -*-perl-*-
2#
3# BackupPC::Config::Meta package
4#
5# DESCRIPTION
6#
7#   This library defines a BackupPC::Config::Meta class.
8#
9# AUTHOR
10#   Craig Barratt  <cbarratt@users.sourceforge.net>
11#
12# COPYRIGHT
13#   Copyright (C) 2004-2020  Craig Barratt
14#
15#   This program is free software: you can redistribute it and/or modify
16#   it under the terms of the GNU General Public License as published by
17#   the Free Software Foundation, either version 3 of the License, or
18#   (at your option) any later version.
19#
20#   This program is distributed in the hope that it will be useful,
21#   but WITHOUT ANY WARRANTY; without even the implied warranty of
22#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23#   GNU General Public License for more details.
24#
25#   You should have received a copy of the GNU General Public License
26#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
27#
28#========================================================================
29#
30# Version 4.3.3, released 5 Apr 2020.
31#
32# See http://backuppc.sourceforge.net.
33#
34#========================================================================
35
36package BackupPC::Config::Meta;
37
38use strict;
39
40require Exporter;
41
42use vars qw( @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS );
43
44use vars qw(%ConfigMeta);
45
46@ISA = qw(Exporter);
47
48@EXPORT    = qw( );
49
50@EXPORT_OK = qw(
51		    %ConfigMeta
52             );
53
54%EXPORT_TAGS = (
55    'all'    => [ @EXPORT_OK ],
56);
57
58#
59# Define the data types for all the config variables
60#
61
62%ConfigMeta = (
63
64    ######################################################################
65    # General server configuration
66    ######################################################################
67    ServerHost 		=> "string",
68    ServerPort	 	=> "integer",
69    ServerMesgSecret 	=> "string",
70    MyPath	 	=> {type => "string", undefIfEmpty => 1},
71    UmaskMode	 	=> "integer",
72    WakeupSchedule => {
73            type  => "shortlist",
74            child => "float",
75        },
76    PoolV3Enabled       => "boolean",
77    MaxBackups	 	=> "integer",
78    MaxUserBackups	=> "integer",
79    MaxPendingCmds	=> "integer",
80    MaxBackupPCNightlyJobs => "integer",
81    BackupPCNightlyPeriod  => "integer",
82    PoolSizeNightlyUpdatePeriod => "integer",
83    MaxOldLogFiles      => "integer",
84    CmdQueueNice        => "integer",
85
86    SshPath	 	=> {type => "execPath", undefIfEmpty => 1},
87    NmbLookupPath 	=> {type => "execPath", undefIfEmpty => 1},
88    PingPath	 	=> {type => "execPath", undefIfEmpty => 1},
89    Ping6Path	 	=> {type => "execPath", undefIfEmpty => 1},
90    DfPath	 	=> {type => "execPath", undefIfEmpty => 1},
91    DfCmd	 	=> "string",
92    DfInodeUsageCmd	=> "string",
93    SplitPath	 	=> {type => "execPath", undefIfEmpty => 1},
94    ParPath	 	=> {type => "execPath", undefIfEmpty => 1},
95    CatPath	 	=> {type => "execPath", undefIfEmpty => 1},
96    GzipPath	 	=> {type => "execPath", undefIfEmpty => 1},
97    Bzip2Path	 	=> {type => "execPath", undefIfEmpty => 1},
98    RrdToolPath	 	=> {type => "execPath", undefIfEmpty => 1},
99    DfMaxUsagePct	=> "float",
100    DfMaxInodeUsagePct	=> "float",
101    DHCPAddressRanges   => {
102            type    => "list",
103	    emptyOk => 1,
104            child   => {
105                type      => "hash",
106                noKeyEdit => 1,
107                order     => [qw(ipAddrBase first last)],
108                child     => {
109                    ipAddrBase => "string",
110                    first      => "integer",
111                    last       => "integer",
112                },
113	    },
114    },
115    BackupPCUser 	=> "string",
116    CgiDir	 	=> "string",
117    InstallDir	 	=> "string",
118    TopDir              => "string",
119    ConfDir             => "string",
120    LogDir              => "string",
121    RunDir              => "string",
122    BackupPCUserVerify  => "boolean",
123    HardLinkMax	 	=> "integer",
124    PerlModuleLoad 	=> {
125	    type    => "list",
126	    emptyOk => 1,
127	    undefIfEmpty => 1,
128	    child   => "string",
129    },
130    ServerInitdPath 	=> {type => "string", undefIfEmpty => 1},
131    ServerInitdStartCmd => "string",
132
133    ######################################################################
134    # What to backup and when to do it
135    # (can be overridden in the per-PC config.pl)
136    ######################################################################
137    FullPeriod	 	=> "float",
138    IncrPeriod	 	=> "float",
139    FillCycle	 	=> "integer",
140    FullKeepCnt         => {
141	    type   => "shortlist",
142	    child  => "integer",
143    },
144    FullKeepCntMin	=> "integer",
145    FullAgeMax		=> "float",
146    IncrKeepCnt	 	=> "integer",
147    IncrKeepCntMin	=> "integer",
148    IncrAgeMax		=> "float",
149    BackupsDisable      => "integer",
150    RestoreInfoKeepCnt	=> "integer",
151    ArchiveInfoKeepCnt	=> "integer",
152
153    BackupFilesOnly	=> {
154            type      => "hash",
155            keyText   => "CfgEdit_Button_New_Share",
156            emptyOk   => 1,
157            childType => {
158                type      => "list",
159                emptyOk   => 1,
160                child     => "string",
161            },
162    },
163    BackupFilesExclude	=> {
164            type      => "hash",
165            keyText   => "CfgEdit_Button_New_Share",
166            emptyOk   => 1,
167            childType => {
168                type      => "list",
169                emptyOk   => 1,
170                child     => "string",
171            },
172    },
173
174    BlackoutBadPingLimit => "integer",
175    BlackoutGoodCnt	 => "integer",
176    BlackoutPeriods 	 => {
177            type    => "list",
178	    emptyOk => 1,
179            child   => {
180                type      => "hash",
181                noKeyEdit => 1,
182                child     => {
183                    hourBegin => "float",
184                    hourEnd   => "float",
185                    weekDays  => {
186                        type  => "shortlist",
187                        child => "integer",
188                    },
189                },
190            },
191        },
192
193    BackupZeroFilesIsFatal => "boolean",
194
195    ######################################################################
196    # How to backup a client
197    ######################################################################
198    XferMethod => {
199	    type   => "select",
200	    values => [qw(archive ftp rsync rsyncd smb tar)],
201    },
202    XferLogLevel	=> "integer",
203
204    ClientCharset       => "string",
205    ClientCharsetLegacy => "string",
206    ClientShareName2Path => {
207            type      => "hash",
208	    keyText   => "CfgEdit_Button_New_Share",
209            emptyOk   => 1,
210            childType => "string",
211    },
212
213    RefCntFsck          => "integer",
214
215    ######################################################################
216    # Smb Configuration
217    ######################################################################
218    SmbShareName 	=> {
219	    type   => "list",
220	    child  => "string",
221    },
222    SmbShareUserName 	=> "string",
223    SmbSharePasswd 	=> "string",
224    SmbClientPath 	=> {type => "execPath", undefIfEmpty => 1},
225    SmbClientFullCmd 	=> "string",
226    SmbClientIncrCmd 	=> "string",
227    SmbClientRestoreCmd => {type => "string", undefIfEmpty => 1},
228
229    ######################################################################
230    # Tar Configuration
231    ######################################################################
232    TarShareName 	=> {
233	    type   => "list",
234	    child  => "string",
235    },
236    TarClientCmd	=> "string",
237    TarFullArgs 	=> "string",
238    TarIncrArgs		=> "string",
239    TarClientRestoreCmd	=> {type => "string", undefIfEmpty => 1},
240    TarClientPath 	=> {type => "string", undefIfEmpty => 1},
241
242    ######################################################################
243    # Rsync Configuration
244    ######################################################################
245    RsyncShareName 	=> {
246	    type   => "list",
247	    child  => "string",
248    },
249    RsyncBackupPCPath	=> {type => "execPath", undefIfEmpty => 1},
250    RsyncClientPath 	=> {type => "string", undefIfEmpty => 1},
251    RsyncSshArgs	=> {
252	    type        => "list",
253	    emptyOk     => 1,
254	    child       => "string",
255    },
256
257    ######################################################################
258    # Rsyncd Configuration
259    ######################################################################
260    RsyncdClientPort	=> "integer",
261    RsyncdUserName 	=> "string",
262    RsyncdPasswd 	=> "string",
263
264    ######################################################################
265    # Rsync(d) Options
266    ######################################################################
267    RsyncArgs	 	=> {
268	    type         => "list",
269	    emptyOk      => 1,
270	    child        => "string",
271    },
272    RsyncArgsExtra	 => {
273	    type         => "list",
274	    emptyOk      => 1,
275	    child        => "string",
276    },
277    RsyncRestoreArgs	=> {
278	    type         => "list",
279	    emptyOk      => 1,
280            undefIfEmpty => 1,
281	    child        => "string",
282    },
283    RsyncFullArgsExtra	 => {
284	    type         => "list",
285	    emptyOk      => 1,
286	    child        => "string",
287    },
288    RsyncIncrArgsExtra	 => {
289	    type         => "list",
290	    emptyOk      => 1,
291	    child        => "string",
292    },
293
294    ######################################################################
295    # FTP Configuration
296    ######################################################################
297    FtpShareName        => {
298            type  => "list",
299            child => "string",
300    },
301    FtpUserName         => "string",
302    FtpPasswd           => "string",
303    FtpPassive          => "boolean",
304    FtpBlockSize        => "integer",
305    FtpPort             => "integer",
306    FtpTimeout          => "integer",
307    FtpFollowSymlinks   => "boolean",
308
309    ######################################################################
310    # Archive Configuration
311    ######################################################################
312    ArchiveDest 	=> "string",
313    ArchiveComp		=> {
314	    type   => "select",
315	    values => [qw(none bzip2 gzip)],
316    },
317    ArchivePar	 	=> "boolean",
318    ArchiveSplit	=> "float",
319    ArchiveClientCmd 	=> "string",
320
321    ######################################################################
322    # Other Client Configuration
323    ######################################################################
324    NmbLookupCmd 	=> "string",
325    NmbLookupFindHostCmd => "string",
326    ClientComment       => "string",
327
328    FixedIPNetBiosNameCheck => "boolean",
329    PingCmd	 	=> "string",
330    PingMaxMsec		=> "float",
331
332    ClientTimeout	=> "integer",
333
334    MaxOldPerPCLogFiles	=> "integer",
335
336    CompressLevel	=> "integer",
337
338    DumpPreUserCmd	=> {type => "string", undefIfEmpty => 1},
339    DumpPostUserCmd	=> {type => "string", undefIfEmpty => 1},
340    DumpPreShareCmd     => {type => "string", undefIfEmpty => 1},
341    DumpPostShareCmd	=> {type => "string", undefIfEmpty => 1},
342    RestorePreUserCmd	=> {type => "string", undefIfEmpty => 1},
343    RestorePostUserCmd	=> {type => "string", undefIfEmpty => 1},
344    ArchivePreUserCmd	=> {type => "string", undefIfEmpty => 1},
345    ArchivePostUserCmd	=> {type => "string", undefIfEmpty => 1},
346    UserCmdCheckStatus  => "boolean",
347
348    ClientNameAlias 	=> {
349	    type    => "list",
350	    emptyOk => 1,
351	    undefIfEmpty => 1,
352	    child   => "string",
353    },
354
355    ######################################################################
356    # Email reminders, status and messages
357    # (can be overridden in the per-PC config.pl)
358    ######################################################################
359    SendmailPath 	      => {type => "execPath", undefIfEmpty => 1},
360    EMailNotifyMinDays        => "float",
361    EMailFromUserName         => "string",
362    EMailAdminUserName        => "string",
363    EMailAdminSubject         => "string",
364    EMailUserDestDomain       => "string",
365    EMailNoBackupEverSubj     => {type => "string",    undefIfEmpty => 1},
366    EMailNoBackupEverMesg     => {type => "bigstring", undefIfEmpty => 1},
367    EMailNotifyOldBackupDays  => "float",
368    EMailNoBackupRecentSubj   => {type => "string",    undefIfEmpty => 1},
369    EMailNoBackupRecentMesg   => {type => "bigstring", undefIfEmpty => 1},
370    EMailNotifyOldOutlookDays => "float",
371    EMailOutlookBackupSubj    => {type => "string",    undefIfEmpty => 1},
372    EMailOutlookBackupMesg    => {type => "bigstring", undefIfEmpty => 1},
373    EMailHeaders              => {type => "bigstring", undefIfEmpty => 1},
374
375    ######################################################################
376    # CGI user interface configuration settings
377    ######################################################################
378    CgiAdminUserGroup 	=> "string",
379    CgiAdminUsers	=> "string",
380    SCGIServerPort	=> "integer",
381    CgiURL	 	=> "string",
382    Language	 	=> {
383	    type   => "select",
384	    values => [qw(cz de en es fr it ja nl pl pt_br ru uk zh_CN)],
385    },
386    CgiUserHomePageCheck => "string",
387    CgiUserUrlCreate    => "string",
388    CgiDateFormatMMDD	=> "integer",
389    CgiNavBarAdminAllHosts => "boolean",
390    CgiSearchBoxEnable 	=> "boolean",
391    CgiNavBarLinks	=> {
392	    type    => "list",
393	    emptyOk => 1,
394	    child   => {
395		type => "hash",
396                noKeyEdit => 1,
397		child => {
398		    link  => "string",
399		    lname => {type => "string", undefIfEmpty => 1},
400		    name  => {type => "string", undefIfEmpty => 1},
401		},
402	    },
403    },
404    CgiStatusHilightColor => {
405	    type => "hash",
406	    noKeyEdit => 1,
407	    child => {
408		Reason_backup_failed           => "string",
409		Reason_backup_done             => "string",
410		Reason_no_ping                 => "string",
411		Reason_backup_canceled_by_user => "string",
412		Status_backup_in_progress      => "string",
413                Disabled_OnlyManualBackups     => "string",
414                Disabled_AllBackupsDisabled    => "string",
415	    },
416    },
417    CgiHeaders	 	=> "bigstring",
418    CgiImageDir 	=> "string",
419    CgiExt2ContentType  => {
420            type      => "hash",
421	    emptyOk   => 1,
422            childType => "string",
423        },
424    CgiImageDirURL 	=> "string",
425    CgiCSSFile	 	=> "string",
426    CgiUserDeleteBackupEnable => "integer",
427    CgiUserConfigEditEnable => "boolean",
428    CgiUserConfigEdit   => {
429	    type => "hash",
430	    noKeyEdit => 1,
431	    child => {
432                FullPeriod                => "boolean",
433                IncrPeriod                => "boolean",
434                FillCycle                 => "boolean",
435                FullKeepCnt               => "boolean",
436                FullKeepCntMin            => "boolean",
437                FullAgeMax                => "boolean",
438                IncrKeepCnt               => "boolean",
439                IncrKeepCntMin            => "boolean",
440                IncrAgeMax                => "boolean",
441                RestoreInfoKeepCnt        => "boolean",
442                ArchiveInfoKeepCnt        => "boolean",
443                BackupFilesOnly           => "boolean",
444                BackupFilesExclude        => "boolean",
445                BackupsDisable            => "boolean",
446                BlackoutBadPingLimit      => "boolean",
447                BlackoutGoodCnt           => "boolean",
448                BlackoutPeriods           => "boolean",
449                BackupZeroFilesIsFatal    => "boolean",
450                XferMethod                => "boolean",
451                XferLogLevel              => "boolean",
452                ClientCharset             => "boolean",
453                ClientCharsetLegacy       => "boolean",
454                ClientShareName2Path      => "boolean",
455                RefCntFsck                => "boolean",
456                SmbShareName              => "boolean",
457                SmbShareUserName          => "boolean",
458                SmbSharePasswd            => "boolean",
459                SmbClientPath             => "boolean",
460                SmbClientFullCmd          => "boolean",
461                SmbClientIncrCmd          => "boolean",
462                SmbClientRestoreCmd       => "boolean",
463                TarShareName              => "boolean",
464                TarFullArgs               => "boolean",
465                TarIncrArgs               => "boolean",
466                TarClientCmd              => "boolean",
467                TarClientPath             => "boolean",
468                TarClientRestoreCmd       => "boolean",
469                RsyncShareName            => "boolean",
470                RsyncBackupPCPath         => "boolean",
471                RsyncdClientPort          => "boolean",
472                RsyncdUserName            => "boolean",
473                RsyncdPasswd              => "boolean",
474                RsyncArgs                 => "boolean",
475                RsyncArgsExtra            => "boolean",
476                RsyncRestoreArgs          => "boolean",
477                RsyncFullArgsExtra        => "boolean",
478                RsyncIncrArgsExtra        => "boolean",
479                RsyncSshArgs              => "boolean",
480                RsyncClientPath           => "boolean",
481                FtpShareName              => "boolean",
482                FtpUserName               => "boolean",
483                FtpPasswd                 => "boolean",
484                FtpBlockSize              => "boolean",
485                FtpPort                   => "boolean",
486                FtpTimeout                => "boolean",
487                FtpFollowSymlinks         => "boolean",
488                FtpRestoreEnabled         => "boolean",
489                ArchiveDest               => "boolean",
490                ArchiveComp               => "boolean",
491                ArchivePar                => "boolean",
492                ArchiveSplit              => "boolean",
493                ArchiveClientCmd          => "boolean",
494                FixedIPNetBiosNameCheck   => "boolean",
495                PingMaxMsec               => "boolean",
496                NmbLookupCmd              => "boolean",
497                NmbLookupFindHostCmd      => "boolean",
498                PingCmd                   => "boolean",
499                ClientTimeout             => "boolean",
500                MaxOldPerPCLogFiles       => "boolean",
501                CompressLevel             => "boolean",
502                ClientNameAlias           => "boolean",
503                ClientComment             => "boolean",
504                DumpPreUserCmd            => "boolean",
505                DumpPostUserCmd           => "boolean",
506                RestorePreUserCmd         => "boolean",
507                RestorePostUserCmd        => "boolean",
508                ArchivePreUserCmd         => "boolean",
509                ArchivePostUserCmd        => "boolean",
510                DumpPostShareCmd          => "boolean",
511                DumpPreShareCmd           => "boolean",
512                UserCmdCheckStatus        => "boolean",
513                EMailNotifyMinDays        => "boolean",
514                EMailFromUserName         => "boolean",
515                EMailAdminSubject         => "boolean",
516                EMailAdminUserName        => "boolean",
517                EMailUserDestDomain       => "boolean",
518                EMailNoBackupEverSubj     => "boolean",
519                EMailNoBackupEverMesg     => "boolean",
520                EMailNotifyOldBackupDays  => "boolean",
521                EMailNoBackupRecentSubj   => "boolean",
522                EMailNoBackupRecentMesg   => "boolean",
523                EMailNotifyOldOutlookDays => "boolean",
524                EMailOutlookBackupSubj    => "boolean",
525                EMailOutlookBackupMesg    => "boolean",
526                EMailHeaders              => "boolean",
527	    },
528    },
529
530    ######################################################################
531    # Fake config setting for editing the hosts
532    ######################################################################
533    Hosts => {
534	    type    => "list",
535	    emptyOk => 1,
536	    child   => {
537		type  => "horizHash",
538                order => [qw(host dhcp user moreUsers)],
539                noKeyEdit => 1,
540		child => {
541		    host       => { type => "string", size => 20 },
542		    dhcp       => { type => "boolean"            },
543		    user       => { type => "string", size => 20 },
544		    moreUsers  => { type => "string", size => 30 },
545		},
546	    },
547    },
548);
549
5501;
551