File: transfersettings.h

package info (click to toggle)
libzypp 17.36.7-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 26,380 kB
  • sloc: cpp: 132,576; xml: 2,587; sh: 486; makefile: 26; python: 23
file content (219 lines) | stat: -rw-r--r-- 6,668 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
/*---------------------------------------------------------------------\
|                          ____ _   __ __ ___                          |
|                         |__  / \ / / . \ . \                         |
|                           / / \ V /|  _/  _/                         |
|                          / /__ | | | | | |                           |
|                         /_____||_| |_| |_|                           |
|                                                                      |
\---------------------------------------------------------------------*/
/** \file zypp-curl/TransferSettings
 *
 */
#ifndef ZYPP_CURL_TRANSFER_SETTINGS_H_INCLUDED
#define ZYPP_CURL_TRANSFER_SETTINGS_H_INCLUDED

#include <string>
#include <vector>
#include <zypp-core/base/Flags.h>
#include <zypp-core/base/PtrTypes.h>
#include <zypp-core/Pathname.h>
#include <zypp-core/Url.h>
namespace zypp
{
  namespace media
  {

    ///////////////////////////////////////////////////////////////////
    /// \brief Holds transfer setting
    ///
    /// \note bsc#1212187: HTTP/2 RFC 9113 forbids fields ending with a
    /// space. The class asserts \ref headers and \ref userAgentString
    /// return trimmed strings. Strings are trimmed when set. Empty
    //  strings are discarded.
    class TransferSettings
    {
    public:
      /** Constructs a transfer program cmd line access. */
      TransferSettings();

      using Headers = std::vector<std::string>;

      /** reset the settings to the defaults */
      void reset();

      /** add a header, on the form "Foo: Bar" (trims)*/
      void addHeader( std::string && val_r );
      void addHeader( const std::string & val_r );

      /** returns a list of all added headers (trimmed) */
      const Headers &headers() const;

      /** sets the user agent ie: "Mozilla v3" (trims) */
      void setUserAgentString( std::string && val_r );
      void setUserAgentString( const std::string &val_r );

      /** user agent string (trimmed)*/
      const std::string &userAgentString() const;


      /** sets the auth username */
      void setUsername( const std::string &val_r );
      void setUsername( std::string && val_r );

      /** auth username */
      const std::string &username() const;

      /** sets the auth password */
      void setPassword( const std::string & val_r );
      void setPassword( std::string && val_r );

      /** auth password */
      const std::string &password() const;

      /** returns the user and password as a user:pass string */
      std::string userPassword() const;

      /** sets anonymous authentication (ie: for ftp) */
      void setAnonymousAuth();


      /** whether the proxy is used or not */
      void setProxyEnabled( bool enabled );

      /** proxy is enabled */
      bool proxyEnabled() const;


      /** proxy to use if it is enabled */
      void setProxy( const std::string &val_r );
      void setProxy( std::string && val_r );

      /** proxy host */
      const std::string &proxy() const;


      /** sets the proxy user */
      void setProxyUsername( const std::string &val_r );
      void setProxyUsername( std::string && val_r );

      /** proxy auth username */
      const std::string &proxyUsername() const;

      /** sets the proxy password */
      void setProxyPassword( const std::string &val_r );
      void setProxyPassword( std::string && val_r );

      /** proxy auth password */
      const std::string &proxyPassword() const;

      /** returns the proxy user and password as a user:pass string */
      std::string proxyUserPassword() const;


      /** set the connect timeout */
      void setConnectTimeout( long t );

      /** connection timeout */
      long connectTimeout() const;


      /** set the transfer timeout */
      void setTimeout( long t );

      /** transfer timeout */
      long timeout() const;


      /** Set maximum number of concurrent connections for a single transfer */
      void setMaxConcurrentConnections(long v);

      /** Maximum number of concurrent connections for a single transfer */
      long maxConcurrentConnections() const;


      /** Set minimum download speed (bytes per second) until the connection is dropped */
      void setMinDownloadSpeed(long v);

      /** Minimum download speed (bytes per second) until the connection is dropped */
      long minDownloadSpeed() const;


      /** Set max download speed (bytes per second) */
      void setMaxDownloadSpeed(long v);

      /** Maximum download speed (bytes per second) */
      long maxDownloadSpeed() const;


      /** Set maximum silent retries */
      void setMaxSilentTries(long v);

      /** Maximum silent retries */
      long maxSilentTries() const;


      /** Sets whether to verify host for ssl */
      void setVerifyHostEnabled( bool enabled );

      /** Whether to verify host for ssl */
      bool verifyHostEnabled() const;


      /** Sets whether to verify host for ssl */
      void setVerifyPeerEnabled( bool enabled );

      /** Whether to verify peer for ssl */
      bool verifyPeerEnabled() const;


      /** Sets the SSL certificate authorities path */
      void setCertificateAuthoritiesPath( const Pathname &val_r );
      void setCertificateAuthoritiesPath( Pathname && val_r );

      /** SSL certificate authorities path ( default: /etc/ssl/certs ) */
      const Pathname &certificateAuthoritiesPath() const;


      /** set the allowed authentication types */
      void setAuthType( const std::string &val_r );
      void setAuthType( std::string && val_r );

      /** get the allowed authentication types */
      const std::string &authType() const;


      /** set whether HEAD requests are allowed */
      void setHeadRequestsAllowed(bool allowed);

      /** whether HEAD requests are allowed */
      bool headRequestsAllowed() const;


      /** Sets the SSL client certificate file */
      void setClientCertificatePath( const Pathname &val_r );
      void setClientCertificatePath( Pathname && val_r );

      /** SSL client certificate file */
      const Pathname &clientCertificatePath() const;


      /** Sets the SSL client key file */
      void setClientKeyPath( const Pathname &val_r );
      void setClientKeyPath( Pathname && val_r );

      /** SSL client key file */
      const Pathname &clientKeyPath() const;

      /** Enable or disable the use of the cookie file */
      void setEnableCookieFile( bool enable = true );
      bool cookieFileEnabled() const;

    protected:
      class Impl;
      RWCOW_pointer<Impl> _impl;
    };

  } // namespace media
} // namespece zypp

#endif // ZYPP_CURL_TRANSFER_SETTINGS_H_INCLUDED