libzypp: zypp-curl/parser/metalinkparser.h Source File

libzypp 17.38.15

metalinkparser.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12#ifndef ZYPP_CURL_PARSER_METALINKPARSER_H_INCLUDED
13#define ZYPP_CURL_PARSER_METALINKPARSER_H_INCLUDED
14
15#include <string>
16
17#include <zypp-core/base/Exception.h>
18#include <zypp-core/base/NonCopyable.h>
19#include <zypp-core/base/InputStream>
20#include <zypp-curl/parser/MediaBlockList>
21#include <zypp-core/Url.h>
22#include <zypp-core/ByteArray.h>
23
24namespace zypp::media {
25
26struct ml_parsedata;
27
28 struct MetalinkMirror {
29 int priority = 0;
30 int maxConnections = -1; //< How many connections can be opened to that mirror, -1 means no limit was defined.
31 Url url;
32};
33
34 class MetaLinkParser : private zypp::base::NonCopyable {
35public:
36 MetaLinkParser();
37 ~MetaLinkParser();
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
75 MediaBlockList getBlockList() const;
76
77 const std::vector<UByteArray> &getZsyncBlockHashes() const;
78 const std::vector<UByteArray> &getSHA1BlockHashes() const;
79
80private:
81 struct ml_parsedata *pd;
82};
83
84 UByteArray hexstr2bytes( const std::string& str );
85
86} // namespace zypp::media
87
88#endif // ZYPP_CURL_PARSER_METALINKPARSER_H_INCLUDED
ByteArray.h
Exception.h
NonCopyable.h
Url.h
zypp::InputStream
Helper to create and pass std::istream.
Definition inputstream.h:57
zypp::UByteArray
Definition ByteArray.h:52
zypp::Url
Url manipulation class.
Definition Url.h:93
zypp::filesystem::Pathname
Pathname.
Definition Pathname.h:48
zypp::media::MediaBlockList
Definition mediablocklist.h:36
zypp::media::MetaLinkParser::parseEnd
void parseEnd()
tells the parser that all chunks are now processed
Definition metalinkparser.cc:508
zypp::media::MetaLinkParser::pd
struct ml_parsedata * pd
Definition metalinkparser.h:81
zypp::media::MetaLinkParser::parse
void parse(const Pathname &filename)
parse a file consisting of metalink xml data
Definition metalinkparser.cc:458
zypp::media::MetaLinkParser::getBlockList
MediaBlockList getBlockList() const
return the block list from the parsed metalink data
Definition metalinkparser.cc:538
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:494
zypp::media::MetaLinkParser::getSHA1BlockHashes
const std::vector< UByteArray > & getSHA1BlockHashes() const
Definition metalinkparser.cc:579
zypp::media::MetaLinkParser::getZsyncBlockHashes
const std::vector< UByteArray > & getZsyncBlockHashes() const
Definition metalinkparser.cc:574
zypp::media::MetaLinkParser::MetaLinkParser
MetaLinkParser()
Definition metalinkparser.cc:448
zypp::media::MetaLinkParser::getMirrors
const std::vector< MetalinkMirror > & getMirrors() const
return the mirrors from the parsed metalink data
Definition metalinkparser.cc:533
zypp::media::MetaLinkParser::getUrls
std::vector< Url > getUrls() const
return the download urls from the parsed metalink data
Definition metalinkparser.cc:524
str
String related utilities and Regular expression matching.
zypp::base::NonCopyable
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
Definition NonCopyable.h:26
zypp::media
Definition MediaNetworkRequestExecutor.h:22
zypp::media::hexstr2bytes
UByteArray hexstr2bytes(const std::string &str)
Definition metalinkparser.cc:353
zypp::media::MetalinkMirror
Definition metalinkparser.h:28
zypp::media::MetalinkMirror::maxConnections
int maxConnections
Definition metalinkparser.h:30
zypp::media::MetalinkMirror::priority
int priority
Definition metalinkparser.h:29
zypp::media::MetalinkMirror::url
Url url
Definition metalinkparser.h:31
zypp::media::ml_parsedata
Definition metalinkparser.cc:128