18#define NS_LOG_APPEND_CONTEXT \
19 if (GetObject<Node>()) \
21 std::clog << "[node " << GetObject<Node>()->GetId() << "] "; \
28#include "ns3/boolean.h"
30#include "ns3/inet-socket-address.h"
31#include "ns3/ipv4-header.h"
32#include "ns3/ipv4-packet-info-tag.h"
33#include "ns3/ipv4-route.h"
34#include "ns3/ipv4-routing-protocol.h"
35#include "ns3/ipv4-routing-table-entry.h"
38#include "ns3/simulator.h"
39#include "ns3/socket-factory.h"
40#include "ns3/trace-source-accessor.h"
41#include "ns3/udp-socket-factory.h"
42#include "ns3/uinteger.h"
56 (((time) < (Simulator::Now())) ? Seconds(0.000001) \
57 : (time - Simulator::Now() + Seconds(0.000001)))
64#define OLSR_REFRESH_INTERVAL m_helloInterval
69#define OLSR_NEIGHB_HOLD_TIME Time(3 * OLSR_REFRESH_INTERVAL)
71#define OLSR_TOP_HOLD_TIME Time(3 * m_tcInterval)
73#define OLSR_DUP_HOLD_TIME Seconds(30)
75#define OLSR_MID_HOLD_TIME Time(3 * m_midInterval)
77#define OLSR_HNA_HOLD_TIME Time(3 * m_hnaInterval)
82#define OLSR_MAXJITTER (m_helloInterval.GetSeconds() / 4)
84#define OLSR_MAX_SEQ_NUM 65535
86#define JITTER (Seconds(m_uniformRandomVariable->GetValue(0, OLSR_MAXJITTER)))
89#define OLSR_MAX_MSGS 64
126 return (os <<
"UNSPEC_LINK");
128 return (os <<
"ASYM_LINK");
130 return (os <<
"SYM_LINK");
132 return (os <<
"LOST_LINK");
134 return (os <<
"Unknown link type");
161 switch (neighborType)
164 return (os <<
"NOT_NEIGH");
166 return (os <<
"SYM_NEIGH");
168 return (os <<
"MPR_NEIGH");
170 return (os <<
"Unknown neighbor type");
185 TypeId(
"ns3::olsr::RoutingProtocol")
187 .SetGroupName(
"Olsr")
189 .AddAttribute(
"HelloInterval",
190 "HELLO messages emission interval.",
194 .AddAttribute(
"TcInterval",
195 "TC messages emission interval.",
199 .AddAttribute(
"MidInterval",
200 "MID messages emission interval. Normally it is equal to TcInterval.",
204 .AddAttribute(
"HnaInterval",
205 "HNA messages emission interval. Normally it is equal to TcInterval.",
209 .AddAttribute(
"Willingness",
210 "Willingness of a node to carry and forward traffic for other nodes.",
223 .AddTraceSource(
"Rx",
224 "Receive OLSR packet.",
226 "ns3::olsr::RoutingProtocol::PacketTxRxTracedCallback")
227 .AddTraceSource(
"Tx",
230 "ns3::olsr::RoutingProtocol::PacketTxRxTracedCallback")
231 .AddTraceSource(
"RoutingTableChanged",
232 "The OLSR routing table has changed.",
234 "ns3::olsr::RoutingProtocol::TableChangeTracedCallback");
294 iter->first->Close();
305 std::ostream* os = stream->GetStream();
307 std::ios oldState(
nullptr);
308 oldState.copyfmt(*os);
310 *os << std::resetiosflags(std::ios::adjustfield) << std::setiosflags(std::ios::left);
312 *os <<
"Node: " <<
m_ipv4->GetObject<
Node>()->GetId() <<
", Time: " <<
Now().
As(unit)
313 <<
", Local time: " <<
m_ipv4->GetObject<
Node>()->GetLocalTime().As(unit)
314 <<
", OLSR Routing table" << std::endl;
316 *os << std::setw(16) <<
"Destination";
317 *os << std::setw(16) <<
"NextHop";
318 *os << std::setw(16) <<
"Interface";
319 *os <<
"Distance" << std::endl;
323 std::ostringstream dest;
324 std::ostringstream nextHop;
326 nextHop << iter->second.nextAddr;
327 *os << std::setw(16) << dest.str();
328 *os << std::setw(16) << nextHop.str();
329 *os << std::setw(16);
336 *os << iter->second.interface;
338 *os << iter->second.distance << std::endl;
345 *os <<
"HNA Routing Table:" << std::endl;
350 *os <<
"HNA Routing Table: empty" << std::endl << std::endl;
353 (*os).copyfmt(oldState);
366 if (addr != loopback)
380 bool canRunOlsr =
false;
384 if (addr == loopback)
423 socket->SetAllowBroadcast(
true);
427 socket->BindToNetDevice(
m_ipv4->GetNetDevice(i));
428 if (socket->Bind(inetAddr))
432 socket->SetRecvPktInfo(
true);
468 receivedPacket = socket->RecvFrom(sourceAddress);
471 if (!receivedPacket->RemovePacketTag(interfaceInfo))
473 NS_ABORT_MSG(
"No incoming interface on OLSR message, aborting.");
488 int32_t interfaceForAddress =
m_ipv4->GetInterfaceForAddress(senderIfaceAddr);
489 if (interfaceForAddress != -1)
495 Ipv4Address receiverIfaceAddr =
m_ipv4->GetAddress(recvInterfaceIndex, 0).GetLocal();
498 <<
" to " << receiverIfaceAddr);
507 packet->RemoveHeader(olsrPacketHeader);
516 if (packet->RemoveHeader(messageHeader) == 0)
527 messages.push_back(messageHeader);
532 for (
auto messageIter = messages.begin(); messageIter != messages.end(); messageIter++)
547 bool do_forwarding =
true;
563 if (duplicated ==
nullptr)
569 <<
" OLSR node " <<
m_mainAddress <<
" received HELLO message of size "
571 ProcessHello(messageHeader, receiverIfaceAddr, senderIfaceAddr);
576 <<
" OLSR node " <<
m_mainAddress <<
" received TC message of size "
578 ProcessTc(messageHeader, senderIfaceAddr);
583 <<
" OLSR node " <<
m_mainAddress <<
" received MID message of size "
589 <<
" OLSR node " <<
m_mainAddress <<
" received HNA message of size "
596 <<
" not implemented");
601 NS_LOG_DEBUG(
"OLSR message is duplicated, not reading it.");
605 for (
auto it = duplicated->
ifaceList.begin(); it != duplicated->
ifaceList.end(); it++)
607 if (*it == receiverIfaceAddr)
609 do_forwarding =
false;
645 for (
auto it =
m_state.GetTwoHopNeighbors().begin(); it !=
m_state.GetTwoHopNeighbors().end();
653 if (nb_tuple ==
nullptr)
675 std::set<Ipv4Address> toRemove;
676 for (
auto twoHopNeigh = N2.begin(); twoHopNeigh != N2.end(); twoHopNeigh++)
678 if (twoHopNeigh->neighborMainAddr == neighborMainAddr)
680 toRemove.insert(twoHopNeigh->twoHopNeighborAddr);
684 for (
auto twoHopNeigh = N2.begin(); twoHopNeigh != N2.end();)
686 if (toRemove.find(twoHopNeigh->twoHopNeighborAddr) != toRemove.end())
688 twoHopNeigh = N2.erase(twoHopNeigh);
710 for (
auto neighbor =
m_state.GetNeighbors().begin(); neighbor !=
m_state.GetNeighbors().end();
715 N.push_back(*neighbor);
726 for (
auto twoHopNeigh =
m_state.GetTwoHopNeighbors().begin();
727 twoHopNeigh !=
m_state.GetTwoHopNeighbors().end();
740 for (
auto neigh = N.begin(); neigh != N.end(); neigh++)
742 if (neigh->neighborMainAddr == twoHopNeigh->neighborMainAddr)
756 for (
auto neigh = N.begin(); neigh != N.end(); neigh++)
758 if (neigh->neighborMainAddr == twoHopNeigh->twoHopNeighborAddr)
767 N2.push_back(*twoHopNeigh);
773 std::ostringstream os;
775 for (
auto iter = N2.begin(); iter != N2.end(); iter++)
779 os << iter->neighborMainAddr <<
"->" << iter->twoHopNeighborAddr;
780 if (next != N2.end())
792 for (
auto neighbor = N.begin(); neighbor != N.end(); neighbor++)
796 mprSet.insert(neighbor->neighborMainAddr);
799 CoverTwoHopNeighbors(neighbor->neighborMainAddr, N2);
808 std::set<Ipv4Address> coveredTwoHopNeighbors;
809 for (
auto twoHopNeigh = N2.begin(); twoHopNeigh != N2.end(); twoHopNeigh++)
813 for (
auto otherTwoHopNeigh = N2.begin(); otherTwoHopNeigh != N2.end(); otherTwoHopNeigh++)
815 if (otherTwoHopNeigh->twoHopNeighborAddr == twoHopNeigh->twoHopNeighborAddr &&
816 otherTwoHopNeigh->neighborMainAddr != twoHopNeigh->neighborMainAddr)
824 NS_LOG_LOGIC(
"Neighbor " << twoHopNeigh->neighborMainAddr
825 <<
" is the only that can reach 2-hop neigh. "
826 << twoHopNeigh->twoHopNeighborAddr <<
" => select as MPR.");
828 mprSet.insert(twoHopNeigh->neighborMainAddr);
831 for (
auto otherTwoHopNeigh = N2.begin(); otherTwoHopNeigh != N2.end();
834 if (otherTwoHopNeigh->neighborMainAddr == twoHopNeigh->neighborMainAddr)
836 coveredTwoHopNeighbors.insert(otherTwoHopNeigh->twoHopNeighborAddr);
842 for (
auto twoHopNeigh = N2.begin(); twoHopNeigh != N2.end();)
844 if (coveredTwoHopNeighbors.find(twoHopNeigh->twoHopNeighborAddr) !=
845 coveredTwoHopNeighbors.end())
850 NS_LOG_LOGIC(
"2-hop neigh. " << twoHopNeigh->twoHopNeighborAddr
851 <<
" is already covered by an MPR.");
852 twoHopNeigh = N2.erase(twoHopNeigh);
862 while (N2.begin() != N2.end())
866 std::ostringstream os;
868 for (
auto iter = N2.begin(); iter != N2.end(); iter++)
872 os << iter->neighborMainAddr <<
"->" << iter->twoHopNeighborAddr;
873 if (next != N2.end())
887 std::map<int, std::vector<const NeighborTuple*>> reachability;
889 for (
auto it = N.begin(); it != N.end(); it++)
893 for (
auto it2 = N2.begin(); it2 != N2.end(); it2++)
902 reachability[r].push_back(&nb_tuple);
915 for (
auto it = rs.begin(); it != rs.end(); it++)
922 for (
auto it2 = reachability[r].begin(); it2 != reachability[r].end(); it2++)
953 NS_LOG_LOGIC(N2.size() <<
" 2-hop neighbors left to cover!");
959 std::ostringstream os;
961 for (
auto iter = mprSet.begin(); iter != mprSet.end(); iter++)
966 if (next != mprSet.end())
984 if (tuple !=
nullptr)
998 <<
" : Node " <<
m_mainAddress <<
": RoutingTableComputation begin...");
1006 for (
auto it = neighborSet.begin(); it != neighborSet.end(); it++)
1009 NS_LOG_DEBUG(
"Looking at neighbor tuple: " << nb_tuple);
1012 bool nb_main_addr =
false;
1015 for (
auto it2 = linkSet.begin(); it2 != linkSet.end(); it2++)
1026 <<
" => adding routing table entry to neighbor");
1034 nb_main_addr =
true;
1056 if (!nb_main_addr && lt !=
nullptr)
1058 NS_LOG_LOGIC(
"no R_dest_addr is equal to the main address of the neighbor "
1059 "=> adding additional routing entry");
1071 for (
auto it = twoHopNeighbors.begin(); it != twoHopNeighbors.end(); it++)
1075 NS_LOG_LOGIC(
"Looking at two-hop neighbor tuple: " << nb2hop_tuple);
1080 NS_LOG_LOGIC(
"Two-hop neighbor tuple is also neighbor; skipped.");
1093 bool nb2hopOk =
false;
1094 for (
auto neighbor = neighborSet.begin(); neighbor != neighborSet.end(); neighbor++)
1105 NS_LOG_LOGIC(
"Two-hop neighbor tuple skipped: 2-hop neighbor "
1108 <<
", which was not found in the Neighbor Set.");
1127 NS_LOG_LOGIC(
"Adding routing entry for two-hop neighbor.");
1132 NS_LOG_LOGIC(
"NOT adding routing entry for two-hop neighbor ("
1148 for (
auto it = topology.begin(); it != topology.end(); it++)
1151 NS_LOG_LOGIC(
"Looking at topology tuple: " << topology_tuple);
1155 bool have_destAddrEntry =
Lookup(topology_tuple.
destAddr, destAddrEntry);
1156 bool have_lastAddrEntry =
Lookup(topology_tuple.
lastAddr, lastAddrEntry);
1157 if (!have_destAddrEntry && have_lastAddrEntry && lastAddrEntry.
distance == h)
1159 NS_LOG_LOGIC(
"Adding routing table entry based on the topology tuple.");
1178 NS_LOG_LOGIC(
"NOT adding routing table entry based on the topology tuple: "
1179 "have_destAddrEntry="
1180 << have_destAddrEntry <<
" have_lastAddrEntry=" << have_lastAddrEntry
1181 <<
" lastAddrEntry.distance=" << (
int)lastAddrEntry.
distance
1182 <<
" (h=" << h <<
")");
1198 for (
auto it = ifaceAssocSet.begin(); it != ifaceAssocSet.end(); it++)
1205 if (have_entry1 && !have_entry2)
1230 for (
auto it = associationSet.begin(); it != associationSet.end(); it++)
1237 bool goToNextAssociationTuple =
false;
1239 NS_LOG_DEBUG(
"Nb local associations: " << localHnaAssociations.size());
1240 for (
auto assocIterator = localHnaAssociations.begin();
1241 assocIterator != localHnaAssociations.end();
1244 const Association& localHnaAssoc = *assocIterator;
1248 NS_LOG_DEBUG(
"HNA association received from another GW is part of local HNA "
1249 "associations: no route added for network "
1251 goToNextAssociationTuple =
true;
1254 if (goToNextAssociationTuple)
1262 bool addRoute =
false;
1266 for (routeIndex = 0; routeIndex <
m_hnaRoutingTable->GetNRoutes(); routeIndex++)
1280 else if (gatewayEntryExists &&
1287 if (addRoute && gatewayEntryExists)
1310 LinkSensing(msg, hello, receiverIface, senderIface);
1312#ifdef NS3_LOG_ENABLE
1316 <<
" ** BEGIN dump Link Set for OLSR Node " <<
m_mainAddress);
1317 for (
auto link = links.begin(); link != links.end(); link++)
1325 <<
" ** BEGIN dump Neighbor Set for OLSR Node " <<
m_mainAddress);
1326 for (
auto neighbor = neighbors.begin(); neighbor != neighbors.end(); neighbor++)
1337#ifdef NS3_LOG_ENABLE
1341 <<
" ** BEGIN dump TwoHopNeighbor Set for OLSR Node " <<
m_mainAddress);
1342 for (
auto tuple = twoHopNeighbors.begin(); tuple != twoHopNeighbors.end(); tuple++)
1363 if (link_tuple ==
nullptr)
1375 if (topologyTuple !=
nullptr)
1398 if (topologyTuple !=
nullptr)
1426#ifdef NS3_LOG_ENABLE
1430 <<
" ** BEGIN dump TopologySet for OLSR Node " <<
m_mainAddress);
1431 for (
auto tuple = topology.begin(); tuple != topology.end(); tuple++)
1450 if (linkTuple ==
nullptr)
1453 <<
": the sender interface of this message is not in the "
1454 "symmetric 1-hop neighborhood of this node,"
1455 " the message MUST be discarded.");
1462 bool updated =
false;
1464 for (
auto tuple = ifaceAssoc.begin(); tuple != ifaceAssoc.end(); tuple++)
1469 tuple->time = now + msg.
GetVTime();
1493 for (
auto neighbor = neighbors.begin(); neighbor != neighbors.end(); neighbor++)
1495 neighbor->neighborMainAddr =
GetMainAddress(neighbor->neighborMainAddr);
1499 for (
auto twoHopNeighbor = twoHopNeighbors.begin(); twoHopNeighbor != twoHopNeighbors.end();
1502 twoHopNeighbor->neighborMainAddr =
GetMainAddress(twoHopNeighbor->neighborMainAddr);
1503 twoHopNeighbor->twoHopNeighborAddr =
GetMainAddress(twoHopNeighbor->twoHopNeighborAddr);
1517 if (link_tuple ==
nullptr)
1536 if (tuple !=
nullptr)
1576 if (linkTuple ==
nullptr)
1587 <<
" does not forward a message received"
1596 bool retransmitted =
false;
1601 if (mprselTuple !=
nullptr)
1608 retransmitted =
true;
1613 if (duplicated !=
nullptr)
1617 duplicated->
ifaceList.push_back(localIface);
1658 packet->AddHeader(header);
1676 int numMessages = 0;
1685 p->AddHeader(*message);
1686 packet->AddAtEnd(p);
1687 msglist.push_back(*message);
1698 if (packet->GetSize())
1724 std::vector<olsr::MessageHeader::Hello::LinkMessage>& linkMessages = hello.
linkMessages;
1727 for (
auto link_tuple = links.begin(); link_tuple != links.end(); link_tuple++)
1730 link_tuple->time >= now))
1739 if (link_tuple->symTime >= now)
1743 else if (link_tuple->asymTime >= now)
1756 <<
" to be MPR_NEIGH.");
1761 for (
auto nb_tuple =
m_state.GetNeighbors().begin();
1762 nb_tuple !=
m_state.GetNeighbors().end();
1765 if (nb_tuple->neighborMainAddr ==
GetMainAddress(link_tuple->neighborIfaceAddr))
1771 <<
" to be SYM_NEIGH.");
1779 <<
" to be NOT_NEIGH.");
1783 NS_FATAL_ERROR(
"There is a neighbor tuple with an unknown status!\n");
1798 linkMessage.
linkCode = (
static_cast<uint8_t
>(linkType) & 0x03) |
1799 ((
static_cast<uint8_t
>(neighborType) << 2) & 0x0f);
1802 std::vector<Ipv4Address> interfaces =
1803 m_state.FindNeighborInterfaces(link_tuple->neighborIfaceAddr);
1809 linkMessages.push_back(linkMessage);
1812 <<
int(linkMessages.size()) <<
" link messages)");
1832 for (
auto mprsel_tuple =
m_state.GetMprSelectors().begin();
1833 mprsel_tuple !=
m_state.GetMprSelectors().end();
1899 std::vector<olsr::MessageHeader::Hna::Association>& associations = hna.
associations;
1903 for (
auto it = localHnaAssociations.begin(); it != localHnaAssociations.end(); it++)
1906 associations.push_back(assoc);
1909 if (associations.empty())
1924 for (
auto assocIterator = localHnaAssociations.begin();
1925 assocIterator != localHnaAssociations.end();
1928 const Association& localHnaAssoc = *assocIterator;
1931 NS_LOG_INFO(
"HNA association for network " << networkAddr <<
"/" << netmask
1932 <<
" already exists.");
1937 NS_LOG_INFO(
"Adding HNA association for network " << networkAddr <<
"/" << netmask <<
".");
1944 NS_LOG_INFO(
"Removing HNA association for network " << networkAddr <<
"/" << netmask <<
".");
1955 NS_LOG_INFO(
"Removing HNA entries coming from the old routing table association.");
1974 NS_LOG_DEBUG(
"Nb local associations before adding some entries from"
1975 " the associated routing table: "
1976 <<
m_state.GetAssociations().size());
1990 NS_LOG_DEBUG(
"Nb local associations after having added some entries from "
1991 "the associated routing table: "
1992 <<
m_state.GetAssociations().size());
2011 bool updated =
false;
2012 bool created =
false;
2014 <<
": LinkSensing(receiverIface=" << receiverIface
2015 <<
", senderIface=" << senderIface <<
") BEGIN");
2019 if (link_tuple ==
nullptr)
2027 link_tuple = &
m_state.InsertLinkTuple(newLinkTuple);
2029 NS_LOG_LOGIC(
"Existing link tuple did not exist => creating new one");
2033 NS_LOG_LOGIC(
"Existing link tuple already exists => will update it");
2041 auto linkType =
LinkType(linkMessage->linkCode & 0x03);
2042 auto neighborType =
NeighborType((linkMessage->linkCode >> 2) & 0x03);
2044 NS_LOG_DEBUG(
"Looking at HELLO link messages with Link Type "
2045 << linkType <<
" and Neighbor Type " << neighborType);
2052 NS_LOG_LOGIC(
"HELLO link code is invalid => IGNORING");
2056 for (
auto neighIfaceAddr = linkMessage->neighborInterfaceAddresses.begin();
2057 neighIfaceAddr != linkMessage->neighborInterfaceAddresses.end();
2061 if (*neighIfaceAddr == receiverIface)
2071 NS_LOG_DEBUG(*link_tuple <<
": link is SYM or ASYM => should become SYM now"
2072 " (symTime being increased to "
2086 NS_LOG_DEBUG(
" \\-> *neighIfaceAddr (" << *neighIfaceAddr
2087 <<
" != receiverIface (" << receiverIface
2088 <<
") => IGNORING!");
2117 if (nb_tuple !=
nullptr)
2131 for (
auto link_tuple =
m_state.GetLinks().begin(); link_tuple !=
m_state.GetLinks().end();
2134 NS_LOG_LOGIC(
"Looking at link tuple: " << *link_tuple);
2138 "Link tuple ignored: "
2139 "GetMainAddress (link_tuple->neighborIfaceAddr) != msg.GetOriginatorAddress ()");
2141 << link_tuple->neighborIfaceAddr
2147 if (link_tuple->symTime < now)
2156 auto neighborType =
NeighborType((linkMessage->linkCode >> 2) & 0x3);
2158 "Looking at Link Message from HELLO message: neighborType=" << neighborType);
2160 for (
auto nb2hop_addr_iter = linkMessage->neighborInterfaceAddresses.begin();
2161 nb2hop_addr_iter != linkMessage->neighborInterfaceAddresses.end();
2165 NS_LOG_DEBUG(
"Looking at 2-hop neighbor address from HELLO message: "
2166 << *nb2hop_addr_iter <<
" (main address is " << nb2hop_addr <<
")");
2175 NS_LOG_LOGIC(
"Ignoring 2-hop neighbor (it is the node itself)");
2183 << (nb2hop_tuple ?
" (refreshing existing entry)" :
""));
2184 if (nb2hop_tuple ==
nullptr)
2211 "2-hop neighbor is NOT_NEIGH => deleting matching 2-hop neighbor state");
2216 NS_LOG_LOGIC(
"*** WARNING *** Ignoring link message (inside HELLO) with bad"
2217 " neighbor type value: "
2238 auto neighborType =
NeighborType(linkMessage->linkCode >> 2);
2241 NS_LOG_DEBUG(
"Processing a link message with neighbor type MPR_NEIGH");
2243 for (
auto nb_iface_addr = linkMessage->neighborInterfaceAddresses.begin();
2244 nb_iface_addr != linkMessage->neighborInterfaceAddresses.end();
2249 NS_LOG_DEBUG(
"Adding entry to mpr selector set for neighbor "
2255 if (existing_mprsel_tuple ==
nullptr)
2278 <<
m_state.PrintMprSelectorSet());
2293 struct hdr_ip* ih = HDR_IP (p);
2294 struct hdr_cmn* ch = HDR_CMN (p);
2296 debug(
"%f: Node %d MAC Layer detects a breakage on link to %d\n",
2298 OLSR::node_id (ra_addr ()),
2299 OLSR::node_id (ch->next_hop ()));
2301 if ((
uint32_t)ih->daddr () == IP_BROADCAST)
2303 drop (p, DROP_RTR_MAC_CALLBACK);
2307 OLSR_link_tuple* link_tuple = state_.find_link_tuple(ch->next_hop());
2312 nb_loss(link_tuple);
2314 drop(p, DROP_RTR_MAC_CALLBACK);
2339 m_state.InsertDuplicateTuple(tuple);
2350 m_state.EraseDuplicateTuple(tuple);
2377 <<
": OLSR Node " <<
m_mainAddress <<
" LinkTuple " << tuple <<
" REMOVED.");
2380 m_state.EraseLinkTuple(tuple);
2389 <<
": OLSR Node " <<
m_mainAddress <<
" LinkTuple " << tuple <<
" UPDATED.");
2393 if (nb_tuple ==
nullptr)
2399 if (nb_tuple !=
nullptr)
2401 int statusBefore = nb_tuple->
status;
2403 bool hasSymmetricLink =
false;
2406 for (
auto it = linkSet.begin(); it != linkSet.end(); it++)
2412 hasSymmetricLink =
true;
2417 if (hasSymmetricLink)
2420 NS_LOG_DEBUG(*nb_tuple <<
"->status = STATUS_SYM; changed:"
2421 <<
int(statusBefore != nb_tuple->
status));
2426 NS_LOG_DEBUG(*nb_tuple <<
"->status = STATUS_NOT_SYM; changed:"
2427 <<
int(statusBefore != nb_tuple->
status));
2432 NS_LOG_WARN(
"ERROR! Wanted to update a NeighborTuple but none was found!");
2445 m_state.InsertNeighborTuple(tuple);
2458 m_state.EraseNeighborTuple(tuple);
2471 m_state.InsertTwoHopNeighborTuple(tuple);
2483 m_state.EraseTwoHopNeighborTuple(tuple);
2500 m_state.InsertMprSelectorTuple(tuple);
2512 m_state.EraseMprSelectorTuple(tuple);
2526 m_state.InsertTopologyTuple(tuple);
2539 m_state.EraseTopologyTuple(tuple);
2551 m_state.InsertIfaceAssocTuple(tuple);
2563 m_state.EraseIfaceAssocTuple(tuple);
2569 m_state.InsertAssociationTuple(tuple);
2575 m_state.EraseAssociationTuple(tuple);
2602 if (!
m_state.GetMprSelectors().empty())
2608 NS_LOG_DEBUG(
"Not sending any TC, no one selected me as MPR.");
2623 if (!
m_state.GetAssociations().empty())
2629 NS_LOG_DEBUG(
"Not sending any HNA, no associations to advertise.");
2638 if (tuple ==
nullptr)
2663 if (tuple ==
nullptr)
2667 if (tuple->
time < now)
2671 else if (tuple->
symTime < now)
2685 neighborIfaceAddr));
2692 neighborIfaceAddr));
2701 tuple =
m_state.FindTwoHopNeighborTuple(neighborMainAddr, twoHopNeighborAddr);
2702 if (tuple ==
nullptr)
2716 twoHopNeighborAddr));
2724 if (tuple ==
nullptr)
2745 if (tuple ==
nullptr)
2767 if (tuple ==
nullptr)
2790 if (tuple ==
nullptr)
2832 outEntry = it->second;
2866 if (!foundSendEntry)
2871 if (oif &&
m_ipv4->GetInterfaceForDevice(oif) !=
static_cast<int>(interfaceIdx))
2878 <<
" Route interface " << interfaceIdx
2879 <<
" does not match requested output interface "
2880 <<
m_ipv4->GetInterfaceForDevice(oif));
2893 if (numOifAddresses == 1)
2895 ifAddr =
m_ipv4->GetAddress(interfaceIdx, 0);
2902 rtentry->SetSource(ifAddr.
GetLocal());
2903 rtentry->SetGateway(entry2.
nextAddr);
2904 rtentry->SetOutputDevice(
m_ipv4->GetNetDevice(interfaceIdx));
2909 NS_LOG_DEBUG(
"Found route to " << rtentry->GetDestination() <<
" via nh "
2910 << rtentry->GetGateway() <<
" with source addr "
2911 << rtentry->GetSource() <<
" and output dev "
2912 << rtentry->GetOutputDevice());
2922 NS_LOG_DEBUG(
"Found route to " << rtentry->GetDestination() <<
" via nh "
2923 << rtentry->GetGateway() <<
" with source addr "
2924 << rtentry->GetSource() <<
" and output dev "
2925 << rtentry->GetOutputDevice());
2962 if (
m_ipv4->IsDestinationAddress(dst, iif))
2967 lcb(p, header, iif);
2990 if (!foundSendEntry)
3004 if (numOifAddresses == 1)
3006 ifAddr =
m_ipv4->GetAddress(interfaceIdx, 0);
3013 rtentry->SetSource(ifAddr.
GetLocal());
3014 rtentry->SetGateway(entry2.
nextAddr);
3015 rtentry->SetOutputDevice(
m_ipv4->GetNetDevice(interfaceIdx));
3021 ucb(rtentry, p, header);
3026 NS_LOG_LOGIC(
"No dynamic route, check network routes");
3034#ifdef NS3_LOG_ENABLE
3037 <<
" --> NOT FOUND; ** Dumping routing table...");
3041 NS_LOG_DEBUG(
"dest=" << iter->first <<
" --> next=" << iter->second.nextAddr
3042 <<
" via interface " << iter->second.interface);
3108 if (
m_ipv4->GetAddress(i, j).GetLocal() == interfaceAddress)
3119std::vector<RoutingTableEntry>
3122 std::vector<RoutingTableEntry> retval;
3125 retval.push_back(iter->second);
3139 return m_state.GetMprSelectors();
3145 return m_state.GetNeighbors();
3151 return m_state.GetTwoHopNeighbors();
3157 return m_state.GetTopologySet();
3191#ifdef NS3_LOG_ENABLE
3195 for (
auto iter =
m_state.GetNeighbors().begin(); iter !=
m_state.GetNeighbors().end(); iter++)
3200 for (
auto iter =
m_state.GetTwoHopNeighbors().begin();
3201 iter !=
m_state.GetTwoHopNeighbors().end();
3204 if (now < iter->expirationTime)
3212 NS_LOG_DEBUG(
" dest=" << iter->first <<
" --> next=" << iter->second.nextAddr
3213 <<
" via interface " << iter->second.interface);
a polymophic address class
bool IsNull() const
Check for null implementation.
Hold variables of type enum.
Ipv4Address GetIpv4() const
static InetSocketAddress ConvertFrom(const Address &address)
Returns an InetSocketAddress which corresponds to the input Address.
Ipv4 addresses are stored in host order in this class.
Ipv4Address GetSubnetDirectedBroadcast(const Ipv4Mask &mask) const
Generate subnet-directed broadcast address corresponding to mask.
static Ipv4Address GetAny()
a class to store IPv4 address information on an interface
Ipv4Address GetLocal() const
Get the local address.
a class to represent an Ipv4 address mask
This class implements Linux struct pktinfo in order to deliver ancillary information to the socket in...
uint32_t GetRecvIf() const
Get the tag's receiving interface.
Abstract base class for IPv4 routing protocols.
Callback< void, Ptr< Ipv4MulticastRoute >, Ptr< const Packet >, const Ipv4Header & > MulticastForwardCallback
Callback for multicast packets to be forwarded.
Callback< void, Ptr< const Packet >, const Ipv4Header &, uint32_t > LocalDeliverCallback
Callback for packets to be locally delivered.
Callback< void, Ptr< Ipv4Route >, Ptr< const Packet >, const Ipv4Header & > UnicastForwardCallback
Callback for unicast packets to be forwarded.
Callback< void, Ptr< const Packet >, const Ipv4Header &, Socket::SocketErrno > ErrorCallback
Callback for routing errors (e.g., no route found)
A record of an IPv4 routing table entry for Ipv4GlobalRouting and Ipv4StaticRouting.
Ipv4Address GetDestNetwork() const
uint32_t GetInterface() const
Ipv4Mask GetDestNetworkMask() const
static std::string FindName(Ptr< Object > object)
Given a pointer to an object, look to see if that object has a name associated with it and,...
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
virtual void DoDispose()
Destructor implementation.
Smart pointer class similar to boost::intrusive_ptr.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static Time Now()
Return the current simulation virtual time.
static Ptr< Socket > CreateSocket(Ptr< Node > node, TypeId tid)
This method wraps the creation of sockets that is performed on a given node by a SocketFactory specif...
SocketErrno
Enumeration of the possible errors returned by a socket.
Simulation virtual time values and global simulation resolution.
TimeWithUnit As(const Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
bool IsStrictlyPositive() const
Exactly equivalent to t > 0.
Unit
The unit to use to interpret a number representing time.
AttributeValue implementation for Time.
A simple virtual Timer class.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
static TypeId GetTypeId()
Get the type ID.
This class encapsulates all data structures needed for maintaining internal state of an OLSR node.
void SendHna()
Creates a new OLSR HNA message which is buffered for being sent later on.
void RemoveHostNetworkAssociation(Ipv4Address networkAddr, Ipv4Mask netmask)
Removes the specified (networkAddr, netmask) tuple from the list of local HNA associations to be sent...
OlsrState m_state
Internal state with all needed data structs.
void AddTwoHopNeighborTuple(const TwoHopNeighborTuple &tuple)
Adds a 2-hop neighbor tuple to the 2-hop Neighbor Set.
Time m_hnaInterval
HNA messages' emission interval.
const MprSelectorSet & GetMprSelectors() const
Gets the MPR selectors.
void SendQueuedMessages()
Creates as many OLSR packets as needed in order to send all buffered OLSR messages.
uint16_t m_messageSequenceNumber
Messages sequence number counter.
const TwoHopNeighborSet & GetTwoHopNeighbors() const
Get the two hop neighbors.
olsr::MessageList m_queuedMessages
A list of pending messages which are buffered awaiting for being sent.
void RemoveLinkTuple(const LinkTuple &tuple)
Removes a link tuple from the Link Set.
void NotifyRemoveAddress(uint32_t interface, Ipv4InterfaceAddress address) override
void NotifyInterfaceUp(uint32_t interface) override
TracedCallback< uint32_t > m_routingTableChanged
Routing table changes callback.
void QueueMessage(const olsr::MessageHeader &message, Time delay)
Enqueues an OLSR message which will be sent with a delay of (0, delay].
void LinkTupleAdded(const LinkTuple &tuple, Willingness willingness)
Adds a link tuple.
void AddNeighborTuple(const NeighborTuple &tuple)
Adds a neighbor tuple to the Neighbor Set.
std::map< Ptr< Socket >, Ipv4InterfaceAddress > m_sendSockets
Container of sockets and the interfaces they are opened onto.
void LinkSensing(const olsr::MessageHeader &msg, const olsr::MessageHeader::Hello &hello, const Ipv4Address &receiverIface, const Ipv4Address &senderIface)
Updates Link Set according to a new received HELLO message (following RFC 3626 specification).
void SendPacket(Ptr< Packet > packet, const MessageList &containedMessages)
Send an OLSR message.
Timer m_tcTimer
Timer for the TC message.
void AddHostNetworkAssociation(Ipv4Address networkAddr, Ipv4Mask netmask)
Injects the specified (networkAddr, netmask) tuple in the list of local HNA associations to be sent b...
const NeighborSet & GetNeighbors() const
Get the one hop neighbors.
Ptr< Ipv4StaticRouting > m_hnaRoutingTable
Routing table for HNA routes.
void SendHello()
Creates a new OLSR HELLO message which is buffered for being sent later on.
void DoDispose() override
Destructor implementation.
bool IsMyOwnAddress(const Ipv4Address &a) const
Check that address is one of my interfaces.
bool FindSendEntry(const RoutingTableEntry &entry, RoutingTableEntry &outEntry) const
Finds the appropriate entry which must be used in order to forward a data packet to a next hop (given...
bool RouteInput(Ptr< const Packet > p, const Ipv4Header &header, Ptr< const NetDevice > idev, const UnicastForwardCallback &ucb, const MulticastForwardCallback &mcb, const LocalDeliverCallback &lcb, const ErrorCallback &ecb) override
Route an input packet (to be forwarded or locally delivered)
void LinkTupleTimerExpire(Ipv4Address neighborIfaceAddr)
Removes tuple_ if expired.
void MprSelTupleTimerExpire(Ipv4Address mainAddr)
Removes MPR selector tuple_ if expired.
void RemoveTopologyTuple(const TopologyTuple &tuple)
Removes a topology tuple to the Topology Set.
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...
void AddTopologyTuple(const TopologyTuple &tuple)
Adds a topology tuple to the Topology Set.
void ProcessTc(const olsr::MessageHeader &msg, const Ipv4Address &senderIface)
Processes a TC message following RFC 3626 specification.
void SetRoutingTableAssociation(Ptr< Ipv4StaticRouting > routingTable)
Associates the specified Ipv4StaticRouting routing table to the OLSR routing protocol.
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 (...
MprSet GetMprSet() const
Gets the MPR set.
Ipv4Address m_mainAddress
the node main address.
Ptr< UniformRandomVariable > m_uniformRandomVariable
Provides uniform random variables.
void Nb2hopTupleTimerExpire(Ipv4Address neighborMainAddr, Ipv4Address twoHopNeighborAddr)
Removes 2_hop neighbor tuple_ if expired.
void HelloTimerExpire()
Sends a HELLO message and reschedules the HELLO timer.
void AssociationTupleTimerExpire(Ipv4Address gatewayAddr, Ipv4Address networkAddr, Ipv4Mask netmask)
Removes association tuple_ if expired.
static const uint16_t OLSR_PORT_NUMBER
port number (698)
uint32_t GetSize() const
Returns the routing table size.
void SetMainInterface(uint32_t interface)
Set the OLSR main address to the first address on the indicated interface.
void RoutingTableComputation()
Creates the routing table of the node following RFC 3626 hints.
void SendMid()
Creates a new OLSR MID message which is buffered for being sent later on.
void AddEntry(const Ipv4Address &dest, const Ipv4Address &next, uint32_t interface, uint32_t distance)
Adds a new entry into the routing table.
void HnaTimerExpire()
Sends an HNA message (if the node has associated hosts/networks) and reschedules the HNA timer.
void AddIfaceAssocTuple(const IfaceAssocTuple &tuple)
Adds an interface association tuple to the Interface Association Set.
void RemoveDuplicateTuple(const DuplicateTuple &tuple)
Removes a duplicate tuple from the Duplicate Set.
const TopologySet & GetTopologySet() const
Gets the topology set.
void SendTc()
Creates a new OLSR TC message which is buffered for being sent later on.
void DupTupleTimerExpire(Ipv4Address address, uint16_t sequenceNumber)
Removes tuple if expired.
Ipv4Address GetMainAddress(Ipv4Address iface_addr) const
Gets the main address associated with a given interface address.
Timer m_midTimer
Timer for the MID message.
EventGarbageCollector m_events
Running events.
void SetIpv4(Ptr< Ipv4 > ipv4) override
bool Lookup(const Ipv4Address &dest, RoutingTableEntry &outEntry) const
Looks up an entry for the specified destination address.
void ProcessMid(const olsr::MessageHeader &msg, const Ipv4Address &senderIface)
Processes a MID message following RFC 3626 specification.
Ptr< const Ipv4StaticRouting > GetRoutingTableAssociation() const
Returns the internal HNA table.
Timer m_queuedMessagesTimer
timer for throttling outgoing messages
Willingness m_willingness
Willingness for forwarding packets on behalf of other nodes.
uint16_t m_ansn
Advertised Neighbor Set sequence number.
void RemoveIfaceAssocTuple(const IfaceAssocTuple &tuple)
Removed an interface association tuple to the Interface Association Set.
void NotifyInterfaceDown(uint32_t interface) override
void NotifyAddAddress(uint32_t interface, Ipv4InterfaceAddress address) override
Time m_midInterval
MID messages' emission interval.
void Clear()
Clears the routing table and frees the memory assigned to each one of its entries.
void TopologyTupleTimerExpire(Ipv4Address destAddr, Ipv4Address lastAddr)
Removes topology tuple_ if expired.
void MprComputation()
Computes MPR set of a node following RFC 3626 hints.
void ProcessHello(const olsr::MessageHeader &msg, const Ipv4Address &receiverIface, const Ipv4Address &senderIface)
Processes a HELLO message following RFC 3626 specification.
static TypeId GetTypeId()
Get the type ID.
std::map< Ipv4Address, RoutingTableEntry > m_table
Data structure for the routing table.
void RemoveEntry(const Ipv4Address &dest)
Deletes the entry whose destination address is given.
void PopulateNeighborSet(const olsr::MessageHeader &msg, const olsr::MessageHeader::Hello &hello)
Updates the Neighbor Set according to the information contained in a new received HELLO message (foll...
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
uint16_t m_packetSequenceNumber
Packets sequence number counter.
Timer m_helloTimer
Timer for the HELLO message.
void PrintRoutingTable(Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S) const override
Print the Routing Table entries.
~RoutingProtocol() override
int Degree(const NeighborTuple &tuple)
This auxiliary function (defined in RFC 3626) is used for calculating the MPR Set.
void RemoveMprSelectorTuple(const MprSelectorTuple &tuple)
Removes an MPR selector tuple from the MPR Selector Set.
void ProcessHna(const olsr::MessageHeader &msg, const Ipv4Address &senderIface)
Processes a HNA message following RFC 3626 specification.
Ptr< Socket > m_recvSocket
Receiving socket.
uint16_t GetPacketSequenceNumber()
Increments packet sequence number and returns the new value.
void DoInitialize() override
Initialize() implementation.
TracedCallback< const PacketHeader &, const MessageList & > m_txPacketTrace
Tx packet trace.
void IncrementAnsn()
Increments the ANSN counter.
Ptr< Ipv4Route > RouteOutput(Ptr< Packet > p, const Ipv4Header &header, Ptr< NetDevice > oif, Socket::SocketErrno &sockerr) override
Query routing cache for an existing route, for an outbound packet.
void SetInterfaceExclusions(std::set< uint32_t > exceptions)
Set the interfaces to be excluded.
void ForwardDefault(olsr::MessageHeader olsrMessage, DuplicateTuple *duplicated, const Ipv4Address &localIface, const Ipv4Address &senderAddress)
OLSR's default forwarding algorithm.
Time m_helloInterval
HELLO messages' emission interval.
Timer m_hnaTimer
Timer for the HNA message.
std::vector< RoutingTableEntry > GetRoutingTableEntries() const
Get the routing table entries.
void LinkTupleUpdated(const LinkTuple &tuple, Willingness willingness)
This function is invoked when a link tuple is updated.
void AddAssociationTuple(const AssociationTuple &tuple)
Adds a host network association tuple to the Association Set.
void AddDuplicateTuple(const DuplicateTuple &tuple)
Adds a duplicate tuple to the Duplicate Set.
void TcTimerExpire()
Sends a TC message (if there exists any MPR selector) and reschedules the TC timer.
TracedCallback< const PacketHeader &, const MessageList & > m_rxPacketTrace
Rx packet trace.
void Dump()
Dump the neighbor table, two-hop neighbor table, and routing table to logging output (NS_LOG_DEBUG lo...
void MidTimerExpire()
Sends a MID message (if the node has more than one interface) and resets the MID timer.
void RemoveTwoHopNeighborTuple(const TwoHopNeighborTuple &tuple)
Removes a 2-hop neighbor tuple from the 2-hop Neighbor Set.
void RemoveAssociationTuple(const AssociationTuple &tuple)
Removes a host network association tuple to the Association Set.
Time m_tcInterval
TC messages' emission interval.
bool UsesNonOlsrOutgoingInterface(const Ipv4RoutingTableEntry &route)
Tests whether or not the specified route uses a non-OLSR outgoing interface.
Ptr< Ipv4StaticRouting > m_routingTableAssociation
Associations from an Ipv4StaticRouting instance.
bool m_linkTupleTimerFirstTime
Flag to indicate if it is the first time the LinkTupleTimer fires.
const OlsrState & GetOlsrState() const
Gets the underlying OLSR state object.
uint16_t GetMessageSequenceNumber()
Increments message sequence number and returns the new value.
void RemoveNeighborTuple(const NeighborTuple &tuple)
Removes a neighbor tuple from the Neighbor Set.
void IfaceAssocTupleTimerExpire(Ipv4Address ifaceAddr)
Removes interface association tuple_ if expired.
void RecvOlsr(Ptr< Socket > socket)
Receive an OLSR message.
std::set< uint32_t > m_interfaceExclusions
Set of interfaces excluded by OSLR.
void NeighborLoss(const LinkTuple &tuple)
Performs all actions needed when a neighbor loss occurs.
Ptr< Ipv4 > m_ipv4
IPv4 object the routing is linked to.
void AddMprSelectorTuple(const MprSelectorTuple &tuple)
Adds an MPR selector tuple to the MPR Selector Set.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Ptr< const AttributeAccessor > MakeEnumAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeChecker > MakeTimeChecker()
Helper to make an unbounded Time checker.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
NeighborType
OLSR neighbor types.
Willingness
Willingness for forwarding packets from other nodes.
@ UNSPEC_LINK
Unspecified link type.
@ LOST_LINK
Lost link type.
@ ASYM_LINK
Asymmetric link type.
@ SYM_LINK
Symmetric link type.
@ SYM_NEIGH
Symmetric neighbor type.
@ NOT_NEIGH
Not neighbor type.
@ MPR_NEIGH
Asymmetric neighbor type.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Time Now()
create an ns3::Time instance which contains the current simulation time.
Time Seconds(double value)
Construct a Time in the indicated unit.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
void CoverTwoHopNeighbors(Ipv4Address neighborMainAddr, TwoHopNeighborSet &N2)
Remove all covered 2-hop neighbors from N2 set.
std::ostream & operator<<(std::ostream &os, const PacketHeader &packet)
std::vector< MprSelectorTuple > MprSelectorSet
MPR Selector Set type.
std::vector< AssociationTuple > AssociationSet
Association Set type.
std::vector< TwoHopNeighborTuple > TwoHopNeighborSet
2-hop Neighbor Set type.
std::vector< LinkTuple > LinkSet
Link Set type.
std::vector< Association > Associations
Association Set type.
std::vector< TopologyTuple > TopologySet
Topology Set type.
std::set< Ipv4Address > MprSet
MPR Set type.
std::vector< NeighborTuple > NeighborSet
Neighbor Set type.
std::vector< MessageHeader > MessageList
std::vector< IfaceAssocTuple > IfaceAssocSet
Interface Association Set type.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Ptr< const AttributeChecker > MakeEnumChecker(T v, std::string n, Ts... args)
Make an EnumChecker pre-configured with a set of allowed values by name.
#define JITTER
Random number between [0-OLSR_MAXJITTER] used to jitter OLSR packet transmission.
#define OLSR_HNA_HOLD_TIME
HNA holding time.
#define OLSR_NEIGHB_HOLD_TIME
Neighbor holding time.
#define OLSR_MAX_SEQ_NUM
Maximum allowed sequence number.
#define OLSR_TOP_HOLD_TIME
Top holding time.
#define OLSR_MID_HOLD_TIME
MID holding time.
#define OLSR_DUP_HOLD_TIME
Dup holding time.
#define OLSR_MAX_MSGS
Maximum number of messages per packet.
#define DELAY(time)
Gets the delay between a given time and the current time.
Ipv4Address networkAddr
IPv4 Network address.
Ipv4Mask netmask
IPv4 Network mask.
Ipv4Address networkAddr
Network Address of network reachable through gatewayAddr.
Ipv4Mask netmask
Netmask of network reachable through gatewayAddr.
Time expirationTime
Time at which this tuple expires and must be removed.
Ipv4Address gatewayAddr
Main address of the gateway.
std::vector< Ipv4Address > ifaceList
List of interfaces which the message has been received on.
Ipv4Address address
Originator address of the message.
uint16_t sequenceNumber
Message sequence number.
bool retransmitted
Indicates whether the message has been retransmitted or not.
Time expirationTime
Time at which this tuple expires and must be removed.
An Interface Association Tuple.
Ipv4Address ifaceAddr
Interface address of a node.
Time time
Time at which this tuple expires and must be removed.
Ipv4Address mainAddr
Main address of the node.
Time time
Time at which this tuple expires and must be removed.
Ipv4Address localIfaceAddr
Interface address of the local node.
Time asymTime
The link is considered unidirectional until this time.
Time symTime
The link is considered bidirectional until this time.
Ipv4Address neighborIfaceAddr
Interface address of the neighbor node.
Ipv4Address mainAddr
Main address of a node which have selected this node as a MPR.
Time expirationTime
Time at which this tuple expires and must be removed.
Ipv4Address neighborMainAddr
Main address of a neighbor node.
Willingness willingness
A value between 0 and 7 specifying the node's willingness to carry traffic on behalf of other nodes.
Status status
Status of the link.
An OLSR's routing table entry.
uint32_t distance
Distance in hops to the destination.
Ipv4Address nextAddr
Address of the next hop.
uint32_t interface
Interface index.
Ipv4Address destAddr
Address of the destination node.
Ipv4Address destAddr
Main address of the destination.
Ipv4Address lastAddr
Main address of a node which is a neighbor of the destination.
uint16_t sequenceNumber
Sequence number.
Time expirationTime
Time at which this tuple expires and must be removed.
Ipv4Address twoHopNeighborAddr
Main address of a 2-hop neighbor with a symmetric link to nb_main_addr.
Ipv4Address neighborMainAddr
Main address of a neighbor.
Time expirationTime
Time at which this tuple expires and must be removed.