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"
43#include "ns3/wifi-mac-header.h"
85 template <
typename... Ts>
88 virtual void DoRun (
void);
109 std::set<std::string> dupes;
111 dupes.insert (
"LteRlc::NotifyTxTracedCallback");
112 dupes.insert (
"LteRlc::ReceiveTracedCallback");
113 dupes.insert (
"LteUeRrc::ImsiCidRntiTracedCallback");
114 dupes.insert (
"LteUeRrc::MibSibHandoverTracedCallback");
115 dupes.insert (
"WifiPhyStateHelper::RxEndErrorTracedCallback");
152 TypeName < T > (int N) \
154 std::stringstream ss; \
155 ss << # T << "(" << N << ")"; \
181TYPENAME (LteEnbPhy::ReportInterferenceTracedCallback);
183TYPENAME (LteEnbRrc::ConnectionHandoverTracedCallback);
195TYPENAME (olsr::RoutingProtocol::PacketTxRxTracedCallback);
196TYPENAME (olsr::RoutingProtocol::TableChangeTracedCallback);
203TYPENAME (dot11s::PeerManagementProtocol::LinkOpenCloseTracedCallback);
204TYPENAME (PhyReceptionStatParameters::TracedCallback);
205TYPENAME (PhyTransmissionStatParameters::TracedCallback);
221TYPENAME (WifiRemoteStationManager::PowerChangeTracedCallback);
222TYPENAME (WifiRemoteStationManager::RateChangeTracedCallback);
239 std::cout <<
"with " << N <<
" args." << std::endl;
248template <
typename... Ts>
258 const std::size_t n =
sizeof...(Ts);
278template <
typename... Ts>
288 std::tuple<typename TypeTraits<Ts>::BaseType...>
m_items;
296 template <
typename U>
299 U
sink = TracedCbSink<Ts...>::Sink;
302 std::cout << TypeName<U> (
m_nItems) <<
" invoked ";
315 std::cout << std::endl;
325 :
TestCase (
"Check basic TracedCallback operation")
336 if (g_dupes.find ( # U ) == g_dupes.end ()) { \
337 NS_TEST_ASSERT_MSG_NE (0, 1, \
338 "expected to find " << # U << " in dupes."); } \
339 if (TypeName<U> (0) == TypeName<T1> (0)) { \
340 std::cout << # U << " matches " << # T1 << std::endl; } \
342 NS_TEST_ASSERT_MSG_EQ \
343 (TypeName<U> (0), TypeName<T1> (0), \
344 "the typedef " << # U << \
345 " used to match the typedef " << # T1 << \
346 " but no longer does. Please add a new CHECK call.")
354#define CHECK(U, ...) \
355 CreateObject< Checker< __VA_ARGS__ > > ()->Invoke<U> ()
362 CHECK (dsr::DsrOptionSRHeader::TracedCallback,
365 CHECK (EpcUeNas::StateTracedCallback,
368 CHECK (Ipv4L3Protocol::DropTracedCallback,
372 CHECK (Ipv4L3Protocol::SentTracedCallback,
375 CHECK (Ipv4L3Protocol::TxRxTracedCallback,
378 CHECK (Ipv6L3Protocol::DropTracedCallback,
382 CHECK (Ipv6L3Protocol::SentTracedCallback,
385 CHECK (Ipv6L3Protocol::TxRxTracedCallback,
388 CHECK (LrWpanMac::SentTracedCallback,
391 CHECK (LrWpanMac::StateTracedCallback,
394 CHECK (LrWpanPhy::StateTracedCallback,
397 CHECK (LteEnbMac::DlSchedulingTracedCallback,
399 uint8_t, uint16_t, uint8_t, uint16_t, uint8_t);
401 CHECK (LteEnbMac::UlSchedulingTracedCallback,
404 CHECK (LteEnbPhy::ReportUeSinrTracedCallback,
405 uint16_t, uint16_t,
double, uint8_t);
407 CHECK (LteEnbPhy::ReportInterferenceTracedCallback,
410 CHECK (LteEnbRrc::ConnectionHandoverTracedCallback,
411 uint64_t, uint16_t, uint16_t);
413 CHECK (LteEnbRrc::HandoverStartTracedCallback,
414 uint64_t, uint16_t, uint16_t, uint16_t);
416 CHECK (LteEnbRrc::NewUeContextTracedCallback,
419 CHECK (LteEnbRrc::ReceiveReportTracedCallback,
422 CHECK (LtePdcp::PduRxTracedCallback,
423 uint16_t, uint8_t,
uint32_t, uint64_t);
425 CHECK (LtePdcp::PduTxTracedCallback,
428 DUPE (LteRlc::NotifyTxTracedCallback, LtePdcp::PduTxTracedCallback);
430 DUPE (LteRlc::ReceiveTracedCallback, LtePdcp::PduRxTracedCallback);
432 CHECK (LteUePhy::RsrpSinrTracedCallback,
433 uint16_t, uint16_t,
double,
double, uint8_t);
435 CHECK (LteUePhy::StateTracedCallback,
438 CHECK (LteUeRrc::CellSelectionTracedCallback,
441 DUPE (LteUeRrc::ImsiCidRntiTracedCallback, LteEnbRrc::ConnectionHandoverTracedCallback);
443 DUPE (LteUeRrc::MibSibHandoverTracedCallback, LteEnbRrc::HandoverStartTracedCallback);
445 CHECK (LteUeRrc::StateTracedCallback,
448 CHECK (Mac48Address::TracedCallback,
451 CHECK (MobilityModel::TracedCallback,
454 CHECK (olsr::RoutingProtocol::PacketTxRxTracedCallback,
457 CHECK (olsr::RoutingProtocol::TableChangeTracedCallback,
460 CHECK (Packet::AddressTracedCallback,
463 CHECK (Packet::Mac48AddressTracedCallback,
466 CHECK (Packet::SinrTracedCallback,
469 CHECK (Packet::SizeTracedCallback,
472 CHECK (Packet::TracedCallback,
475 CHECK (PacketBurst::TracedCallback,
478 CHECK (dot11s::PeerManagementProtocol::LinkOpenCloseTracedCallback,
481 CHECK (PhyReceptionStatParameters::TracedCallback,
484 CHECK (PhyTransmissionStatParameters::TracedCallback,
487 CHECK (SixLowPanNetDevice::DropTracedCallback,
491 CHECK (SixLowPanNetDevice::RxTxTracedCallback,
494 CHECK (SpectrumChannel::LossTracedCallback,
497 CHECK (SpectrumValue::TracedCallback,
500 CHECK (TimeSeriesAdaptor::OutputTracedCallback,
503 CHECK (UanMac::PacketModeTracedCallback,
506 CHECK (UanMacCw::QueueTracedCallback,
509 CHECK (UanMacRc::QueueTracedCallback,
512 CHECK (UanNetDevice::RxTxTracedCallback,
515 CHECK (UanPhy::TracedCallback,
518 CHECK (UeManager::StateTracedCallback,
521 CHECK (WifiMacHeader::TracedCallback,
524 CHECK (WifiPhyStateHelper::RxEndErrorTracedCallback,
527 CHECK (WifiPhyStateHelper::RxOkTracedCallback,
530 CHECK (WifiPhyStateHelper::StateTracedCallback,
533 CHECK (WifiPhyStateHelper::TxTracedCallback,
536 CHECK (WifiRemoteStationManager::PowerChangeTracedCallback,
539 CHECK (WifiRemoteStationManager::RateChangeTracedCallback,
555 :
TestSuite (
"traced-callback-typedef", SYSTEM)
TracedCallback< Ts... > m_cb
TracedCallback to be called.
std::tuple< typename TypeTraits< Ts >::BaseType... > m_items
Arguments of the TracedCallback.
const std::size_t m_nItems
Number of arguments of the TracedCallback.
void Cleanup()
Cleanup the test.
void Invoke(void)
Invoke a TracedCallback.
TracedCallbackTypedefTestCase()
virtual ~TracedCallbackTypedefTestCase()
static std::size_t m_nArgs
Number of arguments passed to callback.
virtual void DoRun(void)
Implementation to actually run this TestCase.
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...
DropReason
Reason why a packet has been dropped.
DropReason
Reason why a packet has been dropped.
State
The states of the UE PHY entity.
State
The states of the UE RRC entity.
A class used for addressing MAC8 MAC's.
A base class which provides memory management and object aggregation.
DropReason
Enumeration of the dropping reasons in SixLoWPAN.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Simulation virtual time values and global simulation resolution.
Forward calls to a chain of Callback.
void ConnectWithoutContext(const CallbackBase &callback)
Append a Callback to the chain (without a context).
Abstraction of packet modulation information.
State
The state of the UeManager at the eNB RRC.
represent a single transmission mode
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
LrWpanMacState
MAC states.
LrWpanPhyEnumeration
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 maches the TracedCallback it is supposed to be e...
void SinkIt(std::size_t N)
Log that a callback was invoked.
std::set< std::string > g_dupes
Container for duplicate types.
#define TYPENAME(T)
Returns a sting representing the type of a class.
std::string TypeName(int N)
Stringify the known TracedCallback type names.
std::set< std::string > Duplicates(void)
Record typedefs which are identical to previously declared.
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.
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
MeasurementReport structure.
PhyReceptionStatParameters structure.
PhyTransmissionStatParameters structure.
static TracedCallbackTypedefTestSuite tracedCallbackTypedefTestSuite
Static variable for test initialization.
WifiPhyState
The state of the PHY layer.