MCPcopy Create free account
hub / github.com/aria2/aria2 / createHandshakeMessageData

Function createHandshakeMessageData

test/BtHandshakeMessageTest.cc:37–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35CPPUNIT_TEST_SUITE_REGISTRATION(BtHandshakeMessageTest);
36
37void createHandshakeMessageData(unsigned char* msg)
38{
39 msg[0] = 19;
40 memcpy(&msg[1], BtHandshakeMessageTest::BTPSTR.c_str(),
41 BtHandshakeMessageTest::BTPSTR.size());
42 unsigned char reserved[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x04};
43 memcpy(&msg[20], reserved, sizeof(reserved));
44 unsigned char infoHash[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
45 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
46 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
47 memcpy(&msg[28], infoHash, sizeof(infoHash));
48 unsigned char peerId[] = {0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0,
49 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0,
50 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0};
51 memcpy(&msg[48], peerId, sizeof(peerId));
52}
53
54void BtHandshakeMessageTest::testCreate()
55{

Callers 2

testCreateMethod · 0.85
testCreateMessageMethod · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected