A Discrete-Event Network Simulator
API
olsr-routing-protocol.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 
23 #ifndef OLSR_AGENT_IMPL_H
24 #define OLSR_AGENT_IMPL_H
25 
26 #include "olsr-header.h"
27 #include "ns3/test.h"
28 #include "olsr-state.h"
29 #include "olsr-repositories.h"
30 
31 #include "ns3/object.h"
32 #include "ns3/packet.h"
33 #include "ns3/node.h"
34 #include "ns3/socket.h"
35 #include "ns3/event-garbage-collector.h"
36 #include "ns3/random-variable-stream.h"
37 #include "ns3/timer.h"
38 #include "ns3/traced-callback.h"
39 #include "ns3/ipv4.h"
40 #include "ns3/ipv4-routing-protocol.h"
41 #include "ns3/ipv4-static-routing.h"
42 
43 #include <vector>
44 #include <map>
45 
47 class OlsrMprTestCase;
48 
49 namespace ns3 {
50 namespace olsr {
51 
56 
60 {
63  uint32_t interface;
64  uint32_t distance;
65 
66  RoutingTableEntry (void) : // default values
67  destAddr (), nextAddr (),
68  interface (0), distance (0)
69  {
70  }
71 };
72 
73 class RoutingProtocol;
74 
81 {
82 public:
86  friend class ::OlsrMprTestCase;
87 
88  static const uint16_t OLSR_PORT_NUMBER;
89 
94  static TypeId GetTypeId (void);
95 
96  RoutingProtocol (void);
97  virtual ~RoutingProtocol (void);
98 
104  void SetMainInterface (uint32_t interface);
105 
111  void Dump (void);
112 
117  std::vector<RoutingTableEntry> GetRoutingTableEntries (void) const;
118 
123  MprSet GetMprSet (void) const;
124 
129  const MprSelectorSet & GetMprSelectors (void) const;
130 
135  const NeighborSet & GetNeighbors (void) const;
136 
141  const TwoHopNeighborSet & GetTwoHopNeighbors (void) const;
142 
147  const TopologySet & GetTopologySet (void) const;
148 
153  const OlsrState & GetOlsrState (void) const;
154 
163  int64_t AssignStreams (int64_t stream);
164 
171  typedef void (* PacketTxRxTracedCallback)(const PacketHeader & header, const MessageList & messages);
172 
178  typedef void (* TableChangeTracedCallback) (uint32_t size);
179 
180 private:
181  std::set<uint32_t> m_interfaceExclusions;
183 
184 public:
189  std::set<uint32_t> GetInterfaceExclusions (void) const
190  {
191  return m_interfaceExclusions;
192  }
193 
198  void SetInterfaceExclusions (std::set<uint32_t> exceptions);
199 
208  void AddHostNetworkAssociation (Ipv4Address networkAddr, Ipv4Mask netmask);
209 
218  void RemoveHostNetworkAssociation (Ipv4Address networkAddr, Ipv4Mask netmask);
219 
231 
237 
238 protected:
239  virtual void DoInitialize (void);
240  virtual void DoDispose (void);
241 
242 private:
243  std::map<Ipv4Address, RoutingTableEntry> m_table;
244 
246 
248 
251  uint16_t m_ansn;
252 
257  uint8_t m_willingness;
258 
261 
265  void Clear (void);
266 
271  uint32_t GetSize (void) const
272  {
273  return m_table.size ();
274  }
275 
280  void RemoveEntry (const Ipv4Address &dest);
291  void AddEntry (const Ipv4Address &dest,
292  const Ipv4Address &next,
293  uint32_t interface,
294  uint32_t distance);
305  void AddEntry (const Ipv4Address &dest,
306  const Ipv4Address &next,
307  const Ipv4Address &interfaceAddress,
308  uint32_t distance);
309 
316  bool Lookup (const Ipv4Address &dest,
317  RoutingTableEntry &outEntry) const;
318 
337  bool FindSendEntry (const RoutingTableEntry &entry,
338  RoutingTableEntry &outEntry) const;
339 
340 public:
341  // From Ipv4RoutingProtocol
343  const Ipv4Header &header,
344  Ptr<NetDevice> oif,
345  Socket::SocketErrno &sockerr);
346  virtual bool RouteInput (Ptr<const Packet> p,
347  const Ipv4Header &header,
352  ErrorCallback ecb);
353  virtual void SetIpv4 (Ptr<Ipv4> ipv4);
354 
359  virtual Ptr<Ipv4> GetIpv4 (void) const;
360  virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream, Time::Unit unit = Time::S) const;
361 
362 
363 private:
364  virtual void NotifyInterfaceUp (uint32_t interface);
365  virtual void NotifyInterfaceDown (uint32_t interface);
366  virtual void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address);
367  virtual void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address);
368 
374  void SendPacket (Ptr<Packet> packet, const MessageList &containedMessages);
375 
380  inline uint16_t GetPacketSequenceNumber (void);
381 
386  inline uint16_t GetMessageSequenceNumber (void);
387 
392  void RecvOlsr (Ptr<Socket> socket);
393 
397  void MprComputation (void);
398 
402  void RoutingTableComputation (void);
403 
404 public:
410  Ipv4Address GetMainAddress (Ipv4Address iface_addr) const;
411 
412 private:
419 
420  // Timer handlers
422 
425  void HelloTimerExpire (void);
426 
428 
431  void TcTimerExpire (void);
432 
434 
437  void MidTimerExpire (void);
438 
440 
443  void HnaTimerExpire (void);
444 
453  void DupTupleTimerExpire (Ipv4Address address, uint16_t sequenceNumber);
454 
456 
467  void LinkTupleTimerExpire (Ipv4Address neighborIfaceAddr);
468 
477  void Nb2hopTupleTimerExpire (Ipv4Address neighborMainAddr, Ipv4Address twoHopNeighborAddr);
478 
486  void MprSelTupleTimerExpire (Ipv4Address mainAddr);
487 
496  void TopologyTupleTimerExpire (Ipv4Address destAddr, Ipv4Address lastAddr);
497 
503  void IfaceAssocTupleTimerExpire (Ipv4Address ifaceAddr);
504 
512  void AssociationTupleTimerExpire (Ipv4Address gatewayAddr, Ipv4Address networkAddr, Ipv4Mask netmask);
513 
517  void IncrementAnsn (void);
518 
522 
533  void ForwardDefault (olsr::MessageHeader olsrMessage,
534  DuplicateTuple *duplicated,
535  const Ipv4Address &localIface,
536  const Ipv4Address &senderAddress);
537 
547  void QueueMessage (const olsr::MessageHeader &message, Time delay);
548 
556  void SendQueuedMessages (void);
557 
561  void SendHello (void);
562 
566  void SendTc (void);
567 
571  void SendMid (void);
572 
576  void SendHna (void);
577 
585  void NeighborLoss (const LinkTuple &tuple);
586 
592  void AddDuplicateTuple (const DuplicateTuple &tuple);
593 
599  void RemoveDuplicateTuple (const DuplicateTuple &tuple);
600 
606  void LinkTupleAdded (const LinkTuple &tuple, uint8_t willingness);
607 
613  void RemoveLinkTuple (const LinkTuple &tuple);
614 
622  void LinkTupleUpdated (const LinkTuple &tuple, uint8_t willingness);
623 
629  void AddNeighborTuple (const NeighborTuple &tuple);
630 
636  void RemoveNeighborTuple (const NeighborTuple &tuple);
637 
643  void AddTwoHopNeighborTuple (const TwoHopNeighborTuple &tuple);
644 
651 
658  void AddMprSelectorTuple (const MprSelectorTuple &tuple);
659 
666  void RemoveMprSelectorTuple (const MprSelectorTuple &tuple);
667 
673  void AddTopologyTuple (const TopologyTuple &tuple);
674 
680  void RemoveTopologyTuple (const TopologyTuple &tuple);
681 
687  void AddIfaceAssocTuple (const IfaceAssocTuple &tuple);
688 
694  void RemoveIfaceAssocTuple (const IfaceAssocTuple &tuple);
695 
701  void AddAssociationTuple (const AssociationTuple &tuple);
702 
708  void RemoveAssociationTuple (const AssociationTuple &tuple);
709 
720  void ProcessHello (const olsr::MessageHeader &msg,
721  const Ipv4Address &receiverIface,
722  const Ipv4Address &senderIface);
723 
734  void ProcessTc (const olsr::MessageHeader &msg,
735  const Ipv4Address &senderIface);
736 
746  void ProcessMid (const olsr::MessageHeader &msg,
747  const Ipv4Address &senderIface);
748 
760  void ProcessHna (const olsr::MessageHeader &msg,
761  const Ipv4Address &senderIface);
762 
771  void LinkSensing (const olsr::MessageHeader &msg,
772  const olsr::MessageHeader::Hello &hello,
773  const Ipv4Address &receiverIface,
774  const Ipv4Address &senderIface);
775 
782  void PopulateNeighborSet (const olsr::MessageHeader &msg,
783  const olsr::MessageHeader::Hello &hello);
784 
792  const olsr::MessageHeader::Hello &hello);
793 
801  const olsr::MessageHeader::Hello &hello);
802 
803  int Degree (NeighborTuple const &tuple);
804 
810  bool IsMyOwnAddress (const Ipv4Address & a) const;
811 
813 
814  // One socket per interface, each bound to that interface's address
815  // (reason: for OLSR Link Sensing we need to know on which interface
816  // HELLO messages arrive)
817  std::map< Ptr<Socket>, Ipv4InterfaceAddress > m_sendSockets;
819 
820 
823 
826 
829 
832 
833 };
834 
835 }
836 } // namespace ns3
837 
838 #endif /* OLSR_AGENT_IMPL_H */
ns3::olsr::RoutingProtocol::RemoveNeighborTuple
void RemoveNeighborTuple(const NeighborTuple &tuple)
Removes a neighbor tuple from the Neighbor Set.
Definition: olsr-routing-protocol.cc:2497
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
ns3::olsr::RoutingProtocol::m_state
OlsrState m_state
Internal state with all needed data structs.
Definition: olsr-routing-protocol.h:259
ns3::olsr::RoutingProtocol::AddIfaceAssocTuple
void AddIfaceAssocTuple(const IfaceAssocTuple &tuple)
Adds an interface association tuple to the Interface Association Set.
Definition: olsr-routing-protocol.cc:2590
ns3::Ipv4Header
Packet header for IPv4.
Definition: ipv4-header.h:34
ns3::olsr::RoutingProtocol::~RoutingProtocol
virtual ~RoutingProtocol(void)
Definition: olsr-routing-protocol.cc:214
ns3::olsr::RoutingProtocol::SetIpv4
virtual void SetIpv4(Ptr< Ipv4 > ipv4)
Definition: olsr-routing-protocol.cc:219
ns3::olsr::RoutingProtocol::m_midTimer
Timer m_midTimer
Timer for the MID message.
Definition: olsr-routing-protocol.h:433
ns3::olsr::RoutingProtocol::NeighborLoss
void NeighborLoss(const LinkTuple &tuple)
Performs all actions needed when a neighbor loss occurs.
Definition: olsr-routing-protocol.cc:2361
ns3::olsr::RoutingProtocol::NotifyRemoveAddress
virtual void NotifyRemoveAddress(uint32_t interface, Ipv4InterfaceAddress address)
Definition: olsr-routing-protocol.cc:3085
ns3::olsr::RoutingProtocol::NotifyAddAddress
virtual void NotifyAddAddress(uint32_t interface, Ipv4InterfaceAddress address)
Definition: olsr-routing-protocol.cc:3081
ns3::olsr::RoutingProtocol::Nb2hopTupleTimerExpire
void Nb2hopTupleTimerExpire(Ipv4Address neighborMainAddr, Ipv4Address twoHopNeighborAddr)
Removes 2_hop neighbor tuple_ if expired.
Definition: olsr-routing-protocol.cc:2739
ns3::Ipv4RoutingProtocol::MulticastForwardCallback
Callback< void, Ptr< Ipv4MulticastRoute >, Ptr< const Packet >, const Ipv4Header & > MulticastForwardCallback
Callback for multicast packets to be forwarded.
Definition: ipv4-routing-protocol.h:69
ns3::olsr::RoutingProtocol::SendQueuedMessages
void SendQueuedMessages(void)
Creates as many OLSR packets as needed in order to send all buffered OLSR messages.
Definition: olsr-routing-protocol.cc:1670
ns3::Socket::SocketErrno
SocketErrno
Enumeration of the possible errors returned by a socket.
Definition: socket.h:82
ns3::olsr::RoutingProtocol::m_routingTableAssociation
Ptr< Ipv4StaticRouting > m_routingTableAssociation
Associations from an Ipv4StaticRouting instance.
Definition: olsr-routing-protocol.h:182
ns3::olsr::RoutingProtocol::GetPacketSequenceNumber
uint16_t GetPacketSequenceNumber(void)
Increments packet sequence number and returns the new value.
Definition: olsr-routing-protocol.cc:2625
ns3::olsr::IfaceAssocTuple
An Interface Association Tuple.
Definition: olsr-repositories.h:40
ns3::olsr::RoutingProtocol::LinkTupleUpdated
void LinkTupleUpdated(const LinkTuple &tuple, uint8_t willingness)
This function is invoked when a link tuple is updated.
Definition: olsr-routing-protocol.cc:2428
ns3::olsr::RoutingProtocol::HnaTimerExpire
void HnaTimerExpire(void)
Sends an HNA message (if the node has associated hosts/networks) and reschedules the HNA timer.
Definition: olsr-routing-protocol.cc:2666
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::olsr::RoutingProtocol::ProcessHello
void ProcessHello(const olsr::MessageHeader &msg, const Ipv4Address &receiverIface, const Ipv4Address &senderIface)
Processes a HELLO message following RFC 3626 specification.
Definition: olsr-routing-protocol.cc:1293
ns3::olsr::RoutingProtocol::m_packetSequenceNumber
uint16_t m_packetSequenceNumber
Packets sequence number counter.
Definition: olsr-routing-protocol.h:249
ns3::olsr::RoutingProtocol
OLSR routing protocol for IPv4.
Definition: olsr-routing-protocol.h:81
ns3::olsr::RoutingProtocol::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition: olsr-routing-protocol.cc:156
ns3::olsr::RoutingProtocol::m_rxPacketTrace
TracedCallback< const PacketHeader &, const MessageList & > m_rxPacketTrace
Rx packet trace.
Definition: olsr-routing-protocol.h:822
ns3::olsr::RoutingProtocol::SendMid
void SendMid(void)
Creates a new OLSR MID message which is buffered for being sent later on.
Definition: olsr-routing-protocol.cc:1838
ns3::olsr::RoutingProtocol::LinkSensing
void LinkSensing(const olsr::MessageHeader &msg, const olsr::MessageHeader::Hello &hello, const Ipv4Address &receiverIface, const Ipv4Address &senderIface)
Updates Link Set according to a new received HELLO message (following RFC 3626 specification).
Definition: olsr-routing-protocol.cc:1998
ns3::olsr::RoutingProtocol::m_ipv4
Ptr< Ipv4 > m_ipv4
IPv4 object the routing is linked to.
Definition: olsr-routing-protocol.h:260
ns3::Ipv4Address
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:41
ns3::olsr::RoutingProtocol::RouteInput
virtual bool RouteInput(Ptr< const Packet > p, const Ipv4Header &header, Ptr< const NetDevice > idev, UnicastForwardCallback ucb, MulticastForwardCallback mcb, LocalDeliverCallback lcb, ErrorCallback ecb)
Route an input packet (to be forwarded or locally delivered)
Definition: olsr-routing-protocol.cc:2962
ns3::olsr::RoutingProtocol::Dump
void Dump(void)
Dump the neighbor table, two-hop neighbor table, and routing table to logging output (NS_LOG_DEBUG lo...
Definition: olsr-routing-protocol.cc:3209
ns3::olsr::RoutingProtocol::RemoveMprSelectorTuple
void RemoveMprSelectorTuple(const MprSelectorTuple &tuple)
Removes an MPR selector tuple from the MPR Selector Set.
Definition: olsr-routing-protocol.cc:2552
ns3::olsr::MprSet
std::set< Ipv4Address > MprSet
MPR Set type.
Definition: olsr-repositories.h:296
ns3::olsr::RoutingProtocol::RoutingProtocol
RoutingProtocol(void)
Definition: olsr-routing-protocol.cc:200
ns3::olsr::RoutingProtocol::GetNeighbors
const NeighborSet & GetNeighbors(void) const
Get the one hop neighbors.
Definition: olsr-routing-protocol.cc:3162
ns3::olsr::RoutingProtocol::OLSR_PORT_NUMBER
static const uint16_t OLSR_PORT_NUMBER
port number (698)
Definition: olsr-routing-protocol.h:88
ns3::Ipv4RoutingTableEntry
A record of an IPv4 routing table entry for Ipv4GlobalRouting and Ipv4StaticRouting.
Definition: ipv4-routing-table-entry.h:37
ns3::olsr::TwoHopNeighborSet
std::vector< TwoHopNeighborTuple > TwoHopNeighborSet
2-hop Neighbor Set type.
Definition: olsr-repositories.h:300
ns3::olsr::RoutingProtocol::m_sendSockets
std::map< Ptr< Socket >, Ipv4InterfaceAddress > m_sendSockets
Container of sockets and the interfaces they are opened onto.
Definition: olsr-routing-protocol.h:817
ns3::olsr::RoutingProtocol::SendHello
void SendHello(void)
Creates a new OLSR HELLO message which is buffered for being sent later on.
Definition: olsr-routing-protocol.cc:1706
ns3::olsr::RoutingTableEntry::nextAddr
Ipv4Address nextAddr
Address of the next hop.
Definition: olsr-routing-protocol.h:62
ns3::olsr::MessageHeader::Hello
HELLO Message Format.
Definition: olsr-header.h:377
ns3::olsr::RoutingProtocol::RemoveEntry
void RemoveEntry(const Ipv4Address &dest)
Deletes the entry whose destination address is given.
Definition: olsr-routing-protocol.cc:2847
ns3::olsr::RoutingProtocol::SendHna
void SendHna(void)
Creates a new OLSR HNA message which is buffered for being sent later on.
Definition: olsr-routing-protocol.cc:1883
ns3::olsr::RoutingProtocol::m_hnaRoutingTable
Ptr< Ipv4StaticRouting > m_hnaRoutingTable
Routing table for HNA routes.
Definition: olsr-routing-protocol.h:245
olsr-repositories.h
ns3::olsr::MessageList
std::vector< MessageHeader > MessageList
Definition: olsr-header.h:695
ns3::Timer
A simple virtual Timer class.
Definition: timer.h:74
ns3::Ipv4RoutingProtocol::UnicastForwardCallback
Callback< void, Ptr< Ipv4Route >, Ptr< const Packet >, const Ipv4Header & > UnicastForwardCallback
Callback for unicast packets to be forwarded.
Definition: ipv4-routing-protocol.h:66
ns3::olsr::MessageHeader
This header can store HELP, TC, MID and HNA messages.
Definition: olsr-header.h:158
ns3::olsr::OlsrState
This class encapsulates all data structures needed for maintaining internal state of an OLSR node.
Definition: olsr-state.h:35
ns3::olsr::RoutingProtocol::MidTimerExpire
void MidTimerExpire(void)
Sends a MID message (if the node has more than one interface) and resets the MID timer.
Definition: olsr-routing-protocol.cc:2659
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
ns3::olsr::RoutingProtocol::GetRoutingTableAssociation
Ptr< const Ipv4StaticRouting > GetRoutingTableAssociation(void) const
Returns the internal HNA table.
Definition: olsr-routing-protocol.cc:3239
ns3::olsr::RoutingProtocol::NotifyInterfaceDown
virtual void NotifyInterfaceDown(uint32_t interface)
Definition: olsr-routing-protocol.cc:3077
ns3::olsr::PacketHeader
The basic layout of any packet in OLSR is as follows (omitting IP and UDP headers):
Definition: olsr-header.h:76
ns3::Ipv4RoutingProtocol::LocalDeliverCallback
Callback< void, Ptr< const Packet >, const Ipv4Header &, uint32_t > LocalDeliverCallback
Callback for packets to be locally delivered.
Definition: ipv4-routing-protocol.h:72
ns3::olsr::RoutingProtocol::TopologyTupleTimerExpire
void TopologyTupleTimerExpire(Ipv4Address destAddr, Ipv4Address lastAddr)
Removes topology tuple_ if expired.
Definition: olsr-routing-protocol.cc:2780
ns3::olsr::RoutingProtocol::AddHostNetworkAssociation
void AddHostNetworkAssociation(Ipv4Address networkAddr, Ipv4Mask netmask)
Injects the specified (networkAddr, netmask) tuple in the list of local HNA associations to be sent b...
Definition: olsr-routing-protocol.cc:1916
ns3::olsr::RoutingProtocol::m_tcInterval
Time m_tcInterval
TC messages' emission interval.
Definition: olsr-routing-protocol.h:254
ns3::olsr::RoutingProtocol::GetMainAddress
Ipv4Address GetMainAddress(Ipv4Address iface_addr) const
Gets the main address associated with a given interface address.
Definition: olsr-routing-protocol.cc:960
ns3::olsr::RoutingProtocol::GetMprSet
MprSet GetMprSet(void) const
Gets the MPR set.
Definition: olsr-routing-protocol.cc:3150
ns3::olsr::RoutingProtocol::GetIpv4
virtual NS_DEPRECATED_3_34 Ptr< Ipv4 > GetIpv4(void) const
Definition: olsr-routing-protocol.cc:242
ns3::Ipv4InterfaceAddress
a class to store IPv4 address information on an interface
Definition: ipv4-interface-address.h:44
ns3::olsr::RoutingProtocol::AssociationTupleTimerExpire
void AssociationTupleTimerExpire(Ipv4Address gatewayAddr, Ipv4Address networkAddr, Ipv4Mask netmask)
Removes association tuple_ if expired.
Definition: olsr-routing-protocol.cc:2820
ns3::olsr::RoutingProtocol::ProcessMid
void ProcessMid(const olsr::MessageHeader &msg, const Ipv4Address &senderIface)
Processes a MID message following RFC 3626 specification.
Definition: olsr-routing-protocol.cc:1437
ns3::olsr::RoutingProtocol::DoInitialize
virtual void DoInitialize(void)
Initialize() implementation.
Definition: olsr-routing-protocol.cc:322
ns3::olsr::RoutingProtocol::AddEntry
void AddEntry(const Ipv4Address &dest, const Ipv4Address &next, uint32_t interface, uint32_t distance)
Adds a new entry into the routing table.
Definition: olsr-routing-protocol.cc:3091
OlsrMprTestCase
Testcase for MPR computation mechanism.
Definition: olsr-routing-protocol-test-suite.cc:57
ns3::olsr::RoutingProtocol::m_txPacketTrace
TracedCallback< const PacketHeader &, const MessageList & > m_txPacketTrace
Tx packet trace.
Definition: olsr-routing-protocol.h:825
ns3::olsr::RoutingProtocol::GetMprSelectors
const MprSelectorSet & GetMprSelectors(void) const
Gets the MPR selectors.
Definition: olsr-routing-protocol.cc:3156
ns3::olsr::RoutingProtocol::AddNeighborTuple
void AddNeighborTuple(const NeighborTuple &tuple)
Adds a neighbor tuple to the Neighbor Set.
Definition: olsr-routing-protocol.cc:2484
ns3::olsr::RoutingProtocol::RemoveLinkTuple
void RemoveLinkTuple(const LinkTuple &tuple)
Removes a link tuple from the Link Set.
Definition: olsr-routing-protocol.cc:2417
ns3::olsr::RoutingProtocol::UsesNonOlsrOutgoingInterface
bool UsesNonOlsrOutgoingInterface(const Ipv4RoutingTableEntry &route)
Tests whether or not the specified route uses a non-OLSR outgoing interface.
Definition: olsr-routing-protocol.cc:1989
ns3::olsr::NeighborSet
std::vector< NeighborTuple > NeighborSet
Neighbor Set type.
Definition: olsr-repositories.h:299
ns3::olsr::RoutingProtocol::LinkTupleTimerExpire
void LinkTupleTimerExpire(Ipv4Address neighborIfaceAddr)
Removes tuple_ if expired.
Definition: olsr-routing-protocol.cc:2701
ns3::olsr::TopologyTuple
A Topology Tuple.
Definition: olsr-repositories.h:208
ns3::olsr::RoutingProtocol::LinkTupleAdded
void LinkTupleAdded(const LinkTuple &tuple, uint8_t willingness)
Adds a link tuple.
Definition: olsr-routing-protocol.cc:2397
first.address
address
Definition: first.py:44
ns3::EventGarbageCollector
An object that tracks scheduled events and automatically cancels them when it is destroyed.
Definition: event-garbage-collector.h:47
ns3::olsr::RoutingProtocol::RoutingTableComputation
void RoutingTableComputation(void)
Creates the routing table of the node following RFC 3626 hints.
Definition: olsr-routing-protocol.cc:976
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
ns3::olsr::RoutingProtocol::RecvOlsr
void RecvOlsr(Ptr< Socket > socket)
Receive an OLSR message.
Definition: olsr-routing-protocol.cc:429
ns3::olsr::RoutingTableEntry
An OLSR's routing table entry.
Definition: olsr-routing-protocol.h:60
ns3::olsr::RoutingProtocol::ForwardDefault
void ForwardDefault(olsr::MessageHeader olsrMessage, DuplicateTuple *duplicated, const Ipv4Address &localIface, const Ipv4Address &senderAddress)
OLSR's default forwarding algorithm.
Definition: olsr-routing-protocol.cc:1566
ns3::olsr::RoutingProtocol::m_queuedMessagesTimer
Timer m_queuedMessagesTimer
timer for throttling outgoing messages
Definition: olsr-routing-protocol.h:521
ns3::olsr::RoutingProtocol::SetRoutingTableAssociation
void SetRoutingTableAssociation(Ptr< Ipv4StaticRouting > routingTable)
Associates the specified Ipv4StaticRouting routing table to the OLSR routing protocol.
Definition: olsr-routing-protocol.cc:1944
ns3::olsr::RoutingProtocol::Degree
int Degree(NeighborTuple const &tuple)
This auxiliary function (defined in RFC 3626) is used for calculating the MPR Set.
Definition: olsr-routing-protocol.cc:609
ns3::olsr::RoutingProtocol::AssignStreams
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Definition: olsr-routing-protocol.cc:3186
ns3::olsr::RoutingProtocol::GetRoutingTableEntries
std::vector< RoutingTableEntry > GetRoutingTableEntries(void) const
Get the routing table entries.
Definition: olsr-routing-protocol.cc:3138
ns3::olsr::RoutingTableEntry::interface
uint32_t interface
Interface index.
Definition: olsr-routing-protocol.h:63
ns3::olsr::RoutingProtocol::m_ansn
uint16_t m_ansn
Advertised Neighbor Set sequence number.
Definition: olsr-routing-protocol.h:251
ns3::Ipv4RoutingProtocol
Abstract base class for IPv4 routing protocols.
Definition: ipv4-routing-protocol.h:57
ns3::olsr::RoutingProtocol::RemoveDuplicateTuple
void RemoveDuplicateTuple(const DuplicateTuple &tuple)
Removes a duplicate tuple from the Duplicate Set.
Definition: olsr-routing-protocol.cc:2386
ns3::olsr::RoutingProtocol::m_linkTupleTimerFirstTime
bool m_linkTupleTimerFirstTime
Flag to indicate if it is the first time the LinkTupleTimer fires.
Definition: olsr-routing-protocol.h:455
ns3::olsr::RoutingProtocol::m_hnaTimer
Timer m_hnaTimer
Timer for the HNA message.
Definition: olsr-routing-protocol.h:439
ns3::olsr::RoutingProtocol::HelloTimerExpire
void HelloTimerExpire(void)
Sends a HELLO message and reschedules the HELLO timer.
Definition: olsr-routing-protocol.cc:2638
ns3::olsr::RoutingProtocol::IncrementAnsn
void IncrementAnsn(void)
Increments the ANSN counter.
Definition: olsr-routing-protocol.cc:2534
ns3::olsr::RoutingProtocol::RemoveAssociationTuple
void RemoveAssociationTuple(const AssociationTuple &tuple)
Removes a host network association tuple to the Association Set.
Definition: olsr-routing-protocol.cc:2620
ns3::olsr::TopologySet
std::vector< TopologyTuple > TopologySet
Topology Set type.
Definition: olsr-repositories.h:301
ns3::olsr::RoutingProtocol::PopulateTwoHopNeighborSet
void PopulateTwoHopNeighborSet(const olsr::MessageHeader &msg, const olsr::MessageHeader::Hello &hello)
Updates the 2-hop Neighbor Set according to the information contained in a new received HELLO message...
Definition: olsr-routing-protocol.cc:2158
ns3::olsr::RoutingTableEntry::RoutingTableEntry
RoutingTableEntry(void)
Definition: olsr-routing-protocol.h:66
ns3::olsr::RoutingTableEntry::destAddr
Ipv4Address destAddr
Address of the destination node.
Definition: olsr-routing-protocol.h:61
ns3::olsr::RoutingProtocol::GetMessageSequenceNumber
uint16_t GetMessageSequenceNumber(void)
Increments message sequence number and returns the new value.
Definition: olsr-routing-protocol.cc:2631
ns3::olsr::RoutingProtocol::Clear
void Clear(void)
Clears the routing table and frees the memory assigned to each one of its entries.
Definition: olsr-routing-protocol.cc:2840
ns3::olsr::RoutingProtocol::ProcessTc
void ProcessTc(const olsr::MessageHeader &msg, const Ipv4Address &senderIface)
Processes a TC message following RFC 3626 specification.
Definition: olsr-routing-protocol.cc:1347
ns3::olsr::RoutingProtocol::MprComputation
void MprComputation(void)
Computates MPR set of a node following RFC 3626 hints.
Definition: olsr-routing-protocol.cc:665
ns3::olsr::RoutingProtocol::GetTopologySet
const TopologySet & GetTopologySet(void) const
Gets the topology set.
Definition: olsr-routing-protocol.cc:3174
ns3::olsr::RoutingProtocol::RemoveIfaceAssocTuple
void RemoveIfaceAssocTuple(const IfaceAssocTuple &tuple)
Removed an interface association tuple to the Interface Association Set.
Definition: olsr-routing-protocol.cc:2602
ns3::olsr::RoutingProtocol::m_hnaInterval
Time m_hnaInterval
HNA messages' emission interval.
Definition: olsr-routing-protocol.h:256
ns3::olsr::RoutingProtocol::AddTopologyTuple
void AddTopologyTuple(const TopologyTuple &tuple)
Adds a topology tuple to the Topology Set.
Definition: olsr-routing-protocol.cc:2564
ns3::olsr::NeighborTuple
A Neighbor Tuple.
Definition: olsr-repositories.h:103
ns3::olsr::RoutingProtocol::SetInterfaceExclusions
void SetInterfaceExclusions(std::set< uint32_t > exceptions)
Set the interfaces to be excluded.
Definition: olsr-routing-protocol.cc:421
ns3::olsr::RoutingProtocol::GetOlsrState
const OlsrState & GetOlsrState(void) const
Gets the underlying OLSR state object.
Definition: olsr-routing-protocol.cc:3180
ns3::Time::S
@ S
second
Definition: nstime.h:115
ns3::olsr::RoutingProtocol::GetInterfaceExclusions
std::set< uint32_t > GetInterfaceExclusions(void) const
Get the excluded interfaces.
Definition: olsr-routing-protocol.h:189
ns3::olsr::RoutingProtocol::m_recvSocket
Ptr< Socket > m_recvSocket
Receiving socket.
Definition: olsr-routing-protocol.h:818
ns3::olsr::RoutingProtocol::NotifyInterfaceUp
virtual void NotifyInterfaceUp(uint32_t interface)
Definition: olsr-routing-protocol.cc:3073
ns3::olsr::RoutingProtocol::m_midInterval
Time m_midInterval
MID messages' emission interval.
Definition: olsr-routing-protocol.h:255
ns3::olsr::RoutingProtocol::SendTc
void SendTc(void)
Creates a new OLSR TC message which is buffered for being sent later on.
Definition: olsr-routing-protocol.cc:1814
ns3::olsr::MprSelectorTuple
An MPR-Selector Tuple.
Definition: olsr-repositories.h:165
ns3::olsr::RoutingProtocol::PopulateMprSelectorSet
void PopulateMprSelectorSet(const olsr::MessageHeader &msg, const olsr::MessageHeader::Hello &hello)
Updates the MPR Selector Set according to the information contained in a new received HELLO message (...
Definition: olsr-routing-protocol.cc:2265
ns3::olsr::RoutingProtocol::m_uniformRandomVariable
Ptr< UniformRandomVariable > m_uniformRandomVariable
Provides uniform random variables.
Definition: olsr-routing-protocol.h:831
ns3::olsr::RoutingProtocol::m_willingness
uint8_t m_willingness
Willingness for forwarding packets on behalf of other nodes.
Definition: olsr-routing-protocol.h:257
ns3::olsr::AssociationTuple
An Association Tuple.
Definition: olsr-repositories.h:265
ns3::olsr::RoutingProtocol::PrintRoutingTable
virtual void PrintRoutingTable(Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S) const
Print the Routing Table entries.
Definition: olsr-routing-protocol.cc:271
ns3::olsr::RoutingProtocol::PacketTxRxTracedCallback
void(* PacketTxRxTracedCallback)(const PacketHeader &header, const MessageList &messages)
TracedCallback signature for Packet transmit and receive events.
Definition: olsr-routing-protocol.h:171
ns3::olsr::RoutingProtocol::m_messageSequenceNumber
uint16_t m_messageSequenceNumber
Messages sequence number counter.
Definition: olsr-routing-protocol.h:250
ns3::olsr::RoutingProtocol::RemoveTwoHopNeighborTuple
void RemoveTwoHopNeighborTuple(const TwoHopNeighborTuple &tuple)
Removes a 2-hop neighbor tuple from the 2-hop Neighbor Set.
Definition: olsr-routing-protocol.cc:2522
ns3::olsr::RoutingProtocol::IfaceAssocTupleTimerExpire
void IfaceAssocTupleTimerExpire(Ipv4Address ifaceAddr)
Removes interface association tuple_ if expired.
Definition: olsr-routing-protocol.cc:2800
ns3::Ipv4Mask
a class to represent an Ipv4 address mask
Definition: ipv4-address.h:256
ns3::olsr::RoutingProtocol::m_queuedMessages
olsr::MessageList m_queuedMessages
A list of pending messages which are buffered awaiting for being sent.
Definition: olsr-routing-protocol.h:520
ns3::olsr::TwoHopNeighborTuple
A 2-hop Tuple.
Definition: olsr-repositories.h:136
ns3::olsr::RoutingProtocol::RemoveHostNetworkAssociation
void RemoveHostNetworkAssociation(Ipv4Address networkAddr, Ipv4Mask netmask)
Removes the specified (networkAddr, netmask) tuple from the list of local HNA associations to be sent...
Definition: olsr-routing-protocol.cc:1937
olsr
Definition: olsr.py:1
ns3::olsr::RoutingProtocol::TableChangeTracedCallback
void(* TableChangeTracedCallback)(uint32_t size)
TracedCallback signature for routing table computation.
Definition: olsr-routing-protocol.h:178
ns3::olsr::RoutingProtocol::m_routingTableChanged
TracedCallback< uint32_t > m_routingTableChanged
Routing table chanes challback.
Definition: olsr-routing-protocol.h:828
ns3::olsr::RoutingProtocol::MprSelTupleTimerExpire
void MprSelTupleTimerExpire(Ipv4Address mainAddr)
Removes MPR selector tuple_ if expired.
Definition: olsr-routing-protocol.cc:2760
ns3::olsr::RoutingProtocol::AddAssociationTuple
void AddAssociationTuple(const AssociationTuple &tuple)
Adds a host network association tuple to the Association Set.
Definition: olsr-routing-protocol.cc:2614
ns3::olsr::MprSelectorSet
std::vector< MprSelectorTuple > MprSelectorSet
MPR Selector Set type.
Definition: olsr-repositories.h:297
ns3::olsr::RoutingProtocol::m_mainAddress
Ipv4Address m_mainAddress
the node main address.
Definition: olsr-routing-protocol.h:812
ns3::olsr::RoutingProtocol::m_interfaceExclusions
std::set< uint32_t > m_interfaceExclusions
Set of interfaces excluded by OSLR.
Definition: olsr-routing-protocol.h:181
ns3::TracedCallback
Forward calls to a chain of Callback.
Definition: traced-callback.h:53
ns3::olsr::RoutingProtocol::QueueMessage
void QueueMessage(const olsr::MessageHeader &message, Time delay)
Enques an OLSR message which will be sent with a delay of (0, delay].
Definition: olsr-routing-protocol.cc:1634
ns3::olsr::RoutingProtocol::PopulateNeighborSet
void PopulateNeighborSet(const olsr::MessageHeader &msg, const olsr::MessageHeader::Hello &hello)
Updates the Neighbor Set according to the information contained in a new received HELLO message (foll...
Definition: olsr-routing-protocol.cc:2147
ns3::olsr::RoutingProtocol::SendPacket
void SendPacket(Ptr< Packet > packet, const MessageList &containedMessages)
Send an OLSR message.
Definition: olsr-routing-protocol.cc:1645
olsr-state.h
ns3::olsr::RoutingTableEntry::distance
uint32_t distance
Distance in hops to the destination.
Definition: olsr-routing-protocol.h:64
ns3::olsr::RoutingProtocol::m_helloTimer
Timer m_helloTimer
Timer for the HELLO message.
Definition: olsr-routing-protocol.h:421
ns3::Ipv4RoutingProtocol::ErrorCallback
Callback< void, Ptr< const Packet >, const Ipv4Header &, Socket::SocketErrno > ErrorCallback
Callback for routing errors (e.g., no route found)
Definition: ipv4-routing-protocol.h:75
ns3::olsr::RoutingProtocol::IsMyOwnAddress
bool IsMyOwnAddress(const Ipv4Address &a) const
Check that address is one of my interfaces.
Definition: olsr-routing-protocol.cc:3194
ns3::olsr::RoutingProtocol::GetTwoHopNeighbors
const TwoHopNeighborSet & GetTwoHopNeighbors(void) const
Get the two hop neighbors.
Definition: olsr-routing-protocol.cc:3168
ns3::olsr::RoutingProtocol::FindSendEntry
bool FindSendEntry(const RoutingTableEntry &entry, RoutingTableEntry &outEntry) const
Finds the appropriate entry which must be used in order to forward a data packet to a next hop (given...
Definition: olsr-routing-protocol.cc:2869
ns3::olsr::RoutingProtocol::AddTwoHopNeighborTuple
void AddTwoHopNeighborTuple(const TwoHopNeighborTuple &tuple)
Adds a 2-hop neighbor tuple to the 2-hop Neighbor Set.
Definition: olsr-routing-protocol.cc:2510
ns3::olsr::RoutingProtocol::AddMprSelectorTuple
void AddMprSelectorTuple(const MprSelectorTuple &tuple)
Adds an MPR selector tuple to the MPR Selector Set.
Definition: olsr-routing-protocol.cc:2540
ns3::olsr::RoutingProtocol::m_helloInterval
Time m_helloInterval
HELLO messages' emission interval.
Definition: olsr-routing-protocol.h:253
ns3::olsr::DuplicateTuple
A Duplicate Tuple.
Definition: olsr-repositories.h:185
ns3::olsr::RoutingProtocol::m_events
EventGarbageCollector m_events
Running events.
Definition: olsr-routing-protocol.h:247
ns3::olsr::RoutingProtocol::m_table
std::map< Ipv4Address, RoutingTableEntry > m_table
Data structure for the routing table.
Definition: olsr-routing-protocol.h:243
ns3::olsr::RoutingProtocol::SetMainInterface
void SetMainInterface(uint32_t interface)
Set the OLSR main address to the first address on the indicated interface.
Definition: olsr-routing-protocol.cc:416
NS_DEPRECATED_3_34
#define NS_DEPRECATED_3_34
Tag for things deprecated in version ns-3.34.
Definition: deprecated.h:80
ns3::olsr::RoutingProtocol::DupTupleTimerExpire
void DupTupleTimerExpire(Ipv4Address address, uint16_t sequenceNumber)
Removes tuple if expired.
Definition: olsr-routing-protocol.cc:2680
ns3::olsr::RoutingProtocol::m_tcTimer
Timer m_tcTimer
Timer for the TC message.
Definition: olsr-routing-protocol.h:427
ns3::olsr::RoutingProtocol::GetSize
uint32_t GetSize(void) const
Returns the routing table size.
Definition: olsr-routing-protocol.h:271
ns3::olsr::RoutingProtocol::Lookup
bool Lookup(const Ipv4Address &dest, RoutingTableEntry &outEntry) const
Looks up an entry for the specified destination address.
Definition: olsr-routing-protocol.cc:2853
olsr-header.h
ns3::olsr::RoutingProtocol::ProcessHna
void ProcessHna(const olsr::MessageHeader &msg, const Ipv4Address &senderIface)
Processes a HNA message following RFC 3626 specification.
Definition: olsr-routing-protocol.cc:1507
ns3::Time::Unit
Unit
The unit to use to interpret a number representing time.
Definition: nstime.h:110
ns3::olsr::RoutingProtocol::TcTimerExpire
void TcTimerExpire(void)
Sends a TC message (if there exists any MPR selector) and reschedules the TC timer.
Definition: olsr-routing-protocol.cc:2645
ns3::olsr::RoutingProtocol::DoDispose
virtual void DoDispose(void)
Destructor implementation.
Definition: olsr-routing-protocol.cc:247
ns3::olsr::RoutingProtocol::AddDuplicateTuple
void AddDuplicateTuple(const DuplicateTuple &tuple)
Adds a duplicate tuple to the Duplicate Set.
Definition: olsr-routing-protocol.cc:2375
ns3::olsr::RoutingProtocol::RemoveTopologyTuple
void RemoveTopologyTuple(const TopologyTuple &tuple)
Removes a topology tuple to the Topology Set.
Definition: olsr-routing-protocol.cc:2577
ns3::olsr::RoutingProtocol::RouteOutput
virtual Ptr< Ipv4Route > RouteOutput(Ptr< Packet > p, const Ipv4Header &header, Ptr< NetDevice > oif, Socket::SocketErrno &sockerr)
Query routing cache for an existing route, for an outbound packet.
Definition: olsr-routing-protocol.cc:2884