2007-08-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

MessageDigestHelper is introduced in order to simplify the use
	of message digest. Removed repeated code.
	The message digest algorithm is now specified by string, like 
"sha1",
	"md5".
	* src/messageDigest.{h, cc}
	* src/MessageDigestHelper.{h, cc}: New class.
	* src/DefaultPieceStorage.cc
	* src/DefaultBtContext.{h, cc}
	(computeFastSet): New function.
	(setInfoHash): Added for unit testing.
	(setNumPieces): Added for unit testing.
	* src/DefaultBtInteractive.cc
	* src/BtPieceMessage.cc
	* src/Peer.cc
	* src/Checksum.h
	* src/message.h
	* src/IteratableChecksumValidator.h
	* src/ChunkChecksumValidator.{h, cc}: Use 
IteratableChecksumValidator
	inside it.
	* src/SegmentMan.{h, cc}
	(checkIntegrity): Removed.
	* src/IteratableChunkChecksumValidator.{h, cc}
	* src/Util.h
	(sha1Sum): Removed.
	(simpleMessageDigest): Removed.
	(fileChecksum): Removed.
	(computeFastSet): Removed.
	* src/ShaVisitor.cc
	* src/ChunkChecksum.h
	* src/DownloadCommand.cc

	Removed messageDigest virtual functions.
	* src/MultiDiskAdaptor.{h, cc}
	* src/DiskAdaptor.h
	* src/ByteArrayDiskWriter.h
	* src/DiskWriter.h
	* src/DiskAdaptorWriter.h
	* src/AbstractSingleDiskAdaptor.{h, cc}
	* src/AbstractDiskWriter.{h, cc}
	
	Fixed comilation error when message digest is disabled.
	* src/MetalinkEntry.{h, cc}
	* src/MetalinkRequestInfo.cc
	
	Removed srandom and random.
	* src/SimpleRandomizer.h

	Added size() virtual function to DiskAdaptor
	* src/MultiDiskAdaptor.h

	Fixed the bug that causes that files are not opened correctly in
	multi-file torrent.
	* src/TorrentRequestInfo.cc
	* src/MultiDiskAdaptor.cc
	
	Added SHA256 support
	* src/messageDigest.cc
	* src/Xml2MetalinkProcessor.cc

	Show supported message digest algorithms
	* src/main.cc

	Updated contact info.
	* src/main.cc
This commit is contained in:
Tatsuhiro Tsujikawa 2007-08-08 14:40:11 +00:00
parent 45f949c713
commit e85f9ccfd6
67 changed files with 1230 additions and 787 deletions

View file

@ -31,8 +31,13 @@ void FeatureConfigTest::testGetDefaultPort() {
void FeatureConfigTest::testIsSupported() {
CPPUNIT_ASSERT_EQUAL(true,
FeatureConfig::getInstance()->isSupported("http"));
#ifdef ENABLE_SSL
CPPUNIT_ASSERT_EQUAL(true,
FeatureConfig::getInstance()->isSupported("https"));
#else
CPPUNIT_ASSERT_EQUAL(false,
FeatureConfig::getInstance()->isSupported("https"));
#endif // ENABLE_SSL
CPPUNIT_ASSERT_EQUAL(true,
FeatureConfig::getInstance()->isSupported("ftp"));
CPPUNIT_ASSERT_EQUAL(false,
@ -41,11 +46,32 @@ void FeatureConfigTest::testIsSupported() {
void FeatureConfigTest::testGetConfigurationSummary() {
CPPUNIT_ASSERT_EQUAL(string("http: yes\n")
#ifdef ENABLE_SSL
+"https: yes\n"
#else
+"https: no\n"
#endif // ENABLE_SSL
+"ftp: yes\n"
#ifdef ENABLE_BITTORRENT
+"bittorrent: yes\n"
#else
+"bittorrent: no\n"
#endif // ENABLE_BITTORRENT
#ifdef ENABLE_METALINK
+"metalink: yes\n"
#else
+"metalink: no\n"
#endif // ENABLE_METALINK
#ifdef ENABLE_MESSAGE_DIGEST
+"message digest: yes\n"
+"async dns: yes\n",
#else
+"message digest: no\n"
#endif // ENABLE_MESSAGE_DIGEST
#ifdef ENABLE_ASYNC_DNS
+"async dns: yes\n"
#else
+"async dns: no\n"
#endif // ENABLE_ASYNC_DNS
,
FeatureConfig::getInstance()->getConfigurationSummary());
}