2006-02-21 14:00:58 +00:00
|
|
|
/* <!-- copyright */
|
|
|
|
/*
|
2006-09-21 15:31:24 +00:00
|
|
|
* aria2 - The high speed download utility
|
2006-02-21 14:00:58 +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
|
2006-09-21 15:31:24 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*
|
|
|
|
* 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-21 14:00:58 +00:00
|
|
|
*/
|
|
|
|
/* copyright --> */
|
|
|
|
#ifndef _D_PREFS_H_
|
|
|
|
#define _D_PREFS_H_
|
|
|
|
|
2006-02-28 02:25:45 +00:00
|
|
|
#include "common.h"
|
|
|
|
|
2006-02-21 14:00:58 +00:00
|
|
|
/**
|
|
|
|
* Constants
|
|
|
|
*/
|
|
|
|
#define V_TRUE "true"
|
2006-04-12 13:55:43 +00:00
|
|
|
#define V_FALSE "false"
|
2006-02-21 14:00:58 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* General preferences
|
|
|
|
*/
|
|
|
|
// values: 1*digit
|
|
|
|
#define PREF_RETRY_WAIT "retry_wait"
|
|
|
|
// values: 1*digit
|
|
|
|
#define PREF_TIMEOUT "timeout"
|
|
|
|
// values: 1*digit
|
2006-10-01 14:11:29 +00:00
|
|
|
#define PREF_DNS_TIMEOUT "dns_timeout"
|
|
|
|
// values: 1*digit
|
2006-02-22 11:18:47 +00:00
|
|
|
#define PREF_MAX_TRIES "max_try"
|
|
|
|
// values: 1*digit
|
|
|
|
#define PREF_MIN_SEGMENT_SIZE "min_segment_size"
|
2006-03-21 14:12:51 +00:00
|
|
|
// values: 1*digit
|
|
|
|
#define PREF_AUTO_SAVE_INTERVAL "auto_save_interval"
|
2006-08-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* src/Option.h
(getAsBool): New function.
* src/Option.cc
(prefs.h): Included.
(defined): 0-length value is now recognized as undefined.
(getAsInt): Rewritten.
(getAsLLInt): Rewritten.
(getAsBool): New function.
* src/FeatureConfig.h: Rewritten.
* src/FeatureConfig.cc: Rewritten.
* src/prefs.h
(PREF_STDOUT_LOG): New definition.
(PREF_LOG): New definition.
(PREF_DIR): New definition.
(PREF_OUT): New definition.
(PREF_SPLIT): New definition.
(PREF_DAEMON): New definition.
(PREF_REFERER): New definition.
(PREF_TORRENT_FILE): New definition.
(PREF_LISTEN_PORT): New definition.
(PREF_METALINK_FILE): New definition.
(PREF_METALINK_VERSION): New definition.
(PREF_METALINK_LANGUAGE): New definition.
(PREF_METALINK_OS): New definition.
(PREF_METALINK_SERVERS): New definition.
* src/main.cc
(main): Following command-line parameters are now put into
Option
class: stdoutLog, logfile, dir, ufilename, split, daemonMode,
referer, torrentFile, metalinkFile, listenPort, metalinkVersion,
metalinkLanguage, metalinkOs, metalinkServers
To fix the bug that aria2 can not handle http response header
properly.
* src/HttpHeader.cc
(put): Made name lowercased.
(defined): Made name lowercased.
(getFirst): Made name lowercased.
(get): Made name lowercased.
(getFirstAsInt): Rewritten.
(getFirstAsLLInt): Rewritten.
2006-08-03 12:36:02 +00:00
|
|
|
// values: true | false
|
|
|
|
#define PREF_STDOUT_LOG "stdout_log"
|
|
|
|
// values: a string that your file system recognizes as a file name.
|
|
|
|
#define PREF_LOG "log"
|
|
|
|
// values: a string that your file system recognizes as a directory.
|
|
|
|
#define PREF_DIR "dir"
|
|
|
|
// values: a string that your file system recognizes as a file name.
|
|
|
|
#define PREF_OUT "out"
|
|
|
|
// values: 1*digit
|
|
|
|
#define PREF_SPLIT "split"
|
|
|
|
// value: true | false
|
|
|
|
#define PREF_DAEMON "daemon"
|
|
|
|
// value: a string
|
|
|
|
#define PREF_REFERER "referer"
|
2006-09-19 14:52:59 +00:00
|
|
|
// value: 1*digit
|
2006-08-07 16:05:00 +00:00
|
|
|
#define PREF_LOWEST_SPEED_LIMIT "lowest_speed_limit"
|
2006-09-19 14:52:59 +00:00
|
|
|
// value: 1*digit
|
|
|
|
#define PREF_SEGMENT_SIZE "segment_size"
|
|
|
|
// value: 1*digit
|
2006-09-21 14:37:15 +00:00
|
|
|
#define PREF_MAX_DOWNLOAD_LIMIT "max_download_limit"
|
2006-09-21 06:56:54 +00:00
|
|
|
// value: 1*digit
|
|
|
|
#define PREF_STARTUP_IDLE_TIME "startup_idle_time"
|
2006-02-21 14:00:58 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* FTP related preferences
|
|
|
|
*/
|
|
|
|
#define PREF_FTP_USER "ftp_user"
|
|
|
|
#define PREF_FTP_PASSWD "ftp_passwd"
|
|
|
|
// values: binary | ascii
|
|
|
|
#define PREF_FTP_TYPE "ftp_type"
|
|
|
|
# define V_BINARY "binary"
|
|
|
|
# define V_ASCII "ascii"
|
|
|
|
// values: get | tunnel
|
|
|
|
#define PREF_FTP_VIA_HTTP_PROXY "ftp_via_http_proxy"
|
|
|
|
# define V_GET "get"
|
|
|
|
# define V_TUNNEL "tunnel"
|
|
|
|
// values: true | false
|
|
|
|
#define PREF_FTP_PASV_ENABLED "ftp_pasv_enabled"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* HTTP related preferences
|
|
|
|
*/
|
|
|
|
#define PREF_HTTP_USER "http_user"
|
|
|
|
#define PREF_HTTP_PASSWD "http_passwd"
|
|
|
|
// values: basic
|
|
|
|
#define PREF_HTTP_AUTH_SCHEME "http_auth_scheme"
|
|
|
|
# define V_BASIC "basic"
|
2006-04-19 17:23:58 +00:00
|
|
|
// values: true | false
|
|
|
|
#define PREF_HTTP_AUTH_ENABLED "http_auth_enabled"
|
2006-09-19 14:52:59 +00:00
|
|
|
// values: true | false
|
|
|
|
#define PREF_HTTP_KEEP_ALIVE "http_keep_alive"
|
2006-02-21 14:00:58 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* HTTP proxy related preferences
|
|
|
|
*/
|
|
|
|
#define PREF_HTTP_PROXY_USER "http_proxy_user"
|
|
|
|
#define PREF_HTTP_PROXY_PASSWD "http_proxy_passwd"
|
|
|
|
#define PREF_HTTP_PROXY_HOST "http_proxy_host"
|
|
|
|
#define PREF_HTTP_PROXY_PORT "http_proxy_port"
|
2006-02-22 15:40:04 +00:00
|
|
|
// values: get | tunnel
|
|
|
|
#define PREF_HTTP_PROXY_METHOD "http_proxy_method"
|
2006-02-21 14:00:58 +00:00
|
|
|
// values: true | false
|
|
|
|
#define PREF_HTTP_PROXY_ENABLED "http_proxy_enabled"
|
|
|
|
// values: true | false
|
|
|
|
#define PREF_HTTP_PROXY_AUTH_ENABLED "http_proxy_auth_enabled"
|
|
|
|
|
Added new class SendMessageQueue that includes PendingMessages
and
RequestSlotMan.
* src/SendMessageQueue.h: New class.
* src/SendMessageQueue.cc: New class.
* src/PendingMessage.h: Added new member variable blockIndex and
its
accessors.
(createRequestMessage): Updated.
* src/PendingMessage.cc (createRequestMessage): Updated.
* src/PeerInteractionCommand.cc (executeInternal): Updated with
SendMessageQueue.
(checkLongTimePeerChoking): Updated with SendMessageQueue.
(receiveMessage): Updated with SendMessageQueue.
(deletePendingPieceMessage): Removed.
(getNewPieceAndSendInterest): Updated with SendMessageQueue.
(sendInterest): Updated with SendMessageQueue.
(createRequestPendingMessage): Updated with SendMessageQueue.
(sendMessages): Updated with SendMessageQueue.
(onAbort): Updated with SendMessageQueue.
(keepAlive): Updated with SendMessageQueue.
(beforeSocketCheck): Updated SendMessageQueue.
* src/PeerInteractionCommand (sendMessages): Shuffle
missingBLockIndexes before using it.
Added its own timeout for peer connection.
* src/PeerAbstractCommand.h: Added member variable timeout and
its
setter.
* src/prefs.h: Added PREF_PEER_CONNECTION_TIMEOUT.
* src/PeerInteractionCommand.cc (PeerInteractionCommand):
Added setTimeout() call.
(executeInternal): Added setTimeout() call.
* src/PeerAbstractCommand.cc (PeerAbstractCommand):
Added timeout.
(isTimeoutDetected): Updated.
* src/main.cc (main): Added PREF_PEER_CONNECTION_TIMEOUT entry
to
option.
Added *simple* message flooding checker.
* src/PeerInteractionCommand.cc (executeInternal):
Added detectMessageFlooding() call.
(detectMessageFlooding): New function.
(receiveMessage): Count up CHOKE, UNCHOKE, HAVE message.
(beforeSocketCheck): Added detectMessageFlooding() call.
* src/PeerInteractionCommand.h: Added sendMessageQueue,
chokeUnchokeCount, haveCount, detectMessageFlooding().
Removed deletePendingPieceMessage(), getRequestSlot(),
deleteRequestSlot(), deleteAllRequestSlot().
* src/PeerInteractionCommand.cc (beforeSocketCheck):
Added checkLongTimePeerChoking() call.
* src/RequestSlotMan.h: Renamed deleteTimeoutRequestSlot().
* src/TorrentMan.cc (addPeer): Delete at most MAX_PEER_LIST_SIZE
peers
if duplicate == false.
The parameter "uploaded" and "downloaded" in the tracker request
are
the size since the client sent the "started" event to the
tracker.
* src/TorrentMan.cc (setup): Assigned saved downloaded Size and
uploaded size to preDownloadedSize, preUploadedSize
respectively.
* src/TorrentMan.h: Added preDownloadedSize, preUploadedSize,
getSessionDownloadedSize(), getSessionUploadedSize().
* src/TrackerInitCommand.cc (execute): Use
getSessionDownloadedSize(),
getSessionUploadedSize() instead of getDownloadedSize(),
getUploadedSize().
* src/PendingMessage.cc (processMessage): Do not send request
message
if the peer is choking the client.
* src/TrackerUpdateCommand.cc (execute): Check wtheher
minInterval is
less than interval.
2006-03-28 15:23:51 +00:00
|
|
|
/**
|
|
|
|
* BitTorrent related preferences
|
|
|
|
*/
|
|
|
|
// values: 1*digit
|
|
|
|
#define PREF_PEER_CONNECTION_TIMEOUT "peer_connection_timeout"
|
2006-04-01 14:39:45 +00:00
|
|
|
// values: true | false
|
2006-04-16 14:38:19 +00:00
|
|
|
#define PREF_SHOW_FILES "show_files"
|
2006-04-06 12:52:16 +00:00
|
|
|
// values: true | false
|
|
|
|
#define PREF_NO_PREALLOCATION "no_preallocation"
|
2006-04-12 13:55:43 +00:00
|
|
|
// values: true | false
|
|
|
|
#define PREF_DIRECT_FILE_MAPPING "direct_file_mapping"
|
2006-04-28 15:55:11 +00:00
|
|
|
// values: 1*digit
|
2006-09-21 14:37:15 +00:00
|
|
|
#define PREF_MAX_UPLOAD_LIMIT "max_upload_limit"
|
2006-08-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* src/Option.h
(getAsBool): New function.
* src/Option.cc
(prefs.h): Included.
(defined): 0-length value is now recognized as undefined.
(getAsInt): Rewritten.
(getAsLLInt): Rewritten.
(getAsBool): New function.
* src/FeatureConfig.h: Rewritten.
* src/FeatureConfig.cc: Rewritten.
* src/prefs.h
(PREF_STDOUT_LOG): New definition.
(PREF_LOG): New definition.
(PREF_DIR): New definition.
(PREF_OUT): New definition.
(PREF_SPLIT): New definition.
(PREF_DAEMON): New definition.
(PREF_REFERER): New definition.
(PREF_TORRENT_FILE): New definition.
(PREF_LISTEN_PORT): New definition.
(PREF_METALINK_FILE): New definition.
(PREF_METALINK_VERSION): New definition.
(PREF_METALINK_LANGUAGE): New definition.
(PREF_METALINK_OS): New definition.
(PREF_METALINK_SERVERS): New definition.
* src/main.cc
(main): Following command-line parameters are now put into
Option
class: stdoutLog, logfile, dir, ufilename, split, daemonMode,
referer, torrentFile, metalinkFile, listenPort, metalinkVersion,
metalinkLanguage, metalinkOs, metalinkServers
To fix the bug that aria2 can not handle http response header
properly.
* src/HttpHeader.cc
(put): Made name lowercased.
(defined): Made name lowercased.
(getFirst): Made name lowercased.
(get): Made name lowercased.
(getFirstAsInt): Rewritten.
(getFirstAsLLInt): Rewritten.
2006-08-03 12:36:02 +00:00
|
|
|
// values: a string that your file system recognizes as a file name.
|
|
|
|
#define PREF_TORRENT_FILE "torrent_file"
|
|
|
|
// values: 1*digit
|
|
|
|
#define PREF_LISTEN_PORT "listen_port"
|
2006-08-07 16:05:00 +00:00
|
|
|
// values: true | false
|
|
|
|
#define PREF_FOLLOW_TORRENT "follow_torrent"
|
|
|
|
// values: 1*digit *( (,|-) 1*digit)
|
|
|
|
#define PREF_SELECT_FILE "select_file"
|
2006-08-27 12:49:17 +00:00
|
|
|
// values: 1*digit
|
|
|
|
#define PREF_SEED_TIME "seed_time"
|
|
|
|
// values: 1*digit ['.' [ 1*digit ] ]
|
|
|
|
#define PREF_SEED_RATIO "seed_ratio"
|
2006-08-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* src/Option.h
(getAsBool): New function.
* src/Option.cc
(prefs.h): Included.
(defined): 0-length value is now recognized as undefined.
(getAsInt): Rewritten.
(getAsLLInt): Rewritten.
(getAsBool): New function.
* src/FeatureConfig.h: Rewritten.
* src/FeatureConfig.cc: Rewritten.
* src/prefs.h
(PREF_STDOUT_LOG): New definition.
(PREF_LOG): New definition.
(PREF_DIR): New definition.
(PREF_OUT): New definition.
(PREF_SPLIT): New definition.
(PREF_DAEMON): New definition.
(PREF_REFERER): New definition.
(PREF_TORRENT_FILE): New definition.
(PREF_LISTEN_PORT): New definition.
(PREF_METALINK_FILE): New definition.
(PREF_METALINK_VERSION): New definition.
(PREF_METALINK_LANGUAGE): New definition.
(PREF_METALINK_OS): New definition.
(PREF_METALINK_SERVERS): New definition.
* src/main.cc
(main): Following command-line parameters are now put into
Option
class: stdoutLog, logfile, dir, ufilename, split, daemonMode,
referer, torrentFile, metalinkFile, listenPort, metalinkVersion,
metalinkLanguage, metalinkOs, metalinkServers
To fix the bug that aria2 can not handle http response header
properly.
* src/HttpHeader.cc
(put): Made name lowercased.
(defined): Made name lowercased.
(getFirst): Made name lowercased.
(get): Made name lowercased.
(getFirstAsInt): Rewritten.
(getFirstAsLLInt): Rewritten.
2006-08-03 12:36:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Metalink related preferences
|
|
|
|
*/
|
|
|
|
// values: a string that your file system recognizes as a file name.
|
|
|
|
#define PREF_METALINK_FILE "metalink_file"
|
|
|
|
// values: a string
|
|
|
|
#define PREF_METALINK_VERSION "metalink_version"
|
|
|
|
// values: a string
|
|
|
|
#define PREF_METALINK_LANGUAGE "metalink_language"
|
|
|
|
// values: a string
|
|
|
|
#define PREF_METALINK_OS "metalink_os"
|
|
|
|
// values: 1*digit
|
|
|
|
#define PREF_METALINK_SERVERS "metalink_servers"
|
2006-08-07 16:05:00 +00:00
|
|
|
// values: true | false
|
|
|
|
#define PREF_FOLLOW_METALINK "follow_metalink"
|
2006-04-12 13:55:43 +00:00
|
|
|
|
2006-02-21 14:00:58 +00:00
|
|
|
#endif // _D_PREFS_H_
|