-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrouter.hh
More file actions
65 lines (47 loc) · 1.06 KB
/
router.hh
File metadata and controls
65 lines (47 loc) · 1.06 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#ifndef ROUTER_HH
#define ROUTER_HH
class NetSocket;
#include <QObject>
#include <QHash>
#include <QString>
#include <QHostAddress>
#include <QTimer>
#include <QMap>
#include <QVariantMap>
class Router : public QObject
{
Q_OBJECT
public:
Router(NetSocket *ns, bool nf);
QString me;
void
processRumor(const QVariantMap& rumor,
const QHostAddress& sender,
const quint16 port);
public slots:
void
sendMessage(const QString& message, const QString& destination);
void
sendMap(const QMap<QString, QVariant> &mesg,
const QString &destination);
void
receiveMessage(QVariantMap& msg);
signals:
void
privateMessage(const QString&message, const QString &origin);
void
newOrigin(const QString& origin);
void
toFileRequests(const QMap<QString, QVariant> &msg);
void
blockRequest(const QMap<QString, QVariant>&msg);
void
toPaxos(const QMap<QString, QVariant>&msg);
private:
QHash<QString, QPair<QHostAddress, quint16> > routingTable;
QHash<QString, quint32> currHighest;
NetSocket *sock;
QTimer timer;
bool noForward;
};
#endif