A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ns3::olsr::RoutingProtocol Class Reference

OLSR routing protocol for IPv4. More...

#include <olsr-routing-protocol.h>

+ Inheritance diagram for ns3::olsr::RoutingProtocol:
+ Collaboration diagram for ns3::olsr::RoutingProtocol:

Public Member Functions

 RoutingProtocol ()
 
virtual ~RoutingProtocol ()
 
void AddHostNetworkAssociation (Ipv4Address networkAddr, Ipv4Mask netmask)
 Inject Association to be sent in HNA message. More...
 
int64_t AssignStreams (int64_t stream)
 Assign a fixed random variable stream number to the random variables used by this model. More...
 
void Dump (void)
 Dump the neighbor table, two-hop neighbor table, and routing table to logging output (NS_LOG_DEBUG log level). More...
 
std::set< uint32_t > GetInterfaceExclusions () const
 
std::vector< RoutingTableEntryGetRoutingTableEntries () const
 Return the list of routing table entries discovered by OLSR. More...
 
void RemoveHostNetworkAssociation (Ipv4Address networkAddr, Ipv4Mask netmask)
 Removes Association sent in HNA message. More...
 
void SetInterfaceExclusions (std::set< uint32_t > exceptions)
 
void SetMainInterface (uint32_t interface)
 Set the OLSR main address to the first address on the indicated interface. More...
 
void SetRoutingTableAssociation (Ptr< Ipv4StaticRouting > routingTable)
 Inject Associations from an Ipv4StaticRouting instance. More...
 
- Public Member Functions inherited from ns3::Object
 Object ()
 
virtual ~Object ()
 
void AggregateObject (Ptr< Object > other)
 
void Dispose (void)
 Run the DoDispose methods of this object and all the objects aggregated to it. More...
 
AggregateIterator GetAggregateIterator (void) const
 
virtual TypeId GetInstanceTypeId (void) const
 
template<typename T >
Ptr< T > GetObject (void) const
 
template<typename T >
Ptr< T > GetObject (TypeId tid) const
 
void Initialize (void)
 This method calls the virtual DoInitialize method on all the objects aggregated to this object. More...
 
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 Constructor. More...
 
 SimpleRefCount (const SimpleRefCount &o)
 Copy constructor. More...
 
uint32_t GetReferenceCount (void) const
 Get the reference count of the object. More...
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment. More...
 
void Ref (void) const
 Increment the reference count. More...
 
void Unref (void) const
 Decrement the reference count. More...
 
- Public Member Functions inherited from ns3::ObjectBase
virtual ~ObjectBase ()
 Virtual destructor. More...
 
void GetAttribute (std::string name, AttributeValue &value) const
 
bool GetAttributeFailSafe (std::string name, AttributeValue &attribute) const
 
void SetAttribute (std::string name, const AttributeValue &value)
 
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
 
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 

Static Public Member Functions

static TypeId GetTypeId (void)
 
- Static Public Member Functions inherited from ns3::Ipv4RoutingProtocol
static TypeId GetTypeId (void)
 Get the type ID. More...
 
- Static Public Member Functions inherited from ns3::Object
static TypeId GetTypeId (void)
 Register this type. More...
 
- Static Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
static void Cleanup (void)
 Noop. More...
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId (void)
 Get the type ID. More...
 

Protected Member Functions

virtual void DoInitialize (void)
 This method is called only once by Object::Initialize. More...
 
- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 
virtual void NotifyNewAggregate (void)
 This method is invoked whenever two sets of objects are aggregated together. More...
 
- Protected Member Functions inherited from ns3::ObjectBase
void ConstructSelf (const AttributeConstructionList &attributes)
 
virtual void NotifyConstructionCompleted (void)
 This method is invoked once all member attributes have been initialized. More...
 

Private Member Functions

void AddAssociationTuple (const AssociationTuple &tuple)
 Adds a host network association tuple to the Association Set. More...
 
void AddDuplicateTuple (const DuplicateTuple &tuple)
 Adds a duplicate tuple to the Duplicate Set. More...
 
void AddEntry (const Ipv4Address &dest, const Ipv4Address &next, uint32_t interface, uint32_t distance)
 Adds a new entry into the routing table. More...
 
void AddEntry (const Ipv4Address &dest, const Ipv4Address &next, const Ipv4Address &interfaceAddress, uint32_t distance)
 
void AddIfaceAssocTuple (const IfaceAssocTuple &tuple)
 Adds an interface association tuple to the Interface Association Set. More...
 
void AddMprSelectorTuple (const MprSelectorTuple &tuple)
 Adds an MPR selector tuple to the MPR Selector Set. More...
 
void AddNeighborTuple (const NeighborTuple &tuple)
 Adds a neighbor tuple to the Neighbor Set. More...
 
void AddTopologyTuple (const TopologyTuple &tuple)
 Adds a topology tuple to the Topology Set. More...
 
void AddTwoHopNeighborTuple (const TwoHopNeighborTuple &tuple)
 Adds a 2-hop neighbor tuple to the 2-hop Neighbor Set. More...
 
void AssociationTupleTimerExpire (Ipv4Address gatewayAddr, Ipv4Address networkAddr, Ipv4Mask netmask)
 Removes tuple_ if expired. More...
 
void Clear ()
 Clears the routing table and frees the memory assigned to each one of its entries. More...
 
int Degree (NeighborTuple const &tuple)
 This auxiliary function (defined in RFC 3626) is used for calculating the MPR Set. More...
 
void DoDispose ()
 This method is called by Object::Dispose or by the object's destructor, whichever comes first. More...
 
void DupTupleTimerExpire (Ipv4Address address, uint16_t sequenceNumber)
 Removes tuple if expired. More...
 
bool FindSendEntry (const RoutingTableEntry &entry, RoutingTableEntry &outEntry) const
 Finds the appropiate entry which must be used in order to forward a data packet to a next hop (given a destination). More...
 
void ForwardDefault (olsr::MessageHeader olsrMessage, DuplicateTuple *duplicated, const Ipv4Address &localIface, const Ipv4Address &senderAddress)
 OLSR's default forwarding algorithm. More...
 
Ipv4Address GetMainAddress (Ipv4Address iface_addr) const
 Gets the main address associated with a given interface address. More...
 
uint16_t GetMessageSequenceNumber ()
 Increments message sequence number and returns the new value. More...
 
uint16_t GetPacketSequenceNumber ()
 Increments packet sequence number and returns the new value. More...
 
uint32_t GetSize () const
 
void HelloTimerExpire ()
 Sends a HELLO message and reschedules the HELLO timer. More...
 
void HnaTimerExpire ()
 Sends an HNA message (if the node has associated hosts/networks) and reschedules the HNA timer. More...
 
void IfaceAssocTupleTimerExpire (Ipv4Address ifaceAddr)
 Removes tuple_ if expired. More...
 
void IncrementAnsn ()
 
bool IsMyOwnAddress (const Ipv4Address &a) const
 Check that address is one of my interfaces. More...
 
void LinkSensing (const olsr::MessageHeader &msg, const olsr::MessageHeader::Hello &hello, const Ipv4Address &receiverIface, const Ipv4Address &sender_iface)
 Updates Link Set according to a new received HELLO message (following RFC 3626 specification). More...
 
void LinkTupleAdded (const LinkTuple &tuple, uint8_t willingness)
 
void LinkTupleTimerExpire (Ipv4Address neighborIfaceAddr)
 Removes tuple_ if expired. More...
 
void LinkTupleUpdated (const LinkTuple &tuple, uint8_t willingness)
 This function is invoked when a link tuple is updated. More...
 
bool Lookup (const Ipv4Address &dest, RoutingTableEntry &outEntry) const
 Looks up an entry for the specified destination address. More...
 
void MidTimerExpire ()
 Sends a MID message (if the node has more than one interface) and resets the MID timer. More...
 
void MprComputation ()
 Computates MPR set of a node following RFC 3626 hints. More...
 
void MprSelTupleTimerExpire (Ipv4Address mainAddr)
 Removes tuple_ if expired. More...
 
void Nb2hopTupleTimerExpire (Ipv4Address neighborMainAddr, Ipv4Address twoHopNeighborAddr)
 Removes tuple_ if expired. More...
 
void NeighborLoss (const LinkTuple &tuple)
 Performs all actions needed when a neighbor loss occurs. More...
 
virtual void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address)
 
virtual void NotifyInterfaceDown (uint32_t interface)
 
virtual void NotifyInterfaceUp (uint32_t interface)
 
virtual void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address)
 
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 (following RFC 3626). More...
 
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 (following RFC 3626). More...
 
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 (following RFC 3626). More...
 
virtual void PrintRoutingTable (Ptr< OutputStreamWrapper > stream) const
 Print the Routing Table entries. More...
 
void ProcessHello (const olsr::MessageHeader &msg, const Ipv4Address &receiverIface, const Ipv4Address &senderIface)
 Processes a HELLO message following RFC 3626 specification. More...
 
void ProcessHna (const olsr::MessageHeader &msg, const Ipv4Address &senderIface)
 Processes a HNA message following RFC 3626 specification. More...
 
void ProcessMid (const olsr::MessageHeader &msg, const Ipv4Address &senderIface)
 Processes a MID message following RFC 3626 specification. More...
 
void ProcessTc (const olsr::MessageHeader &msg, const Ipv4Address &senderIface)
 Processes a TC message following RFC 3626 specification. More...
 
void QueueMessage (const olsr::MessageHeader &message, Time delay)
 Enques an OLSR message which will be sent with a delay of (0, delay]. More...
 
void RecvOlsr (Ptr< Socket > socket)
 
void RemoveAssociationTuple (const AssociationTuple &tuple)
 Removes a host network association tuple from the Association Set. More...
 
void RemoveDuplicateTuple (const DuplicateTuple &tuple)
 Removes a duplicate tuple from the Duplicate Set. More...
 
void RemoveEntry (const Ipv4Address &dest)
 Deletes the entry whose destination address is given. More...
 
void RemoveIfaceAssocTuple (const IfaceAssocTuple &tuple)
 Removes an interface association tuple from the Interface Association Set. More...
 
void RemoveLinkTuple (const LinkTuple &tuple)
 Removes a link tuple from the Link Set. More...
 
void RemoveMprSelectorTuple (const MprSelectorTuple &tuple)
 Removes an MPR selector tuple from the MPR Selector Set. More...
 
void RemoveNeighborTuple (const NeighborTuple &tuple)
 Removes a neighbor tuple from the Neighbor Set. More...
 
void RemoveTopologyTuple (const TopologyTuple &tuple)
 Removes a topology tuple from the Topology Set. More...
 
void RemoveTwoHopNeighborTuple (const TwoHopNeighborTuple &tuple)
 Removes a 2-hop neighbor tuple from the 2-hop Neighbor Set. More...
 
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) More...
 
virtual Ptr< Ipv4RouteRouteOutput (Ptr< Packet > p, const Ipv4Header &header, Ptr< NetDevice > oif, Socket::SocketErrno &sockerr)
 Query routing cache for an existing route, for an outbound packet. More...
 
void RoutingTableComputation ()
 Creates the routing table of the node following RFC 3626 hints. More...
 
void SendHello ()
 Creates a new OLSR HELLO message which is buffered for being sent later on. More...
 
void SendHna ()
 Creates a new OLSR HNA message which is buffered for being sent later on. More...
 
void SendMid ()
 Creates a new OLSR MID message which is buffered for being sent later on. More...
 
void SendPacket (Ptr< Packet > packet, const MessageList &containedMessages)
 
void SendQueuedMessages ()
 Creates as many OLSR packets as needed in order to send all buffered OLSR messages. More...
 
void SendTc ()
 Creates a new OLSR TC message which is buffered for being sent later on. More...
 
virtual void SetIpv4 (Ptr< Ipv4 > ipv4)
 
void TcTimerExpire ()
 Sends a TC message (if there exists any MPR selector) and reschedules the TC timer. More...
 
void TopologyTupleTimerExpire (Ipv4Address destAddr, Ipv4Address lastAddr)
 Removes tuple_ if expired. More...
 
bool UsesNonOlsrOutgoingInterface (const Ipv4RoutingTableEntry &route)
 Tests whether or not the specified route uses a non-OLSR outgoing interface. More...
 

Private Attributes

uint16_t m_ansn
 Advertised Neighbor Set sequence number. More...
 
EventGarbageCollector m_events
 
Time m_helloInterval
 HELLO messages' emission interval. More...
 
Timer m_helloTimer
 
Time m_hnaInterval
 HNA messages' emission interval. More...
 
Ptr< Ipv4StaticRoutingm_hnaRoutingTable
 
Timer m_hnaTimer
 
std::set< uint32_t > m_interfaceExclusions
 
Ptr< Ipv4m_ipv4
 
bool m_linkTupleTimerFirstTime
 
Ipv4Address m_mainAddress
 
uint16_t m_messageSequenceNumber
 Messages sequence number counter. More...
 
Time m_midInterval
 MID messages' emission interval. More...
 
Timer m_midTimer
 
uint16_t m_packetSequenceNumber
 Packets sequence number counter. More...
 
olsr::MessageList m_queuedMessages
 A list of pending messages which are buffered awaiting for being sent. More...
 
Timer m_queuedMessagesTimer
 
Ptr< Ipv4StaticRoutingm_routingTableAssociation
 
TracedCallback< uint32_t > m_routingTableChanged
 
TracedCallback< const
PacketHeader &, const
MessageList & > 
m_rxPacketTrace
 
std::map< Ptr< Socket >
, Ipv4InterfaceAddress
m_socketAddresses
 
OlsrState m_state
 Internal state with all needed data structs. More...
 
std::map< Ipv4Address,
RoutingTableEntry
m_table
 Data structure for the routing table. More...
 
Time m_tcInterval
 TC messages' emission interval. More...
 
Timer m_tcTimer
 
TracedCallback< const
PacketHeader &, const
MessageList & > 
m_txPacketTrace
 
Ptr< UniformRandomVariablem_uniformRandomVariable
 Provides uniform random variables. More...
 
uint8_t m_willingness
 Willingness for forwarding packets on behalf of other nodes. More...
 

Friends

class OlsrMprTestCase
 

Additional Inherited Members

- Public Types inherited from ns3::Ipv4RoutingProtocol
typedef Callback< void, Ptr
< const Packet >, const
Ipv4Header
&, Socket::SocketErrno
ErrorCallback
 Callback for routing errors (e.g., no route found) More...
 
typedef Callback< void, Ptr
< const Packet >, const
Ipv4Header &, uint32_t > 
LocalDeliverCallback
 Callback for packets to be locally delivered. More...
 
typedef Callback< void, Ptr
< Ipv4MulticastRoute >, Ptr
< const Packet >, const
Ipv4Header & > 
MulticastForwardCallback
 Callback for multicast packets to be forwarded. More...
 
typedef Callback< void, Ptr
< Ipv4Route >, Ptr< const
Packet >, const Ipv4Header & > 
UnicastForwardCallback
 Callback for unicast packets to be forwarded. More...
 

Detailed Description

OLSR routing protocol for IPv4.

Config Paths

ns3::olsr::RoutingProtocol is accessible through the following paths with Config::Set and Config::Connect:

  • /NodeList/[i]/$ns3::olsr::RoutingProtocol

Attributes

  • HelloInterval: HELLO messages emission interval.
    • Set with class: ns3::TimeValue
    • Underlying type: Time -9223372036854775808.0ns:+9223372036854775807.0ns
    • Initial value: +2000000000.0ns
    • Flags: construct write read
  • TcInterval: TC messages emission interval.
    • Set with class: ns3::TimeValue
    • Underlying type: Time -9223372036854775808.0ns:+9223372036854775807.0ns
    • Initial value: +5000000000.0ns
    • Flags: construct write read
  • MidInterval: MID messages emission interval. Normally it is equal to TcInterval.
    • Set with class: ns3::TimeValue
    • Underlying type: Time -9223372036854775808.0ns:+9223372036854775807.0ns
    • Initial value: +5000000000.0ns
    • Flags: construct write read
  • HnaInterval: HNA messages emission interval. Normally it is equal to TcInterval.
    • Set with class: ns3::TimeValue
    • Underlying type: Time -9223372036854775808.0ns:+9223372036854775807.0ns
    • Initial value: +5000000000.0ns
    • Flags: construct write read
  • Willingness: Willingness of a node to carry and forward traffic for other nodes.
    • Set with class: ns3::EnumValue
    • Underlying type: never|low|default|high|always
    • Initial value: default
    • Flags: construct write read

TraceSources

  • Rx: Receive OLSR packet.
  • Tx: Send OLSR packet.
  • RoutingTableChanged: The OLSR routing table has changed.

Definition at line 78 of file olsr-routing-protocol.h.

Constructor & Destructor Documentation

ns3::olsr::RoutingProtocol::RoutingProtocol ( )

Definition at line 193 of file olsr-routing-protocol.cc.

References m_hnaRoutingTable, and m_uniformRandomVariable.

ns3::olsr::RoutingProtocol::~RoutingProtocol ( )
virtual

Definition at line 207 of file olsr-routing-protocol.cc.

Member Function Documentation

void ns3::olsr::RoutingProtocol::AddAssociationTuple ( const AssociationTuple tuple)
private

Adds a host network association tuple to the Association Set.

Parameters
tuplethe host network association tuple to be added.

Definition at line 2688 of file olsr-routing-protocol.cc.

References ns3::OlsrState::InsertAssociationTuple(), and m_state.

Referenced by ProcessHna().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::olsr::RoutingProtocol::AddDuplicateTuple ( const DuplicateTuple tuple)
private

Adds a duplicate tuple to the Duplicate Set.

Parameters
tuplethe duplicate tuple to be added.

Definition at line 2371 of file olsr-routing-protocol.cc.

References ns3::OlsrState::InsertDuplicateTuple(), and m_state.

Referenced by ForwardDefault().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::olsr::RoutingProtocol::AddEntry ( const Ipv4Address dest,
const Ipv4Address next,
uint32_t  interface,
uint32_t  distance 
)
private

Adds a new entry into the routing table.

If an entry for the given destination existed, it is deleted and freed.

Parameters
destaddress of the destination node.
nextaddress of the next hop node.
ifaceaddress of the local interface.
distdistance to the destination node.

Definition at line 3251 of file olsr-routing-protocol.cc.

References ns3::olsr::RoutingTableEntry::destAddr, ns3::olsr::RoutingTableEntry::distance, ns3::olsr::RoutingTableEntry::interface, m_mainAddress, m_table, ns3::olsr::RoutingTableEntry::nextAddr, NS_ASSERT, and NS_LOG_FUNCTION.

Referenced by AddEntry(), and RoutingTableComputation().

+ Here is the caller graph for this function:

void ns3::olsr::RoutingProtocol::AddEntry ( const Ipv4Address dest,
const Ipv4Address next,
const Ipv4Address interfaceAddress,
uint32_t  distance 
)
private

Definition at line 3270 of file olsr-routing-protocol.cc.

References AddEntry(), m_ipv4, m_mainAddress, NS_ASSERT, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

void ns3::olsr::RoutingProtocol::AddHostNetworkAssociation ( Ipv4Address  networkAddr,
Ipv4Mask  netmask 
)

Inject Association to be sent in HNA message.

Injects the specified (networkAddr, netmask) tuple in the list of local HNA associations to be sent by the node via HNA messages.

If this tuple already exists, nothing is done.

Definition at line 1883 of file olsr-routing-protocol.cc.

References ns3::OlsrState::GetAssociations(), ns3::OlsrState::InsertAssociation(), m_state, ns3::olsr::Association::netmask, ns3::olsr::Association::networkAddr, and NS_LOG_INFO.

Referenced by SetRoutingTableAssociation().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::olsr::RoutingProtocol::AddIfaceAssocTuple ( const IfaceAssocTuple tuple)
private

Adds an interface association tuple to the Interface Association Set.

Parameters
tuplethe interface association tuple to be added.

Definition at line 2654 of file olsr-routing-protocol.cc.

References ns3::OlsrState::InsertIfaceAssocTuple(), and m_state.

Referenced by DoInitialize(), and ProcessMid().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::olsr::RoutingProtocol::AddMprSelectorTuple ( const MprSelectorTuple tuple)
private

Adds an MPR selector tuple to the MPR Selector Set.

Advertised Neighbor Sequence Number (ANSN) is also updated.

Parameters
tuplethe MPR selector tuple to be added.

Definition at line 2582 of file olsr-routing-protocol.cc.

References IncrementAnsn(), ns3::OlsrState::InsertMprSelectorTuple(), and m_state.

Referenced by PopulateMprSelectorSet().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::olsr::RoutingProtocol::AddNeighborTuple ( const NeighborTuple tuple)
private

Adds a neighbor tuple to the Neighbor Set.

Parameters
tuplethe neighbor tuple to be added.

Definition at line 2504 of file olsr-routing-protocol.cc.

References IncrementAnsn(), ns3::OlsrState::InsertNeighborTuple(), and m_state.

Referenced by LinkTupleAdded().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::olsr::RoutingProtocol::AddTopologyTuple ( const TopologyTuple tuple)
private

Adds a topology tuple to the Topology Set.

Parameters
tuplethe topology tuple to be added.

Definition at line 2618 of file olsr-routing-protocol.cc.

References ns3::OlsrState::InsertTopologyTuple(), and m_state.

Referenced by ProcessTc().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::olsr::RoutingProtocol::AddTwoHopNeighborTuple ( const TwoHopNeighborTuple tuple)
private

Adds a 2-hop neighbor tuple to the 2-hop Neighbor Set.

Parameters
tuplethe 2-hop neighbor tuple to be added.

Definition at line 2540 of file olsr-routing-protocol.cc.

References ns3::OlsrState::InsertTwoHopNeighborTuple(), and m_state.

Referenced by PopulateTwoHopNeighborSet().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int64_t ns3::olsr::RoutingProtocol::AssignStreams ( int64_t  stream)

Assign a fixed random variable stream number to the random variables used by this model.

Return the number of streams (possibly zero) that have been assigned.

Parameters
streamfirst stream index to use
Returns
the number of stream indices assigned by this model

Definition at line 3310 of file olsr-routing-protocol.cc.

References m_uniformRandomVariable, NS_LOG_FUNCTION, and ns3::RandomVariableStream::SetStream().

+ Here is the call graph for this function:

void ns3::olsr::RoutingProtocol::AssociationTupleTimerExpire ( Ipv4Address  gatewayAddr,
Ipv4Address  networkAddr,
Ipv4Mask  netmask 
)
private

Removes tuple_ if expired.

Else timer is rescheduled to expire at tuple_->time().

Parameters
eThe event which has expired.

Definition at line 2960 of file olsr-routing-protocol.cc.

References DELAY, ns3::olsr::AssociationTuple::expirationTime, ns3::OlsrState::FindAssociationTuple(), m_events, m_state, ns3::Simulator::Now(), RemoveAssociationTuple(), ns3::Simulator::Schedule(), and ns3::EventGarbageCollector::Track().

Referenced by ProcessHna().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::olsr::RoutingProtocol::Clear ( void  )
private

Clears the routing table and frees the memory assigned to each one of its entries.

Definition at line 2983 of file olsr-routing-protocol.cc.

References m_table, and NS_LOG_FUNCTION_NOARGS.

Referenced by RoutingTableComputation().

+ Here is the caller graph for this function:

int ns3::olsr::RoutingProtocol::Degree ( NeighborTuple const &  tuple)
private

This auxiliary function (defined in RFC 3626) is used for calculating the MPR Set.

Parameters
tuplethe neighbor tuple which has the main address of the node we are going to calculate its degree to.
Returns
the degree of the node.

Definition at line 516 of file olsr-routing-protocol.cc.

References ns3::OlsrState::FindNeighborTuple(), ns3::OlsrState::GetTwoHopNeighbors(), m_state, ns3::olsr::NeighborTuple::neighborMainAddr, and ns3::olsr::TwoHopNeighborTuple::neighborMainAddr.

Referenced by MprComputation().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::olsr::RoutingProtocol::DoDispose ( void  )
privatevirtual

This method is called by Object::Dispose or by the object's destructor, whichever comes first.

Subclasses are expected to implement their real destruction code in an overriden version of this method and chain up to their parent's implementation once they are done. i.e., for simplicity, the destructor of every subclass should be empty and its content should be moved to the associated DoDispose method.

It is safe to call GetObject from within this method.

Reimplemented from ns3::Object.

Definition at line 234 of file olsr-routing-protocol.cc.

References ns3::Object::DoDispose(), m_hnaRoutingTable, m_ipv4, m_routingTableAssociation, and m_socketAddresses.

+ Here is the call graph for this function:

void ns3::olsr::RoutingProtocol::DoInitialize ( void  )
protectedvirtual

This method is called only once by Object::Initialize.

If the user calls Object::Initialize multiple times, DoInitialize is called only the first time.

Subclasses are expected to override this method and chain up to their parent's implementation once they are done. It is safe to call GetObject and AggregateObject from within this method.

Reimplemented from ns3::Object.

Definition at line 277 of file olsr-routing-protocol.cc.

References AddIfaceAssocTuple(), ns3::Socket::Bind(), ns3::Socket::BindToNetDevice(), ns3::Socket::CreateSocket(), GetMainAddress(), ns3::UdpSocketFactory::GetTypeId(), HelloTimerExpire(), HnaTimerExpire(), ns3::olsr::IfaceAssocTuple::ifaceAddr, m_interfaceExclusions, m_ipv4, m_mainAddress, m_socketAddresses, ns3::olsr::IfaceAssocTuple::mainAddr, ns3::MakeCallback(), MidTimerExpire(), NS_ASSERT, NS_FATAL_ERROR, NS_LOG_DEBUG, OLSR_PORT_NUMBER, RecvOlsr(), ns3::Socket::SetAllowBroadcast(), ns3::Socket::SetRecvCallback(), and TcTimerExpire().

+ Here is the call graph for this function:

void ns3::olsr::RoutingProtocol::Dump ( void  )

Dump the neighbor table, two-hop neighbor table, and routing table to logging output (NS_LOG_DEBUG log level).

If logging is disabled, this function does nothing.

Definition at line 3333 of file olsr-routing-protocol.cc.

References ns3::OlsrState::GetNeighbors(), ns3::OlsrState::GetTwoHopNeighbors(), m_mainAddress, m_state, m_table, ns3::Simulator::Now(), and NS_LOG_DEBUG.

+ Here is the call graph for this function:

void ns3::olsr::RoutingProtocol::DupTupleTimerExpire ( Ipv4Address  address,
uint16_t  sequenceNumber 
)
private

Removes tuple if expired.

Else timer is rescheduled to expire at tuple.expirationTime.

The task of actually removing the tuple is left to the OLSR agent.

Parameters
tupleThe tuple which has expired.

Definition at line 2785 of file olsr-routing-protocol.cc.

References DELAY, ns3::olsr::DuplicateTuple::expirationTime, ns3::OlsrState::FindDuplicateTuple(), m_events, m_state, ns3::Simulator::Now(), RemoveDuplicateTuple(), ns3::Simulator::Schedule(), and ns3::EventGarbageCollector::Track().

Referenced by ForwardDefault().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool ns3::olsr::RoutingProtocol::FindSendEntry ( const RoutingTableEntry entry,
RoutingTableEntry outEntry 
) const
private

Finds the appropiate entry which must be used in order to forward a data packet to a next hop (given a destination).

Imagine a routing table like this: [A,B] [B,C] [C,C]; being each pair of the form [dest addr,next-hop addr]. In this case, if this function is invoked with [A,B] then pair [C,C] is returned because C is the next hop that must be used to forward a data packet destined to A. That is, C is a neighbor of this node, but B isn't. This function finds the appropiate neighbor for forwarding a packet.

Parameters
entrythe routing table entry which indicates the destination node we are interested in.
Returns
the appropiate routing table entry which indicates the next hop which must be used for forwarding a data packet, or NULL if there is no such entry.

Definition at line 3036 of file olsr-routing-protocol.cc.

References ns3::olsr::RoutingTableEntry::destAddr, Lookup(), and ns3::olsr::RoutingTableEntry::nextAddr.

Referenced by RouteInput(), and RouteOutput().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::olsr::RoutingProtocol::ForwardDefault ( olsr::MessageHeader  olsrMessage,
DuplicateTuple duplicated,
const Ipv4Address localIface,
const Ipv4Address senderAddress 
)
private

OLSR's default forwarding algorithm.

See RFC 3626 for details.

Parameters
pthe OLSR packet which has been received.
msgthe OLSR message which must be forwarded.
dup_tupleNULL if the message has never been considered for forwarding, or a duplicate tuple in other case.
local_ifacethe address of the interface where the message was received from.

Definition at line 1507 of file olsr-routing-protocol.cc.

References AddDuplicateTuple(), ns3::olsr::DuplicateTuple::address, DupTupleTimerExpire(), ns3::olsr::DuplicateTuple::expirationTime, ns3::OlsrState::FindMprSelectorTuple(), ns3::OlsrState::FindSymLinkTuple(), ns3::olsr::MessageHeader::GetHopCount(), GetMainAddress(), ns3::olsr::MessageHeader::GetMessageSequenceNumber(), ns3::olsr::MessageHeader::GetOriginatorAddress(), ns3::olsr::MessageHeader::GetTimeToLive(), ns3::olsr::DuplicateTuple::ifaceList, JITTER, m_mainAddress, m_state, ns3::Simulator::Now(), NS_LOG_LOGIC, OLSR_DUP_HOLD_TIME, QueueMessage(), ns3::olsr::DuplicateTuple::retransmitted, ns3::Simulator::Schedule(), ns3::olsr::DuplicateTuple::sequenceNumber, ns3::olsr::MessageHeader::SetHopCount(), and ns3::olsr::MessageHeader::SetTimeToLive().

Referenced by RecvOlsr().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::set<uint32_t> ns3::olsr::RoutingProtocol::GetInterfaceExclusions ( ) const
inline

Definition at line 121 of file olsr-routing-protocol.h.

References m_interfaceExclusions.

Ipv4Address ns3::olsr::RoutingProtocol::GetMainAddress ( Ipv4Address  iface_addr) const
private

Gets the main address associated with a given interface address.

Parameters
iface_addrthe interface address.
Returns
the corresponding main address.

Definition at line 862 of file olsr-routing-protocol.cc.

References ns3::OlsrState::FindIfaceAssocTuple(), m_state, and ns3::olsr::IfaceAssocTuple::mainAddr.

Referenced by DoInitialize(), ForwardDefault(), LinkTupleAdded(), LinkTupleUpdated(), NeighborLoss(), PopulateMprSelectorSet(), PopulateTwoHopNeighborSet(), ProcessMid(), RemoveLinkTuple(), RoutingTableComputation(), and SendHello().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint16_t ns3::olsr::RoutingProtocol::GetMessageSequenceNumber ( )
inlineprivate

Increments message sequence number and returns the new value.

Definition at line 2713 of file olsr-routing-protocol.cc.

References m_messageSequenceNumber, and OLSR_MAX_SEQ_NUM.

Referenced by SendHello(), SendHna(), SendMid(), and SendTc().

+ Here is the caller graph for this function:

uint16_t ns3::olsr::RoutingProtocol::GetPacketSequenceNumber ( )
inlineprivate

Increments packet sequence number and returns the new value.

Definition at line 2706 of file olsr-routing-protocol.cc.

References m_packetSequenceNumber, and OLSR_MAX_SEQ_NUM.

Referenced by SendPacket().

+ Here is the caller graph for this function:

std::vector< RoutingTableEntry > ns3::olsr::RoutingProtocol::GetRoutingTableEntries ( ) const

Return the list of routing table entries discovered by OLSR.

Definition at line 3298 of file olsr-routing-protocol.cc.

References m_table.

uint32_t ns3::olsr::RoutingProtocol::GetSize ( void  ) const
inlineprivate

Definition at line 168 of file olsr-routing-protocol.h.

References m_table.

Referenced by RoutingTableComputation().

+ Here is the caller graph for this function:

void ns3::olsr::RoutingProtocol::HelloTimerExpire ( )
private

Sends a HELLO message and reschedules the HELLO timer.

Parameters
eThe event which has expired.

Definition at line 2725 of file olsr-routing-protocol.cc.

References m_helloInterval, m_helloTimer, ns3::Timer::Schedule(), and SendHello().

Referenced by DoInitialize(), and SetIpv4().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::olsr::RoutingProtocol::HnaTimerExpire ( )
private

Sends an HNA message (if the node has associated hosts/networks) and reschedules the HNA timer.

Definition at line 2764 of file olsr-routing-protocol.cc.

References ns3::OlsrState::GetAssociations(), m_hnaInterval, m_hnaTimer, m_state, NS_LOG_DEBUG, ns3::Timer::Schedule(), and SendHna().

Referenced by DoInitialize(), and SetIpv4().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::olsr::RoutingProtocol::IfaceAssocTupleTimerExpire ( Ipv4Address  ifaceAddr)
private

Removes tuple_ if expired.

Else timer is rescheduled to expire at tuple_->time().

Parameters
eThe event which has expired.

Definition at line 2937 of file olsr-routing-protocol.cc.

References DELAY, ns3::OlsrState::FindIfaceAssocTuple(), m_events, m_state, ns3::Simulator::Now(), RemoveIfaceAssocTuple(), ns3::Simulator::Schedule(), ns3::olsr::IfaceAssocTuple::time, and ns3::EventGarbageCollector::Track().

Referenced by ProcessMid().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::olsr::RoutingProtocol::IncrementAnsn ( )
private

Definition at line 2569 of file olsr-routing-protocol.cc.

References m_ansn, and OLSR_MAX_SEQ_NUM.

Referenced by AddMprSelectorTuple(), AddNeighborTuple(), RemoveMprSelectorTuple(), and RemoveNeighborTuple().

+ Here is the caller graph for this function:

bool ns3::olsr::RoutingProtocol::IsMyOwnAddress ( const Ipv4Address a) const
private

Check that address is one of my interfaces.

Definition at line 3318 of file olsr-routing-protocol.cc.

References ns3::Ipv4InterfaceAddress::GetLocal(), and m_socketAddresses.

Referenced by RouteInput().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::olsr::RoutingProtocol::LinkTupleAdded ( const LinkTuple tuple,
uint8_t  willingness 
)
private
void ns3::olsr::RoutingProtocol::LinkTupleTimerExpire ( Ipv4Address  neighborIfaceAddr)
private

Removes tuple_ if expired.

Else if symmetric time has expired then it is assumed a neighbor loss and agent_->nb_loss() is called. In this case the timer is rescheduled to expire at tuple_->time(). Otherwise the timer is rescheduled to expire at the minimum between tuple_->time() and tuple_->sym_time().

The task of actually removing the tuple is left to the OLSR agent.

Parameters
eThe event which has expired.

Definition at line 2817 of file olsr-routing-protocol.cc.

References DELAY, ns3::OlsrState::FindLinkTuple(), m_events, m_linkTupleTimerFirstTime, m_state, NeighborLoss(), ns3::Simulator::Now(), RemoveLinkTuple(), ns3::Simulator::Schedule(), ns3::olsr::LinkTuple::symTime, ns3::olsr::LinkTuple::time, and ns3::EventGarbageCollector::Track().

Referenced by LinkSensing().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::olsr::RoutingProtocol::LinkTupleUpdated ( const LinkTuple tuple,
uint8_t  willingness 
)
private

This function is invoked when a link tuple is updated.

Its aim is to also update the corresponding neighbor tuple if it is needed.

Parameters
tuplethe link tuple which has been updated.

Definition at line 2441 of file olsr-routing-protocol.cc.

References ns3::OlsrState::FindNeighborTuple(), ns3::OlsrState::GetLinks(), GetMainAddress(), LinkTupleAdded(), m_mainAddress, m_state, ns3::olsr::LinkTuple::neighborIfaceAddr, ns3::olsr::NeighborTuple::neighborMainAddr, ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_WARN, ns3::olsr::NeighborTuple::status, ns3::olsr::NeighborTuple::STATUS_NOT_SYM, ns3::olsr::NeighborTuple::STATUS_SYM, and ns3::olsr::LinkTuple::symTime.

Referenced by LinkSensing(), and NeighborLoss().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool ns3::olsr::RoutingProtocol::Lookup ( const Ipv4Address dest,
RoutingTableEntry outEntry 
) const
private

Looks up an entry for the specified destination address.

Parameters
destdestination address.
outEntryoutput parameter to hold the routing entry result, if fuond
Returns
true if found, false if not found

Definition at line 3006 of file olsr-routing-protocol.cc.

References m_table.

Referenced by FindSendEntry(), RouteInput(), RouteOutput(), and RoutingTableComputation().

+ Here is the caller graph for this function:

void ns3::olsr::RoutingProtocol::MidTimerExpire ( )
private

Sends a MID message (if the node has more than one interface) and resets the MID timer.

Parameters
eThe event which has expired.

Definition at line 2754 of file olsr-routing-protocol.cc.

References m_midInterval, m_midTimer, ns3::Timer::Schedule(), and SendMid().

Referenced by DoInitialize(), and SetIpv4().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::olsr::RoutingProtocol::MprSelTupleTimerExpire ( Ipv4Address  mainAddr)
private

Removes tuple_ if expired.

Else the timer is rescheduled to expire at tuple_->time().

The task of actually removing the tuple is left to the OLSR agent.

Parameters
eThe event which has expired.

Definition at line 2886 of file olsr-routing-protocol.cc.

References DELAY, ns3::olsr::MprSelectorTuple::expirationTime, ns3::OlsrState::FindMprSelectorTuple(), m_events, m_state, ns3::Simulator::Now(), RemoveMprSelectorTuple(), ns3::Simulator::Schedule(), and ns3::EventGarbageCollector::Track().

Referenced by PopulateMprSelectorSet().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::olsr::RoutingProtocol::Nb2hopTupleTimerExpire ( Ipv4Address  neighborMainAddr,
Ipv4Address  twoHopNeighborAddr 
)
private

Removes tuple_ if expired.

Else the timer is rescheduled to expire at tuple_->time().

The task of actually removing the tuple is left to the OLSR agent.

Parameters
eThe event which has expired.

Definition at line 2858 of file olsr-routing-protocol.cc.

References DELAY, ns3::olsr::TwoHopNeighborTuple::expirationTime, ns3::OlsrState::FindTwoHopNeighborTuple(), m_events, m_state, ns3::Simulator::Now(), RemoveTwoHopNeighborTuple(), ns3::Simulator::Schedule(), and ns3::EventGarbageCollector::Track().

Referenced by PopulateTwoHopNeighborSet().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::olsr::RoutingProtocol::NeighborLoss ( const LinkTuple tuple)
private

Performs all actions needed when a neighbor loss occurs.

Neighbor Set, 2-hop Neighbor Set, MPR Set and MPR Selector Set are updated.

Parameters
tuplelink tuple with the information of the link to the neighbor which has been lost.

Definition at line 2352 of file olsr-routing-protocol.cc.

References ns3::OlsrState::EraseMprSelectorTuples(), ns3::OlsrState::EraseTwoHopNeighborTuples(), GetMainAddress(), LinkTupleUpdated(), m_mainAddress, m_state, MprComputation(), ns3::olsr::LinkTuple::neighborIfaceAddr, ns3::Simulator::Now(), NS_LOG_DEBUG, OLSR_WILL_DEFAULT, and RoutingTableComputation().

Referenced by LinkTupleTimerExpire().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::olsr::RoutingProtocol::NotifyAddAddress ( uint32_t  interface,
Ipv4InterfaceAddress  address 
)
privatevirtual
Parameters
interfacethe index of the interface we are being notified about
addressa new address being added to an interface

Protocols are expected to implement this method to be notified whenever a new address is added to an interface. Typically used to add a 'network route' on an interface. Can be invoked on an up or down interface.

Implements ns3::Ipv4RoutingProtocol.

Definition at line 3233 of file olsr-routing-protocol.cc.

void ns3::olsr::RoutingProtocol::NotifyInterfaceDown ( uint32_t  interface)
privatevirtual
Parameters
interfacethe index of the interface we are being notified about

Protocols are expected to implement this method to be notified of the state change of an interface in a node.

Implements ns3::Ipv4RoutingProtocol.

Definition at line 3230 of file olsr-routing-protocol.cc.

void ns3::olsr::RoutingProtocol::NotifyInterfaceUp ( uint32_t  interface)
privatevirtual
Parameters
interfacethe index of the interface we are being notified about

Protocols are expected to implement this method to be notified of the state change of an interface in a node.

Implements ns3::Ipv4RoutingProtocol.

Definition at line 3227 of file olsr-routing-protocol.cc.

void ns3::olsr::RoutingProtocol::NotifyRemoveAddress ( uint32_t  interface,
Ipv4InterfaceAddress  address 
)
privatevirtual
Parameters
interfacethe index of the interface we are being notified about
addressa new address being added to an interface

Protocols are expected to implement this method to be notified whenever a new address is removed from an interface. Typically used to remove the 'network route' of an interface. Can be invoked on an up or down interface.

Implements ns3::Ipv4RoutingProtocol.

Definition at line 3236 of file olsr-routing-protocol.cc.

void ns3::olsr::RoutingProtocol::PopulateMprSelectorSet ( const olsr::MessageHeader msg,
const olsr::MessageHeader::Hello hello 
)
private
void ns3::olsr::RoutingProtocol::PopulateNeighborSet ( const olsr::MessageHeader msg,
const olsr::MessageHeader::Hello hello 
)
private

Updates the Neighbor Set according to the information contained in a new received HELLO message (following RFC 3626).

Definition at line 2125 of file olsr-routing-protocol.cc.

References ns3::OlsrState::FindNeighborTuple(), ns3::olsr::MessageHeader::GetOriginatorAddress(), m_state, ns3::olsr::NeighborTuple::willingness, and ns3::olsr::MessageHeader::Hello::willingness.

Referenced by ProcessHello().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::olsr::RoutingProtocol::PrintRoutingTable ( Ptr< OutputStreamWrapper stream) const
privatevirtual

Print the Routing Table entries.

Parameters
streamthe ostream the Routing table is printed to

Implements ns3::Ipv4RoutingProtocol.

Definition at line 251 of file olsr-routing-protocol.cc.

References ns3::Names::FindName(), ns3::OutputStreamWrapper::GetStream(), m_hnaRoutingTable, m_ipv4, and m_table.

+ Here is the call graph for this function:

void ns3::olsr::RoutingProtocol::ProcessHello ( const olsr::MessageHeader msg,
const Ipv4Address receiverIface,
const Ipv4Address senderIface 
)
private

Processes a HELLO message following RFC 3626 specification.

Link sensing and population of the Neighbor Set, 2-hop Neighbor Set and MPR Selector Set are performed.

Parameters
msgthe OLSR message which contains the HELLO message.
receiver_ifacethe address of the interface where the message was received from.
sender_ifacethe address of the interface where the message was sent from.

Definition at line 1202 of file olsr-routing-protocol.cc.

References ns3::olsr::MessageHeader::GetHello(), ns3::OlsrState::GetLinks(), ns3::OlsrState::GetNeighbors(), ns3::OlsrState::GetTwoHopNeighbors(), LinkSensing(), m_mainAddress, m_state, MprComputation(), ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_FUNCTION, PopulateMprSelectorSet(), PopulateNeighborSet(), and PopulateTwoHopNeighborSet().

Referenced by RecvOlsr().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::olsr::RoutingProtocol::ProcessHna ( const olsr::MessageHeader msg,
const Ipv4Address senderIface 
)
private

Processes a HNA message following RFC 3626 specification.

The Host Network Association Set is updated (if needed) with the information of the received HNA message.

Parameters
msgthe OLSR message which contains the HNA message.
sender_ifacethe address of the interface where the message was sent from.

Definition at line 1439 of file olsr-routing-protocol.cc.

References AddAssociationTuple(), ns3::olsr::MessageHeader::Hna::associations, AssociationTupleTimerExpire(), DELAY, ns3::olsr::AssociationTuple::expirationTime, ns3::OlsrState::FindAssociationTuple(), ns3::OlsrState::FindSymLinkTuple(), ns3::olsr::AssociationTuple::gatewayAddr, ns3::olsr::MessageHeader::GetHna(), ns3::olsr::MessageHeader::GetOriginatorAddress(), ns3::olsr::MessageHeader::GetVTime(), m_state, ns3::olsr::AssociationTuple::netmask, ns3::olsr::AssociationTuple::networkAddr, ns3::Simulator::Now(), and ns3::Simulator::Schedule().

Referenced by RecvOlsr().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::olsr::RoutingProtocol::ProcessMid ( const olsr::MessageHeader msg,
const Ipv4Address senderIface 
)
private

Processes a MID message following RFC 3626 specification.

The Interface Association Set is updated (if needed) with the information of the received MID message.

Parameters
msgthe OLSR message which contains the MID message.
sender_ifacethe address of the interface where the message was sent from.

Definition at line 1360 of file olsr-routing-protocol.cc.

References AddIfaceAssocTuple(), DELAY, ns3::OlsrState::FindSymLinkTuple(), ns3::OlsrState::GetIfaceAssocSetMutable(), GetMainAddress(), ns3::olsr::MessageHeader::GetMid(), ns3::OlsrState::GetNeighbors(), ns3::olsr::MessageHeader::GetOriginatorAddress(), ns3::OlsrState::GetTwoHopNeighbors(), ns3::olsr::MessageHeader::GetVTime(), ns3::olsr::IfaceAssocTuple::ifaceAddr, IfaceAssocTupleTimerExpire(), ns3::olsr::MessageHeader::Mid::interfaceAddresses, m_mainAddress, m_state, ns3::olsr::IfaceAssocTuple::mainAddr, ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_LOGIC, ns3::Simulator::Schedule(), and ns3::olsr::IfaceAssocTuple::time.

Referenced by RecvOlsr().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::olsr::RoutingProtocol::ProcessTc ( const olsr::MessageHeader msg,
const Ipv4Address senderIface 
)
private
void ns3::olsr::RoutingProtocol::QueueMessage ( const olsr::MessageHeader message,
Time  delay 
)
private

Enques an OLSR message which will be sent with a delay of (0, delay].

This buffering system is used in order to piggyback several OLSR messages in a same OLSR packet.

Parameters
msgthe OLSR message which must be sent.
delaymaximum delay the OLSR message is going to be buffered.

Definition at line 1582 of file olsr-routing-protocol.cc.

References ns3::Timer::IsRunning(), m_queuedMessages, m_queuedMessagesTimer, ns3::Timer::Schedule(), and ns3::Timer::SetDelay().

Referenced by ForwardDefault(), SendHello(), SendHna(), SendMid(), and SendTc().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::olsr::RoutingProtocol::RemoveAssociationTuple ( const AssociationTuple tuple)
private

Removes a host network association tuple from the Association Set.

Parameters
tuplethe host network association tuple to be removed.

Definition at line 2699 of file olsr-routing-protocol.cc.

References ns3::OlsrState::EraseAssociationTuple(), and m_state.

Referenced by AssociationTupleTimerExpire().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::olsr::RoutingProtocol::RemoveDuplicateTuple ( const DuplicateTuple tuple)
private

Removes a duplicate tuple from the Duplicate Set.

Parameters
tuplethe duplicate tuple to be removed.

Definition at line 2387 of file olsr-routing-protocol.cc.

References ns3::OlsrState::EraseDuplicateTuple(), and m_state.

Referenced by DupTupleTimerExpire().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::olsr::RoutingProtocol::RemoveEntry ( const Ipv4Address dest)
private

Deletes the entry whose destination address is given.

Parameters
destaddress of the destination node.

Definition at line 2994 of file olsr-routing-protocol.cc.

References m_table.

void ns3::olsr::RoutingProtocol::RemoveHostNetworkAssociation ( Ipv4Address  networkAddr,
Ipv4Mask  netmask 
)

Removes Association sent in HNA message.

Removes the specified (networkAddr, netmask) tuple from the list of local HNA associations to be sent by the node via HNA messages.

If this tuple does not exist, nothing is done (see "OlsrState::EraseAssociation()").

Definition at line 1909 of file olsr-routing-protocol.cc.

References ns3::OlsrState::EraseAssociation(), m_state, and NS_LOG_INFO.

Referenced by SetRoutingTableAssociation().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::olsr::RoutingProtocol::RemoveIfaceAssocTuple ( const IfaceAssocTuple tuple)
private

Removes an interface association tuple from the Interface Association Set.

Parameters
tuplethe interface association tuple to be removed.

Definition at line 2671 of file olsr-routing-protocol.cc.

References ns3::OlsrState::EraseIfaceAssocTuple(), and m_state.

Referenced by IfaceAssocTupleTimerExpire().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::olsr::RoutingProtocol::RemoveLinkTuple ( const LinkTuple tuple)
private

Removes a link tuple from the Link Set.

Parameters
tuplethe link tuple to be removed.

Definition at line 2423 of file olsr-routing-protocol.cc.

References ns3::OlsrState::EraseLinkTuple(), ns3::OlsrState::EraseNeighborTuple(), GetMainAddress(), m_mainAddress, m_state, ns3::olsr::LinkTuple::neighborIfaceAddr, ns3::Simulator::Now(), and NS_LOG_DEBUG.

Referenced by LinkTupleTimerExpire().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::olsr::RoutingProtocol::RemoveMprSelectorTuple ( const MprSelectorTuple tuple)
private

Removes an MPR selector tuple from the MPR Selector Set.

Advertised Neighbor Sequence Number (ANSN) is also updated.

Parameters
tuplethe MPR selector tuple to be removed.

Definition at line 2601 of file olsr-routing-protocol.cc.

References ns3::OlsrState::EraseMprSelectorTuple(), IncrementAnsn(), and m_state.

Referenced by MprSelTupleTimerExpire().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::olsr::RoutingProtocol::RemoveNeighborTuple ( const NeighborTuple tuple)
private

Removes a neighbor tuple from the Neighbor Set.

Parameters
tuplethe neighbor tuple to be removed.

Definition at line 2522 of file olsr-routing-protocol.cc.

References ns3::OlsrState::EraseNeighborTuple(), IncrementAnsn(), and m_state.

+ Here is the call graph for this function:

void ns3::olsr::RoutingProtocol::RemoveTopologyTuple ( const TopologyTuple tuple)
private

Removes a topology tuple from the Topology Set.

Parameters
tuplethe topology tuple to be removed.

Definition at line 2636 of file olsr-routing-protocol.cc.

References ns3::OlsrState::EraseTopologyTuple(), and m_state.

Referenced by TopologyTupleTimerExpire().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::olsr::RoutingProtocol::RemoveTwoHopNeighborTuple ( const TwoHopNeighborTuple tuple)
private

Removes a 2-hop neighbor tuple from the 2-hop Neighbor Set.

Parameters
tuplethe 2-hop neighbor tuple to be removed.

Definition at line 2557 of file olsr-routing-protocol.cc.

References ns3::OlsrState::EraseTwoHopNeighborTuple(), and m_state.

Referenced by Nb2hopTupleTimerExpire().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool ns3::olsr::RoutingProtocol::RouteInput ( Ptr< const Packet p,
const Ipv4Header header,
Ptr< const NetDevice idev,
UnicastForwardCallback  ucb,
MulticastForwardCallback  mcb,
LocalDeliverCallback  lcb,
ErrorCallback  ecb 
)
privatevirtual

Route an input packet (to be forwarded or locally delivered)

This lookup is used in the forwarding process. The packet is handed over to the Ipv4RoutingProtocol, and will get forwarded onward by one of the callbacks. The Linux equivalent is ip_route_input(). There are four valid outcomes, and a matching callbacks to handle each.

Parameters
preceived packet
headerinput parameter used to form a search key for a route
idevPointer to ingress network device
ucbCallback for the case in which the packet is to be forwarded as unicast
mcbCallback for the case in which the packet is to be forwarded as multicast
lcbCallback for the case in which the packet is to be locally delivered
ecbCallback to call if there is an error in forwarding
Returns
true if the Ipv4RoutingProtocol takes responsibility for forwarding or delivering the packet, false otherwise
Todo:
Implment IP aliasing and OLSR

Implements ns3::Ipv4RoutingProtocol.

Definition at line 3124 of file olsr-routing-protocol.cc.

References FindSendEntry(), ns3::Ipv4Header::GetDestination(), ns3::Node::GetId(), ns3::Ipv4InterfaceAddress::GetLocal(), ns3::Ipv4Header::GetSource(), ns3::olsr::RoutingTableEntry::interface, IsMyOwnAddress(), ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), Lookup(), m_hnaRoutingTable, m_ipv4, m_mainAddress, m_table, ns3::olsr::RoutingTableEntry::nextAddr, NS_ASSERT, NS_FATAL_ERROR, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::Ipv4Route::SetDestination(), ns3::Ipv4Route::SetGateway(), ns3::Ipv4Route::SetOutputDevice(), and ns3::Ipv4Route::SetSource().

+ Here is the call graph for this function:

Ptr< Ipv4Route > ns3::olsr::RoutingProtocol::RouteOutput ( Ptr< Packet p,
const Ipv4Header header,
Ptr< NetDevice oif,
Socket::SocketErrno sockerr 
)
privatevirtual

Query routing cache for an existing route, for an outbound packet.

This lookup is used by transport protocols. It does not cause any packet to be forwarded, and is synchronous. Can be used for multicast or unicast. The Linux equivalent is ip_route_output()

The header input parameter may have an uninitialized value for the source address, but the destination address should always be properly set by the caller.

Parameters
ppacket to be routed. Note that this method may modify the packet. Callers may also pass in a null pointer.
headerinput parameter (used to form key to search for the route)
oifOutput interface Netdevice. May be zero, or may be bound via socket options to a particular output interface.
sockerrOutput parameter; socket errno
Returns
a code that indicates what happened in the lookup
Todo:
Implment IP aliasing and OLSR

Implements ns3::Ipv4RoutingProtocol.

Definition at line 3049 of file olsr-routing-protocol.cc.

References ns3::Socket::ERROR_NOROUTETOHOST, ns3::Socket::ERROR_NOTERROR, FindSendEntry(), ns3::Ipv4Header::GetDestination(), ns3::Node::GetId(), ns3::Ipv4InterfaceAddress::GetLocal(), ns3::olsr::RoutingTableEntry::interface, Lookup(), m_hnaRoutingTable, m_ipv4, m_mainAddress, ns3::olsr::RoutingTableEntry::nextAddr, NS_ASSERT, NS_FATAL_ERROR, NS_LOG_DEBUG, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

void ns3::olsr::RoutingProtocol::RoutingTableComputation ( )
private

Creates the routing table of the node following RFC 3626 hints.

Definition at line 877 of file olsr-routing-protocol.cc.

References AddEntry(), Clear(), ns3::olsr::TopologyTuple::destAddr, ns3::olsr::RoutingTableEntry::distance, ns3::OlsrState::FindSymNeighborTuple(), ns3::olsr::AssociationTuple::gatewayAddr, ns3::OlsrState::GetAssociations(), ns3::OlsrState::GetAssociationSet(), ns3::Ipv4RoutingTableEntry::GetDestNetwork(), ns3::Ipv4RoutingTableEntry::GetDestNetworkMask(), ns3::OlsrState::GetIfaceAssocSet(), ns3::OlsrState::GetLinks(), GetMainAddress(), ns3::OlsrState::GetNeighbors(), GetSize(), ns3::OlsrState::GetTopologySet(), ns3::OlsrState::GetTwoHopNeighbors(), ns3::olsr::IfaceAssocTuple::ifaceAddr, ns3::olsr::RoutingTableEntry::interface, ns3::olsr::TopologyTuple::lastAddr, ns3::olsr::LinkTuple::localIfaceAddr, Lookup(), m_hnaRoutingTable, m_mainAddress, m_routingTableChanged, m_state, ns3::olsr::IfaceAssocTuple::mainAddr, ns3::olsr::LinkTuple::neighborIfaceAddr, ns3::olsr::NeighborTuple::neighborMainAddr, ns3::olsr::TwoHopNeighborTuple::neighborMainAddr, ns3::olsr::Association::netmask, ns3::olsr::AssociationTuple::netmask, ns3::olsr::Association::networkAddr, ns3::olsr::AssociationTuple::networkAddr, ns3::olsr::RoutingTableEntry::nextAddr, ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_LOGIC, OLSR_WILL_NEVER, ns3::olsr::NeighborTuple::status, ns3::olsr::NeighborTuple::STATUS_SYM, ns3::olsr::LinkTuple::time, and ns3::olsr::TwoHopNeighborTuple::twoHopNeighborAddr.

Referenced by NeighborLoss(), and RecvOlsr().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::olsr::RoutingProtocol::SendHna ( )
private
void ns3::olsr::RoutingProtocol::SendMid ( )
private
void ns3::olsr::RoutingProtocol::SendPacket ( Ptr< Packet packet,
const MessageList containedMessages 
)
private
void ns3::olsr::RoutingProtocol::SendQueuedMessages ( )
private

Creates as many OLSR packets as needed in order to send all buffered OLSR messages.

Maximum number of messages which can be contained in an OLSR packet is dictated by OLSR_MAX_MSGS constant.

Definition at line 1624 of file olsr-routing-protocol.cc.

References ns3::Packet::AddAtEnd(), ns3::Packet::AddHeader(), ns3::Packet::GetSize(), m_mainAddress, m_queuedMessages, NS_LOG_DEBUG, OLSR_MAX_MSGS, and SendPacket().

Referenced by SetIpv4().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::olsr::RoutingProtocol::SetInterfaceExclusions ( std::set< uint32_t >  exceptions)

Definition at line 354 of file olsr-routing-protocol.cc.

References m_interfaceExclusions.

void ns3::olsr::RoutingProtocol::SetIpv4 ( Ptr< Ipv4 ipv4)
privatevirtual
Parameters
ipv4the ipv4 object this routing protocol is being associated with

Typically, invoked directly or indirectly from ns3::Ipv4::SetRoutingProtocol

Implements ns3::Ipv4RoutingProtocol.

Definition at line 212 of file olsr-routing-protocol.cc.

References HelloTimerExpire(), HnaTimerExpire(), m_ansn, m_helloTimer, m_hnaRoutingTable, m_hnaTimer, m_ipv4, m_linkTupleTimerFirstTime, m_messageSequenceNumber, m_midTimer, m_packetSequenceNumber, m_queuedMessagesTimer, m_tcTimer, MidTimerExpire(), NS_ASSERT, NS_LOG_DEBUG, OLSR_MAX_SEQ_NUM, SendQueuedMessages(), ns3::Timer::SetFunction(), and TcTimerExpire().

+ Here is the call graph for this function:

void ns3::olsr::RoutingProtocol::SetMainInterface ( uint32_t  interface)

Set the OLSR main address to the first address on the indicated interface.

Parameters
interfaceIPv4 interface index

Definition at line 349 of file olsr-routing-protocol.cc.

References m_ipv4, and m_mainAddress.

void ns3::olsr::RoutingProtocol::SetRoutingTableAssociation ( Ptr< Ipv4StaticRouting routingTable)

Inject Associations from an Ipv4StaticRouting instance.

Associates the specified Ipv4StaticRouting routing table to the OLSR routing protocol.

Entries from this associated routing table that use non-olsr outgoing interfaces are added to the list of local HNA associations so that they are included in HNA messages sent by the node. If this method is called more than once, entries from the old association are deleted before entries from the new one are added.

Parameters
routingTablethe Ipv4StaticRouting routing table to be associated.

Definition at line 1926 of file olsr-routing-protocol.cc.

References AddHostNetworkAssociation(), ns3::OlsrState::GetAssociations(), ns3::Ipv4RoutingTableEntry::GetDestNetwork(), ns3::Ipv4RoutingTableEntry::GetDestNetworkMask(), m_routingTableAssociation, m_state, NS_LOG_DEBUG, NS_LOG_INFO, RemoveHostNetworkAssociation(), and UsesNonOlsrOutgoingInterface().

+ Here is the call graph for this function:

void ns3::olsr::RoutingProtocol::TcTimerExpire ( )
private

Sends a TC message (if there exists any MPR selector) and reschedules the TC timer.

Parameters
eThe event which has expired.

Definition at line 2736 of file olsr-routing-protocol.cc.

References ns3::OlsrState::GetMprSelectors(), m_state, m_tcInterval, m_tcTimer, NS_LOG_DEBUG, ns3::Timer::Schedule(), and SendTc().

Referenced by DoInitialize(), and SetIpv4().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::olsr::RoutingProtocol::TopologyTupleTimerExpire ( Ipv4Address  destAddr,
Ipv4Address  lastAddr 
)
private

Removes tuple_ if expired.

Else the timer is rescheduled to expire at tuple_->time().

The task of actually removing the tuple is left to the OLSR agent.

Parameters
eThe event which has expired.

Definition at line 2913 of file olsr-routing-protocol.cc.

References DELAY, ns3::olsr::TopologyTuple::destAddr, ns3::olsr::TopologyTuple::expirationTime, ns3::OlsrState::FindTopologyTuple(), ns3::olsr::TopologyTuple::lastAddr, m_events, m_state, ns3::Simulator::Now(), RemoveTopologyTuple(), ns3::Simulator::Schedule(), and ns3::EventGarbageCollector::Track().

Referenced by ProcessTc().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool ns3::olsr::RoutingProtocol::UsesNonOlsrOutgoingInterface ( const Ipv4RoutingTableEntry route)
private

Tests whether or not the specified route uses a non-OLSR outgoing interface.

Returns true if the outgoing interface of the specified route is a non-OLSR interface. Returns false otherwise.

Definition at line 1976 of file olsr-routing-protocol.cc.

References ns3::Ipv4RoutingTableEntry::GetInterface(), and m_interfaceExclusions.

Referenced by SetRoutingTableAssociation().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Friends And Related Function Documentation

friend class OlsrMprTestCase
friend

Definition at line 81 of file olsr-routing-protocol.h.

Member Data Documentation

uint16_t ns3::olsr::RoutingProtocol::m_ansn
private

Advertised Neighbor Set sequence number.

Definition at line 149 of file olsr-routing-protocol.h.

Referenced by IncrementAnsn(), SendTc(), and SetIpv4().

Time ns3::olsr::RoutingProtocol::m_helloInterval
private

HELLO messages' emission interval.

Definition at line 152 of file olsr-routing-protocol.h.

Referenced by GetTypeId(), HelloTimerExpire(), and SendHello().

Timer ns3::olsr::RoutingProtocol::m_helloTimer
private

Definition at line 219 of file olsr-routing-protocol.h.

Referenced by HelloTimerExpire(), and SetIpv4().

Time ns3::olsr::RoutingProtocol::m_hnaInterval
private

HNA messages' emission interval.

Definition at line 158 of file olsr-routing-protocol.h.

Referenced by GetTypeId(), and HnaTimerExpire().

Ptr<Ipv4StaticRouting> ns3::olsr::RoutingProtocol::m_hnaRoutingTable
private
Timer ns3::olsr::RoutingProtocol::m_hnaTimer
private

Definition at line 228 of file olsr-routing-protocol.h.

Referenced by HnaTimerExpire(), and SetIpv4().

std::set<uint32_t> ns3::olsr::RoutingProtocol::m_interfaceExclusions
private
Ptr<Ipv4> ns3::olsr::RoutingProtocol::m_ipv4
private
bool ns3::olsr::RoutingProtocol::m_linkTupleTimerFirstTime
private

Definition at line 232 of file olsr-routing-protocol.h.

Referenced by LinkTupleTimerExpire(), and SetIpv4().

uint16_t ns3::olsr::RoutingProtocol::m_messageSequenceNumber
private

Messages sequence number counter.

Definition at line 147 of file olsr-routing-protocol.h.

Referenced by GetMessageSequenceNumber(), and SetIpv4().

Time ns3::olsr::RoutingProtocol::m_midInterval
private

MID messages' emission interval.

Definition at line 156 of file olsr-routing-protocol.h.

Referenced by GetTypeId(), and MidTimerExpire().

Timer ns3::olsr::RoutingProtocol::m_midTimer
private

Definition at line 225 of file olsr-routing-protocol.h.

Referenced by MidTimerExpire(), and SetIpv4().

uint16_t ns3::olsr::RoutingProtocol::m_packetSequenceNumber
private

Packets sequence number counter.

Definition at line 145 of file olsr-routing-protocol.h.

Referenced by GetPacketSequenceNumber(), and SetIpv4().

olsr::MessageList ns3::olsr::RoutingProtocol::m_queuedMessages
private

A list of pending messages which are buffered awaiting for being sent.

Definition at line 243 of file olsr-routing-protocol.h.

Referenced by QueueMessage(), and SendQueuedMessages().

Timer ns3::olsr::RoutingProtocol::m_queuedMessagesTimer
private

Definition at line 244 of file olsr-routing-protocol.h.

Referenced by QueueMessage(), and SetIpv4().

Ptr<Ipv4StaticRouting> ns3::olsr::RoutingProtocol::m_routingTableAssociation
private

Definition at line 118 of file olsr-routing-protocol.h.

Referenced by DoDispose(), and SetRoutingTableAssociation().

TracedCallback<uint32_t> ns3::olsr::RoutingProtocol::m_routingTableChanged
private

Definition at line 312 of file olsr-routing-protocol.h.

Referenced by GetTypeId(), and RoutingTableComputation().

TracedCallback<const PacketHeader &, const MessageList &> ns3::olsr::RoutingProtocol::m_rxPacketTrace
private

Definition at line 309 of file olsr-routing-protocol.h.

Referenced by GetTypeId(), and RecvOlsr().

std::map< Ptr<Socket>, Ipv4InterfaceAddress > ns3::olsr::RoutingProtocol::m_socketAddresses
private
std::map<Ipv4Address, RoutingTableEntry> ns3::olsr::RoutingProtocol::m_table
private

Data structure for the routing table.

Definition at line 138 of file olsr-routing-protocol.h.

Referenced by AddEntry(), Clear(), Dump(), GetRoutingTableEntries(), GetSize(), Lookup(), PrintRoutingTable(), RemoveEntry(), and RouteInput().

Time ns3::olsr::RoutingProtocol::m_tcInterval
private

TC messages' emission interval.

Definition at line 154 of file olsr-routing-protocol.h.

Referenced by GetTypeId(), and TcTimerExpire().

Timer ns3::olsr::RoutingProtocol::m_tcTimer
private

Definition at line 222 of file olsr-routing-protocol.h.

Referenced by SetIpv4(), and TcTimerExpire().

TracedCallback<const PacketHeader &, const MessageList &> ns3::olsr::RoutingProtocol::m_txPacketTrace
private

Definition at line 311 of file olsr-routing-protocol.h.

Referenced by GetTypeId(), and SendPacket().

Ptr<UniformRandomVariable> ns3::olsr::RoutingProtocol::m_uniformRandomVariable
private

Provides uniform random variables.

Definition at line 315 of file olsr-routing-protocol.h.

Referenced by AssignStreams(), and RoutingProtocol().

uint8_t ns3::olsr::RoutingProtocol::m_willingness
private

Willingness for forwarding packets on behalf of other nodes.

Definition at line 160 of file olsr-routing-protocol.h.

Referenced by GetTypeId(), and SendHello().


The documentation for this class was generated from the following files: