|
22 |
|
22 |
|
23 |
|
23 |
|
24 |
/// |
24 |
/// |
25 |
/// \file OLSR.cc |
25 |
/// \brief Implementation of OLSR agent and related classes. |
26 |
/// \brief Implementation of OLSR agent and related classes. |
|
|
27 |
/// |
26 |
/// |
28 |
/// This is the main file of this software because %OLSR's behaviour is |
27 |
/// This is the main file of this software because %OLSR's behaviour is |
29 |
/// implemented here. |
28 |
/// implemented here. |
|
499 |
receiverIfaceAddr, inetSourceAddr.GetIpv4 ()); |
498 |
receiverIfaceAddr, inetSourceAddr.GetIpv4 ()); |
500 |
} |
499 |
} |
501 |
} |
500 |
} |
502 |
|
|
|
503 |
} |
501 |
} |
504 |
|
502 |
|
505 |
// After processing all OLSR messages, we must recompute the routing table |
503 |
// After processing all OLSR messages, we must recompute the routing table |
|
573 |
// MPR computation should be done for each interface. See section 8.3.1 |
571 |
// MPR computation should be done for each interface. See section 8.3.1 |
574 |
// (RFC 3626) for details. |
572 |
// (RFC 3626) for details. |
575 |
MprSet mprSet; |
573 |
MprSet mprSet; |
576 |
|
|
|
577 |
|
574 |
|
578 |
// N is the subset of neighbors of the node, which are |
575 |
// N is the subset of neighbors of the node, which are |
579 |
// neighbor "of the interface I" |
576 |
// neighbor "of the interface I" |
|
586 |
N.push_back (*neighbor); |
583 |
N.push_back (*neighbor); |
587 |
} |
584 |
} |
588 |
} |
585 |
} |
589 |
|
586 |
|
590 |
// N2 is the set of 2-hop neighbors reachable from "the interface |
587 |
// N2 is the set of 2-hop neighbors reachable from "the interface |
591 |
// I", excluding: |
588 |
// I", excluding: |
592 |
// (i) the nodes only reachable by members of N with willingness WILL_NEVER |
589 |
// (i) the nodes only reachable by members of N with willingness WILL_NEVER |
|
681 |
|
678 |
|
682 |
// 2. Calculate D(y), where y is a member of N, for all nodes in N. |
679 |
// 2. Calculate D(y), where y is a member of N, for all nodes in N. |
683 |
// (we do this later) |
680 |
// (we do this later) |
684 |
|
681 |
|
685 |
// 3. Add to the MPR set those nodes in N, which are the *only* |
682 |
// 3. Add to the MPR set those nodes in N, which are the *only* |
686 |
// nodes to provide reachability to a node in N2. |
683 |
// nodes to provide reachability to a node in N2. |
687 |
std::set<Ipv4Address> coveredTwoHopNeighbors; |
684 |
std::set<Ipv4Address> coveredTwoHopNeighbors; |
|
734 |
twoHopNeigh++; |
731 |
twoHopNeigh++; |
735 |
} |
732 |
} |
736 |
} |
733 |
} |
737 |
|
734 |
|
738 |
// 4. While there exist nodes in N2 which are not covered by at |
735 |
// 4. While there exist nodes in N2 which are not covered by at |
739 |
// least one node in the MPR set: |
736 |
// least one node in the MPR set: |
740 |
while (N2.begin () != N2.end ()) |
737 |
while (N2.begin () != N2.end ()) |
|
882 |
|
879 |
|
883 |
// 1. All the entries from the routing table are removed. |
880 |
// 1. All the entries from the routing table are removed. |
884 |
Clear (); |
881 |
Clear (); |
885 |
|
882 |
|
886 |
// 2. The new routing entries are added starting with the |
883 |
// 2. The new routing entries are added starting with the |
887 |
// symmetric neighbors (h=1) as the destination nodes. |
884 |
// symmetric neighbors (h=1) as the destination nodes. |
888 |
const NeighborSet &neighborSet = m_state.GetNeighbors (); |
885 |
const NeighborSet &neighborSet = m_state.GetNeighbors (); |
|
1080 |
|
1077 |
|
1081 |
// 4. For each entry in the multiple interface association base |
1078 |
// 4. For each entry in the multiple interface association base |
1082 |
// where there exists a routing entry such that: |
1079 |
// where there exists a routing entry such that: |
1083 |
// R_dest_addr == I_main_addr (of the multiple interface association entry) |
1080 |
// R_dest_addr == I_main_addr (of the multiple interface association entry) |
1084 |
// AND there is no routing entry such that: |
1081 |
// AND there is no routing entry such that: |
1085 |
// R_dest_addr == I_iface_addr |
1082 |
// R_dest_addr == I_iface_addr |
1086 |
const IfaceAssocSet &ifaceAssocSet = m_state.GetIfaceAssocSet (); |
1083 |
const IfaceAssocSet &ifaceAssocSet = m_state.GetIfaceAssocSet (); |
1087 |
for (IfaceAssocSet::const_iterator it = ifaceAssocSet.begin (); |
1084 |
for (IfaceAssocSet::const_iterator it = ifaceAssocSet.begin (); |
1088 |
it != ifaceAssocSet.end (); it++) |
1085 |
it != ifaceAssocSet.end (); it++) |
|
1268 |
{ |
1265 |
{ |
1269 |
const olsr::MessageHeader::Tc &tc = msg.GetTc (); |
1266 |
const olsr::MessageHeader::Tc &tc = msg.GetTc (); |
1270 |
Time now = Simulator::Now (); |
1267 |
Time now = Simulator::Now (); |
1271 |
|
1268 |
|
1272 |
// 1. If the sender interface of this message is not in the symmetric |
1269 |
// 1. If the sender interface of this message is not in the symmetric |
1273 |
// 1-hop neighborhood of this node, the message MUST be discarded. |
1270 |
// 1-hop neighborhood of this node, the message MUST be discarded. |
1274 |
const LinkTuple *link_tuple = m_state.FindSymLinkTuple (senderIface, now); |
1271 |
const LinkTuple *link_tuple = m_state.FindSymLinkTuple (senderIface, now); |
1275 |
if (link_tuple == NULL) |
1272 |
if (link_tuple == NULL) |
1276 |
return; |
1273 |
return; |
1277 |
|
1274 |
|
1278 |
// 2. If there exist some tuple in the topology set where: |
1275 |
// 2. If there exist some tuple in the topology set where: |
1279 |
// T_last_addr == originator address AND |
1276 |
// T_last_addr == originator address AND |
1280 |
// T_seq > ANSN, |
1277 |
// T_seq > ANSN, |
|
1284 |
m_state.FindNewerTopologyTuple (msg.GetOriginatorAddress (), tc.ansn); |
1281 |
m_state.FindNewerTopologyTuple (msg.GetOriginatorAddress (), tc.ansn); |
1285 |
if (topologyTuple != NULL) |
1282 |
if (topologyTuple != NULL) |
1286 |
return; |
1283 |
return; |
1287 |
|
1284 |
|
1288 |
// 3. All tuples in the topology set where: |
1285 |
// 3. All tuples in the topology set where: |
1289 |
// T_last_addr == originator address AND |
1286 |
// T_last_addr == originator address AND |
1290 |
// T_seq < ANSN |
1287 |
// T_seq < ANSN |
1291 |
// MUST be removed from the topology set. |
1288 |
// MUST be removed from the topology set. |
1292 |
m_state.EraseOlderTopologyTuples (msg.GetOriginatorAddress (), tc.ansn); |
1289 |
m_state.EraseOlderTopologyTuples (msg.GetOriginatorAddress (), tc.ansn); |
1293 |
|
1290 |
|
|
1298 |
{ |
1295 |
{ |
1299 |
const Ipv4Address &addr = *i; |
1296 |
const Ipv4Address &addr = *i; |
1300 |
// 4.1. If there exist some tuple in the topology set where: |
1297 |
// 4.1. If there exist some tuple in the topology set where: |
1301 |
// T_dest_addr == advertised neighbor main address, AND |
1298 |
// T_dest_addr == advertised neighbor main address, AND |
1302 |
// T_last_addr == originator address, |
1299 |
// T_last_addr == originator address, |
1303 |
// then the holding time of that tuple MUST be set to: |
1300 |
// then the holding time of that tuple MUST be set to: |
1304 |
// T_time = current time + validity time. |
1301 |
// T_time = current time + validity time. |
1305 |
TopologyTuple *topologyTuple = |
1302 |
TopologyTuple *topologyTuple = |
1306 |
m_state.FindTopologyTuple (addr, msg.GetOriginatorAddress ()); |
1303 |
m_state.FindTopologyTuple (addr, msg.GetOriginatorAddress ()); |
1307 |
|
1304 |
|
|
1313 |
{ |
1310 |
{ |
1314 |
// 4.2. Otherwise, a new tuple MUST be recorded in the topology |
1311 |
// 4.2. Otherwise, a new tuple MUST be recorded in the topology |
1315 |
// set where: |
1312 |
// set where: |
1316 |
// T_dest_addr = advertised neighbor main address, |
1313 |
// T_dest_addr = advertised neighbor main address, |
1317 |
// T_last_addr = originator address, |
1314 |
// T_last_addr = originator address, |
1318 |
// T_seq = ANSN, |
1315 |
// T_seq = ANSN, |
1319 |
// T_time = current time + validity time. |
1316 |
// T_time = current time + validity time. |
1320 |
TopologyTuple topologyTuple;; |
1317 |
TopologyTuple topologyTuple;; |
1321 |
topologyTuple.destAddr = addr; |
1318 |
topologyTuple.destAddr = addr; |
1322 |
topologyTuple.lastAddr = msg.GetOriginatorAddress (); |
1319 |
topologyTuple.lastAddr = msg.GetOriginatorAddress (); |
|
1376 |
" the message MUST be discarded."); |
1373 |
" the message MUST be discarded."); |
1377 |
return; |
1374 |
return; |
1378 |
} |
1375 |
} |
1379 |
|
1376 |
|
1380 |
// 2. For each interface address listed in the MID message |
1377 |
// 2. For each interface address listed in the MID message |
1381 |
for (std::vector<Ipv4Address>::const_iterator i = mid.interfaceAddresses.begin (); |
1378 |
for (std::vector<Ipv4Address>::const_iterator i = mid.interfaceAddresses.begin (); |
1382 |
i != mid.interfaceAddresses.end (); i++) |
1379 |
i != mid.interfaceAddresses.end (); i++) |
|
1526 |
" from " << olsrMessage.GetOriginatorAddress () << " because it is duplicated"); |
1523 |
" from " << olsrMessage.GetOriginatorAddress () << " because it is duplicated"); |
1527 |
return; |
1524 |
return; |
1528 |
} |
1525 |
} |
1529 |
|
1526 |
|
1530 |
// If the sender interface address is an interface address |
1527 |
// If the sender interface address is an interface address |
1531 |
// of a MPR selector of this node and ttl is greater than 1, |
1528 |
// of a MPR selector of this node and ttl is greater than 1, |
1532 |
// the message must be retransmitted |
1529 |
// the message must be retransmitted |
|
1545 |
retransmitted = true; |
1542 |
retransmitted = true; |
1546 |
} |
1543 |
} |
1547 |
} |
1544 |
} |
1548 |
|
1545 |
|
1549 |
// Update duplicate tuple... |
1546 |
// Update duplicate tuple... |
1550 |
if (duplicated != NULL) |
1547 |
if (duplicated != NULL) |
1551 |
{ |
1548 |
{ |
|
1680 |
|
1677 |
|
1681 |
std::vector<olsr::MessageHeader::Hello::LinkMessage> |
1678 |
std::vector<olsr::MessageHeader::Hello::LinkMessage> |
1682 |
&linkMessages = hello.linkMessages; |
1679 |
&linkMessages = hello.linkMessages; |
1683 |
|
1680 |
|
1684 |
const LinkSet &links = m_state.GetLinks (); |
1681 |
const LinkSet &links = m_state.GetLinks (); |
1685 |
for (LinkSet::const_iterator link_tuple = links.begin (); |
1682 |
for (LinkSet::const_iterator link_tuple = links.begin (); |
1686 |
link_tuple != links.end (); link_tuple++) |
1683 |
link_tuple != links.end (); link_tuple++) |
|
1921 |
/// in HNA messages sent by the node. |
1918 |
/// in HNA messages sent by the node. |
1922 |
/// If this method is called more than once, entries from the old |
1919 |
/// If this method is called more than once, entries from the old |
1923 |
/// association are deleted before entries from the new one are added. |
1920 |
/// association are deleted before entries from the new one are added. |
1924 |
/// \param the Ipv4StaticRouting routing table to be associated. |
1921 |
/// \param routingTable the Ipv4StaticRouting routing table to be associated. |
1925 |
/// |
1922 |
/// |
1926 |
void |
1923 |
void |
1927 |
RoutingProtocol::SetRoutingTableAssociation (Ptr<Ipv4StaticRouting> routingTable) |
1924 |
RoutingProtocol::SetRoutingTableAssociation (Ptr<Ipv4StaticRouting> routingTable) |
|
1983 |
} |
1980 |
} |
1984 |
|
1981 |
|
1985 |
/// |
1982 |
/// |
1986 |
/// \brief Updates Link Set according to a new received HELLO message (following RFC 3626 |
1983 |
/// \brief Updates Link Set according to a new received HELLO message |
1987 |
/// specification). Neighbor Set is also updated if needed. |
1984 |
/// (following RFC 3626 specification). Neighbor Set is also updated if needed. |
1988 |
void |
1985 |
void |
1989 |
RoutingProtocol::LinkSensing (const olsr::MessageHeader &msg, |
1986 |
RoutingProtocol::LinkSensing (const olsr::MessageHeader &msg, |
1990 |
const olsr::MessageHeader::Hello &hello, |
1987 |
const olsr::MessageHeader::Hello &hello, |
|
1997 |
NS_LOG_DEBUG ("@" << now.GetSeconds () << ": Olsr node " << m_mainAddress |
1994 |
NS_LOG_DEBUG ("@" << now.GetSeconds () << ": Olsr node " << m_mainAddress |
1998 |
<< ": LinkSensing(receiverIface=" << receiverIface |
1995 |
<< ": LinkSensing(receiverIface=" << receiverIface |
1999 |
<< ", senderIface=" << senderIface << ") BEGIN"); |
1996 |
<< ", senderIface=" << senderIface << ") BEGIN"); |
2000 |
|
1997 |
|
2001 |
NS_ASSERT (msg.GetVTime () > Seconds (0)); |
1998 |
NS_ASSERT (msg.GetVTime () > Seconds (0)); |
2002 |
LinkTuple *link_tuple = m_state.FindLinkTuple (senderIface); |
1999 |
LinkTuple *link_tuple = m_state.FindLinkTuple (senderIface); |
2003 |
if (link_tuple == NULL) |
2000 |
if (link_tuple == NULL) |
|
2017 |
NS_LOG_LOGIC ("Existing link tuple already exists => will update it"); |
2014 |
NS_LOG_LOGIC ("Existing link tuple already exists => will update it"); |
2018 |
updated = true; |
2015 |
updated = true; |
2019 |
} |
2016 |
} |
2020 |
|
2017 |
|
2021 |
link_tuple->asymTime = now + msg.GetVTime (); |
2018 |
link_tuple->asymTime = now + msg.GetVTime (); |
2022 |
for (std::vector<olsr::MessageHeader::Hello::LinkMessage>::const_iterator linkMessage = |
2019 |
for (std::vector<olsr::MessageHeader::Hello::LinkMessage>::const_iterator linkMessage = |
2023 |
hello.linkMessages.begin (); |
2020 |
hello.linkMessages.begin (); |
|
2118 |
} |
2115 |
} |
2119 |
|
2116 |
|
2120 |
/// |
2117 |
/// |
2121 |
/// \brief Updates the Neighbor Set according to the information contained in a new received |
2118 |
/// \brief Updates the Neighbor Set according to the information contained in |
2122 |
/// HELLO message (following RFC 3626). |
2119 |
/// a new received HELLO message (following RFC 3626). |
2123 |
void |
2120 |
void |
2124 |
RoutingProtocol::PopulateNeighborSet (const olsr::MessageHeader &msg, |
2121 |
RoutingProtocol::PopulateNeighborSet (const olsr::MessageHeader &msg, |
2125 |
const olsr::MessageHeader::Hello &hello) |
2122 |
const olsr::MessageHeader::Hello &hello) |
|
2133 |
|
2130 |
|
2134 |
|
2131 |
|
2135 |
/// |
2132 |
/// |
2136 |
/// \brief Updates the 2-hop Neighbor Set according to the information contained in a new |
2133 |
/// \brief Updates the 2-hop Neighbor Set according to the information contained |
2137 |
/// received HELLO message (following RFC 3626). |
2134 |
/// in a new received HELLO message (following RFC 3626). |
2138 |
void |
2135 |
void |
2139 |
RoutingProtocol::PopulateTwoHopNeighborSet (const olsr::MessageHeader &msg, |
2136 |
RoutingProtocol::PopulateTwoHopNeighborSet (const olsr::MessageHeader &msg, |
2140 |
const olsr::MessageHeader::Hello &hello) |
2137 |
const olsr::MessageHeader::Hello &hello) |
|
2142 |
Time now = Simulator::Now (); |
2139 |
Time now = Simulator::Now (); |
2143 |
|
2140 |
|
2144 |
NS_LOG_DEBUG ("Olsr node " << m_mainAddress << ": PopulateTwoHopNeighborSet BEGIN"); |
2141 |
NS_LOG_DEBUG ("Olsr node " << m_mainAddress << ": PopulateTwoHopNeighborSet BEGIN"); |
2145 |
|
2142 |
|
2146 |
for (LinkSet::const_iterator link_tuple = m_state.GetLinks ().begin (); |
2143 |
for (LinkSet::const_iterator link_tuple = m_state.GetLinks ().begin (); |
2147 |
link_tuple != m_state.GetLinks ().end (); link_tuple++) |
2144 |
link_tuple != m_state.GetLinks ().end (); link_tuple++) |
2148 |
{ |
2145 |
{ |
|
2245 |
|
2242 |
|
2246 |
|
2243 |
|
2247 |
/// |
2244 |
/// |
2248 |
/// \brief Updates the MPR Selector Set according to the information contained in a new |
2245 |
/// \brief Updates the MPR Selector Set according to the information contained in |
2249 |
/// received HELLO message (following RFC 3626). |
2246 |
/// a new received HELLO message (following RFC 3626). |
2250 |
void |
2247 |
void |
2251 |
RoutingProtocol::PopulateMprSelectorSet (const olsr::MessageHeader &msg, |
2248 |
RoutingProtocol::PopulateMprSelectorSet (const olsr::MessageHeader &msg, |
2252 |
const olsr::MessageHeader::Hello &hello) |
2249 |
const olsr::MessageHeader::Hello &hello) |
|
2254 |
NS_LOG_FUNCTION (this); |
2251 |
NS_LOG_FUNCTION (this); |
2255 |
|
2252 |
|
2256 |
Time now = Simulator::Now (); |
2253 |
Time now = Simulator::Now (); |
2257 |
|
2254 |
|
2258 |
typedef std::vector<olsr::MessageHeader::Hello::LinkMessage> LinkMessageVec; |
2255 |
typedef std::vector<olsr::MessageHeader::Hello::LinkMessage> LinkMessageVec; |
2259 |
for (LinkMessageVec::const_iterator linkMessage = hello.linkMessages.begin (); |
2256 |
for (LinkMessageVec::const_iterator linkMessage = hello.linkMessages.begin (); |
2260 |
linkMessage != hello.linkMessages.end (); |
2257 |
linkMessage != hello.linkMessages.end (); |
|
2305 |
|
2302 |
|
2306 |
#if 0 |
2303 |
#if 0 |
2307 |
/// |
2304 |
/// |
2308 |
/// \brief Drops a given packet because it couldn't be delivered to the corresponding |
2305 |
/// \brief Drops a given packet because it couldn't be delivered to the corresponding |
2309 |
/// destination by the MAC layer. This may cause a neighbor loss, and appropiate |
2306 |
/// destination by the MAC layer. This may cause a neighbor loss, and appropiate |
2310 |
/// actions are then taken. |
2307 |
/// actions are then taken. |
2311 |
/// |
2308 |
/// |
2312 |
/// \param p the packet which couldn't be delivered by the MAC layer. |
2309 |
/// \param p the packet which couldn't be delivered by the MAC layer. |
2313 |
/// |
2310 |
/// |
|
2316 |
double now = Simulator::Now (); |
2313 |
double now = Simulator::Now (); |
2317 |
struct hdr_ip* ih = HDR_IP (p); |
2314 |
struct hdr_ip* ih = HDR_IP (p); |
2318 |
struct hdr_cmn* ch = HDR_CMN (p); |
2315 |
struct hdr_cmn* ch = HDR_CMN (p); |
2319 |
|
2316 |
|
2320 |
debug ("%f: Node %d MAC Layer detects a breakage on link to %d\n", |
2317 |
debug ("%f: Node %d MAC Layer detects a breakage on link to %d\n", |
2321 |
now, |
2318 |
now, |
2322 |
OLSR::node_id (ra_addr ()), |
2319 |
OLSR::node_id (ra_addr ()), |
2323 |
OLSR::node_id (ch->next_hop ())); |
2320 |
OLSR::node_id (ch->next_hop ())); |
2324 |
|
2321 |
|
2325 |
if ((u_int32_t)ih->daddr () == IP_BROADCAST) { |
2322 |
if ((u_int32_t)ih->daddr () == IP_BROADCAST) { |
2326 |
drop (p, DROP_RTR_MAC_CALLBACK); |
2323 |
drop (p, DROP_RTR_MAC_CALLBACK); |
2327 |
return; |
2324 |
return; |
2328 |
} |
2325 |
} |
2329 |
|
2326 |
|
2330 |
OLSR_link_tuple* link_tuple = state_.find_link_tuple (ch->next_hop ()); |
2327 |
OLSR_link_tuple* link_tuple = state_.find_link_tuple (ch->next_hop ()); |
2331 |
if (link_tuple != NULL) { |
2328 |
if (link_tuple != NULL) { |
2332 |
link_tuple->lost_time () = now + OLSR_NEIGHB_HOLD_TIME; |
2329 |
link_tuple->lost_time () = now + OLSR_NEIGHB_HOLD_TIME; |
|
2431 |
} |
2428 |
} |
2432 |
|
2429 |
|
2433 |
/// |
2430 |
/// |
2434 |
/// \brief This function is invoked when a link tuple is updated. Its aim is to |
2431 |
/// \brief This function is invoked when a link tuple is updated. Its aim is to |
2435 |
/// also update the corresponding neighbor tuple if it is needed. |
2432 |
/// also update the corresponding neighbor tuple if it is needed. |
2436 |
/// |
2433 |
/// |
2437 |
/// \param tuple the link tuple which has been updated. |
2434 |
/// \param tuple the link tuple which has been updated. |
2438 |
/// |
2435 |
/// |
|
2525 |
// OLSR::node_id(ra_addr()), |
2522 |
// OLSR::node_id(ra_addr()), |
2526 |
// OLSR::node_id(tuple->neighborMainAddr), |
2523 |
// OLSR::node_id(tuple->neighborMainAddr), |
2527 |
// ((tuple->status() == OLSR_STATUS_SYM) ? "sym" : "not_sym")); |
2524 |
// ((tuple->status() == OLSR_STATUS_SYM) ? "sym" : "not_sym")); |
2528 |
|
2525 |
|
2529 |
m_state.EraseNeighborTuple (tuple); |
2526 |
m_state.EraseNeighborTuple (tuple); |
2530 |
IncrementAnsn (); |
2527 |
IncrementAnsn (); |
2531 |
} |
2528 |
} |
|
2987 |
|
2984 |
|
2988 |
/// |
2985 |
/// |
2989 |
/// \brief Deletes the entry whose destination address is given. |
2986 |
/// \brief Deletes the entry whose destination address is given. |
2990 |
/// \param dest address of the destination node. |
2987 |
/// \param dest address of the destination node. |
2991 |
/// |
2988 |
/// |
2992 |
void |
2989 |
void |
2993 |
RoutingProtocol::RemoveEntry (Ipv4Address const &dest) |
2990 |
RoutingProtocol::RemoveEntry (Ipv4Address const &dest) |
|
2997 |
|
2994 |
|
2998 |
/// |
2995 |
/// |
2999 |
/// \brief Looks up an entry for the specified destination address. |
2996 |
/// \brief Looks up an entry for the specified destination address. |
3000 |
/// \param dest destination address. |
2997 |
/// \param dest destination address. |
3001 |
/// \param outEntry output parameter to hold the routing entry result, if fuond |
2998 |
/// \param outEntry output parameter to hold the routing entry result, if fuond |
3002 |
/// \return true if found, false if not found |
2999 |
/// \return true if found, false if not found |
3003 |
/// |
3000 |
/// |
3004 |
bool |
3001 |
bool |
3005 |
RoutingProtocol::Lookup (Ipv4Address const &dest, |
3002 |
RoutingProtocol::Lookup (Ipv4Address const &dest, |
|
3016 |
} |
3013 |
} |
3017 |
|
3014 |
|
3018 |
/// |
3015 |
/// |
3019 |
/// \brief Finds the appropiate entry which must be used in order to forward |
3016 |
/// \brief Finds the appropiate entry which must be used in order to forward |
3020 |
/// a data packet to a next hop (given a destination). |
3017 |
/// a data packet to a next hop (given a destination). |
3021 |
/// |
3018 |
/// |
3022 |
/// Imagine a routing table like this: [A,B] [B,C] [C,C]; being each pair of the |
3019 |
/// Imagine a routing table like this: [A,B] [B,C] [C,C]; being each pair of the |
3023 |
/// form [dest addr,next-hop addr]. In this case, if this function is invoked with |
3020 |
/// form [dest addr,next-hop addr]. In this case, if this function is invoked with |
|
3025 |
/// to forward a data packet destined to A. That is, C is a neighbor of this node, |
3022 |
/// to forward a data packet destined to A. That is, C is a neighbor of this node, |
3026 |
/// but B isn't. This function finds the appropiate neighbor for forwarding a packet. |
3023 |
/// but B isn't. This function finds the appropiate neighbor for forwarding a packet. |
3027 |
/// |
3024 |
/// |
3028 |
/// \param entry the routing table entry which indicates the destination node |
3025 |
/// \param entry the routing table entry which indicates the destination node |
3029 |
/// we are interested in. |
3026 |
/// we are interested in. |
3030 |
/// \return the appropiate routing table entry which indicates the next |
3027 |
/// \return the appropiate routing table entry which indicates the next |
3031 |
/// hop which must be used for forwarding a data packet, or NULL |
3028 |
/// hop which must be used for forwarding a data packet, or NULL |
3032 |
/// if there is no such entry. |
3029 |
/// if there is no such entry. |
3033 |
/// |
3030 |
/// |
3034 |
bool |
3031 |
bool |
3035 |
RoutingProtocol::FindSendEntry (RoutingTableEntry const &entry, |
3032 |
RoutingProtocol::FindSendEntry (RoutingTableEntry const &entry, |
|
3239 |
/// |
3236 |
/// |
3240 |
/// If an entry for the given destination existed, it is deleted and freed. |
3237 |
/// If an entry for the given destination existed, it is deleted and freed. |
3241 |
/// |
3238 |
/// |
3242 |
/// \param dest address of the destination node. |
3239 |
/// \param dest address of the destination node. |
3243 |
/// \param next address of the next hop node. |
3240 |
/// \param next address of the next hop node. |
3244 |
/// \param iface address of the local interface. |
3241 |
/// \param iface address of the local interface. |
3245 |
/// \param dist distance to the destination node. |
3242 |
/// \param dist distance to the destination node. |
3246 |
/// |
3243 |
/// |
3247 |
void |
3244 |
void |
3248 |
RoutingProtocol::AddEntry (Ipv4Address const &dest, |
3245 |
RoutingProtocol::AddEntry (Ipv4Address const &dest, |
|
3348 |
#endif //NS3_LOG_ENABLE |
3345 |
#endif //NS3_LOG_ENABLE |
3349 |
} |
3346 |
} |
3350 |
|
3347 |
|
3351 |
} |
3348 |
} // namespace olsr |
3352 |
} // namespace olsr, ns3 |
3349 |
} // namespace ns3 |
3353 |
|
3350 |
|
3354 |
|
3351 |
|