libzypp 17.31.23
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
4#include <zypp-core/zyppng/base/zyppglobal.h>
5#include <zypp-core/zyppng/base/Base>
6#include <zypp-core/zyppng/base/signals.h>
7#include <zypp-core/zyppng/core/Url>
8#include <vector>
9#include <unordered_map>
10
12
13namespace zyppng {
14
15 class NetworkRequestDispatcherPrivate;
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 run ( );
153
157 void reschedule ();
158
162 size_t count ();
163
167 const NetworkRequestError &lastError() const;
168
172 SignalProxy<void ( NetworkRequestDispatcher &, NetworkRequest & )> sigDownloadStarted();
173
177 SignalProxy<void ( NetworkRequestDispatcher &, NetworkRequest & )> sigDownloadFinished();
178
182 SignalProxy<void ( NetworkRequestDispatcher & )> sigQueueFinished ();
183
188 SignalProxy<void ( NetworkRequestDispatcher & )> sigError ();
189 };
190}
191
192
193#endif
const char * agentString()
Definition: MediaCurl.cc:279