Hello, I have two questions.The first one is regarding multiple APs on one node. Usually an AP is able to host several SSIDs. I want to replicate that, but not only have two SSIDs, but communication between the APs hosting them.For example: AP 0.1 is a normal SSID with a lot of users. AP 0.2 is the other SSID, let"s say it is hidden, and just used to communicate some internal stuff. What I want now is if AP 0.2 has access to statistics of AP 0.1.I know that two APs on one node are easy realisable through two NetDevices. But are those two NetDevices somehow able to communicate without the communication leaving the node? Which means, not using the network.One example would be the number of clients that are connected to AP 0.1. Can AP 0.2 know that somehow? Or is it possible to transmit it? Every idea is welcome.
The second question is regarding the behaviour of a Wifi client. Usually a client checks every channel for networks and is able to switch between channels. I want to replicate this behaviour and use it in my simulation. The answers that I found during my search how to realise that, are all a few years old and leave some questions open. One proposes to use WifiPhy and use the channels saved there, but it somehow does not work for the person proposing this. The other proposition recommends using multiple NetDevices on the clients and somehow switch between them, while only having one activated.My first question would be, if this behaviour is implemented by now? And if not, what would the best and most reasonable way to implement it if I want to have as little code as possible in my topology model and most of it directly in the client implementation? Again, every idea is welcome.
Easy cheesy. You can access the "other" NetDevice easily (just ask the IP layer about the pointer to the other NetDevice. or you can store the NetDevice smart pointer in a manager object. I don't know what's the structure of your node, but it's definitely possible.
What I don't know is if there's a ready-made object implementing the logic:
- scan the channels
- grab the beacons
- if the SSID is in the "list of known SSIDs", try to associate
-- if success , stop
-- if fail, continue scanning
It shouldn't be too hard to develop one.
Easy cheesy. You can access the "other" NetDevice easily (just ask the IP layer about the pointer to the other NetDevice. or you can store the NetDevice smart pointer in a manager object. I don't know what's the structure of your node, but it's definitely possible.I already tried to do something similar for the smart pointer as with for example the active probing attribute. Then I should have a pointer to the other NetDevice on one NetDevice. Probably a bad solution, but it seemed worth a try. But I'm somehow stuck. I'm not sure what I should do with the NetDevice then and how to access the functions in the AP implementation. I'm probably missing something simple or confusing something. My mind is somewhat blank, sorry. Could you post a very simple example?
What I don't know is if there's a ready-made object implementing the logic:
- scan the channels
- grab the beacons
- if the SSID is in the "list of known SSIDs", try to associate
-- if success , stop
-- if fail, continue scanning
It shouldn't be too hard to develop one.That sounds promising. So I need to use one Channel Object with several channel numbers. If I'm not mistaken then the available channel numbers should be accessable through the corresponding Phy Object?I would assume it would be implemented in StaWifiMac. The rest of the logic is also implemented there and it would make sense to have it in this class. It would be one more state that represents the scanning and a bit of logic.
DynamicCast<YansWifiPhy> (m_phy)
Let's assume you have a "Monitor" object, and you did associate it with the node.
Class Monitor: public Object
{
...
public:
void SetMainNetDevice (Ptr<NetDevice> mainNetDevice);
void SetControlNetDevice (Ptr<NetDevice> controlNetDevice);
...
}
You can write an Helper for this class or you can simply create an instance (Create<Monitor> monitor) and aggregate it with the node (node->AggregateObject (monitor)).
To be honest you could as well avoid to aggregate it with the node, but it's better to do it. It's a bit more code to write, but you'll be safer in the object destroy phase.
Once you have this, the "monitor" will have access to both NetDevices.
The problem in having the Ptr of one NetDevice in the other one are:
1) object deallocation may get messy, and
2) it's not simple to do it (who said you have to create one interface before the other?)
About what to do with the NetDevice, I'm sorry but I can't help with this. It's your algorithm, so I can't really help.
The channel number is in YansWifiPhy (see SetChannelNumber and GetChannelNumber). You can access YansWifiPhy from StaWifiMac through:DynamicCast<YansWifiPhy> (m_phy)
The DynamicCast is necessary because m_phy is of the base class.
Let's assume you have a "Monitor" object, and you did associate it with the node.
Class Monitor: public Object
{
...
public:
void SetMainNetDevice (Ptr<NetDevice> mainNetDevice);
void SetControlNetDevice (Ptr<NetDevice> controlNetDevice);
...
}
You can write an Helper for this class or you can simply create an instance (Create<Monitor> monitor) and aggregate it with the node (node->AggregateObject (monitor)).
To be honest you could as well avoid to aggregate it with the node, but it's better to do it. It's a bit more code to write, but you'll be safer in the object destroy phase.
Once you have this, the "monitor" will have access to both NetDevices.
The problem in having the Ptr of one NetDevice in the other one are:
1) object deallocation may get messy, and
2) it's not simple to do it (who said you have to create one interface before the other?)
About what to do with the NetDevice, I'm sorry but I can't help with this. It's your algorithm, so I can't really help.
DynamicCast<ApWifiMac> GetMac ()-> GetStatistics ()
it seems a good start, and I'd advise to move the discussion to ns-dev mailing list. Also, Daniel should be involved (he's the wifi module maintainer).
Some suggestion for the enhancement:
1) the channel scanning is searching for a specific SSID if I understand the code. This may be discussed further (e.g., have a list of allowed SSIDs or accept any).
2) some functionalities are assuming that the MAC object is of type YansWifiMac. Probably we should move some functions to the base class. E.g., why SetChannel isn't in the WifiMac base class ?
Ptr<Monitor> monitor = DynamicCast<YansWifiPhy> (m_phy)->GetDevice ()->GetObject<NetDevice> ()->GetNode ()->GetMonitor ();
Ptr<ApWifiMac> otherAP = DynamicCast<ApWifiMac> (DynamicCast<WifiNetDevice> (monitor->GetMainNetDevice ())->GetMac ());
I'll see if I can take a look at the problem.
About your question in the other post... I meant the ns-developers mailing list, the link is here:
http://www.nsnam.org/support/mailing-list/
I did a quick check. There are some things I would have done differently, but nothing we can't iron out in a code review.
About the strange effect you mentioned, yes, it's collisions. I noticed that the probing done by the non-associated nodes is... massive, and it may be worth checking if it's done too fast. Perhaps it's a bug.
As a side note, the pcap file seems to include ANY packet seen by the NetDevice, regardless of the channel number. Also this may be classified as a bug. I'll have to check it a bit better.