libzypp: zyppng::NetworkRequestPrivate Class Reference

libzypp 17.38.8

zyppng::NetworkRequestPrivate Class Reference

`#include <zypp-curl/ng/network/private/request_p.h>`

Inheritance diagram for zyppng::NetworkRequestPrivate:

## Classes
struct | FileVerifyInfo
struct | pending_t
struct | prepareNextRangeBatch_t
struct | running_t
struct | finished_t

## Public Types
enum class | ProtocolMode { Default , HTTP }

## Public Member Functions
| NetworkRequestPrivate (Url &&url, zypp::Pathname &&targetFile, NetworkRequest::FileMode fMode, NetworkRequest &p)
| ~NetworkRequestPrivate () override
bool | initialize (std::string &errBuf)
bool | setupHandle (std::string &errBuf)
bool | assertOutputFile ()
bool | canRecover () const
bool | prepareToContinue (std::string &errBuf)
bool | hasMoreWork () const
void | aboutToStart ()
void | dequeueNotify ()
void | setResult (NetworkRequestError &&err)
void | reset ()
void | resetActivityTimer ()
void | onActivityTimeout (Timer &)
std::string | errorMessage () const
template<typename T>
void | setCurlOption (CURLoption opt, T data)
size_t | headerfunction (char *ptr, size_t bytes) override
size_t | writefunction (char *ptr, std::optional< off_t > offset, size_t bytes) override
void | notifyErrorCodeChanged () override
Public Member Functions inherited from zyppng::BasePrivate
| BasePrivate (Base &b)
virtual | ~BasePrivate ()
virtual void | init ()
Public Member Functions inherited from zyppng::CurlMultiPartDataReceiver
virtual | ~CurlMultiPartDataReceiver ()=default
virtual bool | beginRange (off_t range, std::string &cancelReason)
virtual bool | finishedRange (off_t range, bool validated, std::string &cancelReason)

## Static Public Member Functions
static int | curlProgressCallback (void *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow)

## Public Attributes
enum zyppng::NetworkRequestPrivate::ProtocolMode | _protocolMode = ProtocolMode::Default
std::array< char, CURL_ERROR_SIZE+1 > | _errorBuf
Url | _url
zypp::Pathname | _targetFile
TransferSettings | _settings
NetworkRequest::Options | _options
zypp::ByteCount | _expectedFileSize
std::vector< NetworkRequest::Range > | _requestedRanges
| the requested ranges that need to be downloaded
std::optional< FileVerifyInfo > | _fileVerification
| The digest for the full file.
NetworkRequest::FileMode | _fMode = NetworkRequest::WriteExclusive
NetworkRequest::Priority | _priority = NetworkRequest::Normal
std::string | _lastRedirect
| to log/report redirections
zypp::Pathname | _currentCookieFile = "/var/lib/YaST2/cookies"
void * | _easyHandle = nullptr
NetworkRequestDispatcher * | _dispatcher = nullptr
Signal< void(NetworkRequest &req)> | _sigStarted
Signal< void(NetworkRequest &req, zypp::ByteCount count)> | _sigBytesDownloaded
Signal< void(NetworkRequest &req, off_t dltotal, off_t dlnow, off_t ultotal, off_t ulnow)> | _sigProgress
Signal< void(NetworkRequest &req, const NetworkRequestError &err)> | _sigFinished
std::unique_ptr< curl_slist, decltype(&curl_slist_free_all) > | _headers
std::variant< pending_t, running_t, prepareNextRangeBatch_t, finished_t > | _runningMode = pending_t()
Public Attributes inherited from zyppng::BasePrivate
Base::WeakPtr | parent
std::unordered_set< Base::Ptr > | children
std::unordered_map< uint32_t, zypp::AutoDispose< void * > > | _data
Base * | z_ptr = nullptr
std::thread::id | threadId = std::this_thread::get_id()

## Detailed Description

Definition at line 34 of file request_p.h.

## Member Enumeration Documentation

## ◆ ProtocolMode

enum class zyppng::NetworkRequestPrivate::ProtocolMode
| strong

Enumerator
Default |
HTTP |

Definition at line 38 of file request_p.h.

## Constructor & Destructor Documentation

## ◆ NetworkRequestPrivate()

zyppng::NetworkRequestPrivate::NetworkRequestPrivate | ( | Url && | url,
|  | zypp::Pathname && | targetFile,
|  | NetworkRequest::FileMode | fMode,
|  | NetworkRequest & | p )

Definition at line 73 of file request.cc.

## ◆ ~NetworkRequestPrivate()

zyppng::NetworkRequestPrivate::~NetworkRequestPrivate | ( |  | ) |
| override

Definition at line 81 of file request.cc.

## Member Function Documentation

## ◆ initialize()

bool zyppng::NetworkRequestPrivate::initialize | ( | std::string & | errBuf | ) |

Definition at line 92 of file request.cc.

## ◆ setupHandle()

bool zyppng::NetworkRequestPrivate::setupHandle | ( | std::string & | errBuf | ) |

Force IPv4/v6

Connect timeout

Speed limits

Definition at line 105 of file request.cc.

## ◆ assertOutputFile()

bool zyppng::NetworkRequestPrivate::assertOutputFile | ( |  | ) |

Definition at line 378 of file request.cc.

## ◆ canRecover()

bool zyppng::NetworkRequestPrivate::canRecover | ( |  | ) | const

Definition at line 408 of file request.cc.

## ◆ prepareToContinue()

bool zyppng::NetworkRequestPrivate::prepareToContinue | ( | std::string & | errBuf | ) |

Prepares the request before it is queued again currently this is used only for range batching but could be used to recover from other types of errors too

Definition at line 416 of file request.cc.

## ◆ hasMoreWork()

bool zyppng::NetworkRequestPrivate::hasMoreWork | ( |  | ) | const

Definition at line 456 of file request.cc.

## ◆ aboutToStart()

void zyppng::NetworkRequestPrivate::aboutToStart | ( |  | ) |

Definition at line 462 of file request.cc.

## ◆ dequeueNotify()

void zyppng::NetworkRequestPrivate::dequeueNotify | ( |  | ) |

Definition at line 484 of file request.cc.

## ◆ setResult()

void zyppng::NetworkRequestPrivate::setResult | ( | NetworkRequestError && | err | ) |

Definition at line 493 of file request.cc.

## ◆ reset()

void zyppng::NetworkRequestPrivate::reset | ( |  | ) |

Definition at line 547 of file request.cc.

## ◆ resetActivityTimer()

void zyppng::NetworkRequestPrivate::resetActivityTimer | ( |  | ) |

Definition at line 576 of file request.cc.

## ◆ onActivityTimeout()

void zyppng::NetworkRequestPrivate::onActivityTimeout | ( | Timer & | t | ) |

Definition at line 562 of file request.cc.

## ◆ errorMessage()

std::string zyppng::NetworkRequestPrivate::errorMessage | ( |  | ) | const

Definition at line 571 of file request.cc.

## ◆ setCurlOption()

template<typename T>

void zyppng::NetworkRequestPrivate::setCurlOption | ( | CURLoption | opt,
|  | T | data )
| inline

Definition at line 98 of file request_p.h.

## ◆ curlProgressCallback()

int zyppng::NetworkRequestPrivate::curlProgressCallback | ( | void * | clientp,
|  | curl_off_t | dltotal,
|  | curl_off_t | dlnow,
|  | curl_off_t | ultotal,
|  | curl_off_t | ulnow )
| static

Definition at line 585 of file request.cc.

## ◆ headerfunction()

size_t zyppng::NetworkRequestPrivate::headerfunction | ( | char * | ptr,
|  | size_t | bytes )
| overridevirtual

Called for all received header data, after it was processed by the CurlMultiPartHandler.

Implements zyppng::CurlMultiPartDataReceiver.

Definition at line 610 of file request.cc.

## ◆ writefunction()

size_t zyppng::NetworkRequestPrivate::writefunction | ( | char * | ptr,
|  | std::optional< off_t > | offset,
|  | size_t | bytes )
| overridevirtual

Data callback func, this is called whenever there is actual data to be written to the file. If offset is set, usually when starting to write a new range, it means to continue to write on the current file pointer position, otherwise seek to the given one.

Implements zyppng::CurlMultiPartDataReceiver.

Definition at line 671 of file request.cc.

## ◆ notifyErrorCodeChanged()

void zyppng::NetworkRequestPrivate::notifyErrorCodeChanged | ( |  | ) |
| overridevirtual

Called everytime the error code changes, this is just to notify that a error was set

Reimplemented from zyppng::CurlMultiPartDataReceiver.

Definition at line 736 of file request.cc.

## Member Data Documentation

## ◆ _protocolMode

enum zyppng::NetworkRequestPrivate::ProtocolMode zyppng::NetworkRequestPrivate::_protocolMode = ProtocolMode::Default

## ◆ _errorBuf

std::array<char, CURL_ERROR_SIZE+1> zyppng::NetworkRequestPrivate::_errorBuf

Definition at line 95 of file request_p.h.

## ◆ _url

Url zyppng::NetworkRequestPrivate::_url

Definition at line 106 of file request_p.h.

## ◆ _targetFile

zypp::Pathname zyppng::NetworkRequestPrivate::_targetFile

Definition at line 107 of file request_p.h.

## ◆ _settings

TransferSettings zyppng::NetworkRequestPrivate::_settings

Definition at line 108 of file request_p.h.

## ◆ _options

NetworkRequest::Options zyppng::NetworkRequestPrivate::_options

Definition at line 109 of file request_p.h.

## ◆ _expectedFileSize

zypp::ByteCount zyppng::NetworkRequestPrivate::_expectedFileSize

Definition at line 110 of file request_p.h.

## ◆ _requestedRanges

std::vector<NetworkRequest::Range> zyppng::NetworkRequestPrivate::_requestedRanges

the requested ranges that need to be downloaded

Definition at line 111 of file request_p.h.

## ◆ _fileVerification

std::optional<FileVerifyInfo> zyppng::NetworkRequestPrivate::_fileVerification

The digest for the full file.

Definition at line 117 of file request_p.h.

## ◆ _fMode

NetworkRequest::FileMode zyppng::NetworkRequestPrivate::_fMode = NetworkRequest::WriteExclusive

Definition at line 119 of file request_p.h.

## ◆ _priority

NetworkRequest::Priority zyppng::NetworkRequestPrivate::_priority = NetworkRequest::Normal

Definition at line 120 of file request_p.h.

## ◆ _lastRedirect

std::string zyppng::NetworkRequestPrivate::_lastRedirect

to log/report redirections

Definition at line 122 of file request_p.h.

## ◆ _currentCookieFile

zypp::Pathname zyppng::NetworkRequestPrivate::_currentCookieFile = "/var/lib/YaST2/cookies"

Definition at line 123 of file request_p.h.

## ◆ _easyHandle

void* zyppng::NetworkRequestPrivate::_easyHandle = nullptr

Definition at line 125 of file request_p.h.

## ◆ _dispatcher

NetworkRequestDispatcher* zyppng::NetworkRequestPrivate::_dispatcher = nullptr

Definition at line 126 of file request_p.h.

## ◆ _sigStarted

Signal< void ( NetworkRequest &req )> zyppng::NetworkRequestPrivate::_sigStarted

Definition at line 129 of file request_p.h.

## ◆ _sigBytesDownloaded

Signal< void ( NetworkRequest &req, zypp::ByteCount count )> zyppng::NetworkRequestPrivate::_sigBytesDownloaded

Definition at line 130 of file request_p.h.

## ◆ _sigProgress

Signal< void ( NetworkRequest &req, off_t dltotal, off_t dlnow, off_t ultotal, off_t ulnow )> zyppng::NetworkRequestPrivate::_sigProgress

Definition at line 131 of file request_p.h.

## ◆ _sigFinished

Signal< void ( NetworkRequest &req, const NetworkRequestError &err )> zyppng::NetworkRequestPrivate::_sigFinished

Definition at line 132 of file request_p.h.

## ◆ _headers

std::unique_ptr< curl_slist, decltype (&curl_slist_free_all) > zyppng::NetworkRequestPrivate::_headers

Definition at line 140 of file request_p.h.

## ◆ _runningMode

std::variant< pending_t, running_t, prepareNextRangeBatch_t, finished_t > zyppng::NetworkRequestPrivate::_runningMode = pending_t()

Definition at line 188 of file request_p.h.

The documentation for this class was generated from the following files:

- zypp-curl/ng/network/private/request_p.h
- zypp-curl/ng/network/request.cc