Added adhoc trace sources fro TxOk and TxError

This commit is contained in:
Kirill Andreev
2009-08-18 11:47:17 +04:00
parent 9ea6170d69
commit 17bfa2237c
2 changed files with 27 additions and 3 deletions

View File

@@ -28,6 +28,7 @@
#include "ns3/pointer.h"
#include "ns3/packet.h"
#include "ns3/log.h"
#include "ns3/trace-source-accessor.h"
NS_LOG_COMPONENT_DEFINE ("AdhocWifiMac");
@@ -48,7 +49,17 @@ AdhocWifiMac::GetTypeId (void)
PointerValue (),
MakePointerAccessor (&AdhocWifiMac::GetDcaTxop,
&AdhocWifiMac::SetDcaTxop),
MakePointerChecker<DcaTxop> ())
MakePointerChecker<DcaTxop> ())
.AddTraceSource ( "TxOkHeader",
"The header of successfully transmitted packet",
MakeTraceSourceAccessor (
&AdhocWifiMac::m_txOkCallback)
)
.AddTraceSource ( "TxErrHeader",
"The header of unsuccessfully transmitted packet",
MakeTraceSourceAccessor (
&AdhocWifiMac::m_txErrCallback)
)
;
return tid;
}
@@ -257,7 +268,16 @@ AdhocWifiMac::SetDcaTxop (Ptr<DcaTxop> dcaTxop)
m_dca = dcaTxop;
m_dca->SetLow (m_low);
m_dca->SetManager (m_dcfManager);
m_dca->SetTxFailedCallback (MakeCallback (&AdhocWifiMac::TxFailed, this));
}
void
AdhocWifiMac::TxOk (const WifiMacHeader &hdr)
{
m_txOkCallback (hdr);
}
void
AdhocWifiMac::TxFailed (const WifiMacHeader &hdr)
{
m_txErrCallback (hdr);
}
} // namespace ns3

View File

@@ -88,6 +88,8 @@ private:
AdhocWifiMac &operator = (const AdhocWifiMac &o);
Ptr<DcaTxop> GetDcaTxop(void) const;
void SetDcaTxop (Ptr<DcaTxop> dcaTxop);
void TxOk (WifiMacHeader const &hdr);
void TxFailed (WifiMacHeader const &hdr);
Ptr<DcaTxop> m_dca;
Callback<void,Ptr<Packet>, Mac48Address, Mac48Address> m_upCallback;
@@ -97,6 +99,8 @@ private:
MacRxMiddle *m_rxMiddle;
Ptr<MacLow> m_low;
Ssid m_ssid;
TracedCallback<WifiMacHeader const &> m_txOkCallback;
TracedCallback<WifiMacHeader const &> m_txErrCallback;
};
} // namespace ns3