26 #include "ns3/core-module.h" 27 #include "ns3/dsr-module.h" 28 #include "ns3/internet-module.h" 30 #include "ns3/lr-wpan-mac.h" 31 #include "ns3/lte-module.h" 34 #include "ns3/mesh-module.h" 35 #include "ns3/mobility-module.h" 36 #include "ns3/network-module.h" 37 #include "ns3/olsr-module.h" 38 #include "ns3/sixlowpan-module.h" 39 #include "ns3/spectrum-module.h" 40 #include "ns3/stats-module.h" 41 #include "ns3/uan-module.h" 42 #include "ns3/wifi-phy-state-helper.h" 66 template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5>
70 template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5>
73 template <
typename T1,
typename T2,
typename T3,
typename T4>
76 template <
typename T1,
typename T2,
typename T3>
80 template <
typename T1,
typename T2>
83 template <
typename T1>
86 virtual void DoRun (
void);
102 std::set<std::string> dupes;
104 dupes.insert (
"LteRlc::NotifyTxTracedCallback");
105 dupes.insert (
"LteRlc::ReceiveTracedCallback");
106 dupes.insert (
"LteUeRrc::ImsiCidRntiTracedCallback");
107 dupes.insert (
"LteUeRrc::MibSibHandoverTracedCallback");
108 dupes.insert (
"WifiPhyStateHelper::RxEndErrorTracedCallback");
126 template <
typename T>
133 #define TYPENAME(T) \ 136 TypeName < T > (int N) \ 138 std::stringstream ss; \ 139 ss << # T << "(" << N << ")"; \ 216 std::cout <<
"with " << N <<
" args." << std::endl;
224 template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5>
228 static void Sink (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
234 template <
typename T1,
typename T2,
typename T3,
typename T4>
238 static void Sink (T1 a1, T2 a2, T3 a3, T4 a4)
244 template <
typename T1,
typename T2,
typename T3>
248 static void Sink (T1 a1, T2 a2, T3 a3)
254 template <
typename T1,
typename T2>
258 static void Sink (T1 a1, T2 a2)
264 template <
typename T1>
290 template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5>
304 std::cout << std::endl;
311 template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5>
317 template <
typename U>
321 U
sink = TracedCbSink<T1, T2, T3, T4, T5>::Sink;
324 std::cout << TypeName<U> (N) <<
" invoked ";
326 m_cb (this->
m1, this->
m2, this->m3, this->m4, this->m5);
331 template <
typename T1,
typename T2,
typename T3,
typename T4>
338 template <
typename U>
342 U
sink = TracedCbSink<T1, T2, T3, T4, empty>::Sink;
345 std::cout << TypeName<U> (N) <<
" invoked ";
347 m_cb (this->
m1, this->
m2, this->m3, this->m4);
352 template <
typename T1,
typename T2,
typename T3>
359 template <
typename U>
363 U
sink = TracedCbSink<T1, T2, T3, empty, empty>::Sink;
366 std::cout << TypeName<U> (N) <<
" invoked ";
368 m_cb (this->
m1, this->
m2, this->m3);
373 template <
typename T1,
typename T2>
380 template <
typename U>
384 U
sink = TracedCbSink<T1, T2, empty, empty, empty>::Sink;
387 std::cout << TypeName<U> (N) <<
" invoked ";
389 m_cb (this->
m1, this->
m2);
394 template <
typename T1>
396 :
public CheckerBase<T1, empty, empty, empty, empty>
401 template <
typename U>
405 U
sink = TracedCbSink<T1, empty, empty, empty, empty>::Sink;
408 std::cout << TypeName<U> (N) <<
" invoked ";
416 :
TestCase (
"Check basic TracedCallback operation")
424 #define DUPE(U, T1) \ 425 if (g_dupes.find ( # U ) == g_dupes.end ()) { \ 426 NS_TEST_ASSERT_MSG_NE (0, 1, \ 427 "expected to find " << # U << " in dupes."); } \ 428 if (TypeName<U> (0) == TypeName<T1> (0)) { \ 429 std::cout << # U << " matches " << # T1 << std::endl; } \ 431 NS_TEST_ASSERT_MSG_EQ \ 432 (TypeName<U> (0), TypeName<T1> (0), \ 433 "the typedef " << # U << \ 434 " used to match the typedef " << # T1 << \ 435 " but no longer does. Please add a new CHECK call.") 437 #define CHECK(U, T1, T2, T3, T4, T5) \ 438 CreateObject< Checker<T1, T2, T3, T4, T5> > ()->Invoke<U> () 440 CHECK (dsr::DsrOptionSRHeader::TracedCallback,
444 CHECK (EpcUeNas::StateTracedCallback,
448 CHECK (Ipv4L3Protocol::DropTracedCallback,
452 CHECK (Ipv4L3Protocol::SentTracedCallback,
456 CHECK (Ipv4L3Protocol::TxRxTracedCallback,
460 CHECK (Ipv6L3Protocol::DropTracedCallback,
465 CHECK (Ipv6L3Protocol::SentTracedCallback,
469 CHECK (Ipv6L3Protocol::TxRxTracedCallback,
473 CHECK (LrWpanMac::SentTracedCallback,
477 CHECK (LrWpanMac::StateTracedCallback,
481 CHECK (LrWpanPhy::StateTracedCallback,
492 CHECK (LteEnbMac::UlSchedulingTracedCallback,
493 uint32_t, uint32_t, uint16_t, uint8_t, uint16_t);
495 CHECK (LteEnbPhy::ReportUeSinrTracedCallback,
496 uint16_t, uint16_t,
double, uint8_t,
499 CHECK (LteEnbPhy::ReportInterferenceTracedCallback,
503 CHECK (LteEnbRrc::ConnectionHandoverTracedCallback,
504 uint64_t, uint16_t, uint16_t,
507 CHECK (LteEnbRrc::HandoverStartTracedCallback,
508 uint64_t, uint16_t, uint16_t, uint16_t,
511 CHECK (LteEnbRrc::NewUeContextTracedCallback,
515 CHECK (LteEnbRrc::ReceiveReportTracedCallback,
519 CHECK (LtePdcp::PduRxTracedCallback,
520 uint16_t, uint8_t, uint32_t, uint64_t,
523 CHECK (LtePdcp::PduTxTracedCallback,
524 uint16_t, uint8_t, uint32_t,
527 DUPE (LteRlc::NotifyTxTracedCallback, LtePdcp::PduTxTracedCallback);
529 DUPE (LteRlc::ReceiveTracedCallback, LtePdcp::PduRxTracedCallback);
531 CHECK (LteUePhy::RsrpSinrTracedCallback,
532 uint16_t, uint16_t,
double,
double, uint8_t);
534 CHECK (LteUePhy::StateTracedCallback,
538 CHECK (LteUeRrc::CellSelectionTracedCallback,
542 DUPE (LteUeRrc::ImsiCidRntiTracedCallback, LteEnbRrc::ConnectionHandoverTracedCallback);
544 DUPE (LteUeRrc::MibSibHandoverTracedCallback, LteEnbRrc::HandoverStartTracedCallback);
546 CHECK (LteUeRrc::StateTracedCallback,
549 CHECK (Mac48Address::TracedCallback,
553 CHECK (MobilityModel::TracedCallback,
557 CHECK (olsr::RoutingProtocol::PacketTxRxTracedCallback,
561 CHECK (olsr::RoutingProtocol::TableChangeTracedCallback,
565 CHECK (Packet::AddressTracedCallback,
569 CHECK (Packet::Mac48AddressTracedCallback,
573 CHECK (Packet::SinrTracedCallback,
577 CHECK (Packet::SizeTracedCallback,
581 CHECK (Packet::TracedCallback,
585 CHECK (PacketBurst::TracedCallback,
589 CHECK (dot11s::PeerManagementProtocol::LinkOpenCloseTracedCallback,
593 CHECK (PhyReceptionStatParameters::TracedCallback,
597 CHECK (PhyTransmissionStatParameters::TracedCallback,
601 CHECK (SixLowPanNetDevice::DropTracedCallback,
606 CHECK (SixLowPanNetDevice::RxTxTracedCallback,
610 CHECK (SpectrumChannel::LossTracedCallback,
614 CHECK (SpectrumValue::TracedCallback,
618 CHECK (TimeSeriesAdaptor::OutputTracedCallback,
622 CHECK (UanMac::PacketModeTracedCallback,
626 CHECK (UanMacCw::QueueTracedCallback,
630 CHECK (UanMacRc::QueueTracedCallback,
634 CHECK (UanNetDevice::RxTxTracedCallback,
638 CHECK (UanPhy::TracedCallback,
642 CHECK (UeManager::StateTracedCallback,
645 CHECK (WifiMacHeader::TracedCallback,
649 CHECK (WifiPhyStateHelper::RxEndErrorTracedCallback,
653 CHECK (WifiPhyStateHelper::RxOkTracedCallback,
657 CHECK (WifiPhyStateHelper::StateTracedCallback,
661 CHECK (WifiPhyStateHelper::TxTracedCallback,
665 CHECK (WifiRemoteStationManager::PowerChangeTracedCallback,
669 CHECK (WifiRemoteStationManager::RateChangeTracedCallback,
681 :
TestSuite (
"traced-callback-typedef", SYSTEM)
static void Sink(T1 a1, T2 a2, T3 a3, T4 a4)
void(* Mac48AddressTracedCallback)(Ptr< const Packet > packet, Mac48Address mac)
TracedCallback signature for packet and Mac48Address.
void(* UlSchedulingTracedCallback)(const uint32_t frame, const uint32_t subframe, const uint16_t rnti, const uint8_t mcs, const uint16_t tbsSize)
TracedCallback signature for UL scheduling events.
Simulation virtual time values and global simulation resolution.
State
The state of the UeManager at the eNB RRC.
MeasurementReport structure.
void(* ReportUeSinrTracedCallback)(uint16_t cellId, uint16_t rnti, double sinrLinear, uint8_t componentCarrierId)
TracedCallback signature for the linear average of SRS SINRs.
static void Sink(T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
void(* PowerChangeTracedCallback)(double oldPower, double newPower, Mac48Address remoteAddress)
TracedCallback signature for power change events.
void(* StateTracedCallback)(Time time, LrWpanPhyEnumeration oldState, LrWpanPhyEnumeration newState)
TracedCallback signature for Trx state change events.
NS_ASSERT_MSG(false, "Ipv4AddressGenerator::MaskToIndex(): Impossible")
void(* NewUeContextTracedCallback)(const uint16_t cellId, const uint16_t rnti)
TracedCallback signature for new Ue Context events.
void(* ConnectionHandoverTracedCallback)(const uint64_t imsi, const uint16_t cellId, const uint16_t rnti)
TracedCallback signature for connection and handover end events.
TracedCallback< T1, T2, T3 > m_cb
void(* QueueTracedCallback)(Ptr< const Packet > packet, uint32_t proto)
TracedCallback signature for dequeue of a packet.
void(* QueueTracedCallback)(Ptr< const Packet > packet, uint16_t proto)
TracedCallback signature for enqueue/dequeue of a packet.
void(* StateTracedCallback)(Time start, Time duration, WifiPhyState state)
TracedCallback signature for state changes.
void(* StateTracedCallback)(const State oldState, const State newState)
TracedCallback signature for state change events.
void(* SizeTracedCallback)(uint32_t oldSize, uint32_t newSize)
TracedCallback signature for changes in packet size.
void(* TracedCallback)(Ptr< const Packet > packet)
TracedCallback signature for Ptr<Packet>
TypeTraits< T5 >::BaseType m5
void(* PduTxTracedCallback)(uint16_t rnti, uint8_t lcid, uint32_t size)
TracedCallback for PDU transmission event.
void(* LossTracedCallback)(Ptr< const SpectrumPhy > txPhy, Ptr< const SpectrumPhy > rxPhy, double lossDb)
TracedCallback signature for path loss calculation events.
void(* TableChangeTracedCallback)(uint32_t size)
TracedCallback signature for routing table computation.
const double m1
First component modulus, 232 - 209.
static void Sink(T1 a1, T2 a2, T3 a3)
void(* ReportInterferenceTracedCallback)(uint16_t cellId, Ptr< SpectrumValue > spectrumValue)
TracedCallback signature for the linear average of SRS SINRs.
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
TracedCallback< T1 > m_cb
std::string TypeName(int N)
Stringify the known TracedCallback type names.
DropReason
Enumeration of the dropping reasons in SixLoWPAN.
a polymophic address class
State
The states of the UE PHY entity.
DropReason
Reason why a packet has been dropped.
Class for representing data rates.
TracedCallback< T1, T2, T3, T4, T5 > m_cb
void(* PacketModeTracedCallback)(Ptr< const Packet > packet, UanTxMode mode)
TracedCallback signature for packet reception/enqueue/dequeue events.
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
void(* StateTracedCallback)(uint16_t cellId, uint16_t rnti, State oldState, State newState)
TracedCallback signature for state transition events.
make Callback use a separate empty type
void(* AddressTracedCallback)(Ptr< const Packet > packet, const Address &address)
TracedCallback signature for packet and Address.
void(* DropTracedCallback)(const Ipv6Header &header, Ptr< const Packet > packet, DropReason reason, Ptr< Ipv6 > ipv6, uint32_t interface)
TracedCallback signature for packet drop events.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
void(* RxOkTracedCallback)(Ptr< const Packet > packet, double snr, WifiMode mode, WifiPreamble preamble)
TracedCallback signature for receive end ok event.
void(* TxRxTracedCallback)(Ptr< const Packet > packet, Ptr< Ipv6 > ipv6, uint32_t interface)
TracedCallback signature for packet transmission or reception events.
void(* HandoverStartTracedCallback)(const uint64_t imsi, const uint16_t cellId, const uint16_t rnti, const uint16_t targetCid)
TracedCallback signature for handover start events.
static int m_nArgs
Number of arguments passed to callback.
Abstraction of packet modulation information.
void(* ReceiveReportTracedCallback)(const uint64_t imsi, const uint16_t cellId, const uint16_t rnti, const LteRrcSap::MeasurementReport report)
TracedCallback signature for receive measurement report events.
void(* PduRxTracedCallback)(const uint16_t rnti, const uint8_t lcid, const uint32_t size, const uint64_t delay)
TracedCallback signature for PDU receive event.
A class used for addressing MAC8 MAC's.
TracedCallback< T1, T2, T3, T4 > m_cb
virtual ~TracedCallbackTypedefTestCase()
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
void(* TxTracedCallback)(Ptr< const Packet > packet, WifiMode mode, WifiPreamble preamble, uint8_t power)
TracedCallback signature for transmit event.
void(* SinrTracedCallback)(Ptr< const Packet > packet, double sinr)
TracedCallback signature for packet and SINR.
void(* RxTxTracedCallback)(Ptr< const Packet > packet, Mac8Address address)
TracedCallback signature for MAC send/receive events.
void(* StateTracedCallback)(const uint64_t imsi, const uint16_t cellId, const uint16_t rnti, const State oldState, const State newState)
TracedCallback signature for state transition events.
void(* TracedCallback)(Ptr< SpectrumValue > value)
TracedCallback signature for SpectrumValue.
void SinkIt(unsigned int N)
Log that a callback was invoked.
virtual void DoRun(void)
Implementation to actually run this TestCase.
void(* TracedCallback)(const PhyReceptionStatParameters params)
TracedCallback signature.
TracedCallback< T1, T2 > m_cb
void(* TracedCallback)(Mac48Address value)
TracedCallback signature for Mac48Address.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
PhyReceptionStatParameters structure.
void(* LinkOpenCloseTracedCallback)(Mac48Address src, const Mac48Address dst)
TracedCallback signature for link open/close events.
WifiPhyState
The state of the PHY layer.
std::set< std::string > g_dupes
Container for duplicate types.
TypeTraits< T4 >::BaseType m4
std::vector< MessageHeader > MessageList
static TracedCallbackTypedefTestSuite tracedCallbackTypedefTestSuite
TracedCallbackTypedefTestCase()
void(* DropTracedCallback)(DropReason reason, Ptr< const Packet > packet, Ptr< SixLowPanNetDevice > sixNetDevice, uint32_t ifindex)
TracedCallback signature for.
void(* OutputTracedCallback)(const double now, const double data)
TracedCallback signature for output trace.
void(* SentTracedCallback)(const Ipv6Header &header, Ptr< const Packet > packet, uint32_t interface)
TracedCallback signature for packet sent, forwarded or local-delivered events.
void(* SentTracedCallback)(const Ipv4Header &header, Ptr< const Packet > packet, uint32_t interface)
TracedCallback signature for packet send, forward, or local deliver events.
State
The states of the UE RRC entity.
void(* TracedCallback)(Ptr< const Packet > pkt, double sinr, UanTxMode mode)
TracedCallback signature for UanPhy packet send/receive events.
void(* PacketTxRxTracedCallback)(const PacketHeader &header, const MessageList &messages)
TracedCallback signature for Packet transmit and receive events.
TypeTraits< T3 >::BaseType m3
Inspect a type to deduce its features.
void(* TracedCallback)(Ptr< const PacketBurst > burst)
TracedCallback signature for Ptr<PacketBurst>
void(* TracedCallback)(Ptr< const MobilityModel > model)
TracedCallback signature.
TracedCallbackTypedefTestSuite()
void ConnectWithoutContext(const CallbackBase &callback)
Append a Callback to the chain (without a context).
State
Definition of NAS states as per "LTE - From theory to practice", Section 3.2.3.2 "Connection Establis...
void(* RxTxTracedCallback)(Ptr< const Packet > packet, Ptr< SixLowPanNetDevice > sixNetDevice, uint32_t ifindex)
TracedCallback signature for packet send/receive events.
void(* StateTracedCallback)(uint64_t imsi, uint16_t cellId, uint16_t rnti, State oldState, State newState)
TracedCallback signature for state transition events.
static void Sink(T1 a1, T2 a2)
void(* TracedCallback)(const PhyTransmissionStatParameters params)
TracedCallback signature.
LrWpanMacState
MAC states.
const double m2
Second component modulus, 232 - 22853.
void(* StateTracedCallback)(LrWpanMacState oldState, LrWpanMacState newState)
TracedCallback signature for LrWpanMacState change events.
TypeTraits< T1 >::BaseType m1
LrWpanPhyEnumeration
IEEE802.15.4-2006 PHY Emumerations Table 18 in section 6.2.3.
A base class which provides memory management and object aggregation.
void(* TxRxTracedCallback)(Ptr< const Packet > packet, Ptr< Ipv4 > ipv4, uint32_t interface)
TracedCallback signature for packet transmission or reception events.
PhyTransmissionStatParameters structure.
std::set< std::string > Duplicates(void)
Record typedefs which are identical to previously declared.
void(* RateChangeTracedCallback)(DataRate oldRate, DataRate newRate, Mac48Address remoteAddress)
TracedCallback signature for rate change events.
void(* CellSelectionTracedCallback)(uint64_t imsi, uint16_t cellId)
TracedCallback signature for imsi, cellId and rnti events.
TypeTraits< T2 >::BaseType m2
#define CHECK(U, T1, T2, T3, T4, T5)
void(* SentTracedCallback)(Ptr< const Packet > packet, uint8_t retries, uint8_t backoffs)
TracedCallback signature for sent packets.
DropReason
Reason why a packet has been dropped.
void(* RsrpSinrTracedCallback)(uint16_t cellId, uint16_t rnti, double rsrp, double sinr, uint8_t componentCarrierId)
TracedCallback signature for cell RSRP and SINR report.
void(* DropTracedCallback)(const Ipv4Header &header, Ptr< const Packet > packet, DropReason reason, Ptr< Ipv4 > ipv4, uint32_t interface)
TracedCallback signature for packet drop events.