A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
olsr-state.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2004 Francisco J. Ros
3 * Copyright (c) 2007 INESC Porto
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Authors: Francisco J. Ros <fjrm@dif.um.es>
19 * Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
20 */
21
22#ifndef OLSR_STATE_H
23#define OLSR_STATE_H
24
25#include "olsr-repositories.h"
26
27namespace ns3
28{
29namespace olsr
30{
31
36{
37 // friend class Olsr;
38
39 protected:
52
53 public:
55 {
56 }
57
58 // MPR selector
59
65 {
66 return m_mprSelectorSet;
67 }
68
75
80 void EraseMprSelectorTuple(const MprSelectorTuple& tuple);
81
86 void EraseMprSelectorTuples(const Ipv4Address& mainAddr);
87
93
98 std::string PrintMprSelectorSet() const;
99
100 // Neighbor
101
107 {
108 return m_neighborSet;
109 }
110
116 {
117 return m_neighborSet;
118 }
119
126
132 const NeighborTuple* FindSymNeighborTuple(const Ipv4Address& mainAddr) const;
133
140 NeighborTuple* FindNeighborTuple(const Ipv4Address& mainAddr, Willingness willingness);
141
146 void EraseNeighborTuple(const NeighborTuple& neighborTuple);
151 void EraseNeighborTuple(const Ipv4Address& mainAddr);
152
157 void InsertNeighborTuple(const NeighborTuple& tuple);
158
159 // Two-hop neighbor
160
166 {
167 return m_twoHopNeighborSet;
168 }
169
175 {
176 return m_twoHopNeighborSet;
177 }
178
186 const Ipv4Address& twoHopNeighbor);
187
197 void EraseTwoHopNeighborTuples(const Ipv4Address& neighbor);
203 void EraseTwoHopNeighborTuples(const Ipv4Address& neighbor, const Ipv4Address& twoHopNeighbor);
209
210 // MPR
211
217 bool FindMprAddress(const Ipv4Address& address);
218
223 void SetMprSet(MprSet mprSet);
224
229 MprSet GetMprSet() const;
230
231 // Duplicate
232
239 DuplicateTuple* FindDuplicateTuple(const Ipv4Address& address, uint16_t sequenceNumber);
240
245 void EraseDuplicateTuple(const DuplicateTuple& tuple);
250 void InsertDuplicateTuple(const DuplicateTuple& tuple);
251
252 // Link
253
258 const LinkSet& GetLinks() const
259 {
260 return m_linkSet;
261 }
262
268 LinkTuple* FindLinkTuple(const Ipv4Address& ifaceAddr);
275 LinkTuple* FindSymLinkTuple(const Ipv4Address& ifaceAddr, Time time);
280 void EraseLinkTuple(const LinkTuple& tuple);
286 LinkTuple& InsertLinkTuple(const LinkTuple& tuple);
287
288 // Topology
289
295 {
296 return m_topologySet;
297 }
298
305 TopologyTuple* FindTopologyTuple(const Ipv4Address& destAddr, const Ipv4Address& lastAddr);
312 TopologyTuple* FindNewerTopologyTuple(const Ipv4Address& lastAddr, uint16_t ansn);
317 void EraseTopologyTuple(const TopologyTuple& tuple);
323 void EraseOlderTopologyTuples(const Ipv4Address& lastAddr, uint16_t ansn);
328 void InsertTopologyTuple(const TopologyTuple& tuple);
329
330 // Interface association
331
337 {
338 return m_ifaceAssocSet;
339 }
340
346 {
347 return m_ifaceAssocSet;
348 }
349
361 const IfaceAssocTuple* FindIfaceAssocTuple(const Ipv4Address& ifaceAddr) const;
366 void EraseIfaceAssocTuple(const IfaceAssocTuple& tuple);
371 void InsertIfaceAssocTuple(const IfaceAssocTuple& tuple);
372
373 // Host-Network Association
378 const AssociationSet& GetAssociationSet() const // Associations known to the node
379 {
380 return m_associationSet;
381 }
382
387 const Associations& GetAssociations() const // Set of associations that the node has
388 {
389 return m_associations;
390 }
391
400 const Ipv4Address& networkAddr,
401 const Ipv4Mask& netmask);
406 void EraseAssociationTuple(const AssociationTuple& tuple);
411 void InsertAssociationTuple(const AssociationTuple& tuple);
416 void EraseAssociation(const Association& tuple);
421 void InsertAssociation(const Association& tuple);
422
429 std::vector<Ipv4Address> FindNeighborInterfaces(const Ipv4Address& neighborMainAddr) const;
430};
431
432} // namespace olsr
433} // namespace ns3
434
435#endif /* OLSR_STATE_H */
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:42
a class to represent an Ipv4 address mask
Definition: ipv4-address.h:257
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
This class encapsulates all data structures needed for maintaining internal state of an OLSR node.
Definition: olsr-state.h:36
MprSet GetMprSet() const
Gets the MPR set.
Definition: olsr-state.cc:272
TwoHopNeighborSet & GetTwoHopNeighbors()
Gets the 2-hop neighbor set.
Definition: olsr-state.h:174
void EraseAssociation(const Association &tuple)
Erases an association.
Definition: olsr-state.cc:528
const NeighborSet & GetNeighbors() const
Gets the neighbor set.
Definition: olsr-state.h:106
AssociationSet m_associationSet
Association Set (RFC 3626, section12.2).
Definition: olsr-state.h:48
void EraseIfaceAssocTuple(const IfaceAssocTuple &tuple)
Erases a interface association tuple.
Definition: olsr-state.cc:458
void InsertTopologyTuple(const TopologyTuple &tuple)
Inserts a topology tuple.
Definition: olsr-state.cc:424
IfaceAssocTuple * FindIfaceAssocTuple(const Ipv4Address &ifaceAddr)
Finds a interface association tuple.
Definition: olsr-state.cc:432
std::string PrintMprSelectorSet() const
Prints the MPR selector sets.
Definition: olsr-state.cc:86
LinkSet m_linkSet
Link Set (RFC 3626, section 4.2.1).
Definition: olsr-state.h:40
TwoHopNeighborTuple * FindTwoHopNeighborTuple(const Ipv4Address &neighbor, const Ipv4Address &twoHopNeighbor)
Finds a 2-hop neighbor tuple.
Definition: olsr-state.cc:189
void EraseTwoHopNeighborTuples(const Ipv4Address &neighbor)
Erases the 2-hop neighbor tuples with the same 1-hop neighbor.
Definition: olsr-state.cc:235
void InsertAssociation(const Association &tuple)
Inserts an association tuple.
Definition: olsr-state.cc:541
LinkTuple * FindSymLinkTuple(const Ipv4Address &ifaceAddr, Time time)
Finds a symmetrical link tuple.
Definition: olsr-state.cc:327
const NeighborTuple * FindSymNeighborTuple(const Ipv4Address &mainAddr) const
Finds a symmetrical neighbor tuple.
Definition: olsr-state.cc:120
IfaceAssocSet & GetIfaceAssocSetMutable()
Gets a mutable reference to the interface association set.
Definition: olsr-state.h:345
DuplicateSet m_duplicateSet
Duplicate Set (RFC 3626, section 3.4).
Definition: olsr-state.h:46
IfaceAssocSet m_ifaceAssocSet
Interface Association Set (RFC 3626, section 4.1).
Definition: olsr-state.h:47
void EraseNeighborTuple(const NeighborTuple &neighborTuple)
Erases a neighbor tuple.
Definition: olsr-state.cc:146
TopologyTuple * FindNewerTopologyTuple(const Ipv4Address &lastAddr, uint16_t ansn)
Finds a topology tuple.
Definition: olsr-state.cc:382
void InsertDuplicateTuple(const DuplicateTuple &tuple)
Inserts a duplicate tuple.
Definition: olsr-state.cc:306
const TopologySet & GetTopologySet() const
Gets the topology set.
Definition: olsr-state.h:294
const LinkSet & GetLinks() const
Gets the Link set.
Definition: olsr-state.h:258
Associations m_associations
The node's local Host Network Associations that will be advertised using HNA messages.
Definition: olsr-state.h:50
void EraseMprSelectorTuples(const Ipv4Address &mainAddr)
Erases all MPR selector tuples belonging to the same address.
Definition: olsr-state.cc:64
const TwoHopNeighborSet & GetTwoHopNeighbors() const
Gets the 2-hop neighbor set.
Definition: olsr-state.h:165
MprSelectorTuple * FindMprSelectorTuple(const Ipv4Address &mainAddr)
Finds a MPR selector tuple.
Definition: olsr-state.cc:38
void SetMprSet(MprSet mprSet)
Sets the MPR set to the one specified.
Definition: olsr-state.cc:266
void EraseAssociationTuple(const AssociationTuple &tuple)
Erases a known association tuple.
Definition: olsr-state.cc:509
void InsertNeighborTuple(const NeighborTuple &tuple)
Inserts a neighbor tuple.
Definition: olsr-state.cc:172
NeighborSet m_neighborSet
Neighbor Set (RFC 3626, section 4.3.1).
Definition: olsr-state.h:41
TopologyTuple * FindTopologyTuple(const Ipv4Address &destAddr, const Ipv4Address &lastAddr)
Finds a topology tuple.
Definition: olsr-state.cc:369
TwoHopNeighborSet m_twoHopNeighborSet
2-hop Neighbor Set (RFC 3626, section 4.3.2).
Definition: olsr-state.h:42
NeighborSet & GetNeighbors()
Gets the neighbor set.
Definition: olsr-state.h:115
AssociationTuple * FindAssociationTuple(const Ipv4Address &gatewayAddr, const Ipv4Address &networkAddr, const Ipv4Mask &netmask)
Finds an association tuple.
Definition: olsr-state.cc:493
std::vector< Ipv4Address > FindNeighborInterfaces(const Ipv4Address &neighborMainAddr) const
Returns a vector of all interfaces of a given neighbor, with the exception of the "main" one.
Definition: olsr-state.cc:477
bool FindMprAddress(const Ipv4Address &address)
Checks if there's an MPR with a specific address.
Definition: olsr-state.cc:259
void EraseLinkTuple(const LinkTuple &tuple)
Erases a link tuple.
Definition: olsr-state.cc:347
DuplicateTuple * FindDuplicateTuple(const Ipv4Address &address, uint16_t sequenceNumber)
Finds a duplicate tuple.
Definition: olsr-state.cc:280
void InsertTwoHopNeighborTuple(const TwoHopNeighborTuple &tuple)
Inserts a 2-hop neighbor tuple.
Definition: olsr-state.cc:251
const AssociationSet & GetAssociationSet() const
Gets the association set known to the node.
Definition: olsr-state.h:378
LinkTuple * FindLinkTuple(const Ipv4Address &ifaceAddr)
Finds a link tuple.
Definition: olsr-state.cc:314
const IfaceAssocSet & GetIfaceAssocSet() const
Gets the interface association set.
Definition: olsr-state.h:336
const Associations & GetAssociations() const
Gets the association set the node has.
Definition: olsr-state.h:387
void InsertAssociationTuple(const AssociationTuple &tuple)
Inserts a known association tuple.
Definition: olsr-state.cc:522
MprSet m_mprSet
MPR Set (RFC 3626, section 4.3.3).
Definition: olsr-state.h:44
void InsertMprSelectorTuple(const MprSelectorTuple &tuple)
Inserts a MPR selector tuple.
Definition: olsr-state.cc:80
LinkTuple & InsertLinkTuple(const LinkTuple &tuple)
Inserts a link tuple.
Definition: olsr-state.cc:360
MprSelectorSet m_mprSelectorSet
MPR Selector Set (RFC 3626, section 4.3.4).
Definition: olsr-state.h:45
void EraseTwoHopNeighborTuple(const TwoHopNeighborTuple &tuple)
Erases a 2-hop neighbor tuple.
Definition: olsr-state.cc:204
void InsertIfaceAssocTuple(const IfaceAssocTuple &tuple)
Inserts a interface association tuple.
Definition: olsr-state.cc:471
void EraseTopologyTuple(const TopologyTuple &tuple)
Erases a topology tuple.
Definition: olsr-state.cc:395
NeighborTuple * FindNeighborTuple(const Ipv4Address &mainAddr)
Finds a neighbor tuple.
Definition: olsr-state.cc:107
void EraseOlderTopologyTuples(const Ipv4Address &lastAddr, uint16_t ansn)
Erases a topology tuple.
Definition: olsr-state.cc:408
void EraseDuplicateTuple(const DuplicateTuple &tuple)
Erases a duplicate tuple.
Definition: olsr-state.cc:293
TopologySet m_topologySet
Topology Set (RFC 3626, section 4.4).
Definition: olsr-state.h:43
const MprSelectorSet & GetMprSelectors() const
Gets the MPR selectors.
Definition: olsr-state.h:64
void EraseMprSelectorTuple(const MprSelectorTuple &tuple)
Erases a MPR selector tuple.
Definition: olsr-state.cc:51
Willingness
Willingness for forwarding packets from other nodes.
std::vector< MprSelectorTuple > MprSelectorSet
MPR Selector Set type.
std::vector< AssociationTuple > AssociationSet
Association Set type.
std::vector< TwoHopNeighborTuple > TwoHopNeighborSet
2-hop Neighbor Set type.
std::vector< LinkTuple > LinkSet
Link Set type.
std::vector< Association > Associations
Association Set type.
std::vector< TopologyTuple > TopologySet
Topology Set type.
std::set< Ipv4Address > MprSet
MPR Set type.
std::vector< DuplicateTuple > DuplicateSet
Duplicate Set type.
std::vector< NeighborTuple > NeighborSet
Neighbor Set type.
std::vector< IfaceAssocTuple > IfaceAssocSet
Interface Association Set type.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Definition: olsr.py:1
An Interface Association Tuple.
An MPR-Selector Tuple.