make TransferProgram actually a data transfer class to keep transfer
[platform/upstream/libzypp.git] / zypp / media / TransferSettings.h
1
2 #ifndef TRANSFER_PROGRAM_H_
3 #define TRANSFER_PROGRAM_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  * Easy access to the transfer command line program no matter
19  * which one it is
20  *
21  */
22 class TransferSettings
23 {
24 public:
25   /**
26    * Constructs a transfer program cmd line access.
27    */
28   TransferSettings();
29
30   /**
31    * Constructs the settings from a url object where.
32    * authentication/proxy  information can be extracted
33    * from the url
34    */
35   TransferSettings( const zypp::Url &url );
36
37   typedef std::vector<std::string> Headers;
38   /**
39    * add a header, on the form "Foo: Bar"
40    */
41   void addHeader( const std::string &header );
42
43   /**
44    * begin iterators to additional headers 
45    */
46   Headers::const_iterator headersBegin() const;
47
48   /**
49    * end iterators to additional headers 
50    */
51   Headers::const_iterator headersEnd() const;
52
53   /**
54    * sets the user agent ie: "Mozilla v3"
55    */
56   void setUserAgentString( const std::string &agent );
57
58   /**
59    * user agent string
60    */
61   std::string userAgentString() const;
62
63   /**
64    * sets the auth username
65    */
66   void setUsername( const std::string &username );
67
68   /**
69    * auth username
70    */
71   std::string username() const;
72
73   /**
74    * sets the auth password
75    */
76   void setPassword( const std::string &password );
77
78   /**
79    * auth password
80    */
81   std::string password() const;
82
83   /**
84    * whether the proxy is used or not
85    */
86   void setProxyEnabled( bool enabled );
87
88   /**
89    * proxy is enabled
90    */
91   bool proxyEnabled() const;
92
93   /**
94    * proxy to use if it is enabled
95    */
96   void setProxy( const std::string &proxyhost );
97
98   /**
99    * proxy host
100    */
101   std::string proxy() const;
102
103   /**
104    * sets the proxy user
105    */
106   void setProxyUsername( const std::string &proxyuser );
107
108   /**
109    * proxy auth username
110    */
111   std::string proxyUsername() const;
112
113   /**
114    * sets the proxy password
115    */
116   void setProxyPassword( const std::string &proxypass );
117
118   /**
119    * proxy auth password
120    */
121   std::string proxyPassword() const;
122
123   /**
124    * set the connect timeout
125    */
126   void setConnectTimeout( long t );
127
128   /**
129    * connection timeout
130    */
131   long connectTimeout() const;
132
133   /**
134    * set the transfer timeout
135    */
136   void setTimeout( long t );
137
138   /**
139    * transfer timeout
140    */
141   long timeout() const;
142
143 protected:
144   class Impl;
145   RWCOW_pointer<Impl> _impl;
146 };
147
148 } // ns media
149 } // ns zypp
150
151 #endif