libzypp 17.38.5

transfersettings.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12#ifndef ZYPP_CURL_TRANSFER_SETTINGS_H_INCLUDED
13#define ZYPP_CURL_TRANSFER_SETTINGS_H_INCLUDED
14
15#include <string>
16#include <vector>
17#include <zypp-core/base/Flags.h>
18#include <zypp-core/base/PtrTypes.h>
19#include <zypp-core/Pathname.h>
20#include <zypp-core/Url.h>
21 namespace zypp
22{
23 namespace media
24 {
25
32 // strings are discarded.
33 class TransferSettings
34 {
35 public:
37 static std::ostream & logUserPass( std::ostream & str, const std::string & user_r, const std::string & pass_r );
38
39 public:
41 TransferSettings();
42
43 using Headers = std::vector<std::string>;
44
46 void reset();
47
49 void addHeader( std::string && val_r );
50 void addHeader( const std::string & val_r );
51
53 const Headers &headers() const;
54
56 void setUserAgentString( std::string && val_r );
57 void setUserAgentString( const std::string &val_r );
58
60 const std::string &userAgentString() const;
61
62
64 bool hasCredentials() const;
65
67 std::ostream & logCredentials( std::ostream & str ) const
68 { return logUserPass( str, username(), password() ); }
69
71 void setUsername( const std::string &val_r );
72 void setUsername( std::string && val_r );
73
75 const std::string &username() const;
76
78 void setPassword( const std::string & val_r );
79 void setPassword( std::string && val_r );
80
82 const std::string &password() const;
83
85 void setAnonymousAuth();
86
87
89 void setProxyEnabled( bool enabled );
90
92 bool proxyEnabled() const;
93
94
96 void setProxy( const std::string &val_r );
97 void setProxy( std::string && val_r );
98
100 const std::string &proxy() const;
101
102
104 bool hasProxyCredentials() const;
105
107 std::ostream & logProxyCredentials( std::ostream & str ) const
108 { return logUserPass( str, proxyUsername(), proxyPassword() ); }
109
111 void setProxyUsername( const std::string &val_r );
112 void setProxyUsername( std::string && val_r );
113
115 const std::string &proxyUsername() const;
116
118 void setProxyPassword( const std::string &val_r );
119 void setProxyPassword( std::string && val_r );
120
122 const std::string &proxyPassword() const;
123
125 std::string proxyUserPassword() const;
126
127
129 void setConnectTimeout( long t );
130
132 long connectTimeout() const;
133
134
136 void setTimeout( long t );
137
139 long timeout() const;
140
141
143 void setMaxConcurrentConnections(long v);
144
146 long maxConcurrentConnections() const;
147
148
150 void setMinDownloadSpeed(long v);
151
153 long minDownloadSpeed() const;
154
155
157 void setMaxDownloadSpeed(long v);
158
160 long maxDownloadSpeed() const;
161
162
164 void setMaxSilentTries(long v);
165
167 long maxSilentTries() const;
168
169
171 void setVerifyHostEnabled( bool enabled );
172
174 bool verifyHostEnabled() const;
175
176
178 void setVerifyPeerEnabled( bool enabled );
179
181 bool verifyPeerEnabled() const;
182
183
185 void setCertificateAuthoritiesPath( const Pathname &val_r );
186 void setCertificateAuthoritiesPath( Pathname && val_r );
187
189 const Pathname &certificateAuthoritiesPath() const;
190
191
193 void setAuthType( const std::string &val_r );
194 void setAuthType( std::string && val_r );
195
197 const std::string &authType() const;
198
199
201 void setHeadRequestsAllowed(bool allowed);
202
204 bool headRequestsAllowed() const;
205
206
208 void setClientCertificatePath( const Pathname &val_r );
209 void setClientCertificatePath( Pathname && val_r );
210
212 const Pathname &clientCertificatePath() const;
213
214
216 void setClientKeyPath( const Pathname &val_r );
217 void setClientKeyPath( Pathname && val_r );
218
220 const Pathname &clientKeyPath() const;
221
223 void setEnableCookieFile( bool enable = true );
224 bool cookieFileEnabled() const;
225
226 protected:
227 class Impl;
228 RWCOW_pointer<Impl> _impl;
229 };
230
232 std::ostream & dumpOn( std::ostream & str, const TransferSettings & obj );
233
234 } // namespace media
235} // namespece zypp
236
237#endif // ZYPP_CURL_TRANSFER_SETTINGS_H_INCLUDED
Flags.h
Pathname.h
PtrTypes.h
Url.h
Impl
zypp::filesystem::Pathname
Pathname.
Definition Pathname.h:48
zypp::media::TransferSettings
Holds transfer setting.
Definition transfersettings.h:34
zypp::media::TransferSettings::password
const std::string & password() const
auth password
Definition transfersettings.cc:175
zypp::media::TransferSettings::setProxy
void setProxy(const std::string &val_r)
proxy to use if it is enabled
Definition transfersettings.cc:192
zypp::media::TransferSettings::setProxyEnabled
void setProxyEnabled(bool enabled)
whether the proxy is used or not
Definition transfersettings.cc:185
zypp::media::TransferSettings::maxDownloadSpeed
long maxDownloadSpeed() const
Maximum download speed (bytes per second).
Definition transfersettings.cc:261
zypp::media::TransferSettings::TransferSettings
TransferSettings()
Constructs a transfer program cmd line access.
Definition transfersettings.cc:128
zypp::media::TransferSettings::connectTimeout
long connectTimeout() const
connection timeout
Definition transfersettings.cc:240
zypp::media::TransferSettings::authType
const std::string & authType() const
get the allowed authentication types
Definition transfersettings.cc:326
zypp::media::TransferSettings::timeout
long timeout() const
transfer timeout
Definition transfersettings.cc:233
zypp::media::TransferSettings::setUsername
void setUsername(const std::string &val_r)
sets the auth username
Definition transfersettings.cc:160
zypp::media::TransferSettings::reset
void reset()
reset the settings to the defaults
Definition transfersettings.cc:132
zypp::media::TransferSettings::maxSilentTries
long maxSilentTries() const
Maximum silent retries.
Definition transfersettings.cc:268
zypp::media::TransferSettings::clientCertificatePath
const Pathname & clientCertificatePath() const
SSL client certificate file.
Definition transfersettings.cc:291
zypp::media::TransferSettings::minDownloadSpeed
long minDownloadSpeed() const
Minimum download speed (bytes per second) until the connection is dropped.
Definition transfersettings.cc:254
zypp::media::TransferSettings::setProxyUsername
void setProxyUsername(const std::string &val_r)
sets the proxy user
Definition transfersettings.cc:202
zypp::media::TransferSettings::setHeadRequestsAllowed
void setHeadRequestsAllowed(bool allowed)
set whether HEAD requests are allowed
Definition transfersettings.cc:330
zypp::media::TransferSettings::headers
const Headers & headers() const
returns a list of all added headers (trimmed)
Definition transfersettings.cc:141
zypp::media::TransferSettings::proxy
const std::string & proxy() const
proxy host
Definition transfersettings.cc:198
zypp::media::TransferSettings::clientKeyPath
const Pathname & clientKeyPath() const
SSL client key file.
Definition transfersettings.cc:301
zypp::media::TransferSettings::setVerifyHostEnabled
void setVerifyHostEnabled(bool enabled)
Sets whether to verify host for ssl.
Definition transfersettings.cc:272
zypp::media::TransferSettings::setUserAgentString
void setUserAgentString(std::string &&val_r)
sets the user agent ie: "Mozilla v3" (trims)
Definition transfersettings.cc:150
zypp::media::TransferSettings::setConnectTimeout
void setConnectTimeout(long t)
set the connect timeout
Definition transfersettings.cc:237
zypp::media::TransferSettings::setClientKeyPath
void setClientKeyPath(const Pathname &val_r)
Sets the SSL client key file.
Definition transfersettings.cc:295
zypp::media::TransferSettings::addHeader
void addHeader(std::string &&val_r)
add a header, on the form "Foo: Bar" (trims)
Definition transfersettings.cc:138
zypp::media::TransferSettings::setMinDownloadSpeed
void setMinDownloadSpeed(long v)
Set minimum download speed (bytes per second) until the connection is dropped.
Definition transfersettings.cc:251
zypp::media::TransferSettings::maxConcurrentConnections
long maxConcurrentConnections() const
Maximum number of concurrent connections for a single transfer.
Definition transfersettings.cc:247
zypp::media::TransferSettings::proxyUserPassword
std::string proxyUserPassword() const
returns the proxy user and password as a user:pass string
Definition transfersettings.cc:220
zypp::media::TransferSettings::setClientCertificatePath
void setClientCertificatePath(const Pathname &val_r)
Sets the SSL client certificate file.
Definition transfersettings.cc:285
zypp::media::TransferSettings::verifyHostEnabled
bool verifyHostEnabled() const
Whether to verify host for ssl.
Definition transfersettings.cc:275
zypp::media::TransferSettings::userAgentString
const std::string & userAgentString() const
user agent string (trimmed)
Definition transfersettings.cc:153
zypp::media::TransferSettings::hasCredentials
bool hasCredentials() const
has a username, maybe even the password
Definition transfersettings.cc:157
zypp::media::TransferSettings::setPassword
void setPassword(const std::string &val_r)
sets the auth password
Definition transfersettings.cc:169
zypp::media::TransferSettings::logUserPass
static std::ostream & logUserPass(std::ostream &str, const std::string &user_r, const std::string &pass_r)
Log credentials to stream hiding the password ("","[user]","[user:########]").
Definition transfersettings.cc:115
zypp::media::TransferSettings::headRequestsAllowed
bool headRequestsAllowed() const
whether HEAD requests are allowed
Definition transfersettings.cc:333
zypp::media::TransferSettings::proxyPassword
const std::string & proxyPassword() const
proxy auth password
Definition transfersettings.cc:217
zypp::media::TransferSettings::setVerifyPeerEnabled
void setVerifyPeerEnabled(bool enabled)
Sets whether to verify host for ssl.
Definition transfersettings.cc:279
zypp::media::TransferSettings::cookieFileEnabled
bool cookieFileEnabled() const
Definition transfersettings.cc:307
zypp::media::TransferSettings::hasProxyCredentials
bool hasProxyCredentials() const
has a proxy username, maybe even the password
zypp::media::TransferSettings::proxyEnabled
bool proxyEnabled() const
proxy is enabled
Definition transfersettings.cc:188
zypp::media::TransferSettings::setMaxDownloadSpeed
void setMaxDownloadSpeed(long v)
Set max download speed (bytes per second).
Definition transfersettings.cc:258
zypp::media::TransferSettings::setAnonymousAuth
void setAnonymousAuth()
sets anonymous authentication (ie: for ftp)
Definition transfersettings.cc:178
zypp::media::TransferSettings::Headers
std::vector< std::string > Headers
Definition transfersettings.h:43
zypp::media::TransferSettings::logProxyCredentials
std::ostream & logProxyCredentials(std::ostream &str) const
log credentials to stream hiding the password.
Definition transfersettings.h:107
zypp::media::TransferSettings::username
const std::string & username() const
auth username
Definition transfersettings.cc:166
zypp::media::TransferSettings::setEnableCookieFile
void setEnableCookieFile(bool enable=true)
Enable or disable the use of the cookie file.
Definition transfersettings.cc:304
zypp::media::TransferSettings::_impl
RWCOW_pointer< Impl > _impl
Definition transfersettings.h:228
zypp::media::TransferSettings::proxyUsername
const std::string & proxyUsername() const
proxy auth username
Definition transfersettings.cc:208
zypp::media::TransferSettings::setAuthType
void setAuthType(const std::string &val_r)
set the allowed authentication types
Definition transfersettings.cc:320
zypp::media::TransferSettings::setCertificateAuthoritiesPath
void setCertificateAuthoritiesPath(const Pathname &val_r)
Sets the SSL certificate authorities path.
Definition transfersettings.cc:310
zypp::media::TransferSettings::setProxyPassword
void setProxyPassword(const std::string &val_r)
sets the proxy password
Definition transfersettings.cc:211
zypp::media::TransferSettings::setMaxConcurrentConnections
void setMaxConcurrentConnections(long v)
Set maximum number of concurrent connections for a single transfer.
Definition transfersettings.cc:244
zypp::media::TransferSettings::certificateAuthoritiesPath
const Pathname & certificateAuthoritiesPath() const
SSL certificate authorities path ( default: /etc/ssl/certs ).
Definition transfersettings.cc:316
zypp::media::TransferSettings::setTimeout
void setTimeout(long t)
set the transfer timeout
Definition transfersettings.cc:230
zypp::media::TransferSettings::logCredentials
std::ostream & logCredentials(std::ostream &str) const
log credentials to stream hiding the password.
Definition transfersettings.h:67
zypp::media::TransferSettings::setMaxSilentTries
void setMaxSilentTries(long v)
Set maximum silent retries.
Definition transfersettings.cc:265
zypp::media::TransferSettings::verifyPeerEnabled
bool verifyPeerEnabled() const
Whether to verify peer for ssl.
Definition transfersettings.cc:282
str
String related utilities and Regular expression matching.
zypp::media
Definition MediaNetworkRequestExecutor.h:22
zypp::media::dumpOn
std::ostream & dumpOn(std::ostream &str, const TransferSettings &obj)
Definition transfersettings.cc:337
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition CodePitfalls.doc:2
zypp::RWCOW_pointer
RW_pointer supporting 'copy on write' functionality.
Definition PtrTypes.h:469