libzypp: zypp-curl/ng/network/networkrequestdispatcher.h Source File

libzypp 17.38.14

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/ng/base/zyppglobal.h>
5#include <zypp-core/ng/base/Base>
6#include <zypp-core/ng/base/signals.h>
7#include <zypp-core/ng/core/Url>
8#include <vector>
9#include <unordered_map>
10
11#include <zypp-curl/ng/network/networkrequesterror.h>
12#include <zypp-curl/ng/network/HttpHeader>
13
14namespace zyppng {
15
16 class NetworkRequestDispatcherPrivate;
17 class NetworkRequest;
18
78 class NetworkRequestDispatcher : public Base
79 {
80 ZYPP_DECLARE_PRIVATE(NetworkRequestDispatcher)
81 public:
82
83 using Ptr = std::shared_ptr<NetworkRequestDispatcher>;
84 using WeakPtr = std::weak_ptr<NetworkRequestDispatcher>;
85
86 NetworkRequestDispatcher ( );
87
92 static bool supportsProtocol ( const Url &url );
93
98 void setMaximumConcurrentConnections ( const int maxConn );
99
103 int maximumConcurrentConnections () const;
104
109 void enqueue ( const std::shared_ptr<NetworkRequest> &req );
110
114 void setAgentString ( const std::string &agent );
115
119 const std::string &agentString () const;
120
128 void setHostSpecificHeader ( const std::string &host, const std::string &headerName, const std::string &value );
129 void setHostSpecificHeader ( const std::string &host_r, const HttpHeader & header_r )
130 { setHostSpecificHeader( host_r, header_r.key(), header_r.value() ); }
131
133 void unsetHostSpecificHeader( const std::string &host, const std::string &headerName );
134
135 using SpecificHeaderMap = std::unordered_map< std::string, std::unordered_map<std::string, std::string >>;
136
140 const SpecificHeaderMap &hostSpecificHeaders() const;
141
142
146 void cancel ( NetworkRequest &req , std::string reason = std::string() );
147
151 void cancel ( NetworkRequest &req , const NetworkRequestError &err );
152
156 void cancelAll ( std::string reason = std::string() );
157
161 void cancelAll ( const NetworkRequestError &err );
162
163
167 void run ( );
168
172 void reschedule ();
173
177 size_t count ();
178
182 const NetworkRequestError &lastError() const;
183
187 SignalProxy<void ( NetworkRequestDispatcher &, NetworkRequest & )> sigDownloadStarted();
188
192 SignalProxy<void ( NetworkRequestDispatcher &, NetworkRequest & )> sigDownloadFinished();
193
197 SignalProxy<void ( NetworkRequestDispatcher & )> sigQueueFinished ();
198
203 SignalProxy<void ( NetworkRequestDispatcher & )> sigError ();
204 };
205}
206
207
208#endif
zyppng::Base
Definition base.h:61
zyppng::NetworkRequestDispatcherPrivate
Definition networkrequestdispatcher_p.h:30
zyppng::NetworkRequest
Definition request.h:43
zyppng
Definition MediaNetworkRequestExecutor.h:16
networkrequesterror.h
signals.h
zyppglobal.h
ZYPP_DECLARE_PRIVATE
#define ZYPP_DECLARE_PRIVATE(Class)
Definition zyppglobal.h:80