# HG changeset patch # User Tommaso Pecorella # Date 1511054835 -3600 # Parent 8a4c340c41a8df83090e4dd99897e3addbb5802f Preliminary patch diff --git a/src/wave/examples/vanet-routing-compare.cc b/src/wave/examples/vanet-routing-compare.cc --- a/src/wave/examples/vanet-routing-compare.cc +++ b/src/wave/examples/vanet-routing-compare.cc @@ -426,7 +426,7 @@ * \param packet a received packet * \return none */ - void OnOffTrace (std::string context, Ptr packet); + void BsmTrace (std::string context, Ptr packet); /** * \brief Returns the RoutingStats instance @@ -698,7 +698,7 @@ } void -RoutingHelper::OnOffTrace (std::string context, Ptr packet) +RoutingHelper::BsmTrace (std::string context, Ptr packet) { uint32_t pktBytes = packet->GetSize (); routingStats.IncTxBytes (pktBytes); @@ -1271,7 +1271,6 @@ uint32_t m_mobility; ///< mobility uint32_t m_nNodes; ///< number of nodes double m_TotalSimTime; ///< total sim time - std::string m_rate; ///< rate std::string m_phyModeB; ///< phy mode std::string m_trName; ///< trace file name int m_nodeSpeed; ///< in m/s @@ -1335,7 +1334,6 @@ m_mobility (1), m_nNodes (156), m_TotalSimTime (300.01), - m_rate ("2048bps"), m_phyModeB ("DsssRate11Mbps"), m_trName ("vanet-routing-compare"), m_nodeSpeed (20), @@ -1540,10 +1538,6 @@ "Log filename", ns3::StringValue ("low99-ct-unterstrass-1day.filt.7.adj.log"), ns3::MakeStringChecker ()); -static ns3::GlobalValue g_rate ("VRCrate", - "Data rate", - ns3::StringValue ("2048bps"), - ns3::MakeStringChecker ()); static ns3::GlobalValue g_phyModeB ("VRCphyModeB", "PHY mode (802.11a)", ns3::StringValue ("DsssRate11Mbps"), @@ -1636,8 +1630,8 @@ // routing overhead std::ostringstream oss; oss.str (""); - oss << "/NodeList/*/ApplicationList/*/$ns3::OnOffApplication/Tx"; - Config::Connect (oss.str (), MakeCallback (&RoutingHelper::OnOffTrace, m_routingHelper)); + oss << "/NodeList/*/ApplicationList/*/$ns3::BsmApplication/Tx"; + Config::Connect (oss.str (), MakeCallback (&RoutingHelper::BsmTrace, m_routingHelper)); } void @@ -1940,8 +1934,6 @@ m_traceFile = stringValue.Get (); GlobalValue::GetValueByName ("VRClogFile", stringValue); m_logFile = stringValue.Get (); - GlobalValue::GetValueByName ("VRCrate", stringValue); - m_rate = stringValue.Get (); GlobalValue::GetValueByName ("VRCphyModeB", stringValue); m_phyModeB = stringValue.Get (); GlobalValue::GetValueByName ("VRCtrName", stringValue); @@ -1996,7 +1988,6 @@ g_phyMode.SetValue (StringValue (m_phyMode)); g_traceFile.SetValue (StringValue (m_traceFile)); g_logFile.SetValue (StringValue (m_logFile)); - g_rate.SetValue (StringValue (m_rate)); g_phyModeB.SetValue (StringValue (m_phyModeB)); g_trName.SetValue (StringValue (m_trName)); GlobalValue::GetValueByName ("VRCtrName", stringValue); @@ -2034,7 +2025,6 @@ cmd.AddValue ("traceFile", "Ns2 movement trace file", m_traceFile); cmd.AddValue ("logFile", "Log file", m_logFile); cmd.AddValue ("mobility", "1=trace;2=RWP", m_mobility); - cmd.AddValue ("rate", "Rate", m_rate); cmd.AddValue ("phyModeB", "Phy mode 802.11b", m_phyModeB); cmd.AddValue ("speed", "Node speed (m/s)", m_nodeSpeed); cmd.AddValue ("pause", "Node pause (s)", m_nodePause); @@ -2116,9 +2106,6 @@ void VanetRoutingExperiment::ConfigureDefaults () { - Config::SetDefault ("ns3::OnOffApplication::PacketSize",StringValue ("64")); - Config::SetDefault ("ns3::OnOffApplication::DataRate", StringValue (m_rate)); - //Set Non-unicastMode rate to unicast mode if (m_80211mode == 2) { diff --git a/src/wave/model/bsm-application.cc b/src/wave/model/bsm-application.cc --- a/src/wave/model/bsm-application.cc +++ b/src/wave/model/bsm-application.cc @@ -43,6 +43,9 @@ .SetParent () .SetGroupName ("Wave") .AddConstructor () + .AddTraceSource ("Tx", "A new packet is created and is sent", + MakeTraceSourceAccessor (&BsmApplication::m_txTrace), + "ns3::Packet::TracedCallback") ; return tid; } @@ -242,7 +245,10 @@ if (senderMoving != 0) { // send it! - socket->Send (Create (pktSize)); + Ptr packet = Create (pktSize); + m_txTrace (packet); + + socket->Send (packet); // count it m_waveBsmStats->IncTxPktCount (); m_waveBsmStats->IncTxByteCount (pktSize); diff --git a/src/wave/model/bsm-application.h b/src/wave/model/bsm-application.h --- a/src/wave/model/bsm-application.h +++ b/src/wave/model/bsm-application.h @@ -104,6 +104,9 @@ virtual void DoDispose (void); private: + /// Traced Callback: transmitted packets. + TracedCallback > m_txTrace; + // inherited from Application base class. virtual void StartApplication (void); ///< Called at time specified by Start virtual void StopApplication (void); ///< Called at time specified by Stop