libzypp 17.31.23
zypp::media::MediaBlockList Class Reference

#include </home/abuild/rpmbuild/BUILD/libzypp-17.31.23/zypp-curl/parser/mediablocklist.h>

Public Member Functions

 MediaBlockList (off_t filesize=off_t(-1))
 
bool haveBlocks () const
 do we have a blocklist describing the file? set to true when addBlock() is called
 
size_t addBlock (off_t off, size_t size)
 add a block with offset off and size size to the block list.
 
const MediaBlockgetBlock (size_t blkno) const
 return the offset/size of a block with number blkno
 
size_t numBlocks () const
 return the number of blocks in the blocklist
 
void setFilesize (off_t newfilesize=off_t(-1))
 set / return the size of the whole file
 
off_t getFilesize () const
 
bool haveFilesize () const
 
void setFileChecksum (std::string ctype, int cl, unsigned char *c)
 set / verify the checksum over the whole file
 
std::string fileChecksumType () const
 
const UByteArraygetFileChecksum ()
 
bool createFileDigest (Digest &digest) const
 
bool verifyFileDigest (Digest &digest) const
 
bool haveFileChecksum () const
 
void setChecksum (size_t blkno, std::string cstype, int csl, unsigned char *cs, size_t cspad=0)
 set / verify the (strong) checksum over a single block
 
bool checkChecksum (size_t blkno, const unsigned char *buf, size_t bufl) const
 
UByteArray getChecksum (size_t blkno) const
 
std::string getChecksumType () const
 
size_t checksumPad () const
 
bool createDigest (Digest &digest) const
 
bool verifyDigest (size_t blkno, Digest &digest) const
 
bool haveChecksum (size_t blkno) const
 
void setRsum (size_t blkno, int rsl, unsigned int rs, size_t rspad=0)
 set / verify the (weak) rolling checksum over a single block
 
void setRsumSequence (uint seq)
 how many blocks in sequence need to have the correct checksums to be considered a match
 
bool checkRsum (size_t blkno, const unsigned char *buf, size_t bufl) const
 
unsigned int updateRsum (unsigned int rs, const char *bytes, size_t len) const
 
bool verifyRsum (size_t blkno, unsigned int rs) const
 
bool haveRsum (size_t blkno) const
 
void reuseBlocksOld (FILE *wfp, std::string filename)
 scan a file for blocks from our blocklist.
 
void reuseBlocks (FILE *wfp, std::string filename)
 
std::string asString () const
 return block list as string
 

Private Member Functions

void writeBlock (size_t blkno, FILE *fp, const unsigned char *buf, size_t bufl, size_t start, std::vector< bool > &found) const
 
bool checkChecksumRotated (size_t blkno, const unsigned char *buf, size_t bufl, size_t start) const
 

Private Attributes

off_t filesize
 
std::string fsumtype
 
UByteArray fsum
 
bool haveblocks
 
std::vector< MediaBlockblocks
 
std::string chksumtype
 
int chksumlen
 
size_t chksumpad
 
std::vector< unsigned char > chksums
 
int rsumlen
 
uint rsumseq
 
size_t rsumpad
 
std::vector< unsigned int > rsums
 

Detailed Description

Definition at line 36 of file mediablocklist.h.

Constructor & Destructor Documentation

◆ MediaBlockList()

zypp::media::MediaBlockList::MediaBlockList ( off_t  filesize = off_t(-1))

Definition at line 171 of file mediablocklist.cc.

Member Function Documentation

◆ haveBlocks()

bool zypp::media::MediaBlockList::haveBlocks ( ) const
inline

do we have a blocklist describing the file? set to true when addBlock() is called

Definition at line 44 of file mediablocklist.h.

◆ addBlock()

size_t zypp::media::MediaBlockList::addBlock ( off_t  off,
size_t  size 
)

add a block with offset off and size size to the block list.

Note that blocks must be ordered and must not overlap. returns the block number.

Definition at line 182 of file mediablocklist.cc.

◆ getBlock()

const MediaBlock & zypp::media::MediaBlockList::getBlock ( size_t  blkno) const
inline

return the offset/size of a block with number blkno

Definition at line 57 of file mediablocklist.h.

◆ numBlocks()

size_t zypp::media::MediaBlockList::numBlocks ( ) const
inline

return the number of blocks in the blocklist

Definition at line 63 of file mediablocklist.h.

◆ setFilesize()

void zypp::media::MediaBlockList::setFilesize ( off_t  newfilesize = off_t(-1))
inline

set / return the size of the whole file

Definition at line 70 of file mediablocklist.h.

◆ getFilesize()

off_t zypp::media::MediaBlockList::getFilesize ( ) const
inline

Definition at line 73 of file mediablocklist.h.

◆ haveFilesize()

bool zypp::media::MediaBlockList::haveFilesize ( ) const
inline

Definition at line 76 of file mediablocklist.h.

◆ setFileChecksum()

void zypp::media::MediaBlockList::setFileChecksum ( std::string  ctype,
int  cl,
unsigned char *  c 
)

set / verify the checksum over the whole file

Definition at line 190 of file mediablocklist.cc.

◆ fileChecksumType()

std::string zypp::media::MediaBlockList::fileChecksumType ( ) const

Definition at line 199 of file mediablocklist.cc.

◆ getFileChecksum()

const UByteArray & zypp::media::MediaBlockList::getFileChecksum ( )

Definition at line 204 of file mediablocklist.cc.

◆ createFileDigest()

bool zypp::media::MediaBlockList::createFileDigest ( Digest digest) const

Definition at line 210 of file mediablocklist.cc.

◆ verifyFileDigest()

bool zypp::media::MediaBlockList::verifyFileDigest ( Digest digest) const

Definition at line 216 of file mediablocklist.cc.

◆ haveFileChecksum()

bool zypp::media::MediaBlockList::haveFileChecksum ( ) const
inline

Definition at line 89 of file mediablocklist.h.

◆ setChecksum()

void zypp::media::MediaBlockList::setChecksum ( size_t  blkno,
std::string  cstype,
int  csl,
unsigned char *  cs,
size_t  cspad = 0 
)

set / verify the (strong) checksum over a single block

Definition at line 227 of file mediablocklist.cc.

◆ checkChecksum()

bool zypp::media::MediaBlockList::checkChecksum ( size_t  blkno,
const unsigned char *  buf,
size_t  bufl 
) const

Definition at line 342 of file mediablocklist.cc.

◆ getChecksum()

UByteArray zypp::media::MediaBlockList::getChecksum ( size_t  blkno) const

Definition at line 353 of file mediablocklist.cc.

◆ getChecksumType()

std::string zypp::media::MediaBlockList::getChecksumType ( ) const

Definition at line 363 of file mediablocklist.cc.

◆ checksumPad()

size_t zypp::media::MediaBlockList::checksumPad ( ) const

Definition at line 368 of file mediablocklist.cc.

◆ createDigest()

bool zypp::media::MediaBlockList::createDigest ( Digest digest) const

Definition at line 269 of file mediablocklist.cc.

◆ verifyDigest()

bool zypp::media::MediaBlockList::verifyDigest ( size_t  blkno,
Digest digest 
) const

Definition at line 275 of file mediablocklist.cc.

◆ haveChecksum()

bool zypp::media::MediaBlockList::haveChecksum ( size_t  blkno) const
inline

Definition at line 103 of file mediablocklist.h.

◆ setRsum()

void zypp::media::MediaBlockList::setRsum ( size_t  blkno,
int  rsl,
unsigned int  rs,
size_t  rspad = 0 
)

set / verify the (weak) rolling checksum over a single block

Definition at line 246 of file mediablocklist.cc.

◆ setRsumSequence()

void zypp::media::MediaBlockList::setRsumSequence ( uint  seq)

how many blocks in sequence need to have the correct checksums to be considered a match

Definition at line 263 of file mediablocklist.cc.

◆ checkRsum()

bool zypp::media::MediaBlockList::checkRsum ( size_t  blkno,
const unsigned char *  buf,
size_t  bufl 
) const

Definition at line 333 of file mediablocklist.cc.

◆ updateRsum()

unsigned int zypp::media::MediaBlockList::updateRsum ( unsigned int  rs,
const char *  bytes,
size_t  len 
) const

Definition at line 295 of file mediablocklist.cc.

◆ verifyRsum()

bool zypp::media::MediaBlockList::verifyRsum ( size_t  blkno,
unsigned int  rs 
) const

Definition at line 313 of file mediablocklist.cc.

◆ haveRsum()

bool zypp::media::MediaBlockList::haveRsum ( size_t  blkno) const
inline

Definition at line 120 of file mediablocklist.h.

◆ reuseBlocksOld()

void zypp::media::MediaBlockList::reuseBlocksOld ( FILE *  wfp,
std::string  filename 
)

scan a file for blocks from our blocklist.

if we find a suitable block, it is removed from the list

Definition at line 769 of file mediablocklist.cc.

◆ reuseBlocks()

void zypp::media::MediaBlockList::reuseBlocks ( FILE *  wfp,
std::string  filename 
)

Definition at line 439 of file mediablocklist.cc.

◆ asString()

std::string zypp::media::MediaBlockList::asString ( ) const

return block list as string

Definition at line 1062 of file mediablocklist.cc.

◆ writeBlock()

void zypp::media::MediaBlockList::writeBlock ( size_t  blkno,
FILE *  fp,
const unsigned char *  buf,
size_t  bufl,
size_t  start,
std::vector< bool > &  found 
) const
private

Definition at line 394 of file mediablocklist.cc.

◆ checkChecksumRotated()

bool zypp::media::MediaBlockList::checkChecksumRotated ( size_t  blkno,
const unsigned char *  buf,
size_t  bufl,
size_t  start 
) const
private

Definition at line 375 of file mediablocklist.cc.

Member Data Documentation

◆ filesize

off_t zypp::media::MediaBlockList::filesize
private

Definition at line 140 of file mediablocklist.h.

◆ fsumtype

std::string zypp::media::MediaBlockList::fsumtype
private

Definition at line 141 of file mediablocklist.h.

◆ fsum

UByteArray zypp::media::MediaBlockList::fsum
private

Definition at line 142 of file mediablocklist.h.

◆ haveblocks

bool zypp::media::MediaBlockList::haveblocks
private

Definition at line 144 of file mediablocklist.h.

◆ blocks

std::vector<MediaBlock> zypp::media::MediaBlockList::blocks
private

Definition at line 145 of file mediablocklist.h.

◆ chksumtype

std::string zypp::media::MediaBlockList::chksumtype
private

Definition at line 147 of file mediablocklist.h.

◆ chksumlen

int zypp::media::MediaBlockList::chksumlen
private

Definition at line 148 of file mediablocklist.h.

◆ chksumpad

size_t zypp::media::MediaBlockList::chksumpad
private

Definition at line 149 of file mediablocklist.h.

◆ chksums

std::vector<unsigned char> zypp::media::MediaBlockList::chksums
private

Definition at line 150 of file mediablocklist.h.

◆ rsumlen

int zypp::media::MediaBlockList::rsumlen
private

Definition at line 152 of file mediablocklist.h.

◆ rsumseq

uint zypp::media::MediaBlockList::rsumseq
private

Definition at line 153 of file mediablocklist.h.

◆ rsumpad

size_t zypp::media::MediaBlockList::rsumpad
private

Definition at line 154 of file mediablocklist.h.

◆ rsums

std::vector<unsigned int> zypp::media::MediaBlockList::rsums
private

Definition at line 155 of file mediablocklist.h.


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