Skip to content

Instantly share code, notes, and snippets.

@guilleiguaran
Last active August 29, 2015 14:01
Show Gist options
  • Save guilleiguaran/9648675827477d4a23a4 to your computer and use it in GitHub Desktop.
Save guilleiguaran/9648675827477d4a23a4 to your computer and use it in GitHub Desktop.
diff -r 67ee979a1807 src/applications/model/onoff-application.cc
--- a/src/applications/model/onoff-application.cc Tue Apr 08 14:07:33 2014 -0700
+++ b/src/applications/model/onoff-application.cc Sun May 18 20:00:09 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,15 @@
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 (AC_BE),
+ MakeEnumAccessor (&OnOffApplication::m_accessClass),
+ MakeEnumChecker (AC_BE, "BestEffort",
+ AC_BK, "Background",
+ AC_VI, "Video",
+ AC_VO, "Voice"))
.AddTraceSource ("Tx", "A new packet is created and is sent",
MakeTraceSourceAccessor (&OnOffApplication::m_txTrace))
;
@@ -270,6 +281,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 67ee979a1807 src/applications/model/onoff-application.h
--- a/src/applications/model/onoff-application.h Tue Apr 08 14:07:33 2014 -0700
+++ b/src/applications/model/onoff-application.h Sun May 18 20:00:09 2014 -0500
@@ -31,6 +31,7 @@
#include "ns3/ptr.h"
#include "ns3/data-rate.h"
#include "ns3/traced-callback.h"
+#include "ns3/qos-utils.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
+ AcIndex m_accessClass; //!< Access Class for QoS requirements
/// Traced Callback: transmitted packets.
TracedCallback<Ptr<const Packet> > m_txTrace;
diff -r 67ee979a1807 src/applications/wscript
--- a/src/applications/wscript Tue Apr 08 14:07:33 2014 -0700
+++ b/src/applications/wscript Sun May 18 20:00:09 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