30 #include "ns3/ipv4-route.h"
32 #include "ns3/net-device.h"
33 #include "ns3/output-stream-wrapper.h"
34 #include "ns3/timer.h"
39 #include <sys/types.h>
501 std::map<Ipv4Address, uint32_t>& unreachable);
548 void Purge(std::map<Ipv4Address, RoutingTableEntry>& table)
const;
Ipv4 addresses are stored in host order in this class.
a class to store IPv4 address information on an interface
Smart pointer class similar to boost::intrusive_ptr.
static Time Now()
Return the current simulation virtual time.
Simulation virtual time values and global simulation resolution.
Unit
The unit to use to interpret a number representing time.
A simple virtual Timer class.
void DeleteAllPrecursors()
Delete all precursors.
Timer m_ackTimer
RREP_ACK timer.
void SetHop(uint16_t hop)
Set the number of hops.
void SetRoute(Ptr< Ipv4Route > r)
Set route function.
Ipv4InterfaceAddress m_iface
Output interface address.
std::vector< Ipv4Address > m_precursorList
List of precursors.
Ptr< NetDevice > GetOutputDevice() const
Get output device.
bool IsPrecursorListEmpty() const
Check that precursor list is empty.
bool InsertPrecursor(Ipv4Address id)
Insert precursor in precursor list if it doesn't yet exist in the list.
bool m_blackListState
Indicate if this entry is in "blacklist".
bool m_validSeqNo
Valid Destination Sequence Number flag.
uint8_t GetRreqCnt() const
Get the RREQ count.
Ipv4InterfaceAddress GetInterface() const
Get the Ipv4InterfaceAddress.
void SetNextHop(Ipv4Address nextHop)
Set next hop address.
void SetLifeTime(Time lt)
Set the lifetime.
void Print(Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S) const
Print packet to trace file.
bool IsUnidirectional() const
Get the unidirectional flag.
void GetPrecursors(std::vector< Ipv4Address > &prec) const
Inserts precursors in output parameter prec if they do not yet exist in vector.
RouteFlags GetFlag() const
Get the route flags.
Ipv4Address GetNextHop() const
Get next hop address.
void SetBlacklistTimeout(Time t)
Set the blacklist timeout.
uint16_t m_hops
Hop Count (number of hops needed to reach destination)
Ptr< Ipv4Route > m_ipv4Route
Ip route, include.
void IncrementRreqCnt()
Increment the RREQ count.
bool DeletePrecursor(Ipv4Address id)
Delete precursor.
void SetSeqNo(uint32_t sn)
Set the sequence number.
void SetInterface(Ipv4InterfaceAddress iface)
Set the Ipv4InterfaceAddress.
void SetRreqCnt(uint8_t n)
Set the RREQ count.
void Invalidate(Time badLinkLifetime)
Mark entry as "down" (i.e.
bool LookupPrecursor(Ipv4Address id)
Lookup precursor by address.
void SetOutputDevice(Ptr< NetDevice > dev)
Set output device.
Ipv4Address GetDestination() const
Get destination address function.
bool operator==(const Ipv4Address dst) const
Compare destination address.
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
uint16_t GetHop() const
Get the number of hops.
void SetValidSeqNo(bool s)
Set the valid sequence number.
Ptr< Ipv4Route > GetRoute() const
Get route function.
Time m_routeRequestTimeout
When I can send another request.
uint32_t GetSeqNo() const
Get the sequence number.
uint32_t m_seqNo
Destination Sequence Number, if m_validSeqNo = true.
Time m_lifeTime
Expiration or deletion time of the route Lifetime field in the routing table plays dual role: for an ...
void SetUnidirectional(bool u)
Set the unidirectional flag.
Time m_blackListTimeout
Time for which the node is put into the blacklist.
RouteFlags m_flag
Routing flags: valid, invalid or in search.
bool GetValidSeqNo() const
Get the valid sequence number.
void SetFlag(RouteFlags flag)
Set the route flags.
uint8_t m_reqCount
Number of route requests.
Time GetLifeTime() const
Get the lifetime.
Time GetBlacklistTimeout() const
Get the blacklist timeout value.
The Routing table used by AODV protocol.
void GetListOfDestinationWithNextHop(Ipv4Address nextHop, std::map< Ipv4Address, uint32_t > &unreachable)
Lookup routing entries with next hop Address dst and not empty list of precursors.
bool LookupValidRoute(Ipv4Address dst, RoutingTableEntry &rt)
Lookup route in VALID state.
void Purge()
Delete all outdated entries and invalidate valid entry if Lifetime is expired.
bool Update(RoutingTableEntry &rt)
Update routing table.
Time m_badLinkLifetime
Deletion time for invalid routes.
bool AddRoute(RoutingTableEntry &r)
Add routing table entry if it doesn't yet exist in routing table.
void Print(Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S) const
Print routing table.
RoutingTable(Time t)
constructor
bool LookupRoute(Ipv4Address dst, RoutingTableEntry &rt)
Lookup routing table entry with destination address dst.
void SetBadLinkLifetime(Time t)
Set the lifetime of a bad link.
bool SetEntryState(Ipv4Address dst, RouteFlags state)
Set routing table entry flags.
void DeleteAllRoutesFromInterface(Ipv4InterfaceAddress iface)
Delete all route from interface with address iface.
Time GetBadLinkLifetime() const
Get the lifetime of a bad link.
void Clear()
Delete all entries from routing table.
void InvalidateRoutesWithDst(const std::map< Ipv4Address, uint32_t > &unreachable)
Update routing entries with this destination as follows:
std::map< Ipv4Address, RoutingTableEntry > m_ipv4AddressEntry
The routing table.
bool MarkLinkAsUnidirectional(Ipv4Address neighbor, Time blacklistTimeout)
Mark entry as unidirectional (e.g.
bool DeleteRoute(Ipv4Address dst)
Delete routing table entry with destination address dst, if it exists.
RouteFlags
Route record states.
Every class exported by the ns3 library is enclosed in the ns3 namespace.