2006-07-03 14:19:23 +00:00
|
|
|
/* <!-- copyright */
|
|
|
|
/*
|
2006-09-21 15:31:24 +00:00
|
|
|
* aria2 - The high speed download utility
|
2006-07-03 14:19:23 +00:00
|
|
|
*
|
|
|
|
* Copyright (C) 2006 Tatsuhiro Tsujikawa
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2010-01-05 16:01:46 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
2006-09-21 15:31:24 +00:00
|
|
|
*
|
|
|
|
* In addition, as a special exception, the copyright holders give
|
|
|
|
* permission to link the code of portions of this program with the
|
|
|
|
* OpenSSL library under certain conditions as described in each
|
|
|
|
* individual source file, and distribute linked combinations
|
|
|
|
* including the two.
|
|
|
|
* You must obey the GNU General Public License in all respects
|
|
|
|
* for all of the code used other than OpenSSL. If you modify
|
|
|
|
* file(s) with this exception, you may extend this exception to your
|
|
|
|
* version of the file(s), but you are not obligated to do so. If you
|
|
|
|
* do not wish to do so, delete this exception statement from your
|
|
|
|
* version. If you delete this exception statement from all source
|
|
|
|
* files in the program, then also delete it here.
|
2006-07-03 14:19:23 +00:00
|
|
|
*/
|
|
|
|
/* copyright --> */
|
2010-10-31 07:23:53 +00:00
|
|
|
#ifndef D_METALINK_ENTRY_H
|
|
|
|
#define D_METALINK_ENTRY_H
|
2006-07-03 14:19:23 +00:00
|
|
|
|
|
|
|
#include "common.h"
|
2009-05-29 12:12:22 +00:00
|
|
|
|
2008-02-08 15:53:45 +00:00
|
|
|
#include <string>
|
2010-02-25 14:40:18 +00:00
|
|
|
#include <vector>
|
2006-07-03 14:19:23 +00:00
|
|
|
|
2009-05-29 12:12:22 +00:00
|
|
|
#include "SharedHandle.h"
|
|
|
|
|
2008-02-08 15:53:45 +00:00
|
|
|
namespace aria2 {
|
2007-06-30 09:52:39 +00:00
|
|
|
|
2008-02-08 15:53:45 +00:00
|
|
|
class MetalinkResource;
|
2010-02-25 16:00:24 +00:00
|
|
|
class MetalinkMetaurl;
|
2008-02-08 15:53:45 +00:00
|
|
|
class FileEntry;
|
|
|
|
#ifdef ENABLE_MESSAGE_DIGEST
|
|
|
|
class Checksum;
|
|
|
|
class ChunkChecksum;
|
|
|
|
#endif // ENABLE_MESSAGE_DIGEST
|
2008-07-12 13:35:35 +00:00
|
|
|
class Signature;
|
2007-06-30 09:52:39 +00:00
|
|
|
|
2006-07-03 14:19:23 +00:00
|
|
|
class MetalinkEntry {
|
|
|
|
public:
|
2008-02-08 15:53:45 +00:00
|
|
|
SharedHandle<FileEntry> file;
|
|
|
|
std::string version;
|
2010-02-25 14:40:18 +00:00
|
|
|
std::vector<std::string> languages;
|
|
|
|
std::vector<std::string> oses;
|
2010-02-26 15:37:08 +00:00
|
|
|
// True if size is specified in Metalink document.
|
|
|
|
bool sizeKnown;
|
2010-02-27 15:14:40 +00:00
|
|
|
std::vector<SharedHandle<MetalinkResource> > resources;
|
2010-02-25 16:00:24 +00:00
|
|
|
std::vector<SharedHandle<MetalinkMetaurl> > metaurls;
|
2010-02-25 14:40:18 +00:00
|
|
|
int maxConnections; // Metalink3Spec
|
2007-01-28 14:18:35 +00:00
|
|
|
#ifdef ENABLE_MESSAGE_DIGEST
|
2008-02-08 15:53:45 +00:00
|
|
|
SharedHandle<Checksum> checksum;
|
|
|
|
SharedHandle<ChunkChecksum> chunkChecksum;
|
2007-01-28 14:18:35 +00:00
|
|
|
#endif // ENABLE_MESSAGE_DIGEST
|
2008-07-12 13:35:35 +00:00
|
|
|
private:
|
2010-06-21 13:51:56 +00:00
|
|
|
SharedHandle<Signature> signature_;
|
2006-07-03 14:19:23 +00:00
|
|
|
public:
|
|
|
|
MetalinkEntry();
|
2007-06-30 09:52:39 +00:00
|
|
|
|
2006-07-03 14:19:23 +00:00
|
|
|
~MetalinkEntry();
|
|
|
|
|
2008-02-08 15:53:45 +00:00
|
|
|
MetalinkEntry& operator=(const MetalinkEntry& metalinkEntry);
|
2006-07-03 14:19:23 +00:00
|
|
|
|
2010-02-26 15:37:08 +00:00
|
|
|
const std::string& getPath() const;
|
2007-06-30 09:52:39 +00:00
|
|
|
|
2012-06-25 14:35:24 +00:00
|
|
|
int64_t getLength() const;
|
2008-02-08 15:53:45 +00:00
|
|
|
|
2009-05-29 12:12:22 +00:00
|
|
|
const SharedHandle<FileEntry>& getFile() const
|
|
|
|
{
|
|
|
|
return file;
|
|
|
|
}
|
2007-06-30 09:52:39 +00:00
|
|
|
|
2006-07-03 14:19:23 +00:00
|
|
|
void dropUnsupportedResource();
|
|
|
|
|
2010-02-25 14:40:18 +00:00
|
|
|
void reorderResourcesByPriority();
|
2010-02-25 16:00:24 +00:00
|
|
|
|
|
|
|
void reorderMetaurlsByPriority();
|
2012-10-01 14:52:22 +00:00
|
|
|
|
2010-11-14 07:17:55 +00:00
|
|
|
bool containsLanguage(const std::string& lang) const;
|
2010-02-25 14:40:18 +00:00
|
|
|
|
2010-11-14 07:17:55 +00:00
|
|
|
bool containsOS(const std::string& os) const;
|
2010-02-25 14:40:18 +00:00
|
|
|
|
|
|
|
void setLocationPriority
|
2010-02-27 15:14:40 +00:00
|
|
|
(const std::vector<std::string>& locations, int priorityToAdd);
|
2010-02-25 14:40:18 +00:00
|
|
|
|
|
|
|
void setProtocolPriority(const std::string& protocol, int priorityToAdd);
|
2006-07-03 14:19:23 +00:00
|
|
|
|
2008-05-12 11:39:34 +00:00
|
|
|
static void toFileEntry
|
2010-02-27 15:14:40 +00:00
|
|
|
(std::vector<SharedHandle<FileEntry> >& fileEntries,
|
|
|
|
const std::vector<SharedHandle<MetalinkEntry> >& metalinkEntries);
|
2008-07-12 13:35:35 +00:00
|
|
|
|
|
|
|
void setSignature(const SharedHandle<Signature>& signature);
|
|
|
|
|
2009-05-29 12:12:22 +00:00
|
|
|
const SharedHandle<Signature>& getSignature() const
|
|
|
|
{
|
2010-06-21 13:51:56 +00:00
|
|
|
return signature_;
|
2009-05-29 12:12:22 +00:00
|
|
|
}
|
2007-06-30 09:52:39 +00:00
|
|
|
};
|
2006-11-08 16:25:38 +00:00
|
|
|
|
2008-02-08 15:53:45 +00:00
|
|
|
} // namespace aria2
|
|
|
|
|
2010-10-31 07:23:53 +00:00
|
|
|
#endif // D_METALINK_ENTRY_H
|