libzypp  17.28.0
MetaLinkParser.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #ifndef ZYPP_MEDIA_METALINKPARSER_H
13 #define ZYPP_MEDIA_METALINKPARSER_H
14 
15 #include <string>
16 
17 #include <zypp/base/Exception.h>
18 #include <zypp/base/NonCopyable.h>
19 #include <zypp/base/InputStream.h>
21 #include <zypp/Url.h>
22 #include <zypp/ByteArray.h>
23 
24 namespace zypp::media {
25 
26 struct ml_parsedata;
27 
29  int priority = 0;
30  int maxConnections = -1; //< How many connections can be opened to that mirror, -1 means no limit was defined.
32 };
33 
35 public:
38 
43  void parse(const Pathname &filename);
44 
49  void parse(const InputStream &is);
50 
55  void parseBytes(const char* bytes, size_t len);
60  void parseEnd();
61 
65  std::vector<Url> getUrls() const;
66 
70  const std::vector<MetalinkMirror> &getMirrors() const;
71 
76 
77  const std::vector<UByteArray> &getZsyncBlockHashes() const;
78  const std::vector<UByteArray> &getSHA1BlockHashes() const;
79 
80 private:
81  struct ml_parsedata *pd;
82 };
83 
84 UByteArray hexstr2bytes( std::string str );
85 
86 } // namespace zypp::media
87 
88 #endif // ZYPP_MEDIA_METALINKPARSER_H
zypp::media::MetaLinkParser::getSHA1BlockHashes
const std::vector< UByteArray > & getSHA1BlockHashes() const
Definition: MetaLinkParser.cc:513
zypp::media::MetalinkMirror::maxConnections
int maxConnections
Definition: MetaLinkParser.h:30
zypp::media::MetalinkMirror::url
Url url
Definition: MetaLinkParser.h:31
zypp::media::MediaBlockList
Definition: MediaBlockList.h:36
zypp::media
Definition: CredentialFileReader.cc:31
zypp::media::MetalinkMirror::priority
int priority
Definition: MetaLinkParser.h:29
zypp::media::MetaLinkParser
Definition: MetaLinkParser.h:34
zypp::media::hexstr2bytes
UByteArray hexstr2bytes(std::string str)
Definition: MetaLinkParser.cc:324
zypp::media::MetaLinkParser::parseEnd
void parseEnd()
tells the parser that all chunks are now processed
Definition: MetaLinkParser.cc:446
zypp::media::MetaLinkParser::getUrls
std::vector< Url > getUrls() const
return the download urls from the parsed metalink data
Definition: MetaLinkParser.cc:459
MediaBlockList.h
zypp::base::NonCopyable
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
Definition: NonCopyable.h:26
zypp::media::MetaLinkParser::getBlockList
MediaBlockList getBlockList() const
return the block list from the parsed metalink data
Definition: MetaLinkParser.cc:472
zypp::media::MetaLinkParser::MetaLinkParser
MetaLinkParser()
Definition: MetaLinkParser.cc:405
zypp::InputStream
Helper to create and pass std::istream.
Definition: InputStream.h:57
zypp::media::MetaLinkParser::parse
void parse(const Pathname &filename)
parse a file consisting of metalink xml data
Definition: MetaLinkParser.cc:415
zypp::media::ml_parsedata
Definition: MetaLinkParser.cc:113
zypp::media::MetaLinkParser::getZsyncBlockHashes
const std::vector< UByteArray > & getZsyncBlockHashes() const
Definition: MetaLinkParser.cc:508
zypp::filesystem::Pathname
Pathname.
Definition: Pathname.h:45
zypp::media::MetaLinkParser::pd
struct ml_parsedata * pd
Definition: MetaLinkParser.h:81
zypp::media::MetaLinkParser::parseBytes
void parseBytes(const char *bytes, size_t len)
parse a chunk of a file consisting of metalink xml data.
Definition: MetaLinkParser.cc:435
InputStream.h
zypp::media::MetalinkMirror
Definition: MetaLinkParser.h:28
str
String related utilities and Regular expression matching.
zypp::media::MetaLinkParser::~MetaLinkParser
~MetaLinkParser()
Definition: MetaLinkParser.cc:409
zypp::Url
Url manipulation class.
Definition: Url.h:92
zypp::UByteArray
Definition: ByteArray.h:39
zypp::media::MetaLinkParser::getMirrors
const std::vector< MetalinkMirror > & getMirrors() const
return the mirrors from the parsed metalink data
Definition: MetaLinkParser.cc:467