 |
ewmscp
..
|
Go to the documentation of this file. 1 #ifndef __davixCommon_h__
2 #define __davixCommon_h__
15 copyRequest::clock_type::time_point
start;
21 const std::string& aWhat,
22 const std::string& aPath):
report(nullptr),
23 start(std::chrono::system_clock::now()),
28 operator Davix::DavixError** () {
33 throw std::runtime_error(
"no davix error set");
39 static const std::string noMessageYet(
"no davix eror set");
42 return report->getErrMsg();
47 throw std::runtime_error(
func +
" "
49 +
path +
" : no davix error set");
51 throw std::runtime_error(
func +
" "
57 Davix::DavixError::clearError(&
report);
59 auto now = copyRequest::clock_type::now();
60 auto dt = std::chrono::duration_cast<std::chrono::duration<double>>(now -
start).count();
61 std::cerr <<
func <<
":" <<
what <<
": " << std::fixed << dt <<
"\n";
69 void (Davix::RequestParams::*
set)(T);
72 const std::string& optName,
73 const std::string& description,
74 void (Davix::RequestParams::* setter)(T)):
79 const std::string& optName,
80 const std::string& description,
81 void (Davix::RequestParams::* setter)(T),
95 void (Davix::RequestParams::*
set)(
struct timespec*);
99 const std::string& optName,
100 const std::string& description,
101 void (Davix::RequestParams::* setter)(
struct timespec*)):
102 option(
'\0',
parPrefix + optName, description),
107 spec.tv_sec = std::chrono::duration_cast<std::chrono::seconds>(option).count();
108 spec.tv_nsec = option.count() % 1000000000;
109 (params.*set)(&spec);
116 void (Davix::RequestParams::*
set)(T);
120 const std::string& optName,
121 const std::string& description,
122 void (Davix::RequestParams::* setter)(T),
123 const std::map<std::string, T> map):
127 for (
const auto& item :
nameMap) {
140 void (Davix::RequestParams::*
set)(T);
143 const std::string& optName,
144 const std::string& description,
145 void (Davix::RequestParams::* setter)(T)):
150 for (
const auto& item :
option) {
164 void applySingle(Davix::RequestParams& params,
bool &accessConfigDone);
187 void apply(Davix::RequestParams& params);
203 const Davix::SessionInfo & info,
205 std::string & password,
207 Davix::DavixError** err);
209 std::string & password,
216 std::string& password);
219 bool pathExists(
const std::string& path)
override;
220 std::unique_ptr<const genericStat>
getStat(
const std::string& path,
221 bool followLink)
override;
231 std::unique_ptr<const genericStat>
getStat()
override;
generic option class with any type that can be used with std::istream and std::ostream
void(Davix::RequestParams::* set)(T)
options::container< std::string > option
void applySingle(Davix::RequestParams ¶ms)
options::single< std::string > credentialPath
template class for davix config parameters
class specialisation for options of type bool
void applySingle(Davix::RequestParams ¶ms)
virtual void fAddToRange(rangeValueType aValue)
add a value to the range of allowed values
bool accessConfigured() const
std::unique_ptr< const genericStat > getStat() override
static int loginCallback(void *userdata, const Davix::SessionInfo &info, std::string &login, std::string &password, int count, Davix::DavixError **err)
virtual bool fIsSet() const
check if this option was set, regardless of from command line or config file
Davix::DavixError * operator->()
options::single< bool > noAuth
copyRequest::clock_type::time_point start
void applySingle(Davix::RequestParams ¶ms, bool &accessConfigDone)
static void getPassword(const std::string &prompt, std::string &password)
davixCfgPar< struct timespec * > OperationTimeout
void applySingle(Davix::RequestParams ¶ms)
davixCfgEnum< const Davix::RequestProtocol::Protocol > Protocol
davixCfgPar(const std::string &parPrefix, const std::string &optName, const std::string &description, void(Davix::RequestParams::*setter)(T))
options::single< std::string > proxy
davixCfgEnum(const std::string &parPrefix, const std::string &optName, const std::string &description, void(Davix::RequestParams::*setter)(T), const std::map< std::string, T > map)
davixCfgPar< int > OperationRetry
class for easy error handling with davix ensures proper cleanup of the error report when going out of...
static options::single< bool > withTiming
errorReport(const std::string &aFunc, const std::string &aWhat, const std::string &aPath)
options::single< std::string > privKeyPath
static const std::string parPrefix("dCap")
options::single< std::chrono::nanoseconds > option
bool pathExists(const std::string &path) override
davixIoCommon(const std::string &aPath, davixCommon &aHandler)
davixCfgStrings< const std::string & > CertificateAuthorityPath
options::single< T > option
option that holds the config value
void(Davix::RequestParams::* set)(T)
Davix::X509Credential credential
davixCfgPar(const std::string &parPrefix, const std::string &optName, const std::string &description, void(Davix::RequestParams::*setter)(T), T aDefault)
davixCommon(davixConfigObject &configObj)
void applySingle(Davix::RequestParams ¶ms)
std::map< std::string, T > nameMap
Davix::DavixError * report
class as base for inputHandler::base::reader and outputHandler::base::writer containing the common pa...
davixConfigObject(const std::string &parPrefix)
davixCfgPar< struct timespec * > ConnectionTimeout
options::single< std::string > p12Path
davixCfgPar< bool > SSLCAcheck
Davix::RequestParams params
const std::string & getMessage() const
std::unique_ptr< const genericStat > getStat(const std::string &path, bool followLink) override
davixCfgX509(const std::string &parPrefix)
class for configuring one davix instance holds all options necessary for that
davixCfgStrings(const std::string &parPrefix, const std::string &optName, const std::string &description, void(Davix::RequestParams::*setter)(T))
int loginCallbackInner(std::string &login, std::string &password, int count)
void apply(Davix::RequestParams ¶ms)
davixCfgPar(const std::string &parPrefix, const std::string &optName, const std::string &description, void(Davix::RequestParams::*setter)(struct timespec *))
void(Davix::RequestParams::* set)(T)
setter that will configure the davix instance
options::single< std::string > option