Skip to content

Instantly share code, notes, and snippets.

@guilleiguaran
Created May 20, 2014 19:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guilleiguaran/a1ac9634755155d685b3 to your computer and use it in GitHub Desktop.
Save guilleiguaran/a1ac9634755155d685b3 to your computer and use it in GitHub Desktop.
diff -r 13017af6d1b0 src/applications/model/onoff-application.cc
--- a/src/applications/model/onoff-application.cc Thu May 15 16:09:51 2014 -0700
+++ b/src/applications/model/onoff-application.cc Tue May 20 14:12:58 2014 -0500
@@ -39,8 +39,10 @@
#include "ns3/trace-source-accessor.h"
#include "onoff-application.h"
#include "ns3/udp-socket-factory.h"
+#include "ns3/qos-tag.h"
#include "ns3/string.h"
#include "ns3/pointer.h"
+#include "ns3/enum.h"
NS_LOG_COMPONENT_DEFINE ("OnOffApplication");
@@ -85,6 +87,18 @@
TypeIdValue (UdpSocketFactory::GetTypeId ()),
MakeTypeIdAccessor (&OnOffApplication::m_tid),
MakeTypeIdChecker ())
+ .AddAttribute ("AccessClass",
+ "The access class (AC) for handling the data traffic in compliance with"
+ "the QoS requirements: It can be set to AC_BE, AC_VO, AC_VI or AC_BK",
+ EnumValue (UP_BE),
+ MakeEnumAccessor (&OnOffApplication::m_accessClass),
+ MakeEnumChecker (UP_BE, "BestEffort",
+ UP_BK, "Background",
+ UP_BE, "ExcellentEffort",
+ UP_CL, "ControlledLoad",
+ UP_VI, "Video",
+ UP_VO, "Voice",
+ UP_NC, "NetworkControl"))
.AddTraceSource ("Tx", "A new packet is created and is sent",
MakeTraceSourceAccessor (&OnOffApplication::m_txTrace))
;
@@ -270,6 +284,7 @@
NS_ASSERT (m_sendEvent.IsExpired ());
Ptr<Packet> packet = Create<Packet> (m_pktSize);
+ packet->AddPacketTag (QosTag (m_accessClass));
m_txTrace (packet);
m_socket->Send (packet);
m_totBytes += m_pktSize;
diff -r 13017af6d1b0 src/applications/model/onoff-application.h
--- a/src/applications/model/onoff-application.h Thu May 15 16:09:51 2014 -0700
+++ b/src/applications/model/onoff-application.h Tue May 20 14:12:58 2014 -0500
@@ -31,6 +31,7 @@
#include "ns3/ptr.h"
#include "ns3/data-rate.h"
#include "ns3/traced-callback.h"
+#include "ns3/qos-tag.h"
namespace ns3 {
@@ -163,6 +164,7 @@
EventId m_startStopEvent; //!< Event id for next start or stop event
EventId m_sendEvent; //!< Event id of pending "send packet" event
TypeId m_tid; //!< Type of the socket used
+ UserPriority m_accessClass; //!< Access Class for QoS requirements
/// Traced Callback: transmitted packets.
TracedCallback<Ptr<const Packet> > m_txTrace;
diff -r 13017af6d1b0 src/applications/wscript
--- a/src/applications/wscript Thu May 15 16:09:51 2014 -0700
+++ b/src/applications/wscript Tue May 20 14:12:58 2014 -0500
@@ -1,7 +1,7 @@
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
def build(bld):
- module = bld.create_ns3_module('applications', ['internet', 'config-store','stats'])
+ module = bld.create_ns3_module('applications', ['internet', 'config-store','stats', 'wifi'])
module.source = [
'model/bulk-send-application.cc',
'model/onoff-application.cc',
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment