OLSR routing protocol for IPv4. More...
#include <olsr-routing-protocol.h>
Public Member Functions | |
void | AddHostNetworkAssociation (Ipv4Address networkAddr, Ipv4Mask netmask) |
Inject Association to be sent in HNA message. More... | |
int64_t | AssignStreams (int64_t stream) |
void | Dump (void) |
std::set< uint32_t > | GetInterfaceExclusions () const |
std::vector< RoutingTableEntry > | GetRoutingTableEntries () const |
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::Ipv4RoutingProtocol | |
virtual void | SetRepository (Ptr< Repository > repo) |
Set cognitive radio repository. More... | |
Public Member Functions inherited from ns3::Object | |
void | AggregateObject (Ptr< Object > other) |
void | Dispose (void) |
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) |
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
SimpleRefCount (const SimpleRefCount &o) | |
uint32_t | GetReferenceCount (void) const |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
void | Ref (void) const |
void | Unref (void) const |
Public Member Functions inherited from ns3::ObjectBase | |
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) |
Static Public Member Functions inherited from ns3::Object | |
static TypeId | GetTypeId (void) |
Static Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
static void | Cleanup (void) |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId (void) |
Protected Member Functions | |
virtual void | DoInitialize (void) |
Protected Member Functions inherited from ns3::Object | |
Object (const Object &o) | |
virtual void | NotifyNewAggregate (void) |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
virtual void | NotifyConstructionCompleted (void) |
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. Else timer is rescheduled to expire at tuple_->time(). More... | |
void | Clear () |
Clears the routing table and frees the memory assigned to each one of its entries. | |
int | Degree (NeighborTuple const &tuple) |
This auxiliary function (defined in RFC 3626) is used for calculating the MPR Set. More... | |
void | DoDispose () |
void | DupTupleTimerExpire (Ipv4Address address, uint16_t sequenceNumber) |
Removes tuple if expired. Else timer is rescheduled to expire at tuple.expirationTime. 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. | |
uint16_t | GetPacketSequenceNumber () |
Increments packet sequence number and returns the new value. | |
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. | |
void | IfaceAssocTupleTimerExpire (Ipv4Address ifaceAddr) |
Removes tuple_ if expired. Else timer is rescheduled to expire at tuple_->time(). More... | |
void | IncrementAnsn () |
bool | IsMyOwnAddress (const Ipv4Address &a) const |
Check that address is one of my interfaces. | |
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). Neighbor Set is also updated if needed. | |
void | LinkTupleAdded (const LinkTuple &tuple, uint8_t willingness) |
void | LinkTupleTimerExpire (Ipv4Address neighborIfaceAddr) |
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(). More... | |
void | LinkTupleUpdated (const LinkTuple &tuple, uint8_t willingness) |
This function is invoked when a link tuple is updated. Its aim is to also update the corresponding neighbor tuple if it is needed. 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. | |
void | MprSelTupleTimerExpire (Ipv4Address mainAddr) |
Removes tuple_ if expired. Else the timer is rescheduled to expire at tuple_->time(). More... | |
void | Nb2hopTupleTimerExpire (Ipv4Address neighborMainAddr, Ipv4Address twoHopNeighborAddr) |
Removes tuple_ if expired. Else the timer is rescheduled to expire at tuple_->time(). 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). | |
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). | |
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). | |
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< 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. More... | |
void | RoutingTableComputation () |
Creates the routing table of the node following RFC 3626 hints. | |
void | SendHello () |
Creates a new OLSR HELLO message which is buffered for being sent later on. | |
void | SendHna () |
Creates a new OLSR HNA message which is buffered for being sent later on. | |
void | SendMid () |
Creates a new OLSR MID message which is buffered for being sent later on. | |
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. | |
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. Else the timer is rescheduled to expire at tuple_->time(). More... | |
bool | UsesNonOlsrOutgoingInterface (const Ipv4RoutingTableEntry &route) |
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. | |
Private Attributes | |
uint16_t | m_ansn |
Advertised Neighbor Set sequence number. | |
EventGarbageCollector | m_events |
Time | m_helloInterval |
HELLO messages' emission interval. | |
Timer | m_helloTimer |
Time | m_hnaInterval |
HNA messages' emission interval. | |
Ptr< Ipv4StaticRouting > | m_hnaRoutingTable |
Timer | m_hnaTimer |
std::set< uint32_t > | m_interfaceExclusions |
Ptr< Ipv4 > | m_ipv4 |
bool | m_linkTupleTimerFirstTime |
Ipv4Address | m_mainAddress |
uint16_t | m_messageSequenceNumber |
Messages sequence number counter. | |
Time | m_midInterval |
MID messages' emission interval. | |
Timer | m_midTimer |
uint16_t | m_packetSequenceNumber |
Packets sequence number counter. | |
olsr::MessageList | m_queuedMessages |
A list of pending messages which are buffered awaiting for being sent. | |
Timer | m_queuedMessagesTimer |
Ptr< Ipv4StaticRouting > | m_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. | |
std::map< Ipv4Address, RoutingTableEntry > | m_table |
Data structure for the routing table. | |
Time | m_tcInterval |
TC messages' emission interval. | |
Timer | m_tcTimer |
TracedCallback< const PacketHeader &, const MessageList & > | m_txPacketTrace |
Ptr< UniformRandomVariable > | m_uniformRandomVariable |
Provides uniform random variables. | |
uint8_t | m_willingness |
Willingness for forwarding packets on behalf of other nodes. | |
Friends | |
class | OlsrMprTestCase |
Additional Inherited Members | |
Public Types inherited from ns3::Ipv4RoutingProtocol | |
typedef Callback< void, Ptr < const Packet >, const Ipv4Header &, Socket::SocketErrno > | ErrorCallback |
typedef Callback< void, Ptr < const Packet >, const Ipv4Header &, uint32_t > | LocalDeliverCallback |
typedef Callback< void, Ptr < Ipv4MulticastRoute >, Ptr < const Packet >, const Ipv4Header & > | MulticastForwardCallback |
typedef Callback< void, Ptr < Ipv4Route >, Ptr< const Packet >, const Ipv4Header & > | UnicastForwardCallback |
OLSR routing protocol for IPv4.
ns3::olsr::RoutingProtocol is accessible through the following paths with Config::Set and Config::Connect:
Definition at line 78 of file olsr-routing-protocol.h.
|
private |
Adds a host network association tuple to the Association Set.
tuple | the host network association tuple to be added. |
Definition at line 2685 of file olsr-routing-protocol.cc.
References m_state.
Referenced by ProcessHna().
|
private |
Adds a duplicate tuple to the Duplicate Set.
tuple | the duplicate tuple to be added. |
Definition at line 2368 of file olsr-routing-protocol.cc.
References m_state.
Referenced by ForwardDefault().
|
private |
Adds a new entry into the routing table.
If an entry for the given destination existed, it is deleted and freed.
dest | address of the destination node. |
next | address of the next hop node. |
iface | address of the local interface. |
dist | distance to the destination node. |
Definition at line 3246 of file olsr-routing-protocol.cc.
References ns3::olsr::RoutingTableEntry::destAddr, ns3::olsr::RoutingTableEntry::distance, ns3::olsr::RoutingTableEntry::interface, m_table, ns3::olsr::RoutingTableEntry::nextAddr, NS_ASSERT, and NS_LOG_FUNCTION.
Referenced by RoutingTableComputation().
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 1882 of file olsr-routing-protocol.cc.
References m_state, and NS_LOG_INFO.
Referenced by SetRoutingTableAssociation().
|
private |
Adds an interface association tuple to the Interface Association Set.
tuple | the interface association tuple to be added. |
Definition at line 2651 of file olsr-routing-protocol.cc.
References m_state.
Referenced by DoInitialize(), and ProcessMid().
|
private |
Adds an MPR selector tuple to the MPR Selector Set.
Advertised Neighbor Sequence Number (ANSN) is also updated.
tuple | the MPR selector tuple to be added. |
Definition at line 2579 of file olsr-routing-protocol.cc.
References m_state.
Referenced by PopulateMprSelectorSet().
|
private |
Adds a neighbor tuple to the Neighbor Set.
tuple | the neighbor tuple to be added. |
Definition at line 2501 of file olsr-routing-protocol.cc.
References m_state.
|
private |
Adds a topology tuple to the Topology Set.
tuple | the topology tuple to be added. |
Definition at line 2615 of file olsr-routing-protocol.cc.
References m_state.
Referenced by ProcessTc().
|
private |
Adds a 2-hop neighbor tuple to the 2-hop Neighbor Set.
tuple | the 2-hop neighbor tuple to be added. |
Definition at line 2537 of file olsr-routing-protocol.cc.
References m_state.
Referenced by PopulateTwoHopNeighborSet().
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.
stream | first stream index to use |
Definition at line 3305 of file olsr-routing-protocol.cc.
References m_uniformRandomVariable, NS_LOG_FUNCTION, and ns3::RandomVariableStream::SetStream().
|
private |
Removes tuple_ if expired. Else timer is rescheduled to expire at tuple_->time().
e | The event which has expired. |
Definition at line 2957 of file olsr-routing-protocol.cc.
References ns3::olsr::AssociationTuple::expirationTime, m_state, ns3::Simulator::Now(), RemoveAssociationTuple(), ns3::Simulator::Schedule(), and ns3::EventGarbageCollector::Track().
Referenced by ProcessHna().
|
private |
This auxiliary function (defined in RFC 3626) is used for calculating the MPR Set.
tuple | the neighbor tuple which has the main address of the node we are going to calculate its degree to. |
Definition at line 515 of file olsr-routing-protocol.cc.
References m_state, ns3::olsr::NeighborTuple::neighborMainAddr, and ns3::olsr::TwoHopNeighborTuple::neighborMainAddr.
Referenced by MprComputation().
|
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 233 of file olsr-routing-protocol.cc.
References ns3::Object::DoDispose().
|
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 276 of file olsr-routing-protocol.cc.
References AddIfaceAssocTuple(), ns3::Socket::Bind(), ns3::Socket::BindToNetDevice(), ns3::Socket::CreateSocket(), GetMainAddress(), HelloTimerExpire(), HnaTimerExpire(), ns3::olsr::IfaceAssocTuple::ifaceAddr, ns3::olsr::IfaceAssocTuple::mainAddr, ns3::MakeCallback(), MidTimerExpire(), NS_ASSERT, NS_FATAL_ERROR, NS_LOG_DEBUG, ns3::Socket::SetAllowBroadcast(), ns3::Socket::SetRecvCallback(), and TcTimerExpire().
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 3328 of file olsr-routing-protocol.cc.
References m_state, m_table, ns3::Simulator::Now(), and NS_LOG_DEBUG.
|
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.
tuple | The tuple which has expired. |
Definition at line 2782 of file olsr-routing-protocol.cc.
References ns3::olsr::DuplicateTuple::expirationTime, m_state, ns3::Simulator::Now(), RemoveDuplicateTuple(), ns3::Simulator::Schedule(), and ns3::EventGarbageCollector::Track().
Referenced by ForwardDefault().
|
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.
entry | the routing table entry which indicates the destination node we are interested in. |
Definition at line 3033 of file olsr-routing-protocol.cc.
References ns3::olsr::RoutingTableEntry::destAddr, Lookup(), and ns3::olsr::RoutingTableEntry::nextAddr.
Referenced by RouteInput(), and RouteOutput().
|
private |
OLSR's default forwarding algorithm.
See RFC 3626 for details.
p | the OLSR packet which has been received. |
msg | the OLSR message which must be forwarded. |
dup_tuple | NULL if the message has never been considered for forwarding, or a duplicate tuple in other case. |
local_iface | the address of the interface where the message was received from. |
Definition at line 1506 of file olsr-routing-protocol.cc.
References AddDuplicateTuple(), ns3::olsr::DuplicateTuple::address, DupTupleTimerExpire(), ns3::olsr::DuplicateTuple::expirationTime, GetMainAddress(), ns3::olsr::DuplicateTuple::ifaceList, m_state, ns3::Simulator::Now(), NS_LOG_LOGIC, QueueMessage(), ns3::olsr::DuplicateTuple::retransmitted, ns3::Simulator::Schedule(), and ns3::olsr::DuplicateTuple::sequenceNumber.
|
private |
Gets the main address associated with a given interface address.
iface_addr | the interface address. |
Definition at line 861 of file olsr-routing-protocol.cc.
References m_state, and ns3::olsr::IfaceAssocTuple::mainAddr.
Referenced by DoInitialize(), ForwardDefault(), LinkTupleUpdated(), NeighborLoss(), PopulateMprSelectorSet(), PopulateTwoHopNeighborSet(), ProcessMid(), RemoveLinkTuple(), RoutingTableComputation(), and SendHello().
std::vector< RoutingTableEntry > ns3::olsr::RoutingProtocol::GetRoutingTableEntries | ( | ) | const |
Return the list of routing table entries discovered by OLSR
Definition at line 3293 of file olsr-routing-protocol.cc.
References m_table.
|
private |
Sends a HELLO message and reschedules the HELLO timer.
e | The event which has expired. |
Definition at line 2722 of file olsr-routing-protocol.cc.
References m_helloInterval, ns3::Timer::Schedule(), and SendHello().
Referenced by DoInitialize(), and SetIpv4().
|
private |
Removes tuple_ if expired. Else timer is rescheduled to expire at tuple_->time().
e | The event which has expired. |
Definition at line 2934 of file olsr-routing-protocol.cc.
References m_state, ns3::Simulator::Now(), RemoveIfaceAssocTuple(), ns3::Simulator::Schedule(), ns3::olsr::IfaceAssocTuple::time, and ns3::EventGarbageCollector::Track().
Referenced by ProcessMid().
|
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.
e | The event which has expired. |
Definition at line 2814 of file olsr-routing-protocol.cc.
References 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().
|
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.
tuple | the link tuple which has been updated. |
Definition at line 2438 of file olsr-routing-protocol.cc.
References GetMainAddress(), m_state, ns3::olsr::LinkTuple::neighborIfaceAddr, ns3::olsr::NeighborTuple::neighborMainAddr, ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_WARN, and ns3::olsr::LinkTuple::symTime.
Referenced by LinkSensing(), and NeighborLoss().
|
private |
Looks up an entry for the specified destination address.
dest | destination address. |
outEntry | output parameter to hold the routing entry result, if fuond |
Definition at line 3003 of file olsr-routing-protocol.cc.
References m_table.
Referenced by FindSendEntry(), RouteInput(), RouteOutput(), and RoutingTableComputation().
|
private |
Sends a MID message (if the node has more than one interface) and resets the MID timer.
e | The event which has expired. |
Definition at line 2751 of file olsr-routing-protocol.cc.
References m_midInterval, ns3::Timer::Schedule(), and SendMid().
Referenced by DoInitialize(), and SetIpv4().
|
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.
e | The event which has expired. |
Definition at line 2883 of file olsr-routing-protocol.cc.
References ns3::olsr::MprSelectorTuple::expirationTime, m_state, ns3::Simulator::Now(), RemoveMprSelectorTuple(), ns3::Simulator::Schedule(), and ns3::EventGarbageCollector::Track().
Referenced by PopulateMprSelectorSet().
|
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.
e | The event which has expired. |
Definition at line 2855 of file olsr-routing-protocol.cc.
References ns3::olsr::TwoHopNeighborTuple::expirationTime, m_state, ns3::Simulator::Now(), RemoveTwoHopNeighborTuple(), ns3::Simulator::Schedule(), and ns3::EventGarbageCollector::Track().
Referenced by PopulateTwoHopNeighborSet().
|
private |
Performs all actions needed when a neighbor loss occurs.
Neighbor Set, 2-hop Neighbor Set, MPR Set and MPR Selector Set are updated.
tuple | link tuple with the information of the link to the neighbor which has been lost. |
Definition at line 2349 of file olsr-routing-protocol.cc.
References GetMainAddress(), LinkTupleUpdated(), m_state, MprComputation(), ns3::olsr::LinkTuple::neighborIfaceAddr, ns3::Simulator::Now(), NS_LOG_DEBUG, and RoutingTableComputation().
Referenced by LinkTupleTimerExpire().
|
privatevirtual |
interface | the index of the interface we are being notified about |
address | a 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 3228 of file olsr-routing-protocol.cc.
|
privatevirtual |
interface | the 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 3225 of file olsr-routing-protocol.cc.
|
privatevirtual |
interface | the 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 3222 of file olsr-routing-protocol.cc.
|
privatevirtual |
interface | the index of the interface we are being notified about |
address | a 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 3231 of file olsr-routing-protocol.cc.
|
privatevirtual |
Print the Routing Table entries.
stream | the ostream the Routing table is printed to |
Implements ns3::Ipv4RoutingProtocol.
Definition at line 250 of file olsr-routing-protocol.cc.
References ns3::Names::FindName(), ns3::OutputStreamWrapper::GetStream(), and m_table.
|
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.
msg | the OLSR message which contains the HELLO message. |
receiver_iface | the address of the interface where the message was received from. |
sender_iface | the address of the interface where the message was sent from. |
Definition at line 1201 of file olsr-routing-protocol.cc.
References LinkSensing(), m_state, MprComputation(), ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_FUNCTION, PopulateMprSelectorSet(), PopulateNeighborSet(), and PopulateTwoHopNeighborSet().
|
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.
msg | the OLSR message which contains the HNA message. |
sender_iface | the address of the interface where the message was sent from. |
Definition at line 1438 of file olsr-routing-protocol.cc.
References AddAssociationTuple(), AssociationTupleTimerExpire(), ns3::olsr::AssociationTuple::expirationTime, ns3::olsr::AssociationTuple::gatewayAddr, m_state, ns3::olsr::AssociationTuple::netmask, ns3::olsr::AssociationTuple::networkAddr, ns3::Simulator::Now(), and ns3::Simulator::Schedule().
|
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.
msg | the OLSR message which contains the MID message. |
sender_iface | the address of the interface where the message was sent from. |
Definition at line 1359 of file olsr-routing-protocol.cc.
References AddIfaceAssocTuple(), GetMainAddress(), ns3::olsr::IfaceAssocTuple::ifaceAddr, IfaceAssocTupleTimerExpire(), m_state, ns3::olsr::IfaceAssocTuple::mainAddr, ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_LOGIC, ns3::Simulator::Schedule(), and ns3::olsr::IfaceAssocTuple::time.
|
private |
Processes a TC message following RFC 3626 specification.
The Topology Set is updated (if needed) with the information of the received TC message.
msg | the OLSR message which contains the TC message. |
sender_iface | the address of the interface where the message was sent from. |
Definition at line 1264 of file olsr-routing-protocol.cc.
References AddTopologyTuple(), ns3::olsr::TopologyTuple::destAddr, ns3::olsr::TopologyTuple::expirationTime, ns3::olsr::TopologyTuple::lastAddr, m_state, ns3::Simulator::Now(), NS_LOG_DEBUG, ns3::Simulator::Schedule(), ns3::olsr::TopologyTuple::sequenceNumber, TopologyTupleTimerExpire(), and ns3::EventGarbageCollector::Track().
|
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.
msg | the OLSR message which must be sent. |
delay | maximum delay the OLSR message is going to be buffered. |
Definition at line 1581 of file olsr-routing-protocol.cc.
References ns3::Timer::IsRunning(), m_queuedMessages, ns3::Timer::Schedule(), and ns3::Timer::SetDelay().
Referenced by ForwardDefault(), SendHello(), SendHna(), SendMid(), and SendTc().
|
private |
Removes a host network association tuple from the Association Set.
tuple | the host network association tuple to be removed. |
Definition at line 2696 of file olsr-routing-protocol.cc.
References m_state.
Referenced by AssociationTupleTimerExpire().
|
private |
Removes a duplicate tuple from the Duplicate Set.
tuple | the duplicate tuple to be removed. |
Definition at line 2384 of file olsr-routing-protocol.cc.
References m_state.
Referenced by DupTupleTimerExpire().
|
private |
Deletes the entry whose destination address is given.
dest | address of the destination node. |
Definition at line 2991 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 1908 of file olsr-routing-protocol.cc.
References m_state, and NS_LOG_INFO.
Referenced by SetRoutingTableAssociation().
|
private |
Removes an interface association tuple from the Interface Association Set.
tuple | the interface association tuple to be removed. |
Definition at line 2668 of file olsr-routing-protocol.cc.
References m_state.
Referenced by IfaceAssocTupleTimerExpire().
|
private |
Removes a link tuple from the Link Set.
tuple | the link tuple to be removed. |
Definition at line 2420 of file olsr-routing-protocol.cc.
References GetMainAddress(), m_state, ns3::olsr::LinkTuple::neighborIfaceAddr, ns3::Simulator::Now(), and NS_LOG_DEBUG.
Referenced by LinkTupleTimerExpire().
|
private |
Removes an MPR selector tuple from the MPR Selector Set.
Advertised Neighbor Sequence Number (ANSN) is also updated.
tuple | the MPR selector tuple to be removed. |
Definition at line 2598 of file olsr-routing-protocol.cc.
References m_state.
Referenced by MprSelTupleTimerExpire().
|
private |
Removes a neighbor tuple from the Neighbor Set.
tuple | the neighbor tuple to be removed. |
Definition at line 2519 of file olsr-routing-protocol.cc.
References m_state.
|
private |
Removes a topology tuple from the Topology Set.
tuple | the topology tuple to be removed. |
Definition at line 2633 of file olsr-routing-protocol.cc.
References m_state.
Referenced by TopologyTupleTimerExpire().
|
private |
Removes a 2-hop neighbor tuple from the 2-hop Neighbor Set.
tuple | the 2-hop neighbor tuple to be removed. |
Definition at line 2554 of file olsr-routing-protocol.cc.
References m_state.
Referenced by Nb2hopTupleTimerExpire().
|
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.
p | received packet |
header | input parameter used to form a search key for a route |
idev | Pointer to ingress network device |
ucb | Callback for the case in which the packet is to be forwarded as unicast |
mcb | Callback for the case in which the packet is to be forwarded as multicast |
lcb | Callback for the case in which the packet is to be locally delivered |
ecb | Callback to call if there is an error in forwarding |
Implements ns3::Ipv4RoutingProtocol.
Definition at line 3120 of file olsr-routing-protocol.cc.
References FindSendEntry(), ns3::Ipv4Header::GetDestination(), ns3::Node::GetId(), ns3::Ipv4Header::GetSource(), ns3::olsr::RoutingTableEntry::interface, IsMyOwnAddress(), Lookup(), 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().
|
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.
p | packet to be routed. Note that this method may modify the packet. Callers may also pass in a null pointer. |
header | input parameter (used to form key to search for the route) |
oif | Output interface Netdevice. May be zero, or may be bound via socket options to a particular output interface. |
sockerr | Output parameter; socket errno |
Implements ns3::Ipv4RoutingProtocol.
Definition at line 3046 of file olsr-routing-protocol.cc.
References FindSendEntry(), ns3::Ipv4Header::GetDestination(), ns3::Node::GetId(), ns3::olsr::RoutingTableEntry::interface, Lookup(), ns3::olsr::RoutingTableEntry::nextAddr, NS_ASSERT, NS_FATAL_ERROR, NS_LOG_DEBUG, and NS_LOG_FUNCTION.
|
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 1623 of file olsr-routing-protocol.cc.
References ns3::Packet::AddAtEnd(), ns3::Packet::AddHeader(), ns3::Packet::GetSize(), m_queuedMessages, and NS_LOG_DEBUG.
Referenced by SetIpv4().
ipv4 | the ipv4 object this routing protocol is being associated with |
Typically, invoked directly or indirectly from ns3::Ipv4::SetRoutingProtocol
Implements ns3::Ipv4RoutingProtocol.
Definition at line 211 of file olsr-routing-protocol.cc.
References HelloTimerExpire(), HnaTimerExpire(), m_ansn, m_messageSequenceNumber, m_packetSequenceNumber, MidTimerExpire(), NS_ASSERT, NS_LOG_DEBUG, SendQueuedMessages(), ns3::Timer::SetFunction(), and TcTimerExpire().
void ns3::olsr::RoutingProtocol::SetMainInterface | ( | uint32_t | interface | ) |
Set the OLSR main address to the first address on the indicated interface.
interface | IPv4 interface index |
Definition at line 348 of file olsr-routing-protocol.cc.
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.
routingTable | the Ipv4StaticRouting routing table to be associated. |
Definition at line 1925 of file olsr-routing-protocol.cc.
References AddHostNetworkAssociation(), ns3::Ipv4RoutingTableEntry::GetDestNetwork(), ns3::Ipv4RoutingTableEntry::GetDestNetworkMask(), m_state, NS_LOG_DEBUG, NS_LOG_INFO, RemoveHostNetworkAssociation(), and UsesNonOlsrOutgoingInterface().
|
private |
Sends a TC message (if there exists any MPR selector) and reschedules the TC timer.
e | The event which has expired. |
Definition at line 2733 of file olsr-routing-protocol.cc.
References m_state, m_tcInterval, NS_LOG_DEBUG, ns3::Timer::Schedule(), and SendTc().
Referenced by DoInitialize(), and SetIpv4().
|
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.
e | The event which has expired. |
Definition at line 2910 of file olsr-routing-protocol.cc.
References ns3::olsr::TopologyTuple::destAddr, ns3::olsr::TopologyTuple::expirationTime, ns3::olsr::TopologyTuple::lastAddr, m_state, ns3::Simulator::Now(), RemoveTopologyTuple(), ns3::Simulator::Schedule(), and ns3::EventGarbageCollector::Track().
Referenced by ProcessTc().