2008-08-26 12:39:07 +00:00
|
|
|
#include "common.h"
|
2010-01-28 14:01:50 +00:00
|
|
|
|
2008-08-26 12:39:07 +00:00
|
|
|
#include <string>
|
|
|
|
|
2010-11-11 02:56:24 +00:00
|
|
|
#include "SharedHandle.h"
|
2010-01-28 14:01:50 +00:00
|
|
|
#include "Cookie.h"
|
2012-11-27 13:04:59 +00:00
|
|
|
#include "WrDiskCacheEntry.h"
|
2012-12-19 14:03:48 +00:00
|
|
|
#include "GroupId.h"
|
2010-01-28 14:01:50 +00:00
|
|
|
|
2008-08-26 12:39:07 +00:00
|
|
|
namespace aria2 {
|
|
|
|
|
2010-11-11 02:56:24 +00:00
|
|
|
class MessageDigest;
|
2012-12-19 14:03:48 +00:00
|
|
|
class RequestGroupMan;
|
|
|
|
class RequestGroup;
|
2012-12-22 14:37:44 +00:00
|
|
|
class Option;
|
2013-03-01 12:17:52 +00:00
|
|
|
struct DownloadResult;
|
2010-11-11 02:56:24 +00:00
|
|
|
|
2008-08-26 12:39:07 +00:00
|
|
|
void createFile(const std::string& filename, size_t length);
|
|
|
|
|
2009-05-15 05:20:11 +00:00
|
|
|
std::string readFile(const std::string& path);
|
|
|
|
|
2010-01-28 14:01:50 +00:00
|
|
|
class CookieSorter {
|
|
|
|
public:
|
|
|
|
bool operator()(const Cookie& lhs, const Cookie& rhs) const
|
|
|
|
{
|
|
|
|
if(lhs.getDomain() == rhs.getDomain()) {
|
|
|
|
return lhs.getName() < rhs.getName();
|
|
|
|
} else {
|
|
|
|
return lhs.getDomain() < rhs.getDomain();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2010-10-09 14:22:49 +00:00
|
|
|
Cookie createCookie
|
|
|
|
(const std::string& name,
|
|
|
|
const std::string& value,
|
|
|
|
const std::string& domain,
|
|
|
|
bool hostOnly,
|
|
|
|
const std::string& path,
|
|
|
|
bool secure);
|
|
|
|
|
|
|
|
Cookie createCookie
|
|
|
|
(const std::string& name,
|
|
|
|
const std::string& value,
|
|
|
|
time_t expiryTime,
|
|
|
|
const std::string& domain,
|
|
|
|
bool hostOnly,
|
|
|
|
const std::string& path,
|
|
|
|
bool secure);
|
|
|
|
|
2011-11-05 09:05:23 +00:00
|
|
|
std::string fromHex(const std::string& s);
|
|
|
|
|
2010-11-11 02:56:24 +00:00
|
|
|
#ifdef ENABLE_MESSAGE_DIGEST
|
|
|
|
// Returns hex digest of contents of file denoted by filename.
|
|
|
|
std::string fileHexDigest
|
|
|
|
(const SharedHandle<MessageDigest>& ctx, const std::string& filename);
|
|
|
|
#endif // ENABLE_MESSAGE_DIGEST
|
|
|
|
|
2012-11-27 13:04:59 +00:00
|
|
|
WrDiskCacheEntry::DataCell* createDataCell(int64_t goff,
|
|
|
|
const char* data,
|
|
|
|
size_t offset = 0);
|
|
|
|
|
2012-12-19 14:03:48 +00:00
|
|
|
SharedHandle<RequestGroup> findReservedGroup
|
|
|
|
(const SharedHandle<RequestGroupMan>& rgman, a2_gid_t gid);
|
|
|
|
|
|
|
|
SharedHandle<RequestGroup> getReservedGroup
|
|
|
|
(const SharedHandle<RequestGroupMan>& rgman, size_t index);
|
|
|
|
|
2012-12-22 14:37:44 +00:00
|
|
|
SharedHandle<RequestGroup> createRequestGroup(int32_t pieceLength,
|
|
|
|
int64_t totalLength,
|
|
|
|
const std::string& path,
|
|
|
|
const std::string& uri,
|
|
|
|
const SharedHandle<Option>& opt);
|
2013-02-25 12:42:54 +00:00
|
|
|
|
|
|
|
SharedHandle<DownloadResult> createDownloadResult
|
|
|
|
(error_code::Value result, const std::string& uri);
|
|
|
|
|
2008-08-26 12:39:07 +00:00
|
|
|
} // namespace aria2
|