-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathneighbors.hh
More file actions
36 lines (28 loc) · 736 Bytes
/
neighbors.hh
File metadata and controls
36 lines (28 loc) · 736 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef NEIGHBORS_HH
#define NEIGHBORS_HH
#include <QObject>
#include <QMap>
#include <QList>
#include <QPair>
#include <QHostAddress>
#include <QHostInfo>
#include <QString>
#include <QStringList>
class NeighborList : public QObject
{
Q_OBJECT
public:
NeighborList();
QPair<QHostAddress, quint16> randomNeighbor();
void addNeighbor(const QHostAddress& addr, quint16 port);
QList<QPair<QHostAddress, quint16> > getAllNeighbors();
public slots:
void addHost(const QString& s);
void lookedUpHost(const QHostInfo& info);
private:
bool checkIfWellFormedIP(const QString& addr);
QMap<QString, QList<quint16> > pendingLookups;
QList<QPair<QHostAddress, quint16> > neighbors;
QString myIP;
};
#endif