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

0001 /*
0002     SPDX-FileCopyrightText: 2005 Joris Guisson <joris.guisson@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 #ifndef BTPEERID_H
0007 #define BTPEERID_H
0008 
0009 #include <ktorrent_export.h>
0010 #include <qstring.h>
0011 
0012 namespace bt
0013 {
0014 /**
0015 @author Joris Guisson
0016 */
0017 class KTORRENT_EXPORT PeerID
0018 {
0019     char id[20];
0020     QString client_name;
0021 
0022 public:
0023     PeerID();
0024     PeerID(const char *pid);
0025     PeerID(const PeerID &pid);
0026     virtual ~PeerID();
0027 
0028     PeerID &operator=(const PeerID &pid);
0029 
0030     const char *data() const
0031     {
0032         return id;
0033     }
0034 
0035     QString toString() const;
0036 
0037     /**
0038      * Interprets the PeerID to figure out which client it is.
0039      * @author Ivan + Joris
0040      * @return The name of the client
0041      */
0042     QString identifyClient() const;
0043 
0044     friend bool operator==(const PeerID &a, const PeerID &b);
0045     friend bool operator!=(const PeerID &a, const PeerID &b);
0046     friend bool operator<(const PeerID &a, const PeerID &b);
0047 };
0048 
0049 }
0050 
0051 #endif