Switch to unified view

a b/src/policies/DIF/Routing/DomainRouting/rModule.h
1
/*
2
 * DomainModule.h
3
 *
4
 *  Created on: Mar 23, 2015
5
 *      Author: gaixas1
6
 */
7
8
#ifndef DOMAINMODULE_H_
9
#define DOMAINMODULE_H_
10
11
#include <omnetpp.h>
12
#include <IntRouting.h>
13
14
#include <string>
15
16
namespace DMRnms {
17
18
class Routing;
19
20
typedef std::map<std::string, std::string> s2s;
21
typedef std::map<std::string, Address> s2A;
22
struct dmNxt {
23
    std::string domain;
24
    s2A entries;
25
    dmNxt(const std::string &_domain)
26
        :domain(_domain){}
27
    dmNxt(const std::string &_domain, const s2A &_entries)
28
        :domain(_domain), entries(_entries){}
29
};
30
typedef std::vector<dmNxt> dmUpdateM;
31
32
typedef s2A::iterator s2AIt;
33
typedef s2s::iterator s2sIt;
34
typedef dmUpdateM::iterator dmUpdateMIt;
35
36
class RoutingUpdate : public IntRoutingUpdate {
37
public:
38
    RoutingUpdate(const Address &_addr, const std::string &_domain);
39
    std::string domain;
40
};
41
42
//Predefining class
43
44
45
class rModule {
46
public:
47
    rModule(Routing * _parent, const Address &_nAddr, const std::string &_domain, const std::string &_addr);
48
    virtual ~rModule(){};
49
50
    virtual bool processUpdate(RoutingUpdate * update) = 0;
51
    virtual void addFlow(const Address &_nAddr, const std::string &_addr, const unsigned short &_metric) = 0;
52
    virtual void removeFlow(const Address &_nAddr, const std::string &_addr) = 0;
53
54
    virtual void addAddr(const std::string &_addr) = 0;
55
    virtual void removeAddr(const std::string &_addr) = 0;
56
57
    virtual void setInfMetric(const unsigned short &inf) = 0;
58
59
    virtual dmNxt getChanges() = 0;
60
    virtual dmNxt getAll() = 0;
61
62
    virtual void handleMessage(cMessage *msg) = 0;
63
64
protected:
65
    Routing * parent;
66
    Address myNAddress;
67
    std::string domain;
68
    std::string myAddr;
69
70
    void scheduleAt(const double & time, cMessage *);
71
};
72
73
} /* namespace DomainRouting */
74
75
#endif /* DOMAINMODULE_H_ */