libzypp  17.38.17
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>
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.
34  {
35  public:
37  static std::ostream & logUserPass( std::ostream & str, const std::string & user_r, const std::string & pass_r );
38 
39  public:
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 
156  void setMinDownloadSpeedTime(long v);
157 
159  long minDownloadSpeedTime() const;
160 
161 
163  void setMaxDownloadSpeed(long v);
164 
166  long maxDownloadSpeed() const;
167 
168 
170  void setMaxSilentTries(long v);
171 
173  long maxSilentTries() const;
174 
175 
177  void setVerifyHostEnabled( bool enabled );
178 
180  bool verifyHostEnabled() const;
181 
182 
184  void setVerifyPeerEnabled( bool enabled );
185 
187  bool verifyPeerEnabled() const;
188 
189 
191  void setCertificateAuthoritiesPath( const Pathname &val_r );
192  void setCertificateAuthoritiesPath( Pathname && val_r );
193 
195  const Pathname &certificateAuthoritiesPath() const;
196 
197 
199  void setAuthType( const std::string &val_r );
200  void setAuthType( std::string && val_r );
201 
203  const std::string &authType() const;
204 
205 
207  void setHeadRequestsAllowed(bool allowed);
208 
210  bool headRequestsAllowed() const;
211 
212 
214  void setClientCertificatePath( const Pathname &val_r );
215  void setClientCertificatePath( Pathname && val_r );
216 
218  const Pathname &clientCertificatePath() const;
219 
220 
222  void setClientKeyPath( const Pathname &val_r );
223  void setClientKeyPath( Pathname && val_r );
224 
226  const Pathname &clientKeyPath() const;
227 
229  void setEnableCookieFile( bool enable = true );
230  bool cookieFileEnabled() const;
231 
232  protected:
233  class Impl;
235  };
236 
238  std::ostream & dumpOn( std::ostream & str, const TransferSettings & obj );
239 
240  } // namespace media
241 } // namespece zypp
242 
243 #endif // ZYPP_CURL_TRANSFER_SETTINGS_H_INCLUDED
long timeout() const
transfer timeout
const Pathname & certificateAuthoritiesPath() const
SSL certificate authorities path ( default: /etc/ssl/certs )
const Pathname & clientCertificatePath() const
SSL client certificate file.
void addHeader(std::string &&val_r)
add a header, on the form "Foo: Bar" (trims)
std::string proxyUserPassword() const
returns the proxy user and password as a user:pass string
const std::string & proxyPassword() const
proxy auth password
void setPassword(const std::string &val_r)
sets the auth password
long maxDownloadSpeed() const
Maximum download speed (bytes per second)
Holds transfer setting.
const std::string & authType() const
get the allowed authentication types
bool verifyHostEnabled() const
Whether to verify host for ssl.
const std::string & proxyUsername() const
proxy auth username
String related utilities and Regular expression matching.
void setUsername(const std::string &val_r)
sets the auth username
void setHeadRequestsAllowed(bool allowed)
set whether HEAD requests are allowed
void setConnectTimeout(long t)
set the connect timeout
std::ostream & dumpOn(std::ostream &str, const TransferSettings &obj)
relates: TransferSettings
const std::string & password() const
auth password
const std::string & username() const
auth username
const Headers & headers() const
returns a list of all added headers (trimmed)
void setAnonymousAuth()
sets anonymous authentication (ie: for ftp)
std::ostream & logProxyCredentials(std::ostream &str) const
log credentials to stream hiding the password.
bool verifyPeerEnabled() const
Whether to verify peer for ssl.
long maxSilentTries() const
Maximum silent retries.
long minDownloadSpeedTime() const
The time in seconds that the transfer speed must remain below minDownloadSpeed before the transfer is...
bool hasCredentials() const
has a non-empty username and a non-empty password
void setAuthType(const std::string &val_r)
set the allowed authentication types
void setProxy(const std::string &val_r)
proxy to use if it is enabled
long connectTimeout() const
connection timeout
TransferSettings()
Constructs a transfer program cmd line access.
void setMaxSilentTries(long v)
Set maximum silent retries.
void setTimeout(long t)
set the transfer timeout
const Pathname & clientKeyPath() const
SSL client key file.
RWCOW_pointer< Impl > _impl
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:########]").
void setMaxDownloadSpeed(long v)
Set max download speed (bytes per second)
long minDownloadSpeed() const
Minimum download speed (bytes per second) until the connection is dropped.
bool proxyEnabled() const
proxy is enabled
void setProxyPassword(const std::string &val_r)
sets the proxy password
void reset()
reset the settings to the defaults
void setMaxConcurrentConnections(long v)
Set maximum number of concurrent connections for a single transfer.
long maxConcurrentConnections() const
Maximum number of concurrent connections for a single transfer.
void setMinDownloadSpeedTime(long v)
Set the time in seconds that the transfer speed must remain below minDownloadSpeed before the transfe...
std::ostream & logCredentials(std::ostream &str) const
log credentials to stream hiding the password.
void setUserAgentString(std::string &&val_r)
sets the user agent ie: "Mozilla v3" (trims)
bool hasProxyCredentials() const
has a proxy username, maybe even the password
void setClientCertificatePath(const Pathname &val_r)
Sets the SSL client certificate file.
void setProxyUsername(const std::string &val_r)
sets the proxy user
void setEnableCookieFile(bool enable=true)
Enable or disable the use of the cookie file.
std::vector< std::string > Headers
void setCertificateAuthoritiesPath(const Pathname &val_r)
Sets the SSL certificate authorities path.
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:1
void setMinDownloadSpeed(long v)
Set minimum download speed (bytes per second) until the connection is dropped.
const std::string & proxy() const
proxy host
void setVerifyPeerEnabled(bool enabled)
Sets whether to verify host for ssl.
void setClientKeyPath(const Pathname &val_r)
Sets the SSL client key file.
void setVerifyHostEnabled(bool enabled)
Sets whether to verify host for ssl.
const std::string & userAgentString() const
user agent string (trimmed)
bool headRequestsAllowed() const
whether HEAD requests are allowed
void setProxyEnabled(bool enabled)
whether the proxy is used or not