/* */ #include "DHTQueryMessage.h" #include "DHTNode.h" #include "util.h" #include "a2functional.h" namespace aria2 { const std::string DHTQueryMessage::Q("q"); const std::string DHTQueryMessage::A("a"); DHTQueryMessage::DHTQueryMessage(const std::shared_ptr& localNode, const std::shared_ptr& remoteNode, const std::string& transactionID) : DHTAbstractMessage(localNode, remoteNode, transactionID) { } DHTQueryMessage::~DHTQueryMessage() {} const std::string& DHTQueryMessage::getType() const { return Q; } void DHTQueryMessage::fillMessage(Dict* msgDict) { msgDict->put(Q, getMessageType()); msgDict->put(A, getArgument()); } bool DHTQueryMessage::isReply() const { return false; } std::string DHTQueryMessage::toString() const { return fmt("dht query %s TransactionID=%s Remote:%s(%u), id=%s, v=%s, %s", getMessageType().c_str(), util::toHex(getTransactionID()).c_str(), getRemoteNode()->getIPAddress().c_str(), getRemoteNode()->getPort(), util::toHex(getRemoteNode()->getID(), DHT_ID_LENGTH).c_str(), util::torrentPercentEncode(getVersion()).c_str(), toStringOptional().c_str()); } } // namespace aria2