1
// This file is part of par2cmdline (a PAR 2.0 compatible file verification and
2
// repair tool). See http://parchive.sourceforge.net for details of PAR 2.0.
4
// Copyright (c) 2003 Peter Brian Clements
6
// par2cmdline is free software; you can redistribute it and/or modify
7
// it under the terms of the GNU General Public License as published by
8
// the Free Software Foundation; either version 2 of the License, or
9
// (at your option) any later version.
11
// par2cmdline is distributed in the hope that it will be useful,
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
// GNU General Public License for more details.
16
// You should have received a copy of the GNU General Public License
17
// along with this program; if not, write to the Free Software
18
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
20
#ifndef __COMMANDLINE_H__
21
#define __COMMANDLINE_H__
23
// The CommandLine object is responsible for understanding the format
24
// of the command line parameters are parsing the command line to
25
// extract details as to what the user wants to do.
32
// Parse the supplied command line arguments.
33
bool Parse(int argc, char *argv[]);
35
// Display details of the correct format for command line parameters.
36
static void usage(void);
38
// What operation will we be carrying out
42
opCreate, // Create new PAR2 recovery volumes
43
opVerify, // Verify but don't repair damaged data files
44
opRepair // Verify and if possible repair damaged data files
50
verPar1, // Processing PAR 1.0 files
51
verPar2 // Processing PAR 2.0 files
57
scVariable, // Each PAR2 file will have 2x as many blocks as previous
58
scLimited, // Limit PAR2 file size
59
scUniform // All PAR2 files the same size
65
nlSilent, // Absolutely no output (other than errors)
66
nlQuiet, // Bare minimum of output
67
nlNormal, // Normal level of output
68
nlNoisy, // Lots of output
69
nlDebug // Extra debugging information
72
// Any extra files listed on the command line
77
ExtraFile(const ExtraFile&);
78
ExtraFile& operator=(const ExtraFile&);
80
ExtraFile(const string &name, u64 size);
82
string FileName(void) const {return filename;}
83
u64 FileSize(void) const {return filesize;}
91
// Accessor functions for the command line parameters
93
CommandLine::Operation GetOperation(void) const {return operation;}
94
CommandLine::Version GetVersion(void) const {return version;}
95
u64 GetBlockSize(void) const {return blocksize;}
96
u32 GetBlockCount(void) const {return blockcount;}
97
u32 GetRedundancy(void) const {return redundancy;}
98
u32 GetFirstRecoveryBlock(void) const {return firstblock;}
99
u32 GetRecoveryFileCount(void) const {return recoveryfilecount;}
100
u32 GetRecoveryBlockCount(void) const {return recoveryblockcount;}
101
CommandLine::Scheme GetRecoveryFileScheme(void) const {return recoveryfilescheme;}
102
size_t GetMemoryLimit(void) const {return memorylimit;}
103
u64 GetLargestSourceSize(void) const {return largestsourcesize;}
104
u64 GetTotalSourceSize(void) const {return totalsourcesize;}
105
CommandLine::NoiseLevel GetNoiseLevel(void) const {return noiselevel;}
107
string GetParFilename(void) const {return parfilename;}
108
const list<CommandLine::ExtraFile>& GetExtraFiles(void) const {return extrafiles;}
111
Operation operation; // The operation to be carried out.
112
Version version; // What version files will be processed.
114
NoiseLevel noiselevel; // How much display output should there be.
116
u32 blockcount; // How many blocks the source files should
117
// be virtually split into.
119
u64 blocksize; // What virtual block size to use.
121
u32 firstblock; // What the exponent value for the first
122
// recovery block will be.
124
Scheme recoveryfilescheme; // How the the size of the recovery files should
127
u32 recoveryfilecount; // How many recovery files should be created.
129
u32 recoveryblockcount; // How many recovery blocks should be created.
130
bool recoveryblockcountset; // Set if the recoveryblockcount as been specified
132
u32 redundancy; // What percentage of recovery data should
134
bool redundancyset; // Set if the redundancy has been specified
136
string parfilename; // The name of the PAR2 file to create, or
137
// the name of the first PAR2 file to read
138
// when verifying or repairing.
140
list<ExtraFile> extrafiles; // The list of other files specified on the
141
// command line. When creating, this will be
142
// the source files, and when verifying or
143
// repairing, this will be additional PAR2
144
// files or data files to be examined.
146
u64 totalsourcesize; // Total size of the source files.
148
u64 largestsourcesize; // Size of the largest source file.
150
size_t memorylimit; // How much memory is permitted to be used
151
// for the output buffer when creating
155
typedef list<CommandLine::ExtraFile>::const_iterator ExtraFileIterator;
157
#endif // __COMMANDLINE_H__