[Ns-developers] spectrum modeling and wifi device

Nicola Baldo nbaldo at cttc.es
Tue Feb 24 06:37:55 PST 2009


Hi all,

I am trying to add a new object between the phy and the channel for the 
purpose of modeling the usage of the radio spectrum by wireless devices.

Looking at the code for the wifi device in the latest ns-3-dev, I see 
that YansWifiPhy and YansChannel depend on each other, since:

a) YansWifiPhy owns a pointer to YansWifiChannel, which is used to call 
YansWifiChannel::Send()

b) YansWifiChannel keeps a list of pointers to all attached YansWifiPhy 
instances, which is used to call YansWifiPhy::StartReceivePacket() and 
YansWifiPhy::GetDevice ()->GetObject<NetDevice>()


I was planning to remove the dependency between YansWifiPhy and 
YansChannel by doing the following:


1) defining the following callbacks:

typedef Callback(Ptr<Packet>, double, WifiMode, WifiPreamble) 
StartReceiveCallback;

typedef Callback(Ptr<Packet>, double, WifiMode, WifiPreamble) 
StartSendCallback;


2) changing YansWifiChannel::Add() to the following:

YansWifiChannel::Add(Ptr<NetDevice>,  StartReceiveCallback)

so that the channel can keep only a list of devices and callbacks which 
are to be called for the delivery of packets;


3)  replacing  YansWifiPhy::SetChannel() with the following method:

YansWifiPhy::SetStartSendCallback(StartSendCallback)


What do you think of this approach? Would you accept a patch with these 
changes?


Regards,


Nicola








More information about the Ns-developers mailing list