/usr/include/ns3.27/ns3/olsr-state.h is in libns3-dev 3.27+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2004 Francisco J. Ros
* Copyright (c) 2007 INESC Porto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Authors: Francisco J. Ros <fjrm@dif.um.es>
* Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
*/
#ifndef OLSR_STATE_H
#define OLSR_STATE_H
#include "olsr-repositories.h"
namespace ns3 {
namespace olsr {
/// \ingroup olsr
/// This class encapsulates all data structures needed for maintaining internal state of an OLSR node.
class OlsrState
{
// friend class Olsr;
protected:
LinkSet m_linkSet; //!< Link Set (\RFC{3626}, section 4.2.1).
NeighborSet m_neighborSet; //!< Neighbor Set (\RFC{3626}, section 4.3.1).
TwoHopNeighborSet m_twoHopNeighborSet; //!< 2-hop Neighbor Set (\RFC{3626}, section 4.3.2).
TopologySet m_topologySet; //!< Topology Set (\RFC{3626}, section 4.4).
MprSet m_mprSet; //!< MPR Set (\RFC{3626}, section 4.3.3).
MprSelectorSet m_mprSelectorSet; //!< MPR Selector Set (\RFC{3626}, section 4.3.4).
DuplicateSet m_duplicateSet; //!< Duplicate Set (\RFC{3626}, section 3.4).
IfaceAssocSet m_ifaceAssocSet; //!< Interface Association Set (\RFC{3626}, section 4.1).
AssociationSet m_associationSet; //!< Association Set (\RFC{3626}, section12.2). Associations obtained from HNA messages generated by other nodes.
Associations m_associations; //!< The node's local Host Network Associations that will be advertised using HNA messages.
public:
OlsrState ()
{
}
// MPR selector
/**
* Gets the MPR selectors.
* \returns The MPR selectors.
*/
const MprSelectorSet & GetMprSelectors () const
{
return m_mprSelectorSet;
}
/**
* Finds a MPR selector tuple.
* \param mainAddr The MPR selector main address.
* \returns The MPR selector, if found. Else it returns a null pointer.
*/
MprSelectorTuple* FindMprSelectorTuple (const Ipv4Address &mainAddr);
/**
* Erases a MPR selector tuple.
* \param tuple The MPR selector tuple.
*/
void EraseMprSelectorTuple (const MprSelectorTuple &tuple);
/**
* Erases all MPR selector tuples belonging to the same address.
* \param mainAddr The MPR selector main address.
*/
void EraseMprSelectorTuples (const Ipv4Address &mainAddr);
/**
* Inserts a MPR selector tuple
* \param tuple The MPR selector tuple.
*/
void InsertMprSelectorTuple (const MprSelectorTuple &tuple);
/**
* Prints the MPR selector sets.
* \return a string with the output data.
*/
std::string PrintMprSelectorSet () const;
// Neighbor
/**
* Gets the neighbor set.
* \returns The neighbor set.
*/
const NeighborSet & GetNeighbors () const
{
return m_neighborSet;
}
/**
* Gets the neighbor set.
* \returns The neighbor set.
*/
NeighborSet & GetNeighbors ()
{
return m_neighborSet;
}
/**
* Finds a neighbor tuple.
* \param mainAddr The neighbor tuple main address.
* \returns The neighbor tuple, if found. Else it returns a null pointer.
*/
NeighborTuple* FindNeighborTuple (const Ipv4Address &mainAddr);
/**
* Finds a symmetrical neighbor tuple.
* \param mainAddr The neighbor tuple main address.
* \returns The neighbor tuple, if found. Else it returns a null pointer.
*/
const NeighborTuple* FindSymNeighborTuple (const Ipv4Address &mainAddr) const;
/**
* Finds a neighbor tuple.
* \param mainAddr The neighbor tuple main address.
* \param willingness The neighbor willingness.
* \returns The neighbor tuple, if found. Else it returns a null pointer.
*/
NeighborTuple* FindNeighborTuple (const Ipv4Address &mainAddr,
uint8_t willingness);
/**
* Erases a neighbor tuple.
* \param neighborTuple The neighbor tuple.
*/
void EraseNeighborTuple (const NeighborTuple &neighborTuple);
/**
* Erases a neighbor tuple.
* \param mainAddr The neighbor tuple main address.
*/
void EraseNeighborTuple (const Ipv4Address &mainAddr);
/**
* Inserts a neighbor tuple.
* \param tuple The neighbor tuple.
*/
void InsertNeighborTuple (const NeighborTuple &tuple);
// Two-hop neighbor
/**
* Gets the 2-hop neighbor set.
* \returns The 2-hop neighbor set.
*/
const TwoHopNeighborSet & GetTwoHopNeighbors () const
{
return m_twoHopNeighborSet;
}
/**
* Gets the 2-hop neighbor set.
* \returns The 2-hop neighbor set.
*/
TwoHopNeighborSet & GetTwoHopNeighbors ()
{
return m_twoHopNeighborSet;
}
/**
* Finds a 2-hop neighbor tuple.
* \param neighbor The neighbor main address.
* \param twoHopNeighbor The 2-hop neighbor main address.
* \returns The 2-hop neighbor tuple, if found. Else it returns a null pointer.
*/
TwoHopNeighborTuple* FindTwoHopNeighborTuple (const Ipv4Address &neighbor,
const Ipv4Address &twoHopNeighbor);
/**
* Erases a 2-hop neighbor tuple.
* \param tuple The 2-hop neighbor tuple.
*/
void EraseTwoHopNeighborTuple (const TwoHopNeighborTuple &tuple);
/**
* Erases the 2-hop neighbor tuples with the same 1-hop neighbor.
* \param neighbor The neighbor address.
*/
void EraseTwoHopNeighborTuples (const Ipv4Address &neighbor);
/**
* Erases the 2-hop neighbor tuples with matching predicates.
* \param neighbor The neighbor address.
* \param twoHopNeighbor The 2-hop neighbor main address.
*/
void EraseTwoHopNeighborTuples (const Ipv4Address &neighbor,
const Ipv4Address &twoHopNeighbor);
/**
* Inserts a 2-hop neighbor tuple.
* \param tuple The 2-hop neighbor tuple.
*/
void InsertTwoHopNeighborTuple (const TwoHopNeighborTuple &tuple);
// MPR
/**
* Checks if there's an MPR with a specific address.
* \param address The address to test.
* \return True if a MPR with the specified address exists.
*/
bool FindMprAddress (const Ipv4Address &address);
/**
* Sets the MPR set to the one specified.
* \param mprSet The new MPR set.
*/
void SetMprSet (MprSet mprSet);
/**
* Gets the MPR set.
* \return The MPR set.
*/
MprSet GetMprSet () const;
// Duplicate
/**
* Finds a duplicate tuple.
* \param address The duplicate tuple address.
* \param sequenceNumber The duplicate tuple sequence number.
* \returns The duplicate tuple, or a null pointer if no match.
*/
DuplicateTuple* FindDuplicateTuple (const Ipv4Address &address,
uint16_t sequenceNumber);
/**
* Erases a duplicate tuple.
* \param tuple The tuple to erase.
*/
void EraseDuplicateTuple (const DuplicateTuple &tuple);
/**
* Inserts a duplicate tuple.
* \param tuple The tuple to insert.
*/
void InsertDuplicateTuple (const DuplicateTuple &tuple);
// Link
/**
* Gets the Link set.
* \return The Link set.
*/
const LinkSet & GetLinks () const
{
return m_linkSet;
}
/**
* Finds a link tuple.
* \param ifaceAddr The interface address of the link.
* \returns The link tuple, or a null pointer if no match.
*/
LinkTuple* FindLinkTuple (const Ipv4Address &ifaceAddr);
/**
* Finds a symmetrical link tuple.
* \param ifaceAddr The interface address of the link.
* \param time The time at which the link should be considered symmetrical.
* \returns The link tuple, or a null pointer if no match.
*/
LinkTuple* FindSymLinkTuple (const Ipv4Address &ifaceAddr, Time time);
/**
* Erases a link tuple.
* \param tuple The tuple to erase.
*/
void EraseLinkTuple (const LinkTuple &tuple);
/**
* Inserts a link tuple.
* \param tuple The tuple to insert.
* \returns A reference to the inserted tuple.
*/
LinkTuple& InsertLinkTuple (const LinkTuple &tuple);
// Topology
/**
* Gets the topology set.
* \returns The topology set.
*/
const TopologySet & GetTopologySet () const
{
return m_topologySet;
}
/**
* Finds a topology tuple.
* \param destAddr The destination address.
* \param lastAddr The address of the node previous to the destination.
* \returns The topology tuple, or a null pointer if no match.
*/
TopologyTuple* FindTopologyTuple (const Ipv4Address &destAddr,
const Ipv4Address &lastAddr);
/**
* Finds a topology tuple.
* \param lastAddr The address of the node previous to the destination.
* \param ansn The Advertised Neighbor Sequence Number.
* \returns The topology tuple, or a null pointer if no match.
*/
TopologyTuple* FindNewerTopologyTuple (const Ipv4Address &lastAddr,
uint16_t ansn);
/**
* Erases a topology tuple.
* \param tuple The tuple to erase.
*/
void EraseTopologyTuple (const TopologyTuple &tuple);
/**
* Erases a topology tuple.
* \param lastAddr The address of the node previous to the destination.
* \param ansn The Advertised Neighbor Sequence Number.
*/
void EraseOlderTopologyTuples (const Ipv4Address &lastAddr,
uint16_t ansn);
/**
* Inserts a topology tuple.
* \param tuple The tuple to insert.
*/
void InsertTopologyTuple (const TopologyTuple &tuple);
// Interface association
/**
* Gets the interface association set.
* \returns The interface association set.
*/
const IfaceAssocSet & GetIfaceAssocSet () const
{
return m_ifaceAssocSet;
}
/**
* Gets a mutable reference to the interface association set.
* \returns The interface association set.
*/
IfaceAssocSet & GetIfaceAssocSetMutable ()
{
return m_ifaceAssocSet;
}
/**
* Finds a interface association tuple.
* \param ifaceAddr The interface address.
* \returns The interface association tuple, or a null pointer if no match.
*/
IfaceAssocTuple* FindIfaceAssocTuple (const Ipv4Address &ifaceAddr);
/**
* Finds a interface association tuple.
* \param ifaceAddr The interface address.
* \returns The interface association tuple, or a null pointer if no match.
*/
const IfaceAssocTuple* FindIfaceAssocTuple (const Ipv4Address &ifaceAddr) const;
/**
* Erases a interface association tuple.
* \param tuple The tuple to erase.
*/
void EraseIfaceAssocTuple (const IfaceAssocTuple &tuple);
/**
* Inserts a interface association tuple.
* \param tuple The tuple to insert.
*/
void InsertIfaceAssocTuple (const IfaceAssocTuple &tuple);
// Host-Network Association
/**
* Gets the association set known to the node.
* \returns The association set known to the node.
*/
const AssociationSet & GetAssociationSet () const // Associations known to the node
{
return m_associationSet;
}
/**
* Gets the association set the node has.
* \returns The association set the node has.
*/
const Associations & GetAssociations () const // Set of associations that the node has
{
return m_associations;
}
/**
* Finds an association tuple.
* \param gatewayAddr The gateway address.
* \param networkAddr The network address.
* \param netmask The network mask.
* \returns The association tuple, or a null pointer if no match.
*/
AssociationTuple* FindAssociationTuple (const Ipv4Address &gatewayAddr, \
const Ipv4Address &networkAddr, \
const Ipv4Mask &netmask);
/**
* Erases a known association tuple.
* \param tuple The tuple to erase.
*/
void EraseAssociationTuple (const AssociationTuple &tuple);
/**
* Inserts a known association tuple.
* \param tuple The tuple to insert.
*/
void InsertAssociationTuple (const AssociationTuple &tuple);
/**
* Erases an association.
* \param tuple The tuple to erase.
*/
void EraseAssociation (const Association &tuple);
/**
* Inserts an association tuple.
* \param tuple The tuple to insert.
*/
void InsertAssociation (const Association &tuple);
/**
* Returns a vector of all interfaces of a given neighbor, with the
* exception of the "main" one.
* \param neighborMainAddr The neighbor main address
* \returns A container of the neighbor addresses (excluding the main one).
*/
std::vector<Ipv4Address>
FindNeighborInterfaces (const Ipv4Address &neighborMainAddr) const;
};
}
} // namespace olsr,ns3
#endif /* OLSR_STATE_H */
|