File indexing completed on 2025-01-05 04:37:09
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_ANNOUNCEREQ_H 0008 #define DHT_ANNOUNCEREQ_H 0009 0010 #include "getpeersreq.h" 0011 0012 namespace dht 0013 { 0014 /** 0015 * Announce request in the DHT protocol 0016 */ 0017 class KTORRENT_EXPORT AnnounceReq : public GetPeersReq 0018 { 0019 public: 0020 AnnounceReq(); 0021 AnnounceReq(const Key &id, const Key &info_hash, bt::Uint16 port, const QByteArray &token); 0022 ~AnnounceReq() override; 0023 0024 void apply(DHT *dh_table) override; 0025 void print() override; 0026 void encode(QByteArray &arr) const override; 0027 void parse(bt::BDictNode *dict) override; 0028 0029 const QByteArray &getToken() const 0030 { 0031 return token; 0032 } 0033 bt::Uint16 getPort() const 0034 { 0035 return port; 0036 } 0037 0038 typedef QSharedPointer<AnnounceReq> Ptr; 0039 0040 private: 0041 bt::Uint16 port; 0042 QByteArray token; 0043 }; 0044 0045 } 0046 0047 #endif // DHT_ANNOUNCEREQ_H