19 #include "ns3/aodv-neighbor.h"
20 #include "ns3/aodv-packet.h"
21 #include "ns3/aodv-rqueue.h"
22 #include "ns3/aodv-rtable.h"
23 #include "ns3/ipv4-route.h"
44 void DoRun()
override;
79 "Neighbor doesn't exist");
82 "Neighbor doesn't exist");
85 "Neighbor doesn't exist");
94 "Neighbor doesn't exist");
97 "Neighbor doesn't exist");
100 "Neighbor doesn't exist");
103 "Neighbor doesn't exist");
116 "Neighbor doesn't exist");
121 "Known expire time");
124 "Known expire time");
435 void DoRun()
override;
631 std::vector<Ipv4Address> prec;
720 std::map<Ipv4Address, uint32_t> unreachable;
723 unreachable.insert(std::make_pair(
Ipv4Address(
"4.3.2.1"), 3));
bool IsEqual(const CallbackBase &other) const
Equality test.
Ipv4 addresses are stored in host order in this class.
a class to store IPv4 address information on an interface
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
void AddHeader(const Header &header)
Add header to this packet.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static void Run()
Run the simulation.
SocketErrno
Enumeration of the possible errors returned by a socket.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
@ UNIT
This test suite implements a Unit Test.
maintain list of active neighbors
Time GetExpireTime(Ipv4Address addr)
Return expire time for neighbor node with address addr, if exists, else return 0.
void Update(Ipv4Address addr, Time expire)
Update expire time for entry with address addr, if it exists, else add new entry.
void SetCallback(Callback< void, Ipv4Address > cb)
Set link failure callback.
bool IsNeighbor(Ipv4Address addr)
Check that node with address addr is neighbor.
Time GetExpireTime() const
Get expire time.
void SetErrorCallback(ErrorCallback ecb)
Set error callback.
ErrorCallback GetErrorCallback() const
Get error callback.
void SetUnicastForwardCallback(UnicastForwardCallback ucb)
Set unicast forward callback.
void SetExpireTime(Time exp)
Set expire time.
Ipv4Header GetIpv4Header() const
Get IPv4 header.
UnicastForwardCallback GetUnicastForwardCallback() const
Get unicast forward callback.
Ptr< const Packet > GetPacket() const
Get packet from entry.
void SetIpv4Header(Ipv4Header h)
Set IPv4 header.
AODV route request queue.
bool Dequeue(Ipv4Address dst, QueueEntry &entry)
Return first found (the earliest) entry for given destination.
void SetMaxQueueLen(uint32_t len)
Set maximum queue length.
bool Find(Ipv4Address dst)
Finds whether a packet with destination dst exists in the queue.
Time GetQueueTimeout() const
Get queue timeout.
void SetQueueTimeout(Time t)
Set queue timeout.
void DropPacketWithDst(Ipv4Address dst)
Remove all packets with destination IP address dst.
bool Enqueue(QueueEntry &entry)
Push entry in queue, if there is no entry with the same packet and destination address in queue.
uint32_t GetMaxQueueLen() const
Get maximum queue length.
void DeleteAllPrecursors()
Delete all precursors.
void SetHop(uint16_t hop)
Set the number of hops.
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.
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.
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.
void IncrementRreqCnt()
Increment the RREQ count.
bool DeletePrecursor(Ipv4Address id)
Delete precursor.
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.
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.
uint32_t GetSeqNo() const
Get the sequence number.
void SetUnidirectional(bool u)
Set the unidirectional flag.
bool GetValidSeqNo() const
Get the valid sequence number.
void SetFlag(RouteFlags flag)
Set the route flags.
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 Update(RoutingTableEntry &rt)
Update routing table.
bool AddRoute(RoutingTableEntry &r)
Add routing table entry if it doesn't yet exist in routing table.
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.
Time GetBadLinkLifetime() const
Get the lifetime of a bad link.
void InvalidateRoutesWithDst(const std::map< Ipv4Address, uint32_t > &unreachable)
Update routing entries with this destination as follows:
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.
ns3::aodv::AodvTestSuite g_aodvTestSuite
the test suite
@ AODVTYPE_RREP
AODVTYPE_RREP.
@ AODVTYPE_RREQ
AODVTYPE_RREQ.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
Time Seconds(double value)
Construct a Time in the indicated unit.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Unit test for RequestQueue.
void Unicast(Ptr< Ipv4Route > route, Ptr< const Packet > packet, const Ipv4Header &header)
Unicast test function.
RequestQueue q
Request queue.
void CheckTimeout()
Check timeout function.
void DoRun() override
Implementation to actually run this TestCase.
void Error(Ptr< const Packet > p, const Ipv4Header &h, Socket::SocketErrno e)
Error test function.
void CheckSizeLimit()
Check size limit function.
Unit test for AODV routing table entry.
void DoRun() override
Implementation to actually run this TestCase.
Unit test for AODV routing table.
void DoRun() override
Implementation to actually run this TestCase.
void CheckTimeout2()
Check timeout function 2.
Neighbors * neighbor
The Neighbors.
void DoRun() override
Implementation to actually run this TestCase.
void Handler(Ipv4Address addr)
Handler test function.
void CheckTimeout1()
Check timeout function 1.
void CheckTimeout3()
Check timeout function 3.
Unit test for AODV routing table entry.
void Error(Ptr< const Packet > p, const Ipv4Header &h, Socket::SocketErrno e)
Error test function.
void Unicast2(Ptr< Ipv4Route > route, Ptr< const Packet > packet, const Ipv4Header &header)
Unicast 2 testfunction.
void DoRun() override
Implementation to actually run this TestCase.
void Unicast(Ptr< Ipv4Route > route, Ptr< const Packet > packet, const Ipv4Header &header)
Unicast test function.
void Error2(Ptr< const Packet > p, const Ipv4Header &h, Socket::SocketErrno e)
Error2 test function.