prefs.cc 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
  1. /* <!-- copyright */
  2. /*
  3. * aria2 - The high speed download utility
  4. *
  5. * Copyright (C) 2006 Tatsuhiro Tsujikawa
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. *
  21. * In addition, as a special exception, the copyright holders give
  22. * permission to link the code of portions of this program with the
  23. * OpenSSL library under certain conditions as described in each
  24. * individual source file, and distribute linked combinations
  25. * including the two.
  26. * You must obey the GNU General Public License in all respects
  27. * for all of the code used other than OpenSSL. If you modify
  28. * file(s) with this exception, you may extend this exception to your
  29. * version of the file(s), but you are not obligated to do so. If you
  30. * do not wish to do so, delete this exception statement from your
  31. * version. If you delete this exception statement from all source
  32. * files in the program, then also delete it here.
  33. */
  34. /* copyright --> */
  35. #include "prefs.h"
  36. namespace aria2 {
  37. /**
  38. * Constants
  39. */
  40. const std::string V_TRUE("true");
  41. const std::string V_FALSE("false");
  42. const std::string V_NONE("none");
  43. const std::string V_MEM("mem");
  44. const std::string V_ALL("all");
  45. /**
  46. * General preferences
  47. */
  48. // values: 1*digit
  49. const std::string PREF_TIMEOUT("timeout");
  50. // values: 1*digit
  51. const std::string PREF_DNS_TIMEOUT("dns-timeout");
  52. // values: 1*digit
  53. const std::string PREF_CONNECT_TIMEOUT("connect-timeout");
  54. // values: 1*digit
  55. const std::string PREF_MAX_TRIES("max-tries");
  56. // values: 1*digit
  57. const std::string PREF_AUTO_SAVE_INTERVAL("auto-save-interval");
  58. // values: a string that your file system recognizes as a file name.
  59. const std::string PREF_LOG("log");
  60. // values: a string that your file system recognizes as a directory.
  61. const std::string PREF_DIR("dir");
  62. // values: a string that your file system recognizes as a file name.
  63. const std::string PREF_OUT("out");
  64. // values: 1*digit
  65. const std::string PREF_SPLIT("split");
  66. // value: true | false
  67. const std::string PREF_DAEMON("daemon");
  68. // value: a string
  69. const std::string PREF_REFERER("referer");
  70. // value: 1*digit
  71. const std::string PREF_LOWEST_SPEED_LIMIT("lowest-speed-limit");
  72. // value: 1*digit
  73. const std::string PREF_SEGMENT_SIZE("segment-size");
  74. // value: 1*digit
  75. const std::string PREF_MAX_OVERALL_DOWNLOAD_LIMIT("max-overall-download-limit");
  76. // value: 1*digit
  77. const std::string PREF_MAX_DOWNLOAD_LIMIT("max-download-limit");
  78. // value: 1*digit
  79. const std::string PREF_STARTUP_IDLE_TIME("startup-idle-time");
  80. // value: prealloc | fallc | none
  81. const std::string PREF_FILE_ALLOCATION("file-allocation");
  82. const std::string V_PREALLOC("prealloc");
  83. const std::string V_FALLOC("falloc");
  84. // value: 1*digit
  85. const std::string PREF_NO_FILE_ALLOCATION_LIMIT("no-file-allocation-limit");
  86. // value: true | false
  87. const std::string PREF_ALLOW_OVERWRITE("allow-overwrite");
  88. // value: true | false
  89. const std::string PREF_REALTIME_CHUNK_CHECKSUM("realtime-chunk-checksum");
  90. // value: true | false
  91. const std::string PREF_CHECK_INTEGRITY("check-integrity");
  92. // value: string that your file system recognizes as a file name.
  93. const std::string PREF_NETRC_PATH("netrc-path");
  94. // value:
  95. const std::string PREF_CONTINUE("continue");
  96. // value:
  97. const std::string PREF_NO_NETRC("no-netrc");
  98. // value: 1*digit
  99. const std::string PREF_MAX_DOWNLOADS("max-downloads");
  100. // value: string that your file system recognizes as a file name.
  101. const std::string PREF_INPUT_FILE("input-file");
  102. // value: 1*digit
  103. const std::string PREF_MAX_CONCURRENT_DOWNLOADS("max-concurrent-downloads");
  104. // value: true | false
  105. const std::string PREF_FORCE_SEQUENTIAL("force-sequential");
  106. // value: true | false
  107. const std::string PREF_AUTO_FILE_RENAMING("auto-file-renaming");
  108. // value: true | false
  109. const std::string PREF_PARAMETERIZED_URI("parameterized-uri");
  110. // value: true | false
  111. const std::string PREF_ENABLE_DIRECT_IO("enable-direct-io");
  112. // value: true | false
  113. const std::string PREF_ALLOW_PIECE_LENGTH_CHANGE("allow-piece-length-change");
  114. // value: true | false
  115. const std::string PREF_NO_CONF("no-conf");
  116. // value: string
  117. const std::string PREF_CONF_PATH("conf-path");
  118. // value: 1*digit
  119. const std::string PREF_STOP("stop");
  120. // value: true | false
  121. const std::string PREF_QUIET("quiet");
  122. // value: true | false
  123. const std::string PREF_ASYNC_DNS("async-dns");
  124. // value: 1*digit
  125. const std::string PREF_SUMMARY_INTERVAL("summary-interval");
  126. // value: debug, info, notice, warn, error
  127. const std::string PREF_LOG_LEVEL("log-level");
  128. const std::string V_DEBUG("debug");
  129. const std::string V_INFO("info");
  130. const std::string V_NOTICE("notice");
  131. const std::string V_WARN("warn");
  132. const std::string V_ERROR("error");
  133. // value: inorder | feedback | adaptive
  134. const std::string PREF_URI_SELECTOR("uri-selector");
  135. const std::string V_INORDER("inorder");
  136. const std::string V_FEEDBACK("feedback");
  137. const std::string V_ADAPTIVE("adaptive");
  138. // value: 1*digit
  139. const std::string PREF_SERVER_STAT_TIMEOUT("server-stat-timeout");
  140. // value: string that your file system recognizes as a file name.
  141. const std::string PREF_SERVER_STAT_IF("server-stat-if");
  142. // value: string that your file system recognizes as a file name.
  143. const std::string PREF_SERVER_STAT_OF("server-stat-of");
  144. // value: true | false
  145. const std::string PREF_REMOTE_TIME("remote-time");
  146. // value: 1*digit
  147. const std::string PREF_MAX_FILE_NOT_FOUND("max-file-not-found");
  148. // value: epoll | select
  149. const std::string PREF_EVENT_POLL("event-poll");
  150. const std::string V_EPOLL("epoll");
  151. const std::string V_KQUEUE("kqueue");
  152. const std::string V_PORT("port");
  153. const std::string V_POLL("poll");
  154. const std::string V_SELECT("select");
  155. // value: 1*digit
  156. const std::string PREF_XML_RPC_LISTEN_PORT("xml-rpc-listen-port");
  157. // value: true | false
  158. const std::string PREF_ENABLE_XML_RPC("enable-xml-rpc");
  159. // value: true | false
  160. const std::string PREF_DRY_RUN("dry-run");
  161. // value: true | false
  162. const std::string PREF_REUSE_URI("reuse-uri");
  163. // value: string
  164. const std::string PREF_XML_RPC_USER("xml-rpc-user");
  165. // value: string
  166. const std::string PREF_XML_RPC_PASSWD("xml-rpc-passwd");
  167. // value: 1*digit
  168. const std::string PREF_XML_RPC_MAX_REQUEST_SIZE("xml-rpc-max-request-size");
  169. // value: string
  170. const std::string PREF_ON_DOWNLOAD_START("on-download-start");
  171. const std::string PREF_ON_DOWNLOAD_PAUSE("on-download-pause");
  172. const std::string PREF_ON_DOWNLOAD_STOP("on-download-stop");
  173. const std::string PREF_ON_DOWNLOAD_COMPLETE("on-download-complete");
  174. const std::string PREF_ON_DOWNLOAD_ERROR("on-download-error");
  175. // value: true | false
  176. const std::string PREF_XML_RPC_LISTEN_ALL("xml-rpc-listen-all");
  177. // value: string
  178. const std::string PREF_INTERFACE("interface");
  179. // value: true | false
  180. const std::string PREF_DISABLE_IPV6("disable-ipv6");
  181. // value: true | false
  182. const std::string PREF_HUMAN_READABLE("human-readable");
  183. // value: true | false
  184. const std::string PREF_REMOVE_CONTROL_FILE("remove-control-file");
  185. // value: true | false
  186. const std::string PREF_ALWAYS_RESUME("always-resume");
  187. // value: 1*digit
  188. const std::string PREF_MAX_RESUME_FAILURE_TRIES("max-resume-failure-tries");
  189. // value: string that your file system recognizes as a file name.
  190. const std::string PREF_SAVE_SESSION("save-session");
  191. // value: 1*digit
  192. const std::string PREF_MAX_CONNECTION_PER_SERVER("max-connection-per-server");
  193. // value: 1*digit
  194. const std::string PREF_MIN_SPLIT_SIZE("min-split-size");
  195. // value: true | false
  196. const std::string PREF_CONDITIONAL_GET("conditional-get");
  197. // value: true | false
  198. const std::string PREF_SELECT_LEAST_USED_HOST("select-least-used-host");
  199. // value: true | false
  200. const std::string PREF_ENABLE_ASYNC_DNS6("enable-async-dns6");
  201. /**
  202. * FTP related preferences
  203. */
  204. const std::string PREF_FTP_USER("ftp-user");
  205. const std::string PREF_FTP_PASSWD("ftp-passwd");
  206. // values: binary | ascii
  207. const std::string PREF_FTP_TYPE("ftp-type");
  208. const std::string V_BINARY("binary");
  209. const std::string V_ASCII("ascii");
  210. // values: true | false
  211. const std::string PREF_FTP_PASV("ftp-pasv");
  212. // values: true | false
  213. const std::string PREF_FTP_REUSE_CONNECTION("ftp-reuse-connection");
  214. /**
  215. * HTTP related preferences
  216. */
  217. const std::string PREF_HTTP_USER("http-user");
  218. const std::string PREF_HTTP_PASSWD("http-passwd");
  219. // values: string
  220. const std::string PREF_USER_AGENT("user-agent");
  221. // value: string that your file system recognizes as a file name.
  222. const std::string PREF_LOAD_COOKIES("load-cookies");
  223. // value: string that your file system recognizes as a file name.
  224. const std::string PREF_SAVE_COOKIES("save-cookies");
  225. // values: true | false
  226. const std::string PREF_ENABLE_HTTP_KEEP_ALIVE("enable-http-keep-alive");
  227. // values: true | false
  228. const std::string PREF_ENABLE_HTTP_PIPELINING("enable-http-pipelining");
  229. // value: 1*digit
  230. const std::string PREF_MAX_HTTP_PIPELINING("max-http-pipelining");
  231. // value: string
  232. const std::string PREF_HEADER("header");
  233. // value: string that your file system recognizes as a file name.
  234. const std::string PREF_CERTIFICATE("certificate");
  235. // value: string that your file system recognizes as a file name.
  236. const std::string PREF_PRIVATE_KEY("private-key");
  237. // value: string that your file system recognizes as a file name.
  238. const std::string PREF_CA_CERTIFICATE("ca-certificate");
  239. // value: true | false
  240. const std::string PREF_CHECK_CERTIFICATE("check-certificate");
  241. // value: true | false
  242. const std::string PREF_USE_HEAD("use-head");
  243. // value: true | false
  244. const std::string PREF_HTTP_AUTH_CHALLENGE("http-auth-challenge");
  245. // value: true | false
  246. const std::string PREF_HTTP_NO_CACHE("http-no-cache");
  247. // value: true | false
  248. const std::string PREF_HTTP_ACCEPT_GZIP("http-accept-gzip");
  249. /**
  250. * Proxy related preferences
  251. */
  252. const std::string PREF_HTTP_PROXY("http-proxy");
  253. const std::string PREF_HTTPS_PROXY("https-proxy");
  254. const std::string PREF_FTP_PROXY("ftp-proxy");
  255. const std::string PREF_ALL_PROXY("all-proxy");
  256. // values: comma separeted hostname or domain
  257. const std::string PREF_NO_PROXY("no-proxy");
  258. // values: get | tunnel
  259. const std::string PREF_PROXY_METHOD("proxy-method");
  260. const std::string V_GET("get");
  261. const std::string V_TUNNEL("tunnel");
  262. const std::string PREF_HTTP_PROXY_USER("http-proxy-user");
  263. const std::string PREF_HTTP_PROXY_PASSWD("http-proxy-passwd");
  264. const std::string PREF_HTTPS_PROXY_USER("https-proxy-user");
  265. const std::string PREF_HTTPS_PROXY_PASSWD("https-proxy-passwd");
  266. const std::string PREF_FTP_PROXY_USER("ftp-proxy-user");
  267. const std::string PREF_FTP_PROXY_PASSWD("ftp-proxy-passwd");
  268. const std::string PREF_ALL_PROXY_USER("all-proxy-user");
  269. const std::string PREF_ALL_PROXY_PASSWD("all-proxy-passwd");
  270. /**
  271. * BitTorrent related preferences
  272. */
  273. // values: 1*digit
  274. const std::string PREF_PEER_CONNECTION_TIMEOUT("peer-connection-timeout");
  275. // values: 1*digit
  276. const std::string PREF_BT_TIMEOUT("bt-timeout");
  277. // values: 1*digit
  278. const std::string PREF_BT_REQUEST_TIMEOUT("bt-request-timeout");
  279. // values: true | false
  280. const std::string PREF_SHOW_FILES("show-files");
  281. // values: 1*digit
  282. const std::string PREF_MAX_OVERALL_UPLOAD_LIMIT("max-overall-upload-limit");
  283. // values: 1*digit
  284. const std::string PREF_MAX_UPLOAD_LIMIT("max-upload-limit");
  285. // values: a string that your file system recognizes as a file name.
  286. const std::string PREF_TORRENT_FILE("torrent-file");
  287. // values: 1*digit
  288. const std::string PREF_LISTEN_PORT("listen-port");
  289. // values: true | false | mem
  290. const std::string PREF_FOLLOW_TORRENT("follow-torrent");
  291. // values: 1*digit *( (,|-) 1*digit);
  292. const std::string PREF_SELECT_FILE("select-file");
  293. // values: 1*digit
  294. const std::string PREF_SEED_TIME("seed-time");
  295. // values: 1*digit ['.' [ 1*digit ] ]
  296. const std::string PREF_SEED_RATIO("seed-ratio");
  297. // values: 1*digit
  298. const std::string PREF_BT_KEEP_ALIVE_INTERVAL("bt-keep-alive-interval");
  299. // values: a string, less than or equals to 20 bytes length
  300. const std::string PREF_PEER_ID_PREFIX("peer-id-prefix");
  301. // values: true | false
  302. const std::string PREF_ENABLE_PEER_EXCHANGE("enable-peer-exchange");
  303. // values: true | false
  304. const std::string PREF_ENABLE_DHT("enable-dht");
  305. // values: 1*digit
  306. const std::string PREF_DHT_LISTEN_PORT("dht-listen-port");
  307. // values: a string
  308. const std::string PREF_DHT_ENTRY_POINT_HOST("dht-entry-point-host");
  309. // values: 1*digit
  310. const std::string PREF_DHT_ENTRY_POINT_PORT("dht-entry-point-port");
  311. // values: a string (hostname:port);
  312. const std::string PREF_DHT_ENTRY_POINT("dht-entry-point");
  313. // values: a string
  314. const std::string PREF_DHT_FILE_PATH("dht-file-path");
  315. // values: plain | arc4
  316. const std::string PREF_BT_MIN_CRYPTO_LEVEL("bt-min-crypto-level");
  317. const std::string V_PLAIN("plain");
  318. const std::string V_ARC4("arc4");
  319. // values:: true | false
  320. const std::string PREF_BT_REQUIRE_CRYPTO("bt-require-crypto");
  321. // values: 1*digit
  322. const std::string PREF_BT_REQUEST_PEER_SPEED_LIMIT("bt-request-peer-speed-limit");
  323. // values: 1*digit
  324. const std::string PREF_BT_MAX_OPEN_FILES("bt-max-open-files");
  325. // values: true | false
  326. const std::string PREF_BT_SEED_UNVERIFIED("bt-seed-unverified");
  327. // values: true | false
  328. const std::string PREF_BT_HASH_CHECK_SEED("bt-hash-check-seed");
  329. // values: 1*digit
  330. const std::string PREF_BT_MAX_PEERS("bt-max-peers");
  331. // values: a string (IP address)
  332. const std::string PREF_BT_EXTERNAL_IP("bt-external-ip");
  333. // values: 1*digit '=' a string that your file system recognizes as a file name.
  334. const std::string PREF_INDEX_OUT("index-out");
  335. // values: 1*digit
  336. const std::string PREF_BT_TRACKER_INTERVAL("bt-tracker-interval");
  337. // values: 1*digit
  338. const std::string PREF_BT_STOP_TIMEOUT("bt-stop-timeout");
  339. // values: head[=SIZE]|tail[=SIZE], ...
  340. const std::string PREF_BT_PRIORITIZE_PIECE("bt-prioritize-piece");
  341. // values: true | false
  342. const std::string PREF_BT_SAVE_METADATA("bt-save-metadata");
  343. // values: true | false
  344. const std::string PREF_BT_METADATA_ONLY("bt-metadata-only");
  345. // values: true | false
  346. const std::string PREF_BT_ENABLE_LPD("bt-enable-lpd");
  347. // values: string
  348. const std::string PREF_BT_LPD_INTERFACE("bt-lpd-interface");
  349. // values: 1*digit
  350. const std::string PREF_BT_TRACKER_TIMEOUT("bt-tracker-timeout");
  351. // values: 1*digit
  352. const std::string PREF_BT_TRACKER_CONNECT_TIMEOUT("bt-tracker-connect-timeout");
  353. // values: 1*digit
  354. const std::string PREF_DHT_MESSAGE_TIMEOUT("dht-message-timeout");
  355. // values: string
  356. const std::string PREF_ON_BT_DOWNLOAD_COMPLETE("on-bt-download-complete");
  357. /**
  358. * Metalink related preferences
  359. */
  360. // values: a string that your file system recognizes as a file name.
  361. const std::string PREF_METALINK_FILE("metalink-file");
  362. // values: a string
  363. const std::string PREF_METALINK_VERSION("metalink-version");
  364. // values: a string
  365. const std::string PREF_METALINK_LANGUAGE("metalink-language");
  366. // values: a string
  367. const std::string PREF_METALINK_OS("metalink-os");
  368. // values: a string
  369. const std::string PREF_METALINK_LOCATION("metalink-location");
  370. // values: 1*digit
  371. const std::string PREF_METALINK_SERVERS("metalink-servers");
  372. // values: true | false | mem
  373. const std::string PREF_FOLLOW_METALINK("follow-metalink");
  374. // values: http | https | ftp | none
  375. const std::string PREF_METALINK_PREFERRED_PROTOCOL("metalink-preferred-protocol");
  376. const std::string V_HTTP("http");
  377. const std::string V_HTTPS("https");
  378. const std::string V_FTP("ftp");
  379. // values: true | false
  380. const std::string PREF_METALINK_ENABLE_UNIQUE_PROTOCOL("metalink-enable-unique-protocol");
  381. } // namespace aria2