prefs.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470
  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. #ifndef D_PREFS_H
  36. #define D_PREFS_H
  37. #include "common.h"
  38. #include <string>
  39. namespace aria2 {
  40. struct Pref {
  41. Pref(const char* k, size_t i);
  42. // Keyword, aka Option Name
  43. const char* k;
  44. // Option ID
  45. size_t i;
  46. };
  47. namespace option {
  48. // Returns the number of options.
  49. size_t countOption();
  50. // Returns Pref whose ID is id. id must be less than countOption().
  51. const Pref* i2p(size_t id);
  52. // Returns Pref whose keyword is k. If no such Pref is found, returns
  53. // special null Pref whose ID is 0.
  54. const Pref* k2p(const std::string& k);
  55. } // namespace option
  56. /**
  57. * Constants
  58. */
  59. extern const std::string A2_V_TRUE;
  60. extern const std::string A2_V_FALSE;
  61. extern const std::string A2_V_DEFAULT;
  62. extern const std::string V_NONE;
  63. extern const std::string V_MEM;
  64. extern const std::string V_ALL;
  65. extern const std::string A2_V_FULL;
  66. extern const std::string A2_V_GEOM;
  67. extern const std::string V_PREALLOC;
  68. extern const std::string V_FALLOC;
  69. extern const std::string V_DEBUG;
  70. extern const std::string V_INFO;
  71. extern const std::string V_NOTICE;
  72. extern const std::string V_WARN;
  73. extern const std::string V_ERROR;
  74. extern const std::string V_INORDER;
  75. extern const std::string V_FEEDBACK;
  76. extern const std::string V_ADAPTIVE;
  77. extern const std::string V_EPOLL;
  78. extern const std::string V_KQUEUE;
  79. extern const std::string V_PORT;
  80. extern const std::string V_POLL;
  81. extern const std::string V_SELECT;
  82. extern const std::string V_BINARY;
  83. extern const std::string V_ASCII;
  84. extern const std::string V_GET;
  85. extern const std::string V_TUNNEL;
  86. extern const std::string V_PLAIN;
  87. extern const std::string V_ARC4;
  88. extern const std::string V_HTTP;
  89. extern const std::string V_HTTPS;
  90. extern const std::string V_FTP;
  91. extern const Pref* PREF_VERSION;
  92. extern const Pref* PREF_HELP;
  93. /**
  94. * General preferences
  95. */
  96. // values: 1*digit
  97. extern const Pref* PREF_TIMEOUT;
  98. // values: 1*digit
  99. extern const Pref* PREF_DNS_TIMEOUT;
  100. // values: 1*digit
  101. extern const Pref* PREF_CONNECT_TIMEOUT;
  102. // values: 1*digit
  103. extern const Pref* PREF_MAX_TRIES;
  104. // values: 1*digit
  105. extern const Pref* PREF_AUTO_SAVE_INTERVAL;
  106. // values: a string that your file system recognizes as a file name.
  107. extern const Pref* PREF_LOG;
  108. // values: a string that your file system recognizes as a directory.
  109. extern const Pref* PREF_DIR;
  110. // values: a string that your file system recognizes as a file name.
  111. extern const Pref* PREF_OUT;
  112. // values: 1*digit
  113. extern const Pref* PREF_SPLIT;
  114. // value: true | false
  115. extern const Pref* PREF_DAEMON;
  116. // value: a string
  117. extern const Pref* PREF_REFERER;
  118. // value: 1*digit
  119. extern const Pref* PREF_LOWEST_SPEED_LIMIT;
  120. // value: 1*digit
  121. extern const Pref* PREF_PIECE_LENGTH;
  122. // value: 1*digit
  123. extern const Pref* PREF_MAX_DOWNLOAD_LIMIT;
  124. // value: 1*digit
  125. extern const Pref* PREF_STARTUP_IDLE_TIME;
  126. // value: prealloc | falloc | none
  127. extern const Pref* PREF_FILE_ALLOCATION;
  128. // value: 1*digit
  129. extern const Pref* PREF_NO_FILE_ALLOCATION_LIMIT;
  130. // value: true | false
  131. extern const Pref* PREF_ALLOW_OVERWRITE;
  132. // value: true | false
  133. extern const Pref* PREF_REALTIME_CHUNK_CHECKSUM;
  134. // value: true | false
  135. extern const Pref* PREF_CHECK_INTEGRITY;
  136. // value: string that your file system recognizes as a file name.
  137. extern const Pref* PREF_NETRC_PATH;
  138. // value:
  139. extern const Pref* PREF_CONTINUE;
  140. // value:
  141. extern const Pref* PREF_NO_NETRC;
  142. // value: 1*digit
  143. extern const Pref* PREF_MAX_OVERALL_DOWNLOAD_LIMIT;
  144. // value: 1*digit
  145. extern const Pref* PREF_MAX_DOWNLOADS;
  146. // value: string that your file system recognizes as a file name.
  147. extern const Pref* PREF_INPUT_FILE;
  148. // value: true | false
  149. extern const Pref* PREF_DEFERRED_INPUT;
  150. // value: 1*digit
  151. extern const Pref* PREF_MAX_CONCURRENT_DOWNLOADS;
  152. // value: true | false
  153. extern const Pref* PREF_FORCE_SEQUENTIAL;
  154. // value: true | false
  155. extern const Pref* PREF_AUTO_FILE_RENAMING;
  156. // value: true | false
  157. extern const Pref* PREF_PARAMETERIZED_URI;
  158. // value: true | false
  159. extern const Pref* PREF_ENABLE_DIRECT_IO;
  160. // value: true | false
  161. extern const Pref* PREF_ALLOW_PIECE_LENGTH_CHANGE;
  162. // value: true | false
  163. extern const Pref* PREF_NO_CONF;
  164. // value: string
  165. extern const Pref* PREF_CONF_PATH;
  166. // value: 1*digit
  167. extern const Pref* PREF_STOP;
  168. // value: true | false
  169. extern const Pref* PREF_QUIET;
  170. // value: true | false
  171. extern const Pref* PREF_ASYNC_DNS;
  172. // value: 1*digit
  173. extern const Pref* PREF_SUMMARY_INTERVAL;
  174. // value: debug, info, notice, warn, error
  175. extern const Pref* PREF_LOG_LEVEL;
  176. // value: inorder | feedback | adaptive
  177. extern const Pref* PREF_URI_SELECTOR;
  178. // value: 1*digit
  179. extern const Pref* PREF_SERVER_STAT_TIMEOUT;
  180. // value: string that your file system recognizes as a file name.
  181. extern const Pref* PREF_SERVER_STAT_IF;
  182. // value: string that your file system recognizes as a file name.
  183. extern const Pref* PREF_SERVER_STAT_OF;
  184. // value: true | false
  185. extern const Pref* PREF_REMOTE_TIME;
  186. // value: 1*digit
  187. extern const Pref* PREF_MAX_FILE_NOT_FOUND;
  188. // value: epoll | select
  189. extern const Pref* PREF_EVENT_POLL;
  190. // value: true | false
  191. extern const Pref* PREF_ENABLE_RPC;
  192. // value: 1*digit
  193. extern const Pref* PREF_RPC_LISTEN_PORT;
  194. // value: string
  195. extern const Pref* PREF_RPC_USER;
  196. // value: string
  197. extern const Pref* PREF_RPC_PASSWD;
  198. // value: 1*digit
  199. extern const Pref* PREF_RPC_MAX_REQUEST_SIZE;
  200. // value: true | false
  201. extern const Pref* PREF_RPC_LISTEN_ALL;
  202. // value: true | false
  203. extern const Pref* PREF_RPC_ALLOW_ORIGIN_ALL;
  204. // value: true | false
  205. extern const Pref* PREF_DRY_RUN;
  206. // value: true | false
  207. extern const Pref* PREF_REUSE_URI;
  208. // value: string
  209. extern const Pref* PREF_ON_DOWNLOAD_START;
  210. extern const Pref* PREF_ON_DOWNLOAD_PAUSE;
  211. extern const Pref* PREF_ON_DOWNLOAD_STOP;
  212. extern const Pref* PREF_ON_DOWNLOAD_COMPLETE;
  213. extern const Pref* PREF_ON_DOWNLOAD_ERROR;
  214. // value: string
  215. extern const Pref* PREF_INTERFACE;
  216. // value: true | false
  217. extern const Pref* PREF_DISABLE_IPV6;
  218. // value: true | false
  219. extern const Pref* PREF_HUMAN_READABLE;
  220. // value: true | false
  221. extern const Pref* PREF_REMOVE_CONTROL_FILE;
  222. // value: true | false
  223. extern const Pref* PREF_ALWAYS_RESUME;
  224. // value: 1*digit
  225. extern const Pref* PREF_MAX_RESUME_FAILURE_TRIES;
  226. // value: string that your file system recognizes as a file name.
  227. extern const Pref* PREF_SAVE_SESSION;
  228. // value: 1*digit
  229. extern const Pref* PREF_MAX_CONNECTION_PER_SERVER;
  230. // value: 1*digit
  231. extern const Pref* PREF_MIN_SPLIT_SIZE;
  232. // value: true | false
  233. extern const Pref* PREF_CONDITIONAL_GET;
  234. // value: true | false
  235. extern const Pref* PREF_SELECT_LEAST_USED_HOST;
  236. // value: true | false
  237. extern const Pref* PREF_ENABLE_ASYNC_DNS6;
  238. // value: 1*digit
  239. extern const Pref* PREF_MAX_DOWNLOAD_RESULT;
  240. // value: 1*digit
  241. extern const Pref* PREF_RETRY_WAIT;
  242. // value: string
  243. extern const Pref* PREF_ASYNC_DNS_SERVER;
  244. // value: true | false
  245. extern const Pref* PREF_SHOW_CONSOLE_READOUT;
  246. // value: default | inorder | geom
  247. extern const Pref* PREF_STREAM_PIECE_SELECTOR;
  248. // value: true | false
  249. extern const Pref* PREF_TRUNCATE_CONSOLE_READOUT;
  250. // value: true | false
  251. extern const Pref* PREF_PAUSE;
  252. // value: default | full
  253. extern const Pref* PREF_DOWNLOAD_RESULT;
  254. // value: true | false
  255. extern const Pref* PREF_HASH_CHECK_ONLY;
  256. /**
  257. * FTP related preferences
  258. */
  259. extern const Pref* PREF_FTP_USER;
  260. extern const Pref* PREF_FTP_PASSWD;
  261. // values: binary | ascii
  262. extern const Pref* PREF_FTP_TYPE;
  263. // values: true | false
  264. extern const Pref* PREF_FTP_PASV;
  265. // values: true | false
  266. extern const Pref* PREF_FTP_REUSE_CONNECTION;
  267. // values: hashType=digest
  268. extern const Pref* PREF_CHECKSUM;
  269. // value: pid
  270. extern const Pref* PREF_STOP_WITH_PROCESS;
  271. /**
  272. * HTTP related preferences
  273. */
  274. extern const Pref* PREF_HTTP_USER;
  275. extern const Pref* PREF_HTTP_PASSWD;
  276. // values: string
  277. extern const Pref* PREF_USER_AGENT;
  278. // value: string that your file system recognizes as a file name.
  279. extern const Pref* PREF_LOAD_COOKIES;
  280. // value: string that your file system recognizes as a file name.
  281. extern const Pref* PREF_SAVE_COOKIES;
  282. // values: true | false
  283. extern const Pref* PREF_ENABLE_HTTP_KEEP_ALIVE;
  284. // values: true | false
  285. extern const Pref* PREF_ENABLE_HTTP_PIPELINING;
  286. // value: 1*digit
  287. extern const Pref* PREF_MAX_HTTP_PIPELINING;
  288. // value: string
  289. extern const Pref* PREF_HEADER;
  290. // value: string that your file system recognizes as a file name.
  291. extern const Pref* PREF_CERTIFICATE;
  292. // value: string that your file system recognizes as a file name.
  293. extern const Pref* PREF_PRIVATE_KEY;
  294. // value: string that your file system recognizes as a file name.
  295. extern const Pref* PREF_CA_CERTIFICATE;
  296. // value: true | false
  297. extern const Pref* PREF_CHECK_CERTIFICATE;
  298. // value: true | false
  299. extern const Pref* PREF_USE_HEAD;
  300. // value: true | false
  301. extern const Pref* PREF_HTTP_AUTH_CHALLENGE;
  302. // value: true | false
  303. extern const Pref* PREF_HTTP_NO_CACHE;
  304. // value: true | false
  305. extern const Pref* PREF_HTTP_ACCEPT_GZIP;
  306. /**;
  307. * Proxy related preferences
  308. */
  309. extern const Pref* PREF_HTTP_PROXY;
  310. extern const Pref* PREF_HTTPS_PROXY;
  311. extern const Pref* PREF_FTP_PROXY;
  312. extern const Pref* PREF_ALL_PROXY;
  313. // values: comma separeted hostname or domain
  314. extern const Pref* PREF_NO_PROXY;
  315. // values: get | tunnel
  316. extern const Pref* PREF_PROXY_METHOD;
  317. extern const Pref* PREF_HTTP_PROXY_USER;
  318. extern const Pref* PREF_HTTP_PROXY_PASSWD;
  319. extern const Pref* PREF_HTTPS_PROXY_USER;
  320. extern const Pref* PREF_HTTPS_PROXY_PASSWD;
  321. extern const Pref* PREF_FTP_PROXY_USER;
  322. extern const Pref* PREF_FTP_PROXY_PASSWD;
  323. extern const Pref* PREF_ALL_PROXY_USER;
  324. extern const Pref* PREF_ALL_PROXY_PASSWD;
  325. /**
  326. * BitTorrent related preferences
  327. */
  328. // values: 1*digit
  329. extern const Pref* PREF_PEER_CONNECTION_TIMEOUT;
  330. // values: 1*digit
  331. extern const Pref* PREF_BT_TIMEOUT;
  332. // values: 1*digit
  333. extern const Pref* PREF_BT_REQUEST_TIMEOUT;
  334. // values: true | false
  335. extern const Pref* PREF_SHOW_FILES;
  336. // values: 1*digit
  337. extern const Pref* PREF_MAX_OVERALL_UPLOAD_LIMIT;
  338. // values: 1*digit
  339. extern const Pref* PREF_MAX_UPLOAD_LIMIT;
  340. // values: a string that your file system recognizes as a file name.
  341. extern const Pref* PREF_TORRENT_FILE;
  342. // values: 1*digit
  343. extern const Pref* PREF_LISTEN_PORT;
  344. // values: true | false | mem
  345. extern const Pref* PREF_FOLLOW_TORRENT;
  346. // values: 1*digit *( (,|-) 1*digit)
  347. extern const Pref* PREF_SELECT_FILE;
  348. // values: 1*digit
  349. extern const Pref* PREF_SEED_TIME;
  350. // values: 1*digit ['.' [ 1*digit ] ]
  351. extern const Pref* PREF_SEED_RATIO;
  352. // values: 1*digit
  353. extern const Pref* PREF_BT_KEEP_ALIVE_INTERVAL;
  354. // values: a string, less than or equals to 20 bytes length
  355. extern const Pref* PREF_PEER_ID_PREFIX;
  356. // values: true | false
  357. extern const Pref* PREF_ENABLE_PEER_EXCHANGE;
  358. // values: true | false
  359. extern const Pref* PREF_ENABLE_DHT;
  360. // values: a string
  361. extern const Pref* PREF_DHT_LISTEN_ADDR;
  362. // values: 1*digit
  363. extern const Pref* PREF_DHT_LISTEN_PORT;
  364. // values: a string
  365. extern const Pref* PREF_DHT_ENTRY_POINT_HOST;
  366. // values: 1*digit
  367. extern const Pref* PREF_DHT_ENTRY_POINT_PORT;
  368. // values: a string (hostname:port)
  369. extern const Pref* PREF_DHT_ENTRY_POINT;
  370. // values: a string
  371. extern const Pref* PREF_DHT_FILE_PATH;
  372. // values: true | false
  373. extern const Pref* PREF_ENABLE_DHT6;
  374. // values: a string
  375. extern const Pref* PREF_DHT_LISTEN_ADDR6;
  376. // values: a string
  377. extern const Pref* PREF_DHT_ENTRY_POINT_HOST6;
  378. // values: 1*digit
  379. extern const Pref* PREF_DHT_ENTRY_POINT_PORT6;
  380. // values: a string (hostname:port)
  381. extern const Pref* PREF_DHT_ENTRY_POINT6;
  382. // values: a string
  383. extern const Pref* PREF_DHT_FILE_PATH6;
  384. // values: plain | arc4
  385. extern const Pref* PREF_BT_MIN_CRYPTO_LEVEL;
  386. // values:: true | false
  387. extern const Pref* PREF_BT_REQUIRE_CRYPTO;
  388. // values: 1*digit
  389. extern const Pref* PREF_BT_REQUEST_PEER_SPEED_LIMIT;
  390. // values: 1*digit
  391. extern const Pref* PREF_BT_MAX_OPEN_FILES;
  392. // values: true | false
  393. extern const Pref* PREF_BT_SEED_UNVERIFIED;
  394. // values: true | false
  395. extern const Pref* PREF_BT_HASH_CHECK_SEED;
  396. // values: 1*digit
  397. extern const Pref* PREF_BT_MAX_PEERS;
  398. // values: a string (IP address)
  399. extern const Pref* PREF_BT_EXTERNAL_IP;
  400. // values: 1*digit '=' a string that your file system recognizes as a file name.
  401. extern const Pref* PREF_INDEX_OUT;
  402. // values: 1*digit
  403. extern const Pref* PREF_BT_TRACKER_INTERVAL;
  404. // values: 1*digit
  405. extern const Pref* PREF_BT_STOP_TIMEOUT;
  406. // values: head[=SIZE]|tail[=SIZE], ...
  407. extern const Pref* PREF_BT_PRIORITIZE_PIECE;
  408. // values: true | false
  409. extern const Pref* PREF_BT_SAVE_METADATA;
  410. // values: true | false
  411. extern const Pref* PREF_BT_METADATA_ONLY;
  412. // values: true | false
  413. extern const Pref* PREF_BT_ENABLE_LPD;
  414. // values: string
  415. extern const Pref* PREF_BT_LPD_INTERFACE;
  416. // values: 1*digit
  417. extern const Pref* PREF_BT_TRACKER_TIMEOUT;
  418. // values: 1*digit
  419. extern const Pref* PREF_BT_TRACKER_CONNECT_TIMEOUT;
  420. // values: 1*digit
  421. extern const Pref* PREF_DHT_MESSAGE_TIMEOUT;
  422. // values: string
  423. extern const Pref* PREF_ON_BT_DOWNLOAD_COMPLETE;
  424. // values: string
  425. extern const Pref* PREF_BT_TRACKER;
  426. // values: string
  427. extern const Pref* PREF_BT_EXCLUDE_TRACKER;
  428. /**
  429. * Metalink related preferences
  430. */
  431. // values: a string that your file system recognizes as a file name.
  432. extern const Pref* PREF_METALINK_FILE;
  433. // values: a string
  434. extern const Pref* PREF_METALINK_VERSION;
  435. // values: a string
  436. extern const Pref* PREF_METALINK_LANGUAGE;
  437. // values: a string
  438. extern const Pref* PREF_METALINK_OS;
  439. // values: a string
  440. extern const Pref* PREF_METALINK_LOCATION;
  441. // values: 1*digit
  442. extern const Pref* PREF_METALINK_SERVERS;
  443. // values: true | false | mem
  444. extern const Pref* PREF_FOLLOW_METALINK;
  445. // values: http | https | ftp | none
  446. extern const Pref* PREF_METALINK_PREFERRED_PROTOCOL;
  447. // values: true | false
  448. extern const Pref* PREF_METALINK_ENABLE_UNIQUE_PROTOCOL;
  449. // values: a string
  450. extern const Pref* PREF_METALINK_BASE_URI;
  451. } // namespace aria2
  452. #endif // D_PREFS_H