diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2009-03-12 15:54:43 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2009-03-12 15:54:43 +0000 |
| commit | 15582ed8cdbfd58d86fc1d92e37c87d2664450cd (patch) | |
| tree | 405e75ec596ae46ac889ae9b0ac8f611c538d0b1 /src/IndexBtMessageValidator.h | |
| parent | 371ef954d5390ada5e9debd9652e982b1b225be7 (diff) | |
2009-03-13 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Refactored BtMessage subclasses. BtCancelMessage,
BtRequestMessage and BtRejectMessage are derived from
RangeBtMessage class.
BtAllowedFastMessage, BtHaveMessage and BtSuggestPieceMessage
are derived from IndexBtMessage class. BtChokeMessage,
BtHaveAllMessage, BtHaveNoneMessage, BtInterestedMessage,
BtNotInterestedMessage and BtUnchokeMessage are derived from
ZeroBtMessage class.
* src/AbstractBtMessage.cc
* src/AbstractBtMessage.h
* src/BtAllowedFastMessage.cc
* src/BtAllowedFastMessage.h
* src/BtAllowedFastMessageValidator.h: Removed
* src/BtBitfieldMessage.cc
* src/BtBitfieldMessage.h
* src/BtCancelMessage.cc
* src/BtCancelMessage.h
* src/BtCancelMessageValidator.h: Removed
* src/BtChokeMessage.cc
* src/BtChokeMessage.h
* src/BtExtendedMessage.cc
* src/BtExtendedMessage.h
* src/BtHandshakeMessage.cc
* src/BtHandshakeMessage.h
* src/BtHaveAllMessage.cc
* src/BtHaveAllMessage.h
* src/BtHaveMessage.cc
* src/BtHaveMessage.h
* src/BtHaveMessageValidator.h: Removed
* src/BtHaveNoneMessage.cc
* src/BtHaveNoneMessage.h
* src/BtInterestedMessage.cc
* src/BtInterestedMessage.h
* src/BtKeepAliveMessage.cc
* src/BtKeepAliveMessage.h
* src/BtNotInterestedMessage.cc
* src/BtNotInterestedMessage.h
* src/BtPieceMessage.cc
* src/BtPieceMessage.h
* src/BtPortMessage.cc
* src/BtPortMessage.h
* src/BtRejectMessage.cc
* src/BtRejectMessage.h
* src/BtRejectMessageValidator.h: Removed
* src/BtRequestMessage.cc
* src/BtRequestMessage.h
* src/BtRequestMessageValidator.h: Removed
* src/BtSuggestPieceMessage.cc
* src/BtSuggestPieceMessage.h
* src/BtSuggestPieceMessageValidator.h: Removed
* src/BtUnchokeMessage.cc
* src/BtUnchokeMessage.h
* src/DefaultBtMessageFactory.cc
* src/IndexBtMessage.cc
* src/IndexBtMessage.h
* src/IndexBtMessageValidator.h
* src/Makefile.am
* src/PeerMessageUtil.cc
* src/PeerMessageUtil.h
* src/RangeBtMessage.cc
* src/RangeBtMessage.h
* src/RangeBtMessageValidator.h
* src/SimpleBtMessage.cc
* src/SimpleBtMessage.h
* src/ZeroBtMessage.cc
* src/ZeroBtMessage.h
* test/BtRequestMessageTest.cc
Diffstat (limited to 'src/IndexBtMessageValidator.h')
| -rw-r--r-- | src/IndexBtMessageValidator.h | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/src/IndexBtMessageValidator.h b/src/IndexBtMessageValidator.h new file mode 100644 index 00000000..17bf4fd3 --- /dev/null +++ b/src/IndexBtMessageValidator.h @@ -0,0 +1,65 @@ +/* <!-- copyright */ +/* + * aria2 - The high speed download utility + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * In addition, as a special exception, the copyright holders give + * permission to link the code of portions of this program with the + * OpenSSL library under certain conditions as described in each + * individual source file, and distribute linked combinations + * including the two. + * You must obey the GNU General Public License in all respects + * for all of the code used other than OpenSSL. If you modify + * file(s) with this exception, you may extend this exception to your + * version of the file(s), but you are not obligated to do so. If you + * do not wish to do so, delete this exception statement from your + * version. If you delete this exception statement from all source + * files in the program, then also delete it here. + */ +/* copyright --> */ +#ifndef _D_INDEX_BT_VALIDATOR_H_ +#define _D_INDEX_BT_VALIDATOR_H_ + +#include "BtMessageValidator.h" +#include "IndexBtMessage.h" +#include "PeerMessageUtil.h" + +namespace aria2 { + +class IndexBtMessageValidator : public BtMessageValidator { +private: + const IndexBtMessage* _message; + size_t _numPiece; +public: + IndexBtMessageValidator(const IndexBtMessage* message, + size_t numPiece): + _message(message), + _numPiece(numPiece) {} + + virtual bool validate(Errors& errors) + { + // TODO + PeerMessageUtil::checkIndex(_message->getIndex(), _numPiece); + return true; + } + +}; + +} // namespace aria2 + +#endif // _D_INDEX_BT_MESSAGE_VALIDATOR_H_ |
