1#ifndef ZYPP_NG_MEDIA_CURL_REQUEST_H_INCLUDED
2#define ZYPP_NG_MEDIA_CURL_REQUEST_H_INCLUDED
5#include <zypp-curl/ng/network/TransferSettings>
6#include <zypp-core/zyppng/base/Base>
7#include <zypp-core/zyppng/core/Url>
8#include <zypp-core/zyppng/core/ByteArray>
9#include <zypp-core/zyppng/base/zyppglobal.h>
10#include <zypp-core/zyppng/base/signals.h>
11#include <zypp-core/base/Flags.h>
12#include <zypp-core/ByteCount.h>
30 class NetworkRequestDispatcher;
31 class NetworkRequestPrivate;
44 using Ptr = std::shared_ptr<NetworkRequest>;
45 using WeakPtr = std::weak_ptr<NetworkRequest>;
77 size_t bytesWritten = 0;
91 State _rangeState = State::Pending;
93 static Range make (
size_t start,
size_t len = 0,
DigestPtr &&digest =
nullptr,
CheckSumBytes &&expectedChkSum =
CheckSumBytes(), std::any &&userData = std::any(), std::optional<size_t> digestCompareLen = {}, std::optional<size_t> _dataBlockPadding = {} );
125 void setPriority (
Priority prio,
bool triggerReschedule =
true );
137 void setOptions ( Options opt );
142 Options options ()
const;
148 void addRequestRange (
size_t start,
size_t len = 0,
DigestPtr digest =
nullptr,
CheckSumBytes expectedChkSum =
CheckSumBytes(), std::any userData = std::any(), std::optional<size_t> digestCompareLen = {}, std::optional<size_t> chksumpad = {} );
150 void addRequestRange (
const Range &range );
156 void resetRequestRanges ( );
158 std::vector<Range> failedRanges ()
const;
159 const std::vector<Range> &requestedRanges ()
const;
164 const std::string &lastRedirectInfo()
const;
172 void *nativeHandle ()
const;
178 std::optional<Timings> timings ()
const;
184 std::vector<char> peekData ( off_t offset,
size_t count )
const;
195 void setUrl (
const Url & url );
211 FileMode fileOpenMode ()
const;
217 void setFileOpenMode ( FileMode mode );
223 std::string contentType ()
const;
242 TransferSettings &transferSettings ();
247 State state ()
const;
252 NetworkRequestError error ()
const;
258 std::string extendedErrorString()
const;
263 bool hasError ()
const;
269 bool addRequestHeader(
const std::string &header );
274 SignalProxy<void ( NetworkRequest &req )> sigStarted ();
279 SignalProxy<void ( NetworkRequest &req,
zypp::ByteCount count )> sigBytesDownloaded ();
286 SignalProxy<void ( NetworkRequest &req, off_t dltotal, off_t dlnow, off_t ultotal, off_t ulnow )> sigProgress ();
294 SignalProxy<void ( NetworkRequest &req,
const NetworkRequestError &err)> sigFinished ( );
297 friend class NetworkRequestDispatcher;
Store and operate with byte count.
std::shared_ptr< zypp::Digest > DigestPtr
std::shared_ptr< NetworkRequest > Ptr
ZYPP_DECLARE_FLAGS(Options, OptionBits)
std::weak_ptr< NetworkRequest > WeakPtr
Easy-to use interface to the ZYPP dependency resolver.
zypp::media::AuthData AuthData
CheckSumBytes _checksum
Enables automated checking of downloaded contents against a checksum.
std::optional< size_t > _relevantDigestLen
std::optional< size_t > _chksumPad
std::chrono::microseconds appconnect
std::chrono::microseconds redirect
std::chrono::microseconds pretransfer
std::chrono::microseconds total
std::chrono::microseconds namelookup
std::chrono::microseconds connect
#define ZYPP_DECLARE_OPERATORS_FOR_FLAGS(Name)