Imported Upstream version 17.23.5
[platform/upstream/libzypp.git] / zypp / media / TransferSettings.h
1
2 #ifndef TRANSFER_SETTINGS_H_
3 #define TRANSFER_SETTINGS_H_
4
5 #include <string>
6 #include <vector>
7 #include <zypp/base/Flags.h>
8 #include <zypp/base/PtrTypes.h>
9 #include <zypp/Pathname.h>
10 #include <zypp/Url.h>
11
12 namespace zypp
13 {
14   namespace media
15   {
16
17     /**
18      * Holds transfer setting
19      */
20     class TransferSettings
21     {
22     public:
23       /** Constructs a transfer program cmd line access. */
24       TransferSettings();
25
26       typedef std::vector<std::string> Headers;
27
28       /** reset the settings to the defaults */
29       void reset();
30
31
32       /** add a header, on the form "Foo: Bar" */
33       void addHeader( std::string && val_r );
34
35       /** begin iterators to additional headers */
36       Headers::const_iterator headersBegin() const;
37
38       /** end iterators to additional headers */
39       Headers::const_iterator headersEnd() const;
40
41
42       /** sets the user agent ie: "Mozilla v3" */
43       void setUserAgentString( std::string && val_r );
44
45       /** user agent string */
46       std::string userAgentString() const;
47
48
49       /** sets the auth username */
50       void setUsername( std::string && val_r );
51
52       /** auth username */
53       std::string username() const;
54
55       /** sets the auth password */
56       void setPassword( std::string && val_r );
57
58       /** auth password */
59       std::string password() const;
60
61       /** returns the user and password as a user:pass string */
62       std::string userPassword() const;
63
64       /** sets anonymous authentication (ie: for ftp) */
65       void setAnonymousAuth();
66
67
68       /** whether the proxy is used or not */
69       void setProxyEnabled( bool enabled );
70
71       /** proxy is enabled */
72       bool proxyEnabled() const;
73
74
75       /** proxy to use if it is enabled */
76       void setProxy( std::string && val_r );
77
78       /** proxy host */
79       std::string proxy() const;
80
81
82       /** sets the proxy user */
83       void setProxyUsername( std::string && val_r );
84
85       /** proxy auth username */
86       std::string proxyUsername() const;
87
88       /** sets the proxy password */
89       void setProxyPassword( std::string && val_r );
90
91       /** proxy auth password */
92       std::string proxyPassword() const;
93
94       /** returns the proxy user and password as a user:pass string */
95       std::string proxyUserPassword() const;
96
97
98       /** set the connect timeout */
99       void setConnectTimeout( long t );
100
101       /** connection timeout */
102       long connectTimeout() const;
103
104
105       /** set the transfer timeout */
106       void setTimeout( long t );
107
108       /** transfer timeout */
109       long timeout() const;
110
111
112       /** Set maximum number of concurrent connections for a single transfer */
113       void setMaxConcurrentConnections(long v);
114
115       /** Maximum number of concurrent connections for a single transfer */
116       long maxConcurrentConnections() const;
117
118
119       /** Set minimum download speed (bytes per second) until the connection is dropped */
120       void setMinDownloadSpeed(long v);
121
122       /** Minimum download speed (bytes per second) until the connection is dropped */
123       long minDownloadSpeed() const;
124
125
126       /** Set max download speed (bytes per second) */
127       void setMaxDownloadSpeed(long v);
128
129       /** Maximum download speed (bytes per second) */
130       long maxDownloadSpeed() const;
131
132
133       /** Set maximum silent retries */
134       void setMaxSilentTries(long v);
135
136       /** Maximum silent retries */
137       long maxSilentTries() const;
138
139
140       /** Sets whether to verify host for ssl */
141       void setVerifyHostEnabled( bool enabled );
142
143       /** Whether to verify host for ssl */
144       bool verifyHostEnabled() const;
145
146
147       /** Sets whether to verify host for ssl */
148       void setVerifyPeerEnabled( bool enabled );
149
150       /** Whether to verify peer for ssl */
151       bool verifyPeerEnabled() const;
152
153
154       /** Sets the SSL certificate authorities path */
155       void setCertificateAuthoritiesPath( Pathname && val_r );
156
157       /** SSL certificate authorities path ( default: /etc/ssl/certs ) */
158       Pathname certificateAuthoritiesPath() const;
159
160
161       /** set the allowed authentication types */
162       void setAuthType( std::string && val_r );
163
164       /** get the allowed authentication types */
165       std::string authType() const;
166
167
168       /** set whether HEAD requests are allowed */
169       void setHeadRequestsAllowed(bool allowed);
170
171       /** whether HEAD requests are allowed */
172       bool headRequestsAllowed() const;
173
174
175       /** Sets the SSL client certificate file */
176       void setClientCertificatePath( Pathname && val_r );
177
178       /** SSL client certificate file */
179       Pathname clientCertificatePath() const;
180
181
182       /** Sets the SSL client key file */
183       void setClientKeyPath( Pathname && val_r );
184
185       /** SSL client key file */
186       Pathname clientKeyPath() const;
187
188     protected:
189       class Impl;
190       RWCOW_pointer<Impl> _impl;
191     };
192
193   } // namespace media
194 } // namespece zypp
195
196 #endif