libzypp
17.28.5
|
#include <media/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 More... | |
size_t | addBlock (off_t off, size_t size) |
add a block with offset off and size size to the block list. More... | |
MediaBlock | getBlock (size_t blkno) const |
return the offset/size of a block with number blkno More... | |
size_t | numBlocks () const |
return the number of blocks in the blocklist More... | |
void | setFilesize (off_t newfilesize=off_t(-1)) |
set / return the size of the whole file More... | |
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 More... | |
std::string | fileChecksumType () const |
const UByteArray & | getFileChecksum () |
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 More... | |
bool | checkChecksum (size_t blkno, const unsigned char *buf, size_t bufl) const |
UByteArray | getChecksum (size_t blkno) const |
std::string | getChecksumType () 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 More... | |
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 | reuseBlocks (FILE *wfp, std::string filename) |
scan a file for blocks from our blocklist. More... | |
std::string | asString () const |
return block list as string More... | |
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< MediaBlock > | blocks |
std::string | chksumtype |
int | chksumlen |
size_t | chksumpad |
std::vector< unsigned char > | chksums |
std::string | rsumtype |
int | rsumlen |
size_t | rsumpad |
std::vector< unsigned int > | rsums |
Definition at line 36 of file MediaBlockList.h.
zypp::media::MediaBlockList::MediaBlockList | ( | off_t | filesize = off_t(-1) | ) |
Definition at line 31 of file MediaBlockList.cc.
|
inline |
do we have a blocklist describing the file? set to true when addBlock() is called
Definition at line 44 of file MediaBlockList.h.
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 42 of file MediaBlockList.cc.
|
inline |
return the offset/size of a block with number blkno
Definition at line 57 of file MediaBlockList.h.
|
inline |
return the number of blocks in the blocklist
Definition at line 63 of file MediaBlockList.h.
|
inline |
set / return the size of the whole file
Definition at line 70 of file MediaBlockList.h.
|
inline |
Definition at line 73 of file MediaBlockList.h.
|
inline |
Definition at line 76 of file MediaBlockList.h.
void zypp::media::MediaBlockList::setFileChecksum | ( | std::string | ctype, |
int | cl, | ||
unsigned char * | c | ||
) |
set / verify the checksum over the whole file
Definition at line 50 of file MediaBlockList.cc.
std::string zypp::media::MediaBlockList::fileChecksumType | ( | ) | const |
Definition at line 59 of file MediaBlockList.cc.
const UByteArray & zypp::media::MediaBlockList::getFileChecksum | ( | ) |
Definition at line 64 of file MediaBlockList.cc.
Definition at line 70 of file MediaBlockList.cc.
Definition at line 76 of file MediaBlockList.cc.
|
inline |
Definition at line 89 of file MediaBlockList.h.
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 87 of file MediaBlockList.cc.
bool zypp::media::MediaBlockList::checkChecksum | ( | size_t | blkno, |
const unsigned char * | buf, | ||
size_t | bufl | ||
) | const |
Definition at line 205 of file MediaBlockList.cc.
UByteArray zypp::media::MediaBlockList::getChecksum | ( | size_t | blkno | ) | const |
Definition at line 216 of file MediaBlockList.cc.
std::string zypp::media::MediaBlockList::getChecksumType | ( | ) | const |
Definition at line 226 of file MediaBlockList.cc.
Definition at line 123 of file MediaBlockList.cc.
Definition at line 129 of file MediaBlockList.cc.
|
inline |
Definition at line 102 of file MediaBlockList.h.
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 106 of file MediaBlockList.cc.
bool zypp::media::MediaBlockList::checkRsum | ( | size_t | blkno, |
const unsigned char * | buf, | ||
size_t | bufl | ||
) | const |
Definition at line 196 of file MediaBlockList.cc.
unsigned int zypp::media::MediaBlockList::updateRsum | ( | unsigned int | rs, |
const char * | bytes, | ||
size_t | len | ||
) | const |
Definition at line 149 of file MediaBlockList.cc.
bool zypp::media::MediaBlockList::verifyRsum | ( | size_t | blkno, |
unsigned int | rs | ||
) | const |
Definition at line 166 of file MediaBlockList.cc.
|
inline |
Definition at line 113 of file MediaBlockList.h.
void zypp::media::MediaBlockList::reuseBlocks | ( | 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 299 of file MediaBlockList.cc.
std::string zypp::media::MediaBlockList::asString | ( | ) | const |
return block list as string
Definition at line 512 of file MediaBlockList.cc.
|
private |
Definition at line 252 of file MediaBlockList.cc.
|
private |
Definition at line 233 of file MediaBlockList.cc.
|
private |
Definition at line 132 of file MediaBlockList.h.
|
private |
Definition at line 133 of file MediaBlockList.h.
|
private |
Definition at line 134 of file MediaBlockList.h.
|
private |
Definition at line 136 of file MediaBlockList.h.
|
private |
Definition at line 137 of file MediaBlockList.h.
|
private |
Definition at line 139 of file MediaBlockList.h.
|
private |
Definition at line 140 of file MediaBlockList.h.
|
private |
Definition at line 141 of file MediaBlockList.h.
|
private |
Definition at line 142 of file MediaBlockList.h.
|
private |
Definition at line 144 of file MediaBlockList.h.
|
private |
Definition at line 145 of file MediaBlockList.h.
|
private |
Definition at line 146 of file MediaBlockList.h.
|
private |
Definition at line 147 of file MediaBlockList.h.