Commit Graph

15 Commits

Author SHA1 Message Date
Tatsuhiro Tsujikawa
07d270c87e Require -std=c++11 and use std::shared_ptr instead of SharedHandle 2013-06-22 01:10:38 +09:00
Tatsuhiro Tsujikawa
8b0c701266 Removed trailing spaces 2012-10-01 23:52:22 +09:00
Tatsuhiro Tsujikawa
0c162dfbfb Made util::fromHex and base32::decode function template 2011-11-05 18:05:23 +09:00
Tatsuhiro Tsujikawa
310e58bc62 Stored hash value as raw byte string, instead of hex digest. 2011-10-13 21:40:07 +09:00
Tatsuhiro Tsujikawa
03f0774482 Consistent naming scheme for hash type and digest for DownloadContext. 2011-07-27 22:44:30 +09:00
Tatsuhiro Tsujikawa
3ee6784b76 Made `make distcheck' pass.
We added 2 macros A2_TEST_DIR and A2_TEST_OUT_DIR to pass tests in
`make distcheck`.  A2_TEST_DIR refers to test directory.  All output
files by unit tests are now created under A2_TEST_OUT_DIR directory.
2010-12-02 22:52:35 +09:00
Tatsuhiro Tsujikawa
89f997ec0d 2010-11-11 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Replaced MessageDigestContext with MessageDigest.  Cleaned up
	unnecessary functions in MessageDigestHelper.
	* src/BtPieceMessage.cc
	* src/Checksum.h
	* src/DHTTokenTracker.cc
	* src/DownloadCommand.cc
	* src/DownloadCommand.h
	* src/HashFuncEntry.h
	* src/IteratableChecksumValidator.cc
	* src/IteratableChecksumValidator.h
	* src/IteratableChunkChecksumValidator.cc
	* src/IteratableChunkChecksumValidator.h
	* src/LibgcryptMessageDigestImpl.cc
	* src/LibgcryptMessageDigestImpl.h
	* src/LibsslMessageDigestImpl.cc
	* src/LibsslMessageDigestImpl.h
	* src/MSEHandshake.cc
	* src/MSEHandshake.h
	* src/Makefile.am
	* src/MessageDigest.cc
	* src/MessageDigest.h
	* src/MessageDigestHelper.cc
	* src/MessageDigestHelper.h
	* src/MessageDigestImpl.h
	* src/MetalinkParserController.cc
	* src/Piece.cc
	* src/Piece.h
	* src/UTMetadataDataExtensionMessage.cc
	* src/bittorrent_helper.cc
	* src/messageDigest.cc: Removed
	* src/messageDigest.h: Removed
	* src/util.cc
	* src/version_usage.cc
	* test/BittorrentHelperTest.cc
	* test/GZipDecoderTest.cc
	* test/GZipDecodingStreamFilterTest.cc
	* test/IteratableChecksumValidatorTest.cc
	* test/IteratableChunkChecksumValidatorTest.cc
	* test/Makefile.am
	* test/MessageDigestHelperTest.cc
	* test/MessageDigestTest.cc
	* test/Metalink2RequestGroupTest.cc
	* test/MetalinkProcessorTest.cc
	* test/PieceTest.cc
	* test/TestUtil.cc
	* test/TestUtil.h
	* test/UTMetadataDataExtensionMessageTest.cc
	* test/UTMetadataPostDownloadHandlerTest.cc
2010-11-11 02:56:24 +00:00
Tatsuhiro Tsujikawa
b305edd7c5 2010-05-14 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Left only IANA hash function textual name in messageDigest.cc.
	Assign only IANA hash function textual name to Checksum and
	ChunkChecksum. Fixed the value of MessageDigestContext::MD5.
	* src/Checksum.h
	* src/MetalinkParserController.cc
	* src/messageDigest.cc
	* src/messageDigest.h
	* test/IteratableChecksumValidatorTest.cc
	* test/IteratableChunkChecksumValidatorTest.cc
	* test/MessageDigestHelperTest.cc
	* test/Metalink2RequestGroupTest.cc
	* test/MetalinkProcessorTest.cc
2010-05-14 14:11:56 +00:00
Tatsuhiro Tsujikawa
5699b67526 2009-06-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Rewritten DownloadContext and removed SingleFileDownloadContext
	and BtContext and its derived classes. BitTorrent specific
	attributes are now set by DownloadContext::setAttribute() with key
	bittorrent::BITTORRENT.
	* src/AbstractBtMessage.cc
	* src/AbstractBtMessage.h
	* src/AbstractCommand.cc
	* src/AbstractCommand.h
	* src/AbstractProxyRequestCommand.cc
	* src/AbstractProxyResponseCommand.cc
	* src/ActivePeerConnectionCommand.cc
	* src/ActivePeerConnectionCommand.h
	* src/AnnounceList.cc
	* src/BtCheckIntegrityEntry.cc
	* src/BtConstants.h
	* src/BtContext.h: Removed
	* src/BtDependency.cc
	* src/BtExtendedMessage.cc
	* src/BtPieceMessage.cc
	* src/BtPieceMessage.h
	* src/BtPostDownloadHandler.cc
	* src/BtRegistry.cc
	* src/BtRegistry.h
	* src/BtSetup.cc
	* src/CheckIntegrityCommand.cc
	* src/CheckIntegrityEntry.cc
	* src/ChecksumCheckIntegrityEntry.cc
	* src/ConsoleStatCalc.cc
	* src/ContentTypeRequestGroupCriteria.cc
	* src/DHTGetPeersCommand.cc
	* src/DHTGetPeersCommand.h
	* src/DHTPeerLookupTask.cc
	* src/DHTPeerLookupTask.h
	* src/DHTTaskFactory.h
	* src/DHTTaskFactoryImpl.cc
	* src/DHTTaskFactoryImpl.h
	* src/DefaultBtAnnounce.cc
	* src/DefaultBtAnnounce.h
	* src/DefaultBtContext.cc: Removed
	* src/DefaultBtContext.h: Removed
	* src/DefaultBtInteractive.cc
	* src/DefaultBtInteractive.h
	* src/DefaultBtMessageDispatcher.cc
	* src/DefaultBtMessageDispatcher.h
	* src/DefaultBtMessageFactory.cc
	* src/DefaultBtMessageFactory.h
	* src/DefaultBtMessageReceiver.cc
	* src/DefaultBtMessageReceiver.h
	* src/DefaultBtProgressInfoFile.cc
	* src/DefaultBtRequestFactory.cc
	* src/DefaultBtRequestFactory.h
	* src/DefaultExtensionMessageFactory.cc
	* src/DefaultExtensionMessageFactory.h
	* src/DefaultPeerStorage.cc
	* src/DefaultPeerStorage.h
	* src/DefaultPieceStorage.cc
	* src/DefaultSegmentManFactory.cc
	* src/DiskAdaptor.cc
	* src/DiskAdaptor.h
	* src/DownloadContext.cc
	* src/DownloadContext.h
	* src/DownloadEngine.cc
	* src/DownloadEngineFactory.cc
	* src/DownloadHandler.cc
	* src/DownloadResult.h
	* src/FileAllocationCommand.cc
	* src/FileAllocationDispatcherCommand.cc
	* src/FileAllocationEntry.cc
	* src/FileEntry.h
	* src/FillRequestGroupCommand.cc
	* src/FtpDownloadCommand.cc
	* src/FtpFinishDownloadCommand.cc
	* src/FtpInitiateConnectionCommand.cc
	* src/FtpNegotiationCommand.cc
	* src/FtpTunnelRequestCommand.cc
	* src/FtpTunnelResponseCommand.cc
	* src/HandshakeExtensionMessage.cc
	* src/HandshakeExtensionMessage.h
	* src/HaveEraseCommand.cc
	* src/HttpDownloadCommand.cc
	* src/HttpInitiateConnectionCommand.cc
	* src/HttpProxyRequestCommand.cc
	* src/HttpProxyResponseCommand.cc
	* src/HttpRequest.cc
	* src/HttpRequest.h
	* src/HttpRequestCommand.cc
	* src/HttpResponseCommand.cc
	* src/HttpServerBodyCommand.cc
	* src/HttpServerCommand.cc
	* src/HttpSkipResponseCommand.cc
	* src/InitiateConnectionCommandFactory.cc
	* src/InitiatorMSEHandshakeCommand.cc
	* src/InitiatorMSEHandshakeCommand.h
	* src/IteratableChecksumValidator.cc
	* src/IteratableChecksumValidator.h
	* src/IteratableChunkChecksumValidator.cc
	* src/MSEHandshake.cc
	* src/MSEHandshake.h
	* src/Makefile.am
	* src/Makefile.in
	* src/Metalink2RequestGroup.cc
	* src/MetalinkPostDownloadHandler.cc
	* src/MultiDiskAdaptor.cc
	* src/MultiDiskAdaptor.h
	* src/MultiFileAllocationIterator.cc
	* src/MultiUrlRequestInfo.cc
	* src/PeerChokeCommand.cc
	* src/PeerChokeCommand.h
	* src/PeerInitiateConnectionCommand.cc
	* src/PeerInitiateConnectionCommand.h
	* src/PeerInteractionCommand.cc
	* src/PeerInteractionCommand.h
	* src/PeerReceiveHandshakeCommand.cc
	* src/PieceHashCheckIntegrityEntry.cc
	* src/RealtimeCommand.cc
	* src/ReceiverMSEHandshakeCommand.cc
	* src/RequestGroup.cc
	* src/RequestGroup.h
	* src/RequestGroupEntry.cc
	* src/RequestGroupMan.cc
	* src/SeedCheckCommand.cc
	* src/SeedCheckCommand.h
	* src/SegmentMan.cc
	* src/ShareRatioSeedCriteria.h
	* src/SingleFileDownloadContext.cc: Removed
	* src/SingleFileDownloadContext.h: Removed
	* src/SleepCommand.cc
	* src/StreamCheckIntegrityEntry.cc
	* src/TrackerWatcherCommand.cc
	* src/TrackerWatcherCommand.h
	* src/UnknownLengthPieceStorage.cc
	* src/Util.cc
	* src/Util.h
	* src/XmlRpcMethodImpl.cc
	* src/bittorrent_helper.cc
	* src/bittorrent_helper.h
	* src/download_helper.cc
	* src/main.cc
	* src/option_processing.cc
	* test/BitfieldManTest.cc
	* test/BittorrentHelperTest.cc
	* test/BtCancelMessageTest.cc
	* test/BtChokeMessageTest.cc
	* test/BtDependencyTest.cc
	* test/BtPieceMessageTest.cc
	* test/BtPostDownloadHandlerTest.cc
	* test/BtRegistryTest.cc
	* test/BtRejectMessageTest.cc
	* test/BtRequestMessageTest.cc
	* test/DHTPeerAnnounceStorageTest.cc
	* test/DefaultBtAnnounceTest.cc
	* test/DefaultBtContextTest.cc: Removed
	* test/DefaultBtMessageDispatcherTest.cc
	* test/DefaultBtMessageFactoryTest.cc
	* test/DefaultBtProgressInfoFileTest.cc
	* test/DefaultBtRequestFactoryTest.cc
	* test/DefaultExtensionMessageFactoryTest.cc
	* test/DefaultPeerStorageTest.cc
	* test/DefaultPieceStorageTest.cc
	* test/DirectDiskAdaptorTest.cc
	* test/DownloadContextTest.cc
	* test/DownloadHandlerFactoryTest.cc
	* test/DownloadHelperTest.cc
	* test/HandshakeExtensionMessageTest.cc
	* test/HttpRequestTest.cc
	* test/HttpResponseTest.cc
	* test/IteratableChecksumValidatorTest.cc
	* test/IteratableChunkChecksumValidatorTest.cc
	* test/MSEHandshakeTest.cc
	* test/Makefile.am
	* test/Makefile.in
	* test/Metalink2RequestGroupTest.cc
	* test/MetalinkPostDownloadHandlerTest.cc
	* test/MockBtContext.h: Removed
	* test/MockDHTTaskFactory.h
	* test/MockDownloadContext.h: Removed
	* test/MockPieceStorage.h
	* test/MultiDiskAdaptorTest.cc
	* test/MultiFileAllocationIteratorTest.cc
	* test/RequestGroupManTest.cc
	* test/RequestGroupTest.cc
	* test/SegmentManTest.cc
	* test/ShareRatioSeedCriteriaTest.cc
	* test/SingleFileDownloadContextTest.cc: Removed
	* test/UtilTest.cc
	* test/XmlRpcMethodTest.cc
2009-06-28 10:37:15 +00:00
Tatsuhiro Tsujikawa
660c480cca 2009-01-31 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Use LongestSequencePieceSelector for HTTP/FTP/BitTorrent
	integrated downloads. This PieceSelector subclass finds the
	longest continuous sequence in the available missing pieces and
	selects the last index of such sequence. This makes HTTP/FTP
	connections less interrupted by the pieces obtained by
	BitTorrent peers.
	* src/DefaultPieceStorage.cc
	* src/DefaultPieceStorage.h
	* src/LongestSequencePieceSelector.cc
	* src/LongestSequencePieceSelector.h
	* src/Makefile.am
	* src/PieceSelector.h
	* src/RarestPieceSelector.h
	* src/RequestGroup.cc
	* test/BtDependencyTest.cc
	* test/DefaultPieceStorageTest.cc
	* test/IteratableChecksumValidatorTest.cc
	* test/LongestSequencePieceSelectorTest.cc
	* test/Makefile.am
	* test/SegmentManTest.cc
2009-01-31 14:34:29 +00:00
Tatsuhiro Tsujikawa
3505201f33 2008-04-20 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Rewritten SharedHandle. Now copy constructor taking raw pointer 
has
	keyword explicit and SharedHandle's default constructor 
initializes
	its internal obj to null, old implementation initializes it 
using
	obj's default constructor.
	To assign null, write SharedHandle<T> x(...); x.reset();
	TODO: test/SharedHandleTest.cc needs more tests.
	* src/SharedHandle.h
2008-04-20 00:50:22 +00:00
Tatsuhiro Tsujikawa
1b7c198289 2008-02-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Removed "using namespace std;" from all sources. Appended std:: 
prefix to c++
	standard classes.
	Included string.h where mem* function are used.
2008-02-08 15:53:45 +00:00
Tatsuhiro Tsujikawa
7c41d11be3 2007-11-12 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Implemented checksum validation feature(1 checksum for each 
file)
	The validation takes place after the download.
	* src/PieceHashCheckIntegrityEntry.{h, cc}: New class.
	* src/IteratableChecksumValidator.{h, cc}: Rewritten.
	* src/CheckIntegrityCommand.cc: Changed log message.
	* src/Metalink2RequestGroup.cc: Set checksum to
	SingleFileDownloadContext.
	* src/StreamCheckIntegrityEntry.{h, cc}: Now derived from
	PieceHashCheckIntegrity class.
	* src/BtCheckIntegrityEntry.{h, cc}: Now derived from
	PieceHashCheckIntegrity class.
	* src/ChecksumCheckIntegrityEntry.{h, cc}: New class.
	* src/IteratableValidator.h: New class.
	* src/message.h
	* src/CheckIntegrityEntry.{h, cc}
	* src/IteratableChunkChecksumValidator.{h, cc}
	* src/SingleFileDownloadContext.h
	* src/DownloadCommand.cc
	
	--allow-overwrite=true is no longer needed to check file 
integrity
	before download in BitTorrent download.
	* src/RequestGroup.cc (getInitialCommand)

	Removed RequestGroup from queue when 
RequestGroup::getInitialCommand()
	throws exception.
	* src/RequestGroupMan.cc (getInitialCommands)
2007-11-12 11:28:16 +00:00
Tatsuhiro Tsujikawa
e85f9ccfd6 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
2007-08-08 14:40:11 +00:00
Tatsuhiro Tsujikawa
ccdd5b31a3 2007-06-01 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* src/FileAllocationCommand.cc: Derived from RealtimeCommand.
	* src/CheckIntegrityCommand.cc: Derived from RealtimeCommand.
	
	* src/MetalinkEntry.h
	(checksum): Changed to ChecksumHandle
	* src/MetalinkRequestInfo.cc
	(checksum): Changed to ChecksumHandle

	* src/File.cc
	(mkdirs): OPEN_MODE -> DIR_OPEN_MODE
	* src/common.h
	(DIR_OPEN_MODE): New definition

	* src/RequestGroup.cc
	(prepareForNextAction): Added an argument.

	* src/message.h
	(MSG_GOOD_CHECKSUM): New definition
	(MSG_BAD_CHECKSUM): New definition

	* src/HttpResponseCommand.cc
	(handleDefaultEncoding): Continue download sequence in new
	non-segmented download.

	* src/FileAllocationEntry.h
	(_nextDownloadCommand): New variable.

	* src/DownloadCommand.cc
	(prepareForNextSegment): Create ChecksumCommand if checksum is
	available.	

	* src/RealtimeCommand.h, src/RealtimeCommand.cc: New class.

	* src/IteratableChecksumValidator.h,
	src/IteratableChecksumValidator.cc: New class.

	* src/ChecksumCommand.h, src/ChecksumCommand.cc: New class.
2007-05-31 15:56:20 +00:00