libzypp 17.31.23
zyppng::NetworkRequestPrivate Class Reference

#include </home/abuild/rpmbuild/BUILD/libzypp-17.31.23/zypp-curl/ng/network/private/request_p.h>

Inheritance diagram for zyppng::NetworkRequestPrivate:

Classes

struct  finished_t
 
struct  pending_t
 
struct  prepareNextRangeBatch_t
 
struct  running_t
 

Public Types

enum class  ProtocolMode { Default , HTTP }
 

Public Member Functions

 NetworkRequestPrivate (Url &&url, zypp::Pathname &&targetFile, NetworkRequest::FileMode fMode, NetworkRequest &p)
 
virtual ~NetworkRequestPrivate ()
 
bool initialize (std::string &errBuf)
 
bool setupHandle (std::string &errBuf)
 
bool assertOutputFile ()
 
bool canRecover () const
 
bool prepareToContinue (std::string &errBuf)
 
bool prepareNextRangeBatch (std::string &errBuf)
 
bool hasMoreWork () const
 
void aboutToStart ()
 
void dequeueNotify ()
 
void setResult (NetworkRequestError &&err)
 
void reset ()
 
void resetActivityTimer ()
 
void onActivityTimeout (Timer &)
 
bool checkIfRangeChkSumIsValid (const NetworkRequest::Range &rng)
 
void validateRange (NetworkRequest::Range &rng)
 
bool parseContentRangeHeader (const std::string_view &line, size_t &start, size_t &len)
 
bool parseContentTypeMultiRangeHeader (const std::string_view &line, std::string &boundary)
 
std::string errorMessage () const
 
template<typename T >
void setCurlOption (CURLoption opt, T data)
 
size_t headerCallback (char *ptr, size_t size, size_t nmemb)
 
size_t writeCallback (char *ptr, size_t size, size_t nmemb)
 

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
 
NetworkRequest::FileMode _fMode = NetworkRequest::WriteExclusive
 
NetworkRequest::Priority _priority = NetworkRequest::Normal
 
std::string _lastRedirect
 to log/report redirections
 
const std::string _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()
 

Static Public Attributes

static constexpr int _rangeAttempt []
 

Detailed Description

Definition at line 35 of file request_p.h.

Member Enumeration Documentation

◆ ProtocolMode

Enumerator
Default 
HTTP 

Definition at line 39 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 107 of file request.cc.

◆ ~NetworkRequestPrivate()

zyppng::NetworkRequestPrivate::~NetworkRequestPrivate ( )
virtual

Definition at line 115 of file request.cc.

Member Function Documentation

◆ initialize()

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

Definition at line 125 of file request.cc.

◆ setupHandle()

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

Force IPv4/v6

Connect timeout

Speed limits

Definition at line 137 of file request.cc.

◆ assertOutputFile()

bool zyppng::NetworkRequestPrivate::assertOutputFile ( )

Definition at line 404 of file request.cc.

◆ canRecover()

bool zyppng::NetworkRequestPrivate::canRecover ( ) const

Definition at line 434 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 443 of file request.cc.

◆ prepareNextRangeBatch()

bool zyppng::NetworkRequestPrivate::prepareNextRangeBatch ( std::string &  errBuf)

Add the next batch of range descriptions to the curl handle

Definition at line 475 of file request.cc.

◆ hasMoreWork()

bool zyppng::NetworkRequestPrivate::hasMoreWork ( ) const

Definition at line 584 of file request.cc.

◆ aboutToStart()

void zyppng::NetworkRequestPrivate::aboutToStart ( )

Definition at line 590 of file request.cc.

◆ dequeueNotify()

void zyppng::NetworkRequestPrivate::dequeueNotify ( )

Definition at line 616 of file request.cc.

◆ setResult()

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

Definition at line 629 of file request.cc.

◆ reset()

void zyppng::NetworkRequestPrivate::reset ( )

Definition at line 664 of file request.cc.

◆ resetActivityTimer()

void zyppng::NetworkRequestPrivate::resetActivityTimer ( )

Definition at line 757 of file request.cc.

◆ onActivityTimeout()

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

Definition at line 675 of file request.cc.

◆ checkIfRangeChkSumIsValid()

bool zyppng::NetworkRequestPrivate::checkIfRangeChkSumIsValid ( const NetworkRequest::Range rng)

Definition at line 686 of file request.cc.

◆ validateRange()

void zyppng::NetworkRequestPrivate::validateRange ( NetworkRequest::Range rng)

Definition at line 706 of file request.cc.

◆ parseContentRangeHeader()

bool zyppng::NetworkRequestPrivate::parseContentRangeHeader ( const std::string_view &  line,
size_t &  start,
size_t &  len 
)

Definition at line 721 of file request.cc.

◆ parseContentTypeMultiRangeHeader()

bool zyppng::NetworkRequestPrivate::parseContentTypeMultiRangeHeader ( const std::string_view &  line,
std::string &  boundary 
)

Definition at line 738 of file request.cc.

◆ errorMessage()

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

Definition at line 752 of file request.cc.

◆ setCurlOption()

template<typename T >
void zyppng::NetworkRequestPrivate::setCurlOption ( CURLoption  opt,
data 
)
inline

Definition at line 107 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 766 of file request.cc.

◆ headerCallback()

size_t zyppng::NetworkRequestPrivate::headerCallback ( char *  ptr,
size_t  size,
size_t  nmemb 
)

Definition at line 792 of file request.cc.

◆ writeCallback()

size_t zyppng::NetworkRequestPrivate::writeCallback ( char *  ptr,
size_t  size,
size_t  nmemb 
)

Definition at line 878 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 104 of file request_p.h.

◆ _url

Url zyppng::NetworkRequestPrivate::_url

Definition at line 115 of file request_p.h.

◆ _targetFile

zypp::Pathname zyppng::NetworkRequestPrivate::_targetFile

Definition at line 116 of file request_p.h.

◆ _settings

TransferSettings zyppng::NetworkRequestPrivate::_settings

Definition at line 117 of file request_p.h.

◆ _options

NetworkRequest::Options zyppng::NetworkRequestPrivate::_options

Definition at line 118 of file request_p.h.

◆ _expectedFileSize

zypp::ByteCount zyppng::NetworkRequestPrivate::_expectedFileSize

Definition at line 119 of file request_p.h.

◆ _requestedRanges

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

the requested ranges that need to be downloaded

Definition at line 120 of file request_p.h.

◆ _fMode

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

Definition at line 122 of file request_p.h.

◆ _priority

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

Definition at line 123 of file request_p.h.

◆ _lastRedirect

std::string zyppng::NetworkRequestPrivate::_lastRedirect

to log/report redirections

Definition at line 125 of file request_p.h.

◆ _currentCookieFile

const std::string zyppng::NetworkRequestPrivate::_currentCookieFile = "/var/lib/YaST2/cookies"

Definition at line 126 of file request_p.h.

◆ _easyHandle

void* zyppng::NetworkRequestPrivate::_easyHandle = nullptr

Definition at line 128 of file request_p.h.

◆ _dispatcher

NetworkRequestDispatcher* zyppng::NetworkRequestPrivate::_dispatcher = nullptr

Definition at line 129 of file request_p.h.

◆ _sigStarted

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

Definition at line 132 of file request_p.h.

◆ _sigBytesDownloaded

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

Definition at line 133 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 134 of file request_p.h.

◆ _sigFinished

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

Definition at line 135 of file request_p.h.

◆ _headers

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

Definition at line 141 of file request_p.h.

◆ _rangeAttempt

constexpr int zyppng::NetworkRequestPrivate::_rangeAttempt[]
staticconstexpr
Initial value:
= {
255,
127,
63,
15,
5
}

Definition at line 148 of file request_p.h.

◆ _runningMode

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

Definition at line 211 of file request_p.h.


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