libzypp 17.37.17
networkrequestdispatcher.h
Go to the documentation of this file.
1#ifndef ZYPP_NG_MEDIA_CURL_CURL_H_INCLUDED
2#define ZYPP_NG_MEDIA_CURL_CURL_H_INCLUDED
3
5#include <zypp-core/zyppng/base/Base>
7#include <zypp-core/zyppng/core/Url>
8#include <vector>
9#include <unordered_map>
10
12
13namespace zyppng {
14
16 class NetworkRequest;
17
77 class LIBZYPP_NG_EXPORT NetworkRequestDispatcher : public Base
78 {
79 ZYPP_DECLARE_PRIVATE(NetworkRequestDispatcher)
80 public:
81
82 using Ptr = std::shared_ptr<NetworkRequestDispatcher>;
83 using WeakPtr = std::weak_ptr<NetworkRequestDispatcher>;
84
85 NetworkRequestDispatcher ( );
86
91 static bool supportsProtocol ( const Url &url );
92
97 void setMaximumConcurrentConnections ( const int maxConn );
98
102 int maximumConcurrentConnections () const;
103
108 void enqueue ( const std::shared_ptr<NetworkRequest> &req );
109
113 void setAgentString ( const std::string &agent );
114
118 const std::string &agentString () const;
119
128 void setHostSpecificHeader ( const std::string &host, const std::string &headerName, const std::string &value );
129
130
131 using SpecificHeaderMap = std::unordered_map< std::string, std::unordered_map<std::string, std::string >>;
132
136 const SpecificHeaderMap &hostSpecificHeaders() const;
137
138
142 void cancel ( NetworkRequest &req , std::string reason = std::string() );
143
147 void cancel ( NetworkRequest &req , const NetworkRequestError &err );
148
152 void cancelAll ( std::string reason = std::string() );
153
157 void cancelAll ( const NetworkRequestError &err );
158
159
163 void run ( );
164
168 void reschedule ();
169
173 size_t count ();
174
178 const NetworkRequestError &lastError() const;
179
183 SignalProxy<void ( NetworkRequestDispatcher &, NetworkRequest & )> sigDownloadStarted();
184
188 SignalProxy<void ( NetworkRequestDispatcher &, NetworkRequest & )> sigDownloadFinished();
189
193 SignalProxy<void ( NetworkRequestDispatcher & )> sigQueueFinished ();
194
199 SignalProxy<void ( NetworkRequestDispatcher & )> sigError ();
200 };
201}
202
203
204#endif
#define ZYPP_DECLARE_PRIVATE(Class)
Definition zyppglobal.h:87
#define LIBZYPP_NG_EXPORT
Definition zyppglobal.h:8