File indexing completed on 2025-01-05 04:37:10
0001 /* 0002 SPDX-FileCopyrightText: 2012 Joris Guisson <joris.guisson@gmail.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef DHT_GETPEERSREQ_H 0008 #define DHT_GETPEERSREQ_H 0009 0010 #include "rpcmsg.h" 0011 #include <QStringList> 0012 0013 namespace dht 0014 { 0015 /** 0016 * GetPeers request in the DHT protocol 0017 */ 0018 class KTORRENT_EXPORT GetPeersReq : public RPCMsg 0019 { 0020 public: 0021 GetPeersReq(); 0022 GetPeersReq(const Key &id, const Key &info_hash); 0023 ~GetPeersReq() override; 0024 0025 const Key &getInfoHash() const 0026 { 0027 return info_hash; 0028 } 0029 bool wants(int ip_version) const; 0030 0031 void apply(DHT *dh_table) override; 0032 void print() override; 0033 void encode(QByteArray &arr) const override; 0034 void parse(bt::BDictNode *dict) override; 0035 0036 typedef QSharedPointer<GetPeersReq> Ptr; 0037 0038 protected: 0039 Key info_hash; 0040 QStringList want; 0041 }; 0042 0043 } 0044 0045 #endif // DHT_GETPEERSREQ_H