RINASim
October 2016
Documentation of framework for OMNeT++
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
DV.h
Go to the documentation of this file.
1
// The MIT License (MIT)
2
//
3
// Copyright (c) 2014-2016 Brno University of Technology, PRISTINE project
4
//
5
// Permission is hereby granted, free of charge, to any person obtaining a copy
6
// of this software and associated documentation files (the "Software"), to deal
7
// in the Software without restriction, including without limitation the rights
8
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
// copies of the Software, and to permit persons to whom the Software is
10
// furnished to do so, subject to the following conditions:
11
//
12
// The above copyright notice and this permission notice shall be included in
13
// all copies or substantial portions of the Software.
14
//
15
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
// THE SOFTWARE.
22
23
/*
24
* DV.h
25
*
26
* Created on: Mar 23, 2015
27
* Author: gaixas1
28
*/
29
30
#ifndef DV_H_
31
#define DV_H_
32
33
#include <
DomainRouting/rModule.h
>
34
35
namespace
DMRnmsDV
{
36
37
using namespace
DMRnms
;
38
40
// Data structures
41
42
struct
rtEntry
{
43
std::string
addr
;
44
unsigned
short
metric
;
45
rtEntry
()
46
:addr(
""
), metric(UINT16_MAX){}
47
rtEntry
(
const
std::string &_addr,
const
unsigned
short
&_metric)
48
:addr(_addr), metric(_metric){}
49
};
50
typedef
std::vector<rtEntry>
entriesL
;
51
typedef
std::vector<rtEntry>::iterator
entriesIt
;
52
53
typedef
std::map<Address, unsigned short>
neighMetric
;
54
typedef
neighMetric::iterator
neighMetricIt
;
55
56
57
struct
tEntry
{
58
Address
addr
;
59
unsigned
short
metric
;
60
tEntry
()
61
:addr(
""
), metric(UINT16_MAX){}
62
tEntry
(
const
std::string &_addr,
const
unsigned
short
&_metric)
63
:addr(_addr), metric(_metric){}
64
};
65
typedef
std::map<std::string, tEntry>
tTable
;
66
typedef
tTable::iterator
tTableIt
;
67
68
typedef
std::set<std::string>
sSet
;
69
typedef
sSet::iterator
sSetIt
;
70
71
72
74
// Update Message
75
76
class
DVUpdate
:
public
RoutingUpdate
{
77
public
:
78
DVUpdate
(
const
Address
&_addr,
const
std::string &_domain);
79
80
void
addEntry(
rtEntry
_e);
81
82
entriesIt entriesBegin();
83
entriesIt entriesEnd();
84
85
protected
:
86
entriesL
entries
;
87
};
88
89
90
92
// Routing Module
93
94
class
DomainRouting;
95
96
class
DV
:
public
rModule
{
97
public
:
98
DV
(
Routing
* parent,
const
Address
&_nAddr,
const
std::string &_domain,
const
std::string &_addr);
99
100
bool
processUpdate(
RoutingUpdate
* update);
101
void
addFlow(
const
Address
&_nAddr,
const
std::string &_addr,
const
unsigned
short
&_metric);
102
void
removeFlow(
const
Address
&_nAddr,
const
std::string &_addr);
103
104
void
addAddr(
const
std::string &_addr);
105
void
removeAddr(
const
std::string &_addr);
106
107
void
setInfMetric(
const
unsigned
short
&inf);
108
109
dmNxt
getChanges();
110
dmNxt
getAll();
111
112
void
handleMessage(cMessage *msg);
113
114
protected
:
115
tTable
table
;
116
neighMetric
nei
;
117
unsigned
short
infMetric
;
118
s2A
changes
;
119
sSet
changedEntries
;
120
sSet
myAddrSet
;
121
122
bool
scheduledUpdate
;
123
void
scheduleUpdate();
124
};
125
126
}
/* namespace DomainRoutingDV */
127
128
#endif
/* DV_H_ */
DMRnmsDV::DVUpdate::entries
entriesL entries
Definition:
DV.h:86
DMRnmsDV::DV::myAddrSet
sSet myAddrSet
Definition:
DV.h:120
DMRnmsDV::tEntry::tEntry
tEntry(const std::string &_addr, const unsigned short &_metric)
Definition:
DV.h:62
DMRnmsDV::DV::scheduledUpdate
bool scheduledUpdate
Definition:
DV.h:122
DMRnmsDV::tEntry
Definition:
DV.h:57
DMRnmsDV::tTableIt
tTable::iterator tTableIt
Definition:
DV.h:66
rModule.h
DMRnms::rModule
Definition:
rModule.h:67
DMRnmsDV::tTable
std::map< std::string, tEntry > tTable
Definition:
DV.h:65
DMRnms::RoutingUpdate
Definition:
rModule.h:58
DMRnmsDV::DV
Definition:
DV.h:96
DMRnmsDV::rtEntry
Definition:
DV.h:42
DMRnms
Definition:
rModule.cc:33
DMRnms::dmNxt
Definition:
rModule.h:44
DMRnmsDV::entriesIt
std::vector< rtEntry >::iterator entriesIt
Definition:
DV.h:51
DMRnms::Routing
Definition:
Routing.h:49
DMRnmsDV::sSetIt
sSet::iterator sSetIt
Definition:
DV.h:69
DMRnms::DV
Definition:
Routing.h:38
DMRnmsDV::sSet
std::set< std::string > sSet
Definition:
DV.h:68
DMRnmsDV::entriesL
std::vector< rtEntry > entriesL
Definition:
DV.h:50
DMRnmsDV::DVUpdate
Definition:
DV.h:76
DMRnmsDV::rtEntry::rtEntry
rtEntry()
Definition:
DV.h:45
DMRnmsDV::tEntry::tEntry
tEntry()
Definition:
DV.h:60
DMRnmsDV::DV::changes
s2A changes
Definition:
DV.h:118
DMRnmsDV::tEntry::addr
Address addr
Definition:
DV.h:58
DMRnmsDV::rtEntry::addr
std::string addr
Definition:
DV.h:43
DMRnmsDV::DV::table
tTable table
Definition:
DV.h:115
DMRnmsDV::DV::nei
neighMetric nei
Definition:
DV.h:116
DMRnmsDV::rtEntry::metric
unsigned short metric
Definition:
DV.h:44
DMRnmsDV::DV::changedEntries
sSet changedEntries
Definition:
DV.h:119
DMRnmsDV::tEntry::metric
unsigned short metric
Definition:
DV.h:59
DMRnms::s2A
std::map< std::string, Address > s2A
Definition:
rModule.h:43
DMRnmsDV::rtEntry::rtEntry
rtEntry(const std::string &_addr, const unsigned short &_metric)
Definition:
DV.h:47
DMRnmsDV::neighMetric
std::map< Address, unsigned short > neighMetric
Definition:
DV.h:53
Address
Address class holds IPC Process identification.
Definition:
Address.h:42
DMRnmsDV::neighMetricIt
neighMetric::iterator neighMetricIt
Definition:
DV.h:54
DMRnmsDV::DV::infMetric
unsigned short infMetric
Definition:
DV.h:117
DMRnmsDV
Definition:
DV.cc:33
policies
DIF
Routing
DomainRouting
DV
DV.h
Generated on Tue Oct 25 2016 21:08:57 for RINASim by
1.8.10