2015-09-29 14:29:10 +02:00
|
|
|
#include "ProgramOptions.h"
|
|
|
|
#include <cstring>
|
2016-02-11 16:39:42 +01:00
|
|
|
#include <cpp-utils/assert/assert.h>
|
2015-09-29 14:29:10 +02:00
|
|
|
|
|
|
|
using namespace cryfs::program_options;
|
|
|
|
using std::string;
|
|
|
|
using std::vector;
|
2015-10-17 18:31:17 +02:00
|
|
|
using boost::optional;
|
2015-11-17 10:49:35 +01:00
|
|
|
namespace bf = boost::filesystem;
|
2015-09-29 14:29:10 +02:00
|
|
|
|
2017-10-01 10:04:29 +02:00
|
|
|
ProgramOptions::ProgramOptions(bf::path baseDir, bf::path mountDir, optional<bf::path> configFile,
|
2018-02-03 17:33:59 +01:00
|
|
|
bool foreground, bool allowFilesystemUpgrade, bool allowReplacedFilesystem, optional<double> unmountAfterIdleMinutes,
|
2017-10-01 10:04:29 +02:00
|
|
|
optional<bf::path> logFile, optional<string> cipher,
|
|
|
|
optional<uint32_t> blocksizeBytes,
|
2018-04-29 22:41:21 +02:00
|
|
|
bool allowIntegrityViolations,
|
2017-10-01 10:04:29 +02:00
|
|
|
boost::optional<bool> missingBlockIsIntegrityViolation,
|
|
|
|
vector<string> fuseOptions)
|
2018-04-29 22:41:21 +02:00
|
|
|
:_baseDir(std::move(baseDir)), _mountDir(std::move(mountDir)), _configFile(std::move(configFile)), _foreground(foreground), _allowFilesystemUpgrade(allowFilesystemUpgrade), _allowReplacedFilesystem(allowReplacedFilesystem), _allowIntegrityViolations(allowIntegrityViolations),
|
2017-10-01 10:04:29 +02:00
|
|
|
_cipher(std::move(cipher)), _blocksizeBytes(std::move(blocksizeBytes)), _unmountAfterIdleMinutes(std::move(unmountAfterIdleMinutes)),
|
|
|
|
_missingBlockIsIntegrityViolation(std::move(missingBlockIsIntegrityViolation)), _logFile(std::move(logFile)), _fuseOptions(std::move(fuseOptions)) {
|
2015-09-29 14:29:10 +02:00
|
|
|
}
|
|
|
|
|
2015-11-17 10:49:35 +01:00
|
|
|
const bf::path &ProgramOptions::baseDir() const {
|
2015-09-29 14:29:10 +02:00
|
|
|
return _baseDir;
|
|
|
|
}
|
|
|
|
|
2016-05-10 01:07:02 +02:00
|
|
|
const bf::path &ProgramOptions::mountDir() const {
|
|
|
|
return _mountDir;
|
2015-09-29 14:29:10 +02:00
|
|
|
}
|
|
|
|
|
2015-11-17 10:49:35 +01:00
|
|
|
const optional<bf::path> &ProgramOptions::configFile() const {
|
2015-09-29 14:39:10 +02:00
|
|
|
return _configFile;
|
|
|
|
}
|
|
|
|
|
2015-10-15 03:38:44 +02:00
|
|
|
bool ProgramOptions::foreground() const {
|
|
|
|
return _foreground;
|
|
|
|
}
|
|
|
|
|
2018-02-01 11:04:59 +01:00
|
|
|
bool ProgramOptions::allowFilesystemUpgrade() const {
|
|
|
|
return _allowFilesystemUpgrade;
|
|
|
|
}
|
|
|
|
|
2015-11-13 00:06:53 +01:00
|
|
|
const optional<double> &ProgramOptions::unmountAfterIdleMinutes() const {
|
2015-11-12 20:43:11 +01:00
|
|
|
return _unmountAfterIdleMinutes;
|
|
|
|
}
|
|
|
|
|
2015-11-17 10:49:35 +01:00
|
|
|
const optional<bf::path> &ProgramOptions::logFile() const {
|
2015-10-17 18:31:17 +02:00
|
|
|
return _logFile;
|
|
|
|
}
|
|
|
|
|
2015-10-30 19:53:15 +01:00
|
|
|
const optional<string> &ProgramOptions::cipher() const {
|
|
|
|
return _cipher;
|
|
|
|
}
|
|
|
|
|
2016-03-04 23:12:41 +01:00
|
|
|
const optional<uint32_t> &ProgramOptions::blocksizeBytes() const {
|
|
|
|
return _blocksizeBytes;
|
|
|
|
}
|
|
|
|
|
2018-04-29 22:41:21 +02:00
|
|
|
bool ProgramOptions::allowIntegrityViolations() const {
|
|
|
|
return _allowIntegrityViolations;
|
2017-09-16 17:18:04 +02:00
|
|
|
}
|
|
|
|
|
2018-02-03 17:33:59 +01:00
|
|
|
bool ProgramOptions::allowReplacedFilesystem() const {
|
|
|
|
return _allowReplacedFilesystem;
|
|
|
|
}
|
|
|
|
|
2016-06-27 07:07:58 +02:00
|
|
|
const optional<bool> &ProgramOptions::missingBlockIsIntegrityViolation() const {
|
|
|
|
return _missingBlockIsIntegrityViolation;
|
|
|
|
}
|
|
|
|
|
2016-05-10 01:07:02 +02:00
|
|
|
const vector<string> &ProgramOptions::fuseOptions() const {
|
2015-09-29 14:29:10 +02:00
|
|
|
return _fuseOptions;
|
|
|
|
}
|