diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2010-08-03 11:44:24 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2010-08-03 11:44:24 +0000 |
| commit | 2bd5020f81bc8c9995590209d0bf024147c8a51a (patch) | |
| tree | 3cc93c71179570c7a4889a25f64f56d3c8820c84 /test/UTPexExtensionMessageTest.cc | |
| parent | 939a372727b2f27e683a23ac38928b82de550376 (diff) | |
2010-08-03 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added bittorrent::packcompact() which replaces
bittorrent::createcompact() and supports IPv6 addresses. Rewritten
bittorrent::unpackcompact() and bittorrent::extractPeer() to
support IPv6 addresses. Fixed added.f flags in ut_pex.
* src/BtConstants.h
* src/DHTFindNodeReplyMessage.cc
* src/DHTGetPeersReplyMessage.cc
* src/DHTMessageFactoryImpl.cc
* src/DHTRoutingTableDeserializer.cc
* src/DHTRoutingTableSerializer.cc
* src/DHTTokenTracker.cc
* src/DefaultBtAnnounce.cc
* src/UTPexExtensionMessage.cc
* src/bittorrent_helper.cc
* src/bittorrent_helper.h
* test/BittorrentHelperTest.cc
* test/DHTFindNodeReplyMessageTest.cc
* test/DHTGetPeersReplyMessageTest.cc
* test/DHTMessageFactoryImplTest.cc
* test/DHTRoutingTableSerializerTest.cc
* test/DefaultExtensionMessageFactoryTest.cc
* test/UTPexExtensionMessageTest.cc
Diffstat (limited to 'test/UTPexExtensionMessageTest.cc')
| -rw-r--r-- | test/UTPexExtensionMessageTest.cc | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/test/UTPexExtensionMessageTest.cc b/test/UTPexExtensionMessageTest.cc index c2afa55a..0aa700ea 100644 --- a/test/UTPexExtensionMessageTest.cc +++ b/test/UTPexExtensionMessageTest.cc @@ -81,18 +81,18 @@ void UTPexExtensionMessageTest::testGetBencodedData() p4->startBadCondition(); CPPUNIT_ASSERT(msg.addDroppedPeer(p4)); - unsigned char c1[6]; - unsigned char c2[6]; - unsigned char c3[6]; - unsigned char c4[6]; - bittorrent::createcompact(c1, p1->getIPAddress(), p1->getPort()); - bittorrent::createcompact(c2, p2->getIPAddress(), p2->getPort()); - bittorrent::createcompact(c3, p3->getIPAddress(), p3->getPort()); - bittorrent::createcompact(c4, p4->getIPAddress(), p4->getPort()); + unsigned char c1[COMPACT_LEN_IPV6]; + unsigned char c2[COMPACT_LEN_IPV6]; + unsigned char c3[COMPACT_LEN_IPV6]; + unsigned char c4[COMPACT_LEN_IPV6]; + bittorrent::packcompact(c1, p1->getIPAddress(), p1->getPort()); + bittorrent::packcompact(c2, p2->getIPAddress(), p2->getPort()); + bittorrent::packcompact(c3, p3->getIPAddress(), p3->getPort()); + bittorrent::packcompact(c4, p4->getIPAddress(), p4->getPort()); std::string expected = "d5:added12:"+ std::string(&c1[0], &c1[6])+std::string(&c2[0], &c2[6])+ - "7:added.f2:207:dropped12:"+ + "7:added.f2:"+util::fromHex("0200")+"7:dropped12:"+ std::string(&c3[0], &c3[6])+std::string(&c4[0], &c4[6])+ "e"; std::string bd = msg.getPayload(); @@ -152,14 +152,14 @@ void UTPexExtensionMessageTest::testDoReceivedAction() void UTPexExtensionMessageTest::testCreate() { - unsigned char c1[6]; - unsigned char c2[6]; - unsigned char c3[6]; - unsigned char c4[6]; - bittorrent::createcompact(c1, "192.168.0.1", 6881); - bittorrent::createcompact(c2, "10.1.1.2", 9999); - bittorrent::createcompact(c3, "192.168.0.2", 6882); - bittorrent::createcompact(c4, "10.1.1.3",10000); + unsigned char c1[COMPACT_LEN_IPV6]; + unsigned char c2[COMPACT_LEN_IPV6]; + unsigned char c3[COMPACT_LEN_IPV6]; + unsigned char c4[COMPACT_LEN_IPV6]; + bittorrent::packcompact(c1, "192.168.0.1", 6881); + bittorrent::packcompact(c2, "10.1.1.2", 9999); + bittorrent::packcompact(c3, "192.168.0.2", 6882); + bittorrent::packcompact(c4, "10.1.1.3",10000); char id[1] = { 1 }; |
