A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
olsr-state.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2004 Francisco J. Ros
4
* Copyright (c) 2007 INESC Porto
5
*
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License version 2 as
8
* published by the Free Software Foundation;
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
*
19
* Authors: Francisco J. Ros <fjrm@dif.um.es>
20
* Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
21
*/
22
24
25
#ifndef OLSR_STATE_H
26
#define OLSR_STATE_H
27
28
#include "
olsr-repositories.h
"
29
30
namespace
ns3 {
31
32
using namespace
olsr;
33
35
class
OlsrState
36
{
37
// friend class Olsr;
38
39
protected
:
40
LinkSet
m_linkSet
;
41
NeighborSet
m_neighborSet
;
42
TwoHopNeighborSet
m_twoHopNeighborSet
;
43
TopologySet
m_topologySet
;
44
MprSet
m_mprSet
;
45
MprSelectorSet
m_mprSelectorSet
;
46
DuplicateSet
m_duplicateSet
;
47
IfaceAssocSet
m_ifaceAssocSet
;
48
AssociationSet
m_associationSet
;
49
Associations
m_associations
;
50
51
public
:
52
53
OlsrState
()
54
{}
55
56
// MPR selector
57
const
MprSelectorSet
& GetMprSelectors ()
const
58
{
59
return
m_mprSelectorSet;
60
}
61
MprSelectorTuple
* FindMprSelectorTuple (
const
Ipv4Address
&mainAddr);
62
void
EraseMprSelectorTuple (
const
MprSelectorTuple
&tuple);
63
void
EraseMprSelectorTuples (
const
Ipv4Address
&mainAddr);
64
void
InsertMprSelectorTuple (
const
MprSelectorTuple
&tuple);
65
std::string PrintMprSelectorSet ()
const
;
66
67
// Neighbor
68
const
NeighborSet
& GetNeighbors ()
const
69
{
70
return
m_neighborSet;
71
}
72
NeighborSet
& GetNeighbors ()
73
{
74
return
m_neighborSet;
75
}
76
NeighborTuple
* FindNeighborTuple (
const
Ipv4Address
&mainAddr);
77
const
NeighborTuple
* FindSymNeighborTuple (
const
Ipv4Address
&mainAddr)
const
;
78
NeighborTuple
* FindNeighborTuple (
const
Ipv4Address
&mainAddr,
79
uint8_t willingness);
80
void
EraseNeighborTuple (
const
NeighborTuple
&neighborTuple);
81
void
EraseNeighborTuple (
const
Ipv4Address
&mainAddr);
82
void
InsertNeighborTuple (
const
NeighborTuple
&tuple);
83
84
// Two-hop neighbor
85
const
TwoHopNeighborSet
& GetTwoHopNeighbors ()
const
86
{
87
return
m_twoHopNeighborSet;
88
}
89
TwoHopNeighborSet
& GetTwoHopNeighbors ()
90
{
91
return
m_twoHopNeighborSet;
92
}
93
TwoHopNeighborTuple
* FindTwoHopNeighborTuple (
const
Ipv4Address
&neighbor,
94
const
Ipv4Address
&twoHopNeighbor);
95
void
EraseTwoHopNeighborTuple (
const
TwoHopNeighborTuple
&tuple);
96
void
EraseTwoHopNeighborTuples (
const
Ipv4Address
&neighbor);
97
void
EraseTwoHopNeighborTuples (
const
Ipv4Address
&neighbor,
98
const
Ipv4Address
&twoHopNeighbor);
99
void
InsertTwoHopNeighborTuple (
const
TwoHopNeighborTuple
&tuple);
100
101
// MPR
102
bool
FindMprAddress (
const
Ipv4Address
&address);
104
void
SetMprSet (
MprSet
mprSet);
106
MprSet
GetMprSet ()
const
;
107
108
// Duplicate
109
DuplicateTuple
* FindDuplicateTuple (
const
Ipv4Address
&address,
110
uint16_t sequenceNumber);
111
void
EraseDuplicateTuple (
const
DuplicateTuple
&tuple);
112
void
InsertDuplicateTuple (
const
DuplicateTuple
&tuple);
113
114
// Link
115
const
LinkSet
& GetLinks ()
const
116
{
117
return
m_linkSet;
118
}
119
LinkTuple
* FindLinkTuple (
const
Ipv4Address
&ifaceAddr);
120
LinkTuple
* FindSymLinkTuple (
const
Ipv4Address
&ifaceAddr,
Time
time);
121
void
EraseLinkTuple (
const
LinkTuple
&tuple);
122
LinkTuple
& InsertLinkTuple (
const
LinkTuple
&tuple);
123
124
// Topology
125
const
TopologySet
& GetTopologySet ()
const
126
{
127
return
m_topologySet;
128
}
129
TopologyTuple
* FindTopologyTuple (
const
Ipv4Address
&destAddr,
130
const
Ipv4Address
&lastAddr);
131
TopologyTuple
* FindNewerTopologyTuple (
const
Ipv4Address
&lastAddr,
132
uint16_t ansn);
133
void
EraseTopologyTuple (
const
TopologyTuple
&tuple);
134
void
EraseOlderTopologyTuples (
const
Ipv4Address
&lastAddr,
135
uint16_t ansn);
136
void
InsertTopologyTuple (
const
TopologyTuple
&tuple);
137
138
// Interface association
139
const
IfaceAssocSet
& GetIfaceAssocSet ()
const
140
{
141
return
m_ifaceAssocSet;
142
}
143
IfaceAssocSet
& GetIfaceAssocSetMutable ()
144
{
145
return
m_ifaceAssocSet;
146
}
147
IfaceAssocTuple
* FindIfaceAssocTuple (
const
Ipv4Address
&ifaceAddr);
148
const
IfaceAssocTuple
* FindIfaceAssocTuple (
const
Ipv4Address
&ifaceAddr)
const
;
149
void
EraseIfaceAssocTuple (
const
IfaceAssocTuple
&tuple);
150
void
InsertIfaceAssocTuple (
const
IfaceAssocTuple
&tuple);
151
152
// Host-Network Association
153
const
AssociationSet
& GetAssociationSet () const
// Associations known to the node
154
{
155
return
m_associationSet;
156
}
157
158
const
Associations
& GetAssociations () const
// Set of associations that the node has
159
{
160
return
m_associations;
161
}
162
163
AssociationTuple
* FindAssociationTuple (
const
Ipv4Address
&gatewayAddr, \
164
const
Ipv4Address
&networkAddr, \
165
const
Ipv4Mask
&netmask);
166
void
EraseAssociationTuple (
const
AssociationTuple
&tuple);
167
void
InsertAssociationTuple (
const
AssociationTuple
&tuple);
168
void
EraseAssociation (
const
Association
&tuple);
169
void
InsertAssociation (
const
Association
&tuple);
170
171
// Returns a vector of all interfaces of a given neighbor, with the
172
// exception of the "main" one.
173
std::vector<Ipv4Address>
174
FindNeighborInterfaces (
const
Ipv4Address
&neighborMainAddr)
const
;
175
176
};
177
178
}
// namespace ns3
179
180
#endif
/* OLSR_STATE_H */
src
olsr
model
olsr-state.h
Generated on Tue Nov 13 2012 10:32:21 for ns-3 by
1.8.1.2