From 46f0a8a0b14539d1c1341bc5c39e7257fbd3d5b9 Mon Sep 17 00:00:00 2001 From: Mohamed Amine Ismail Date: Tue, 16 Mar 2010 14:29:08 +0100 Subject: [PATCH] Enabling pcap tracing in examples/wimax/wimax-simlpe.cc --- examples/wimax/wimax-simple.cc | 6 ++++-- src/devices/wimax/bs-net-device.cc | 4 ---- src/devices/wimax/mac-messages.h | 25 ++++++++++++---------- src/devices/wimax/simple-ofdm-wimax-phy.cc | 4 +++- src/devices/wimax/simple-ofdm-wimax-phy.h | 2 +- src/devices/wimax/ss-net-device.cc | 3 +-- src/helper/wimax-helper.cc | 17 ++++++--------- 7 files changed, 30 insertions(+), 31 deletions(-) diff --git a/examples/wimax/wimax-simple.cc b/examples/wimax/wimax-simple.cc index 449588f1b..2d941190f 100644 --- a/examples/wimax/wimax-simple.cc +++ b/examples/wimax/wimax-simple.cc @@ -153,8 +153,10 @@ int main (int argc, char *argv[]) clientApps.Stop (Seconds (duration)); Simulator::Stop (Seconds (duration + 0.1)); - wimax.EnablePcap("ss0", ssNodes.Get (0)->GetId (), ss[0]->GetIfIndex ()); - wimax.EnablePcap("ss1", ssNodes.Get (0)->GetId (), ss[0]->GetIfIndex ()); + + wimax.EnablePcap ("wimax-simple-ss0", ssNodes.Get (0)->GetId (), ss[0]->GetIfIndex ()); + wimax.EnablePcap ("wimax-simple-ss1", ssNodes.Get (1)->GetId (), ss[1]->GetIfIndex ()); + wimax.EnablePcap ("wimax-simple-bs0", bsNodes.Get (0)->GetId (), bs->GetIfIndex ()); IpcsClassifierRecord DlClassifierUgs (Ipv4Address ("0.0.0.0"), Ipv4Mask ("0.0.0.0"), diff --git a/src/devices/wimax/bs-net-device.cc b/src/devices/wimax/bs-net-device.cc index 26212a419..4244aba01 100644 --- a/src/devices/wimax/bs-net-device.cc +++ b/src/devices/wimax/bs-net-device.cc @@ -594,16 +594,12 @@ BaseStationNetDevice::DoSend (Ptr packet, Ptr burst = Create (); ServiceFlow *serviceFlow = 0; - // drop packet if no SS is registered with the BS, the destination SS is not yet registered or if queue is full - NS_LOG_INFO ("BS (" << source << "):"); NS_LOG_INFO ("\tSending packet..."); NS_LOG_INFO ("\t\tDestination: " << dest); NS_LOG_INFO ("\t\tPaket Size: " << packet->GetSize ()); NS_LOG_INFO ("\t\tProtocol: " << protocolNumber); - NS_LOG_INFO ("TraceDelay: TX (BS), To: " << dest << ", Uid: " << packet->GetUid () << ", time: " - << (Simulator::Now ()).GetSeconds () << ", Packet Size: " << packet->GetSize ()); if (protocolNumber == 2048) { diff --git a/src/devices/wimax/mac-messages.h b/src/devices/wimax/mac-messages.h index 578304b4d..189b9a8a3 100644 --- a/src/devices/wimax/mac-messages.h +++ b/src/devices/wimax/mac-messages.h @@ -38,19 +38,22 @@ namespace ns3 { class ManagementMessageType : public Header { public: + /* + * Section 6.3.2.3 MAC Management messages page 42, Table 14 page 43 + */ enum MessageType { - MESSAGE_TYPE_DL_MAP, - MESSAGE_TYPE_DCD, - MESSAGE_TYPE_UL_MAP, - MESSAGE_TYPE_UCD, - MESSAGE_TYPE_RNG_REQ, - MESSAGE_TYPE_RNG_RSP, - MESSAGE_TYPE_REG_REQ, - MESSAGE_TYPE_REG_RSP, - MESSAGE_TYPE_DSA_REQ, - MESSAGE_TYPE_DSA_RSP, - MESSAGE_TYPE_DSA_ACK + MESSAGE_TYPE_UCD = 0, + MESSAGE_TYPE_DCD = 1, + MESSAGE_TYPE_DL_MAP = 2, + MESSAGE_TYPE_UL_MAP = 3, + MESSAGE_TYPE_RNG_REQ = 4, + MESSAGE_TYPE_RNG_RSP = 5, + MESSAGE_TYPE_REG_REQ = 6, + MESSAGE_TYPE_REG_RSP = 7, + MESSAGE_TYPE_DSA_REQ = 11, + MESSAGE_TYPE_DSA_RSP = 12, + MESSAGE_TYPE_DSA_ACK = 13 }; ManagementMessageType (void); diff --git a/src/devices/wimax/simple-ofdm-wimax-phy.cc b/src/devices/wimax/simple-ofdm-wimax-phy.cc index 04d7e55dd..4ba774217 100644 --- a/src/devices/wimax/simple-ofdm-wimax-phy.cc +++ b/src/devices/wimax/simple-ofdm-wimax-phy.cc @@ -241,6 +241,7 @@ SimpleOfdmWimaxPhy::Send (SendParams *params) Send (o_params->GetBurst (), (WimaxPhy::ModulationType) o_params->GetModulationType (), o_params->GetDirection ()); + } WimaxPhy::PhyType @@ -263,6 +264,7 @@ SimpleOfdmWimaxPhy::Send (Ptr burst, SetBlockParameters (burst->GetSize (), modulationType); CreateFecBlocks (buffer, modulationType); StartSendFecBlock (true, modulationType, direction); + m_traceTx (burst); } } @@ -459,8 +461,8 @@ void SimpleOfdmWimaxPhy::EndReceive (Ptr burst) { Ptr b = burst->Copy (); - m_traceRx (burst); GetReceiveCallback () (b); + m_traceRx (burst); } bvec diff --git a/src/devices/wimax/simple-ofdm-wimax-phy.h b/src/devices/wimax/simple-ofdm-wimax-phy.h index 8f0d96944..6787aec95 100644 --- a/src/devices/wimax/simple-ofdm-wimax-phy.h +++ b/src/devices/wimax/simple-ofdm-wimax-phy.h @@ -232,7 +232,7 @@ private: Time m_blockTime; TracedCallback > m_traceRx; - TracedCallback, WimaxPhy::ModulationType, uint16_t, uint16_t> m_traceTx; + TracedCallback > m_traceTx; // data rates for this Phy uint32_t m_dataRateBpsk12, m_dataRateQpsk12, m_dataRateQpsk34, m_dataRateQam16_12, m_dataRateQam16_34, diff --git a/src/devices/wimax/ss-net-device.cc b/src/devices/wimax/ss-net-device.cc index 3283b2c50..6bbf1bfa9 100644 --- a/src/devices/wimax/ss-net-device.cc +++ b/src/devices/wimax/ss-net-device.cc @@ -1031,8 +1031,7 @@ SubscriberStationNetDevice::DoReceive (Ptr packet) // This is the first or middle fragment. // Take the fragment queue, store the fragment into the queue NS_LOG_INFO ( "\t Received the first or the middle fragment" << std::endl); - GetConnectionManager ()->GetConnection (cid) - ->FragmentEnqueue (packet); + GetConnectionManager ()->GetConnection (cid)->FragmentEnqueue (packet); } } } diff --git a/src/helper/wimax-helper.cc b/src/helper/wimax-helper.cc index 98486e681..96a35a510 100644 --- a/src/helper/wimax-helper.cc +++ b/src/helper/wimax-helper.cc @@ -534,19 +534,16 @@ WimaxHelper::EnableAsciiInternal (Ptr stream, EnableAsciiForConnection (stream, nodeid, deviceid, (char*) "SubscriberStationNetDevice", (char*) "BasicConnection"); EnableAsciiForConnection (stream, nodeid, deviceid, (char*) "SubscriberStationNetDevice", (char*) "PrimaryConnection"); - } +} static void PcapSniffTxEvent (Ptr file, - Ptr burst, - WimaxPhy::ModulationType modulationType, - uint16_t m_nrBlocks, - uint16_t m_blockSize) + Ptr burst) { std::list > packets = burst->GetPackets (); for (std::list >::iterator iter = packets.begin (); iter != packets.end (); ++iter) { - WimaxMacToMacHeader m2m((*iter)->GetSize()); - (*iter)->AddHeader(m2m); + WimaxMacToMacHeader m2m ((*iter)->GetSize ()); + (*iter)->AddHeader (m2m); file->Write (Simulator::Now (), (*iter)); } } @@ -556,8 +553,8 @@ static void PcapSniffRxEvent (Ptr file, Ptr std::list > packets = burst->GetPackets (); for (std::list >::iterator iter = packets.begin (); iter != packets.end (); ++iter) { - WimaxMacToMacHeader m2m((*iter)->GetSize()); - (*iter)->AddHeader(m2m); + WimaxMacToMacHeader m2m ((*iter)->GetSize ()); + (*iter)->AddHeader (m2m); file->Write (Simulator::Now (), (*iter)); } } @@ -568,7 +565,7 @@ WimaxHelper::EnablePcapInternal (std::string prefix, Ptr nd, bool exp // // All of the Pcap enable functions vector through here including the ones // that are wandering through all of devices on perhaps all of the nodes in - // the system. We can only deal with devices of type WifiNetDevice. + // the system. We can only deal with devices of type WimaxNetDevice. // Ptr device = nd->GetObject (); if (device == 0)