/* */ #include "ZeroBtMessage.h" #include "bittorrent_helper.h" namespace aria2 { ZeroBtMessage::ZeroBtMessage(uint8_t id, const char* name) : SimpleBtMessage{id, name} { } unsigned char* ZeroBtMessage::createMessage() { /** * len --- 1, 4bytes * id --- ?, 1byte * total: 5bytes */ auto msg = new unsigned char[MESSAGE_LENGTH]; bittorrent::createPeerMessageString(msg, MESSAGE_LENGTH, 1, getId()); return msg; } size_t ZeroBtMessage::getMessageLength() { return MESSAGE_LENGTH; } std::string ZeroBtMessage::toString() const { return getName(); } } // namespace aria2