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

libzypp 17.36.6

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
11#include <zypp-curl/ng/network/networkrequesterror.h>
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 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
zyppng::Base
Definition base.h:60
zyppng::NetworkRequestDispatcherPrivate
Definition networkrequestdispatcher_p.h:30
zyppng::NetworkRequest
Definition request.h:43
zyppng
Definition MediaCurl2.h:22
networkrequesterror.h
signals.h
zyppglobal.h
ZYPP_DECLARE_PRIVATE
#define ZYPP_DECLARE_PRIVATE(Class)
Definition zyppglobal.h:87
LIBZYPP_NG_EXPORT
#define LIBZYPP_NG_EXPORT
Definition zyppglobal.h:8