|
|
| 155 |
} |
155 |
} |
| 156 |
|
156 |
|
| 157 |
void |
157 |
void |
| 158 |
RoutingTableEntry::Print (std::ostream & os) const |
158 |
RoutingTableEntry::Print (Ptr<OutputStreamWrapper> stream) const |
| 159 |
{ |
159 |
{ |
| 160 |
os << m_ipv4Route->GetDestination () << "\t" << m_ipv4Route->GetGateway () |
160 |
std::ostream* os = stream->GetStream (); |
|
|
161 |
*os << m_ipv4Route->GetDestination () << "\t" << m_ipv4Route->GetGateway () |
| 161 |
<< "\t" << m_iface.GetLocal () << "\t"; |
162 |
<< "\t" << m_iface.GetLocal () << "\t"; |
| 162 |
switch (m_flag) |
163 |
switch (m_flag) |
| 163 |
{ |
164 |
{ |
| 164 |
case VALID: |
165 |
case VALID: |
| 165 |
{ |
166 |
{ |
| 166 |
os << "UP"; |
167 |
*os << "UP"; |
| 167 |
break; |
168 |
break; |
| 168 |
} |
169 |
} |
| 169 |
case INVALID: |
170 |
case INVALID: |
| 170 |
{ |
171 |
{ |
| 171 |
os << "DOWN"; |
172 |
*os << "DOWN"; |
| 172 |
break; |
173 |
break; |
| 173 |
} |
174 |
} |
| 174 |
case IN_SEARCH: |
175 |
case IN_SEARCH: |
| 175 |
{ |
176 |
{ |
| 176 |
os << "IN_SEARCH"; |
177 |
*os << "IN_SEARCH"; |
| 177 |
break; |
178 |
break; |
| 178 |
} |
179 |
} |
| 179 |
} |
180 |
} |
| 180 |
os << "\t" << (m_lifeTime - Simulator::Now ()).GetSeconds () << "\t" |
181 |
*os << "\t" << (m_lifeTime - Simulator::Now ()).GetSeconds () << "\t" |
| 181 |
<< m_hops << "\n"; |
182 |
<< m_hops << "\n"; |
| 182 |
} |
183 |
} |
| 183 |
|
184 |
|
|
|
| 397 |
} |
398 |
} |
| 398 |
|
399 |
|
| 399 |
void |
400 |
void |
| 400 |
RoutingTable::Print (std::ostream &os) |
401 |
RoutingTable::Print (Ptr<OutputStreamWrapper> stream) |
| 401 |
{ |
402 |
{ |
| 402 |
Purge (); |
403 |
Purge (); |
| 403 |
os << "\nAODV Routing table\n" |
404 |
*stream->GetStream () << "AODV Routing table\n" |
| 404 |
<< "Destination\tGateway\t\tInterface\tFlag\tExpire\tHops\n"; |
405 |
<< "Destination\tGateway\t\tInterface\tFlag\tExpire\t\tHops\n"; |
| 405 |
for (std::map<Ipv4Address, RoutingTableEntry>::const_iterator i = |
406 |
for (std::map<Ipv4Address, RoutingTableEntry>::const_iterator i = |
| 406 |
m_ipv4AddressEntry.begin (); i != m_ipv4AddressEntry.end (); ++i) |
407 |
m_ipv4AddressEntry.begin (); i != m_ipv4AddressEntry.end (); ++i) |
| 407 |
{ |
408 |
{ |
| 408 |
i->second.Print (os); |
409 |
i->second.Print (stream); |
| 409 |
} |
410 |
} |
| 410 |
os << "\n"; |
411 |
*stream->GetStream () << "\n"; |
| 411 |
} |
412 |
} |
| 412 |
|
413 |
|
| 413 |
} |
414 |
} |