38 #include "ns3/buffer.h"
39 #include "ns3/packet.h"
40 #include "ns3/callback.h"
42 #include "ns3/udp-l4-protocol.h"
44 #include "ns3/ipv4-route.h"
45 #include "ns3/object.h"
47 #include "ns3/ipv4-interface.h"
48 #include "ns3/ipv4-header.h"
49 #include "ns3/ipv4-address.h"
50 #include "ns3/traced-callback.h"
51 #include "ns3/output-stream-wrapper.h"
52 #include "ns3/timer.h"
54 #include "dsr-rsendbuff.h"
55 #include "dsr-maintain-buff.h"
56 #include "dsr-option-header.h"
57 #include "dsr-rcache.h"
58 #include "dsr-routing.h"
59 #include "dsr-gratuitous-reply-table.h"
114 std::vector<Ipv4Address>
CutRoute (
Ipv4Address ipv4Address, std::vector<Ipv4Address> &nodeList);
149 bool IfDuplicates (std::vector<Ipv4Address>& vec, std::vector<Ipv4Address>& vec2);
159 void RemoveDuplicates (std::vector<Ipv4Address>& vec);
virtual ~DsrOptionAck()
Destructor.
static const uint8_t OPT_NUMBER
Dsr Route Error option number.
uint32_t m_length
The length of the packet.
Ptr< Ipv4 > m_ipv4
The ip layer 3.
virtual uint8_t Process(Ptr< Packet > packet, Ptr< Packet > dsrP, Ipv4Address ipv4Address, Ipv4Address source, Ipv4Header const &ipv4Header, uint8_t protocol, bool &isPromisc, Ipv4Address promiscSource)
Process method.
virtual uint8_t GetOptionNumber() const
Get the option number.
static const uint8_t OPT_NUMBER
Rreq option number.
DsrOptionAck()
Constructor.
static const uint8_t OPT_NUMBER
Dsr ack request option number.
Ptr< Ipv4 > m_ipv4
The ipv4 layer 3.
virtual TypeId GetInstanceTypeId() const
Get the instance type ID.
static TypeId GetTypeId()
Get the type identificator.
DsrOptionRerr()
Constructor.
virtual ~DsrOptionSR()
Destructor.
static TypeId GetTypeId()
Get the type identificator.
forward calls to a chain of CallbackAn ns3::TracedCallback has almost exactly the same API as a norma...
virtual uint8_t GetOptionNumber() const =0
Get the option number.
virtual uint8_t Process(Ptr< Packet > packet, Ptr< Packet > dsrP, Ipv4Address ipv4Address, Ipv4Address source, Ipv4Header const &ipv4Header, uint8_t protocol, bool &isPromisc, Ipv4Address promiscSource)
Process method.
DsrOptionRrep()
Constructor.
DsrOptionSR()
Constructor.
virtual uint8_t Process(Ptr< Packet > packet, Ptr< Packet > dsrP, Ipv4Address ipv4Address, Ipv4Address source, Ipv4Header const &ipv4Header, uint8_t protocol, bool &isPromisc, Ipv4Address promiscSource)
Process method.
virtual TypeId GetInstanceTypeId() const
Get the instance type ID.
virtual uint8_t Process(Ptr< Packet > packet, Ptr< Packet > dsrP, Ipv4Address ipv4Address, Ipv4Address source, Ipv4Header const &ipv4Header, uint8_t protocol, bool &isPromisc, Ipv4Address promiscSource)=0
Process method.
void SetNode(Ptr< Node > node)
Set the node.
static const uint8_t OPT_NUMBER
Pad1 option number.
uint8_t DoSendError(Ptr< Packet > p, DsrOptionRerrUnreachHeader &rerr, uint32_t rerrSize, Ipv4Address ipv4Address, uint8_t protocol)
Do Send error message.
Ptr< dsr::RreqTable > m_rreqTable
The route request table.
uint32_t GetIDfromIP(Ipv4Address address)
Get the node id with Ipv4Address.
Ptr< Ipv4 > m_ipv4
The ipv4 layer 3.
void ScheduleReply(Ptr< Packet > &packet, std::vector< Ipv4Address > &nodeList, Ipv4Address &source, Ipv4Address &destination)
Schedule the intermediate node route request broadcast.
virtual uint8_t GetOptionNumber() const
Get the option number.
static TypeId GetTypeId()
Get the type identificator.
uint32_t m_length
The length of the packet.
DsrOptionRreq()
Constructor.
Ipv4Address ReverseSearchNextTwoHop(Ipv4Address ipv4Address, std::vector< Ipv4Address > &vec)
Reverse search for the next two hop in the route.
virtual uint8_t Process(Ptr< Packet > packet, Ptr< Packet > dsrP, Ipv4Address ipv4Address, Ipv4Address source, Ipv4Header const &ipv4Header, uint8_t protocol, bool &isPromisc, Ipv4Address promiscSource)
Process method.
Ptr< dsr::RouteCache > m_routeCache
The route cache.
TracedCallback< Ptr< const Packet > > m_dropTrace
Drop trace callback.
static const uint8_t OPT_NUMBER
Router alert option number.
virtual ~DsrOptionPad1()
Destructor.
static TypeId GetTypeId()
Get the type identificator.
virtual uint8_t Process(Ptr< Packet > packet, Ptr< Packet > dsrP, Ipv4Address ipv4Address, Ipv4Address source, Ipv4Header const &ipv4Header, uint8_t protocol, bool &isPromisc, Ipv4Address promiscSource)
Process method.
static const uint8_t OPT_NUMBER
PadN option number.
Ipv4Address Broadcast
The broadcast IP address.
virtual ~DsrOptionRreq()
Destructor.
std::vector< Ipv4Address > m_finalRoute
The vector of final Ipv4 address.
virtual TypeId GetInstanceTypeId() const
Get the instance type ID.
Time ActiveRouteTimeout
The active route timeout value.
void PrintVector(std::vector< Ipv4Address > &vec)
Print out the elements in the route vector.
DsrOptionPad1()
Constructor.
uint32_t m_length
The length of the packet.
DsrOptionPadn()
Constructor.
virtual ~DsrOptionRrep()
Destructor.
Ptr< dsr::RouteCache > m_routeCache
The route cache.
static const uint8_t OPT_NUMBER
The Dsr Ack option number.
Ipv4Address SearchNextHop(Ipv4Address ipv4Address, std::vector< Ipv4Address > &vec)
Search for the next hop in the route.
virtual ~DsrOptionRerr()
Destructor.
TracedCallback< const DsrOptionSRHeader & > m_rxPacketTrace
static TypeId GetTypeId()
Get the type identificator.
Ptr< Ipv4 > m_ipv4
The ip layer 3.
virtual ~DsrOptions()
Destructor.
Ipv4 addresses are stored in host order in this class.
virtual uint8_t Process(Ptr< Packet > packet, Ptr< Packet > dsrP, Ipv4Address ipv4Address, Ipv4Address source, Ipv4Header const &ipv4Header, uint8_t protocol, bool &isPromisc, Ipv4Address promiscSource)
Process method.
Ptr< Ipv4 > m_ipv4
The ipv4 layer 3.
virtual ~DsrOptionPadn()
Destructor.
static TypeId GetTypeId()
Get the type identificator.
uint32_t m_length
The length of the packet.
bool CheckDuplicates(Ipv4Address ipv4Address, std::vector< Ipv4Address > &vec)
Check if the route already contains the node ip address.
bool ReverseRoutes(std::vector< Ipv4Address > &vec)
Reverse the routes.
virtual uint8_t Process(Ptr< Packet > packet, Ptr< Packet > dsrP, Ipv4Address ipv4Address, Ipv4Address source, Ipv4Header const &ipv4Header, uint8_t protocol, bool &isPromisc, Ipv4Address promiscSource)
Process method.
Ptr< Ipv4Route > m_ipv4Route
The ipv4 route.
Ptr< Ipv4 > m_ipv4
The ipv4.
virtual TypeId GetInstanceTypeId() const
Get the instance type ID.
Ipv4Address ReverseSearchNextHop(Ipv4Address ipv4Address, std::vector< Ipv4Address > &vec)
Reverse search for the next hop in the route.
virtual ~DsrOptionAckReq()
Destructor.
uint32_t m_length
The length of the packet.
virtual TypeId GetInstanceTypeId() const
Get the instance type ID.
static TypeId GetTypeId(void)
Get the type identificator.
bool ContainAddressAfter(Ipv4Address ipv4Address, Ipv4Address destAddress, std::vector< Ipv4Address > &nodeList)
Search for the ipv4 address in the node list.
virtual uint8_t GetOptionNumber() const
Get the option number.
virtual uint8_t GetOptionNumber() const
Get the option number.
virtual uint8_t GetOptionNumber() const
Get the option number.
Ptr< Ipv4 > m_ipv4
The ipv4.
virtual TypeId GetInstanceTypeId() const
Get the instance type ID.
static const uint8_t OPT_NUMBER
Source Route option number.
std::vector< Ipv4Address > m_ipv4Address
The vector of Ipv4 address.
Ptr< dsr::RouteCache > m_routeCache
The route cache.
virtual uint8_t GetOptionNumber() const
Get the option number.
a base class which provides memory management and object aggregation
Ptr< Node > GetNode() const
Get the node.
virtual Ptr< Ipv4Route > SetRoute(Ipv4Address nextHop, Ipv4Address srcAddress)
Set the route to use for data packets.
DsrOptionAckReq()
Constructor.
bool IfDuplicates(std::vector< Ipv4Address > &vec, std::vector< Ipv4Address > &vec2)
Check if the two vectors contain duplicate or not.
Ptr< dsr::RouteCache > m_routeCache
The route cache table.
Ptr< Node > GetNodeWithAddress(Ipv4Address ipv4Address)
Get the node object with Ipv4Address.
static TypeId GetTypeId()
Get the type identificator.
virtual uint8_t Process(Ptr< Packet > packet, Ptr< Packet > dsrP, Ipv4Address ipv4Address, Ipv4Address source, Ipv4Header const &ipv4Header, uint8_t protocol, bool &isPromisc, Ipv4Address promiscSource)
Process method.
Ptr< dsr::RouteCache > m_routeCache
The route cache.
a unique identifier for an interface.
Ptr< dsr::RouteCache > m_routeCache
The route cache.
std::vector< Ipv4Address > CutRoute(Ipv4Address ipv4Address, std::vector< Ipv4Address > &nodeList)
Cut the route from ipv4Address to the end of the route vector.
virtual uint8_t GetOptionNumber() const
Get the option number.
static TypeId GetTypeId()
Get the type identificator.
virtual uint8_t GetOptionNumber() const
Get the option number.