Switch to unified view

a b/src/policies/DIF/RA/PDUFG/BiDomainGenerator/BiDomainGenerator.h
1
//
2
// This program is free software: you can redistribute it and/or modify
3
// it under the terms of the GNU Lesser General Public License as published by
4
// the Free Software Foundation, either version 3 of the License, or
5
// (at your option) any later version.
6
// 
7
// This program is distributed in the hope that it will be useful,
8
// but WITHOUT ANY WARRANTY; without even the implied warranty of
9
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
// GNU Lesser General Public License for more details.
11
// 
12
// You should have received a copy of the GNU Lesser General Public License
13
// along with this program.  If not, see http://www.gnu.org/licenses/.
14
// 
15
16
#ifndef BiDomainGenerator_H_
17
#define BiDomainGenerator_H_
18
19
#include <IntPDUFG.h>
20
#include <DomainTable/DomainTable.h>
21
#include <DomainRouting/Routing.h>
22
23
#include <map>
24
#include <set>
25
26
namespace BiDomainGenerator {
27
28
29
struct pAddr {
30
    std::string domain;
31
    std::string addr;
32
    pAddr (const std::string &_domain, const std::string &_addr)
33
        : domain(_domain), addr(_addr) {}
34
};
35
36
typedef std::set<RMTPort*> PortsSet;
37
typedef std::map<std::string, PortsSet> NTable;
38
39
typedef PortsSet::iterator PortsSetIt;
40
typedef NTable::iterator NTableIt;
41
42
43
class BiDomainGenerator: public IntPDUFG {
44
public:
45
    // A new flow has been inserted/or removed
46
    virtual void insertedFlow(const Address &addr, const unsigned short &qos, RMTPort * port);
47
    virtual void removedFlow(const Address &addr, const unsigned short &qos, RMTPort * port);
48
49
    //Routing has processes a routing update
50
    virtual void routingUpdated();
51
52
protected:
53
    // Called after initialize
54
    virtual void onPolicyInit();
55
56
private:
57
    DA * difA;
58
    DomainTable::DomainTable * fwd;
59
    DMRnms::Routing * rt;
60
61
    std::string myPrefix;
62
    std::string mySufix;
63
    pAddr parseAddr(const std::string &addr);
64
65
    NTable neighbours;
66
};
67
68
}
69
70
#endif /* STATICGENERATOR_H_ */