# HG changeset patch # User Mathieu Lacage # Date 1208300034 25200 # Node ID fa0747c4ad5ee44af11a95c09cdca3b67bda168a # Parent 27b183b18d4da91f28624a0f1c9c3db425fb5bfe use function logging macros diff -r 27b183b18d4d -r fa0747c4ad5e src/devices/wifi/dca-txop.cc --- a/src/devices/wifi/dca-txop.cc Tue Apr 15 15:29:43 2008 -0700 +++ b/src/devices/wifi/dca-txop.cc Tue Apr 15 15:53:54 2008 -0700 @@ -37,7 +37,7 @@ NS_LOG_COMPONENT_DEFINE ("DcaTxop"); #define MY_DEBUG(x) \ - NS_LOG_DEBUG (Simulator::Now () << " " << m_low->GetMac ()->GetAddress () << " " << x) + NS_LOG_DEBUG (m_low->GetMac ()->GetAddress () << " " << x) namespace ns3 { @@ -122,6 +122,7 @@ : m_manager (0), m_currentPacket (0) { + NS_LOG_FUNCTION (this); m_transmissionListener = new DcaTxop::TransmissionListener (this); m_dcf = new DcaTxop::Dcf (this); m_queue = CreateObject (); @@ -130,11 +131,14 @@ } DcaTxop::~DcaTxop () -{} +{ + NS_LOG_FUNCTION (this); +} void DcaTxop::DoDispose (void) { + NS_LOG_FUNCTION (this); delete m_transmissionListener; delete m_dcf; delete m_rng; @@ -151,6 +155,7 @@ void DcaTxop::SetManager (DcfManager *manager) { + NS_LOG_FUNCTION (this << manager); m_manager = manager; m_manager->Add (m_dcf); } @@ -158,11 +163,13 @@ void DcaTxop::SetLow (Ptr low) { + NS_LOG_FUNCTION (this << low); m_low = low; } void DcaTxop::SetWifiRemoteStationManager (Ptr remoteManager) { + NS_LOG_FUNCTION (this << remoteManager); m_stationManager = remoteManager; } void @@ -179,26 +186,31 @@ void DcaTxop::SetMaxQueueSize (uint32_t size) { + NS_LOG_FUNCTION (this << size); m_queue->SetMaxSize (size); } void DcaTxop::SetMaxQueueDelay (Time delay) { + NS_LOG_FUNCTION (this << delay); m_queue->SetMaxDelay (delay); } void DcaTxop::SetMinCw (uint32_t minCw) { + NS_LOG_FUNCTION (this << minCw); m_dcf->SetCwMin (minCw); } void DcaTxop::SetMaxCw (uint32_t maxCw) { + NS_LOG_FUNCTION (this << maxCw); m_dcf->SetCwMax (maxCw); } void DcaTxop::SetAifsn (uint32_t aifsn) { + NS_LOG_FUNCTION (this << aifsn); m_dcf->SetAifsn (aifsn); } uint32_t @@ -220,6 +232,7 @@ void DcaTxop::Queue (Ptr packet, WifiMacHeader const &hdr) { + NS_LOG_FUNCTION (this << packet << &hdr); WifiMacTrailer fcs; uint32_t fullPacketSize = hdr.GetSerializedSize () + packet->GetSize () + fcs.GetSerializedSize (); WifiRemoteStation *station = GetStation (hdr.GetAddr1 ()); @@ -237,6 +250,7 @@ void DcaTxop::RestartAccessIfNeeded (void) { + NS_LOG_FUNCTION (this); if ((m_currentPacket != 0 || !m_queue->IsEmpty ()) && !m_dcf->IsAccessRequested ()) @@ -248,6 +262,7 @@ void DcaTxop::StartAccessIfNeeded (void) { + NS_LOG_FUNCTION (this); if (m_currentPacket == 0 && !m_queue->IsEmpty () && !m_dcf->IsAccessRequested ()) @@ -350,6 +365,7 @@ void DcaTxop::NotifyAccessGranted (void) { + NS_LOG_FUNCTION (this); if (m_currentPacket == 0) { if (m_queue->IsEmpty ()) @@ -429,11 +445,13 @@ void DcaTxop::NotifyInternalCollision (void) { + NS_LOG_FUNCTION (this); NotifyCollision (); } void DcaTxop::NotifyCollision (void) { + NS_LOG_FUNCTION (this); MY_DEBUG ("collision"); m_dcf->StartBackoffNow (m_rng->GetNext (0, m_dcf->GetCw ())); RestartAccessIfNeeded (); @@ -442,11 +460,13 @@ void DcaTxop::GotCts (double snr, WifiMode txMode) { + NS_LOG_FUNCTION (this << snr << txMode); MY_DEBUG ("got cts"); } void DcaTxop::MissedCts (void) { + NS_LOG_FUNCTION (this); MY_DEBUG ("missed cts"); if (!NeedRtsRetransmission ()) { @@ -467,6 +487,7 @@ void DcaTxop::GotAck (double snr, WifiMode txMode) { + NS_LOG_FUNCTION (this << snr << txMode); if (!NeedFragmentation () || IsLastFragment ()) { @@ -492,6 +513,7 @@ void DcaTxop::MissedAck (void) { + NS_LOG_FUNCTION (this); MY_DEBUG ("missed ack"); if (!NeedDataRetransmission ()) { @@ -518,6 +540,7 @@ void DcaTxop::StartNext (void) { + NS_LOG_FUNCTION (this); MY_DEBUG ("start next packet fragment"); /* this callback is used only for fragments. */ NextFragment (); @@ -541,6 +564,7 @@ void DcaTxop::Cancel (void) { + NS_LOG_FUNCTION (this); MY_DEBUG ("transmission cancelled"); /** * This happens in only one case: in an AP, you have two DcaTxop: diff -r 27b183b18d4d -r fa0747c4ad5e src/devices/wifi/ideal-wifi-manager.cc --- a/src/devices/wifi/ideal-wifi-manager.cc Tue Apr 15 15:29:43 2008 -0700 +++ b/src/devices/wifi/ideal-wifi-manager.cc Tue Apr 15 15:53:54 2008 -0700 @@ -23,17 +23,6 @@ #include "ns3/double.h" #include -#define noIDEAL_DEBUG 1 - -#ifdef IDEAL_DEBUG -#include -# define TRACE(x) \ -std::cout << "IDEAL TRACE " << x << std::endl; -#else -# define TRACE(x) -#endif - - namespace ns3 { NS_OBJECT_ENSURE_REGISTERED (IdealWifiManager); @@ -115,13 +104,11 @@ void IdealWifiRemoteStation::DoReportRtsOk (double ctsSnr, WifiMode ctsMode, double rtsSnr) { - TRACE ("got cts for rts snr="<GetAddress () << " " << x) + NS_LOG_DEBUG (m_mac->GetAddress () << " " << x) namespace ns3 { @@ -215,7 +215,30 @@ return m_nextSize; } - +std::ostream &operator << (std::ostream &os, const MacLowTransmissionParameters ¶ms) +{ + os << "[" + << "send rts=" << params.m_sendRts << ", " + << "next size=" << params.m_nextSize << ", " + << "dur=" << params.m_overrideDurationId << ", " + << "ack="; + switch (params.m_waitAck) { + case MacLowTransmissionParameters::ACK_NONE: + os << "none"; + break; + case MacLowTransmissionParameters::ACK_NORMAL: + os << "normal"; + break; + case MacLowTransmissionParameters::ACK_FAST: + os << "fast"; + break; + case MacLowTransmissionParameters::ACK_SUPER_FAST: + os << "super-fast"; + break; + } + os << "]"; + return os; +} MacLow::MacLow () : m_normalAckTimeoutEvent (), @@ -230,16 +253,20 @@ m_currentPacket (0), m_listener (0) { + NS_LOG_FUNCTION (this); m_lastNavDuration = Seconds (0); m_lastNavStart = Seconds (0); } MacLow::~MacLow () -{} +{ + NS_LOG_FUNCTION (this); +} void MacLow::DoDispose (void) { + NS_LOG_FUNCTION (this); CancelAllEvents (); m_phy = 0; m_mac = 0; @@ -249,6 +276,7 @@ void MacLow::CancelAllEvents (void) { + NS_LOG_FUNCTION (this); bool oneRunning = false; if (m_normalAckTimeoutEvent.IsRunning ()) { @@ -339,9 +367,10 @@ void MacLow::StartTransmission (Ptr packet, WifiMacHeader const*hdr, - MacLowTransmissionParameters parameters, + MacLowTransmissionParameters params, MacLowTransmissionListener *listener) { + NS_LOG_FUNCTION (this << packet << hdr << params << listener); /* m_currentPacket is not NULL because someone started * a transmission and was interrupted before one of: * - ctsTimeout @@ -360,7 +389,7 @@ m_currentHdr = *hdr; CancelAllEvents (); m_listener = listener; - m_txParams = parameters; + m_txParams = params; //NS_ASSERT (m_phy->IsStateIdle ()); @@ -383,6 +412,7 @@ void MacLow::ReceiveError (Ptr packet, double rxSnr) { + NS_LOG_FUNCTION (this << packet << rxSnr); MY_DEBUG ("rx failed "); if (m_txParams.MustWaitFastAck ()) { @@ -396,6 +426,7 @@ void MacLow::ReceiveOk (Ptr packet, double rxSnr, WifiMode txMode, WifiPreamble preamble) { + NS_LOG_FUNCTION (this << packet << rxSnr << txMode << preamble); /* A packet is received from the PHY. * When we have handled this packet, * we handle any packet present in the @@ -754,6 +785,7 @@ MacLow::ForwardDown (Ptr packet, WifiMacHeader const* hdr, WifiMode txMode) { + NS_LOG_FUNCTION (this << packet << hdr << txMode); MY_DEBUG ("send " << hdr->GetTypeString () << ", to=" << hdr->GetAddr1 () << ", size=" << packet->GetSize () << @@ -773,6 +805,7 @@ void MacLow::CtsTimeout (void) { + NS_LOG_FUNCTION (this); MY_DEBUG ("cts timeout"); // XXX: should check that there was no rx start before now. // we should restart a new cts timeout now until the expected @@ -787,6 +820,7 @@ void MacLow::NormalAckTimeout (void) { + NS_LOG_FUNCTION (this); MY_DEBUG ("normal ack timeout"); // XXX: should check that there was no rx start before now. // we should restart a new ack timeout now until the expected @@ -800,6 +834,7 @@ void MacLow::FastAckTimeout (void) { + NS_LOG_FUNCTION (this); WifiRemoteStation *station = GetStation (m_currentHdr.GetAddr1 ()); station->ReportDataFailed (); MacLowTransmissionListener *listener = m_listener; @@ -817,6 +852,7 @@ void MacLow::SuperFastAckTimeout () { + NS_LOG_FUNCTION (this); WifiRemoteStation *station = GetStation (m_currentHdr.GetAddr1 ()); station->ReportDataFailed (); MacLowTransmissionListener *listener = m_listener; @@ -836,6 +872,7 @@ void MacLow::SendRtsForPacket (void) { + NS_LOG_FUNCTION (this); /* send an RTS for this packet. */ WifiMacHeader rts; rts.SetType (WIFI_MAC_CTL_RTS); @@ -917,6 +954,7 @@ void MacLow::SendDataPacket (void) { + NS_LOG_FUNCTION (this); /* send this packet directly. No RTS is needed. */ StartDataTxTimers (); @@ -977,6 +1015,7 @@ void MacLow::SendCtsAfterRts (Mac48Address source, Time duration, WifiMode rtsTxMode, double rtsSnr) { + NS_LOG_FUNCTION (this); /* send a CTS when you receive a RTS * right after SIFS. */ @@ -1007,6 +1046,7 @@ void MacLow::SendDataAfterCts (Mac48Address source, Time duration, WifiMode txMode) { + NS_LOG_FUNCTION (this); /* send the third step in a * RTS/CTS/DATA/ACK hanshake */ @@ -1043,6 +1083,7 @@ void MacLow::FastAckFailedTimeout (void) { + NS_LOG_FUNCTION (this); MacLowTransmissionListener *listener = m_listener; m_listener = 0; listener->MissedAck (); @@ -1052,6 +1093,7 @@ void MacLow::SendAckAfterData (Mac48Address source, Time duration, WifiMode dataTxMode, double dataSnr) { + NS_LOG_FUNCTION (this); /* send an ACK when you receive * a packet after SIFS. */ diff -r 27b183b18d4d -r fa0747c4ad5e src/devices/wifi/mac-low.h --- a/src/devices/wifi/mac-low.h Tue Apr 15 15:29:43 2008 -0700 +++ b/src/devices/wifi/mac-low.h Tue Apr 15 15:53:54 2008 -0700 @@ -22,6 +22,7 @@ #include #include +#include #include "wifi-mac-header.h" #include "wifi-mode.h" @@ -252,6 +253,7 @@ uint32_t GetNextPacketSize (void) const; private: + friend std::ostream &operator << (std::ostream &os, const MacLowTransmissionParameters ¶ms); uint32_t m_nextSize; enum { ACK_NONE, @@ -263,6 +265,8 @@ Time m_overrideDurationId; }; +std::ostream &operator << (std::ostream &os, const MacLowTransmissionParameters ¶ms); + /** * \brief handle RTS/CTS/DATA/ACK transactions. diff -r 27b183b18d4d -r fa0747c4ad5e src/devices/wifi/mac-rx-middle.cc --- a/src/devices/wifi/mac-rx-middle.cc Tue Apr 15 15:29:43 2008 -0700 +++ b/src/devices/wifi/mac-rx-middle.cc Tue Apr 15 15:53:54 2008 -0700 @@ -29,8 +29,6 @@ NS_LOG_COMPONENT_DEFINE ("MacRxMiddle"); -#define TRACE(x) NS_LOG_DEBUG(Simulator::Now () << " " << x) - namespace ns3 { @@ -99,10 +97,13 @@ MacRxMiddle::MacRxMiddle () -{} +{ + NS_LOG_FUNCTION_NOARGS (); +} MacRxMiddle::~MacRxMiddle () { + NS_LOG_FUNCTION_NOARGS (); for (OriginatorsI i = m_originatorStatus.begin (); i != m_originatorStatus.end (); i++) { @@ -122,16 +123,18 @@ void MacRxMiddle::SetForwardCallback (ForwardUpCallback callback) { + NS_LOG_FUNCTION_NOARGS (); m_callback = callback; } bool MacRxMiddle::SequenceControlSmaller (int seqca, int seqcb) { + NS_LOG_FUNCTION (seqca << seqcb); int seqa = seqca >> 4; int seqb = seqcb >> 4; int delta = seqb - seqa; - TRACE ("seqb="<IsNextFragment (hdr->GetSequenceControl ())) { - TRACE ("accumulate last fragment seq="<GetSequenceNumber ()<< + NS_LOG_DEBUG ("accumulate last fragment seq="<GetSequenceNumber ()<< ", frag="<GetFragmentNumber ()<< ", size="<GetSize ()); Ptr p = originator->AccumulateLastFragment (packet); @@ -227,7 +233,7 @@ } else { - TRACE ("non-ordered fragment"); + NS_LOG_DEBUG ("non-ordered fragment"); return 0; } } @@ -236,7 +242,7 @@ { if (hdr->IsMoreFragments ()) { - TRACE ("accumulate first fragment seq="<GetSequenceNumber ()<< + NS_LOG_DEBUG ("accumulate first fragment seq="<GetSequenceNumber ()<< ", frag="<GetFragmentNumber ()<< ", size="<GetSize ()); originator->AccumulateFirstFragment (packet); @@ -253,6 +259,7 @@ void MacRxMiddle::Receive (Ptr packet, WifiMacHeader const *hdr) { + NS_LOG_FUNCTION (packet << hdr); OriginatorRxStatus *originator = Lookup (hdr); if (hdr->IsData ()) { @@ -272,7 +279,7 @@ // filter duplicates. if (IsDuplicate (hdr, originator)) { - TRACE ("duplicate from="<GetAddr2 ()<< + NS_LOG_DEBUG ("duplicate from="<GetAddr2 ()<< ", seq="<GetSequenceNumber ()<< ", frag="<GetFragmentNumber ()); return; @@ -282,7 +289,7 @@ { return; } - TRACE ("forwarding data from="<GetAddr2 ()<< + NS_LOG_DEBUG ("forwarding data from="<GetAddr2 ()<< ", seq="<GetSequenceNumber ()<< ", frag="<GetFragmentNumber ()); if (!hdr->GetAddr1 ().IsBroadcast ()) @@ -293,7 +300,7 @@ } else { - TRACE ("forwarding "<GetTypeString ()<< + NS_LOG_DEBUG ("forwarding "<GetTypeString ()<< ", from="<GetAddr2 ()<< ", seq="<GetSequenceNumber ()<< ", frag="<GetFragmentNumber ()); diff -r 27b183b18d4d -r fa0747c4ad5e src/devices/wifi/nqap-wifi-mac.cc --- a/src/devices/wifi/nqap-wifi-mac.cc Tue Apr 15 15:29:43 2008 -0700 +++ b/src/devices/wifi/nqap-wifi-mac.cc Tue Apr 15 15:53:54 2008 -0700 @@ -33,9 +33,6 @@ NS_LOG_COMPONENT_DEFINE ("NqapWifiMac"); -#define TRACE(x) \ - NS_LOG_DEBUG(Simulator::Now () << " " << GetAddress () << " " << x); - namespace ns3 { NS_OBJECT_ENSURE_REGISTERED (NqapWifiMac); @@ -61,6 +58,7 @@ NqapWifiMac::NqapWifiMac () { + NS_LOG_FUNCTION (this); m_rxMiddle = new MacRxMiddle (); m_rxMiddle->SetForwardCallback (MakeCallback (&NqapWifiMac::Receive, this)); @@ -82,11 +80,14 @@ m_beaconDca->SetManager (m_dcfManager); } NqapWifiMac::~NqapWifiMac () -{} +{ + NS_LOG_FUNCTION (this); +} void NqapWifiMac::DoDispose (void) { + NS_LOG_FUNCTION (this); delete m_rxMiddle; delete m_dcfManager; m_rxMiddle = 0; @@ -102,6 +103,7 @@ void NqapWifiMac::SetBeaconGeneration (bool enable) { + NS_LOG_FUNCTION (this << enable); if (enable) { m_beaconEvent = Simulator::ScheduleNow (&NqapWifiMac::SendOneBeacon, this); @@ -121,18 +123,21 @@ void NqapWifiMac::SetSlot (Time slotTime) { + NS_LOG_FUNCTION (this << slotTime); m_dcfManager->SetSlot (slotTime); m_slot = slotTime; } void NqapWifiMac::SetSifs (Time sifs) { + NS_LOG_FUNCTION (this << sifs); m_dcfManager->SetSifs (sifs); m_sifs = sifs; } void NqapWifiMac::SetEifsNoDifs (Time eifsNoDifs) { + NS_LOG_FUNCTION (this << eifsNoDifs); m_dcfManager->SetEifsNoDifs (eifsNoDifs); m_eifsNoDifs = eifsNoDifs; } @@ -156,6 +161,7 @@ void NqapWifiMac::SetWifiPhy (Ptr phy) { + NS_LOG_FUNCTION (this << phy); m_phy = phy; m_dcfManager->SetupPhyListener (phy); m_low->SetPhy (phy); @@ -163,6 +169,7 @@ void NqapWifiMac::SetWifiRemoteStationManager (Ptr stationManager) { + NS_LOG_FUNCTION (this << stationManager); m_stationManager = stationManager; m_dca->SetWifiRemoteStationManager (stationManager); m_beaconDca->SetWifiRemoteStationManager (stationManager); @@ -171,11 +178,13 @@ void NqapWifiMac::SetForwardUpCallback (Callback, const Mac48Address &> upCallback) { + NS_LOG_FUNCTION (this); m_upCallback = upCallback; } void NqapWifiMac::SetLinkUpCallback (Callback linkUp) { + NS_LOG_FUNCTION (this); if (!linkUp.IsNull ()) { linkUp (); @@ -183,7 +192,9 @@ } void NqapWifiMac::SetLinkDownCallback (Callback linkDown) -{} +{ + NS_LOG_FUNCTION (this); +} Mac48Address NqapWifiMac::GetAddress (void) const { @@ -202,11 +213,13 @@ void NqapWifiMac::SetAddress (Mac48Address address) { + NS_LOG_FUNCTION (address); m_address = address; } void NqapWifiMac::SetSsid (Ssid ssid) { + NS_LOG_FUNCTION (ssid); m_ssid = ssid; } @@ -214,21 +227,25 @@ void NqapWifiMac::SetBeaconInterval (Time interval) { + NS_LOG_FUNCTION (this << interval); m_beaconInterval = interval; } void NqapWifiMac::StartBeaconing (void) { + NS_LOG_FUNCTION (this); SendOneBeacon (); } void NqapWifiMac::ForwardUp (Ptr packet, Mac48Address from) { + NS_LOG_FUNCTION (this << packet << from); m_upCallback (packet, from); } void NqapWifiMac::ForwardDown (Ptr packet, Mac48Address from, Mac48Address to) { + NS_LOG_FUNCTION (this << packet << from << to); WifiMacHeader hdr; hdr.SetTypeData (); hdr.SetAddr1 (to); @@ -241,6 +258,7 @@ void NqapWifiMac::Enqueue (Ptr packet, Mac48Address to) { + NS_LOG_FUNCTION (this << packet << to); ForwardDown (packet, GetAddress (), to); } SupportedRates @@ -265,7 +283,7 @@ void NqapWifiMac::SendProbeResp (Mac48Address to) { - TRACE ("send probe response to="<SetForwardCallback (MakeCallback (&NqstaWifiMac::Receive, this)); @@ -110,11 +108,14 @@ } NqstaWifiMac::~NqstaWifiMac () -{} +{ + NS_LOG_FUNCTION (this); +} void NqstaWifiMac::DoDispose (void) { + NS_LOG_FUNCTION (this); delete m_rxMiddle; delete m_dcfManager; m_rxMiddle = 0; @@ -128,18 +129,21 @@ void NqstaWifiMac::SetSlot (Time slotTime) { + NS_LOG_FUNCTION (this << slotTime); m_dcfManager->SetSlot (slotTime); m_slot = slotTime; } void NqstaWifiMac::SetSifs (Time sifs) { + NS_LOG_FUNCTION (this << sifs); m_dcfManager->SetSifs (sifs); m_sifs = sifs; } void NqstaWifiMac::SetEifsNoDifs (Time eifsNoDifs) { + NS_LOG_FUNCTION (this << eifsNoDifs); m_dcfManager->SetEifsNoDifs (eifsNoDifs); m_eifsNoDifs = eifsNoDifs; } @@ -206,33 +210,39 @@ void NqstaWifiMac::SetAddress (Mac48Address address) { + NS_LOG_FUNCTION (this << address); m_address = address; } void NqstaWifiMac::SetSsid (Ssid ssid) { + NS_LOG_FUNCTION (this << ssid); m_ssid = ssid; } void NqstaWifiMac::SetMaxMissedBeacons (uint32_t missed) { + NS_LOG_FUNCTION (this << missed); m_maxMissedBeacons = missed; } void NqstaWifiMac::SetProbeRequestTimeout (Time timeout) { + NS_LOG_FUNCTION (this << timeout); m_probeRequestTimeout = timeout; } void NqstaWifiMac::SetAssocRequestTimeout (Time timeout) { + NS_LOG_FUNCTION (this << timeout); m_assocRequestTimeout = timeout; } void NqstaWifiMac::StartActiveAssociation (void) { + NS_LOG_FUNCTION (this); TryToEnsureAssociated (); } @@ -245,11 +255,13 @@ void NqstaWifiMac::SetBssid (Mac48Address bssid) { + NS_LOG_FUNCTION (this << bssid); m_bssid = bssid; } void NqstaWifiMac::SetActiveProbing (bool enable) { + NS_LOG_FUNCTION (this << enable); if (enable) { TryToEnsureAssociated (); @@ -262,12 +274,13 @@ void NqstaWifiMac::ForwardUp (Ptr packet, const Mac48Address &address) { + NS_LOG_FUNCTION (this << packet << address); m_forwardUp (packet, address); } void NqstaWifiMac::SendProbeRequest (void) { - TRACE ("send probe request"); + NS_LOG_FUNCTION (this); WifiMacHeader hdr; hdr.SetProbeReq (); hdr.SetAddr1 (GetBroadcastBssid ()); @@ -290,7 +303,7 @@ void NqstaWifiMac::SendAssociationRequest (void) { - TRACE ("send assoc request to=" << GetBssid ()); + NS_LOG_FUNCTION (this << GetBssid ()); WifiMacHeader hdr; hdr.SetAssocReq (); hdr.SetAddr1 (GetBssid ()); @@ -312,6 +325,7 @@ void NqstaWifiMac::TryToEnsureAssociated (void) { + NS_LOG_FUNCTION (this); switch (m_state) { case ASSOCIATED: return; @@ -351,37 +365,40 @@ void NqstaWifiMac::AssocRequestTimeout (void) { - TRACE ("assoc request timeout"); + NS_LOG_FUNCTION (this); m_state = WAIT_ASSOC_RESP; SendAssociationRequest (); } void NqstaWifiMac::ProbeRequestTimeout (void) { - TRACE ("probe request timeout"); + NS_LOG_FUNCTION (this); m_state = WAIT_PROBE_RESP; SendProbeRequest (); } void NqstaWifiMac::MissedBeacons (void) { + NS_LOG_FUNCTION (this); if (m_beaconWatchdogEnd > Simulator::Now ()) { m_beaconWatchdog = Simulator::Schedule (m_beaconWatchdogEnd - Simulator::Now (), &NqstaWifiMac::MissedBeacons, this); return; } - TRACE ("beacon missed"); + NS_LOG_DEBUG ("beacon missed"); m_state = BEACON_MISSED; TryToEnsureAssociated (); } void NqstaWifiMac::RestartBeaconWatchdog (Time delay) { + NS_LOG_FUNCTION (this << delay); m_beaconWatchdogEnd = std::max (Simulator::Now () + delay, m_beaconWatchdogEnd); if (Simulator::GetDelayLeft (m_beaconWatchdog) < delay && m_beaconWatchdog.IsExpired ()) { + NS_LOG_DEBUG ("really restart watchdog."); m_beaconWatchdog = Simulator::Schedule (delay, &NqstaWifiMac::MissedBeacons, this); } } @@ -394,12 +411,13 @@ void NqstaWifiMac::Enqueue (Ptr packet, Mac48Address to) { + NS_LOG_FUNCTION (this << packet << to); if (!IsAssociated ()) { TryToEnsureAssociated (); return; } - //TRACE ("enqueue size="<GetSize ()<<", to="<Lookup (hdr->GetAddr2 ()); for (uint32_t i = 0; i < m_phy->GetNModes (); i++) @@ -509,7 +528,7 @@ } else { - TRACE ("assoc refused"); + NS_LOG_DEBUG ("assoc refused"); m_state = REFUSED; } } diff -r 27b183b18d4d -r fa0747c4ad5e src/devices/wifi/wifi-mac-header.cc --- a/src/devices/wifi/wifi-mac-header.cc Tue Apr 15 15:29:43 2008 -0700 +++ b/src/devices/wifi/wifi-mac-header.cc Tue Apr 15 15:53:54 2008 -0700 @@ -21,17 +21,6 @@ #include "ns3/address-utils.h" #include "wifi-mac-header.h" -#define MAC80211HEADER_DEBUG 1 - -#ifdef MAC80211HEADER_DEBUG -#include -# define TRACE(x) \ -std::Cout << "MAC80211HEADER " << x << std::Endl; -#else -# define TRACE(x) -#endif - - namespace ns3 { NS_OBJECT_ENSURE_REGISTERED (WifiMacHeader); diff -r 27b183b18d4d -r fa0747c4ad5e src/devices/wifi/wifi-phy.cc --- a/src/devices/wifi/wifi-phy.cc Tue Apr 15 15:29:43 2008 -0700 +++ b/src/devices/wifi/wifi-phy.cc Tue Apr 15 15:53:54 2008 -0700 @@ -258,14 +258,19 @@ m_previousStateChangeTime (Seconds (0)), m_endSyncEvent (), m_random (0.0, 1.0) -{} +{ + NS_LOG_FUNCTION (this); +} WifiPhy::~WifiPhy () -{} +{ + NS_LOG_FUNCTION (this); +} void WifiPhy::DoDispose (void) { + NS_LOG_FUNCTION (this); m_channel = 0; m_events.clear (); m_modes.clear (); @@ -274,6 +279,7 @@ void WifiPhy::SetStandard (enum WifiPhyStandard standard) { + NS_LOG_FUNCTION (this << standard); m_standard = standard; switch (standard) { case WIFI_PHY_STANDARD_80211a: @@ -292,36 +298,43 @@ void WifiPhy::SetRxNoise (double db) { + NS_LOG_FUNCTION (this << db); m_rxNoiseRatio = DbToRatio (db); } void WifiPhy::SetTxPowerStart (double start) { + NS_LOG_FUNCTION (this << start); m_txPowerBaseDbm = start; } void WifiPhy::SetTxPowerEnd (double end) { + NS_LOG_FUNCTION (this << end); m_txPowerEndDbm = end; } void WifiPhy::SetNTxPower (uint32_t n) { + NS_LOG_FUNCTION (this << n); m_nTxPower = n; } void WifiPhy::SetTxGain (double gain) { + NS_LOG_FUNCTION (this << gain); m_txGainDb = gain; } void WifiPhy::SetRxGain (double gain) { + NS_LOG_FUNCTION (this << gain); m_rxGainDb = gain; } void WifiPhy::SetEdThreshold (double threshold) { + NS_LOG_FUNCTION (this << threshold); m_edThresholdW = DbmToW (threshold); } double @@ -384,6 +397,7 @@ WifiMode txMode, enum WifiPreamble preamble) { + NS_LOG_FUNCTION (this << packet << rxPowerDbm << txMode << preamble); rxPowerDbm += m_rxGainDb; double rxPowerW = DbmToW (rxPowerDbm); Time rxDuration = CalculateTxDuration (packet->GetSize (), txMode, preamble); @@ -472,6 +486,7 @@ void WifiPhy::SendPacket (Ptr packet, WifiMode txMode, WifiPreamble preamble, uint8_t txPower) { + NS_LOG_FUNCTION (this << packet << txMode << preamble << txPower); /* Transmission can happen if: * - we are syncing on a packet. It is the responsability of the * MAC layer to avoid doing this but the PHY does nothing to @@ -529,6 +544,7 @@ void WifiPhy::Configure80211aParameters (void) { + NS_LOG_FUNCTION (this); m_plcpLongPreambleDelayUs = 16; m_plcpShortPreambleDelayUs = 16; m_longPlcpHeaderMode = g_6mba; @@ -558,6 +574,7 @@ void WifiPhy::Configure80211a (void) { + NS_LOG_FUNCTION (this); Configure80211aParameters (); m_modes.push_back (g_6mba); m_modes.push_back (g_9mba); @@ -574,6 +591,7 @@ void WifiPhy::ConfigureHolland (void) { + NS_LOG_FUNCTION (this); Configure80211aParameters (); m_modes.push_back (g_6mba); m_modes.push_back (g_12mba); @@ -1329,6 +1347,7 @@ void WifiPhy::EndSync (Ptr packet, Ptr event) { + NS_LOG_FUNCTION (this << packet << event); NS_ASSERT (IsStateSync ()); NS_ASSERT (event->GetEndTime () == Simulator::Now ());