9#include "ns3/core-module.h"
10#include "ns3/dsr-module.h"
11#include "ns3/internet-module.h"
20#include "ns3/lr-wpan-mac.h"
21#include "ns3/lte-module.h"
24#include "ns3/mesh-module.h"
25#include "ns3/mobility-module.h"
26#include "ns3/network-module.h"
27#include "ns3/olsr-module.h"
28#include "ns3/sixlowpan-module.h"
29#include "ns3/spectrum-module.h"
30#include "ns3/stats-module.h"
31#include "ns3/uan-module.h"
32#include "ns3/wifi-mac-header.h"
33#include "ns3/wifi-phy-state-helper.h"
74 template <
typename... Ts>
77 void DoRun()
override;
99 std::set<std::string> dupes;
101 dupes.insert(
"LteRlc::NotifyTxTracedCallback");
102 dupes.insert(
"LteRlc::ReceiveTracedCallback");
103 dupes.insert(
"LteUeRrc::ImsiCidRntiTracedCallback");
104 dupes.insert(
"LteUeRrc::MibSibHandoverTracedCallback");
105 dupes.insert(
"WifiPhyStateHelper::RxEndErrorTracedCallback");
140 inline std::string TypeName<T>(int N) \
142 std::stringstream ss; \
143 ss << #T << "(" << N << ")"; \
227 std::cout <<
"with " << N <<
" args." << std::endl;
236template <
typename... Ts>
246 const std::size_t n =
sizeof...(Ts);
264template <
typename... Ts>
275 std::tuple<std::remove_pointer_t<std::remove_cvref_t<Ts>>...>
m_items;
283 template <
typename U>
289 std::cout << TypeName<U>(
m_nItems) <<
" invoked ";
302 std::cout << std::endl;
311 :
TestCase(
"Check basic TracedCallback operation")
322 if (g_dupes.find(#U) == g_dupes.end()) \
324 NS_TEST_ASSERT_MSG_NE(0, 1, "expected to find " << #U << " in dupes."); \
326 if (TypeName<U>(0) == TypeName<T1>(0)) \
328 std::cout << #U << " matches " << #T1 << std::endl; \
332 NS_TEST_ASSERT_MSG_EQ(TypeName<U>(0), \
335 << #U << " used to match the typedef " << #T1 \
336 << " but no longer does. Please add a new CHECK call."); \
344#define CHECK(U, ...) CreateObject<Checker<__VA_ARGS__>>()->Invoke<U>()
TracedCallback< Ts... > m_cb
TracedCallback to be called.
std::tuple< std::remove_pointer_t< std::remove_cvref_t< Ts > >... > m_items
Arguments of the TracedCallback.
const std::size_t m_nItems
Number of arguments of the TracedCallback.
void Invoke()
Invoke a TracedCallback.
void Cleanup()
Cleanup the test.
TracedCallbackTypedefTestCase()
void DoRun() override
Implementation to actually run this TestCase.
static std::size_t m_nArgs
Number of arguments passed to callback.
~TracedCallbackTypedefTestCase() override
TracedCallback typedef TestSuite.
TracedCallbackTypedefTestSuite()
static void Sink(Ts...)
Sink function, called by a TracedCallback.
a polymophic address class
Class for representing data rates.
State
Definition of NAS states as per "LTE - From theory to practice", Section 3.2.3.2 "Connection Establis...
void(* StateTracedCallback)(const State oldState, const State newState)
TracedCallback signature for state change events.
DropReason
Reason why a packet has been dropped.
void(* DropTracedCallback)(const Ipv4Header &header, Ptr< const Packet > packet, DropReason reason, Ptr< Ipv4 > ipv4, uint32_t interface)
TracedCallback signature for packet drop events.
void(* TxRxTracedCallback)(Ptr< const Packet > packet, Ptr< Ipv4 > ipv4, uint32_t interface)
TracedCallback signature for packet transmission or reception events.
void(* SentTracedCallback)(const Ipv4Header &header, Ptr< const Packet > packet, uint32_t interface)
TracedCallback signature for packet send, forward, or local deliver events.
void(* SentTracedCallback)(const Ipv6Header &header, Ptr< const Packet > packet, uint32_t interface)
TracedCallback signature for packet sent, forwarded or local-delivered events.
DropReason
Reason why a packet has been dropped.
void(* DropTracedCallback)(const Ipv6Header &header, Ptr< const Packet > packet, DropReason reason, Ptr< Ipv6 > ipv6, uint32_t interface)
TracedCallback signature for packet drop events.
void(* TxRxTracedCallback)(Ptr< const Packet > packet, Ptr< Ipv6 > ipv6, uint32_t interface)
TracedCallback signature for packet transmission or reception events.
void(* DlSchedulingTracedCallback)(const uint32_t frame, const uint32_t subframe, const uint16_t rnti, const uint8_t mcs0, const uint16_t tbs0Size, const uint8_t mcs1, const uint16_t tbs1Size, const uint8_t ccId)
TracedCallback signature for DL scheduling events.
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.
void(* ReportUeSinrTracedCallback)(uint16_t cellId, uint16_t rnti, double sinrLinear, uint8_t componentCarrierId)
TracedCallback signature for the linear average of SRS SINRs.
void(* ReportInterferenceTracedCallback)(uint16_t cellId, Ptr< SpectrumValue > spectrumValue)
TracedCallback signature for the linear average of SRS SINRs.
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(* HandoverStartTracedCallback)(const uint64_t imsi, const uint16_t cellId, const uint16_t rnti, const uint16_t targetCid)
TracedCallback signature for handover start events.
void(* ConnectionHandoverTracedCallback)(const uint64_t imsi, const uint16_t cellId, const uint16_t rnti)
TracedCallback signature for connection and handover end events.
void(* NewUeContextTracedCallback)(const uint16_t cellId, const uint16_t rnti)
TracedCallback signature for new Ue Context 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.
void(* PduTxTracedCallback)(uint16_t rnti, uint8_t lcid, uint32_t size)
TracedCallback for PDU transmission event.
void(* ReceiveTracedCallback)(uint16_t rnti, uint8_t lcid, uint32_t bytes, uint64_t delay)
TracedCallback signature for.
void(* NotifyTxTracedCallback)(uint16_t rnti, uint8_t lcid, uint32_t bytes)
TracedCallback signature for NotifyTxOpportunity events.
void(* StateTracedCallback)(uint16_t cellId, uint16_t rnti, State oldState, State newState)
TracedCallback signature for state transition events.
State
The states of the UE PHY entity.
void(* RsrpSinrTracedCallback)(uint16_t cellId, uint16_t rnti, double rsrp, double sinr, uint8_t componentCarrierId)
TracedCallback signature for cell RSRP and SINR report.
State
The states of the UE RRC entity.
void(* MibSibHandoverTracedCallback)(uint64_t imsi, uint16_t cellId, uint16_t rnti, uint16_t otherCid)
TracedCallback signature for MIBReceived, Sib1Received and HandoverStart events.
void(* CellSelectionTracedCallback)(uint64_t imsi, uint16_t cellId)
TracedCallback signature for imsi, cellId and rnti events.
void(* ImsiCidRntiTracedCallback)(uint64_t imsi, uint16_t cellId, uint16_t rnti)
TracedCallback signature for imsi, cellId and rnti events.
void(* StateTracedCallback)(uint64_t imsi, uint16_t cellId, uint16_t rnti, State oldState, State newState)
TracedCallback signature for state transition events.
void(* TracedCallback)(Mac48Address value)
TracedCallback signature for Mac48Address.
A class used for addressing MAC8 MAC's.
void(* TracedCallback)(Ptr< const MobilityModel > model)
TracedCallback signature.
A base class which provides memory management and object aggregation.
void(* TracedCallback)(Ptr< const PacketBurst > burst)
TracedCallback signature for Ptr<PacketBurst>
void(* SizeTracedCallback)(uint32_t oldSize, uint32_t newSize)
TracedCallback signature for changes in packet size.
void(* Mac48AddressTracedCallback)(Ptr< const Packet > packet, Mac48Address mac)
TracedCallback signature for packet and Mac48Address.
void(* AddressTracedCallback)(Ptr< const Packet > packet, const Address &address)
TracedCallback signature for packet and Address.
void(* SinrTracedCallback)(Ptr< const Packet > packet, double sinr)
TracedCallback signature for packet and SINR.
void(* TracedCallback)(Ptr< const Packet > packet)
TracedCallback signature for Ptr<Packet>
Smart pointer class similar to boost::intrusive_ptr.
void(* DropTracedCallback)(DropReason reason, Ptr< const Packet > packet, Ptr< SixLowPanNetDevice > sixNetDevice, uint32_t ifindex)
TracedCallback signature for packet drop events.
DropReason
Enumeration of the dropping reasons in SixLoWPAN.
void(* RxTxTracedCallback)(Ptr< const Packet > packet, Ptr< SixLowPanNetDevice > sixNetDevice, uint32_t ifindex)
TracedCallback signature for packet send/receive events.
void(* LossTracedCallback)(Ptr< const SpectrumPhy > txPhy, Ptr< const SpectrumPhy > rxPhy, double lossDb)
TracedCallback signature for path loss calculation events.
void(* TracedCallback)(Ptr< SpectrumValue > value)
TracedCallback signature for SpectrumValue.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Simulation virtual time values and global simulation resolution.
void(* OutputTracedCallback)(const double now, const double data)
TracedCallback signature for output trace.
Forward calls to a chain of Callback.
void ConnectWithoutContext(const CallbackBase &callback)
Append a Callback to the chain (without a context).
void(* QueueTracedCallback)(Ptr< const Packet > packet, uint16_t proto)
TracedCallback signature for enqueue/dequeue of a packet.
void(* PacketModeTracedCallback)(Ptr< const Packet > packet, UanTxMode mode)
TracedCallback signature for packet reception/enqueue/dequeue events.
void(* QueueTracedCallback)(Ptr< const Packet > packet, uint32_t proto)
TracedCallback signature for dequeue of a packet.
void(* RxTxTracedCallback)(Ptr< const Packet > packet, Mac8Address address)
TracedCallback signature for MAC send/receive events.
void(* TracedCallback)(Ptr< const Packet > pkt, double sinr, UanTxMode mode)
TracedCallback signature for UanPhy packet send/receive events.
Abstraction of packet modulation information.
State
The state of the UeManager at the eNB RRC.
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.
represent a single transmission mode
void(* TxTracedCallback)(Ptr< const Packet > packet, WifiMode mode, WifiPreamble preamble, uint8_t power)
TracedCallback signature for transmit event.
void(* StateTracedCallback)(Time start, Time duration, WifiPhyState state)
TracedCallback signature for state changes.
void(* RxEndErrorTracedCallback)(Ptr< const Packet > packet, double snr)
TracedCallback signature for receive end error event.
void(* RxOkTracedCallback)(Ptr< const Packet > packet, double snr, WifiMode mode, WifiPreamble preamble)
TracedCallback signature for receive end OK event.
void(* PowerChangeTracedCallback)(double oldPower, double newPower, Mac48Address remoteAddress)
TracedCallback signature for power change events.
void(* RateChangeTracedCallback)(DataRate oldRate, DataRate newRate, Mac48Address remoteAddress)
TracedCallback signature for rate change events.
void(* LinkOpenCloseTracedCallback)(Mac48Address src, const Mac48Address dst)
TracedCallback signature for link open/close events.
void(* StateTracedCallback)(MacState oldState, MacState newState)
TracedCallback signature for MacState change events.
void(* SentTracedCallback)(Ptr< const Packet > packet, uint8_t retries, uint8_t backoffs)
TracedCallback signature for sent packets.
void(* StateTracedCallback)(Time time, PhyEnumeration oldState, PhyEnumeration newState)
TracedCallback signature for Trx state change events.
void(* PacketTxRxTracedCallback)(const PacketHeader &header, const MessageList &messages)
TracedCallback signature for Packet transmit and receive events.
void(* TableChangeTracedCallback)(uint32_t size)
TracedCallback signature for routing table computation.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
PhyEnumeration
IEEE802.15.4-2006 PHY Emumerations Table 18 in section 6.2.3.
#define CHECK(U,...)
Check the TracedCallback by calling its Invoke function.
#define DUPE(U, T1)
Check the TracedCallback duplicate by checking if it matches the TracedCallback it is supposed to be ...
void SinkIt(std::size_t N)
Log that a callback was invoked.
std::set< std::string > g_dupes
Container for duplicate types.
std::set< std::string > Duplicates()
Record typedefs which are identical to previously declared.
#define TYPENAME(T)
Returns a string representing the type of a class.
std::string TypeName(int N)
Stringify the known TracedCallback type names.
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
std::vector< MessageHeader > MessageList
Every class exported by the ns3 library is enclosed in the ns3 namespace.
WifiPhyState
The state of the PHY layer.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
MeasurementReport structure.
PhyReceptionStatParameters structure.
void(* TracedCallback)(const PhyReceptionStatParameters params)
TracedCallback signature.
PhyTransmissionStatParameters structure.
void(* TracedCallback)(const PhyTransmissionStatParameters params)
TracedCallback signature.
static TracedCallbackTypedefTestSuite tracedCallbackTypedefTestSuite
Static variable for test initialization.
Ptr< PacketSink > sink
Pointer to the packet sink application.