Download this file

rModule.h    76 lines (55 with data), 1.8 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
66
67
68
69
70
71
72
73
74
75
/*
* DomainModule.h
*
* Created on: Mar 23, 2015
* Author: gaixas1
*/
#ifndef DOMAINMODULE_H_
#define DOMAINMODULE_H_
#include <omnetpp.h>
#include <IntRouting.h>
#include <string>
namespace DMRnms {
class Routing;
typedef std::map<std::string, std::string> s2s;
typedef std::map<std::string, Address> s2A;
struct dmNxt {
std::string domain;
s2A entries;
dmNxt(const std::string &_domain)
:domain(_domain){}
dmNxt(const std::string &_domain, const s2A &_entries)
:domain(_domain), entries(_entries){}
};
typedef std::vector<dmNxt> dmUpdateM;
typedef s2A::iterator s2AIt;
typedef s2s::iterator s2sIt;
typedef dmUpdateM::iterator dmUpdateMIt;
class RoutingUpdate : public IntRoutingUpdate {
public:
RoutingUpdate(const Address &_addr, const std::string &_domain);
std::string domain;
};
//Predefining class
class rModule {
public:
rModule(Routing * _parent, const Address &_nAddr, const std::string &_domain, const std::string &_addr);
virtual ~rModule(){};
virtual bool processUpdate(RoutingUpdate * update) = 0;
virtual void addFlow(const Address &_nAddr, const std::string &_addr, const unsigned short &_metric) = 0;
virtual void removeFlow(const Address &_nAddr, const std::string &_addr) = 0;
virtual void addAddr(const std::string &_addr) = 0;
virtual void removeAddr(const std::string &_addr) = 0;
virtual void setInfMetric(const unsigned short &inf) = 0;
virtual dmNxt getChanges() = 0;
virtual dmNxt getAll() = 0;
virtual void handleMessage(cMessage *msg) = 0;
protected:
Routing * parent;
Address myNAddress;
std::string domain;
std::string myAddr;
void scheduleAt(const double & time, cMessage *);
};
} /* namespace DomainRouting */
#endif /* DOMAINMODULE_H_ */