File indexing completed on 2025-01-05 04:37:11

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_PACKEDNODECONTAINER_H
0008 #define DHT_PACKEDNODECONTAINER_H
0009 
0010 #include <QByteArray>
0011 #include <QList>
0012 
0013 namespace dht
0014 {
0015 /**
0016  * Packed node container utilitiy class.
0017  * Stores both nodes and nodes6 parameters of some DHT messages.
0018  */
0019 class PackedNodeContainer
0020 {
0021 public:
0022     PackedNodeContainer();
0023     virtual ~PackedNodeContainer();
0024 
0025     /// Add a single node to the nodes or nodes2 parameter depending on it's size
0026     void addNode(const QByteArray &a);
0027 
0028     /// Get the nodes parameter
0029     const QByteArray &getNodes() const
0030     {
0031         return nodes;
0032     }
0033 
0034     /// Get the nodes6 parameter
0035     const QByteArray &getNodes6() const
0036     {
0037         return nodes6;
0038     }
0039 
0040 protected:
0041     QByteArray nodes;
0042     QByteArray nodes6;
0043 };
0044 
0045 }
0046 
0047 #endif // DHT_PACKEDNODECONTAINER_H