OptionHandlerFactory.cc 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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 "OptionHandlerFactory.h"
  36. #include "prefs.h"
  37. #include "OptionHandlerImpl.h"
  38. OptionHandlers OptionHandlerFactory::createOptionHandlers()
  39. {
  40. OptionHandlers handlers;
  41. handlers.push_back(new HttpProxyOptionHandler(PREF_HTTP_PROXY));
  42. handlers.push_back(new DefaultOptionHandler(PREF_HTTP_USER));
  43. handlers.push_back(new DefaultOptionHandler(PREF_HTTP_PASSWD));
  44. handlers.push_back(new DefaultOptionHandler(PREF_HTTP_PROXY_USER));
  45. handlers.push_back(new DefaultOptionHandler(PREF_HTTP_PROXY_PASSWD));
  46. handlers.push_back(new ParameterOptionHandler(PREF_HTTP_AUTH_SCHEME, V_BASIC));
  47. handlers.push_back(new DefaultOptionHandler(PREF_REFERER));
  48. handlers.push_back(new NumberOptionHandler(PREF_RETRY_WAIT, 0, 60));
  49. handlers.push_back(new DefaultOptionHandler(PREF_FTP_USER));
  50. handlers.push_back(new DefaultOptionHandler(PREF_FTP_PASSWD));
  51. handlers.push_back(new ParameterOptionHandler(PREF_FTP_TYPE, V_BINARY, V_ASCII));
  52. handlers.push_back(new ParameterOptionHandler(PREF_FTP_VIA_HTTP_PROXY,
  53. V_GET, V_TUNNEL));
  54. handlers.push_back(new UnitNumberOptionHandler(PREF_MIN_SEGMENT_SIZE, 1024));
  55. handlers.push_back(new ParameterOptionHandler(PREF_HTTP_PROXY_METHOD,
  56. V_GET, V_TUNNEL));
  57. handlers.push_back(new IntegerRangeOptionHandler(PREF_LISTEN_PORT, 1024, UINT16_MAX));
  58. handlers.push_back(new ParameterOptionHandler(PREF_FOLLOW_TORRENT, V_TRUE, V_MEM, V_FALSE));
  59. handlers.push_back(new BooleanOptionHandler(PREF_NO_PREALLOCATION));
  60. handlers.push_back(new BooleanOptionHandler(PREF_DIRECT_FILE_MAPPING));
  61. handlers.push_back(new IntegerRangeOptionHandler(PREF_SELECT_FILE, 1, INT32_MAX));
  62. handlers.push_back(new NumberOptionHandler(PREF_SEED_TIME, 0));
  63. handlers.push_back(new FloatNumberOptionHandler(PREF_SEED_RATIO, 0.0));
  64. handlers.push_back(new UnitNumberOptionHandler(PREF_MAX_UPLOAD_LIMIT, 0));
  65. handlers.push_back(new DefaultOptionHandler(PREF_METALINK_VERSION));
  66. handlers.push_back(new DefaultOptionHandler(PREF_METALINK_LANGUAGE));
  67. handlers.push_back(new DefaultOptionHandler(PREF_METALINK_OS));
  68. handlers.push_back(new ParameterOptionHandler(PREF_FOLLOW_METALINK, V_TRUE, V_MEM, V_FALSE));
  69. handlers.push_back(new DefaultOptionHandler(PREF_METALINK_LOCATION));
  70. handlers.push_back(new UnitNumberOptionHandler(PREF_LOWEST_SPEED_LIMIT, 0));
  71. handlers.push_back(new UnitNumberOptionHandler(PREF_MAX_DOWNLOAD_LIMIT, 0));
  72. handlers.push_back(new BooleanOptionHandler(PREF_ALLOW_OVERWRITE));
  73. handlers.push_back(new BooleanOptionHandler(PREF_CHECK_INTEGRITY));
  74. handlers.push_back(new BooleanOptionHandler(PREF_REALTIME_CHUNK_CHECKSUM));
  75. handlers.push_back(new BooleanOptionHandler(PREF_DAEMON));
  76. handlers.push_back(new DefaultOptionHandler(PREF_DIR));
  77. handlers.push_back(new DefaultOptionHandler(PREF_OUT));
  78. handlers.push_back(new LogOptionHandler(PREF_LOG));
  79. handlers.push_back(new NumberOptionHandler(PREF_SPLIT, 1, 5));
  80. handlers.push_back(new NumberOptionHandler(PREF_TIMEOUT, 1, 600));
  81. handlers.push_back(new NumberOptionHandler(PREF_MAX_TRIES, 0));
  82. handlers.push_back(new BooleanOptionHandler(PREF_FTP_PASV));
  83. handlers.push_back(new BooleanOptionHandler(PREF_SHOW_FILES));
  84. handlers.push_back(new DefaultOptionHandler(PREF_TORRENT_FILE));
  85. handlers.push_back(new DefaultOptionHandler(PREF_METALINK_FILE));
  86. handlers.push_back(new NumberOptionHandler(PREF_METALINK_SERVERS, 1));
  87. handlers.push_back(new ParameterOptionHandler(PREF_FILE_ALLOCATION,
  88. V_NONE, V_PREALLOC));
  89. handlers.push_back(new BooleanOptionHandler(PREF_CONTINUE));
  90. handlers.push_back(new DefaultOptionHandler(PREF_USER_AGENT));
  91. handlers.push_back(new BooleanOptionHandler(PREF_NO_NETRC));
  92. handlers.push_back(new DefaultOptionHandler(PREF_INPUT_FILE));
  93. handlers.push_back(new NumberOptionHandler(PREF_MAX_CONCURRENT_DOWNLOADS, 1, 45));
  94. handlers.push_back(new DefaultOptionHandler(PREF_LOAD_COOKIES));
  95. handlers.push_back(new DefaultOptionHandler(PREF_PEER_ID_PREFIX));
  96. handlers.push_back(new BooleanOptionHandler(PREF_FORCE_SEQUENTIAL));
  97. handlers.push_back(new BooleanOptionHandler(PREF_AUTO_FILE_RENAMING));
  98. handlers.push_back(new BooleanOptionHandler(PREF_PARAMETERIZED_URI));
  99. handlers.push_back(new BooleanOptionHandler(PREF_ENABLE_HTTP_KEEP_ALIVE));
  100. handlers.push_back(new BooleanOptionHandler(PREF_ENABLE_HTTP_PIPELINING));
  101. handlers.push_back(new UnitNumberOptionHandler(PREF_NO_FILE_ALLOCATION_LIMIT, 0));
  102. handlers.push_back(new BooleanOptionHandler(PREF_ENABLE_DIRECT_IO));
  103. handlers.push_back(new BooleanOptionHandler(PREF_ALLOW_PIECE_LENGTH_CHANGE));
  104. return handlers;
  105. }