 |
ewmscp
..
|
Go to the documentation of this file.
3 #include <forward_list>
6 static const std::string
parPrefix(
"dCap");
9 static std::forward_list<dCapConfigParameter*>&
getList() {
10 static std::remove_reference<decltype(
getList())>::type list;
31 const std::string& description,
48 void (*
set)(
const char *);
51 const std::string& description,
52 void (* setter)(
const char*)):
68 const std::string& description1,
69 const std::string& opt2Name,
70 const std::string& description2,
71 void (* setter)(T, U),
72 std::initializer_list<dCapConfigParameter*> forbid = {}):
78 for (
auto& other : forbid) {
94 const std::string& description,
109 "CallbackPortRangeEnd",
"set callback port range end",
129 auto index = path.find(
"//");
130 if (index == std::remove_reference<decltype(path)>::type::npos) {
131 throw std::runtime_error(
"can't sanitize path \"" + path +
"\"");
133 index = path.find(
'/', index + 2);
134 std::string url(path.substr(0, index + 1));
136 escaper->escape(path.substr(index + 1), url);
137 if (url.back() ==
'/') {
150 auto result = dc_stat(fixedPath.c_str(), &statBuf);
151 if (result && errno == ENOENT) {
164 result = dc_stat(fixedPath.c_str(), &statBuf);
166 result = dc_lstat(fixedPath.c_str(), &statBuf);
168 if (result && errno == ENOENT && (dc_errno == DEOK || dc_errno == DESRVMSG)) {
172 if (statBuf.st_blksize == 0) {
173 statBuf.st_blksize = 1024 * 1024;
175 return std::unique_ptr<const genericStat>(
new genericStat(statBuf, std::chrono::seconds(1)));
193 return std::unique_ptr<const genericStat>(
new genericStat(statBuf, std::chrono::seconds(1)));
generic option class with any type that can be used with std::istream and std::ostream
static dCapCfgPar< const char * > Tunnel("Tunnel", "set tunnel", dc_setTunnel)
virtual void fForbid(options::base &)
static dCapCfgPar< unsigned int > DebugLevel("DebugLevel", "set debug level", dc_setDebugLevel)
generic stat abstraction class Used to abstract the variants of the stat structure.
options::single< U > option2
void applySingle() override
virtual bool fIsSet() const
check if this option was set, regardless of from command line or config file
dCapCfgPar(const std::string &optName, const std::string &description, void(*setter)(T))
std::unique_ptr< const genericStat > getStat() override
static dCapCfgTimePar< unsigned int > CloseTimeout("CloseTimeout", "set close timeout", dc_setCloseTimeout)
virtual void fForbid(const base *aOtherOption)
forbid aOtherOption when this option is set
options::single< std::chrono::seconds > option
virtual void fRequire(const base *aOtherOption)
require aOtherOption when this option is set
static std::forward_list< dCapConfigParameter * > & getList()
static std::string fixPathUrl(const std::string &path)
options::single< T > option1
void fForbid(options::base &opt) override
static const std::string parPrefix("dCap")
dcapIoCommon(const std::string &aPath)
static dCapCfgPar< unsigned short > CallbackPort("CallbackPort", "set callback port", dc_setCallbackPort)
dCapCfgTimePar(const std::string &optName, const std::string &description, void(*setter)(T))
virtual void applySingle()=0
dCapCfg2Par(const std::string &opt1Name, const std::string &description1, const std::string &opt2Name, const std::string &description2, void(*setter)(T, U), std::initializer_list< dCapConfigParameter * > forbid={})
static std::mutex extraOptionMutex
static const escapism * newEscaper(const std::string &name)
bool pathExists(const std::string &path) override
static dCapCfgTimePar< time_t > OpenTimeout("OpenTimeout", "set open timeout", dc_setOpenTimeout)
static dCapCfgPar< const char * > ReplyHostName("ReplyHostName", "set reply host name", dc_setReplyHostName)
options::single< std::string > option
void good0(T call, const Args &... args)
void applySingle() override
dCapCfgPar(const std::string &optName, const std::string &description, void(*setter)(const char *))
void applySingle() override
options::single< T > option
static dCapCfgPar< const char * > TunnelType("TunnelType", "set tunnel type", dc_setTunnelType)
static dCapCfg2Par< unsigned short, unsigned short > CallbackPortRange("CallbackPortRangeBegin", "set callback port range begin", "CallbackPortRangeEnd", "set callback port range end", dc_setCallbackPortRange, {&CallbackPort})
std::unique_ptr< const genericStat > getStat(const std::string &path, bool followLink) override
void applySingle() override