2009-11-21 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

Initial support of Extension for Peers to Send Metadata
	Files(BEP9). Currently aria2 only serves metadata and cannot get
	metadata from swarm.
	* src/BtConstants.h
	* src/DefaultBtInteractive.cc
	* src/DefaultExtensionMessageFactory.cc
	* src/DefaultExtensionMessageFactory.h
	* src/ExtensionMessage.h
	* src/ExtensionMessageRegistry.h
	* src/HandshakeExtensionMessage.cc
	* src/HandshakeExtensionMessage.h
	* src/Makefile.am
	* src/PeerConnection.h
	* src/PeerInteractionCommand.cc
	* src/UTMetadataDataExtensionMessage.cc
	* src/UTMetadataDataExtensionMessage.h
	* src/UTMetadataExtensionMessage.cc
	* src/UTMetadataExtensionMessage.h
	* src/UTMetadataRejectExtensionMessage.cc
	* src/UTMetadataRejectExtensionMessage.h
	* src/UTMetadataRequestExtensionMessage.cc
	* src/UTMetadataRequestExtensionMessage.h
	* src/bittorrent_helper.cc
	* src/bittorrent_helper.h
	* test/BittorrentHelperTest.cc
	* test/DefaultExtensionMessageFactoryTest.cc
	* test/HandshakeExtensionMessageTest.cc
	* test/Makefile.am
	* test/UTMetadataDataExtensionMessageTest.cc
	* test/UTMetadataRejectExtensionMessageTest.cc
	* test/UTMetadataRequestExtensionMessageTest.cc
This commit is contained in:
Tatsuhiro Tsujikawa 2009-11-20 15:42:25 +00:00
parent 2764b6739d
commit 93968c4fa5
31 changed files with 1262 additions and 32 deletions

View file

@ -2,7 +2,7 @@
/*
* aria2 - The high speed download utility
*
* Copyright (C) 2006 Tatsuhiro Tsujikawa
* Copyright (C) 2009 Tatsuhiro Tsujikawa
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -46,6 +46,7 @@ namespace aria2 {
class Peer;
class Logger;
class HandshakeExtensionMessage;
class DownloadContext;
typedef SharedHandle<HandshakeExtensionMessage> HandshakeExtensionMessageHandle;
class HandshakeExtensionMessage:public ExtensionMessage {
@ -54,8 +55,12 @@ private:
uint16_t _tcpPort;
size_t _metadataSize;
std::map<std::string, uint8_t> _extensions;
SharedHandle<DownloadContext> _dctx;
SharedHandle<Peer> _peer;
Logger* _logger;
@ -103,6 +108,21 @@ public:
return _tcpPort;
}
size_t getMetadataSize()
{
return _metadataSize;
}
void setMetadataSize(size_t size)
{
_metadataSize = size;
}
void setDownloadContext(const SharedHandle<DownloadContext>& dctx)
{
_dctx = dctx;
}
void setExtension(const std::string& name, uint8_t id)
{
_extensions[name] = id;