|
libzypp 17.37.6
|
#include <zypp-curl/ng/network/request.h>
Classes | |
| struct | Timings |
Public Types | |
| enum | State { Pending , Running , Finished , Error } |
| enum | Priority { Normal , High , Critical = 100 } |
| enum | FileMode { WriteExclusive , WriteShared } |
| enum | OptionBits { Default = 0x00 , HeadRequest = 0x01 , ConnectionTest = 0x02 } |
| using | Ptr = std::shared_ptr<NetworkRequest> |
| using | WeakPtr = std::weak_ptr<NetworkRequest> |
| using | DigestPtr = std::shared_ptr<zypp::Digest> |
| using | CheckSumBytes = UByteArray |
| using | Range = CurlMultiPartHandler::Range |
| Public Types inherited from zyppng::Base | |
| using | Ptr = std::shared_ptr<Base> |
| using | WeakPtr = std::weak_ptr<Base> |
Public Member Functions | |
| ZYPP_DECLARE_FLAGS (Options, OptionBits) | |
| NetworkRequest (Url url, zypp::Pathname targetFile, FileMode fMode=WriteExclusive) | |
| ~NetworkRequest () override | |
| void | setExpectedFileSize (zypp::ByteCount expectedFileSize) |
| zypp::ByteCount | expectedFileSize () const |
| void | setPriority (Priority prio, bool triggerReschedule=true) |
| Priority | priority () const |
| void | setOptions (Options opt) |
| Options | options () const |
| void | addRequestRange (size_t start, size_t len=0, std::optional< zypp::Digest > &&digest={}, CheckSumBytes expectedChkSum=CheckSumBytes(), std::any userData=std::any(), std::optional< size_t > digestCompareLen={}, std::optional< size_t > chksumpad={}) |
| void | addRequestRange (Range &&range) |
| bool | setExpectedFileChecksum (const zypp::CheckSum &expected) |
| void | resetRequestRanges () |
| std::vector< Range > | failedRanges () const |
| const std::vector< Range > & | requestedRanges () const |
| const std::string & | lastRedirectInfo () const |
| void * | nativeHandle () const |
| std::optional< Timings > | timings () const |
| After the request is finished query the timings that were collected during download. | |
| std::vector< char > | peekData (off_t offset, size_t count) const |
| Url | url () const |
| void | setUrl (const Url &url) |
| This will change the URL of the request. | |
| const zypp::Pathname & | targetFilePath () const |
| Returns the target filename path. | |
| void | setTargetFilePath (const zypp::Pathname &path) |
| Changes the target file path of the download. | |
| FileMode | fileOpenMode () const |
| Returns the currently configured file open mode. | |
| void | setFileOpenMode (FileMode mode) |
| Sets the file open mode to mode. | |
| std::string | contentType () const |
| Returns the content type as reported from the server. | |
| zypp::ByteCount | reportedByteCount () const |
| Returns the number of bytes that are reported from the backend as the full download size, those can be 0 even when the download is already running. | |
| zypp::ByteCount | downloadedByteCount () const |
| Returns the number of already downloaded bytes as reported by the backend. | |
| TransferSettings & | transferSettings () |
| State | state () const |
| Returns the current state the HttpDownloadRequest is in. | |
| NetworkRequestError | error () const |
| Returns the last set Error. | |
| std::string | extendedErrorString () const |
| In some cases, curl can provide extended error information collected at runtime. | |
| bool | hasError () const |
| Checks if there was a error with the request. | |
| bool | addRequestHeader (const std::string &header) |
| const zypp::Pathname & | cookieFile () const |
| void | setCookieFile (zypp::Pathname cookieFile) |
| SignalProxy< void(NetworkRequest &req)> | sigStarted () |
| Signals that the dispatcher dequeued the request and actually starts downloading data. | |
| SignalProxy< void(NetworkRequest &req, zypp::ByteCount count)> | sigBytesDownloaded () |
| Signals that new data has been downloaded, this is only the payload and does not include control data bytes. | |
| SignalProxy< void(NetworkRequest &req, off_t dltotal, off_t dlnow, off_t ultotal, off_t ulnow)> | sigProgress () |
| Signals if there was data read from the download. | |
| SignalProxy< void(NetworkRequest &req, const NetworkRequestError &err)> | sigFinished () |
| Signals that the download finished. | |
| Public Member Functions inherited from zyppng::Base | |
| Base () | |
| virtual | ~Base () |
| WeakPtr | parent () const |
| void | addChild (const Base::Ptr &child) |
| void | removeChild (const Ptr &child) |
| const std::unordered_set< Ptr > & | children () const |
| std::thread::id | threadId () const |
| template<typename T> | |
| std::vector< std::weak_ptr< T > > | findChildren () const |
| template<typename T> | |
| std::shared_ptr< T > | shared_this () const |
| template<typename T> | |
| std::shared_ptr< T > | shared_this () |
| template<typename T> | |
| std::weak_ptr< T > | weak_this () const |
| template<typename T> | |
| std::weak_ptr< T > | weak_this () |
| template<typename SenderFunc, typename ReceiverFunc> | |
| auto | connect (SenderFunc &&sFun, typename internal::MemberFunction< ReceiverFunc >::ClassType &recv, ReceiverFunc &&rFunc) |
| template<typename SenderFunc, typename ReceiverFunc, typename ... Tracker> | |
| std::enable_if_t< std::is_member_function_pointer_v< SenderFunc >, connection > | connectFunc (SenderFunc &&sFun, ReceiverFunc &&rFunc, const Tracker &...trackers) |
Friends | |
| class | NetworkRequestDispatcher |
| class | NetworkRequestDispatcherPrivate |
Additional Inherited Members | |
| Static Public Member Functions inherited from zyppng::Base | |
| template<typename Obj, typename Functor> | |
| static decltype(auto) | make_base_slot (Obj *o, Functor &&f) |
| template<typename SenderFunc, typename ReceiverFunc> | |
| static auto | connect (typename internal::MemberFunction< SenderFunc >::ClassType &s, SenderFunc &&sFun, typename internal::MemberFunction< ReceiverFunc >::ClassType &recv, ReceiverFunc &&rFunc) |
| template<typename SenderFunc, typename ReceiverFunc, typename ... Tracker> | |
| static auto | connectFunc (typename internal::MemberFunction< SenderFunc >::ClassType &s, SenderFunc &&sFun, ReceiverFunc &&rFunc, const Tracker &...trackers) |
| Protected Member Functions inherited from zyppng::Base | |
| Base (BasePrivate &dd) | |
| Protected Attributes inherited from zyppng::Base | |
| std::unique_ptr< BasePrivate > | d_ptr |
Represents a (http/https/ftp) request. This is the low level API for the
| using zyppng::NetworkRequest::Ptr = std::shared_ptr<NetworkRequest> |
| using zyppng::NetworkRequest::WeakPtr = std::weak_ptr<NetworkRequest> |
| using zyppng::NetworkRequest::DigestPtr = std::shared_ptr<zypp::Digest> |
| zyppng::NetworkRequest::NetworkRequest | ( | zyppng::Url | url, |
| zypp::Pathname | targetFile, | ||
| FileMode | fMode = WriteExclusive ) |
| url | The source URL of the download |
| targetFile | The path where the file should be stored |
| fMode | The mode in which the file is opened in. |
Definition at line 751 of file request.cc.
|
override |
Definition at line 756 of file request.cc.
| zyppng::NetworkRequest::ZYPP_DECLARE_FLAGS | ( | Options | , |
| OptionBits | ) |
| void zyppng::NetworkRequest::setExpectedFileSize | ( | zypp::ByteCount | expectedFileSize | ) |
Sets the expected file size for the download. In case of a Multi-Range-Download the NetworkRequest will check if the download would write behind the expectedFileSize and fail.
Definition at line 764 of file request.cc.
| zypp::ByteCount zyppng::NetworkRequest::expectedFileSize | ( | ) | const |
Definition at line 769 of file request.cc.
| void zyppng::NetworkRequest::setPriority | ( | NetworkRequest::Priority | prio, |
| bool | triggerReschedule = true ) |
Sets the priority of the NetworkRequest, this will affect where the
Definition at line 774 of file request.cc.
| NetworkRequest::Priority zyppng::NetworkRequest::priority | ( | ) | const |
Returns the requested priority of the NetworkRequest
Definition at line 782 of file request.cc.
| void zyppng::NetworkRequest::setOptions | ( | Options | opt | ) |
Change request options.
Definition at line 787 of file request.cc.
| NetworkRequest::Options zyppng::NetworkRequest::options | ( | ) | const |
Returns the currently set options
Definition at line 792 of file request.cc.
| void zyppng::NetworkRequest::addRequestRange | ( | size_t | start, |
| size_t | len = 0, | ||
| std::optional< zypp::Digest > && | digest = {}, | ||
| CheckSumBytes | expectedChkSum = CheckSumBytes(), | ||
| std::any | userData = std::any(), | ||
| std::optional< size_t > | digestCompareLen = {}, | ||
| std::optional< size_t > | chksumpad = {} ) |
Adds a new range to the requested range list, the ranges can not overlap
Definition at line 797 of file request.cc.
| void zyppng::NetworkRequest::addRequestRange | ( | Range && | range | ) |
Definition at line 806 of file request.cc.
| bool zyppng::NetworkRequest::setExpectedFileChecksum | ( | const zypp::CheckSum & | expected | ) |
Sets the expected checksum for the full file.
Definition at line 820 of file request.cc.
| void zyppng::NetworkRequest::resetRequestRanges | ( | ) |
Clears all requested ranges, the next download will get the complete file
Definition at line 837 of file request.cc.
| std::vector< NetworkRequest::Range > zyppng::NetworkRequest::failedRanges | ( | ) | const |
Definition at line 845 of file request.cc.
| const std::vector< NetworkRequest::Range > & zyppng::NetworkRequest::requestedRanges | ( | ) | const |
Definition at line 862 of file request.cc.
| const std::string & zyppng::NetworkRequest::lastRedirectInfo | ( | ) | const |
Returns the last redirect information from the headers.
Definition at line 867 of file request.cc.
| void * zyppng::NetworkRequest::nativeHandle | ( | ) | const |
Returns a pointer to the native CURL easy handle
Definition at line 872 of file request.cc.
| std::optional< zyppng::NetworkRequest::Timings > zyppng::NetworkRequest::timings | ( | ) | const |
After the request is finished query the timings that were collected during download.
Definition at line 877 of file request.cc.
| std::vector< char > zyppng::NetworkRequest::peekData | ( | off_t | offset, |
| size_t | count ) const |
Will return the data at offset with length count. If there is not yet enough data a empty vector will be returned
Definition at line 905 of file request.cc.
| Url zyppng::NetworkRequest::url | ( | ) | const |
Returns the request URL
Definition at line 916 of file request.cc.
| void zyppng::NetworkRequest::setUrl | ( | const Url & | url | ) |
This will change the URL of the request.
Definition at line 921 of file request.cc.
| const zypp::filesystem::Pathname & zyppng::NetworkRequest::targetFilePath | ( | ) | const |
Returns the target filename path.
Definition at line 930 of file request.cc.
| void zyppng::NetworkRequest::setTargetFilePath | ( | const zypp::Pathname & | path | ) |
Changes the target file path of the download.
Definition at line 935 of file request.cc.
| NetworkRequest::FileMode zyppng::NetworkRequest::fileOpenMode | ( | ) | const |
Returns the currently configured file open mode.
Definition at line 943 of file request.cc.
| void zyppng::NetworkRequest::setFileOpenMode | ( | FileMode | mode | ) |
Sets the file open mode to mode.
Definition at line 948 of file request.cc.
| std::string zyppng::NetworkRequest::contentType | ( | ) | const |
Returns the content type as reported from the server.
Definition at line 956 of file request.cc.
| zypp::ByteCount zyppng::NetworkRequest::reportedByteCount | ( | ) | const |
Returns the number of bytes that are reported from the backend as the full download size, those can be 0 even when the download is already running.
Definition at line 964 of file request.cc.
| zypp::ByteCount zyppng::NetworkRequest::downloadedByteCount | ( | ) | const |
Returns the number of already downloaded bytes as reported by the backend.
Definition at line 978 of file request.cc.
| TransferSettings & zyppng::NetworkRequest::transferSettings | ( | ) |
Returns a writeable reference to the internal
Definition at line 993 of file request.cc.
| NetworkRequest::State zyppng::NetworkRequest::state | ( | ) | const |
Returns the current state the HttpDownloadRequest is in.
Definition at line 998 of file request.cc.
| NetworkRequestError zyppng::NetworkRequest::error | ( | ) | const |
Returns the last set Error.
Definition at line 1017 of file request.cc.
| std::string zyppng::NetworkRequest::extendedErrorString | ( | ) | const |
In some cases, curl can provide extended error information collected at runtime.
In those cases, it is possible to query that information.
Definition at line 1025 of file request.cc.
| bool zyppng::NetworkRequest::hasError | ( | ) | const |
Checks if there was a error with the request.
Definition at line 1033 of file request.cc.
| bool zyppng::NetworkRequest::addRequestHeader | ( | const std::string & | header | ) |
Adds a raw header to the request data. Use this to send custom headers to the server.
Definition at line 1038 of file request.cc.
| const zypp::Pathname & zyppng::NetworkRequest::cookieFile | ( | ) | const |
Return the currently used path for the cookie file
Definition at line 1052 of file request.cc.
| void zyppng::NetworkRequest::setCookieFile | ( | zypp::Pathname | cookieFile | ) |
Set path to use for the cookie file if enabled via TransferSettings.
Definition at line 1057 of file request.cc.
| SignalProxy< void(NetworkRequest &req)> zyppng::NetworkRequest::sigStarted | ( | ) |
Signals that the dispatcher dequeued the request and actually starts downloading data.
Definition at line 1062 of file request.cc.
| SignalProxy< void(NetworkRequest &req, zypp::ByteCount count)> zyppng::NetworkRequest::sigBytesDownloaded | ( | ) |
Signals that new data has been downloaded, this is only the payload and does not include control data bytes.
Definition at line 1067 of file request.cc.
| SignalProxy< void(NetworkRequest &req, off_t dltotal, off_t dlnow, off_t ultotal, off_t ulnow)> zyppng::NetworkRequest::sigProgress | ( | ) |
Signals if there was data read from the download.
Definition at line 1072 of file request.cc.
| SignalProxy< void(zyppng::NetworkRequest &req, const zyppng::NetworkRequestError &err)> zyppng::NetworkRequest::sigFinished | ( | ) |
Signals that the download finished.
Definition at line 1077 of file request.cc.
|
friend |