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