AodvProtocol in progress, doesn't work
This commit is contained in:
@@ -247,6 +247,7 @@ Ipv4RawSocketImpl::ForwardUp (Ptr<const Packet> p, Ipv4Header ipHeader, Ptr<NetD
|
||||
{
|
||||
return false;
|
||||
}
|
||||
NS_LOG_LOGIC ("src = " << m_src << " dst = " << m_dst);
|
||||
if ((m_src == Ipv4Address::GetAny () || ipHeader.GetDestination () == m_src) &&
|
||||
(m_dst == Ipv4Address::GetAny () || ipHeader.GetSource () == m_dst) &&
|
||||
ipHeader.GetProtocol () == m_protocol)
|
||||
|
||||
@@ -247,8 +247,12 @@ RoutingProtocol::Start ()
|
||||
NS_LOG_INFO ("Interface " << iface << " used by AODV");
|
||||
|
||||
// Add local broadcast record to the routing table
|
||||
aodv_rt_entry rt(/*dst=*/iface.GetBroadcast (), /*know seqno=*/true, /*seqno=*/0,
|
||||
/*hops=*/1, /*next hop=*/iface.GetBroadcast (), /*lifetime=*/Seconds(1e9)); // TODO use infty
|
||||
aodv_rt_entry rt(/*dst=*/iface.GetBroadcast (),
|
||||
/*know seqno=*/true, /*seqno=*/0,
|
||||
/*iface=*/iface.GetLocal (),
|
||||
/*hops=*/1,
|
||||
/*next hop=*/iface.GetBroadcast (),
|
||||
/*lifetime=*/Seconds(1e9)); // TODO use infty
|
||||
rtable.rt_add (rt);
|
||||
}
|
||||
}
|
||||
@@ -656,6 +660,7 @@ RoutingProtocol::SendRequest (Ipv4Address dst, bool G, bool D)
|
||||
udpHeader.SetSourcePort (AODV_PORT);
|
||||
udpHeader.SetDestinationPort (AODV_PORT);
|
||||
|
||||
|
||||
// Create RREQ header
|
||||
TypeHeader tHeader (AODVTYPE_RREQ);
|
||||
RreqHeader rreqHeader;
|
||||
@@ -702,6 +707,9 @@ RoutingProtocol::SendRequest (Ipv4Address dst, bool G, bool D)
|
||||
packet->AddHeader (udpHeader);
|
||||
packet->AddHeader (ipv4Header);
|
||||
|
||||
udpHeader.Print (std::cout);
|
||||
std::cout << "\n";
|
||||
|
||||
socket->Send (packet);
|
||||
}
|
||||
// htimer.SetDelay(HELLO_INTERVAL);
|
||||
|
||||
@@ -54,12 +54,13 @@ aodv_rt_entry::aodv_rt_entry()
|
||||
}
|
||||
|
||||
aodv_rt_entry::aodv_rt_entry(Ipv4Address dst, bool vSeqNo, u_int32_t seqNo,
|
||||
u_int16_t hops,Ipv4Address nextHop, Time lifetime)
|
||||
Ipv4Address iface, u_int16_t hops, Ipv4Address nextHop, Time lifetime)
|
||||
{
|
||||
rt_dst = dst;
|
||||
validSeqNo = vSeqNo;
|
||||
if (validSeqNo) rt_seqno = seqNo;
|
||||
rt_hops = hops;
|
||||
interface = iface;
|
||||
rt_nexthop = nextHop;
|
||||
rt_lifetime = lifetime;
|
||||
}
|
||||
@@ -177,7 +178,7 @@ AodvRtableTest::RunTests ()
|
||||
aodv_rt_entry entry1;
|
||||
Ipv4Address dst1("3.3.3.3");
|
||||
Ipv4Address dst2("1.2.3.4");
|
||||
aodv_rt_entry entry2 = aodv_rt_entry(dst2, true, 34, 1, Ipv4Address("5.5.5.5"), Seconds(5));
|
||||
aodv_rt_entry entry2 = aodv_rt_entry(dst2, true, 34, Ipv4Address("2.3.4.5"), 1, Ipv4Address("5.5.5.5"), Seconds(5));
|
||||
NS_TEST_ASSERT( !(entry1 == dst1) );
|
||||
NS_TEST_ASSERT(entry2 == dst2);
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <map>
|
||||
#include <sys/types.h>
|
||||
#include "ns3/ipv4.h"
|
||||
#include "ns3/nstime.h"
|
||||
#include "ns3/ipv4-address.h"
|
||||
#include "ns3/nstime.h"
|
||||
|
||||
namespace ns3 {
|
||||
@@ -47,8 +47,9 @@ class aodv_rt_entry
|
||||
{
|
||||
public:
|
||||
aodv_rt_entry();
|
||||
aodv_rt_entry(Ipv4Address dst, bool vSeqNo, u_int32_t seqNo,
|
||||
u_int16_t hops,Ipv4Address nextHop, Time lifetime);
|
||||
// TODO add all members to c-tor
|
||||
aodv_rt_entry(Ipv4Address dst, bool vSeqNo, u_int32_t seqNo, Ipv4Address iface,
|
||||
u_int16_t hops, Ipv4Address nextHop, Time lifetime);
|
||||
~aodv_rt_entry();
|
||||
|
||||
///\name Precursors management
|
||||
|
||||
Reference in New Issue
Block a user