35 #include "ns3/inet-socket-address.h"
36 #include "ns3/trace-source-accessor.h"
37 #include "ns3/udp-socket-factory.h"
38 #include "ns3/wifi-net-device.h"
39 #include "ns3/boolean.h"
40 #include "ns3/double.h"
41 #include "ns3/uinteger.h"
78 static TypeId tid =
TypeId (
"ns3::dsdv::DeferredRouteOutputTag")
80 .SetGroupName (
"Dsdv")
95 return sizeof(int32_t);
113 os <<
"DeferredRouteOutputTag: output interface = " <<
oif;
120 static TypeId tid =
TypeId (
"ns3::dsdv::RoutingProtocol")
122 .SetGroupName (
"Dsdv")
124 .AddAttribute (
"PeriodicUpdateInterval",
"Periodic interval between exchange of full routing tables among nodes. ",
128 .AddAttribute (
"SettlingTime",
"Minimum time an update is to be stored in adv table before sending out"
129 "in case of change in metric (in seconds)",
133 .AddAttribute (
"MaxQueueLen",
"Maximum number of packets that we allow a routing protocol to buffer.",
136 MakeUintegerChecker<uint32_t> ())
137 .AddAttribute (
"MaxQueuedPacketsPerDst",
"Maximum number of packets that we allow per destination to buffer.",
140 MakeUintegerChecker<uint32_t> ())
141 .AddAttribute (
"MaxQueueTime",
"Maximum time packets can be queued (in seconds)",
145 .AddAttribute (
"EnableBuffering",
"Enables buffering of data packets if no route to destination is available",
150 .AddAttribute (
"EnableWST",
"Enables Weighted Settling Time for the updates before advertising",
155 .AddAttribute (
"Holdtimes",
"Times the forwarding Interval to purge the route.",
158 MakeUintegerChecker<uint32_t> ())
159 .AddAttribute (
"WeightedFactor",
"WeightedFactor for the settling time if Weighted Settling Time is enabled",
162 MakeDoubleChecker<double> ())
163 .AddAttribute (
"EnableRouteAggregation",
"Enables Weighted Settling Time for the updates before advertising",
168 .AddAttribute (
"RouteAggregationTime",
"Time to aggregate updates before sending them out (in seconds)",
216 m_advRoutingTable (),
218 m_periodicUpdateTimer (
Timer::CANCEL_ON_DESTROY)
234 iter->first->Close ();
244 <<
", Time: " <<
Now ().
As (unit)
245 <<
", Local time: " << GetObject<Node> ()->GetLocalTime ().As (unit)
246 <<
", DSDV Routing table" << std::endl;
285 std::map<Ipv4Address, RoutingTableEntry> removedAddresses;
290 <<
", Packet id: " << p->
GetUid () <<
", Destination address in Packet: " << dst);
293 for (std::map<Ipv4Address, RoutingTableEntry>::iterator rmItr = removedAddresses.begin ();
294 rmItr != removedAddresses.end (); ++rmItr)
296 rmItr->second.SetEntriesChanged (
true);
297 rmItr->second.SetSeqNo (rmItr->second.GetSeqNo () + 1);
300 if (!removedAddresses.empty ())
310 if (rt.GetHop () == 1)
312 route = rt.GetRoute ();
315 <<
" to neighboring destination "
333 <<
" to destination " << dst <<
" via "
334 << rt.GetNextHop ());
348 uint32_t iif = (oif ?
m_ipv4->GetInterfaceForDevice (oif) : -1);
361 UnicastForwardCallback ucb,
378 UnicastForwardCallback ucb,
395 int32_t iif =
m_ipv4->GetInterfaceForDevice (idev);
435 if (lcb.
IsNull () ==
false)
438 lcb (p, header, iif);
443 NS_LOG_ERROR (
"Unable to deliver packet locally due to null callback " << p->
GetUid () <<
" from " << origin);
453 ucb (route,packet,header);
465 if (
m_ipv4->IsDestinationAddress (dst, iif))
467 if (lcb.
IsNull () ==
false)
470 lcb (p, header, iif);
474 NS_LOG_ERROR (
"Unable to deliver packet locally due to null callback " << p->
GetUid () <<
" from " << origin);
481 if (
m_ipv4->IsForwarding (iif) ==
false)
483 NS_LOG_LOGIC (
"Forwarding disabled for this interface");
498 <<
" via nexthop neighbor " << toDst.
GetNextHop ());
499 ucb (route,p,header);
504 <<
" as there is no route to forward it.");
538 int32_t
interface =
m_ipv4->GetInterfaceForAddress (addr);
539 if (oif ==
m_ipv4->GetNetDevice (static_cast<uint32_t> (interface)))
568 <<
" and packet id: " << packet->GetUid ());
570 for (; packetSize > 0; packetSize = packetSize - 12)
574 packet->RemoveHeader (dsdvHeader);
581 if (dsdvHeader.
GetDst () == interface.GetLocal ())
585 NS_LOG_DEBUG (
"Sent Dsdv update back to the same Destination, "
586 "with infinite metric. Time left to send fwd update: "
592 NS_LOG_DEBUG (
"Received update for my address. Discarding this.");
602 << sender <<
" to " << receiver <<
". Details are: Destination: " << dsdvHeader.
GetDst () <<
", Seq No: "
607 if (permanentTableVerifier ==
false)
616 m_ipv4->GetAddress (
m_ipv4->GetInterfaceForAddress (receiver), 0),
630 NS_LOG_DEBUG (
"Discarding this update as this route is not present in "
631 "main routing table and received with infinite metric");
639 std::map<Ipv4Address, RoutingTableEntry> allRoutes;
641 for (std::map<Ipv4Address, RoutingTableEntry>::const_iterator i = allRoutes.begin (); i != allRoutes.end (); ++i)
643 NS_LOG_DEBUG (
"ADV table routes are:" << i->second.GetDestination ());
651 if (dsdvHeader.
GetDstSeqno () > advTableEntry.GetSeqNo ())
656 NS_LOG_DEBUG (
"Canceling the timer to update route with better seq number");
659 if (dsdvHeader.
GetHopCount () != advTableEntry.GetHop ())
661 advTableEntry.SetSeqNo (dsdvHeader.
GetDstSeqno ());
663 advTableEntry.SetFlag (
VALID);
664 advTableEntry.SetEntriesChanged (
true);
665 advTableEntry.SetNextHop (sender);
667 NS_LOG_DEBUG (
"Received update with better sequence number and changed metric.Waiting for WST");
669 advTableEntry.SetSettlingTime (tempSettlingtime);
671 <<
"s as there is no event running for this route");
682 advTableEntry.SetSeqNo (dsdvHeader.
GetDstSeqno ());
684 advTableEntry.SetFlag (
VALID);
685 advTableEntry.SetEntriesChanged (
true);
686 advTableEntry.SetNextHop (sender);
689 NS_LOG_DEBUG (
"Route with better sequence number and same metric received. Advertised without WST");
692 else if (dsdvHeader.
GetDstSeqno () == advTableEntry.GetSeqNo ())
694 if (dsdvHeader.
GetHopCount () < advTableEntry.GetHop ())
699 NS_LOG_DEBUG (
"Canceling any existing timer to update route with same sequence number "
700 "and better hop count");
702 advTableEntry.SetSeqNo (dsdvHeader.
GetDstSeqno ());
704 advTableEntry.SetFlag (
VALID);
705 advTableEntry.SetEntriesChanged (
true);
706 advTableEntry.SetNextHop (sender);
709 advTableEntry.SetSettlingTime (tempSettlingtime);
711 <<
" as there is no current event running for this route");
729 if (advTableEntry.GetNextHop () == sender)
737 NS_LOG_DEBUG (
"Received update with same seq number and "
738 "same/worst metric for, " << dsdvHeader.
GetDst () <<
". Discarding the update.");
748 NS_LOG_DEBUG (dsdvHeader.
GetDst () <<
" : Received update with old seq number. Discarding the update.");
753 NS_LOG_DEBUG (
"Route with infinite metric received for "
754 << dsdvHeader.
GetDst () <<
" from " << sender);
756 if (sender == advTableEntry.GetNextHop ())
758 NS_LOG_DEBUG (
"Triggering an update for this unreachable route:");
759 std::map<Ipv4Address, RoutingTableEntry> dstsWithNextHopSrc;
762 advTableEntry.SetSeqNo (dsdvHeader.
GetDstSeqno ());
763 advTableEntry.SetEntriesChanged (
true);
765 for (std::map<Ipv4Address, RoutingTableEntry>::iterator i = dstsWithNextHopSrc.begin (); i
766 != dstsWithNextHopSrc.end (); ++i)
768 i->second.SetSeqNo (i->second.GetSeqNo () + 1);
769 i->second.SetEntriesChanged (
true);
781 " : Discard this link break update as it was received from a different neighbor "
782 "and I can reach the destination");
787 std::map<Ipv4Address, RoutingTableEntry> allRoutes;
804 std::map<Ipv4Address, RoutingTableEntry> allRoutes;
813 for (std::map<Ipv4Address, RoutingTableEntry>::const_iterator i = allRoutes.begin (); i != allRoutes.end (); ++i)
815 NS_LOG_LOGIC (
"Destination: " << i->second.GetDestination ()
816 <<
" SeqNo:" << i->second.GetSeqNo () <<
" HopCount:"
817 << i->second.GetHop () + 1);
821 dsdvHeader.
SetDst (i->second.GetDestination ());
824 temp.SetFlag (
VALID);
825 temp.SetEntriesChanged (
false);
827 if (!(temp.GetSeqNo () % 2))
833 NS_LOG_DEBUG (
"Deleted this route from the advertised table");
839 NS_LOG_DEBUG (
"EventID " << event.GetUid () <<
" associated with "
840 << temp.GetDestination () <<
" has not expired, waiting in adv table");
847 dsdvHeader.
SetDst (
m_ipv4->GetAddress (1, 0).GetLocal ());
850 NS_LOG_DEBUG (
"Adding my update as well to the packet");
865 <<
" with packet id : " << packet->
GetUid () <<
" and packet Size: " << packet->
GetSize ());
869 NS_LOG_FUNCTION (
"Update not sent as there are no updates to be triggered");
877 std::map<Ipv4Address, RoutingTableEntry> removedAddresses, allRoutes;
881 if (allRoutes.empty ())
892 for (std::map<Ipv4Address, RoutingTableEntry>::const_iterator i = allRoutes.begin (); i != allRoutes.end (); ++i)
895 if (i->second.GetHop () == 0)
898 dsdvHeader.
SetDst (
m_ipv4->GetAddress (1,0).GetLocal ());
899 dsdvHeader.
SetDstSeqno (i->second.GetSeqNo () + 2);
908 dsdvHeader.
SetDst (i->second.GetDestination ());
913 NS_LOG_DEBUG (
"Forwarding the update for " << i->first);
917 <<
", LifeTime: " << i->second.GetLifeTime ().GetSeconds ());
919 for (std::map<Ipv4Address, RoutingTableEntry>::const_iterator rmItr = removedAddresses.begin (); rmItr
920 != removedAddresses.end (); ++rmItr)
923 removedHeader.
SetDst (rmItr->second.GetDestination ());
924 removedHeader.
SetDstSeqno (rmItr->second.GetSeqNo () + 1);
925 removedHeader.
SetHopCount (rmItr->second.GetHop () + 1);
927 NS_LOG_DEBUG (
"Update for removed record is: Destination: " << removedHeader.
GetDst ()
931 socket->
Send (packet);
977 <<
" interface is up");
980 if (iface.GetLocal () ==
Ipv4Address (
"127.0.0.1"))
1028 NS_LOG_FUNCTION (
this <<
" interface " << i <<
" address " << address);
1066 if (l3->GetNAddresses (i))
1123 std::map<Ipv4Address, RoutingTableEntry> allRoutes;
1125 for (std::map<Ipv4Address, RoutingTableEntry>::const_iterator i = allRoutes.begin (); i != allRoutes.end (); ++i)
1135 <<
" to neighboring destination "
1168 NS_LOG_DEBUG (
"Output device doesn't match. Dropped.");
1176 ucb (route,p,header);
1204 NS_LOG_DEBUG (
"Calculated weightedTime:" << weightedTime.GetSeconds ());
1205 return weightedTime;
1214 NS_LOG_FUNCTION (
"Merging advertised table changes with main table before sending out periodic update");
1215 std::map<Ipv4Address, RoutingTableEntry> allRoutes;
1217 if (allRoutes.size () > 0)
1219 for (std::map<Ipv4Address, RoutingTableEntry>::const_iterator i = allRoutes.begin (); i != allRoutes.end (); ++i)
1235 NS_LOG_DEBUG (
"Event currently running. Cannot Merge Routing Tables");
void Start()
Start protocol operation.
static TypeId GetTypeId(void)
Get the type ID.
Unit
The unit to use to interpret a number representing time.
static const uint32_t DSDV_PORT
UDP Port for DSDV control traffic.
static Ipv4Mask GetOnes(void)
Simulation virtual time values and global simulation resolution.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
bool GetWSTFlag() const
Get weighted settling time (WST) flag.
Ipv4Address GetIpv4(void) const
static Ipv4Address GetAny(void)
void SetEntriesChanged(bool entriesChanged)
Set entries changed indicator.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
std::map< Ptr< Socket >, Ipv4InterfaceAddress > m_socketAddresses
Raw socket per each IP interface, map socket -> iface address (IP + mask)
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
SocketErrno
Enumeration of the possible errors returned by a socket.
AttributeValue implementation for Boolean.
Ipv4Mask GetMask(void) const
Get the network mask.
Ipv4Address GetNextHop() const
Get next hop.
bool EnableRouteAggregation
This is a flag to enable route aggregation.
void MergeTriggerPeriodicUpdates()
Merge periodic updates.
Time m_periodicUpdateInterval
PeriodicUpdateInterval specifies the periodic time interval between which the a node broadcasts its e...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
bool EnableBuffering
Flag that is used to enable or disable buffering.
bool AnyRunningEvent(Ipv4Address address)
Force delete an update waiting for settling time to complete as a better update to same destination w...
Ipv4Header GetIpv4Header() const
Get IP header.
Ipv4Address GetLocal(void) const
Get the local address.
virtual bool SetAllowBroadcast(bool allowBroadcast)=0
Configure whether broadcast datagram transmissions are allowed.
ErrorCallback m_ecb
Error callback for own packets.
a class to represent an Ipv4 address mask
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
virtual void SetIpv4(Ptr< Ipv4 > ipv4)
void AddPacketTag(const Tag &tag) const
Add a packet tag.
static TypeId GetTypeId()
Get the type ID.
uint64_t GetUid(void) const
Returns the packet's Uid.
EventId GetEventId(Ipv4Address address)
Get the EcentId associated with that address.
uint32_t GetSerializedSize() const
bool IsNull(void) const
Check for null implementation.
bool EnableWST
Flag that is used to enable or disable Weighted Settling Time.
TypeId GetInstanceTypeId() const
Get the most derived TypeId for this Object.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
void SetFlag(RouteFlags flag)
Set route flags.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
uint32_t GetSeqNo() const
Get sequence number.
void SetMaxPacketsPerDst(uint32_t len)
Set maximum packets per destination.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
virtual void DoDispose()
Destructor implementation.
bool IsMulticast(void) const
virtual void NotifyInterfaceDown(uint32_t interface)
void GetListOfAllRoutes(std::map< Ipv4Address, RoutingTableEntry > &allRoutes)
Lookup list of all addresses in the routing table.
double m_weightedFactor
This is the wighted factor to determine the weighted settling time.
void(* Time)(Time oldValue, Time newValue)
TracedValue callback signature for Time.
virtual void DoDispose(void)
Destructor implementation.
TAG_BUFFER_INLINE uint32_t ReadU32(void)
void SendPacketFromQueue(Ipv4Address dst, Ptr< Ipv4Route > route)
Send packet from queue.
int32_t oif
Positive if output device is fixed in RouteOutput.
bool Update(RoutingTableEntry &rt)
Updating the routing Table with routing table entry rt.
Ptr< Ipv4Route > GetRoute() const
Get route.
a polymophic address class
void SendPeriodicUpdate()
Broadcasts the entire routing table for every PeriodicUpdateInterval.
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
bool GetEnableRAFlag() const
Get enable route aggregation (RA) flag.
void SetSource(Ipv4Address src)
Ptr< NetDevice > GetOutputDevice(void) const
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
bool ForceDeleteIpv4Event(Ipv4Address address)
Force delete an update waiting for settling time to complete as a better update to same destination w...
bool PeekPacketTag(Tag &tag) const
Search a matching tag and call Tag::Deserialize if it is found.
NS_ASSERT_MSG(false,"Ipv4AddressGenerator::MaskToIndex(): Impossible")
virtual uint32_t GetInteger(void)=0
Get the next random value as an integer drawn from the distribution.
Ptr< Socket > FindSocketWithInterfaceAddress(Ipv4InterfaceAddress iface) const
Find socket with local interface address iface.
static EventId Schedule(Time const &delay, MEM mem_ptr, OBJ obj)
Schedule an event to expire after delay.
AttributeValue implementation for Time.
void Schedule(void)
Schedule a new event using the currently-configured delay, function, and arguments.
void SetGateway(Ipv4Address gw)
Hold an unsigned integer type.
TAG_BUFFER_INLINE void WriteU32(uint32_t v)
void SetSeqNo(uint32_t sequenceNumber)
Set sequence number.
void Purge(std::map< Ipv4Address, RoutingTableEntry > &removedAddresses)
Delete all outdated entries if Lifetime is expired.
bool IsBroadcast(void) const
uint32_t m_maxQueueLen
The maximum number of packets that we allow a routing protocol to buffer.
Ptr< Ipv4Route > LoopbackRoute(const Ipv4Header &header, Ptr< NetDevice > oif) const
Create loopback route for given header.
void Deserialize(TagBuffer i)
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
uint32_t GetUid(void) const
bool RouteInput(Ptr< const Packet > p, const Ipv4Header &header, Ptr< const NetDevice > idev, UnicastForwardCallback ucb, MulticastForwardCallback mcb, LocalDeliverCallback lcb, ErrorCallback ecb)
Route input packet.
void SetRecvCallback(Callback< void, Ptr< Socket > >)
Notify application when new data is available to be read.
static Ptr< Socket > CreateSocket(Ptr< Node > node, TypeId tid)
This method wraps the creation of sockets that is performed on a given node by a SocketFactory specif...
Ipv4Address GetSource(void) const
virtual void NotifyRemoveAddress(uint32_t interface, Ipv4InterfaceAddress address)
static TypeId GetTypeId(void)
Get the type ID.
Time GetSettlingTime() const
Get settling time.
void SetMaxQueueLen(uint32_t len)
Set maximum queue length.
UnicastForwardCallback m_scb
Unicast callback for own packets.
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
double f(double x, void *params)
tag a set of bytes in a packet
Ptr< Ipv4Route > RouteOutput(Ptr< Packet > p, const Ipv4Header &header, Ptr< NetDevice > oif, Socket::SocketErrno &sockerr)
Query routing cache for an existing route, for an outbound packet.
virtual ~RoutingProtocol()
Implement the IPv4 layer.
Time GetSettlingTime(Ipv4Address dst)
Get settlingTime for a destination.
virtual int Bind(const Address &address)=0
Allocate a local endpoint for this socket.
void DeferredRouteOutput(Ptr< const Packet > p, const Ipv4Header &header, UnicastForwardCallback ucb, ErrorCallback ecb)
Queue packet until we find a route.
void LookForQueuedPackets(void)
Look for any queued packets to send them out.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Time m_routeAggregationTime
Parameter that holds the route aggregation time interval.
static InetSocketAddress ConvertFrom(const Address &address)
Returns an InetSocketAddress which corresponds to the input Address.
bool Dequeue(Ipv4Address dst, QueueEntry &entry)
Return first found (the earliest) entry for given destination.
Ptr< const AttributeChecker > MakeBooleanChecker(void)
PacketQueue m_queue
A "drop front on full" queue used by the routing layer to buffer packets to which it does not have a ...
void DeleteAllRoutesFromInterface(Ipv4InterfaceAddress iface)
Delete all route from interface with address iface.
UnicastForwardCallback GetUnicastForwardCallback() const
Get unicast forward callback function.
Time m_maxQueueTime
The maximum period of time that a routing protocol is allowed to buffer a packet for.
bool AddRoute(RoutingTableEntry &r)
Add routing table entry if it doesn't yet exist in routing table.
virtual void PrintRoutingTable(Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S) const
Print the Routing Table entries.
void RecvDsdv(Ptr< Socket > socket)
Receive and process dsdv control packet.
void SetQueueTimeout(Time t)
Set queue timeout.
bool GetEnableBufferFlag() const
Get enable buffer flag.
static EventId ScheduleNow(MEM mem_ptr, OBJ obj)
Schedule an event to expire Now.
Ipv4Address m_mainAddress
Nodes IP address.
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
static Time Now(void)
Return the current simulation virtual time.
void SetOutputDevice(Ptr< NetDevice > outputDevice)
Equivalent in Linux to dst_entry.dev.
static Ipv4Address GetLoopback(void)
void SendTriggeredUpdate()
Sends trigger update from a node.
NS_LOG_LOGIC("Net device "<< nd<< " is not bridged")
uint32_t m_maxQueuedPacketsPerDst
The maximum number of packets that we allow per destination to buffer.
virtual void BindToNetDevice(Ptr< NetDevice > netdevice)
Bind a socket to specific device.
void Serialize(TagBuffer i) const
virtual void NotifyAddAddress(uint32_t interface, Ipv4InterfaceAddress address)
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
void GetListOfDestinationWithNextHop(Ipv4Address nxtHp, std::map< Ipv4Address, RoutingTableEntry > &dstList)
Lookup list of addresses for which nxtHp is the next Hop address.
bool DeleteIpv4Event(Ipv4Address address)
Clear up the entry from the map after the event is completed.
Ipv4Address GetDestination(void) const
uint32_t GetHop() const
Get hop.
void Send(Ptr< Ipv4Route >, Ptr< const Packet >, const Ipv4Header &)
Send packet.
Ipv4 addresses are stored in host order in this class.
Ipv4Address GetBroadcast(void) const
Get the broadcast address.
TimeWithUnit As(const enum Unit unit) const
Attach a unit to a Time, to facilitate output in a specific unit.
bool DeleteRoute(Ipv4Address dst)
Delete routing table entry with destination address dst, if it exists.
a class to store IPv4 address information on an interface
void SetEnableRAFlag(bool f)
Set enable route aggregation (RA) flag.
An identifier for simulation events.
Ptr< NetDevice > m_lo
Loopback device used to defer route requests until a route is found.
Ptr< UniformRandomVariable > m_uniformRandomVariable
Provides uniform random variables.
bool RemovePacketTag(Tag &tag)
Remove a packet tag.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Time Seconds(double value)
Construct a Time in the indicated unit.
bool GetEntriesChanged() const
Get entries changed.
Ptr< const Packet > GetPacket() const
Get packet.
Tag used by DSDV implementation.
void SetEnableBufferFlag(bool f)
Set enable buffer flag.
Abstract base class for IPv4 routing protocols.
Ipv4Address GetDestination() const
Get destination IP address.
void Clear()
Delete all entries from routing table.
DeferredRouteOutputTag(int32_t o=-1)
Constructor.
virtual int SendTo(Ptr< Packet > p, uint32_t flags, const Address &toAddress)=0
Send data to a specified peer.
Ptr< Ipv4 > m_ipv4
IP protocol.
void Setholddowntime(Time t)
Set hold down time (time until an invalid route may be deleted)
RoutingTable m_advRoutingTable
Advertised Routing table for the node.
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
virtual void NotifyInterfaceUp(uint32_t interface)
static const uint32_t packetSize
void Print(std::ostream &os) const
bool AddIpv4Event(Ipv4Address address, EventId id)
Add an event for a destination address so that the update to for that destination is sent after the e...
void Print(Ptr< OutputStreamWrapper > stream) const
Print routing table.
bool LookupRoute(Ipv4Address dst, RoutingTableEntry &rt)
Lookup routing table entry with destination address dst.
virtual Ptr< Packet > RecvFrom(uint32_t maxSize, uint32_t flags, Address &fromAddress)=0
Read a single packet from the socket and retrieve the sender address.
Timer m_periodicUpdateTimer
Timer to trigger periodic updates from a node.
uint32_t GetSize()
Get the number of entries.
void SetWSTFlag(bool f)
Set weighted settling time (WST) flag.
virtual int Send(Ptr< Packet > p, uint32_t flags)=0
Send data (or dummy data) to the remote host.
virtual int Close(void)=0
Close a socket.
RoutingTable m_routingTable
Main Routing table for the node.
void Drop(Ptr< const Packet >, const Ipv4Header &, Socket::SocketErrno)
Notify that packet is dropped for some reason.
Time GetDelayLeft(void) const
This class can be used to hold variables of floating point type such as 'double' or 'float'...
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
a unique identifier for an interface.
Time m_settlingTime
SettlingTime specifies the time for which a node waits before propagating an update.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Time GetLifeTime() const
Get lifetime.
static Time GetMaximumSimulationTime(void)
Get the maximum representable simulation time.
std::ostream * GetStream(void)
Return a pointer to an ostream previously set in the wrapper.
virtual Address GetAddress(void) const =0
void AddHeader(const Header &header)
Add header to this packet.
bool Find(Ipv4Address dst)
Finds whether a packet with destination dst exists in the queue.
void SetDestination(Ipv4Address dest)
Callback< void, Ptr< Ipv4Route >, Ptr< const Packet >, const Ipv4Header & > UnicastForwardCallback
Callback for unicast packets to be forwarded.
uint32_t Holdtimes
Holdtimes is the multiplicative factor of PeriodicUpdateInterval for which the node waits since the l...
bool Enqueue(QueueEntry &entry)
Push entry in queue, if there is no entry with the same packet and destination address in queue...