-
Notifications
You must be signed in to change notification settings - Fork 6
/
node.h
71 lines (51 loc) · 1.49 KB
/
node.h
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
66
67
68
69
70
71
#ifndef _node
#define _node
#include <new>
#include <iostream>
#include <deque>
class RoutingMessage;
class Table;
class Link;
class SimulationContext;
#include "table.h"
using namespace std;
class Node {
private:
unsigned number;
SimulationContext *context;
double bw;
double lat;
#if defined(LINKSTATE)
#endif
#if defined(DISTANCEVECTOR)
#endif
// students will add protocol-specific data here
public:
Node(const unsigned n, SimulationContext *c, double b, double l);
Node();
Node(const Node &rhs);
Node & operator=(const Node &rhs);
virtual ~Node();
virtual bool Matches(const Node &rhs) const;
virtual void SetNumber(const unsigned n);
virtual unsigned GetNumber() const;
virtual void SetLatency(const double l);
virtual double GetLatency() const;
virtual void SetBW(const double b);
virtual double GetBW() const;
virtual void SendToNeighbors(const RoutingMessage *m);
virtual void SendToNeighbor(const Node *n, const RoutingMessage *m);
virtual deque<Node*> *GetNeighbors();
virtual void SetTimeOut(const double timefromnow);
//
// Students will WRITE THESE
//
virtual void LinkHasBeenUpdated(const Link *l);
virtual void ProcessIncomingRoutingMessage(const RoutingMessage *m);
virtual void TimeOut();
virtual Node *GetNextHop(const Node *destination) const;
virtual Table *GetRoutingTable() const;
virtual ostream & Print(ostream &os) const;
};
inline ostream & operator<<(ostream &os, const Node &n) { return n.Print(os);}
#endif