32 #include "ns3/simulator.h"
51 m_lifeTime (lifetime),
54 m_settlingTime (SettlingTime),
55 m_entriesChanged (areChanged)
78 std::map<Ipv4Address, RoutingTableEntry>::const_iterator i =
m_ipv4AddressEntry.find (
id);
96 std::map<Ipv4Address, RoutingTableEntry>::const_iterator i =
m_ipv4AddressEntry.find (
id);
101 if (forRouteInput ==
true &&
id == i->second.GetInterface ().GetBroadcast ())
129 std::pair<std::map<Ipv4Address, RoutingTableEntry>::iterator,
bool> result =
m_ipv4AddressEntry.insert (std::make_pair (
131 return result.second;
155 if (i->second.GetInterface () == iface)
157 std::map<Ipv4Address, RoutingTableEntry>::iterator tmp = i;
173 if (i->second.GetDestination () !=
Ipv4Address (
"127.0.0.1") && i->second.GetFlag () ==
VALID)
176 std::make_pair (i->first,i->second));
183 std::map<Ipv4Address, RoutingTableEntry> & unreachable)
185 unreachable.clear ();
186 for (std::map<Ipv4Address, RoutingTableEntry>::const_iterator i =
m_ipv4AddressEntry.begin (); i
189 if (i->second.GetNextHop () == nextHop)
191 unreachable.insert (std::make_pair (i->first,i->second));
201 << std::setw (10) <<
m_hops <<
"\t" << std::setw (10) <<
m_seqNo <<
"\t"
215 std::map<Ipv4Address, RoutingTableEntry>::iterator itmp = i;
216 if (i->second.GetLifeTime () >
m_holddownTime && (i->second.GetHop () > 0))
220 if ((j->second.GetNextHop () == i->second.GetDestination ()) && (i->second.GetHop () != j->second.GetHop ()))
222 std::map<Ipv4Address, RoutingTableEntry>::iterator jtmp = j;
223 removedAddresses.insert (std::make_pair (j->first,j->second));
232 removedAddresses.insert (std::make_pair (i->first,i->second));
253 *stream->
GetStream () <<
"\nDSDV Routing table\n" <<
"Destination\t\tGateway\t\tInterface\t\tHopCount\t\tSeqNum\t\tLifeTime\t\tSettlingTime\n";
254 for (std::map<Ipv4Address, RoutingTableEntry>::const_iterator i =
m_ipv4AddressEntry.begin (); i
257 i->second.Print (stream);
266 std::pair<std::map<Ipv4Address, EventId>::iterator,
bool> result =
m_ipv4Events.insert (std::make_pair (address,
id));
267 return result.second;
274 std::map<Ipv4Address, EventId>::const_iterator i =
m_ipv4Events.find (address);
298 std::map<Ipv4Address, EventId>::const_iterator i =
m_ipv4Events.find (address);
313 std::map<Ipv4Address, EventId>::const_iterator i =
m_ipv4Events.find (address);
339 std::map <Ipv4Address, EventId>::const_iterator i =
m_ipv4Events.find (address);
Time m_holddownTime
an entry in the routing table.
uint32_t m_hops
Hop Count (number of hops needed to reach destination)
keep track of time values and allow control of global simulation resolution
smart pointer class similar to boost::intrusive_ptr
void Print(Ptr< OutputStreamWrapper > stream) const
bool AnyRunningEvent(Ipv4Address address)
Ipv4Address GetLocal(void) const
EventId GetEventId(Ipv4Address address)
#define NS_LOG_COMPONENT_DEFINE(name)
void GetListOfAllRoutes(std::map< Ipv4Address, RoutingTableEntry > &allRoutes)
static void Cancel(const EventId &id)
bool IsRunning(void) const
bool Update(RoutingTableEntry &rt)
void SetSource(Ipv4Address src)
bool ForceDeleteIpv4Event(Ipv4Address address)
double GetSeconds(void) const
void SetGateway(Ipv4Address gw)
uint32_t m_seqNo
Destination Sequence Number.
void Purge(std::map< Ipv4Address, RoutingTableEntry > &removedAddresses)
Delete all outdated entries if Lifetime is expired.
Ipv4Address GetGateway(void) const
Ipv4InterfaceAddress m_iface
Output interface address.
std::map< Ipv4Address, EventId > m_ipv4Events
an entry in the event table.
void DeleteAllRoutesFromInterface(Ipv4InterfaceAddress iface)
Delete all route from interface with address iface.
bool AddRoute(RoutingTableEntry &r)
uint32_t RoutingTableSize()
Provides the number of routes present in that nodes routing table.
void SetOutputDevice(Ptr< NetDevice > outputDevice)
std::map< Ipv4Address, RoutingTableEntry > m_ipv4AddressEntry
an entry in the routing table.
void GetListOfDestinationWithNextHop(Ipv4Address nxtHp, std::map< Ipv4Address, RoutingTableEntry > &dstList)
bool DeleteIpv4Event(Ipv4Address address)
Ipv4Address GetDestination(void) const
Ipv4 addresses are stored in host order in this class.
bool DeleteRoute(Ipv4Address dst)
a class to store IPv4 address information on an interface
an identifier for simulation events.
RoutingTableEntry(Ptr< NetDevice > dev=0, Ipv4Address dst=Ipv4Address(), uint32_t m_seqNo=0, Ipv4InterfaceAddress iface=Ipv4InterfaceAddress(), uint32_t hops=0, Ipv4Address nextHop=Ipv4Address(), Time lifetime=Simulator::Now(), Time SettlingTime=Simulator::Now(), bool changedEntries=false)
c-tor
Ipv4Address GetDestination() const
Time m_lifeTime
Expiration or deletion time of the route Lifetime field in the routing table plays dual role – for an...
bool AddIpv4Event(Ipv4Address address, EventId id)
void Print(Ptr< OutputStreamWrapper > stream) const
Print routing table.
bool LookupRoute(Ipv4Address dst, RoutingTableEntry &rt)
bool IsExpired(void) const
Ptr< Ipv4Route > m_ipv4Route
std::ostream * GetStream(void)
void SetDestination(Ipv4Address dest)