Thanks Kontantinos. Your answers have been really helpful. I have few
more doubts.
First : If I write anything to socket of a node using below code. Will
RouteOutput() be automatically invoked while socket->Send is being
called?
***************************************************************************************
TypeId tid = TypeId::LookupByName ("ns3::UdpSocketFactory");
Ptr<Socket> source = Socket::CreateSocket (m_NodeContainer.Get
(sourceNode), tid);
InetSocketAddress remote = InetSocketAddress (Ipv4Address
("255.255.255.255"), 80);
source->SetAllowBroadcast (true);
source->Connect (remote);
socket->Send (packet); //where packet is some packet
***************************************************************************************
Second: If I create all the nodes in my simulation to act as receive
sinks. Then as soon as the source node above broadcasts a packet, all
the nodes will receive it (Assume all nodes are in the radio range of
source node). And does that mean RouteInput() will be automatically
invoked for each node upon reception of packet?
***************************************************************************************
for(int i = 0; i < numberOfNodes; i++)
{
Ptr<Socket> recvSink = Socket::CreateSocket (m_NodeContainer.Get (i),
tid);
InetSocketAddress local = InetSocketAddress (Ipv4Address::GetAny (),
80);
recvSink->Bind (local);
recvSink->SetRecvCallback (MakeCallback (&ReceivePacket, this));
}
***************************************************************************************
Please let me know.
Thanks,
Megha
--
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To post to this group, send email to ns-3-...@googlegroups.com.
To unsubscribe from this group, send email to ns-3-users+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ns-3-users?hl=en.
Thanks Lalith for the explanation. I have one more doubt.
Consider there are 2 nodes in the simulation which are in the radio
range of one another.
At t=0, first node sends a packet to second node. Since destination
address is second node, in this case RouteOutput() will be invoked (I
have created a new protocol ‘Test’ in the src folder). Since my second
node is in the range of first node, how RouteOutput() will forward the
packet to destination? In my logs I am able to see that RouteOutput()
is invoked, and I am not doing anything in RouteOutput() as I don’t
need to route since destination is in my radio range. But packet is
not reaching the destination and neither RouteInput() is being called.
I am not using OLSR. I have created a new protocol 'test' in the src
folder. I am trying to figure out how RouteOutput forwards packet to
the lower layers when both the nodes: source and destination are in
the radio range of each other.
As per Konstantinos reply, looks like I have to send the packet to
WifiDevice interface #0 of my source node.
One of the arguments of RouteOutput() is Ptr<NetDevice> oif. But I am
not sure how can I use it to send the packet down to lower layers.
Thanks,
Megha
--
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To post to this group, send email to ns-3-...@googlegroups.com.
To unsubscribe from this group, send email to ns-3-users+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ns-3-users?hl=en.
> Question: why not do the "if(epidemicHeader.GetDst() == m_mainAddress)"epidemicHeader.GetDst()shows garbage value if I try to get the value
> check within RouteInput(), correct the destination port, and invoke lcb()
> from there directly without getting the packet to RecvEpidemic()?
at RouteInput(). May be it's not the correct layer where I can read
epidemicHeader. I can only read epidemicHeader correctly when the
callback RecvEpidemic is invoked. Any thoughts on this?
And also since RouteInput() is invoked at network layer, is port
information accessible at this layer?
Thanks,
Megha
On Nov 17, 4:27 am, Lalith Suresh <suresh.lal...@gmail.com> wrote:
Hi Lalith, Here you suggested to correct the destination port. Can you
please guide me how I can correct the destination port in RouteInput()
method? I tried looking at doxygen and user group but didn't find
anything on how port can be updated.
And also since RouteInput() is invoked at network layer, is port
information accessible at this layer?
Ipv4ListRoutingHelper list;
list.Add(staticRouting, 0);
InternetStackHelper internet;
internet.SetRoutingHelper(list); // has effect on the next Install()
internet.Install(c);
internet.Install(q);
Ipv4AddressHelper ipv4;
NS_LOG_INFO("Assign IP Addresses.");
ipv4.SetBase("10.1.1.0", "255.255.255.0");
Ipv4InterfaceContainer i = ipv4.Assign(devices3);
YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default();
WifiHelper wifi = WifiHelper::Default();
NqosWifiMacHelper mac = NqosWifiMacHelper::Default();
wifi.SetRemoteStationManager("ns3::AarfWifiManager");
wifiPhy.SetPcapDataLinkType(YansWifiPhyHelper::DLT_IEEE802_11_RADIO);
YansWifiChannelHelper wifiChannel;
wifiChannel.SetPropagationDelay("ns3::ConstantSpeedPropagationDelayModel");
wifiChannel.AddPropagationLoss("ns3::RangePropagationLossModel", "MaxRange",
DoubleValue(100.0));
wifiPhy.SetChannel(wifiChannel.Create());
NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default();
wifi.SetStandard(WIFI_PHY_STANDARD_80211b);
wifi.SetRemoteStationManager("ns3::ConstantRateWifiManager", "DataMode",
StringValue(phyMode), "ControlMode", StringValue(phyMode));
wifiMac.SetType("ns3::AdhocWifiMac");
NetDeviceContainer devices = wifi.Install(wifiPhy, wifiMac, c);
NetDeviceContainer devices2 = wifi.Install(wifiPhy, wifiMac, q);
I read the link that you mentioned but I couldn't find out how to change node's wifi range, if it's possible for you just give me one example of how to do it.