mirror of
https://github.com/aria2/aria2.git
synced 2025-02-22 07:03:44 +00:00

* src/PortMessage.h: Removed. * src/SuggestPieceMessage.h: Removed. * src/KeepAliveMessage.h: Removed. * src/HandshakeMessage.h: Removed. * src/PeerInteraction.h: Removed. * src/UnchokeMessage.h: Removed. * src/PieceMessage.h: Removed. * src/RequestMessage.h: Removed. * src/InterestedMessage.h: Removed. * src/HaveMessage.h: Removed. * src/CancelMessage.h: Removed. * src/RejectMessage.h: Removed. * src/AllowedFastMessage.h: Removed. * src/HaveNoneMessage.h: Removed. * src/SimplePeerMessage.h: Removed. * src/HaveAllMessage.h: Removed. * src/BitfieldMessage.h: Removed. * src/PeerMessageFactory.h: Removed. * src/NotInterestedMessage.h: Removed. * src/ChokeMessage.h: Removed. * src/PeerMessage.h: Removed.
37 lines
722 B
C++
37 lines
722 B
C++
#include "PeerMessageUtil.h"
|
|
#include <netinet/in.h>
|
|
#include <cppunit/extensions/HelperMacros.h>
|
|
|
|
using namespace std;
|
|
|
|
class PeerMessageUtilTest:public CppUnit::TestFixture {
|
|
|
|
CPPUNIT_TEST_SUITE(PeerMessageUtilTest);
|
|
CPPUNIT_TEST_SUITE_END();
|
|
private:
|
|
|
|
public:
|
|
void setUp() {
|
|
}
|
|
|
|
};
|
|
|
|
|
|
CPPUNIT_TEST_SUITE_REGISTRATION( PeerMessageUtilTest );
|
|
|
|
void setIntParam(char* dest, int param) {
|
|
int nParam = htonl(param);
|
|
memcpy(dest, &nParam, 4);
|
|
}
|
|
|
|
void setShortIntParam(char* dest, int param) {
|
|
short int nParam = htons(param);
|
|
memcpy(dest, &nParam, 2);
|
|
}
|
|
|
|
void createNLengthMessage(char* msg, int msgLen, int payloadLen, int id) {
|
|
memset(msg, 0, msgLen);
|
|
setIntParam(msg, payloadLen);
|
|
msg[4] = (char)id;
|
|
}
|