From 606eb84448f0654092c7da3f4bb94d708143b825 Mon Sep 17 00:00:00 2001 From: Tommaso Pecorella Date: Sun, 28 Aug 2022 13:24:25 -0500 Subject: [PATCH] doc: fix doxygen in various examples --- examples/energy/energy-model-example.cc | 20 ++- .../energy-model-with-harvesting-example.cc | 40 ++++- examples/naming/object-names.cc | 7 + examples/stats/wifi-example-sim.cc | 9 +- examples/tcp/tcp-large-transfer.cc | 30 +++- examples/tcp/tcp-validation.cc | 149 +++++++++++++++++- examples/tcp/tcp-variants-comparison.cc | 123 +++++++++++++-- .../traffic-control/queue-discs-benchmark.cc | 35 +++- examples/traffic-control/traffic-control.cc | 17 ++ examples/tutorial/fifth.cc | 11 ++ examples/tutorial/seventh.cc | 13 ++ examples/tutorial/sixth.cc | 13 ++ examples/wireless/mixed-wired-wireless.cc | 11 +- examples/wireless/wifi-ap.cc | 75 +++++++-- .../wireless/wifi-backward-compatibility.cc | 6 + examples/wireless/wifi-hidden-terminal.cc | 8 +- examples/wireless/wifi-multirate.cc | 18 +-- .../wifi-power-adaptation-distance.cc | 16 ++ .../wifi-power-adaptation-interference.cc | 16 ++ examples/wireless/wifi-simple-adhoc-grid.cc | 13 ++ examples/wireless/wifi-simple-adhoc.cc | 13 ++ examples/wireless/wifi-simple-infra.cc | 13 ++ examples/wireless/wifi-simple-interference.cc | 23 ++- examples/wireless/wifi-sleep.cc | 16 ++ .../wireless/wifi-spectrum-per-example.cc | 16 +- .../wifi-spectrum-per-interference.cc | 27 +++- examples/wireless/wifi-tcp.cc | 7 +- .../outdoor-group-mobility-example.cc | 12 +- .../examples/outdoor-random-walk-example.cc | 5 + src/csma/examples/csma-packet-socket.cc | 8 + src/csma/examples/csma-ping.cc | 12 ++ src/csma/examples/csma-raw-ip-socket.cc | 6 + src/lte/examples/lena-cqi-threshold.cc | 29 ++-- src/lte/examples/lena-dual-stripe.cc | 82 +++++++++- src/lte/examples/lena-radio-link-failure.cc | 111 ++++++++++++- src/lte/examples/lena-x2-handover.cc | 50 ++++++ src/mesh/examples/mesh.cc | 14 +- .../reference-point-group-mobility-example.cc | 6 + .../examples/main-propagation-loss.cc | 36 ++++- ...ideal-phy-matrix-propagation-loss-model.cc | 10 +- ...hoc-aloha-ideal-phy-with-microwave-oven.cc | 45 +++++- .../examples/adhoc-aloha-ideal-phy.cc | 44 +++++- src/stats/examples/double-probe-example.cc | 16 +- .../examples/adaptive-red-tests.cc | 50 +++--- .../examples/codel-vs-pfifo-asymmetric.cc | 85 +++++++++- .../examples/codel-vs-pfifo-basic-test.cc | 16 +- src/traffic-control/examples/red-tests.cc | 50 +++--- src/wifi/examples/wifi-bianchi.cc | 149 +++++++++++++++++- src/wifi/examples/wifi-manager-example.cc | 29 +++- src/wifi/examples/wifi-phy-configuration.cc | 11 ++ .../examples/wifi-test-interference-helper.cc | 6 +- 51 files changed, 1448 insertions(+), 179 deletions(-) diff --git a/examples/energy/energy-model-example.cc b/examples/energy/energy-model-example.cc index 575152c48..0acb2e23a 100644 --- a/examples/energy/energy-model-example.cc +++ b/examples/energy/energy-model-example.cc @@ -35,6 +35,12 @@ using namespace ns3; NS_LOG_COMPONENT_DEFINE ("EnergyExample"); +/** + * Print a received packet + * + * \param from sender address + * \return a sting with the details of the packet: dst {IP, port}, time. + */ static inline std::string PrintReceivedPacket (Address& from) { @@ -93,7 +99,12 @@ GenerateTraffic (Ptr socket, uint32_t pktSize, Ptr n, } } -/// Trace function for remaining energy at node. +/** + * Trace function for remaining energy at node. + * + * \param oldValue Old value + * \param remainingEnergy New value + */ void RemainingEnergy (double oldValue, double remainingEnergy) { @@ -101,7 +112,12 @@ RemainingEnergy (double oldValue, double remainingEnergy) << "s Current remaining energy = " << remainingEnergy << "J"); } -/// Trace function for total energy consumption at node. +/** + * \brief Trace function for total energy consumption at node. + * + * \param oldValue Old value + * \param totalEnergy New value + */ void TotalEnergy (double oldValue, double totalEnergy) { diff --git a/examples/energy/energy-model-with-harvesting-example.cc b/examples/energy/energy-model-with-harvesting-example.cc index bea75e25f..d5c917e77 100644 --- a/examples/energy/energy-model-with-harvesting-example.cc +++ b/examples/energy/energy-model-with-harvesting-example.cc @@ -64,6 +64,12 @@ using namespace ns3; NS_LOG_COMPONENT_DEFINE ("EnergyWithHarvestingExample"); +/** + * Print a received packet + * + * \param from sender address + * \return a sting with the details of the packet: dst {IP, port}, time. + */ static inline std::string PrintReceivedPacket (Address& from) { @@ -122,7 +128,12 @@ GenerateTraffic (Ptr socket, uint32_t pktSize, Ptr n, } } -/// Trace function for remaining energy at node. +/** + * Trace function for remaining energy at node. + * + * \param oldValue Old value + * \param remainingEnergy New value + */ void RemainingEnergy (double oldValue, double remainingEnergy) { @@ -130,15 +141,24 @@ RemainingEnergy (double oldValue, double remainingEnergy) << "s Current remaining energy = " << remainingEnergy << "J"); } -/// Trace function for total energy consumption at node. -void +/** + * Trace function for total energy consumption at node. + * + * \param oldValue Old value + * \param totalEnergy New value + */void TotalEnergy (double oldValue, double totalEnergy) { NS_LOG_UNCOND (Simulator::Now ().GetSeconds () << "s Total energy consumed by radio = " << totalEnergy << "J"); } -/// Trace function for the power harvested by the energy harvester. +/** + * Trace function for the power harvested by the energy harvester. + * + * \param oldValue Old value + * \param harvestedPower New value + */ void HarvestedPower (double oldValue, double harvestedPower) { @@ -146,16 +166,20 @@ HarvestedPower (double oldValue, double harvestedPower) << "s Current harvested power = " << harvestedPower << " W"); } -/// Trace function for the total energy harvested by the node. +/** + * Trace function for the total energy harvested by the node. + * + * \param oldValue Old value + * \param totalEnergyHarvested New value + */ void -TotalEnergyHarvested (double oldValue, double TotalEnergyHarvested) +TotalEnergyHarvested (double oldValue, double totalEnergyHarvested) { NS_LOG_UNCOND (Simulator::Now ().GetSeconds () << "s Total energy harvested by harvester = " - << TotalEnergyHarvested << " J"); + << totalEnergyHarvested << " J"); } - int main (int argc, char *argv[]) { diff --git a/examples/naming/object-names.cc b/examples/naming/object-names.cc index 4c31d2c89..8eceae341 100644 --- a/examples/naming/object-names.cc +++ b/examples/naming/object-names.cc @@ -33,8 +33,15 @@ using namespace ns3; NS_LOG_COMPONENT_DEFINE ("ObjectNamesExample"); +/// Counter of the received bytes. uint32_t bytesReceived = 0; +/** + * Function called when a packet is received. + * + * \param context The context. + * \param packet The received packet. + */ void RxEvent (std::string context, Ptr packet) { diff --git a/examples/stats/wifi-example-sim.cc b/examples/stats/wifi-example-sim.cc index 7dcd38ab1..482a1a471 100644 --- a/examples/stats/wifi-example-sim.cc +++ b/examples/stats/wifi-example-sim.cc @@ -44,6 +44,13 @@ using namespace ns3; NS_LOG_COMPONENT_DEFINE ("WiFiDistanceExperiment"); +/** + * Function called when a packet is transmitted. + * + * \param datac The counter of the number of transmitted packets. + * \param path The callback context + * \param packet The transmsiotted packet. + */ void TxCallback (Ptr > datac, std::string path, Ptr packet) { NS_LOG_INFO ("Sent frame counted in " << @@ -53,8 +60,6 @@ void TxCallback (Ptr > datac, } - - //---------------------------------------------------------------------- //-- main //---------------------------------------------- diff --git a/examples/tcp/tcp-large-transfer.cc b/examples/tcp/tcp-large-transfer.cc index 95a527906..6e5ae4b4b 100644 --- a/examples/tcp/tcp-large-transfer.cc +++ b/examples/tcp/tcp-large-transfer.cc @@ -44,12 +44,16 @@ using namespace ns3; NS_LOG_COMPONENT_DEFINE ("TcpLargeTransfer"); -// The number of bytes to send in this simulation. +/// The number of bytes to send in this simulation. static const uint32_t totalTxBytes = 2000000; +/// The actual number of sent bytes. static uint32_t currentTxBytes = 0; + // Perform series of 1040 byte writes (this is a multiple of 26 since // we want to detect data splicing in the output stream) +/// Write size. static const uint32_t writeSize = 1040; +/// Data to be written. uint8_t data[writeSize]; // These are for starting the writing process, and handling the sending @@ -57,9 +61,29 @@ uint8_t data[writeSize]; // implement a sending "Application", although not a proper ns3::Application // subclass. -void StartFlow (Ptr, Ipv4Address, uint16_t); -void WriteUntilBufferFull (Ptr, uint32_t); +/** + * Start a flow. + * + * \param localSocket The local (sending) socket. + * \param servAddress The server address. + * \param servPort The server port. + */ +void StartFlow (Ptr localSocket, Ipv4Address servAddress, uint16_t servPort); +/** + * Write to the buffer, filling it. + * + * \param localSocket The socket. + * \param txSpace The number of bytes to write. + */ +void WriteUntilBufferFull (Ptr localSocket, uint32_t txSpace); + +/** + * Congestion window tracker function. + * + * \param oldval Old value. + * \param newval New value. + */ static void CwndTracer (uint32_t oldval, uint32_t newval) { diff --git a/examples/tcp/tcp-validation.cc b/examples/tcp/tcp-validation.cc index ff6ccd035..cbf7596ac 100644 --- a/examples/tcp/tcp-validation.cc +++ b/examples/tcp/tcp-validation.cc @@ -158,13 +158,20 @@ NS_LOG_COMPONENT_DEFINE ("TcpValidation"); // These variables are declared outside of main() so that they can // be used in trace sinks. -uint32_t g_firstBytesReceived = 0; -uint32_t g_secondBytesReceived = 0; -uint32_t g_marksObserved = 0; -uint32_t g_dropsObserved = 0; -std::string g_validate = ""; // Empty string disables this mode -bool g_validationFailed = false; +uint32_t g_firstBytesReceived = 0; //!< First received packet size. +uint32_t g_secondBytesReceived = 0; //!< Second received packet size. +uint32_t g_marksObserved = 0; //!< Number of marked packets observed. +uint32_t g_dropsObserved = 0; //!< Number of dropped packets observed. +std::string g_validate = ""; //!< Empty string disables validation. +bool g_validationFailed = false; //!< True if validation failed. +/** + * Trace first congestion window. + * + * \param ofStream Output filestream. + * \param oldCwnd Old value. + * \param newCwnd new value. + */ void TraceFirstCwnd (std::ofstream* ofStream, uint32_t oldCwnd, uint32_t newCwnd) { @@ -202,6 +209,14 @@ TraceFirstCwnd (std::ofstream* ofStream, uint32_t oldCwnd, uint32_t newCwnd) } } +/** + * Trace first TcpDctcp. + * + * \param ofStream Output filestream. + * \param bytesMarked Bytes marked. + * \param bytesAcked Bytes ACKed. + * \param alpha Alpha. + */ void TraceFirstDctcp (std::ofstream* ofStream, uint32_t bytesMarked, uint32_t bytesAcked, double alpha) { @@ -245,6 +260,13 @@ TraceFirstDctcp (std::ofstream* ofStream, uint32_t bytesMarked, uint32_t bytesAc } } +/** + * Trace first RTT. + * + * \param ofStream Output filestream. + * \param oldRtt Old value. + * \param newRtt New value. + */ void TraceFirstRtt (std::ofstream* ofStream, Time oldRtt, Time newRtt) { @@ -254,6 +276,13 @@ TraceFirstRtt (std::ofstream* ofStream, Time oldRtt, Time newRtt) } } +/** + * Trace second congestion window. + * + * \param ofStream Output filestream. + * \param oldCwnd Old value. + * \param newCwnd new value. + */ void TraceSecondCwnd (std::ofstream* ofStream, uint32_t oldCwnd, uint32_t newCwnd) { @@ -265,6 +294,13 @@ TraceSecondCwnd (std::ofstream* ofStream, uint32_t oldCwnd, uint32_t newCwnd) } } +/** + * Trace second RTT. + * + * \param ofStream Output filestream. + * \param oldRtt Old value. + * \param newRtt New value. + */ void TraceSecondRtt (std::ofstream* ofStream, Time oldRtt, Time newRtt) { @@ -274,6 +310,14 @@ TraceSecondRtt (std::ofstream* ofStream, Time oldRtt, Time newRtt) } } +/** + * Trace second TcpDctcp. + * + * \param ofStream Output filestream. + * \param bytesMarked Bytes marked. + * \param bytesAcked Bytes ACKed. + * \param alpha Alpha. + */ void TraceSecondDctcp (std::ofstream* ofStream, uint32_t bytesMarked, uint32_t bytesAcked, double alpha) { @@ -283,6 +327,12 @@ TraceSecondDctcp (std::ofstream* ofStream, uint32_t bytesMarked, uint32_t bytesA } } +/** + * Trace ping RTT. + * + * \param ofStream Output filestream. + * \param rtt RTT value. + */ void TracePingRtt (std::ofstream* ofStream, Time rtt) { @@ -292,18 +342,36 @@ TracePingRtt (std::ofstream* ofStream, Time rtt) } } +/** + * Trace first Rx. + * + * \param packet The packet. + * \param address The sender address. + */ void TraceFirstRx (Ptr packet, const Address &address) { g_firstBytesReceived += packet->GetSize (); } +/** + * Trace second Rx. + * + * \param packet The packet. + * \param address The sender address. + */ void TraceSecondRx (Ptr packet, const Address &address) { g_secondBytesReceived += packet->GetSize (); } +/** + * Trace queue drop. + * + * \param ofStream Output filestream. + * \param item The dropped QueueDiscItem. + */ void TraceQueueDrop (std::ofstream* ofStream, Ptr item) { @@ -314,6 +382,13 @@ TraceQueueDrop (std::ofstream* ofStream, Ptr item) g_dropsObserved++; } +/** + * Trace queue marks. + * + * \param ofStream Output filestream. + * \param item The marked QueueDiscItem. + * \param reason The reason. + */ void TraceQueueMark (std::ofstream* ofStream, Ptr item, const char* reason) { @@ -324,6 +399,14 @@ TraceQueueMark (std::ofstream* ofStream, Ptr item, const ch g_marksObserved++; } +/** + * Trace queue length. + * + * \param ofStream Output filestream. + * \param queueLinkRate Queue link rate. + * \param oldVal Old value. + * \param newVal New value. + */ void TraceQueueLength (std::ofstream* ofStream, DataRate queueLinkRate, uint32_t oldVal, uint32_t newVal) { @@ -334,6 +417,12 @@ TraceQueueLength (std::ofstream* ofStream, DataRate queueLinkRate, uint32_t oldV } } +/** + * Trace marks frequency. + * + * \param ofStream Output filestream. + * \param marksSamplingInterval The mark sampling interval. + */ void TraceMarksFrequency (std::ofstream* ofStream, Time marksSamplingInterval) { @@ -345,6 +434,12 @@ TraceMarksFrequency (std::ofstream* ofStream, Time marksSamplingInterval) Simulator::Schedule (marksSamplingInterval, &TraceMarksFrequency, ofStream, marksSamplingInterval); } +/** + * Trace the first throughput. + * + * \param ofStream Output filestream. + * \param throughputInterval The throughput interval. + */ void TraceFirstThroughput (std::ofstream* ofStream, Time throughputInterval) { @@ -385,6 +480,12 @@ TraceFirstThroughput (std::ofstream* ofStream, Time throughputInterval) } } +/** + * Trace the second throughput. + * + * \param ofStream Output filestream. + * \param throughputInterval The throughput interval. + */ void TraceSecondThroughput (std::ofstream* ofStream, Time throughputInterval) { @@ -396,48 +497,84 @@ TraceSecondThroughput (std::ofstream* ofStream, Time throughputInterval) Simulator::Schedule (throughputInterval, &TraceSecondThroughput, ofStream, throughputInterval); } +/** + * Schedule trace connection. + * + * \param ofStream Output filestream. + */ void ScheduleFirstTcpCwndTraceConnection (std::ofstream* ofStream) { Config::ConnectWithoutContextFailSafe ("/NodeList/1/$ns3::TcpL4Protocol/SocketList/0/CongestionWindow", MakeBoundCallback (&TraceFirstCwnd, ofStream)); } +/** + * Schedule trace connection. + * + * \param ofStream Output filestream. + */ void ScheduleFirstTcpRttTraceConnection (std::ofstream* ofStream) { Config::ConnectWithoutContextFailSafe ("/NodeList/1/$ns3::TcpL4Protocol/SocketList/0/RTT", MakeBoundCallback (&TraceFirstRtt, ofStream)); } +/** + * Schedule trace connection. + * + * \param ofStream Output filestream. + */ void ScheduleFirstDctcpTraceConnection (std::ofstream* ofStream) { Config::ConnectWithoutContextFailSafe ("/NodeList/1/$ns3::TcpL4Protocol/SocketList/0/CongestionOps/$ns3::TcpDctcp/CongestionEstimate", MakeBoundCallback (&TraceFirstDctcp, ofStream)); } +/** + * Schedule trace connection. + * + * \param ofStream Output filestream. + */ void ScheduleSecondDctcpTraceConnection (std::ofstream* ofStream) { Config::ConnectWithoutContextFailSafe ("/NodeList/2/$ns3::TcpL4Protocol/SocketList/0/CongestionOps/$ns3::TcpDctcp/CongestionEstimate", MakeBoundCallback (&TraceSecondDctcp, ofStream)); } +/** + * Schedule trace connection. + */ void ScheduleFirstPacketSinkConnection (void) { Config::ConnectWithoutContextFailSafe ("/NodeList/6/ApplicationList/*/$ns3::PacketSink/Rx", MakeCallback (&TraceFirstRx)); } +/** + * Schedule trace connection. + * + * \param ofStream Output filestream. + */ void ScheduleSecondTcpCwndTraceConnection (std::ofstream* ofStream) { Config::ConnectWithoutContext ("/NodeList/2/$ns3::TcpL4Protocol/SocketList/0/CongestionWindow", MakeBoundCallback (&TraceSecondCwnd, ofStream)); } +/** + * Schedule trace connection. + * + * \param ofStream Output filestream. + */ void ScheduleSecondTcpRttTraceConnection (std::ofstream* ofStream) { Config::ConnectWithoutContext ("/NodeList/2/$ns3::TcpL4Protocol/SocketList/0/RTT", MakeBoundCallback (&TraceSecondRtt, ofStream)); } +/** + * Schedule trace connection. + */ void ScheduleSecondPacketSinkConnection (void) { diff --git a/examples/tcp/tcp-variants-comparison.cc b/examples/tcp/tcp-variants-comparison.cc index 90b62075c..56e5592d0 100644 --- a/examples/tcp/tcp-variants-comparison.cc +++ b/examples/tcp/tcp-variants-comparison.cc @@ -55,20 +55,26 @@ using namespace ns3; NS_LOG_COMPONENT_DEFINE ("TcpVariantsComparison"); -static std::map firstCwnd; -static std::map firstSshThr; -static std::map firstRtt; -static std::map firstRto; -static std::map> cWndStream; -static std::map> ssThreshStream; -static std::map> rttStream; -static std::map> rtoStream; -static std::map> nextTxStream; -static std::map> nextRxStream; -static std::map> inFlightStream; -static std::map cWndValue; -static std::map ssThreshValue; +static std::map firstCwnd; //!< First congestion window. +static std::map firstSshThr; //!< First SlowStart threshold. +static std::map firstRtt; //!< First RTT. +static std::map firstRto; //!< First RTO. +static std::map> cWndStream; //!< Congstion window outut stream. +static std::map> ssThreshStream; //!< SlowStart threshold outut stream. +static std::map> rttStream; //!< RTT outut stream. +static std::map> rtoStream; //!< RTO outut stream. +static std::map> nextTxStream; //!< Next TX outut stream. +static std::map> nextRxStream; //!< Next RX outut stream. +static std::map> inFlightStream; //!< In flight outut stream. +static std::map cWndValue; //!< congestion window value. +static std::map ssThreshValue; //!< SlowStart threshold value. +/** + * Get the Node Id From Context. + * + * \param context The context. + * \return the node ID. + */ static uint32_t GetNodeIdFromContext (std::string context) { @@ -77,6 +83,13 @@ GetNodeIdFromContext (std::string context) return std::stoul (context.substr (n1 + 1, n2 - n1 - 1)); } +/** + * Congestion window tracer. + * + * \param context The context. + * \param oldval Old value. + * \param newval New value. + */ static void CwndTracer (std::string context, uint32_t oldval, uint32_t newval) { @@ -97,6 +110,13 @@ CwndTracer (std::string context, uint32_t oldval, uint32_t newval) } } +/** + * Slow start threshold tracer. + * + * \param context The context. + * \param oldval Old value. + * \param newval New value. + */ static void SsThreshTracer (std::string context, uint32_t oldval, uint32_t newval) { @@ -116,6 +136,13 @@ SsThreshTracer (std::string context, uint32_t oldval, uint32_t newval) } } +/** + * RTT tracer. + * + * \param context The context. + * \param oldval Old value. + * \param newval New value. + */ static void RttTracer (std::string context, Time oldval, Time newval) { @@ -129,6 +156,13 @@ RttTracer (std::string context, Time oldval, Time newval) *rttStream[nodeId]->GetStream () << Simulator::Now ().GetSeconds () << " " << newval.GetSeconds () << std::endl; } +/** + * RTO tracer. + * + * \param context The context. + * \param oldval Old value. + * \param newval New value. + */ static void RtoTracer (std::string context, Time oldval, Time newval) { @@ -142,6 +176,13 @@ RtoTracer (std::string context, Time oldval, Time newval) *rtoStream[nodeId]->GetStream () << Simulator::Now ().GetSeconds () << " " << newval.GetSeconds () << std::endl; } +/** + * Next TX tracer. + * + * \param context The context. + * \param old Old sequence number. + * \param nextTx Next sequence number. + */ static void NextTxTracer (std::string context, [[maybe_unused]] SequenceNumber32 old, SequenceNumber32 nextTx) { @@ -150,6 +191,13 @@ NextTxTracer (std::string context, [[maybe_unused]] SequenceNumber32 old, Sequen *nextTxStream[nodeId]->GetStream () << Simulator::Now ().GetSeconds () << " " << nextTx << std::endl; } +/** + * In-flight tracer. + * + * \param context The context. + * \param old Old value. + * \param inFlight In flight value. + */ static void InFlightTracer (std::string context, [[maybe_unused]] uint32_t old, uint32_t inFlight) { @@ -158,6 +206,13 @@ InFlightTracer (std::string context, [[maybe_unused]] uint32_t old, uint32_t inF *inFlightStream[nodeId]->GetStream () << Simulator::Now ().GetSeconds () << " " << inFlight << std::endl; } +/** + * Next RX tracer. + * + * \param context The context. + * \param old Old sequence number. + * \param nextRx Next sequence number. + */ static void NextRxTracer (std::string context, [[maybe_unused]] SequenceNumber32 old, SequenceNumber32 nextRx) { @@ -166,6 +221,12 @@ NextRxTracer (std::string context, [[maybe_unused]] SequenceNumber32 old, Sequen *nextRxStream[nodeId]->GetStream () << Simulator::Now ().GetSeconds () << " " << nextRx << std::endl; } +/** + * Congestion window trace connection. + * + * \param cwnd_tr_file_name Congestion window trace file name. + * \param nodeId Node ID. + */ static void TraceCwnd (std::string cwnd_tr_file_name, uint32_t nodeId) { @@ -175,6 +236,12 @@ TraceCwnd (std::string cwnd_tr_file_name, uint32_t nodeId) MakeCallback (&CwndTracer)); } +/** + * Slow start threshold trace connection. + * + * \param ssthresh_tr_file_name Slow start threshold trace file name. + * \param nodeId Node ID. + */ static void TraceSsThresh (std::string ssthresh_tr_file_name, uint32_t nodeId) { @@ -184,6 +251,12 @@ TraceSsThresh (std::string ssthresh_tr_file_name, uint32_t nodeId) MakeCallback (&SsThreshTracer)); } +/** + * RTT trace connection. + * + * \param rtt_tr_file_name RTT trace file name. + * \param nodeId Node ID. + */ static void TraceRtt (std::string rtt_tr_file_name, uint32_t nodeId) { @@ -193,6 +266,12 @@ TraceRtt (std::string rtt_tr_file_name, uint32_t nodeId) MakeCallback (&RttTracer)); } +/** + * RTO trace connection. + * + * \param rto_tr_file_name RTO trace file name. + * \param nodeId Node ID. + */ static void TraceRto (std::string rto_tr_file_name, uint32_t nodeId) { @@ -202,6 +281,12 @@ TraceRto (std::string rto_tr_file_name, uint32_t nodeId) MakeCallback (&RtoTracer)); } +/** + * Next TX trace connection. + * + * \param next_tx_seq_file_name Next TX trace file name. + * \param nodeId Node ID. + */ static void TraceNextTx (std::string &next_tx_seq_file_name, uint32_t nodeId) { @@ -211,6 +296,12 @@ TraceNextTx (std::string &next_tx_seq_file_name, uint32_t nodeId) MakeCallback (&NextTxTracer)); } +/** + * In flight trace connection. + * + * \param in_flight_file_name In flight trace file name. + * \param nodeId Node ID. + */ static void TraceInFlight (std::string &in_flight_file_name, uint32_t nodeId) { @@ -220,6 +311,12 @@ TraceInFlight (std::string &in_flight_file_name, uint32_t nodeId) MakeCallback (&InFlightTracer)); } +/** + * Next RX trace connection. + * + * \param next_rx_seq_file_name Next RX trace file name. + * \param nodeId Node ID. + */ static void TraceNextRx (std::string &next_rx_seq_file_name, uint32_t nodeId) { diff --git a/examples/traffic-control/queue-discs-benchmark.cc b/examples/traffic-control/queue-discs-benchmark.cc index 0ebb77cf7..caa9803db 100644 --- a/examples/traffic-control/queue-discs-benchmark.cc +++ b/examples/traffic-control/queue-discs-benchmark.cc @@ -66,28 +66,55 @@ using namespace ns3; NS_LOG_COMPONENT_DEFINE ("BenchmarkQueueDiscs"); +/** + * Print the queue limitis. + * + * \param stream The ouput stream. + * \param oldVal Old value. + * \param newVal New value. + */ void LimitsTrace (Ptr stream, uint32_t oldVal, uint32_t newVal) { *stream->GetStream () << Simulator::Now ().GetSeconds () << " " << newVal << std::endl; } +/** + * Print the bytes in the queue. + * + * \param stream The ouput stream. + * \param oldVal Old value. + * \param newVal New value. + */ void BytesInQueueTrace (Ptr stream, uint32_t oldVal, uint32_t newVal) { *stream->GetStream () << Simulator::Now ().GetSeconds () << " " << newVal << std::endl; } +/** + * Sample and print the queue goodput. + * + * \param app The Tx app. + * \param stream The ouput stream. + * \param period The sampling period. + */ static void -GoodputSampling (std::string fileName, ApplicationContainer app, Ptr stream, float period) +GoodputSampling (ApplicationContainer app, Ptr stream, float period) { - Simulator::Schedule (Seconds (period), &GoodputSampling, fileName, app, stream, period); + Simulator::Schedule (Seconds (period), &GoodputSampling, app, stream, period); double goodput; uint64_t totalPackets = DynamicCast (app.Get (0))->GetTotalRx (); goodput = totalPackets * 8 / (Simulator::Now ().GetSeconds () * 1024); // Kbit/s *stream->GetStream () << Simulator::Now ().GetSeconds () << " " << goodput << std::endl; } +/** + * Print the ping RTT. + * + * \param context The context. + * \param rtt The RTT. + */ static void PingRtt (std::string context, Time rtt) { std::cout << context << "=" << rtt.GetMilliSeconds () << " ms" << std::endl; @@ -289,10 +316,10 @@ int main (int argc, char *argv[]) sourceApps.Stop (Seconds (stopTime - 0.1)); Ptr uploadGoodputStream = ascii.CreateFileStream (queueDiscType + "-upGoodput.txt"); - Simulator::Schedule (Seconds (samplingPeriod), &GoodputSampling, queueDiscType + "-upGoodput.txt", uploadApp, + Simulator::Schedule (Seconds (samplingPeriod), &GoodputSampling, uploadApp, uploadGoodputStream, samplingPeriod); Ptr downloadGoodputStream = ascii.CreateFileStream (queueDiscType + "-downGoodput.txt"); - Simulator::Schedule (Seconds (samplingPeriod), &GoodputSampling, queueDiscType + "-downGoodput.txt", downloadApp, + Simulator::Schedule (Seconds (samplingPeriod), &GoodputSampling, downloadApp, downloadGoodputStream, samplingPeriod); // Flow monitor diff --git a/examples/traffic-control/traffic-control.cc b/examples/traffic-control/traffic-control.cc index 7e55ed6a8..85add7ff7 100644 --- a/examples/traffic-control/traffic-control.cc +++ b/examples/traffic-control/traffic-control.cc @@ -66,18 +66,35 @@ using namespace ns3; NS_LOG_COMPONENT_DEFINE ("TrafficControlExample"); +/** + * Number of packets in TX queue trace. + * + * \param oldValue Old velue. + * \param newValue New value. + */ void TcPacketsInQueueTrace (uint32_t oldValue, uint32_t newValue) { std::cout << "TcPacketsInQueue " << oldValue << " to " << newValue << std::endl; } +/** + * Packets in the device queue trace. + * + * \param oldValue Old velue. + * \param newValue New value. + */ void DevicePacketsInQueueTrace (uint32_t oldValue, uint32_t newValue) { std::cout << "DevicePacketsInQueue " << oldValue << " to " << newValue << std::endl; } +/** + * TC Soujoun time trace. + * + * \param sojournTime The soujourn time. + */ void SojournTimeTrace (Time sojournTime) { diff --git a/examples/tutorial/fifth.cc b/examples/tutorial/fifth.cc index 9da967519..95fa26d19 100644 --- a/examples/tutorial/fifth.cc +++ b/examples/tutorial/fifth.cc @@ -62,12 +62,23 @@ NS_LOG_COMPONENT_DEFINE ("FifthScriptExample"); // +/** + * Congestion window change callback + * + * \param oldCwnd Old congestion window. + * \param newCwnd New congestion window. + */ static void CwndChange (uint32_t oldCwnd, uint32_t newCwnd) { NS_LOG_UNCOND (Simulator::Now ().GetSeconds () << "\t" << newCwnd); } +/** + * Rx drop callback + * + * \param p The dropped packet. + */ static void RxDrop (Ptr p) { diff --git a/examples/tutorial/seventh.cc b/examples/tutorial/seventh.cc index 5480c3e6f..305beb166 100644 --- a/examples/tutorial/seventh.cc +++ b/examples/tutorial/seventh.cc @@ -66,6 +66,13 @@ NS_LOG_COMPONENT_DEFINE ("SeventhScriptExample"); // +/** + * Congestion window change callback + * + * \param stream The ouput stream file. + * \param oldCwnd Old congestion window. + * \param newCwnd New congestion window. + */ static void CwndChange (Ptr stream, uint32_t oldCwnd, uint32_t newCwnd) { @@ -73,6 +80,12 @@ CwndChange (Ptr stream, uint32_t oldCwnd, uint32_t newCwnd) *stream->GetStream () << Simulator::Now ().GetSeconds () << "\t" << oldCwnd << "\t" << newCwnd << std::endl; } +/** + * Rx drop callback + * + * \param file The ouput PCAP file. + * \param p The dropped packet. + */ static void RxDrop (Ptr file, Ptr p) { diff --git a/examples/tutorial/sixth.cc b/examples/tutorial/sixth.cc index 7af6428c2..abeb6436e 100644 --- a/examples/tutorial/sixth.cc +++ b/examples/tutorial/sixth.cc @@ -62,6 +62,13 @@ NS_LOG_COMPONENT_DEFINE ("SixthScriptExample"); // +/** + * Congestion window change callback + * + * \param stream The ouput stream file. + * \param oldCwnd Old congestion window. + * \param newCwnd New congestion window. + */ static void CwndChange (Ptr stream, uint32_t oldCwnd, uint32_t newCwnd) { @@ -69,6 +76,12 @@ CwndChange (Ptr stream, uint32_t oldCwnd, uint32_t newCwnd) *stream->GetStream () << Simulator::Now ().GetSeconds () << "\t" << oldCwnd << "\t" << newCwnd << std::endl; } +/** + * Rx drop callback + * + * \param file The ouput PCAP file. + * \param p The dropped packet. + */ static void RxDrop (Ptr file, Ptr p) { diff --git a/examples/wireless/mixed-wired-wireless.cc b/examples/wireless/mixed-wired-wireless.cc index daba0be13..9d5554601 100644 --- a/examples/wireless/mixed-wired-wireless.cc +++ b/examples/wireless/mixed-wired-wireless.cc @@ -80,10 +80,13 @@ using namespace ns3; // NS_LOG_COMPONENT_DEFINE ("MixedWireless"); -// -// This function will be used below as a trace sink, if the command-line -// argument or default value "useCourseChangeCallback" is set to true -// +/** + * This function will be used below as a trace sink, if the command-line + * argument or default value "useCourseChangeCallback" is set to true + * + * \param path The callback path. + * \param model The mobility model. + */ static void CourseChangeCallback (std::string path, Ptr model) { diff --git a/examples/wireless/wifi-ap.cc b/examples/wireless/wifi-ap.cc index 4cf0a7f28..452081a07 100644 --- a/examples/wireless/wifi-ap.cc +++ b/examples/wireless/wifi-ap.cc @@ -34,8 +34,15 @@ using namespace ns3; +/// True for verbose output. static bool g_verbose = true; +/** + * MAC-level TX trace. + * + * \param context The context. + * \param p The packet. + */ void DevTxTrace (std::string context, Ptr p) { @@ -44,6 +51,13 @@ DevTxTrace (std::string context, Ptr p) std::cout << " TX p: " << *p << std::endl; } } + +/** + * MAC-level RX trace. + * + * \param context The context. + * \param p The packet. + */ void DevRxTrace (std::string context, Ptr p) { @@ -52,6 +66,16 @@ DevRxTrace (std::string context, Ptr p) std::cout << " RX p: " << *p << std::endl; } } + +/** + * PHY-level RX OK trace + * + * \param context The context. + * \param packet The packet. + * \param snr The SNR. + * \param mode The wifi mode. + * \param preamble The preamble. + */ void PhyRxOkTrace (std::string context, Ptr packet, double snr, WifiMode mode, WifiPreamble preamble) { @@ -60,6 +84,14 @@ PhyRxOkTrace (std::string context, Ptr packet, double snr, WifiMod std::cout << "PHYRXOK mode=" << mode << " snr=" << snr << " " << *packet << std::endl; } } + +/** + * PHY-level RX error trace + * + * \param context The context. + * \param packet The packet. + * \param snr The SNR. + */ void PhyRxErrorTrace (std::string context, Ptr packet, double snr) { @@ -68,6 +100,16 @@ PhyRxErrorTrace (std::string context, Ptr packet, double snr) std::cout << "PHYRXERROR snr=" << snr << " " << *packet << std::endl; } } + +/** + * PHY-level TX trace. + * + * \param context The context. + * \param packet The packet. + * \param mode The wifi mode. + * \param preamble The preamble. + * \param txPower The TX power. + */ void PhyTxTrace (std::string context, Ptr packet, WifiMode mode, WifiPreamble preamble, uint8_t txPower) { @@ -76,6 +118,15 @@ PhyTxTrace (std::string context, Ptr packet, WifiMode mode, WifiPr std::cout << "PHYTX mode=" << mode << " " << *packet << std::endl; } } + +/** + * PHY state trace. + * + * \param context The context. + * \param start Start time of the state. + * \param duration Duration of the state. + * \param state The state. + */ void PhyStateTrace (std::string context, Time start, Time duration, WifiPhyState state) { @@ -85,30 +136,22 @@ PhyStateTrace (std::string context, Time start, Time duration, WifiPhyState stat } } -static void -SetPosition (Ptr node, Vector position) -{ - Ptr mobility = node->GetObject (); - mobility->SetPosition (position); -} - -static Vector -GetPosition (Ptr node) -{ - Ptr mobility = node->GetObject (); - return mobility->GetPosition (); -} - +/** + * Move a node position by 5m on the x axis every second, up to 210m. + * + * \param node The node. + */ static void AdvancePosition (Ptr node) { - Vector pos = GetPosition (node); + Ptr mobility = node->GetObject (); + Vector pos = mobility->GetPosition (); pos.x += 5.0; if (pos.x >= 210.0) { return; } - SetPosition (node, pos); + mobility->SetPosition (pos); Simulator::Schedule (Seconds (1.0), &AdvancePosition, node); } diff --git a/examples/wireless/wifi-backward-compatibility.cc b/examples/wireless/wifi-backward-compatibility.cc index 858332d63..db1247d64 100644 --- a/examples/wireless/wifi-backward-compatibility.cc +++ b/examples/wireless/wifi-backward-compatibility.cc @@ -50,6 +50,12 @@ using namespace ns3; NS_LOG_COMPONENT_DEFINE ("wifi-backward-compatibility"); +/** + * Convert a string (e.g., "80211a") to a pair {WifiStandard, WifiPhyBand} + * + * \param version The WiFi standard version. + * \return a pair of WifiStandard, WifiPhyBand + */ std::pair ConvertStringToStandardAndBand (std::string version) { WifiStandard standard = WIFI_STANDARD_80211a; diff --git a/examples/wireless/wifi-hidden-terminal.cc b/examples/wireless/wifi-hidden-terminal.cc index 3c07620fb..f9758d869 100644 --- a/examples/wireless/wifi-hidden-terminal.cc +++ b/examples/wireless/wifi-hidden-terminal.cc @@ -47,7 +47,13 @@ using namespace ns3; -/// Run single 10 seconds experiment + +/** + * Run single 10 seconds experiment + * + * \param enableCtsRts if true, enable RTS/CTS for packets larget than 100 bytes. + * \param wifiManager WiFi manager to use. + */ void experiment (bool enableCtsRts, std::string wifiManager) { // 0. Enable or disable CTS/RTS diff --git a/examples/wireless/wifi-multirate.cc b/examples/wireless/wifi-multirate.cc index 85d9190ef..fd77f6038 100644 --- a/examples/wireless/wifi-multirate.cc +++ b/examples/wireless/wifi-multirate.cc @@ -428,18 +428,18 @@ Experiment::SendMultiDestinations (Ptr sender, NodeContainer c) } } -static inline Vector -GetPosition (Ptr node) -{ - Ptr mobility = node->GetObject (); - return mobility->GetPosition (); -} - +/** + * Print the position of two nodes. + * + * \param client Client node. + * \param server Server node. + * \return a string with the nodes data and positions + */ static inline std::string PrintPosition (Ptr client, Ptr server) { - Vector serverPos = GetPosition (server); - Vector clientPos = GetPosition (client); + Vector serverPos = server->GetObject ()->GetPosition (); + Vector clientPos = client->GetObject ()->GetPosition (); Ptr ipv4Server = server->GetObject (); Ptr ipv4Client = client->GetObject (); diff --git a/examples/wireless/wifi-power-adaptation-distance.cc b/examples/wireless/wifi-power-adaptation-distance.cc index a1f9eb031..33ef09e6f 100644 --- a/examples/wireless/wifi-power-adaptation-distance.cc +++ b/examples/wireless/wifi-power-adaptation-distance.cc @@ -351,11 +351,27 @@ NodeStatistics::GetPowerDatafile () return m_output_power; } +/** + * Callback called by WifiNetDevice/RemoteStationManager/x/PowerChange. + * + * \param path The trace path. + * \param oldPower Old Tx power. + * \param newPower Actual Tx power. + * \param dest Destination of the transmission. + */ void PowerCallback (std::string path, double oldPower, double newPower, Mac48Address dest) { NS_LOG_INFO ((Simulator::Now ()).GetSeconds () << " " << dest << " Old power=" << oldPower << " New power=" << newPower); } +/** + * \brief Callback called by WifiNetDevice/RemoteStationManager/x/RateChange. + * + * \param path The trace path. + * \param oldRate Old rate. + * \param newRate Actual rate. + * \param dest Destination of the transmission. + */ void RateCallback (std::string path, DataRate oldRate, DataRate newRate, Mac48Address dest) { NS_LOG_INFO ((Simulator::Now ()).GetSeconds () << " " << dest << " Old rate=" << oldRate << " New rate=" << newRate); diff --git a/examples/wireless/wifi-power-adaptation-interference.cc b/examples/wireless/wifi-power-adaptation-interference.cc index f2cb6838f..4455301b6 100644 --- a/examples/wireless/wifi-power-adaptation-interference.cc +++ b/examples/wireless/wifi-power-adaptation-interference.cc @@ -417,11 +417,27 @@ NodeStatistics::GetBusyTime () return m_totalBusyTime + m_totalRxTime; } +/** + * Callback called by WifiNetDevice/RemoteStationManager/x/PowerChange. + * + * \param path The trace path. + * \param oldPower Old Tx power. + * \param newPower Actual Tx power. + * \param dest Destination of the transmission. + */ void PowerCallback (std::string path, double oldPower, double newPower, Mac48Address dest) { NS_LOG_INFO ((Simulator::Now ()).GetSeconds () << " " << dest << " Old power=" << oldPower << " New power=" << newPower); } +/** + * \brief Callback called by WifiNetDevice/RemoteStationManager/x/RateChange. + * + * \param path The trace path. + * \param oldRate Old rate. + * \param newRate Actual rate. + * \param dest Destination of the transmission. + */ void RateCallback (std::string path, DataRate oldRate, DataRate newRate, Mac48Address dest) { NS_LOG_INFO ((Simulator::Now ()).GetSeconds () << " " << dest << " Old rate=" << oldRate << " New rate=" << newRate); diff --git a/examples/wireless/wifi-simple-adhoc-grid.cc b/examples/wireless/wifi-simple-adhoc-grid.cc index e2e700bc5..fcf2b75fe 100644 --- a/examples/wireless/wifi-simple-adhoc-grid.cc +++ b/examples/wireless/wifi-simple-adhoc-grid.cc @@ -89,6 +89,11 @@ using namespace ns3; NS_LOG_COMPONENT_DEFINE ("WifiSimpleAdhocGrid"); +/** + * Function called when a packet is received. + * + * \param socket The receiving socket. + */ void ReceivePacket (Ptr socket) { while (socket->Recv ()) @@ -97,6 +102,14 @@ void ReceivePacket (Ptr socket) } } +/** + * Generate traffic. + * + * \param socket The sending socket. + * \param pktSize The packet size. + * \param pktCount The packet count. + * \param pktInterval The interval between two packets. + */ static void GenerateTraffic (Ptr socket, uint32_t pktSize, uint32_t pktCount, Time pktInterval ) { diff --git a/examples/wireless/wifi-simple-adhoc.cc b/examples/wireless/wifi-simple-adhoc.cc index 2756e4ab0..c05d85680 100644 --- a/examples/wireless/wifi-simple-adhoc.cc +++ b/examples/wireless/wifi-simple-adhoc.cc @@ -66,6 +66,11 @@ using namespace ns3; NS_LOG_COMPONENT_DEFINE ("WifiSimpleAdhoc"); +/** + * Function called when a packet is received. + * + * \param socket The receiving socket. + */ void ReceivePacket (Ptr socket) { while (socket->Recv ()) @@ -74,6 +79,14 @@ void ReceivePacket (Ptr socket) } } +/** + * Generate traffic. + * + * \param socket The sending socket. + * \param pktSize The packet size. + * \param pktCount The packet count. + * \param pktInterval The interval between two packets. + */ static void GenerateTraffic (Ptr socket, uint32_t pktSize, uint32_t pktCount, Time pktInterval ) { diff --git a/examples/wireless/wifi-simple-infra.cc b/examples/wireless/wifi-simple-infra.cc index cc99ce0d6..2c1762d2a 100644 --- a/examples/wireless/wifi-simple-infra.cc +++ b/examples/wireless/wifi-simple-infra.cc @@ -92,6 +92,11 @@ using namespace ns3; NS_LOG_COMPONENT_DEFINE ("WifiSimpleInfra"); +/** + * Function called when a packet is received. + * + * \param socket The receiving socket. + */ void ReceivePacket (Ptr socket) { while (socket->Recv ()) @@ -100,6 +105,14 @@ void ReceivePacket (Ptr socket) } } +/** + * Generate traffic. + * + * \param socket The sending socket. + * \param pktSize The packet size. + * \param pktCount The packet count. + * \param pktInterval The interval between two packets. + */ static void GenerateTraffic (Ptr socket, uint32_t pktSize, uint32_t pktCount, Time pktInterval ) { diff --git a/examples/wireless/wifi-simple-interference.cc b/examples/wireless/wifi-simple-interference.cc index af5d53734..58a2b7061 100644 --- a/examples/wireless/wifi-simple-interference.cc +++ b/examples/wireless/wifi-simple-interference.cc @@ -95,6 +95,12 @@ using namespace ns3; NS_LOG_COMPONENT_DEFINE ("WifiSimpleInterference"); +/** + * Print a packer that has been received. + * + * \param socket The receiving socket. + * \return a string with the packet details. + */ static inline std::string PrintReceivedPacket (Ptr socket) { Address addr; @@ -112,19 +118,32 @@ static inline std::string PrintReceivedPacket (Ptr socket) return oss.str (); } +/** + * Function called when a packet is received. + * + * \param socket The receiving socket. + */ static void ReceivePacket (Ptr socket) { NS_LOG_UNCOND (PrintReceivedPacket (socket)); } +/** + * Generate traffic + * + * \param socket The seding socket. + * \param pktSize The packet size. + * \param pktCount The packet counter. + * \param pktInterval The interval between two packets. + */ static void GenerateTraffic (Ptr socket, uint32_t pktSize, - uint32_t pktCount, Time pktInterval ) + uint32_t pktCount, Time pktInterval) { if (pktCount > 0) { socket->Send (Create (pktSize)); Simulator::Schedule (pktInterval, &GenerateTraffic, - socket, pktSize,pktCount - 1, pktInterval); + socket, pktSize, pktCount - 1, pktInterval); } else { diff --git a/examples/wireless/wifi-sleep.cc b/examples/wireless/wifi-sleep.cc index 7a9c88122..6a14a2ebc 100644 --- a/examples/wireless/wifi-sleep.cc +++ b/examples/wireless/wifi-sleep.cc @@ -66,6 +66,13 @@ using namespace ns3; NS_LOG_COMPONENT_DEFINE ("WifiSleep"); +/** + * Remaining energy trace sink + * + * \tparam node The node ID this trace belongs to. + * \param oldValue Old value. + * \param newValue New value. + */ template void RemainingEnergyTrace (double oldValue, double newValue) { @@ -77,6 +84,15 @@ void RemainingEnergyTrace (double oldValue, double newValue) f << Simulator::Now ().GetSeconds () << " remaining energy=" << newValue << std::endl; } +/** + * PHY state trace sink + * + * \tparam node The node ID this trace belongs to. + * \param context The context + * \param start Start time for the current state + * \param duration Duratio of the current state + * \param state State + */ template void PhyStateTrace (std::string context, Time start, Time duration, WifiPhyState state) { diff --git a/examples/wireless/wifi-spectrum-per-example.cc b/examples/wireless/wifi-spectrum-per-example.cc index 755d1b395..1c24aeef8 100644 --- a/examples/wireless/wifi-spectrum-per-example.cc +++ b/examples/wireless/wifi-spectrum-per-example.cc @@ -93,10 +93,20 @@ using namespace ns3; // Global variables for use in callbacks. -double g_signalDbmAvg; -double g_noiseDbmAvg; -uint32_t g_samples; +double g_signalDbmAvg; //!< Average signal power [dBm] +double g_noiseDbmAvg; //!< Average noise power [dBm] +uint32_t g_samples; //!< Number of samples +/** + * Monitor sniffer Rx trace + * + * \param packet The sensed packet. + * \param channelFreqMhz The channel frequancy [MHz]. + * \param txVector The Tx vector. + * \param aMpdu The aMPDU. + * \param signalNoise The signal and noise dBm. + * \param staId The STA ID. + */ void MonitorSniffRx (Ptr packet, uint16_t channelFreqMhz, WifiTxVector txVector, diff --git a/examples/wireless/wifi-spectrum-per-interference.cc b/examples/wireless/wifi-spectrum-per-interference.cc index 4934f75e1..c1fcff7f0 100644 --- a/examples/wireless/wifi-spectrum-per-interference.cc +++ b/examples/wireless/wifi-spectrum-per-interference.cc @@ -99,10 +99,20 @@ using namespace ns3; // Global variables for use in callbacks. -double g_signalDbmAvg; -double g_noiseDbmAvg; -uint32_t g_samples; +double g_signalDbmAvg; //!< Average signal power [dBm] +double g_noiseDbmAvg; //!< Average noise power [dBm] +uint32_t g_samples; //!< Number of samples +/** + * Monitor sniffer Rx trace + * + * \param packet The sensed packet. + * \param channelFreqMhz The channel frequancy [MHz]. + * \param txVector The Tx vector. + * \param aMpdu The aMPDU. + * \param signalNoise The signal and noise dBm. + * \param staId The STA ID. + */ void MonitorSniffRx (Ptr packet, uint16_t channelFreqMhz, WifiTxVector txVector, @@ -118,7 +128,8 @@ void MonitorSniffRx (Ptr packet, NS_LOG_COMPONENT_DEFINE ("WifiSpectrumPerInterference"); -Ptr SpectrumModelWifi5180MHz, SpectrumModelWifi5190MHz; +Ptr SpectrumModelWifi5180MHz; //!< Spectrum model at 5180 MHz. +Ptr SpectrumModelWifi5190MHz; //!< Spectrum model at 5190 MHz. /** Initializer for a static spectrum model centered around 5180 MHz */ class static_SpectrumModelWifi5180MHz_initializer @@ -137,7 +148,9 @@ public: SpectrumModelWifi5180MHz = Create (bands); } -} static_SpectrumModelWifi5180MHz_initializer_instance; +}; +/// Static instance to initizlize the spectrum model around 5180 MHz. +static_SpectrumModelWifi5180MHz_initializer static_SpectrumModelWifi5180MHz_initializer_instance; /** Initializer for a static spectrum model centered around 5190 MHz */ class static_SpectrumModelWifi5190MHz_initializer @@ -156,7 +169,9 @@ public: SpectrumModelWifi5190MHz = Create (bands); } -} static_SpectrumModelWifi5190MHz_initializer_instance; +}; +/// Static instance to initizlize the spectrum model around 5190 MHz. +static_SpectrumModelWifi5190MHz_initializer static_SpectrumModelWifi5190MHz_initializer_instance; int main (int argc, char *argv[]) { diff --git a/examples/wireless/wifi-tcp.cc b/examples/wireless/wifi-tcp.cc index b2b210c62..1f75ab360 100644 --- a/examples/wireless/wifi-tcp.cc +++ b/examples/wireless/wifi-tcp.cc @@ -53,9 +53,12 @@ NS_LOG_COMPONENT_DEFINE ("wifi-tcp"); using namespace ns3; -Ptr sink; /* Pointer to the packet sink application */ -uint64_t lastTotalRx = 0; /* The value of the last total received bytes */ +Ptr sink; //!< Pointer to the packet sink application +uint64_t lastTotalRx = 0; //!< The value of the last total received bytes +/** + * Calulate the throughput + */ void CalculateThroughput () { diff --git a/src/buildings/examples/outdoor-group-mobility-example.cc b/src/buildings/examples/outdoor-group-mobility-example.cc index 9e003344b..4815ade63 100644 --- a/src/buildings/examples/outdoor-group-mobility-example.cc +++ b/src/buildings/examples/outdoor-group-mobility-example.cc @@ -70,8 +70,14 @@ using namespace ns3; NS_LOG_COMPONENT_DEFINE ("OutdoorGroupMobilityExample"); +/// The time series file. std::ofstream g_timeSeries; +/** + * Print the node position to the time series file. + * + * \param node The node. + */ void PrintPosition (Ptr node) { @@ -80,9 +86,13 @@ PrintPosition (Ptr node) if (!model) return; NS_LOG_LOGIC ("Node: " << node->GetId () << " Position: " << model->GetPosition ()); g_timeSeries << Simulator::Now ().GetSeconds () << " " << node->GetId () << " " << model->GetPosition () << std::endl; - } +/** + * Print the buildings list in a format that can be used by Gnuplot to draw them. + * + * \param filename The ouput filename. + */ void PrintGnuplottableBuildingListToFile (std::string filename) { diff --git a/src/buildings/examples/outdoor-random-walk-example.cc b/src/buildings/examples/outdoor-random-walk-example.cc index 69ee5290e..b5d2ace03 100644 --- a/src/buildings/examples/outdoor-random-walk-example.cc +++ b/src/buildings/examples/outdoor-random-walk-example.cc @@ -29,6 +29,11 @@ using namespace ns3; NS_LOG_COMPONENT_DEFINE ("OutdoorRandomWalkExample"); +/** + * Print the buildings list in a format that can be used by Gnuplot to draw them. + * + * \param filename The ouput filename. + */ void PrintGnuplottableBuildingListToFile (std::string filename) { diff --git a/src/csma/examples/csma-packet-socket.cc b/src/csma/examples/csma-packet-socket.cc index 97344593d..d34adf791 100644 --- a/src/csma/examples/csma-packet-socket.cc +++ b/src/csma/examples/csma-packet-socket.cc @@ -41,8 +41,16 @@ using namespace ns3; NS_LOG_COMPONENT_DEFINE ("CsmaPacketSocketExample"); +/// Ouput stream. std::ofstream g_os; +/** + * Rx sink + * + * \param path The context. + * \param p The packet. + * \param address The sender address. + */ static void SinkRx (std::string path, Ptr p, const Address &address) { diff --git a/src/csma/examples/csma-ping.cc b/src/csma/examples/csma-ping.cc index 1a1bbf1d0..83e38005e 100644 --- a/src/csma/examples/csma-ping.cc +++ b/src/csma/examples/csma-ping.cc @@ -39,11 +39,23 @@ using namespace ns3; NS_LOG_COMPONENT_DEFINE ("CsmaPingExample"); +/** + * Rx sink + * + * \param p The packer. + * \param ad The sender address. + */ static void SinkRx (Ptr p, const Address &ad) { //std::cout << *p << std::endl; } +/** + * Ping RTT trace sink + * + * \param context The context. + * \param rtt The RTT. + */ static void PingRtt (std::string context, Time rtt) { //std::cout << context << " " << rtt << std::endl; diff --git a/src/csma/examples/csma-raw-ip-socket.cc b/src/csma/examples/csma-raw-ip-socket.cc index 93b4aad26..8da02a5ba 100644 --- a/src/csma/examples/csma-raw-ip-socket.cc +++ b/src/csma/examples/csma-raw-ip-socket.cc @@ -42,6 +42,12 @@ using namespace ns3; NS_LOG_COMPONENT_DEFINE ("CsmaRawIpSocketExample"); +/** + * Receive sink function + * + * \param p the packet. + * \param ad the sender's address. + */ static void SinkRx (Ptr p, const Address &ad) { // Enable the below line to see the packet contents printed out at the diff --git a/src/lte/examples/lena-cqi-threshold.cc b/src/lte/examples/lena-cqi-threshold.cc index 81b93e9e2..15d4f5e65 100644 --- a/src/lte/examples/lena-cqi-threshold.cc +++ b/src/lte/examples/lena-cqi-threshold.cc @@ -29,25 +29,19 @@ using namespace ns3; -// position functions insipred by /examples/wireless/wifi-ap.cc -static void -SetPosition (Ptr node, Vector position) -{ - Ptr mobility = node->GetObject (); - mobility->SetPosition (position); -} - -static Vector -GetPosition (Ptr node) -{ - Ptr mobility = node->GetObject (); - return mobility->GetPosition (); -} - +/** + * Change the position of a node. + * + * This function will move a node with a x coordinate greater than 10 m + * to a x equal to 5 m, and less than or equal to 10 m to 10 Km + * + * \param node The node to move. + */ static void ChangePosition (Ptr node) { - Vector pos = GetPosition (node); + Ptr mobility = node->GetObject (); + Vector pos = mobility->GetPosition (); if (pos.x <= 10.0) { @@ -57,8 +51,7 @@ ChangePosition (Ptr node) { pos.x = 5.0; } - SetPosition (node, pos); - + mobility->SetPosition (pos); } int main (int argc, char *argv[]) diff --git a/src/lte/examples/lena-dual-stripe.cc b/src/lte/examples/lena-dual-stripe.cc index 03037d29a..c472ca1b2 100644 --- a/src/lte/examples/lena-dual-stripe.cc +++ b/src/lte/examples/lena-dual-stripe.cc @@ -42,6 +42,13 @@ using namespace ns3; NS_LOG_COMPONENT_DEFINE ("LenaDualStripe"); +/** + * Check if two boxes are overlapping. + * + * \param a First box. + * \param b Second box. + * \return true if the boxes are overlapping, false otherwise. + */ bool AreOverlapping (Box a, Box b) { return !((a.xMin > b.xMax) || (b.xMin > a.xMax) || (a.yMin > b.yMax) || (b.yMin > a.yMax)); @@ -159,6 +166,11 @@ FemtocellBlockAllocator::OverlapsWithAnyPrevious (Box box) return false; } +/** + * Print a list of buildings that can be plotted using Gnuplot. + * + * \param filename the output file name. + */ void PrintGnuplottableBuildingListToFile (std::string filename) { @@ -182,6 +194,11 @@ PrintGnuplottableBuildingListToFile (std::string filename) } } +/** + * Print a list of UEs that can be plotted using Gnuplot. + * + * \param filename the output file name. + */ void PrintGnuplottableUeListToFile (std::string filename) { @@ -210,6 +227,11 @@ PrintGnuplottableUeListToFile (std::string filename) } } +/** + * Print a list of ENBs that can be plotted using Gnuplot. + * + * \param filename the output file name. + */ void PrintGnuplottableEnbListToFile (std::string filename) { @@ -239,134 +261,190 @@ PrintGnuplottableEnbListToFile (std::string filename) } } - +/// Number of femtocell blocks static ns3::GlobalValue g_nBlocks ("nBlocks", "Number of femtocell blocks", ns3::UintegerValue (1), ns3::MakeUintegerChecker ()); + +/// Number of apartments along the X axis in a femtocell block static ns3::GlobalValue g_nApartmentsX ("nApartmentsX", "Number of apartments along the X axis in a femtocell block", ns3::UintegerValue (10), ns3::MakeUintegerChecker ()); + +/// Number of floors static ns3::GlobalValue g_nFloors ("nFloors", "Number of floors", ns3::UintegerValue (1), ns3::MakeUintegerChecker ()); + +/// How many macro sites there are static ns3::GlobalValue g_nMacroEnbSites ("nMacroEnbSites", "How many macro sites there are", ns3::UintegerValue (3), ns3::MakeUintegerChecker ()); + +/// (minimum) number of sites along the X-axis of the hex grid static ns3::GlobalValue g_nMacroEnbSitesX ("nMacroEnbSitesX", "(minimum) number of sites along the X-axis of the hex grid", ns3::UintegerValue (1), ns3::MakeUintegerChecker ()); + +/// min distance between two nearby macro cell sites static ns3::GlobalValue g_interSiteDistance ("interSiteDistance", "min distance between two nearby macro cell sites", ns3::DoubleValue (500), ns3::MakeDoubleChecker ()); + +/// how much the UE area extends outside the macrocell grid, expressed as fraction of the interSiteDistance static ns3::GlobalValue g_areaMarginFactor ("areaMarginFactor", "how much the UE area extends outside the macrocell grid, " "expressed as fraction of the interSiteDistance", ns3::DoubleValue (0.5), ns3::MakeDoubleChecker ()); + +/// How many macrocell UEs there are per square meter static ns3::GlobalValue g_macroUeDensity ("macroUeDensity", "How many macrocell UEs there are per square meter", ns3::DoubleValue (0.00002), ns3::MakeDoubleChecker ()); + +/// The HeNB deployment ratio as per 3GPP R4-092042 static ns3::GlobalValue g_homeEnbDeploymentRatio ("homeEnbDeploymentRatio", "The HeNB deployment ratio as per 3GPP R4-092042", ns3::DoubleValue (0.2), ns3::MakeDoubleChecker ()); + +/// The HeNB activation ratio as per 3GPP R4-092042 static ns3::GlobalValue g_homeEnbActivationRatio ("homeEnbActivationRatio", "The HeNB activation ratio as per 3GPP R4-092042", ns3::DoubleValue (0.5), ns3::MakeDoubleChecker ()); + +/// How many (on average) home UEs per HeNB there are in the simulation static ns3::GlobalValue g_homeUesHomeEnbRatio ("homeUesHomeEnbRatio", "How many (on average) home UEs per HeNB there are in the simulation", ns3::DoubleValue (1.0), ns3::MakeDoubleChecker ()); + +/// TX power [dBm] used by macro eNBs static ns3::GlobalValue g_macroEnbTxPowerDbm ("macroEnbTxPowerDbm", "TX power [dBm] used by macro eNBs", ns3::DoubleValue (46.0), ns3::MakeDoubleChecker ()); + +/// TX power [dBm] used by HeNBs static ns3::GlobalValue g_homeEnbTxPowerDbm ("homeEnbTxPowerDbm", "TX power [dBm] used by HeNBs", ns3::DoubleValue (20.0), ns3::MakeDoubleChecker ()); + +/// DL EARFCN used by macro eNBs static ns3::GlobalValue g_macroEnbDlEarfcn ("macroEnbDlEarfcn", "DL EARFCN used by macro eNBs", ns3::UintegerValue (100), ns3::MakeUintegerChecker ()); + +/// DL EARFCN used by HeNBs static ns3::GlobalValue g_homeEnbDlEarfcn ("homeEnbDlEarfcn", "DL EARFCN used by HeNBs", ns3::UintegerValue (100), ns3::MakeUintegerChecker ()); + +/// Bandwidth [num RBs] used by macro eNBs static ns3::GlobalValue g_macroEnbBandwidth ("macroEnbBandwidth", "bandwidth [num RBs] used by macro eNBs", ns3::UintegerValue (25), ns3::MakeUintegerChecker ()); + +/// Bandwidth [num RBs] used by HeNBs static ns3::GlobalValue g_homeEnbBandwidth ("homeEnbBandwidth", "bandwidth [num RBs] used by HeNBs", ns3::UintegerValue (25), ns3::MakeUintegerChecker ()); + +/// Total duration of the simulation [s] static ns3::GlobalValue g_simTime ("simTime", "Total duration of the simulation [s]", ns3::DoubleValue (0.25), ns3::MakeDoubleChecker ()); + +/// If true, will generate a REM and then abort the simulation static ns3::GlobalValue g_generateRem ("generateRem", "if true, will generate a REM and then abort the simulation;" "if false, will run the simulation normally (without generating any REM)", ns3::BooleanValue (false), ns3::MakeBooleanChecker ()); + +/// Resource Block Id of Data Channel, for which REM will be generated. static ns3::GlobalValue g_remRbId ("remRbId", "Resource Block Id of Data Channel, for which REM will be generated;" "default value is -1, what means REM will be averaged from all RBs of " "Control Channel", ns3::IntegerValue (-1), MakeIntegerChecker ()); + +/// If true, will setup the EPC to simulate an end-to-end topology. static ns3::GlobalValue g_epc ("epc", "If true, will setup the EPC to simulate an end-to-end topology, " "with real IP applications over PDCP and RLC UM (or RLC AM by changing " "the default value of EpsBearerToRlcMapping e.g. to RLC_AM_ALWAYS). " - "If false, only the LTE radio access will be simulated with RLC SM. ", + "If false, only the LTE radio access will be simulated with RLC SM.", ns3::BooleanValue (false), ns3::MakeBooleanChecker ()); + +/// if true, will activate data flows in the downlink when EPC is being used. static ns3::GlobalValue g_epcDl ("epcDl", "if true, will activate data flows in the downlink when EPC is being used. " "If false, downlink flows won't be activated. " "If EPC is not used, this parameter will be ignored.", ns3::BooleanValue (true), ns3::MakeBooleanChecker ()); + +/// if true, will activate data flows in the uplink when EPC is being used. static ns3::GlobalValue g_epcUl ("epcUl", "if true, will activate data flows in the uplink when EPC is being used. " "If false, uplink flows won't be activated. " "If EPC is not used, this parameter will be ignored.", ns3::BooleanValue (true), ns3::MakeBooleanChecker ()); + +/// if true, the UdpClient application will be used. static ns3::GlobalValue g_useUdp ("useUdp", "if true, the UdpClient application will be used. " "Otherwise, the BulkSend application will be used over a TCP connection. " "If EPC is not used, this parameter will be ignored.", ns3::BooleanValue (true), ns3::MakeBooleanChecker ()); + +/// The path of the fading trace (by default no fading trace is loaded, i.e., fading is not considered) static ns3::GlobalValue g_fadingTrace ("fadingTrace", "The path of the fading trace (by default no fading trace " "is loaded, i.e., fading is not considered)", ns3::StringValue (""), ns3::MakeStringChecker ()); + +/// How many bearers per UE there are in the simulation static ns3::GlobalValue g_numBearersPerUe ("numBearersPerUe", "How many bearers per UE there are in the simulation", ns3::UintegerValue (1), ns3::MakeUintegerChecker ()); + +/// SRS Periodicity (has to be at least greater than the number of UEs per eNB) static ns3::GlobalValue g_srsPeriodicity ("srsPeriodicity", "SRS Periodicity (has to be at least " "greater than the number of UEs per eNB)", ns3::UintegerValue (80), ns3::MakeUintegerChecker ()); + +/// Minimum speed value of macro UE with random waypoint model [m/s]. static ns3::GlobalValue g_outdoorUeMinSpeed ("outdoorUeMinSpeed", "Minimum speed value of macro UE with random waypoint model [m/s].", ns3::DoubleValue (0.0), ns3::MakeDoubleChecker ()); + +/// Maximum speed value of macro UE with random waypoint model [m/s]. static ns3::GlobalValue g_outdoorUeMaxSpeed ("outdoorUeMaxSpeed", "Maximum speed value of macro UE with random waypoint model [m/s].", ns3::DoubleValue (0.0), diff --git a/src/lte/examples/lena-radio-link-failure.cc b/src/lte/examples/lena-radio-link-failure.cc index 4a3977dcc..878b67e42 100644 --- a/src/lte/examples/lena-radio-link-failure.cc +++ b/src/lte/examples/lena-radio-link-failure.cc @@ -34,14 +34,18 @@ using namespace ns3; NS_LOG_COMPONENT_DEFINE ("LenaRadioLinkFailure"); -//Global values to check the simulation -//behavior during and after the simulation. -uint16_t counterN310FirsteNB = 0; -Time t310StartTimeFirstEnb = Seconds (0); -uint32_t ByteCounter = 0; -uint32_t oldByteCounter = 0; - +// Global values to check the simulation +// behavior during and after the simulation. +uint16_t counterN310FirsteNB = 0; //!< Counter of N310 indications. +Time t310StartTimeFirstEnb = Seconds (0); //!< Time of first N310 indication. +uint32_t ByteCounter = 0; //!< Byte counter. +uint32_t oldByteCounter = 0; //!< Old Byte counter, +/** + * Print the position of a UE with given IMSI. + * + * \param imsi The IMSI. + */ void PrintUePosition (uint64_t imsi) { @@ -65,6 +69,14 @@ PrintUePosition (uint64_t imsi) } } +/** + * UE Notify connection established. + * + * \param context The context. + * \param imsi The IMSI. + * \param cellid The Cell ID. + * \param rnti The RNTI. + */ void NotifyConnectionEstablishedUe (std::string context, uint64_t imsi, @@ -79,6 +91,14 @@ NotifyConnectionEstablishedUe (std::string context, << std::endl; } +/** + * eNB Notify connection established. + * + * \param context The context. + * \param imsi The IMSI. + * \param cellId The Cell ID. + * \param rnti The RNTI. + */ void NotifyConnectionEstablishedEnb (std::string context, uint64_t imsi, @@ -131,6 +151,15 @@ static const std::string & ToString (LteUeRrc::State s) return g_ueRrcStateName[s]; } +/** + * UE state transition tracer. + * + * \param imsi The IMSI. + * \param cellId The Cell ID. + * \param rnti The RNTI. + * \param oldState The old state. + * \param newState The new state. + */ void UeStateTransition (uint64_t imsi, uint16_t cellId, uint16_t rnti, LteUeRrc::State oldState, LteUeRrc::State newState) { @@ -142,6 +171,14 @@ UeStateTransition (uint64_t imsi, uint16_t cellId, uint16_t rnti, LteUeRrc::Stat << std::endl; } +/** + * eNB RRC timeout tracer. + * + * \param imsi The IMSI. + * \param rnti The RNTI. + * \param cellId The Cell ID. + * \param cause The reason for timeout. + */ void EnbRrcTimeout (uint64_t imsi, uint16_t rnti, uint16_t cellId, std::string cause) { @@ -151,6 +188,13 @@ EnbRrcTimeout (uint64_t imsi, uint16_t rnti, uint16_t cellId, std::string cause) << ", ENB RRC " << cause << std::endl; } +/** + * Notification of connection release at eNB. + * + * \param imsi The IMSI. + * \param cellId The Cell ID. + * \param rnti The RNTI. + */ void NotifyConnectionReleaseAtEnodeB (uint64_t imsi, uint16_t cellId, uint16_t rnti) { @@ -159,6 +203,16 @@ NotifyConnectionReleaseAtEnodeB (uint64_t imsi, uint16_t cellId, uint16_t rnti) << ", UE context destroyed at eNodeB" << std::endl; } +/** + * PHY sync detection tracer. + * + * \param n310 310 data. + * \param imsi The IMSI. + * \param rnti The RNTI. + * \param cellId The Cell ID. + * \param type The type. + * \param count The count. + */ void PhySyncDetection (uint16_t n310, uint64_t imsi, uint16_t rnti, uint16_t cellId, std::string type, uint8_t count) { @@ -178,6 +232,14 @@ void PhySyncDetection (uint16_t n310, uint64_t imsi, uint16_t rnti, uint16_t cel } } +/** + * Radio link failure tracer. + * + * \param t310 310 data. + * \param imsi The IMSI. + * \param cellId The Cell ID. + * \param rnti The RNTI. + */ void RadioLinkFailure (Time t310, uint64_t imsi, uint16_t cellId, uint16_t rnti) { std::cout << Simulator::Now () @@ -193,6 +255,13 @@ void RadioLinkFailure (Time t310, uint64_t imsi, uint16_t cellId, uint16_t rnti) } } +/** + * UE Random access error notification. + * + * \param imsi The IMSI. + * \param cellId The Cell ID. + * \param rnti The RNTI. + */ void NotifyRandomAccessErrorUe (uint64_t imsi, uint16_t cellId, uint16_t rnti) { @@ -201,6 +270,14 @@ NotifyRandomAccessErrorUe (uint64_t imsi, uint16_t cellId, uint16_t rnti) << ", UE RRC Random access Failed" << std::endl; } +/** + * UE Connection timeout notification. + * + * \param imsi The IMSI. + * \param cellId The Cell ID. + * \param rnti The RNTI. + * \param connEstFailCount Connection failure count. + */ void NotifyConnectionTimeoutUe (uint64_t imsi, uint16_t cellId, uint16_t rnti, uint8_t connEstFailCount) @@ -212,6 +289,14 @@ NotifyConnectionTimeoutUe (uint64_t imsi, uint16_t cellId, uint16_t rnti, << ", UE RRC Connection timeout" << std::endl; } +/** + * UE RA response timeout notification. + * + * \param imsi The IMSI. + * \param contention Contention flag. + * \param preambleTxCounter Preamble Tx counter. + * \param maxPreambleTxLimit Max preamble Ts limit. + */ void NotifyRaResponseTimeoutUe (uint64_t imsi, bool contention, uint8_t preambleTxCounter, @@ -224,12 +309,24 @@ NotifyRaResponseTimeoutUe (uint64_t imsi, bool contention, << ", UE RA response timeout" << std::endl; } +/** + * Receive a packet. + * + * \param packet The packet. + */ void ReceivePacket (Ptr packet, const Address &) { ByteCounter += packet->GetSize (); } +/** + * Write the troughput to file. + * + * \param firstWrite True if first time writing. + * \param binSize Bin size. + * \param fileName Output filename. + */ void Throughput (bool firstWrite, Time binSize, std::string fileName) { diff --git a/src/lte/examples/lena-x2-handover.cc b/src/lte/examples/lena-x2-handover.cc index 2d667f86d..78cf79e50 100644 --- a/src/lte/examples/lena-x2-handover.cc +++ b/src/lte/examples/lena-x2-handover.cc @@ -31,6 +31,14 @@ using namespace ns3; NS_LOG_COMPONENT_DEFINE ("LenaX2HandoverExample"); +/** + * UE Connection established noticication. + * + * \param context The context. + * \param imsi The IMSI of the connected terminal. + * \param cellid The Cell ID. + * \param rnti The RNTI. + */ void NotifyConnectionEstablishedUe (std::string context, uint64_t imsi, @@ -44,6 +52,15 @@ NotifyConnectionEstablishedUe (std::string context, << std::endl; } +/** + * UE Start Handover notification. + * + * \param context The context. + * \param imsi The IMSI of the connected terminal. + * \param cellid The actual Cell ID. + * \param rnti The RNTI. + * \param targetCellId The target Cell ID. + */ void NotifyHandoverStartUe (std::string context, uint64_t imsi, @@ -59,6 +76,14 @@ NotifyHandoverStartUe (std::string context, << std::endl; } +/** + * UE Handover end successful notification. + * + * \param context The context. + * \param imsi The IMSI of the connected terminal. + * \param cellid The Cell ID. + * \param rnti The RNTI. + */ void NotifyHandoverEndOkUe (std::string context, uint64_t imsi, @@ -72,6 +97,14 @@ NotifyHandoverEndOkUe (std::string context, << std::endl; } +/** + * eNB Connection established noticication. + * + * \param context The context. + * \param imsi The IMSI of the connected terminal. + * \param cellid The Cell ID. + * \param rnti The RNTI. + */ void NotifyConnectionEstablishedEnb (std::string context, uint64_t imsi, @@ -85,6 +118,15 @@ NotifyConnectionEstablishedEnb (std::string context, << std::endl; } +/** + * eNB Start Handover notification. + * + * \param context The context. + * \param imsi The IMSI of the connected terminal. + * \param cellid The actual Cell ID. + * \param rnti The RNTI. + * \param targetCellId The target Cell ID. + */ void NotifyHandoverStartEnb (std::string context, uint64_t imsi, @@ -100,6 +142,14 @@ NotifyHandoverStartEnb (std::string context, << std::endl; } +/** + * eNB Handover end successful notification. + * + * \param context The context. + * \param imsi The IMSI of the connected terminal. + * \param cellid The Cell ID. + * \param rnti The RNTI. + */ void NotifyHandoverEndOkEnb (std::string context, uint64_t imsi, diff --git a/src/mesh/examples/mesh.cc b/src/mesh/examples/mesh.cc index 62eb15393..d5e45b51f 100644 --- a/src/mesh/examples/mesh.cc +++ b/src/mesh/examples/mesh.cc @@ -87,9 +87,14 @@ using namespace ns3; NS_LOG_COMPONENT_DEFINE ("MeshExample"); // Declaring these variables outside of main() for use in trace sinks -uint32_t g_udpTxCount = 0; -uint32_t g_udpRxCount = 0; +uint32_t g_udpTxCount = 0; //!< Rx packet counter. +uint32_t g_udpRxCount = 0; //!< Tx packet counter. +/** + * Transmission trace sink. + * + * \param p The sent packet. + */ void TxTrace (Ptr p) { @@ -97,6 +102,11 @@ TxTrace (Ptr p) g_udpTxCount++; } +/** + * Reception trace sink, + * + * \param p The received packet. + */ void RxTrace (Ptr p) { diff --git a/src/mobility/examples/reference-point-group-mobility-example.cc b/src/mobility/examples/reference-point-group-mobility-example.cc index eb2fcc97a..d6276d149 100644 --- a/src/mobility/examples/reference-point-group-mobility-example.cc +++ b/src/mobility/examples/reference-point-group-mobility-example.cc @@ -66,8 +66,14 @@ using namespace ns3; NS_LOG_COMPONENT_DEFINE ("ReferencePointGroupMobilityExample"); +/// The time series file. std::ofstream g_timeSeries; +/** + * Print the node position to the time series file. + * + * \param node The node. + */ void PrintPosition (Ptr node) { diff --git a/src/propagation/examples/main-propagation-loss.cc b/src/propagation/examples/main-propagation-loss.cc index 0666a5166..567edbc91 100644 --- a/src/propagation/examples/main-propagation-loss.cc +++ b/src/propagation/examples/main-propagation-loss.cc @@ -35,8 +35,14 @@ using namespace ns3; -/// Round a double number to the given precision. e.g. dround(0.234, 0.1) = 0.2 -/// and dround(0.257, 0.1) = 0.3 +/** + * Round a double number to the given precision. e.g. dround(0.234, 0.1) = 0.2 + * and dround(0.257, 0.1) = 0.3 + * + * \param number The number to round. + * \param precision The precision. + * \return the rounded number + */ static double dround (double number, double precision) { number /= precision; @@ -52,6 +58,14 @@ static double dround (double number, double precision) return number; } +/** + * Test the model by sampling over a distance. + * + * \param model The model to test. + * \param targetDistance The target distance. + * \param step The step. + * \return a Gnuplot object to be plotted. + */ static Gnuplot TestDeterministic (Ptr model, double targetDistance, double step) { @@ -98,6 +112,15 @@ TestDeterministic (Ptr model, double targetDistance, doubl return plot; } +/** + * Test the model by sampling over a distance. + * + * \param model The model to test. + * \param targetDistance The target distance. + * \param step The step. + * \param samples Number of samples. + * \return a Gnuplot object to be plotted. + */ static Gnuplot TestProbabilistic (Ptr model, double targetDistance, double step, unsigned int samples) { @@ -167,6 +190,15 @@ TestProbabilistic (Ptr model, double targetDistance, doubl return plot; } +/** + * Test the model by sampling over time. + * + * \param model The model to test. + * \param timeStep The time step. + * \param timeTotal The total time. + * \param distance The distance. + * \return a Gnuplot object to be plotted. + */ static Gnuplot TestDeterministicByTime (Ptr model, Time timeStep, diff --git a/src/spectrum/examples/adhoc-aloha-ideal-phy-matrix-propagation-loss-model.cc b/src/spectrum/examples/adhoc-aloha-ideal-phy-matrix-propagation-loss-model.cc index f81f8b0b8..9b3b95b9f 100644 --- a/src/spectrum/examples/adhoc-aloha-ideal-phy-matrix-propagation-loss-model.cc +++ b/src/spectrum/examples/adhoc-aloha-ideal-phy-matrix-propagation-loss-model.cc @@ -45,9 +45,15 @@ using namespace ns3; NS_LOG_COMPONENT_DEFINE ("TestAdhocOfdmAloha"); -static bool g_verbose = false; -static uint64_t g_rxBytes; +static bool g_verbose = false; //!< True if verbose output. +static uint64_t g_rxBytes; //!< Rx bytes counter. +/** + * Trace for PHY Rx successful end. + * + * \param context The context. + * \param p The packet. + */ void PhyRxEndOkTrace (std::string context, Ptr p) { diff --git a/src/spectrum/examples/adhoc-aloha-ideal-phy-with-microwave-oven.cc b/src/spectrum/examples/adhoc-aloha-ideal-phy-with-microwave-oven.cc index 3f761e0cf..8d19393be 100644 --- a/src/spectrum/examples/adhoc-aloha-ideal-phy-with-microwave-oven.cc +++ b/src/spectrum/examples/adhoc-aloha-ideal-phy-with-microwave-oven.cc @@ -47,9 +47,15 @@ using namespace ns3; NS_LOG_COMPONENT_DEFINE ("OfdmWithWaveformGenerator"); +/// True for verbose output. static bool g_verbose = false; - +/** + * + * + * \param context + * \param p + */ void PhyTxStartTrace (std::string context, Ptr p) { @@ -59,7 +65,12 @@ PhyTxStartTrace (std::string context, Ptr p) } } - +/** + * PHY start TX trace. + * + * \param context The context. + * \param p The packet. + */ void PhyTxEndTrace (std::string context, Ptr p) { @@ -69,6 +80,12 @@ PhyTxEndTrace (std::string context, Ptr p) } } +/** + * PHY end TX trace. + * + * \param context The context. + * \param p The packet. + */ void PhyRxStartTrace (std::string context, Ptr p) { @@ -78,6 +95,12 @@ PhyRxStartTrace (std::string context, Ptr p) } } +/** + * PHY end OK RX trace. + * + * \param context The context. + * \param p The packet. + */ void PhyRxEndOkTrace (std::string context, Ptr p) { @@ -87,6 +110,12 @@ PhyRxEndOkTrace (std::string context, Ptr p) } } +/** + * PHY end error RX trace. + * + * \param context The context. + * \param p The packet. + */ void PhyRxEndErrorTrace (std::string context, Ptr p) { @@ -96,7 +125,11 @@ PhyRxEndErrorTrace (std::string context, Ptr p) } } - +/** + * Receive callback. + * + * \param socket The receiving socket. + */ void ReceivePacket (Ptr socket) { @@ -112,6 +145,12 @@ ReceivePacket (Ptr socket) } } +/** + * Create a socket and prepare it for packet reception. + * + * \param node The node. + * \return a new socket + */ Ptr SetupPacketReceive (Ptr node) { diff --git a/src/spectrum/examples/adhoc-aloha-ideal-phy.cc b/src/spectrum/examples/adhoc-aloha-ideal-phy.cc index 3d65b110d..00c2741d3 100644 --- a/src/spectrum/examples/adhoc-aloha-ideal-phy.cc +++ b/src/spectrum/examples/adhoc-aloha-ideal-phy.cc @@ -43,8 +43,15 @@ using namespace ns3; NS_LOG_COMPONENT_DEFINE ("TestAdhocOfdmAloha"); +/// True for verbose output. static bool g_verbose = false; +/** + * PHY start TX trace. + * + * \param context The context. + * \param p The packet. + */ void PhyTxStartTrace (std::string context, Ptr p) { @@ -54,7 +61,12 @@ PhyTxStartTrace (std::string context, Ptr p) } } - +/** + * PHY end TX trace. + * + * \param context The context. + * \param p The packet. + */ void PhyTxEndTrace (std::string context, Ptr p) { @@ -64,6 +76,12 @@ PhyTxEndTrace (std::string context, Ptr p) } } +/** + * PHY start RX trace. + * + * \param context The context. + * \param p The packet. + */ void PhyRxStartTrace (std::string context, Ptr p) { @@ -73,6 +91,12 @@ PhyRxStartTrace (std::string context, Ptr p) } } +/** + * PHY end OK RX trace. + * + * \param context The context. + * \param p The packet. + */ void PhyRxEndOkTrace (std::string context, Ptr p) { @@ -82,6 +106,12 @@ PhyRxEndOkTrace (std::string context, Ptr p) } } +/** + * PHY end error RX trace. + * + * \param context The context. + * \param p The packet. + */ void PhyRxEndErrorTrace (std::string context, Ptr p) { @@ -91,7 +121,11 @@ PhyRxEndErrorTrace (std::string context, Ptr p) } } - +/** + * Receive callback. + * + * \param socket The receiving socket. + */ void ReceivePacket (Ptr socket) { @@ -107,6 +141,12 @@ ReceivePacket (Ptr socket) } } +/** + * Create a socket and prepare it for packet reception. + * + * \param node The node. + * \return a new socket + */ Ptr SetupPacketReceive (Ptr node) { diff --git a/src/stats/examples/double-probe-example.cc b/src/stats/examples/double-probe-example.cc index e9d4a05a6..afa44994b 100644 --- a/src/stats/examples/double-probe-example.cc +++ b/src/stats/examples/double-probe-example.cc @@ -107,14 +107,26 @@ Emitter::Count (void) Simulator::Schedule (Seconds (m_var->GetValue ()), &Emitter::Count, this); } -// This is a function to test hooking a raw function to the trace source +/** + * This is a function to test hooking a raw function to the trace source, + * + * \param context The trace context. + * \param oldVal Old value. + * \param newVal New value. + */ void NotifyViaTraceSource (std::string context, double oldVal, double newVal) { NS_LOG_DEBUG ("context: " << context << " old " << oldVal << " new " << newVal); } -// This is a function to test hooking it to the probe output +/** + * This is a function to test hooking it to the probe output + * + * \param context The trace context. + * \param oldVal Old value. + * \param newVal New value. + */ void NotifyViaProbe (std::string context, double oldVal, double newVal) { diff --git a/src/traffic-control/examples/adaptive-red-tests.cc b/src/traffic-control/examples/adaptive-red-tests.cc index 75762a60a..ce1158477 100644 --- a/src/traffic-control/examples/adaptive-red-tests.cc +++ b/src/traffic-control/examples/adaptive-red-tests.cc @@ -76,32 +76,37 @@ using namespace ns3; NS_LOG_COMPONENT_DEFINE ("AdaptiveRedTests"); -uint32_t checkTimes; -double avgQueueDiscSize; +uint32_t checkTimes; //!< Number of times the queues have been checked. +double avgQueueDiscSize; //!< Average QueueDisc size. // The times -double global_start_time; -double global_stop_time; -double sink_start_time; -double sink_stop_time; -double client_start_time; -double client_stop_time; +double global_start_time; //!< Global start time +double global_stop_time; //!< Global stop time. +double sink_start_time; //!< Sink start time. +double sink_stop_time; //!< Sink stop time. +double client_start_time; //!< Client start time. +double client_stop_time; //!< Client stop time. -NodeContainer n0n2; -NodeContainer n1n2; -NodeContainer n2n3; -NodeContainer n3n4; -NodeContainer n3n5; +NodeContainer n0n2; //!< Nodecontainer n0 + n2. +NodeContainer n1n2; //!< Nodecontainer n1 + n2. +NodeContainer n2n3; //!< Nodecontainer n2 + n3. +NodeContainer n3n4; //!< Nodecontainer n3 + n4. +NodeContainer n3n5; //!< Nodecontainer n3 + n5. -Ipv4InterfaceContainer i0i2; -Ipv4InterfaceContainer i1i2; -Ipv4InterfaceContainer i2i3; -Ipv4InterfaceContainer i3i4; -Ipv4InterfaceContainer i3i5; +Ipv4InterfaceContainer i0i2; //!< IPv4 interface container i0 + i2. +Ipv4InterfaceContainer i1i2; //!< IPv4 interface container i1 + i2. +Ipv4InterfaceContainer i2i3; //!< IPv4 interface container i2 + i3. +Ipv4InterfaceContainer i3i4; //!< IPv4 interface container i3 + i4. +Ipv4InterfaceContainer i3i5; //!< IPv4 interface container i3 + i5. -std::stringstream filePlotQueueDisc; -std::stringstream filePlotQueueDiscAvg; +std::stringstream filePlotQueueDisc; //!< Output file name for queue disc size. +std::stringstream filePlotQueueDiscAvg; //!< Output file name for queue disc average. +/** + * Check the queue disc size and write its stats to the output files. + * + * \param queue The queue to check. + */ void CheckQueueDiscSize (Ptr queue) { @@ -122,6 +127,11 @@ CheckQueueDiscSize (Ptr queue) fPlotQueueDiscAvg.close (); } +/** + * Setup the apps. + * + * \param test The test number. + */ void BuildAppsTest (uint32_t test) { diff --git a/src/traffic-control/examples/codel-vs-pfifo-asymmetric.cc b/src/traffic-control/examples/codel-vs-pfifo-asymmetric.cc index 0c4c9cccd..542b20a55 100644 --- a/src/traffic-control/examples/codel-vs-pfifo-asymmetric.cc +++ b/src/traffic-control/examples/codel-vs-pfifo-asymmetric.cc @@ -69,12 +69,24 @@ using namespace ns3; NS_LOG_COMPONENT_DEFINE ("CoDelPfifoFastAsymmetricTest"); +/** + * TCP Congestion window tracker. + * + * \param stream The ouput stream. + * \param oldval Old value. + * \param newval New value. + */ static void -CwndTracer (Ptrstream, uint32_t oldval, uint32_t newval) +CwndTracer (Ptr stream, uint32_t oldval, uint32_t newval) { *stream->GetStream () << oldval << " " << newval << std::endl; } +/** + * Setup for TCP congestion window tracking. + * + * \param cwndTrFileName Congestion window output file name. + */ static void TraceCwnd (std::string cwndTrFileName) { @@ -91,12 +103,23 @@ TraceCwnd (std::string cwndTrFileName) } } +/** + * Traffic Control Sojourn tracker. + * + * \param stream The ouput stream. + * \param newval New value. + */ static void -SojournTracer (Ptrstream, Time newval) +SojournTracer (Ptr stream, Time newval) { *stream->GetStream () << newval << std::endl; } +/** + * Setup for Traffic Control Sojourn time tracking. + * + * \param sojournTrFileName Sojourn time output file name. + */ static void TraceSojourn (std::string sojournTrFileName) { @@ -113,12 +136,24 @@ TraceSojourn (std::string sojournTrFileName) } } +/** + * Traffic Control Queue length tracker. + * + * \param stream The ouput stream. + * \param oldval Old value. + * \param newval New value. + */ static void -QueueLengthTracer (Ptrstream, uint32_t oldval, uint32_t newval) +QueueLengthTracer (Ptr stream, uint32_t oldval, uint32_t newval) { *stream->GetStream () << oldval << " " << newval << std::endl; } +/** + * Setup for Traffic Control Queue length tracking. + * + * \param queueLengthTrFileName Queue length output file name. + */ static void TraceQueueLength (std::string queueLengthTrFileName) { @@ -135,12 +170,23 @@ TraceQueueLength (std::string queueLengthTrFileName) } } +/** + * Traffic control drop trace. + * + * \param stream The ouput stream. + * \param item The dropped item. + */ static void -EveryDropTracer (Ptrstream, Ptr item) +EveryDropTracer (Ptr stream, Ptr item) { *stream->GetStream () << Simulator::Now ().GetSeconds () << " " << item << std::endl; } +/** + * Setup for Traffic Control drop tracking. + * + * \param everyDropTrFileName TC drop output file name. + */ static void TraceEveryDrop (std::string everyDropTrFileName) { @@ -157,8 +203,15 @@ TraceEveryDrop (std::string everyDropTrFileName) } } +/** + * Traffic Control Dropping state trace. + * + * \param stream The ouput stream. + * \param oldVal Old value. + * \param newVal New value. + */ static void -DroppingStateTracer (Ptrstream, bool oldVal, bool newVal) +DroppingStateTracer (Ptr stream, bool oldVal, bool newVal) { if (oldVal == false && newVal == true) { @@ -172,6 +225,11 @@ DroppingStateTracer (Ptrstream, bool oldVal, bool newVal) } } +/** + * Setup for Traffic Control dropping tracking. + * + * \param dropStateTrFileName TC drop state output file name. + */ static void TraceDroppingState (std::string dropStateTrFileName) { @@ -184,10 +242,18 @@ TraceDroppingState (std::string dropStateTrFileName) else { Ptr stream = ascii.CreateFileStream (dropStateTrFileName.c_str ()); - Config::ConnectWithoutContext ("/NodeList/2/$ns3::TrafficControlLayer/RootQueueDiscList/0/$ns3::CoDelQueueDisc/DropState", MakeBoundCallback (&DroppingStateTracer, stream)); + Config::ConnectWithoutContext ("/NodeList/2/CwndTracer$ns3::TrafficControlLayer/RootQueueDiscList/0/$ns3::CoDelQueueDisc/DropState", MakeBoundCallback (&DroppingStateTracer, stream)); } } +/** + * Create a Bulk Flow application + * + * \param remoteAddress Remote address. + * \param sender Sender node. + * \param pktSize Pakcet size. + * \param stopTime Stop time. + */ void CreateBulkFlow (AddressValue remoteAddress, Ptr sender, uint32_t pktSize, float stopTime) { @@ -200,6 +266,13 @@ CreateBulkFlow (AddressValue remoteAddress, Ptr sender, uint32_t pktSize, sourceApp.Stop (Seconds (stopTime - 3)); } +/** + * Create a On Off Flow application. + * + * \param remoteAddress Remote address. + * \param sender Sender node. + * \param stopTime Stop time. + */ void CreateOnOffFlow (AddressValue remoteAddress, Ptr sender, float stopTime) { diff --git a/src/traffic-control/examples/codel-vs-pfifo-basic-test.cc b/src/traffic-control/examples/codel-vs-pfifo-basic-test.cc index cc97cbe2c..9e5db67ba 100644 --- a/src/traffic-control/examples/codel-vs-pfifo-basic-test.cc +++ b/src/traffic-control/examples/codel-vs-pfifo-basic-test.cc @@ -54,12 +54,26 @@ using namespace ns3; NS_LOG_COMPONENT_DEFINE ("CoDelPfifoFastBasicTest"); +/** + * Function called when Congestion Window is changed. + * + * \param stream Output stream. + * \param oldval Old value. + * \param newval New value. + */ static void -CwndTracer (Ptrstream, uint32_t oldval, uint32_t newval) +CwndTracer (Ptr stream, uint32_t oldval, uint32_t newval) { *stream->GetStream () << oldval << " " << newval << std::endl; } +/** + * Function to enable the Congestion window tracing. + * + * Note that you can not hook to the trace before the socket is created. + * + * \param cwndTrFileName Name of the output file. + */ static void TraceCwnd (std::string cwndTrFileName) { diff --git a/src/traffic-control/examples/red-tests.cc b/src/traffic-control/examples/red-tests.cc index 24af6eb4c..6a675e8a5 100644 --- a/src/traffic-control/examples/red-tests.cc +++ b/src/traffic-control/examples/red-tests.cc @@ -50,32 +50,37 @@ using namespace ns3; NS_LOG_COMPONENT_DEFINE ("RedTests"); -uint32_t checkTimes; -double avgQueueSize; +uint32_t checkTimes; //!< Number of times the queues have been checked. +double avgQueueSize; //!< Average Queue size. // The times -double global_start_time; -double global_stop_time; -double sink_start_time; -double sink_stop_time; -double client_start_time; -double client_stop_time; +double global_start_time; //!< Global start time +double global_stop_time; //!< Global stop time. +double sink_start_time; //!< Sink start time. +double sink_stop_time; //!< Sink stop time. +double client_start_time; //!< Client start time. +double client_stop_time; //!< Client stop time. -NodeContainer n0n2; -NodeContainer n1n2; -NodeContainer n2n3; -NodeContainer n3n4; -NodeContainer n3n5; +NodeContainer n0n2; //!< Nodecontainer n0 + n2. +NodeContainer n1n2; //!< Nodecontainer n1 + n2. +NodeContainer n2n3; //!< Nodecontainer n2 + n3. +NodeContainer n3n4; //!< Nodecontainer n3 + n4. +NodeContainer n3n5; //!< Nodecontainer n3 + n5. -Ipv4InterfaceContainer i0i2; -Ipv4InterfaceContainer i1i2; -Ipv4InterfaceContainer i2i3; -Ipv4InterfaceContainer i3i4; -Ipv4InterfaceContainer i3i5; +Ipv4InterfaceContainer i0i2; //!< IPv4 interface container i0 + i2. +Ipv4InterfaceContainer i1i2; //!< IPv4 interface container i1 + i2. +Ipv4InterfaceContainer i2i3; //!< IPv4 interface container i2 + i3. +Ipv4InterfaceContainer i3i4; //!< IPv4 interface container i3 + i4. +Ipv4InterfaceContainer i3i5; //!< IPv4 interface container i3 + i5. -std::stringstream filePlotQueue; -std::stringstream filePlotQueueAvg; +std::stringstream filePlotQueue; //!< Output file name for queue size. +std::stringstream filePlotQueueAvg; //!< Output file name for queue average. +/** + * Check the queue size and write its stats to the output files. + * + * \param queue The queue to check. + */ void CheckQueueSize (Ptr queue) { @@ -96,6 +101,11 @@ CheckQueueSize (Ptr queue) fPlotQueueAvg.close (); } +/** + * Setup the apps. + * + * \param test The test number. + */ void BuildAppsTest (uint32_t test) { diff --git a/src/wifi/examples/wifi-bianchi.cc b/src/wifi/examples/wifi-bianchi.cc index 00ade2af1..db915b2ce 100644 --- a/src/wifi/examples/wifi-bianchi.cc +++ b/src/wifi/examples/wifi-bianchi.cc @@ -54,6 +54,7 @@ #include "ns3/ampdu-subframe-header.h" #include "ns3/wifi-mac.h" +/// Avoid std::numbers::pi because it's C++20 #define PI 3.1415926535 NS_LOG_COMPONENT_DEFINE ("WifiBianchi"); @@ -89,6 +90,7 @@ bool tracing = false; ///< Flag to enable/disable generation of tracing files uint32_t pktSize = 1500; ///< packet size used for the simulation (in bytes) uint8_t maxMpdus = 0; ///< The maximum number of MPDUs in A-MPDUs (0 to disable MPDU aggregation) +/// Table of the expected values for EIFS std::map > bianchiResultsEifs = { /* 11b */ @@ -301,6 +303,7 @@ std::map > bianchiResultsDifs = { /* 11b */ @@ -513,7 +516,12 @@ std::map & counter, Mac48Address addr, uint64_t increment = 1) { @@ -558,6 +578,17 @@ IncrementCounter (std::map & counter, Mac48Address addr, } } +/** + * Trace a packet reception. + * + * \param context The context. + * \param p The packet. + * \param channelFreqMhz The channel frequqncy. + * \param txVector The TX vector. + * \param aMpdu The AMPDU. + * \param signalNoise The signal and noise dBm. + * \param staId The STA ID. + */ void TracePacketReception (std::string context, Ptr p, uint16_t channelFreqMhz, WifiTxVector txVector, MpduInfo aMpdu, SignalNoiseDbm signalNoise, uint16_t staId) { @@ -599,6 +630,12 @@ TracePacketReception (std::string context, Ptr p, uint16_t channel } } +/** + * Contention window trace. + * + * \param context The context. + * \param cw The contention window. + */ void CwTrace (std::string context, uint32_t cw, uint8_t /* linkId */) { @@ -609,6 +646,12 @@ CwTrace (std::string context, uint32_t cw, uint8_t /* linkId */) } } +/** + * Backoff trace. + * + * \param context The context. + * \param newVal The backoff value. + */ void BackoffTrace (std::string context, uint32_t newVal, uint8_t /* linkId */) { @@ -619,18 +662,39 @@ BackoffTrace (std::string context, uint32_t newVal, uint8_t /* linkId */) } } +/** + * PHY Rx trace. + * + * \param context The context. + * \param p The packet. + * \param power The Rx power. + */ void PhyRxTrace (std::string context, Ptr p, RxPowerWattPerChannelBand power) { NS_LOG_INFO ("PHY-RX-START time=" << Simulator::Now () << " node=" << ContextToNodeId (context) << " size=" << p->GetSize ()); } +/** + * PHY Rx trace. + * + * \param context The context. + * \param txVector The TX vector. + * \param psduDuration The PDSU diration. + */ void PhyRxPayloadTrace (std::string context, WifiTxVector txVector, Time psduDuration) { NS_LOG_INFO ("PHY-RX-PAYLOAD-START time=" << Simulator::Now () << " node=" << ContextToNodeId (context) << " psduDuration=" << psduDuration); } +/** + * PHY Drop trace. + * + * \param context The context. + * \param p The packet. + * \param reason The drop reason. + */ void PhyRxDropTrace (std::string context, Ptr p, WifiPhyRxfailureReason reason) { @@ -710,12 +774,27 @@ PhyRxDropTrace (std::string context, Ptr p, WifiPhyRxfailureReason } } +/** + * PHY RX end trace + * + * \param context The context. + * \param p The packet. + */ void PhyRxDoneTrace (std::string context, Ptr p) { NS_LOG_INFO ("PHY-RX-END time=" << Simulator::Now () << " node=" << ContextToNodeId (context) << " size=" << p->GetSize ()); } +/** + * PHY successful RX trace + * + * \param context The context. + * \param p The packet. + * \param snr The SNR. + * \param mode The WiFi mode. + * \param preamble The preamble. + */ void PhyRxOkTrace (std::string context, Ptr p, double snr, WifiMode mode, WifiPreamble preamble) { @@ -742,6 +821,13 @@ PhyRxOkTrace (std::string context, Ptr p, double snr, WifiMode mod } } +/** + * PHY RX error trace + * + * \param context The context. + * \param p The packet. + * \param snr The SNR. + */ void PhyRxErrorTrace (std::string context, Ptr p, double snr) { @@ -753,6 +839,13 @@ PhyRxErrorTrace (std::string context, Ptr p, double snr) } } +/** + * PHY TX trace + * + * \param context The context. + * \param p The packet. + * \param txPowerW The TX power. + */ void PhyTxTrace (std::string context, Ptr p, double txPowerW) { @@ -768,12 +861,24 @@ PhyTxTrace (std::string context, Ptr p, double txPowerW) } } +/** + * PHY TX end trace. + * + * \param context The context. + * \param p The packet. + */ void PhyTxDoneTrace (std::string context, Ptr p) { NS_LOG_INFO ("PHY-TX-END time=" << Simulator::Now () << " node=" << ContextToNodeId (context) << " " << p->GetSize ()); } +/** + * MAC TX trace. + * + * \param context The context. + * \param p The packet. + */ void MacTxTrace (std::string context, Ptr p) { @@ -783,6 +888,12 @@ MacTxTrace (std::string context, Ptr p) } } +/** + * MAC RX trace. + * + * \param context The context. + * \param p The packet. + */ void MacRxTrace (std::string context, Ptr p) { @@ -792,6 +903,13 @@ MacRxTrace (std::string context, Ptr p) } } +/** + * Socket send trace. + * + * \param context The context. + * \param p The packet. + * \param addr destination address. + */ void SocketSendTrace (std::string context, Ptr p, const Address &addr) { @@ -801,6 +919,12 @@ SocketSendTrace (std::string context, Ptr p, const Address &addr) } } +/** + * Association log trace. + * + * \param context The context. + * \param address The MAC address. + */ void AssociationLog (std::string context, Mac48Address address) { @@ -817,6 +941,12 @@ AssociationLog (std::string context, Mac48Address address) } } +/** + * Deassociation log trace. + * + * \param context The context. + * \param address The MAC address. + */ void DisassociationLog (std::string context, Mac48Address address) { @@ -825,6 +955,9 @@ DisassociationLog (std::string context, Mac48Address address) NS_FATAL_ERROR ("Device should not disassociate!"); } +/** + * Reset the stats. + */ void RestartCalc () { @@ -842,6 +975,9 @@ RestartCalc () rxEventAbortedByTx.clear (); } +/** + * Class to configure and run an experiment. + */ class Experiment { public: @@ -1056,6 +1192,13 @@ Experiment::Run (const WifiHelper &helper, const YansWifiPhyHelper &wifiPhy, con return 0; } +/** + * Get the Counter associated with a MAC address. + * + * \param counter The map of counters to inspect. + * \param addr The MAC address. + * \return the value of the counter, + */ uint64_t GetCount (const std::map & counter, Mac48Address addr) { @@ -1082,7 +1225,7 @@ int main (int argc, char *argv[]) std::string phyMode = "OfdmRate54Mbps"; ///< the constant PHY mode string used to transmit frames std::string standard ("11a"); ///< the 802.11 standard bool validate = false; ///< Flag used for regression in order to verify ns-3 results are in the expected boundaries - uint16_t plotBianchiModel = 0x01; ///< First bit corresponds to the DIFS model, second bit to the EIFS model + uint16_t plotBianchiModel = 0x01; ///< First bit corresponds to the DIFS model, second bit to the EIFS model double maxRelativeError = 0.015; ///< Maximum relative error tolerated between ns-3 results and the Bianchi model (used for regression, i.e. when the validate flag is set) double frequency = 5; ///< The operating frequency band in GHz: 2.4, 5 or 6 uint16_t channelWidth = 20; ///< The constant channel width in MHz (only for 11n/ac/ax) diff --git a/src/wifi/examples/wifi-manager-example.cc b/src/wifi/examples/wifi-manager-example.cc index 9de5f1de3..ca0ae53d7 100644 --- a/src/wifi/examples/wifi-manager-example.cc +++ b/src/wifi/examples/wifi-manager-example.cc @@ -64,18 +64,30 @@ using namespace ns3; NS_LOG_COMPONENT_DEFINE ("WifiManagerExample"); // 290K @ 20 MHz -const double NOISE_DBM_Hz = -174.0; -double noiseDbm = NOISE_DBM_Hz; +const double NOISE_DBM_Hz = -174.0; //!< Default value for noise. +double noiseDbm = NOISE_DBM_Hz; //!< Value for noise. -double g_intervalBytes = 0; -uint64_t g_intervalRate = 0; +double g_intervalBytes = 0; //!< Bytes received in an interval. +uint64_t g_intervalRate = 0; //!< Rate in an interval. +/** + * Packet received. + * + * \param pkt The packet. + * \param addr The sender address. + */ void PacketRx (Ptr pkt, const Address &addr) { g_intervalBytes += pkt->GetSize (); } +/** + * Rate changed. + * + * \param oldVal Old value. + * \param newVal New value. + */ void RateChange (uint64_t oldVal, uint64_t newVal) { @@ -133,6 +145,15 @@ struct StandardInfo double m_yMax; ///< Y maximum }; +/** + * Change the signal model and report the rate. + * + * \param rssModel The new RSS model. + * \param step The step tp use. + * \param rss The RSS. + * \param rateDataset The rate dataset. + * \param actualDataset The actual dataset. + */ void ChangeSignalAndReportRate (Ptr rssModel, Step step, double rss, Gnuplot2dDataset& rateDataset, Gnuplot2dDataset& actualDataset) { diff --git a/src/wifi/examples/wifi-phy-configuration.cc b/src/wifi/examples/wifi-phy-configuration.cc index 930e5e3ed..6bf28ee09 100644 --- a/src/wifi/examples/wifi-phy-configuration.cc +++ b/src/wifi/examples/wifi-phy-configuration.cc @@ -39,6 +39,12 @@ using namespace ns3; NS_LOG_COMPONENT_DEFINE ("WifiPhyConfigurationExample"); +/** + * Get the Yans Wifi Phy Ptr object for the 1st node in the NodeContainer + * + * \param nc The node container. + * \return the Yans Wifi Phy Ptr object of the 1st node in the NodeContainer + */ Ptr GetYansWifiPhyPtr (const NetDeviceContainer &nc) { @@ -47,6 +53,11 @@ GetYansWifiPhyPtr (const NetDeviceContainer &nc) return wp->GetObject (); } +/** + * Print the attributes to a file. + * + * \param enabled Enable printing. + */ void PrintAttributesIfEnabled (bool enabled) { diff --git a/src/wifi/examples/wifi-test-interference-helper.cc b/src/wifi/examples/wifi-test-interference-helper.cc index 309ae085b..904dd8065 100644 --- a/src/wifi/examples/wifi-test-interference-helper.cc +++ b/src/wifi/examples/wifi-test-interference-helper.cc @@ -72,9 +72,9 @@ using namespace ns3; NS_LOG_COMPONENT_DEFINE ("test-interference-helper"); -bool checkResults = false; -bool expectRxASuccessfull = false; -bool expectRxBSuccessfull = false; +bool checkResults = false; //!< True if results have to be checked. +bool expectRxASuccessfull = false; //!< True if Rx from A is expected to be successful. +bool expectRxBSuccessfull = false; //!< True if Rx from B is expected to be successful. /// InterferenceExperiment class InterferenceExperiment