LEFT | RIGHT |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2011 Yufei Cheng | 3 * Copyright (c) 2011 Yufei Cheng |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 5 * This program is free software; you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 2 as | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 NS_LOG_INFO ("The request table size after erase " << (uint32_t)m_rreq
DstMap.size ()); | 100 NS_LOG_INFO ("The request table size after erase " << (uint32_t)m_rreq
DstMap.size ()); |
101 } | 101 } |
102 RreqTableEntry rreqTableEntry; | 102 RreqTableEntry rreqTableEntry; |
103 rreqTableEntry.m_reqNo = 1; | 103 rreqTableEntry.m_reqNo = 1; |
104 rreqTableEntry.m_expire = Simulator::Now (); | 104 rreqTableEntry.m_expire = Simulator::Now (); |
105 m_rreqDstMap [dst] = rreqTableEntry; | 105 m_rreqDstMap [dst] = rreqTableEntry; |
106 } | 106 } |
107 else | 107 else |
108 { | 108 { |
109 NS_LOG_LOGIC ("Find the request table entry for " << dst << ", increment
the request count"); | 109 NS_LOG_LOGIC ("Find the request table entry for " << dst << ", increment
the request count"); |
110 Ipv4Address d = i->first; | 110 Ipv4Address dst1 = i->first; |
111 RreqTableEntry rreqTableEntry = i->second; | 111 RreqTableEntry rreqTableEntry = i->second; |
112 rreqTableEntry.m_reqNo = rreqTableEntry.m_reqNo + 1; | 112 rreqTableEntry.m_reqNo = rreqTableEntry.m_reqNo + 1; |
113 rreqTableEntry.m_expire = Simulator::Now (); | 113 rreqTableEntry.m_expire = Simulator::Now (); |
114 m_rreqDstMap [d] = rreqTableEntry; | 114 m_rreqDstMap [dst1] = rreqTableEntry; |
115 } | 115 } |
116 } | 116 } |
117 | 117 |
118 void | 118 void |
119 DsrRreqTable::RemoveRreqEntry (Ipv4Address dst) | 119 DsrRreqTable::RemoveRreqEntry (Ipv4Address dst) |
120 { | 120 { |
121 NS_LOG_FUNCTION (this << dst); | 121 NS_LOG_FUNCTION (this << dst); |
122 std::map<Ipv4Address, RreqTableEntry >::const_iterator i = | 122 std::map<Ipv4Address, RreqTableEntry >::const_iterator i = |
123 m_rreqDstMap.find (dst); | 123 m_rreqDstMap.find (dst); |
124 if (i == m_rreqDstMap.end ()) | 124 if (i == m_rreqDstMap.end ()) |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 m_rreqIdCache[dst] = rreqId; | 183 m_rreqIdCache[dst] = rreqId; |
184 } | 184 } |
185 NS_LOG_INFO ("The Request id for " << dst << " is " << rreqId); | 185 NS_LOG_INFO ("The Request id for " << dst << " is " << rreqId); |
186 return rreqId; | 186 return rreqId; |
187 } | 187 } |
188 } | 188 } |
189 | 189 |
190 uint32_t | 190 uint32_t |
191 DsrRreqTable::GetRreqSize () | 191 DsrRreqTable::GetRreqSize () |
192 { | 192 { |
193 return m_rreqIdCache.size (); | 193 return static_cast<uint32_t> (m_rreqIdCache.size ()); |
194 } | 194 } |
195 | 195 |
196 // -----------------------------------------------------------------------------
----------------------------- | 196 // -----------------------------------------------------------------------------
----------------------------- |
197 /* | 197 /* |
198 * This part takes care of black list which can save unidirectional link informa
tion | 198 * This part takes care of black list which can save unidirectional link informa
tion |
199 */ | 199 */ |
200 | 200 |
201 void | 201 void |
202 DsrRreqTable::Invalidate () | 202 DsrRreqTable::Invalidate () |
203 { | 203 { |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 { | 278 { |
279 NS_LOG_LOGIC ("Find the request table entry for " << src << ", check if i
t is exact duplicate"); | 279 NS_LOG_LOGIC ("Find the request table entry for " << src << ", check if i
t is exact duplicate"); |
280 /* | 280 /* |
281 * Drop the most aged packet when buffer reaches to max | 281 * Drop the most aged packet when buffer reaches to max |
282 */ | 282 */ |
283 receivedRreqEntryList = i->second; | 283 receivedRreqEntryList = i->second; |
284 if (receivedRreqEntryList.size () >= m_requestIdSize) | 284 if (receivedRreqEntryList.size () >= m_requestIdSize) |
285 { | 285 { |
286 receivedRreqEntryList.pop_front (); | 286 receivedRreqEntryList.pop_front (); |
287 } | 287 } |
288 Ipv4Address s = i->first; | 288 Ipv4Address src1 = i->first; |
289 // We loop the receive rreq entry to find duplicate | 289 // We loop the receive rreq entry to find duplicate |
290 for (std::list<DsrReceivedRreqEntry>::const_iterator j = receivedRreqEntry
List.begin (); j != receivedRreqEntryList.end (); ++j) | 290 for (std::list<DsrReceivedRreqEntry>::const_iterator j = receivedRreqEntry
List.begin (); j != receivedRreqEntryList.end (); ++j) |
291 { | 291 { |
292 if (*j == rreqEntry) /// Check if we have found one duplicati
on entry or not | 292 if (*j == rreqEntry) /// Check if we have found one duplicati
on entry or not |
293 { | 293 { |
294 return true; | 294 return true; |
295 } | 295 } |
296 } | 296 } |
297 /// if this entry is not found, we need to save the entry in the cache, an
d then return false for the check | 297 /// if this entry is not found, we need to save the entry in the cache, an
d then return false for the check |
298 receivedRreqEntryList.push_back (rreqEntry); | 298 receivedRreqEntryList.push_back (rreqEntry); |
299 m_sourceRreqMap [s] = receivedRreqEntryList; | 299 m_sourceRreqMap [src1] = receivedRreqEntryList; |
300 return false; | 300 return false; |
301 } | 301 } |
302 } | 302 } |
303 | 303 |
304 } // namespace dsr | 304 } // namespace dsr |
305 } // namespace ns3 | 305 } // namespace ns3 |
LEFT | RIGHT |