RINASim  October 2016
Documentation of framework for OMNeT++
HierarchicalTable.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 HierarchicalTable_H_
17 #define HierarchicalTable_H_
18 
19 #include <IntMMForwarding.h>
20 
21 #include <map>
22 #include <string>
23 #include <vector>
24 
25 namespace HierarchicalTable {
26 
27 using namespace std;
28 
29 typedef map<string, vector<RMTPort*> > FWDTable;
30 typedef FWDTable::iterator FWDTableIt;
31 
33 
34 public:
36 
37  void addDomain(const string & domId, const string & qos, const string & prefix);
38  void addDomain(const string & domId, const string & prefix);
39 
40  void removeDomain(string domId);
41 
42  // Lookup function, return a list of RMTPorts to forward a PDU/Address+qos.
43  vector<RMTPort * > lookup(const PDU * pdu);
44  vector<RMTPort * > lookup(const Address &dst, const string& qos);
45 
46  // Returns a representation of the Forwarding Knowledge
47  string toString();
48 
49  //Insert/Remove an entry
50  void addReplace(const string &domId, const string &addr, vector<RMTPort *> ports);
51 
52  void finish();
53 
54  void setAddr(const Address & addr);
55 
56  void setTmp(const Address & dst, RMTPort *p);
57  void removeTmp(const Address & dst, RMTPort *p);
58 
59 protected:
60  string anyQoS;
61 
63 
64  struct domData {
65  string domId;
66  unsigned int prefLen;
67  domData() : domId(""), prefLen(0){}
68  domData(const string & id, const unsigned int & len) : domId(id), prefLen(len){}
69  };
70 
71  // domain -> addr -> list<ports>
72  map<string, map<string, vector<RMTPort*> > > table;
73 
74  // prefix -> qos -> domain
75  map<string, map<string, domData> > domains;
76 
77  // Address port / temporal links
78  map<Address, RMTPort* > direct;
79 
80 
81  // Called after initialize
82  void onPolicyInit();
83 };
84 
85 }
86 
87 #endif /* HierarchicalTable_H_ */
map< Address, RMTPort * > direct
map< string, vector< RMTPort * > > FWDTable
map< string, map< string, domData > > domains
map< string, map< string, vector< RMTPort * > > > table
Definition: PDU.h:42
domData(const string &id, const unsigned int &len)
FWDTable::iterator FWDTableIt
Address class holds IPC Process identification.
Definition: Address.h:42