remove extra WifiPhy::SendPacket argument. Add header mode support
--- a/src/devices/wifi/mac-parameters.cc Mon Oct 08 17:04:34 2007 +0200
+++ b/src/devices/wifi/mac-parameters.cc Tue Oct 09 10:21:46 2007 +0200
@@ -50,13 +50,13 @@
WifiMacHeader hdr;
hdr.SetType (WIFI_MAC_CTL_CTS);
m_ctsTimeout = m_sifs;
- m_ctsTimeout += phy->CalculateTxDuration (hdr.GetSize (), phy->GetMode (0));
+ m_ctsTimeout += phy->CalculateTxDuration (hdr.GetSize (), phy->GetMode (0), phy->GetMode (0));
m_ctsTimeout += m_maxPropagationDelay * Scalar (2);
m_ctsTimeout += m_slot;
hdr.SetType (WIFI_MAC_CTL_ACK);
m_ackTimeout = m_sifs;
- m_ackTimeout += phy->CalculateTxDuration (hdr.GetSize (), phy->GetMode (0));
+ m_ackTimeout += phy->CalculateTxDuration (hdr.GetSize (), phy->GetMode (0), phy->GetMode (0));
m_ackTimeout += m_maxPropagationDelay * Scalar (2);
m_ackTimeout += m_slot;
}
--- a/src/devices/wifi/wifi-channel.cc Mon Oct 08 17:04:34 2007 +0200
+++ b/src/devices/wifi/wifi-channel.cc Tue Oct 09 10:21:46 2007 +0200
@@ -30,12 +30,11 @@
namespace ns3 {
WifiChannel::ReceiveData::ReceiveData (const Packet &packet, double rxPowerDbm,
- WifiMode txMode, WifiMode headerMode, uint32_t extra)
+ WifiMode txMode, WifiMode headerMode)
: m_packet (packet),
m_rxPowerDbm (rxPowerDbm),
m_wifiMode (txMode),
- m_headerMode (headerMode),
- m_extra (extra)
+ m_headerMode (headerMode)
{}
@@ -62,7 +61,7 @@
}
void
WifiChannel::Send (Ptr<NetDevice> sender, const Packet &packet, double txPowerDbm,
- WifiMode wifiMode, WifiMode headerMode, uint32_t extra) const
+ WifiMode wifiMode, WifiMode headerMode) const
{
Ptr<MobilityModel> senderMobility = sender->GetNode ()->QueryInterface<MobilityModel> (MobilityModel::iid);
uint32_t j = 0;
@@ -74,7 +73,7 @@
double distance = senderMobility->GetDistanceFrom (receiverMobility);
Time delay = m_delay->GetDelay (distance);
double rxPowerDbm = m_loss->GetRxPower (txPowerDbm, distance);
- struct ReceiveData data = ReceiveData (packet, rxPowerDbm, wifiMode, headerMode, extra);
+ struct ReceiveData data = ReceiveData (packet, rxPowerDbm, wifiMode, headerMode);
Simulator::Schedule (delay, &WifiChannel::Receive, this,
j, data);
}
@@ -86,7 +85,7 @@
WifiChannel::Receive (uint32_t i,
const struct ReceiveData &data) const
{
- m_deviceList[i].second (data.m_packet, data.m_rxPowerDbm, data.m_wifiMode, data.m_headerMode, data.m_extra);
+ m_deviceList[i].second (data.m_packet, data.m_rxPowerDbm, data.m_wifiMode, data.m_headerMode);
}
uint32_t
--- a/src/devices/wifi/wifi-channel.h Mon Oct 08 17:04:34 2007 +0200
+++ b/src/devices/wifi/wifi-channel.h Tue Oct 09 10:21:46 2007 +0200
@@ -35,7 +35,7 @@
class WifiChannel : public Channel
{
public:
- typedef Callback<void,Packet,double,WifiMode,WifiMode,uint32_t> ReceiveCallback;
+ typedef Callback<void,Packet,double,WifiMode,WifiMode> ReceiveCallback;
WifiChannel ();
virtual ~WifiChannel ();
@@ -47,18 +47,17 @@
void Add (Ptr<NetDevice> device, ReceiveCallback callback);
void Send (Ptr<NetDevice> sender, const Packet &packet, double txPowerDbm,
- WifiMode wifiMode, WifiMode headerMode, uint32_t extra) const;
+ WifiMode wifiMode, WifiMode headerMode) const;
private:
typedef std::vector<std::pair<Ptr<NetDevice>, ReceiveCallback> > DeviceList;
struct ReceiveData {
ReceiveData (const Packet &packet, double rxPowerDbm,
- WifiMode txMode, WifiMode headerMode, uint32_t extra);
+ WifiMode txMode, WifiMode headerMode);
Packet m_packet;
double m_rxPowerDbm;
WifiMode m_wifiMode;
WifiMode m_headerMode;
- uint32_t m_extra;
};
void Receive (uint32_t i,
const struct ReceiveData &data) const;
--- a/src/devices/wifi/wifi-phy.cc Mon Oct 08 17:04:34 2007 +0200
+++ b/src/devices/wifi/wifi-phy.cc Tue Oct 09 10:21:46 2007 +0200
@@ -246,10 +246,9 @@
WifiPhy::ReceivePacket (Packet const packet,
double rxPowerW,
WifiMode txMode,
- WifiMode headerMode,
- uint32_t extra)
+ WifiMode headerMode)
{
- Time rxDuration = CalculateTxDuration (packet.GetSize (), txMode);
+ Time rxDuration = CalculateTxDuration (packet.GetSize (), txMode, headerMode);
Time endRx = Simulator::Now () + rxDuration;
m_startRxLogger (rxDuration, rxPowerW);
@@ -288,8 +287,7 @@
assert (m_endSyncEvent.IsExpired ());
m_endSyncEvent = Simulator::Schedule (rxDuration, &WifiPhy::EndSync, this,
packet,
- event,
- extra);
+ event);
}
else
{
@@ -337,7 +335,7 @@
event->Unref ();
}
void
-WifiPhy::SendPacket (Packet const packet, WifiMode txMode, WifiMode headerMode, uint8_t txPower, uint32_t stuff)
+WifiPhy::SendPacket (Packet const packet, WifiMode txMode, WifiMode headerMode, uint8_t txPower)
{
/* Transmission can happen if:
* - we are syncing on a packet. It is the responsability of the
@@ -351,11 +349,11 @@
m_endSyncEvent.Cancel ();
}
- Time txDuration = CalculateTxDuration (packet.GetSize (), txMode);
+ Time txDuration = CalculateTxDuration (packet.GetSize (), txMode, headerMode);
m_startTxLogger (txDuration, txMode.GetPhyRate (), GetPowerDbm (txPower));
NotifyTxStart (txDuration);
SwitchToTx (txDuration);
- m_channel->Send (m_device, packet, GetPowerDbm (txPower) + m_txGainDbm, txMode, headerMode, stuff);
+ m_channel->Send (m_device, packet, GetPowerDbm (txPower) + m_txGainDbm, txMode, headerMode);
}
void
@@ -519,10 +517,10 @@
Time
-WifiPhy::CalculateTxDuration (uint32_t size, WifiMode payloadMode) const
+WifiPhy::CalculateTxDuration (uint32_t size, WifiMode payloadMode, WifiMode headerMode) const
{
uint64_t delay = m_plcpPreambleDelayUs;
- delay += m_plcpHeaderLength * 1000000 / GetMode (0).GetDataRate ();
+ delay += m_plcpHeaderLength * 1000000 / headerMode.GetDataRate ();
uint64_t nbits = size * 8;
delay += nbits * 1000000 / payloadMode.GetDataRate ();
return MicroSeconds (delay);
@@ -1164,7 +1162,7 @@
void
-WifiPhy::EndSync (Packet const packet, Ptr<RxEvent> event, uint32_t extra)
+WifiPhy::EndSync (Packet const packet, Ptr<RxEvent> event)
{
assert (IsStateSync ());
assert (event->GetEndTime () == Simulator::Now ());
@@ -1188,7 +1186,7 @@
m_endSyncLogger (true);
NotifySyncEndOk ();
SwitchFromSync ();
- m_syncOkCallback (packet, snr, event->GetPayloadMode (), event->GetHeaderMode (), extra);
+ m_syncOkCallback (packet, snr, event->GetPayloadMode (), event->GetHeaderMode ());
}
else
{
--- a/src/devices/wifi/wifi-phy.h Mon Oct 08 17:04:34 2007 +0200
+++ b/src/devices/wifi/wifi-phy.h Tue Oct 09 10:21:46 2007 +0200
@@ -71,7 +71,7 @@
class WifiPhy
{
public:
- typedef Callback<void,Packet const , double, WifiMode, WifiMode, uint32_t> SyncOkCallback;
+ typedef Callback<void,Packet const , double, WifiMode, WifiMode> SyncOkCallback;
typedef Callback<void,Packet const , double> SyncErrorCallback;
WifiPhy (Ptr<WifiNetDevice> device);
@@ -82,7 +82,7 @@
void SetReceiveOkCallback (SyncOkCallback callback);
void SetReceiveErrorCallback (SyncErrorCallback callback);
- void SendPacket (Packet const packet, WifiMode mode, WifiMode headeMode, uint8_t txPower, uint32_t stuff);
+ void SendPacket (Packet const packet, WifiMode mode, WifiMode headerMode, uint8_t txPower);
void RegisterListener (WifiPhyListener *listener);
@@ -94,7 +94,7 @@
Time GetStateDuration (void);
Time GetDelayUntilIdle (void);
- Time CalculateTxDuration (uint32_t size, WifiMode payloadMode) const;
+ Time CalculateTxDuration (uint32_t size, WifiMode payloadMode, WifiMode headerMode) const;
void Configure80211a (void);
void SetEdThresholdDbm (double rxThreshold);
@@ -157,7 +157,7 @@
double CalculateSnr (double signal, double noiseInterference, WifiMode mode) const;
double CalculateChunkSuccessRate (double snir, Time delay, WifiMode mode) const;
double CalculatePer (Ptr<const RxEvent> event, NiChanges *ni) const;
- void EndSync (Packet const packet, Ptr<RxEvent> event, uint32_t stuff);
+ void EndSync (Packet const packet, Ptr<RxEvent> event);
double Log2 (double val) const;
double GetBpskBer (double snr, uint32_t signalSpread, uint32_t phyRate) const;
double GetQamBer (double snr, unsigned int m, uint32_t signalSpread, uint32_t phyRate) const;
@@ -179,8 +179,7 @@
void ReceivePacket (Packet packet,
double rxPowerW,
WifiMode mode,
- WifiMode headerMode,
- uint32_t stuff);
+ WifiMode headerMode);
private:
uint64_t m_txPrepareDelayUs;
uint64_t m_plcpPreambleDelayUs;