Routing table entry. More...
#include "aodv-rtable.h"
Public Member Functions | |
RoutingTableEntry (Ptr< NetDevice > dev=nullptr, Ipv4Address dst=Ipv4Address(), bool vSeqNo=false, uint32_t seqNo=0, Ipv4InterfaceAddress iface=Ipv4InterfaceAddress(), uint16_t hops=0, Ipv4Address nextHop=Ipv4Address(), Time lifetime=Simulator::Now()) | |
constructor | |
~RoutingTableEntry () | |
Precursors management | |
Timer | m_ackTimer |
RREP_ACK timer. | |
bool | m_validSeqNo |
Valid Destination Sequence Number flag. | |
uint32_t | m_seqNo |
Destination Sequence Number, if m_validSeqNo = true. | |
uint16_t | m_hops |
Hop Count (number of hops needed to reach destination) | |
Time | m_lifeTime |
Expiration or deletion time of the route Lifetime field in the routing table plays dual role: for an active route it is the expiration time, and for an invalid route it is the deletion time. | |
Ptr< Ipv4Route > | m_ipv4Route |
Ip route, include. | |
Ipv4InterfaceAddress | m_iface |
Output interface address. | |
RouteFlags | m_flag |
Routing flags: valid, invalid or in search. | |
std::vector< Ipv4Address > | m_precursorList |
List of precursors. | |
Time | m_routeRequestTimeout |
When I can send another request. | |
uint8_t | m_reqCount |
Number of route requests. | |
bool | m_blackListState |
Indicate if this entry is in "blacklist". | |
Time | m_blackListTimeout |
Time for which the node is put into the blacklist. | |
bool | InsertPrecursor (Ipv4Address id) |
Insert precursor in precursor list if it doesn't yet exist in the list. | |
bool | LookupPrecursor (Ipv4Address id) |
Lookup precursor by address. | |
bool | DeletePrecursor (Ipv4Address id) |
Delete precursor. | |
void | DeleteAllPrecursors () |
Delete all precursors. | |
bool | IsPrecursorListEmpty () const |
Check that precursor list is empty. | |
void | GetPrecursors (std::vector< Ipv4Address > &prec) const |
Inserts precursors in output parameter prec if they do not yet exist in vector. | |
void | Invalidate (Time badLinkLifetime) |
Mark entry as "down" (i.e. | |
Ipv4Address | GetDestination () const |
Get destination address function. | |
Ptr< Ipv4Route > | GetRoute () const |
Get route function. | |
void | SetRoute (Ptr< Ipv4Route > r) |
Set route function. | |
void | SetNextHop (Ipv4Address nextHop) |
Set next hop address. | |
Ipv4Address | GetNextHop () const |
Get next hop address. | |
void | SetOutputDevice (Ptr< NetDevice > dev) |
Set output device. | |
Ptr< NetDevice > | GetOutputDevice () const |
Get output device. | |
Ipv4InterfaceAddress | GetInterface () const |
Get the Ipv4InterfaceAddress. | |
void | SetInterface (Ipv4InterfaceAddress iface) |
Set the Ipv4InterfaceAddress. | |
void | SetValidSeqNo (bool s) |
Set the valid sequence number. | |
bool | GetValidSeqNo () const |
Get the valid sequence number. | |
void | SetSeqNo (uint32_t sn) |
Set the sequence number. | |
uint32_t | GetSeqNo () const |
Get the sequence number. | |
void | SetHop (uint16_t hop) |
Set the number of hops. | |
uint16_t | GetHop () const |
Get the number of hops. | |
void | SetLifeTime (Time lt) |
Set the lifetime. | |
Time | GetLifeTime () const |
Get the lifetime. | |
void | SetFlag (RouteFlags flag) |
Set the route flags. | |
RouteFlags | GetFlag () const |
Get the route flags. | |
void | SetRreqCnt (uint8_t n) |
Set the RREQ count. | |
uint8_t | GetRreqCnt () const |
Get the RREQ count. | |
void | IncrementRreqCnt () |
Increment the RREQ count. | |
void | SetUnidirectional (bool u) |
Set the unidirectional flag. | |
bool | IsUnidirectional () const |
Get the unidirectional flag. | |
void | SetBlacklistTimeout (Time t) |
Set the blacklist timeout. | |
Time | GetBlacklistTimeout () const |
Get the blacklist timeout value. | |
bool | operator== (const Ipv4Address dst) const |
Compare destination address. | |
void | Print (Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S) const |
Print packet to trace file. | |
Routing table entry.
Definition at line 50 of file aodv-rtable.h.
ns3::aodv::RoutingTableEntry::RoutingTableEntry | ( | Ptr< NetDevice > | dev = nullptr, |
Ipv4Address | dst = Ipv4Address(), | ||
bool | vSeqNo = false, | ||
uint32_t | seqNo = 0, | ||
Ipv4InterfaceAddress | iface = Ipv4InterfaceAddress(), | ||
uint16_t | hops = 0, | ||
Ipv4Address | nextHop = Ipv4Address(), | ||
Time | lifetime = Simulator::Now() ) |
constructor
dev | the device |
dst | the destination IP address |
vSeqNo | verify sequence number flag |
seqNo | the sequence number |
iface | the interface |
hops | the number of hops |
nextHop | the IP address of the next hop |
lifetime | the lifetime of the entry |
Definition at line 37 of file aodv-rtable.cc.
References ns3::Create(), ns3::Ipv4InterfaceAddress::GetLocal(), m_iface, and m_ipv4Route.
ns3::aodv::RoutingTableEntry::~RoutingTableEntry | ( | ) |
Definition at line 63 of file aodv-rtable.cc.
void ns3::aodv::RoutingTableEntry::DeleteAllPrecursors | ( | ) |
Delete all precursors.
Definition at line 117 of file aodv-rtable.cc.
References m_precursorList, and NS_LOG_FUNCTION.
Referenced by ns3::aodv::AodvRtableEntryTest::DoRun().
bool ns3::aodv::RoutingTableEntry::DeletePrecursor | ( | Ipv4Address | id | ) |
Delete precursor.
id | precursor address |
Definition at line 99 of file aodv-rtable.cc.
References m_precursorList, NS_LOG_FUNCTION, and NS_LOG_LOGIC.
Referenced by ns3::aodv::AodvRtableEntryTest::DoRun().
|
inline |
Get the blacklist timeout value.
Definition at line 345 of file aodv-rtable.h.
References m_blackListTimeout.
Referenced by ns3::aodv::AodvRtableEntryTest::DoRun().
|
inline |
Get destination address function.
Definition at line 121 of file aodv-rtable.h.
References m_ipv4Route.
Referenced by ns3::aodv::RoutingTable::AddRoute(), ns3::aodv::AodvRtableEntryTest::DoRun(), ns3::aodv::AodvRtableTest::DoRun(), ns3::aodv::RoutingProtocol::SendReply(), ns3::aodv::RoutingProtocol::SendReplyByIntermediateNode(), ns3::aodv::RoutingProtocol::SendRerrMessage(), and ns3::aodv::RoutingTable::Update().
|
inline |
Get the route flags.
Definition at line 283 of file aodv-rtable.h.
References m_flag.
Referenced by ns3::aodv::RoutingTable::AddRoute(), ns3::aodv::RoutingProtocol::DeferredRouteOutput(), ns3::aodv::AodvRtableEntryTest::DoRun(), ns3::aodv::AodvRtableTest::DoRun(), ns3::aodv::RoutingProtocol::Forwarding(), ns3::aodv::RoutingTable::LookupValidRoute(), ns3::aodv::RoutingProtocol::RecvReply(), ns3::aodv::RoutingProtocol::RecvRequest(), ns3::aodv::RoutingProtocol::RouteRequestTimerExpire(), ns3::aodv::RoutingProtocol::SendRequest(), and ns3::aodv::RoutingProtocol::UpdateRouteLifeTime().
|
inline |
Get the number of hops.
Definition at line 247 of file aodv-rtable.h.
References m_hops.
Referenced by ns3::aodv::AodvRtableEntryTest::DoRun(), ns3::aodv::RoutingProtocol::RecvReply(), ns3::aodv::RoutingProtocol::RouteRequestTimerExpire(), ns3::aodv::RoutingProtocol::ScheduleRreqRetry(), ns3::aodv::RoutingProtocol::SendReply(), ns3::aodv::RoutingProtocol::SendReplyByIntermediateNode(), ns3::aodv::RoutingProtocol::SendRequest(), and ns3::aodv::RoutingProtocol::UpdateRouteToNeighbor().
|
inline |
Get the Ipv4InterfaceAddress.
Definition at line 184 of file aodv-rtable.h.
References m_iface.
Referenced by ns3::aodv::AodvRtableEntryTest::DoRun(), ns3::aodv::RoutingProtocol::RecvReply(), ns3::aodv::RoutingProtocol::SendReply(), ns3::aodv::RoutingProtocol::SendReplyAck(), ns3::aodv::RoutingProtocol::SendReplyByIntermediateNode(), ns3::aodv::RoutingProtocol::SendRerrMessage(), and ns3::aodv::RoutingProtocol::SendRerrWhenNoRouteToForward().
|
inline |
Get the lifetime.
Definition at line 265 of file aodv-rtable.h.
References m_lifeTime, and ns3::Simulator::Now().
Referenced by ns3::aodv::AodvRtableEntryTest::DoRun(), ns3::aodv::RoutingProtocol::ProcessHello(), ns3::aodv::RoutingProtocol::RecvReply(), ns3::aodv::RoutingProtocol::RecvRequest(), ns3::aodv::RoutingProtocol::SendReplyByIntermediateNode(), ns3::aodv::RoutingProtocol::UpdateRouteLifeTime(), and ns3::aodv::RoutingProtocol::UpdateRouteToNeighbor().
|
inline |
Get next hop address.
Definition at line 157 of file aodv-rtable.h.
References m_ipv4Route.
Referenced by ns3::aodv::AodvRtableEntryTest::DoRun(), ns3::aodv::RoutingProtocol::Forwarding(), ns3::aodv::RoutingProtocol::RecvReply(), ns3::aodv::RoutingProtocol::RecvRequest(), ns3::aodv::RoutingProtocol::RouteInput(), ns3::aodv::RoutingProtocol::SendReply(), ns3::aodv::RoutingProtocol::SendReplyByIntermediateNode(), and ns3::aodv::RoutingProtocol::SendRerrWhenNoRouteToForward().
Get output device.
Definition at line 175 of file aodv-rtable.h.
References m_ipv4Route.
Referenced by ns3::aodv::AodvRtableEntryTest::DoRun(), and ns3::aodv::RoutingProtocol::UpdateRouteToNeighbor().
void ns3::aodv::RoutingTableEntry::GetPrecursors | ( | std::vector< Ipv4Address > & | prec | ) | const |
Inserts precursors in output parameter prec if they do not yet exist in vector.
prec | vector of precursor addresses |
Definition at line 130 of file aodv-rtable.cc.
References IsPrecursorListEmpty(), m_precursorList, and NS_LOG_FUNCTION.
Referenced by ns3::aodv::AodvRtableEntryTest::DoRun(), ns3::aodv::RoutingProtocol::RecvError(), and ns3::aodv::RoutingProtocol::SendRerrWhenBreaksLinkToNextHop().
Get route function.
Definition at line 130 of file aodv-rtable.h.
References m_ipv4Route.
Referenced by ns3::aodv::AodvRtableEntryTest::DoRun(), ns3::aodv::RoutingProtocol::Forwarding(), ns3::aodv::RoutingProtocol::RecvReply(), ns3::aodv::RoutingProtocol::RouteInput(), ns3::aodv::RoutingProtocol::RouteOutput(), and ns3::aodv::RoutingProtocol::RouteRequestTimerExpire().
|
inline |
Get the RREQ count.
Definition at line 301 of file aodv-rtable.h.
References m_reqCount.
Referenced by ns3::aodv::AodvRtableEntryTest::DoRun(), ns3::aodv::RoutingProtocol::RouteRequestTimerExpire(), and ns3::aodv::RoutingProtocol::ScheduleRreqRetry().
|
inline |
Get the sequence number.
Definition at line 229 of file aodv-rtable.h.
References m_seqNo.
Referenced by ns3::aodv::AodvRtableEntryTest::DoRun(), ns3::aodv::RoutingProtocol::Forwarding(), ns3::aodv::RoutingProtocol::RecvReply(), ns3::aodv::RoutingProtocol::RecvRequest(), ns3::aodv::RoutingProtocol::SendReplyByIntermediateNode(), ns3::aodv::RoutingProtocol::SendRequest(), and ns3::aodv::RoutingProtocol::SendRerrWhenBreaksLinkToNextHop().
|
inline |
Get the valid sequence number.
Definition at line 211 of file aodv-rtable.h.
References m_validSeqNo.
Referenced by ns3::aodv::AodvRtableEntryTest::DoRun(), ns3::aodv::RoutingProtocol::Forwarding(), ns3::aodv::RoutingProtocol::RecvReply(), ns3::aodv::RoutingProtocol::RecvRequest(), ns3::aodv::RoutingProtocol::SendRequest(), and ns3::aodv::RoutingProtocol::UpdateRouteToNeighbor().
|
inline |
Increment the RREQ count.
Definition at line 309 of file aodv-rtable.h.
References m_reqCount.
Referenced by ns3::aodv::AodvRtableEntryTest::DoRun(), and ns3::aodv::RoutingProtocol::SendRequest().
bool ns3::aodv::RoutingTableEntry::InsertPrecursor | ( | Ipv4Address | id | ) |
Insert precursor in precursor list if it doesn't yet exist in the list.
id | precursor address |
Definition at line 68 of file aodv-rtable.cc.
References LookupPrecursor(), m_precursorList, and NS_LOG_FUNCTION.
Referenced by ns3::aodv::AodvRtableEntryTest::DoRun(), ns3::aodv::AodvRtableTest::DoRun(), ns3::aodv::RoutingProtocol::RecvReply(), and ns3::aodv::RoutingProtocol::SendReplyByIntermediateNode().
void ns3::aodv::RoutingTableEntry::Invalidate | ( | Time | badLinkLifetime | ) |
Mark entry as "down" (i.e.
disable it)
badLinkLifetime | duration to keep entry marked as invalid |
Definition at line 156 of file aodv-rtable.cc.
References ns3::Time::As(), ns3::aodv::INVALID, m_flag, m_lifeTime, m_reqCount, ns3::Simulator::Now(), NS_LOG_FUNCTION, and ns3::Time::S.
Referenced by ns3::aodv::AodvRtableEntryTest::DoRun().
bool ns3::aodv::RoutingTableEntry::IsPrecursorListEmpty | ( | ) | const |
Check that precursor list is empty.
Definition at line 124 of file aodv-rtable.cc.
References m_precursorList.
Referenced by ns3::aodv::AodvRtableEntryTest::DoRun(), and GetPrecursors().
|
inline |
Get the unidirectional flag.
Definition at line 327 of file aodv-rtable.h.
References m_blackListState.
Referenced by ns3::aodv::AodvRtableEntryTest::DoRun(), ns3::aodv::AodvRtableTest::DoRun(), and ns3::aodv::RoutingProtocol::RecvRequest().
bool ns3::aodv::RoutingTableEntry::LookupPrecursor | ( | Ipv4Address | id | ) |
Lookup precursor by address.
id | precursor address |
Definition at line 83 of file aodv-rtable.cc.
References m_precursorList, NS_LOG_FUNCTION, and NS_LOG_LOGIC.
Referenced by ns3::aodv::AodvRtableEntryTest::DoRun(), and InsertPrecursor().
|
inline |
Compare destination address.
dst | IP address to compare |
Definition at line 358 of file aodv-rtable.h.
References m_ipv4Route.
void ns3::aodv::RoutingTableEntry::Print | ( | Ptr< OutputStreamWrapper > | stream, |
Time::Unit | unit = Time::S ) const |
Print packet to trace file.
stream | The output stream |
unit | The time unit to use (default Time::S) |
Definition at line 169 of file aodv-rtable.cc.
References ns3::Ipv4InterfaceAddress::GetLocal(), ns3::aodv::IN_SEARCH, ns3::aodv::INVALID, m_flag, m_hops, m_iface, m_ipv4Route, m_lifeTime, ns3::Simulator::Now(), and ns3::aodv::VALID.
|
inline |
Set the blacklist timeout.
t | the blacklist timeout value |
Definition at line 336 of file aodv-rtable.h.
References m_blackListTimeout.
Referenced by ns3::aodv::AodvRtableEntryTest::DoRun().
|
inline |
Set the route flags.
flag | the route flags |
Definition at line 274 of file aodv-rtable.h.
References m_flag.
Referenced by ns3::aodv::AodvRtableEntryTest::DoRun(), ns3::aodv::RoutingProtocol::ProcessHello(), ns3::aodv::RoutingProtocol::RecvReplyAck(), ns3::aodv::RoutingProtocol::RecvRequest(), and ns3::aodv::RoutingProtocol::SendRequest().
|
inline |
Set the number of hops.
hop | the number of hops |
Definition at line 238 of file aodv-rtable.h.
References m_hops.
Referenced by ns3::aodv::AodvRtableEntryTest::DoRun(), ns3::aodv::AodvRtableTest::DoRun(), ns3::aodv::RoutingProtocol::ProcessHello(), ns3::aodv::RoutingProtocol::RecvRequest(), and ns3::aodv::RoutingProtocol::SendRequest().
|
inline |
Set the Ipv4InterfaceAddress.
iface | The Ipv4InterfaceAddress |
Definition at line 193 of file aodv-rtable.h.
References m_iface.
Referenced by ns3::aodv::AodvRtableEntryTest::DoRun(), ns3::aodv::RoutingProtocol::ProcessHello(), and ns3::aodv::RoutingProtocol::RecvRequest().
|
inline |
Set the lifetime.
lt | The lifetime |
Definition at line 256 of file aodv-rtable.h.
References m_lifeTime, and ns3::Simulator::Now().
Referenced by ns3::aodv::AodvRtableEntryTest::DoRun(), ns3::aodv::AodvRtableTest::DoRun(), ns3::aodv::RoutingProtocol::ProcessHello(), ns3::aodv::RoutingProtocol::RecvReply(), ns3::aodv::RoutingProtocol::RecvRequest(), ns3::aodv::RoutingProtocol::SendRequest(), ns3::aodv::RoutingProtocol::UpdateRouteLifeTime(), and ns3::aodv::RoutingProtocol::UpdateRouteToNeighbor().
|
inline |
Set next hop address.
nextHop | the next hop IPv4 address |
Definition at line 148 of file aodv-rtable.h.
References m_ipv4Route.
Referenced by ns3::aodv::AodvRtableEntryTest::DoRun(), ns3::aodv::RoutingProtocol::ProcessHello(), and ns3::aodv::RoutingProtocol::RecvRequest().
Set output device.
dev | The output device |
Definition at line 166 of file aodv-rtable.h.
References m_ipv4Route.
Referenced by ns3::aodv::AodvRtableEntryTest::DoRun(), ns3::aodv::RoutingProtocol::ProcessHello(), and ns3::aodv::RoutingProtocol::RecvRequest().
Set route function.
r | the IPv4 route |
Definition at line 139 of file aodv-rtable.h.
References m_ipv4Route.
|
inline |
Set the RREQ count.
n | the RREQ count |
Definition at line 292 of file aodv-rtable.h.
References m_reqCount.
Referenced by ns3::aodv::RoutingTable::AddRoute(), ns3::aodv::AodvRtableEntryTest::DoRun(), and ns3::aodv::RoutingProtocol::UpdateRouteLifeTime().
|
inline |
Set the sequence number.
sn | the sequence number |
Definition at line 220 of file aodv-rtable.h.
References m_seqNo.
Referenced by ns3::aodv::RoutingProtocol::ProcessHello(), and ns3::aodv::RoutingProtocol::RecvRequest().
|
inline |
Set the unidirectional flag.
u | the uni directional flag |
Definition at line 318 of file aodv-rtable.h.
References m_blackListState.
Referenced by ns3::aodv::AodvRtableEntryTest::DoRun().
|
inline |
Set the valid sequence number.
s | the sequence number |
Definition at line 202 of file aodv-rtable.h.
References m_validSeqNo.
Referenced by ns3::aodv::AodvRtableEntryTest::DoRun(), ns3::aodv::RoutingProtocol::ProcessHello(), and ns3::aodv::RoutingProtocol::RecvRequest().
Timer ns3::aodv::RoutingTableEntry::m_ackTimer |
RREP_ACK timer.
Definition at line 351 of file aodv-rtable.h.
Referenced by ns3::aodv::RoutingProtocol::RecvReplyAck(), and ns3::aodv::RoutingProtocol::SendReplyByIntermediateNode().
|
private |
Indicate if this entry is in "blacklist".
Definition at line 403 of file aodv-rtable.h.
Referenced by IsUnidirectional(), and SetUnidirectional().
|
private |
Time for which the node is put into the blacklist.
Definition at line 405 of file aodv-rtable.h.
Referenced by GetBlacklistTimeout(), and SetBlacklistTimeout().
|
private |
Routing flags: valid, invalid or in search.
Definition at line 394 of file aodv-rtable.h.
Referenced by GetFlag(), Invalidate(), Print(), and SetFlag().
|
private |
Hop Count (number of hops needed to reach destination)
Definition at line 376 of file aodv-rtable.h.
|
private |
Output interface address.
Definition at line 392 of file aodv-rtable.h.
Referenced by RoutingTableEntry(), GetInterface(), Print(), and SetInterface().
Ip route, include.
Definition at line 390 of file aodv-rtable.h.
Referenced by RoutingTableEntry(), GetDestination(), GetNextHop(), GetOutputDevice(), GetRoute(), operator==(), Print(), SetNextHop(), SetOutputDevice(), and SetRoute().
|
private |
Expiration or deletion time of the route Lifetime field in the routing table plays dual role: for an active route it is the expiration time, and for an invalid route it is the deletion time.
Definition at line 383 of file aodv-rtable.h.
Referenced by GetLifeTime(), Invalidate(), Print(), and SetLifeTime().
|
private |
List of precursors.
Definition at line 397 of file aodv-rtable.h.
Referenced by DeleteAllPrecursors(), DeletePrecursor(), GetPrecursors(), InsertPrecursor(), IsPrecursorListEmpty(), and LookupPrecursor().
|
private |
Number of route requests.
Definition at line 401 of file aodv-rtable.h.
Referenced by GetRreqCnt(), IncrementRreqCnt(), Invalidate(), and SetRreqCnt().
|
private |
When I can send another request.
Definition at line 399 of file aodv-rtable.h.
|
private |
Destination Sequence Number, if m_validSeqNo = true.
Definition at line 374 of file aodv-rtable.h.
Referenced by GetSeqNo(), and SetSeqNo().
|
private |
Valid Destination Sequence Number flag.
Definition at line 372 of file aodv-rtable.h.
Referenced by GetValidSeqNo(), and SetValidSeqNo().