RINASim  October 2016
Documentation of framework for OMNeT++
PortsLoadGenerator.h
Go to the documentation of this file.
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 __PORTSLOADGENERATOR_H
17 #define __PORTSLOADGENERATOR_H
18 
19 #include <IntPDUFG.h>
20 #include <PortsLoadMonitor.h>
22 #include <IntPortsLoadRouting.h>
23 
24 #include <map>
25 #include <set>
26 
27 #define SCALE_BYTES(x) (x)
28 // Comment it to remove the visual debugging.
29 #define PORTSLOADGENERATOR_ENHANCED_DEBUG
30 
31 typedef std::set<RMTPort*> PortsSet;
32 typedef std::map<std::string, PortsSet> Nentries;
33 typedef std::map<std::string, Nentries> NTable;
34 
35 typedef PortsSet::iterator PortsSetIt;
36 typedef Nentries::iterator NentriesIt;
37 typedef NTable::iterator NTableIt;
38 
39 //
40 // Structures necessary to remember the rates and avoid continue
41 // routing update.
42 //
43 
44 typedef std::map<std::string, unsigned short> QosToRateMap;
45 typedef std::map<std::string, QosToRateMap> RateMap;
46 
47 typedef QosToRateMap::iterator QTRIter;
48 typedef RateMap::iterator RateIter;
49 
50 // Provides an maintain updated the neighbor state according to the link load
51 // on them.
53 {
54 public:
55 
56  // A new port has been inserted to another node.
57  virtual void insertedFlow(const Address &addr, const QoSCube& qos, RMTPort * port);
58 
59  // A previous existing port has been deleted.
60  virtual void removedFlow(const Address &addr, const QoSCube& qos, RMTPort * port);
61 
62  // Routing policy signal an update.
63  virtual void routingUpdated();
64 
65 protected:
66 
67  // Handles messages directed to this module.
68  virtual void handleMessage(cMessage *msg);
69 
70  // Policy initialization steps.
71  virtual void onPolicyInit();
72 
73 private:
74  DA * difA;
79 
80  // Cache for the rates of the local ports.
82 
83  // Time between a link load check and another.
84  int rtInt;
85  // Time between a route update and another.
86  int upInt;
87 
88  // Does the entry in exists in cache?
89  bool rateCacheEntryExists(std::string dest, std::string qos);
90 };
91 
92 #endif // __PORTSLOADGENERATOR_H
virtual void onPolicyInit()
Nentries::iterator NentriesIt
SimpleTable::SimpleTable * fwd
NTable::iterator NTableIt
RateMap::iterator RateIter
PortsSet::iterator PortsSetIt
virtual void removedFlow(const Address &addr, const QoSCube &qos, RMTPort *port)
QosToRateMap::iterator QTRIter
std::map< std::string, unsigned short > QosToRateMap
PortsLoadMonitor * rmtp
Definition: DA.h:43
virtual void handleMessage(cMessage *msg)
Class representing QoSCube with all its properties that is primarily used by FA, RMT and RA Specifica...
Definition: QoSCube.h:57
std::map< std::string, PortsSet > Nentries
IntPortsLoadRouting * rt
std::map< std::string, QosToRateMap > RateMap
std::set< RMTPort * > PortsSet
virtual void routingUpdated()
Address class holds IPC Process identification.
Definition: Address.h:42
std::map< std::string, Nentries > NTable
bool rateCacheEntryExists(std::string dest, std::string qos)
virtual void insertedFlow(const Address &addr, const QoSCube &qos, RMTPort *port)