#include <olsr-agent-impl.h>
Public Member Functions | |
AgentImpl () | |
virtual | ~AgentImpl () |
virtual void | SetNode (Ptr< Node > node) |
virtual void | Start () |
Starts the OLSR protocol operation. | |
virtual void | SetMainInterface (uint32_t interface) |
Sets the main interface to be used by OLSR. | |
virtual Ptr< const olsr::RoutingTable > | GetRoutingTable () const |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
This method returns the TypeId associated to ns3::olsr::AgentImpl. | |
Protected Member Functions | |
void | DoDispose () |
void | SendPacket (Ptr< Packet > packet, const MessageList &containedMessages) |
uint16_t | GetPacketSequenceNumber () |
Increments packet sequence number and returns the new value. | |
uint16_t | GetMessageSequenceNumber () |
Increments message sequence number and returns the new value. | |
void | RecvOlsr (Ptr< Socket > socket) |
void | MprComputation () |
Computates MPR set of a node following RFC 3626 hints. | |
void | RoutingTableComputation () |
Creates the routing table of the node following RFC 3626 hints. | |
Ipv4Address | GetMainAddress (Ipv4Address iface_addr) const |
Gets the main address associated with a given interface address. | |
void | HelloTimerExpire () |
Sends a HELLO message and reschedules the HELLO timer. | |
void | TcTimerExpire () |
Sends a TC message (if there exists any MPR selector) and reschedules the TC timer. | |
void | MidTimerExpire () |
Sends a MID message (if the node has more than one interface) and resets the MID timer. | |
void | DupTupleTimerExpire (Ipv4Address address, uint16_t sequenceNumber) |
Removes tuple if expired. Else timer is rescheduled to expire at tuple.expirationTime. | |
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(). | |
void | Nb2hopTupleTimerExpire (Ipv4Address neighborMainAddr, Ipv4Address twoHopNeighborAddr) |
Removes tuple_ if expired. Else the timer is rescheduled to expire at tuple_->time(). | |
void | MprSelTupleTimerExpire (Ipv4Address mainAddr) |
Removes tuple_ if expired. Else the timer is rescheduled to expire at tuple_->time(). | |
void | TopologyTupleTimerExpire (Ipv4Address destAddr, Ipv4Address lastAddr) |
Removes tuple_ if expired. Else the timer is rescheduled to expire at tuple_->time(). | |
void | IfaceAssocTupleTimerExpire (Ipv4Address ifaceAddr) |
Removes tuple_ if expired. Else timer is rescheduled to expire at tuple_->time(). | |
void | IncrementAnsn () |
void | ForwardDefault (olsr::MessageHeader olsrMessage, DuplicateTuple *duplicated, const Ipv4Address &localIface, const Ipv4Address &senderAddress) |
OLSR's default forwarding algorithm. | |
void | QueueMessage (const olsr::MessageHeader &message, Time delay) |
Enques an OLSR message which will be sent with a delay of (0, delay]. | |
void | SendQueuedMessages () |
Creates as many OLSR packets as needed in order to send all buffered OLSR messages. | |
void | SendHello () |
Creates a new OLSR HELLO message which is buffered for being sent later on. | |
void | SendTc () |
Creates a new OLSR TC 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 | NeighborLoss (const LinkTuple &tuple) |
Performs all actions needed when a neighbor loss occurs. | |
void | AddDuplicateTuple (const DuplicateTuple &tuple) |
Adds a duplicate tuple to the Duplicate Set. | |
void | RemoveDuplicateTuple (const DuplicateTuple &tuple) |
Removes a duplicate tuple from the Duplicate Set. | |
void | LinkTupleAdded (const LinkTuple &tuple, uint8_t willingness) |
void | RemoveLinkTuple (const LinkTuple &tuple) |
Removes a link tuple from the Link Set. | |
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. | |
void | AddNeighborTuple (const NeighborTuple &tuple) |
Adds a neighbor tuple to the Neighbor Set. | |
void | RemoveNeighborTuple (const NeighborTuple &tuple) |
Removes a neighbor tuple from the Neighbor Set. | |
void | AddTwoHopNeighborTuple (const TwoHopNeighborTuple &tuple) |
Adds a 2-hop neighbor tuple to the 2-hop Neighbor Set. | |
void | RemoveTwoHopNeighborTuple (const TwoHopNeighborTuple &tuple) |
Removes a 2-hop neighbor tuple from the 2-hop Neighbor Set. | |
void | AddMprSelectorTuple (const MprSelectorTuple &tuple) |
Adds an MPR selector tuple to the MPR Selector Set. | |
void | RemoveMprSelectorTuple (const MprSelectorTuple &tuple) |
Removes an MPR selector tuple from the MPR Selector Set. | |
void | AddTopologyTuple (const TopologyTuple &tuple) |
Adds a topology tuple to the Topology Set. | |
void | RemoveTopologyTuple (const TopologyTuple &tuple) |
Removes a topology tuple from the Topology Set. | |
void | AddIfaceAssocTuple (const IfaceAssocTuple &tuple) |
Adds an interface association tuple to the Interface Association Set. | |
void | RemoveIfaceAssocTuple (const IfaceAssocTuple &tuple) |
Removes an interface association tuple from the Interface Association Set. | |
void | ProcessHello (const olsr::MessageHeader &msg, const Ipv4Address &receiverIface, const Ipv4Address &senderIface) |
Processes a HELLO message following RFC 3626 specification. | |
void | ProcessTc (const olsr::MessageHeader &msg, const Ipv4Address &senderIface) |
Processes a TC message following RFC 3626 specification. | |
void | ProcessMid (const olsr::MessageHeader &msg, const Ipv4Address &senderIface) |
Processes a MID message following RFC 3626 specification. | |
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 | 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). | |
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). | |
int | Degree (NeighborTuple const &tuple) |
This auxiliary function (defined in RFC 3626) is used for calculating the MPR Set. | |
Protected Attributes | |
Timer | m_helloTimer |
Timer | m_tcTimer |
Timer | m_midTimer |
bool | m_linkTupleTimerFirstTime |
olsr::MessageList | m_queuedMessages |
A list of pending messages which are buffered awaiting for being sent. | |
Timer | m_queuedMessagesTimer |
Ipv4Address | m_mainAddress |
std::map< Ptr< Socket > , Ipv4Address > | m_socketAddresses |
TracedCallback< const PacketHeader &, const MessageList & > | m_rxPacketTrace |
TracedCallback< const PacketHeader &, const MessageList & > | m_txPacketTrace |
TracedCallback< uint32_t > | m_routingTableChanged |
Private Attributes | |
EventGarbageCollector | m_events |
Ipv4Address | m_routingAgentAddr |
Address of the routing agent. | |
uint16_t | m_packetSequenceNumber |
Packets sequence number counter. | |
uint16_t | m_messageSequenceNumber |
Messages sequence number counter. | |
uint16_t | m_ansn |
Advertised Neighbor Set sequence number. | |
Time | m_helloInterval |
HELLO messages' emission interval. | |
Time | m_tcInterval |
TC messages' emission interval. | |
Time | m_midInterval |
MID messages' emission interval. | |
uint8_t | m_willingness |
Willingness for forwarding packets on behalf of other nodes. | |
Ptr< RoutingTable > | m_routingTable |
Routing table. | |
OlsrState | m_state |
Internal state with all needed data structs. | |
Ptr< Ipv4 > | m_ipv4 |
Definition at line 49 of file olsr-agent-impl.h.
ns3::olsr::AgentImpl::AgentImpl | ( | ) |
Definition at line 184 of file olsr-agent-impl.cc.
ns3::olsr::AgentImpl::~AgentImpl | ( | ) | [virtual] |
Definition at line 191 of file olsr-agent-impl.cc.
void ns3::olsr::AgentImpl::AddDuplicateTuple | ( | const DuplicateTuple & | tuple | ) | [protected] |
Adds a duplicate tuple to the Duplicate Set.
tuple | the duplicate tuple to be added. |
Definition at line 1960 of file olsr-agent-impl.cc.
References m_state.
Referenced by ForwardDefault().
void ns3::olsr::AgentImpl::AddIfaceAssocTuple | ( | const IfaceAssocTuple & | tuple | ) | [protected] |
Adds an interface association tuple to the Interface Association Set.
tuple | the interface association tuple to be added. |
Definition at line 2227 of file olsr-agent-impl.cc.
References m_state.
Referenced by ProcessMid(), and Start().
void ns3::olsr::AgentImpl::AddMprSelectorTuple | ( | const MprSelectorTuple & | tuple | ) | [protected] |
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 2155 of file olsr-agent-impl.cc.
References IncrementAnsn(), and m_state.
Referenced by PopulateMprSelectorSet().
void ns3::olsr::AgentImpl::AddNeighborTuple | ( | const NeighborTuple & | tuple | ) | [protected] |
Adds a neighbor tuple to the Neighbor Set.
tuple | the neighbor tuple to be added. |
Definition at line 2077 of file olsr-agent-impl.cc.
References IncrementAnsn(), and m_state.
Referenced by LinkTupleAdded().
void ns3::olsr::AgentImpl::AddTopologyTuple | ( | const TopologyTuple & | tuple | ) | [protected] |
Adds a topology tuple to the Topology Set.
tuple | the topology tuple to be added. |
Definition at line 2191 of file olsr-agent-impl.cc.
References m_state.
Referenced by ProcessTc().
void ns3::olsr::AgentImpl::AddTwoHopNeighborTuple | ( | const TwoHopNeighborTuple & | tuple | ) | [protected] |
Adds a 2-hop neighbor tuple to the 2-hop Neighbor Set.
tuple | the 2-hop neighbor tuple to be added. |
Definition at line 2113 of file olsr-agent-impl.cc.
References m_state.
Referenced by PopulateTwoHopNeighborSet().
int ns3::olsr::AgentImpl::Degree | ( | NeighborTuple const & | tuple | ) | [protected] |
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 456 of file olsr-agent-impl.cc.
References m_state.
Referenced by MprComputation().
void ns3::olsr::AgentImpl::DoDispose | ( | void | ) | [protected, virtual] |
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.
Reimplemented from ns3::Object.
Definition at line 213 of file olsr-agent-impl.cc.
References m_ipv4, m_routingTable, and m_socketAddresses.
void ns3::olsr::AgentImpl::DupTupleTimerExpire | ( | Ipv4Address | address, | |
uint16_t | sequenceNumber | |||
) | [protected] |
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 2319 of file olsr-agent-impl.cc.
References DELAY, m_events, m_state, ns3::Simulator::Now(), RemoveDuplicateTuple(), ns3::Simulator::Schedule(), and ns3::EventGarbageCollector::Track().
Referenced by ForwardDefault().
void ns3::olsr::AgentImpl::ForwardDefault | ( | olsr::MessageHeader | olsrMessage, | |
DuplicateTuple * | duplicated, | |||
const Ipv4Address & | localIface, | |||
const Ipv4Address & | senderAddress | |||
) | [protected] |
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 1247 of file olsr-agent-impl.cc.
References AddDuplicateTuple(), DupTupleTimerExpire(), ns3::olsr::MessageHeader::GetHopCount(), GetMainAddress(), ns3::olsr::MessageHeader::GetMessageSequenceNumber(), ns3::olsr::MessageHeader::GetOriginatorAddress(), ns3::olsr::MessageHeader::GetTimeToLive(), JITTER, m_mainAddress, m_state, ns3::Simulator::Now(), ns3::Now(), NS_LOG_LOGIC, OLSR_DUP_HOLD_TIME, QueueMessage(), ns3::Simulator::Schedule(), ns3::olsr::MessageHeader::SetHopCount(), and ns3::olsr::MessageHeader::SetTimeToLive().
Referenced by RecvOlsr().
Ipv4Address ns3::olsr::AgentImpl::GetMainAddress | ( | Ipv4Address | iface_addr | ) | const [protected] |
Gets the main address associated with a given interface address.
iface_addr | the interface address. |
Definition at line 747 of file olsr-agent-impl.cc.
References m_state.
Referenced by ForwardDefault(), LinkTupleAdded(), LinkTupleUpdated(), NeighborLoss(), PopulateMprSelectorSet(), PopulateTwoHopNeighborSet(), ProcessMid(), RemoveLinkTuple(), RoutingTableComputation(), SendHello(), and Start().
uint16_t ns3::olsr::AgentImpl::GetMessageSequenceNumber | ( | ) | [inline, protected] |
Increments message sequence number and returns the new value.
Definition at line 2263 of file olsr-agent-impl.cc.
References m_messageSequenceNumber, and OLSR_MAX_SEQ_NUM.
Referenced by SendHello(), SendMid(), and SendTc().
uint16_t ns3::olsr::AgentImpl::GetPacketSequenceNumber | ( | ) | [inline, protected] |
Increments packet sequence number and returns the new value.
Definition at line 2256 of file olsr-agent-impl.cc.
References m_packetSequenceNumber, and OLSR_MAX_SEQ_NUM.
Referenced by SendPacket().
Ptr< const olsr::RoutingTable > ns3::olsr::AgentImpl::GetRoutingTable | ( | ) | const [virtual] |
Implements ns3::olsr::Agent.
Definition at line 2492 of file olsr-agent-impl.cc.
References m_routingTable.
TypeId ns3::olsr::AgentImpl::GetTypeId | ( | void | ) | [static] |
This method returns the TypeId associated to ns3::olsr::AgentImpl.
This object is accessible through the following paths with Config::Set and Config::Connect:
Attributes defined for this type:
TraceSources defined for this type:
Reimplemented from ns3::olsr::Agent.
Definition at line 148 of file olsr-agent-impl.cc.
References ns3::TypeId::AddAttribute(), ns3::TypeId::AddTraceSource(), m_helloInterval, m_midInterval, m_routingTableChanged, m_rxPacketTrace, m_tcInterval, m_txPacketTrace, m_willingness, ns3::MakeEnumAccessor(), ns3::MakeEnumChecker(), ns3::MakeTraceSourceAccessor(), OLSR_WILL_ALWAYS, OLSR_WILL_DEFAULT, OLSR_WILL_HIGH, OLSR_WILL_LOW, OLSR_WILL_NEVER, ns3::Seconds(), and ns3::TypeId::SetParent().
void ns3::olsr::AgentImpl::HelloTimerExpire | ( | ) | [protected] |
Sends a HELLO message and reschedules the HELLO timer.
e | The event which has expired. |
Definition at line 2275 of file olsr-agent-impl.cc.
References m_helloInterval, m_helloTimer, ns3::Timer::Schedule(), and SendHello().
void ns3::olsr::AgentImpl::IfaceAssocTupleTimerExpire | ( | Ipv4Address | ifaceAddr | ) | [protected] |
Removes tuple_ if expired. Else timer is rescheduled to expire at tuple_->time().
e | The event which has expired. |
Definition at line 2472 of file olsr-agent-impl.cc.
References DELAY, m_events, m_state, ns3::Simulator::Now(), RemoveIfaceAssocTuple(), ns3::Simulator::Schedule(), and ns3::EventGarbageCollector::Track().
Referenced by ProcessMid().
void ns3::olsr::AgentImpl::IncrementAnsn | ( | ) | [protected] |
Definition at line 2142 of file olsr-agent-impl.cc.
References m_ansn, and OLSR_MAX_SEQ_NUM.
Referenced by AddMprSelectorTuple(), AddNeighborTuple(), RemoveMprSelectorTuple(), and RemoveNeighborTuple().
void ns3::olsr::AgentImpl::LinkSensing | ( | const olsr::MessageHeader & | msg, | |
const olsr::MessageHeader::Hello & | hello, | |||
const Ipv4Address & | receiverIface, | |||
const Ipv4Address & | sender_iface | |||
) | [protected] |
Updates Link Set according to a new received HELLO message (following RFC 3626 specification). Neighbor Set is also updated if needed.
Definition at line 1579 of file olsr-agent-impl.cc.
References DELAY, ns3::TimeUnit< 1 >::GetSeconds(), ns3::olsr::MessageHeader::GetVTime(), ns3::olsr::MessageHeader::Hello::linkMessages, LinkTupleAdded(), LinkTupleTimerExpire(), LinkTupleUpdated(), m_events, m_mainAddress, m_state, ns3::Now(), NS_ASSERT, NS_FATAL_ERROR, NS_LOG_DEBUG, NS_LOG_LOGIC, OLSR_ASYM_LINK, OLSR_LOST_LINK, OLSR_MPR_NEIGH, OLSR_NEIGHB_HOLD_TIME, OLSR_NOT_NEIGH, OLSR_SYM_LINK, OLSR_SYM_NEIGH, OLSR_UNSPEC_LINK, ns3::Simulator::Schedule(), ns3::Seconds(), ns3::EventGarbageCollector::Track(), and ns3::olsr::MessageHeader::Hello::willingness.
Referenced by ProcessHello().
void ns3::olsr::AgentImpl::LinkTupleAdded | ( | const LinkTuple & | tuple, | |
uint8_t | willingness | |||
) | [protected] |
Definition at line 1987 of file olsr-agent-impl.cc.
References AddNeighborTuple(), GetMainAddress(), and ns3::Simulator::Now().
Referenced by LinkSensing(), and LinkTupleUpdated().
void ns3::olsr::AgentImpl::LinkTupleTimerExpire | ( | Ipv4Address | neighborIfaceAddr | ) | [protected] |
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 2351 of file olsr-agent-impl.cc.
References DELAY, m_events, m_linkTupleTimerFirstTime, m_state, NeighborLoss(), ns3::Now(), RemoveLinkTuple(), ns3::Simulator::Schedule(), and ns3::EventGarbageCollector::Track().
Referenced by LinkSensing().
void ns3::olsr::AgentImpl::LinkTupleUpdated | ( | const LinkTuple & | tuple, | |
uint8_t | willingness | |||
) | [protected] |
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 2030 of file olsr-agent-impl.cc.
References GetMainAddress(), LinkTupleAdded(), m_mainAddress, m_state, ns3::Simulator::Now(), NS_LOG_DEBUG, and NS_LOG_WARN.
Referenced by LinkSensing(), and NeighborLoss().
void ns3::olsr::AgentImpl::MidTimerExpire | ( | ) | [protected] |
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 2305 of file olsr-agent-impl.cc.
References m_midInterval, m_midTimer, ns3::Timer::Schedule(), and SendMid().
void ns3::olsr::AgentImpl::MprComputation | ( | ) | [protected] |
Computates MPR set of a node following RFC 3626 hints.
Definition at line 478 of file olsr-agent-impl.cc.
References Degree(), m_mainAddress, m_state, NS_LOG_DEBUG, NS_LOG_FUNCTION, OLSR_WILL_ALWAYS, and OLSR_WILL_NEVER.
Referenced by NeighborLoss(), and ProcessHello().
void ns3::olsr::AgentImpl::MprSelTupleTimerExpire | ( | Ipv4Address | mainAddr | ) | [protected] |
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 2420 of file olsr-agent-impl.cc.
References DELAY, m_events, m_state, ns3::Simulator::Now(), RemoveMprSelectorTuple(), ns3::Simulator::Schedule(), and ns3::EventGarbageCollector::Track().
Referenced by PopulateMprSelectorSet().
void ns3::olsr::AgentImpl::Nb2hopTupleTimerExpire | ( | Ipv4Address | neighborMainAddr, | |
Ipv4Address | twoHopNeighborAddr | |||
) | [protected] |
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 2392 of file olsr-agent-impl.cc.
References DELAY, m_events, m_state, ns3::Simulator::Now(), RemoveTwoHopNeighborTuple(), ns3::Simulator::Schedule(), and ns3::EventGarbageCollector::Track().
Referenced by PopulateTwoHopNeighborSet().
void ns3::olsr::AgentImpl::NeighborLoss | ( | const LinkTuple & | tuple | ) | [protected] |
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 1941 of file olsr-agent-impl.cc.
References GetMainAddress(), LinkTupleUpdated(), m_mainAddress, m_state, MprComputation(), ns3::Simulator::Now(), NS_LOG_DEBUG, OLSR_WILL_DEFAULT, and RoutingTableComputation().
Referenced by LinkTupleTimerExpire().
void ns3::olsr::AgentImpl::PopulateMprSelectorSet | ( | const olsr::MessageHeader & | msg, | |
const olsr::MessageHeader::Hello & | hello | |||
) | [protected] |
Updates the MPR Selector Set according to the information contained in a new received HELLO message (following RFC 3626).
Definition at line 1841 of file olsr-agent-impl.cc.
References AddMprSelectorTuple(), DELAY, GetMainAddress(), ns3::olsr::MessageHeader::GetOriginatorAddress(), ns3::olsr::MessageHeader::GetVTime(), ns3::olsr::MessageHeader::Hello::linkMessages, m_events, m_mainAddress, m_state, MprSelTupleTimerExpire(), ns3::Now(), NS_LOG_DEBUG, NS_LOG_FUNCTION, OLSR_MPR_NEIGH, ns3::Simulator::Schedule(), and ns3::EventGarbageCollector::Track().
Referenced by ProcessHello().
void ns3::olsr::AgentImpl::PopulateNeighborSet | ( | const olsr::MessageHeader & | msg, | |
const olsr::MessageHeader::Hello & | hello | |||
) | [protected] |
Updates the Neighbor Set according to the information contained in a new received HELLO message (following RFC 3626).
Definition at line 1714 of file olsr-agent-impl.cc.
References ns3::olsr::MessageHeader::GetOriginatorAddress(), m_state, and ns3::olsr::MessageHeader::Hello::willingness.
Referenced by ProcessHello().
void ns3::olsr::AgentImpl::PopulateTwoHopNeighborSet | ( | const olsr::MessageHeader & | msg, | |
const olsr::MessageHeader::Hello & | hello | |||
) | [protected] |
Updates the 2-hop Neighbor Set according to the information contained in a new received HELLO message (following RFC 3626).
Definition at line 1729 of file olsr-agent-impl.cc.
References AddTwoHopNeighborTuple(), DELAY, GetMainAddress(), ns3::olsr::MessageHeader::GetOriginatorAddress(), ns3::olsr::MessageHeader::GetVTime(), ns3::olsr::MessageHeader::Hello::linkMessages, m_events, m_mainAddress, m_routingAgentAddr, m_state, Nb2hopTupleTimerExpire(), ns3::Now(), NS_LOG_DEBUG, NS_LOG_LOGIC, OLSR_MPR_NEIGH, OLSR_NOT_NEIGH, OLSR_SYM_NEIGH, ns3::Simulator::Schedule(), and ns3::EventGarbageCollector::Track().
Referenced by ProcessHello().
void ns3::olsr::AgentImpl::ProcessHello | ( | const olsr::MessageHeader & | msg, | |
const Ipv4Address & | receiverIface, | |||
const Ipv4Address & | senderIface | |||
) | [protected] |
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 1009 of file olsr-agent-impl.cc.
References ns3::olsr::MessageHeader::GetHello(), LinkSensing(), m_mainAddress, m_state, MprComputation(), ns3::Simulator::Now(), NS_LOG_DEBUG, PopulateMprSelectorSet(), PopulateNeighborSet(), and PopulateTwoHopNeighborSet().
Referenced by RecvOlsr().
void ns3::olsr::AgentImpl::ProcessMid | ( | const olsr::MessageHeader & | msg, | |
const Ipv4Address & | senderIface | |||
) | [protected] |
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 1165 of file olsr-agent-impl.cc.
References AddIfaceAssocTuple(), DELAY, GetMainAddress(), ns3::olsr::MessageHeader::GetMid(), ns3::olsr::MessageHeader::GetOriginatorAddress(), ns3::olsr::MessageHeader::GetVTime(), IfaceAssocTupleTimerExpire(), ns3::olsr::MessageHeader::Mid::interfaceAddresses, m_mainAddress, m_state, ns3::Now(), NS_LOG_DEBUG, NS_LOG_LOGIC, and ns3::Simulator::Schedule().
Referenced by RecvOlsr().
void ns3::olsr::AgentImpl::ProcessTc | ( | const olsr::MessageHeader & | msg, | |
const Ipv4Address & | senderIface | |||
) | [protected] |
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 1070 of file olsr-agent-impl.cc.
References AddTopologyTuple(), ns3::olsr::MessageHeader::Tc::ansn, DELAY, ns3::olsr::MessageHeader::GetOriginatorAddress(), ns3::olsr::MessageHeader::GetTc(), ns3::olsr::MessageHeader::GetVTime(), m_events, m_mainAddress, m_state, ns3::olsr::MessageHeader::Tc::neighborAddresses, ns3::Simulator::Now(), ns3::Now(), NS_LOG_DEBUG, ns3::Simulator::Schedule(), TopologyTupleTimerExpire(), and ns3::EventGarbageCollector::Track().
Referenced by RecvOlsr().
void ns3::olsr::AgentImpl::QueueMessage | ( | const olsr::MessageHeader & | message, | |
Time | delay | |||
) | [protected] |
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 1322 of file olsr-agent-impl.cc.
References ns3::Timer::IsRunning(), m_queuedMessages, m_queuedMessagesTimer, ns3::Timer::Schedule(), and ns3::Timer::SetDelay().
Referenced by ForwardDefault(), SendHello(), SendMid(), and SendTc().
Definition at line 307 of file olsr-agent-impl.cc.
References ns3::InetSocketAddress::ConvertFrom(), ForwardDefault(), ns3::InetSocketAddress::GetIpv4(), ns3::olsr::MessageHeader::GetMessageSequenceNumber(), ns3::olsr::MessageHeader::GetMessageType(), ns3::olsr::MessageHeader::GetOriginatorAddress(), ns3::olsr::PacketHeader::GetPacketLength(), ns3::InetSocketAddress::GetPort(), ns3::olsr::MessageHeader::GetSerializedSize(), ns3::olsr::PacketHeader::GetSerializedSize(), ns3::olsr::MessageHeader::GetTimeToLive(), ns3::olsr::MessageHeader::HELLO_MESSAGE, m_mainAddress, m_rxPacketTrace, m_socketAddresses, m_state, ns3::olsr::MessageHeader::MID_MESSAGE, ns3::Simulator::Now(), NS_ASSERT, NS_LOG_DEBUG, OLSR_PORT_NUMBER, ProcessHello(), ProcessMid(), ProcessTc(), RoutingTableComputation(), and ns3::olsr::MessageHeader::TC_MESSAGE.
Referenced by Start().
void ns3::olsr::AgentImpl::RemoveDuplicateTuple | ( | const DuplicateTuple & | tuple | ) | [protected] |
Removes a duplicate tuple from the Duplicate Set.
tuple | the duplicate tuple to be removed. |
Definition at line 1976 of file olsr-agent-impl.cc.
References m_state.
Referenced by DupTupleTimerExpire().
void ns3::olsr::AgentImpl::RemoveIfaceAssocTuple | ( | const IfaceAssocTuple & | tuple | ) | [protected] |
Removes an interface association tuple from the Interface Association Set.
tuple | the interface association tuple to be removed. |
Definition at line 2244 of file olsr-agent-impl.cc.
References m_state.
Referenced by IfaceAssocTupleTimerExpire().
void ns3::olsr::AgentImpl::RemoveLinkTuple | ( | const LinkTuple & | tuple | ) | [protected] |
Removes a link tuple from the Link Set.
tuple | the link tuple to be removed. |
Definition at line 2012 of file olsr-agent-impl.cc.
References GetMainAddress(), m_mainAddress, m_state, ns3::Simulator::Now(), and NS_LOG_DEBUG.
Referenced by LinkTupleTimerExpire().
void ns3::olsr::AgentImpl::RemoveMprSelectorTuple | ( | const MprSelectorTuple & | tuple | ) | [protected] |
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 2174 of file olsr-agent-impl.cc.
References IncrementAnsn(), and m_state.
Referenced by MprSelTupleTimerExpire().
void ns3::olsr::AgentImpl::RemoveNeighborTuple | ( | const NeighborTuple & | tuple | ) | [protected] |
Removes a neighbor tuple from the Neighbor Set.
tuple | the neighbor tuple to be removed. |
Definition at line 2095 of file olsr-agent-impl.cc.
References IncrementAnsn(), and m_state.
void ns3::olsr::AgentImpl::RemoveTopologyTuple | ( | const TopologyTuple & | tuple | ) | [protected] |
Removes a topology tuple from the Topology Set.
tuple | the topology tuple to be removed. |
Definition at line 2209 of file olsr-agent-impl.cc.
References m_state.
Referenced by TopologyTupleTimerExpire().
void ns3::olsr::AgentImpl::RemoveTwoHopNeighborTuple | ( | const TwoHopNeighborTuple & | tuple | ) | [protected] |
Removes a 2-hop neighbor tuple from the 2-hop Neighbor Set.
tuple | the 2-hop neighbor tuple to be removed. |
Definition at line 2130 of file olsr-agent-impl.cc.
References m_state.
Referenced by Nb2hopTupleTimerExpire().
void ns3::olsr::AgentImpl::RoutingTableComputation | ( | ) | [protected] |
Creates the routing table of the node following RFC 3626 hints.
Definition at line 762 of file olsr-agent-impl.cc.
References ns3::olsr::RoutingTableEntry::distance, GetMainAddress(), ns3::olsr::RoutingTableEntry::interface, m_mainAddress, m_routingTable, m_routingTableChanged, m_state, ns3::olsr::RoutingTableEntry::nextAddr, ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_LOGIC, and OLSR_WILL_NEVER.
Referenced by NeighborLoss(), and RecvOlsr().
void ns3::olsr::AgentImpl::SendHello | ( | ) | [protected] |
Creates a new OLSR HELLO message which is buffered for being sent later on.
Definition at line 1398 of file olsr-agent-impl.cc.
References ns3::olsr::MessageHeader::GetHello(), GetMainAddress(), GetMessageSequenceNumber(), ns3::olsr::MessageHeader::GetSerializedSize(), JITTER, ns3::olsr::MessageHeader::Hello::LinkMessage::linkCode, ns3::olsr::MessageHeader::Hello::linkMessages, m_helloInterval, m_mainAddress, m_state, m_willingness, ns3::olsr::MessageHeader::Hello::LinkMessage::neighborInterfaceAddresses, ns3::Now(), NS_FATAL_ERROR, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_WARN, OLSR_ASYM_LINK, OLSR_LOST_LINK, OLSR_MPR_NEIGH, OLSR_NEIGHB_HOLD_TIME, OLSR_NOT_NEIGH, OLSR_SYM_LINK, OLSR_SYM_NEIGH, QueueMessage(), ns3::olsr::MessageHeader::SetHopCount(), ns3::olsr::MessageHeader::Hello::SetHTime(), ns3::olsr::MessageHeader::SetMessageSequenceNumber(), ns3::olsr::MessageHeader::SetOriginatorAddress(), ns3::olsr::MessageHeader::SetTimeToLive(), ns3::olsr::MessageHeader::SetVTime(), and ns3::olsr::MessageHeader::Hello::willingness.
Referenced by HelloTimerExpire().
void ns3::olsr::AgentImpl::SendMid | ( | ) | [protected] |
Creates a new OLSR MID message which is buffered for being sent later on.
Definition at line 1535 of file olsr-agent-impl.cc.
References GetMessageSequenceNumber(), ns3::olsr::MessageHeader::GetMid(), ns3::olsr::MessageHeader::Mid::interfaceAddresses, JITTER, m_ipv4, m_mainAddress, OLSR_MID_HOLD_TIME, QueueMessage(), ns3::olsr::MessageHeader::SetHopCount(), ns3::olsr::MessageHeader::SetMessageSequenceNumber(), ns3::olsr::MessageHeader::SetOriginatorAddress(), ns3::olsr::MessageHeader::SetTimeToLive(), and ns3::olsr::MessageHeader::SetVTime().
Referenced by MidTimerExpire().
void ns3::olsr::AgentImpl::SendPacket | ( | Ptr< Packet > | packet, | |
const MessageList & | containedMessages | |||
) | [protected] |
Definition at line 1333 of file olsr-agent-impl.cc.
References GetPacketSequenceNumber(), ns3::olsr::PacketHeader::GetSerializedSize(), m_mainAddress, m_socketAddresses, m_txPacketTrace, NS_LOG_DEBUG, ns3::olsr::PacketHeader::SetPacketLength(), and ns3::olsr::PacketHeader::SetPacketSequenceNumber().
Referenced by SendQueuedMessages().
void ns3::olsr::AgentImpl::SendQueuedMessages | ( | ) | [protected] |
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 1359 of file olsr-agent-impl.cc.
References m_mainAddress, m_queuedMessages, NS_LOG_DEBUG, OLSR_MAX_MSGS, and SendPacket().
Referenced by SetNode().
void ns3::olsr::AgentImpl::SendTc | ( | ) | [protected] |
Creates a new OLSR TC message which is buffered for being sent later on.
Definition at line 1509 of file olsr-agent-impl.cc.
References ns3::olsr::MessageHeader::Tc::ansn, GetMessageSequenceNumber(), ns3::olsr::MessageHeader::GetTc(), JITTER, m_ansn, m_mainAddress, m_state, ns3::olsr::MessageHeader::Tc::neighborAddresses, NS_LOG_FUNCTION, OLSR_TOP_HOLD_TIME, QueueMessage(), ns3::olsr::MessageHeader::SetHopCount(), ns3::olsr::MessageHeader::SetMessageSequenceNumber(), ns3::olsr::MessageHeader::SetOriginatorAddress(), ns3::olsr::MessageHeader::SetTimeToLive(), and ns3::olsr::MessageHeader::SetVTime().
Referenced by TcTimerExpire().
void ns3::olsr::AgentImpl::SetMainInterface | ( | uint32_t | interface | ) | [virtual] |
Sets the main interface to be used by OLSR.
Normally OLSR supports multiple interfaces, but the protocol requires the definition of a "main interface". This interface's IPv4 address provides the identity of the node, and all outgoing OLSR routing messages must have the main interface address, regardless of the actual interface used to transmit the packet. This method allows one to explicitly select an interface as the main interface. It must be called before the agent starts, but calling it is optional; if not called, the agent tries to guess and uses a suitable interface.
Implements ns3::olsr::Agent.
Definition at line 298 of file olsr-agent-impl.cc.
References m_ipv4, and m_mainAddress.
Implements ns3::olsr::Agent.
Definition at line 195 of file olsr-agent-impl.cc.
References HelloTimerExpire(), m_ansn, m_helloTimer, 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().
void ns3::olsr::AgentImpl::Start | ( | ) | [virtual] |
Starts the OLSR protocol operation.
Calling this method essentially bootstraps the OLSR protocol, and causes the agent to start broadcasting OLSR messages to neighbors, as well start listening to messages from neighbors.
Implements ns3::olsr::Agent.
Definition at line 233 of file olsr-agent-impl.cc.
References AddIfaceAssocTuple(), ns3::Socket::CreateSocket(), GetMainAddress(), ns3::UdpSocketFactory::GetTypeId(), HelloTimerExpire(), m_ipv4, m_mainAddress, m_routingTable, m_socketAddresses, ns3::MakeCallback(), MidTimerExpire(), NS_ASSERT, NS_FATAL_ERROR, NS_LOG_DEBUG, OLSR_PORT_NUMBER, RecvOlsr(), and TcTimerExpire().
void ns3::olsr::AgentImpl::TcTimerExpire | ( | ) | [protected] |
Sends a TC message (if there exists any MPR selector) and reschedules the TC timer.
e | The event which has expired. |
Definition at line 2286 of file olsr-agent-impl.cc.
References m_state, m_tcInterval, m_tcTimer, NS_LOG_DEBUG, ns3::Timer::Schedule(), and SendTc().
void ns3::olsr::AgentImpl::TopologyTupleTimerExpire | ( | Ipv4Address | destAddr, | |
Ipv4Address | lastAddr | |||
) | [protected] |
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 2447 of file olsr-agent-impl.cc.
References DELAY, m_events, m_state, ns3::Simulator::Now(), RemoveTopologyTuple(), ns3::Simulator::Schedule(), and ns3::EventGarbageCollector::Track().
Referenced by ProcessTc().
uint16_t ns3::olsr::AgentImpl::m_ansn [private] |
Advertised Neighbor Set sequence number.
Definition at line 74 of file olsr-agent-impl.h.
Referenced by IncrementAnsn(), SendTc(), and SetNode().
Definition at line 64 of file olsr-agent-impl.h.
Referenced by DupTupleTimerExpire(), IfaceAssocTupleTimerExpire(), LinkSensing(), LinkTupleTimerExpire(), MprSelTupleTimerExpire(), Nb2hopTupleTimerExpire(), PopulateMprSelectorSet(), PopulateTwoHopNeighborSet(), ProcessTc(), and TopologyTupleTimerExpire().
Time ns3::olsr::AgentImpl::m_helloInterval [private] |
HELLO messages' emission interval.
Definition at line 77 of file olsr-agent-impl.h.
Referenced by GetTypeId(), HelloTimerExpire(), and SendHello().
Timer ns3::olsr::AgentImpl::m_helloTimer [protected] |
Definition at line 109 of file olsr-agent-impl.h.
Referenced by HelloTimerExpire(), and SetNode().
Ptr<Ipv4> ns3::olsr::AgentImpl::m_ipv4 [private] |
Definition at line 90 of file olsr-agent-impl.h.
Referenced by DoDispose(), SendMid(), SetMainInterface(), SetNode(), and Start().
bool ns3::olsr::AgentImpl::m_linkTupleTimerFirstTime [protected] |
Definition at line 119 of file olsr-agent-impl.h.
Referenced by LinkTupleTimerExpire(), and SetNode().
Ipv4Address ns3::olsr::AgentImpl::m_mainAddress [protected] |
Definition at line 180 of file olsr-agent-impl.h.
Referenced by ForwardDefault(), LinkSensing(), LinkTupleUpdated(), MprComputation(), NeighborLoss(), PopulateMprSelectorSet(), PopulateTwoHopNeighborSet(), ProcessHello(), ProcessMid(), ProcessTc(), RecvOlsr(), RemoveLinkTuple(), RoutingTableComputation(), SendHello(), SendMid(), SendPacket(), SendQueuedMessages(), SendTc(), SetMainInterface(), and Start().
uint16_t ns3::olsr::AgentImpl::m_messageSequenceNumber [private] |
Messages sequence number counter.
Definition at line 72 of file olsr-agent-impl.h.
Referenced by GetMessageSequenceNumber(), and SetNode().
Time ns3::olsr::AgentImpl::m_midInterval [private] |
MID messages' emission interval.
Definition at line 81 of file olsr-agent-impl.h.
Referenced by GetTypeId(), and MidTimerExpire().
Timer ns3::olsr::AgentImpl::m_midTimer [protected] |
Definition at line 115 of file olsr-agent-impl.h.
Referenced by MidTimerExpire(), and SetNode().
uint16_t ns3::olsr::AgentImpl::m_packetSequenceNumber [private] |
Packets sequence number counter.
Definition at line 70 of file olsr-agent-impl.h.
Referenced by GetPacketSequenceNumber(), and SetNode().
A list of pending messages which are buffered awaiting for being sent.
Definition at line 129 of file olsr-agent-impl.h.
Referenced by QueueMessage(), and SendQueuedMessages().
Timer ns3::olsr::AgentImpl::m_queuedMessagesTimer [protected] |
Definition at line 130 of file olsr-agent-impl.h.
Referenced by QueueMessage(), and SetNode().
Address of the routing agent.
Definition at line 67 of file olsr-agent-impl.h.
Referenced by PopulateTwoHopNeighborSet().
Ptr<RoutingTable> ns3::olsr::AgentImpl::m_routingTable [private] |
Routing table.
Definition at line 86 of file olsr-agent-impl.h.
Referenced by DoDispose(), GetRoutingTable(), RoutingTableComputation(), and Start().
TracedCallback<uint32_t> ns3::olsr::AgentImpl::m_routingTableChanged [protected] |
Definition at line 191 of file olsr-agent-impl.h.
Referenced by GetTypeId(), and RoutingTableComputation().
TracedCallback<const PacketHeader &, const MessageList &> ns3::olsr::AgentImpl::m_rxPacketTrace [protected] |
Definition at line 188 of file olsr-agent-impl.h.
Referenced by GetTypeId(), and RecvOlsr().
std::map< Ptr<Socket>, Ipv4Address > ns3::olsr::AgentImpl::m_socketAddresses [protected] |
Definition at line 185 of file olsr-agent-impl.h.
Referenced by DoDispose(), RecvOlsr(), SendPacket(), and Start().
OlsrState ns3::olsr::AgentImpl::m_state [private] |
Internal state with all needed data structs.
Definition at line 88 of file olsr-agent-impl.h.
Referenced by AddDuplicateTuple(), AddIfaceAssocTuple(), AddMprSelectorTuple(), AddNeighborTuple(), AddTopologyTuple(), AddTwoHopNeighborTuple(), Degree(), DupTupleTimerExpire(), ForwardDefault(), GetMainAddress(), IfaceAssocTupleTimerExpire(), LinkSensing(), LinkTupleTimerExpire(), LinkTupleUpdated(), MprComputation(), MprSelTupleTimerExpire(), Nb2hopTupleTimerExpire(), NeighborLoss(), PopulateMprSelectorSet(), PopulateNeighborSet(), PopulateTwoHopNeighborSet(), ProcessHello(), ProcessMid(), ProcessTc(), RecvOlsr(), RemoveDuplicateTuple(), RemoveIfaceAssocTuple(), RemoveLinkTuple(), RemoveMprSelectorTuple(), RemoveNeighborTuple(), RemoveTopologyTuple(), RemoveTwoHopNeighborTuple(), RoutingTableComputation(), SendHello(), SendTc(), TcTimerExpire(), and TopologyTupleTimerExpire().
Time ns3::olsr::AgentImpl::m_tcInterval [private] |
TC messages' emission interval.
Definition at line 79 of file olsr-agent-impl.h.
Referenced by GetTypeId(), and TcTimerExpire().
Timer ns3::olsr::AgentImpl::m_tcTimer [protected] |
Definition at line 112 of file olsr-agent-impl.h.
Referenced by SetNode(), and TcTimerExpire().
TracedCallback<const PacketHeader &, const MessageList &> ns3::olsr::AgentImpl::m_txPacketTrace [protected] |
Definition at line 190 of file olsr-agent-impl.h.
Referenced by GetTypeId(), and SendPacket().
uint8_t ns3::olsr::AgentImpl::m_willingness [private] |
Willingness for forwarding packets on behalf of other nodes.
Definition at line 83 of file olsr-agent-impl.h.
Referenced by GetTypeId(), and SendHello().