prefs.h 16 KB

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