2006-02-17 13:35:04 +00:00
|
|
|
/* <!-- copyright */
|
|
|
|
/*
|
2006-09-21 15:31:24 +00:00
|
|
|
* aria2 - The high speed download utility
|
2006-02-17 13:35:04 +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-02-17 13:35:04 +00:00
|
|
|
*/
|
|
|
|
/* copyright --> */
|
2010-10-31 07:23:53 +00:00
|
|
|
#ifndef D_DOWNLOAD_ENGINE_H
|
|
|
|
#define D_DOWNLOAD_ENGINE_H
|
2006-02-17 13:35:04 +00:00
|
|
|
|
|
|
|
#include "common.h"
|
2008-11-03 06:49:02 +00:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <deque>
|
|
|
|
#include <map>
|
2010-02-28 12:30:11 +00:00
|
|
|
#include <vector>
|
2013-06-21 16:10:38 +00:00
|
|
|
#include <memory>
|
2008-11-03 06:49:02 +00:00
|
|
|
|
2008-05-08 11:18:36 +00:00
|
|
|
#include "a2netcompat.h"
|
2010-04-11 08:28:22 +00:00
|
|
|
#include "TimerA2.h"
|
2008-05-31 10:31:07 +00:00
|
|
|
#include "a2io.h"
|
2008-11-03 07:49:13 +00:00
|
|
|
#include "CUIDCounter.h"
|
2009-01-24 09:00:36 +00:00
|
|
|
#include "FileAllocationMan.h"
|
2009-01-24 10:40:42 +00:00
|
|
|
#include "CheckIntegrityMan.h"
|
2010-01-06 14:31:41 +00:00
|
|
|
#include "DNSCache.h"
|
2010-11-14 07:17:55 +00:00
|
|
|
#ifdef ENABLE_ASYNC_DNS
|
|
|
|
# include "AsyncNameResolver.h"
|
|
|
|
#endif // ENABLE_ASYNC_DNS
|
2008-02-08 15:53:45 +00:00
|
|
|
|
|
|
|
namespace aria2 {
|
2007-10-11 16:58:24 +00:00
|
|
|
|
|
|
|
class Option;
|
|
|
|
class RequestGroupMan;
|
|
|
|
class StatCalc;
|
2008-02-08 15:53:45 +00:00
|
|
|
class SocketCore;
|
2008-09-01 13:46:03 +00:00
|
|
|
class CookieStorage;
|
2008-11-03 10:06:25 +00:00
|
|
|
class AuthConfigFactory;
|
|
|
|
class Request;
|
2009-01-15 15:23:16 +00:00
|
|
|
class EventPoll;
|
|
|
|
class Command;
|
2009-07-25 14:07:46 +00:00
|
|
|
#ifdef ENABLE_BITTORRENT
|
|
|
|
class BtRegistry;
|
|
|
|
#endif // ENABLE_BITTORRENT
|
2013-05-11 02:04:47 +00:00
|
|
|
#ifdef ENABLE_WEBSOCKET
|
|
|
|
namespace rpc {
|
|
|
|
class WebSocketSessionMan;
|
|
|
|
} // namespace rpc
|
|
|
|
#endif // ENABLE_WEBSOCKET
|
2006-08-11 12:29:55 +00:00
|
|
|
|
2014-04-19 17:10:06 +00:00
|
|
|
namespace util {
|
|
|
|
namespace security {
|
|
|
|
class HMAC;
|
|
|
|
class HMACResult;
|
|
|
|
} // namespace security
|
|
|
|
} // namespace util
|
|
|
|
|
2006-02-17 13:35:04 +00:00
|
|
|
class DownloadEngine {
|
|
|
|
private:
|
2007-03-16 14:21:29 +00:00
|
|
|
void waitData();
|
2008-05-31 10:31:07 +00:00
|
|
|
|
2010-06-21 13:51:56 +00:00
|
|
|
std::string sessionId_;
|
2010-01-17 11:55:22 +00:00
|
|
|
|
2013-07-06 10:39:16 +00:00
|
|
|
std::unique_ptr<EventPoll> eventPoll_;
|
2008-05-31 10:31:07 +00:00
|
|
|
|
2013-07-06 10:26:30 +00:00
|
|
|
std::unique_ptr<StatCalc> statCalc_;
|
2007-10-11 16:58:24 +00:00
|
|
|
|
2013-02-24 15:56:49 +00:00
|
|
|
int haltRequested_;
|
2007-10-11 16:58:24 +00:00
|
|
|
|
2008-05-08 13:18:25 +00:00
|
|
|
class SocketPoolEntry {
|
|
|
|
private:
|
2013-06-21 16:10:38 +00:00
|
|
|
std::shared_ptr<SocketCore> socket_;
|
2012-09-26 14:00:05 +00:00
|
|
|
// protocol specific option string
|
|
|
|
std::string options_;
|
2008-09-24 17:01:57 +00:00
|
|
|
|
2010-06-21 13:51:56 +00:00
|
|
|
time_t timeout_;
|
2008-05-08 13:18:25 +00:00
|
|
|
|
2010-06-21 13:51:56 +00:00
|
|
|
Timer registeredTime_;
|
2008-05-08 13:18:25 +00:00
|
|
|
public:
|
2013-06-21 16:10:38 +00:00
|
|
|
SocketPoolEntry(const std::shared_ptr<SocketCore>& socket,
|
2012-09-26 14:00:05 +00:00
|
|
|
const std::string& option,
|
2010-01-05 16:01:46 +00:00
|
|
|
time_t timeout);
|
2008-05-08 13:18:25 +00:00
|
|
|
|
2013-06-21 16:10:38 +00:00
|
|
|
SocketPoolEntry(const std::shared_ptr<SocketCore>& socket,
|
2010-05-21 12:22:04 +00:00
|
|
|
time_t timeout);
|
|
|
|
|
2008-05-08 13:18:25 +00:00
|
|
|
~SocketPoolEntry();
|
|
|
|
|
|
|
|
bool isTimeout() const;
|
|
|
|
|
2013-06-21 16:10:38 +00:00
|
|
|
const std::shared_ptr<SocketCore>& getSocket() const
|
2009-05-29 12:12:22 +00:00
|
|
|
{
|
2010-06-21 13:51:56 +00:00
|
|
|
return socket_;
|
2009-05-29 12:12:22 +00:00
|
|
|
}
|
|
|
|
|
2012-09-26 14:00:05 +00:00
|
|
|
const std::string& getOptions() const
|
2009-05-29 12:12:22 +00:00
|
|
|
{
|
2010-06-21 13:51:56 +00:00
|
|
|
return options_;
|
2009-05-29 12:12:22 +00:00
|
|
|
}
|
2008-05-08 13:18:25 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// key = IP address:port, value = SocketPoolEntry
|
2010-06-21 13:51:56 +00:00
|
|
|
std::multimap<std::string, SocketPoolEntry> socketPool_;
|
2012-10-01 14:52:22 +00:00
|
|
|
|
2010-06-21 13:51:56 +00:00
|
|
|
Timer lastSocketPoolScan_;
|
2008-09-24 17:01:57 +00:00
|
|
|
|
2010-06-21 13:51:56 +00:00
|
|
|
bool noWait_;
|
2008-09-01 13:46:03 +00:00
|
|
|
|
2011-02-26 14:16:48 +00:00
|
|
|
static const int64_t DEFAULT_REFRESH_INTERVAL = 1000;
|
2008-11-11 16:05:42 +00:00
|
|
|
|
2010-07-28 12:31:55 +00:00
|
|
|
// Milliseconds
|
|
|
|
int64_t refreshInterval_;
|
2013-04-26 14:55:51 +00:00
|
|
|
Timer lastRefresh_;
|
2008-11-11 16:05:42 +00:00
|
|
|
|
2013-06-25 14:01:00 +00:00
|
|
|
std::unique_ptr<CookieStorage> cookieStorage_;
|
2008-09-01 13:46:03 +00:00
|
|
|
|
2009-07-25 14:07:46 +00:00
|
|
|
#ifdef ENABLE_BITTORRENT
|
2013-07-06 09:42:57 +00:00
|
|
|
std::unique_ptr<BtRegistry> btRegistry_;
|
2009-07-25 14:07:46 +00:00
|
|
|
#endif // ENABLE_BITTORRENT
|
2008-11-03 06:49:02 +00:00
|
|
|
|
2010-06-21 13:51:56 +00:00
|
|
|
CUIDCounter cuidCounter_;
|
2008-11-03 07:49:13 +00:00
|
|
|
|
2011-02-17 16:04:11 +00:00
|
|
|
#ifdef HAVE_ARES_ADDR_NODE
|
2011-02-08 14:05:40 +00:00
|
|
|
ares_addr_node* asyncDNSServers_;
|
2011-02-17 16:04:11 +00:00
|
|
|
#endif // HAVE_ARES_ADDR_NODE
|
2011-02-08 14:05:40 +00:00
|
|
|
|
2013-07-06 09:38:18 +00:00
|
|
|
std::unique_ptr<DNSCache> dnsCache_;
|
2008-11-03 08:18:58 +00:00
|
|
|
|
2013-06-25 13:06:29 +00:00
|
|
|
std::unique_ptr<AuthConfigFactory> authConfigFactory_;
|
2008-11-03 10:06:25 +00:00
|
|
|
|
2013-05-11 02:04:47 +00:00
|
|
|
#ifdef ENABLE_WEBSOCKET
|
2013-07-06 09:33:59 +00:00
|
|
|
std::unique_ptr<rpc::WebSocketSessionMan> webSocketSessionMan_;
|
2013-05-11 02:04:47 +00:00
|
|
|
#endif // ENABLE_WEBSOCKET
|
|
|
|
|
2007-10-11 16:58:24 +00:00
|
|
|
/**
|
|
|
|
* Delegates to StatCalc
|
|
|
|
*/
|
|
|
|
void calculateStatistics();
|
|
|
|
|
|
|
|
void onEndOfRun();
|
|
|
|
|
|
|
|
void afterEachIteration();
|
2012-10-01 14:52:22 +00:00
|
|
|
|
2010-05-21 13:54:50 +00:00
|
|
|
void poolSocket(const std::string& key, const SocketPoolEntry& entry);
|
2010-05-21 12:22:04 +00:00
|
|
|
|
2008-09-24 17:01:57 +00:00
|
|
|
std::multimap<std::string, SocketPoolEntry>::iterator
|
2010-05-21 13:54:50 +00:00
|
|
|
findSocketPoolEntry(const std::string& key);
|
2010-06-08 14:11:36 +00:00
|
|
|
|
2013-07-05 15:59:43 +00:00
|
|
|
std::unique_ptr<RequestGroupMan> requestGroupMan_;
|
2013-07-05 15:30:30 +00:00
|
|
|
std::unique_ptr<FileAllocationMan> fileAllocationMan_;
|
|
|
|
std::unique_ptr<CheckIntegrityMan> checkIntegrityMan_;
|
2010-06-21 13:51:56 +00:00
|
|
|
Option* option_;
|
2013-09-25 14:35:18 +00:00
|
|
|
// Ensure that Commands are cleaned up before requestGroupMan_ is
|
|
|
|
// deleted.
|
|
|
|
std::deque<std::unique_ptr<Command>> routineCommands_;
|
|
|
|
std::deque<std::unique_ptr<Command>> commands_;
|
2014-04-19 17:10:06 +00:00
|
|
|
|
|
|
|
std::unique_ptr<util::security::HMAC> tokenHMAC_;
|
|
|
|
std::unique_ptr<util::security::HMACResult> tokenExpected_;
|
|
|
|
|
2012-10-01 14:52:22 +00:00
|
|
|
public:
|
2013-07-06 10:39:16 +00:00
|
|
|
DownloadEngine(std::unique_ptr<EventPoll> eventPoll);
|
2008-02-08 15:53:45 +00:00
|
|
|
|
2010-06-08 14:11:36 +00:00
|
|
|
~DownloadEngine();
|
2006-02-17 13:35:04 +00:00
|
|
|
|
2013-04-25 12:46:31 +00:00
|
|
|
// If oneshot is true, this function returns after one event polling
|
|
|
|
// and performing action for them. This function returns 1 when
|
|
|
|
// oneshot is true and there are still downloads to be
|
|
|
|
// processed. Otherwise, returns 0.
|
|
|
|
int run(bool oneshot=false);
|
2006-02-17 13:35:04 +00:00
|
|
|
|
2013-06-21 16:10:38 +00:00
|
|
|
bool addSocketForReadCheck(const std::shared_ptr<SocketCore>& socket,
|
2010-01-05 16:01:46 +00:00
|
|
|
Command* command);
|
2013-06-21 16:10:38 +00:00
|
|
|
bool deleteSocketForReadCheck(const std::shared_ptr<SocketCore>& socket,
|
2010-01-05 16:01:46 +00:00
|
|
|
Command* command);
|
2013-06-21 16:10:38 +00:00
|
|
|
bool addSocketForWriteCheck(const std::shared_ptr<SocketCore>& socket,
|
2010-01-05 16:01:46 +00:00
|
|
|
Command* command);
|
2013-06-21 16:10:38 +00:00
|
|
|
bool deleteSocketForWriteCheck(const std::shared_ptr<SocketCore>& socket,
|
2010-01-05 16:01:46 +00:00
|
|
|
Command* command);
|
2008-05-31 10:31:07 +00:00
|
|
|
|
2006-08-21 13:18:51 +00:00
|
|
|
#ifdef ENABLE_ASYNC_DNS
|
2008-05-31 10:31:07 +00:00
|
|
|
|
2013-06-21 16:10:38 +00:00
|
|
|
bool addNameResolverCheck(const std::shared_ptr<AsyncNameResolver>& resolver,
|
2010-01-05 16:01:46 +00:00
|
|
|
Command* command);
|
2013-06-21 16:10:38 +00:00
|
|
|
bool deleteNameResolverCheck(const std::shared_ptr<AsyncNameResolver>& resolver,
|
2010-01-05 16:01:46 +00:00
|
|
|
Command* command);
|
2006-08-21 13:18:51 +00:00
|
|
|
#endif // ENABLE_ASYNC_DNS
|
2007-05-20 13:51:52 +00:00
|
|
|
|
2013-06-23 12:55:52 +00:00
|
|
|
void addCommand(std::vector<std::unique_ptr<Command>> commands);
|
2010-06-08 14:11:36 +00:00
|
|
|
|
2013-06-23 12:55:52 +00:00
|
|
|
void addCommand(std::unique_ptr<Command> command);
|
2010-06-08 14:11:36 +00:00
|
|
|
|
2013-07-05 15:59:43 +00:00
|
|
|
const std::unique_ptr<RequestGroupMan>& getRequestGroupMan() const
|
2010-06-08 14:11:36 +00:00
|
|
|
{
|
2010-06-21 13:51:56 +00:00
|
|
|
return requestGroupMan_;
|
2010-06-08 14:11:36 +00:00
|
|
|
}
|
|
|
|
|
2013-07-05 15:59:43 +00:00
|
|
|
void setRequestGroupMan(std::unique_ptr<RequestGroupMan> rgman);
|
2010-06-08 14:11:36 +00:00
|
|
|
|
2013-07-05 15:30:30 +00:00
|
|
|
const std::unique_ptr<FileAllocationMan>& getFileAllocationMan() const
|
2010-06-08 14:11:36 +00:00
|
|
|
{
|
2010-06-21 13:51:56 +00:00
|
|
|
return fileAllocationMan_;
|
2010-06-08 14:11:36 +00:00
|
|
|
}
|
|
|
|
|
2013-07-05 15:30:30 +00:00
|
|
|
void setFileAllocationMan(std::unique_ptr<FileAllocationMan> faman);
|
2010-06-08 14:11:36 +00:00
|
|
|
|
2013-07-05 15:30:30 +00:00
|
|
|
const std::unique_ptr<CheckIntegrityMan>& getCheckIntegrityMan() const
|
2010-06-08 14:11:36 +00:00
|
|
|
{
|
2010-06-21 13:51:56 +00:00
|
|
|
return checkIntegrityMan_;
|
2010-06-08 14:11:36 +00:00
|
|
|
}
|
|
|
|
|
2013-07-05 15:30:30 +00:00
|
|
|
void setCheckIntegrityMan(std::unique_ptr<CheckIntegrityMan> ciman);
|
2010-06-08 14:11:36 +00:00
|
|
|
|
|
|
|
Option* getOption() const
|
|
|
|
{
|
2010-06-21 13:51:56 +00:00
|
|
|
return option_;
|
2010-06-08 14:11:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void setOption(Option* op)
|
|
|
|
{
|
2010-06-21 13:51:56 +00:00
|
|
|
option_ = op;
|
2010-06-08 14:11:36 +00:00
|
|
|
}
|
2007-10-11 16:58:24 +00:00
|
|
|
|
2013-07-06 10:26:30 +00:00
|
|
|
void setStatCalc(std::unique_ptr<StatCalc> statCalc);
|
2007-10-11 16:58:24 +00:00
|
|
|
|
|
|
|
bool isHaltRequested() const
|
2007-05-20 13:51:52 +00:00
|
|
|
{
|
2010-06-21 13:51:56 +00:00
|
|
|
return haltRequested_;
|
2007-05-20 13:51:52 +00:00
|
|
|
}
|
2008-02-11 05:07:08 +00:00
|
|
|
|
2013-02-24 15:56:49 +00:00
|
|
|
bool isForceHaltRequested() const
|
|
|
|
{
|
|
|
|
return haltRequested_ >= 2;
|
|
|
|
}
|
|
|
|
|
2008-02-11 05:07:08 +00:00
|
|
|
void requestHalt();
|
2008-04-20 05:42:15 +00:00
|
|
|
|
2010-04-02 14:23:59 +00:00
|
|
|
void requestForceHalt();
|
|
|
|
|
2008-04-20 05:42:15 +00:00
|
|
|
void setNoWait(bool b);
|
|
|
|
|
2013-06-23 12:55:52 +00:00
|
|
|
void addRoutineCommand(std::unique_ptr<Command> command);
|
2008-04-22 08:52:47 +00:00
|
|
|
|
2010-05-21 13:54:50 +00:00
|
|
|
void poolSocket(const std::string& ipaddr, uint16_t port,
|
|
|
|
const std::string& username,
|
|
|
|
const std::string& proxyhost, uint16_t proxyport,
|
2013-06-21 16:10:38 +00:00
|
|
|
const std::shared_ptr<SocketCore>& sock,
|
2012-09-26 14:00:05 +00:00
|
|
|
const std::string& options,
|
2010-10-19 14:02:47 +00:00
|
|
|
time_t timeout = 15);
|
2010-05-21 13:54:50 +00:00
|
|
|
|
2013-06-21 16:10:38 +00:00
|
|
|
void poolSocket(const std::shared_ptr<Request>& request,
|
2010-05-21 12:22:04 +00:00
|
|
|
const std::string& username,
|
2013-06-21 16:10:38 +00:00
|
|
|
const std::shared_ptr<Request>& proxyRequest,
|
|
|
|
const std::shared_ptr<SocketCore>& socket,
|
2012-09-26 14:00:05 +00:00
|
|
|
const std::string& options,
|
2010-01-05 16:01:46 +00:00
|
|
|
time_t timeout = 15);
|
2012-09-26 14:00:05 +00:00
|
|
|
|
2010-05-21 13:54:50 +00:00
|
|
|
void poolSocket(const std::string& ipaddr, uint16_t port,
|
|
|
|
const std::string& proxyhost, uint16_t proxyport,
|
2013-06-21 16:10:38 +00:00
|
|
|
const std::shared_ptr<SocketCore>& sock,
|
2010-10-19 14:02:47 +00:00
|
|
|
time_t timeout = 15);
|
2010-05-21 13:54:50 +00:00
|
|
|
|
2013-06-21 16:10:38 +00:00
|
|
|
void poolSocket(const std::shared_ptr<Request>& request,
|
|
|
|
const std::shared_ptr<Request>& proxyRequest,
|
|
|
|
const std::shared_ptr<SocketCore>& socket,
|
2010-01-05 16:01:46 +00:00
|
|
|
time_t timeout = 15);
|
2008-11-05 12:30:22 +00:00
|
|
|
|
2013-06-21 16:10:38 +00:00
|
|
|
std::shared_ptr<SocketCore> popPooledSocket
|
2010-05-21 13:54:50 +00:00
|
|
|
(const std::string& ipaddr,
|
|
|
|
uint16_t port,
|
|
|
|
const std::string& proxyhost, uint16_t proxyport);
|
2008-05-08 11:18:36 +00:00
|
|
|
|
2013-06-21 16:10:38 +00:00
|
|
|
std::shared_ptr<SocketCore> popPooledSocket
|
2012-09-26 14:00:05 +00:00
|
|
|
(std::string& options,
|
2008-09-24 17:01:57 +00:00
|
|
|
const std::string& ipaddr,
|
2010-05-21 12:22:04 +00:00
|
|
|
uint16_t port,
|
2010-05-21 13:54:50 +00:00
|
|
|
const std::string& username,
|
|
|
|
const std::string& proxyhost, uint16_t proxyport);
|
2008-05-08 11:18:36 +00:00
|
|
|
|
2013-06-21 16:10:38 +00:00
|
|
|
std::shared_ptr<SocketCore>
|
2010-05-21 13:54:50 +00:00
|
|
|
popPooledSocket
|
|
|
|
(const std::vector<std::string>& ipaddrs, uint16_t port);
|
2008-09-01 13:46:03 +00:00
|
|
|
|
2013-06-21 16:10:38 +00:00
|
|
|
std::shared_ptr<SocketCore>
|
2008-09-24 17:01:57 +00:00
|
|
|
popPooledSocket
|
2012-09-26 14:00:05 +00:00
|
|
|
(std::string& options,
|
2010-02-28 12:30:11 +00:00
|
|
|
const std::vector<std::string>& ipaddrs,
|
2010-05-21 12:22:04 +00:00
|
|
|
uint16_t port,
|
|
|
|
const std::string& username);
|
2008-09-24 17:01:57 +00:00
|
|
|
|
2013-06-26 14:56:43 +00:00
|
|
|
const std::unique_ptr<CookieStorage>& getCookieStorage() const;
|
2008-11-03 06:49:02 +00:00
|
|
|
|
2009-07-25 14:07:46 +00:00
|
|
|
#ifdef ENABLE_BITTORRENT
|
2013-07-06 09:42:57 +00:00
|
|
|
const std::unique_ptr<BtRegistry>& getBtRegistry() const
|
2009-05-29 12:12:22 +00:00
|
|
|
{
|
2010-06-21 13:51:56 +00:00
|
|
|
return btRegistry_;
|
2009-05-29 12:12:22 +00:00
|
|
|
}
|
2009-07-25 14:07:46 +00:00
|
|
|
#endif // ENABLE_BITTORRENT
|
2008-11-03 07:49:13 +00:00
|
|
|
|
2009-03-19 13:54:09 +00:00
|
|
|
cuid_t newCUID();
|
2008-11-03 08:18:58 +00:00
|
|
|
|
2009-07-02 15:18:13 +00:00
|
|
|
const std::string& findCachedIPAddress
|
|
|
|
(const std::string& hostname, uint16_t port) const;
|
2008-11-03 08:18:58 +00:00
|
|
|
|
2010-01-06 14:31:41 +00:00
|
|
|
template<typename OutputIterator>
|
|
|
|
void findAllCachedIPAddresses
|
|
|
|
(OutputIterator out, const std::string& hostname, uint16_t port) const
|
|
|
|
{
|
2010-06-21 13:51:56 +00:00
|
|
|
dnsCache_->findAll(out, hostname, port);
|
2010-01-06 14:31:41 +00:00
|
|
|
}
|
|
|
|
|
2009-07-02 15:18:13 +00:00
|
|
|
void cacheIPAddress
|
|
|
|
(const std::string& hostname, const std::string& ipaddr, uint16_t port);
|
|
|
|
|
|
|
|
void markBadIPAddress
|
|
|
|
(const std::string& hostname, const std::string& ipaddr, uint16_t port);
|
|
|
|
|
|
|
|
void removeCachedIPAddress(const std::string& hostname, uint16_t port);
|
2008-11-03 10:06:25 +00:00
|
|
|
|
2013-06-25 13:06:29 +00:00
|
|
|
void setAuthConfigFactory(std::unique_ptr<AuthConfigFactory> factory);
|
2008-11-03 10:06:25 +00:00
|
|
|
|
2013-06-26 14:56:43 +00:00
|
|
|
const std::unique_ptr<AuthConfigFactory>& getAuthConfigFactory() const;
|
2008-11-11 16:05:42 +00:00
|
|
|
|
2010-07-28 12:31:55 +00:00
|
|
|
void setRefreshInterval(int64_t interval);
|
2010-01-17 11:55:22 +00:00
|
|
|
|
|
|
|
const std::string getSessionId() const
|
|
|
|
{
|
2010-06-21 13:51:56 +00:00
|
|
|
return sessionId_;
|
2010-01-17 11:55:22 +00:00
|
|
|
}
|
2011-02-08 14:05:40 +00:00
|
|
|
|
2011-02-17 16:04:11 +00:00
|
|
|
#ifdef HAVE_ARES_ADDR_NODE
|
2011-02-08 14:05:40 +00:00
|
|
|
void setAsyncDNSServers(ares_addr_node* asyncDNSServers);
|
|
|
|
|
|
|
|
ares_addr_node* getAsyncDNSServers() const
|
|
|
|
{
|
|
|
|
return asyncDNSServers_;
|
|
|
|
}
|
2011-02-17 16:04:11 +00:00
|
|
|
#endif // HAVE_ARES_ADDR_NODE
|
2013-05-11 02:04:47 +00:00
|
|
|
|
|
|
|
#ifdef ENABLE_WEBSOCKET
|
2013-07-06 09:33:59 +00:00
|
|
|
void setWebSocketSessionMan(std::unique_ptr<rpc::WebSocketSessionMan> wsman);
|
|
|
|
const std::unique_ptr<rpc::WebSocketSessionMan>& getWebSocketSessionMan()
|
|
|
|
const
|
2013-05-11 02:04:47 +00:00
|
|
|
{
|
|
|
|
return webSocketSessionMan_;
|
|
|
|
}
|
|
|
|
#endif // ENABLE_WEBSOCKET
|
2014-04-19 17:10:06 +00:00
|
|
|
|
|
|
|
bool validateToken(const std::string& token);
|
2006-02-17 13:35:04 +00:00
|
|
|
};
|
|
|
|
|
2008-02-08 15:53:45 +00:00
|
|
|
} // namespace aria2
|
|
|
|
|
2010-10-31 07:23:53 +00:00
|
|
|
#endif // D_DOWNLOAD_ENGINE_H
|
2006-02-17 13:35:04 +00:00
|
|
|
|