From 8f1bc5d5ad78ac508be797e1a58f67f1e739abb2 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Tue, 21 Apr 2009 14:38:47 +0200 Subject: [PATCH 01/35] bug 537: no support to build static ns-3 binaries --- src/wscript | 3 ++- wscript | 19 ++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/wscript b/src/wscript index d4ee847bd..94b64ead7 100644 --- a/src/wscript +++ b/src/wscript @@ -72,7 +72,8 @@ def create_ns3_module(bld, name, dependencies=()): module.target = module.name module.add_objects = ['ns3-' + dep for dep in dependencies] module.module_deps = list(dependencies) - module.env.append_value('CXXFLAGS', module.env['shlib_CXXFLAGS']) + if not module.env['ENABLE_STATIC_NS3']: + module.env.append_value('CXXFLAGS', module.env['shlib_CXXFLAGS']) module.env.append_value('CXXDEFINES', "NS3_MODULE_COMPILATION") return module diff --git a/wscript b/wscript index 0b91d8a67..1be89ff62 100644 --- a/wscript +++ b/wscript @@ -156,6 +156,10 @@ def set_options(opt): help=('Path to the regression reference traces directory'), default=None, dest='regression_traces', type="string") + opt.add_option('--enable-static', + help=('Compile NS-3 statically: works only on linux, without python'), + dest='enable_static', action='store_true', + default=False) # options provided in a script in a subdirectory named "src" opt.sub_options('src') @@ -286,6 +290,11 @@ def configure(conf): conf.find_program('valgrind', var='VALGRIND') + if Options.options.enable_static and \ + not conf.env['ENABLE_PYTHON_BINDINGS'] and \ + env['PLATFORM'].startswith('linux'): + conf.env['ENABLE_STATIC_NS3'] = Options.options.enable_static + # Write a summary of optional features status print "---- Summary of optional NS-3 features:" for (name, caption, was_enabled, reason_not_enabled) in conf.env['NS3_OPTIONAL_FEATURES']: @@ -351,6 +360,10 @@ def create_ns3_program(bld, name, dependencies=('simulator',)): program.target = program.name program.uselib_local = 'ns3' program.ns3_module_dependencies = ['ns3-'+dep for dep in dependencies] + if program.env['ENABLE_STATIC_NS3']: + program.env.append_value('LINKFLAGS', '-Wl,--whole-archive,-Bstatic') + program.env.append_value('LINKFLAGS', '-lns3') + program.env.append_value('LINKFLAGS', '-Wl,-Bdynamic,--no-whole-archive') return program def add_scratch_programs(bld): @@ -434,7 +447,11 @@ def build(bld): bld.all_task_gen.remove(obj) ## Create a single ns3 library containing all enabled modules - lib = bld.new_task_gen('cxx', 'shlib') + if env['ENABLE_STATIC_NS3']: + lib = bld.new_task_gen('cxx', 'staticlib') + else: + lib = bld.new_task_gen('cxx', 'shlib') + lib.name = 'ns3' lib.target = 'ns3' if env['NS3_ENABLED_MODULES']: From b00c5e751e58b0add9888086fbe5602e70c4ff51 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Wed, 22 Apr 2009 13:06:22 +0200 Subject: [PATCH 02/35] enable static libns3 builds for python module --- bindings/python/wscript | 4 ++++ wscript | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/bindings/python/wscript b/bindings/python/wscript index d33fdf381..6d39fe62d 100644 --- a/bindings/python/wscript +++ b/bindings/python/wscript @@ -445,6 +445,10 @@ def build(bld): pymod.target = 'ns3/_ns3' pymod.name = 'ns3module' pymod.uselib_local = "ns3" + if pymod.env['ENABLE_STATIC_NS3']: + pymod.env.append_value('LINKFLAGS', '-Wl,--whole-archive,-Bstatic') + pymod.env.append_value('LINKFLAGS', '-lns3') + pymod.env.append_value('LINKFLAGS', '-Wl,-Bdynamic,--no-whole-archive') defines = list(pymod.env['CXXDEFINES']) defines.extend(['NS_DEPRECATED=', 'NS3_DEPRECATED_H']) diff --git a/wscript b/wscript index 1be89ff62..fdcc6e1bf 100644 --- a/wscript +++ b/wscript @@ -291,7 +291,6 @@ def configure(conf): conf.find_program('valgrind', var='VALGRIND') if Options.options.enable_static and \ - not conf.env['ENABLE_PYTHON_BINDINGS'] and \ env['PLATFORM'].startswith('linux'): conf.env['ENABLE_STATIC_NS3'] = Options.options.enable_static From 7eda961b1f0a84ce8ad175329a04982adce6399b Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Wed, 22 Apr 2009 13:59:10 +0200 Subject: [PATCH 03/35] Backed out changeset 4d9d3ff807a9 Does not work on x86-64. --- bindings/python/wscript | 4 ---- wscript | 1 + 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/bindings/python/wscript b/bindings/python/wscript index 6d39fe62d..d33fdf381 100644 --- a/bindings/python/wscript +++ b/bindings/python/wscript @@ -445,10 +445,6 @@ def build(bld): pymod.target = 'ns3/_ns3' pymod.name = 'ns3module' pymod.uselib_local = "ns3" - if pymod.env['ENABLE_STATIC_NS3']: - pymod.env.append_value('LINKFLAGS', '-Wl,--whole-archive,-Bstatic') - pymod.env.append_value('LINKFLAGS', '-lns3') - pymod.env.append_value('LINKFLAGS', '-Wl,-Bdynamic,--no-whole-archive') defines = list(pymod.env['CXXDEFINES']) defines.extend(['NS_DEPRECATED=', 'NS3_DEPRECATED_H']) diff --git a/wscript b/wscript index fdcc6e1bf..1be89ff62 100644 --- a/wscript +++ b/wscript @@ -291,6 +291,7 @@ def configure(conf): conf.find_program('valgrind', var='VALGRIND') if Options.options.enable_static and \ + not conf.env['ENABLE_PYTHON_BINDINGS'] and \ env['PLATFORM'].startswith('linux'): conf.env['ENABLE_STATIC_NS3'] = Options.options.enable_static From 5dff0e0ca67110c1ec0a536c823e1771ede3badc Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Wed, 22 Apr 2009 17:22:41 +0200 Subject: [PATCH 04/35] enable static builds, even when python is enabled --- bindings/python/wscript | 4 ++++ src/wscript | 8 ++++++++ wscript | 1 - 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/bindings/python/wscript b/bindings/python/wscript index d33fdf381..6d39fe62d 100644 --- a/bindings/python/wscript +++ b/bindings/python/wscript @@ -445,6 +445,10 @@ def build(bld): pymod.target = 'ns3/_ns3' pymod.name = 'ns3module' pymod.uselib_local = "ns3" + if pymod.env['ENABLE_STATIC_NS3']: + pymod.env.append_value('LINKFLAGS', '-Wl,--whole-archive,-Bstatic') + pymod.env.append_value('LINKFLAGS', '-lns3') + pymod.env.append_value('LINKFLAGS', '-Wl,-Bdynamic,--no-whole-archive') defines = list(pymod.env['CXXDEFINES']) defines.extend(['NS_DEPRECATED=', 'NS3_DEPRECATED_H']) diff --git a/src/wscript b/src/wscript index 94b64ead7..f1517e2a3 100644 --- a/src/wscript +++ b/src/wscript @@ -74,6 +74,14 @@ def create_ns3_module(bld, name, dependencies=()): module.module_deps = list(dependencies) if not module.env['ENABLE_STATIC_NS3']: module.env.append_value('CXXFLAGS', module.env['shlib_CXXFLAGS']) + elif module.env['CXX_NAME'] == 'gcc' and \ + os.uname()[4] == 'x86_64' and \ + module.env['ENABLE_PYTHON_BINDINGS']: + # enable that flag for static builds only on x86-64 platforms + # when gcc is present and only when we want python bindings + # (it's more efficient to not use this option if we can avoid it) + module.env.append_value('CXXFLAGS', '-mcmodel=large') + module.env.append_value('CXXDEFINES', "NS3_MODULE_COMPILATION") return module diff --git a/wscript b/wscript index 1be89ff62..fdcc6e1bf 100644 --- a/wscript +++ b/wscript @@ -291,7 +291,6 @@ def configure(conf): conf.find_program('valgrind', var='VALGRIND') if Options.options.enable_static and \ - not conf.env['ENABLE_PYTHON_BINDINGS'] and \ env['PLATFORM'].startswith('linux'): conf.env['ENABLE_STATIC_NS3'] = Options.options.enable_static From f38772431ec1e60ef0f9488e8e2f63ee6205ee90 Mon Sep 17 00:00:00 2001 From: Faker Moatamri Date: Thu, 23 Apr 2009 09:35:16 +0200 Subject: [PATCH 05/35] bug 533: Multiplication of Scalar variables does not give expected result --- src/simulator/high-precision-128.cc | 80 ++++++++++++++++++++++++++++- src/simulator/high-precision-128.h | 1 + src/simulator/time.cc | 4 +- 3 files changed, 81 insertions(+), 4 deletions(-) diff --git a/src/simulator/high-precision-128.cc b/src/simulator/high-precision-128.cc index eb6cc965b..67c544305 100644 --- a/src/simulator/high-precision-128.cc +++ b/src/simulator/high-precision-128.cc @@ -19,6 +19,7 @@ */ #include "high-precision-128.h" #include "ns3/test.h" +#include "ns3/fatal-error.h" #include #include @@ -151,10 +152,69 @@ HighPrecision::SlowMul (HighPrecision const &o) { EnsureSlow (); const_cast (o).EnsureSlow (); - cairo_int128_t other = _cairo_int128_rsa (o.m_slowValue, 64); - m_slowValue = _cairo_int128_mul (m_slowValue, other); + //use the 128 bits multiplication + m_slowValue = Mul128(m_slowValue,o.m_slowValue); return false; } +/** + * this function multiplies two 128 bits fractions considering + * the high 64 bits as the integer part and the low 64 bits + * as the fractional part. It takes into account the sign + * of the operands to produce a signed 128 bits result. + */ +cairo_int128_t +HighPrecision::Mul128(cairo_int128_t a, cairo_int128_t b ) +{ + //Implement the 128 bits multiplication + cairo_int128_t result; + cairo_uint128_t hiPart,loPart,midPart; + bool resultNegative = false, signA = false,signB = false; + + //take the sign of the operands + signA = _cairo_int128_negative (a); + signB = _cairo_int128_negative (b); + //the result is negative only if one of the operand is negative + if ((signA == true && signB == false) ||(signA == false && signB == true)) + { + resultNegative = true; + } + //now take the absolute part to make sure that the resulting operands are positive + if (signA == true) + { + a = _cairo_int128_negate (a); + } + if (signB == true) + { + b = _cairo_int128_negate (b); + } + + //Multiplying (a.h 2^64 + a.l) x (b.h 2^64 + b.l) = + // 2^128 a.h b.h + 2^64*(a.h b.l+b.h a.l) + a.l b.l + //get the low part a.l b.l + //multiply the fractional part + loPart = _cairo_uint64x64_128_mul (a.lo, b.lo); + //compute the middle part 2^64*(a.h b.l+b.h a.l) + midPart = _cairo_uint128_add(_cairo_uint64x64_128_mul(a.lo, b.hi), + _cairo_uint64x64_128_mul(a.hi, b.lo)) ; + //truncate the low part + result.lo = _cairo_uint64_add(loPart.hi,midPart.lo); + //compute the high part 2^128 a.h b.h + hiPart = _cairo_uint64x64_128_mul (a.hi, b.hi); + //truncate the high part and only use the low part + result.hi = _cairo_uint64_add(hiPart.lo,midPart.hi); + //if the high part is not zero, put a warning + if (hiPart.hi !=0) + { + NS_FATAL_ERROR("High precision 128 bits multiplication error: multiplication overflow."); + } + //add the sign to the result + if (resultNegative) + { + result = _cairo_int128_negate (result); + } + return result; +} + bool HighPrecision::Div (HighPrecision const &o) { @@ -351,6 +411,22 @@ HighPrecision128Tests::RunTests (void) a = HighPrecision (0.1); a.Div (HighPrecision (1.25)); NS_TEST_ASSERT_EQUAL (a.GetDouble (), 0.08); + //test the multiplication + a = HighPrecision (0.5); + a.Mul(HighPrecision (5)); + NS_TEST_ASSERT_EQUAL (a.GetDouble (), 2.5); + //test the sign of multiplication, first operand negative + a = HighPrecision (-0.5); + a.Mul(HighPrecision (5)); + NS_TEST_ASSERT_EQUAL (a.GetDouble (), -2.5); + //two negative + a = HighPrecision (-0.5); + a.Mul(HighPrecision (-5)); + NS_TEST_ASSERT_EQUAL (a.GetDouble (), 2.5); + //second operand negative + a = HighPrecision (0.5); + a.Mul(HighPrecision (-5)); + NS_TEST_ASSERT_EQUAL (a.GetDouble (), -2.5); return result; diff --git a/src/simulator/high-precision-128.h b/src/simulator/high-precision-128.h index 61ef029b9..96c6bd1c9 100644 --- a/src/simulator/high-precision-128.h +++ b/src/simulator/high-precision-128.h @@ -85,6 +85,7 @@ private: bool SlowSub (HighPrecision const &o); bool SlowMul (HighPrecision const &o); int SlowCompare (HighPrecision const &o) const; + cairo_uint128_t Mul128(cairo_uint128_t , cairo_uint128_t ); inline void EnsureSlow (void); static const double MAX_64; diff --git a/src/simulator/time.cc b/src/simulator/time.cc index 66d3317ad..835e15a9f 100644 --- a/src/simulator/time.cc +++ b/src/simulator/time.cc @@ -572,11 +572,11 @@ void TimeTests::CheckOld (bool *ok) Time t4; t4 = Seconds (10.0) * Scalar (1.5); - CheckTimeSec("old 11", t4.GetSeconds(), 10, ok); + CheckTimeSec("old 11", t4.GetSeconds(), 15, ok); Time t5; t5 = NanoSeconds (10) * Scalar (1.5); - CheckTime("old 12", t5.GetNanoSeconds(), 10, ok); + CheckTime("old 12", t5.GetNanoSeconds(), 15, ok); t4 = Seconds (10.0) * Scalar (15) / Scalar (10); CheckTimeSec("old 13", t4.GetSeconds(), 15, ok); From 99df5ad589c7543b37b41edd26524174236eb6f6 Mon Sep 17 00:00:00 2001 From: Faker Moatamri Date: Thu, 23 Apr 2009 10:34:24 +0200 Subject: [PATCH 06/35] improve internals documentation --- src/simulator/high-precision-128.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/simulator/high-precision-128.h b/src/simulator/high-precision-128.h index 96c6bd1c9..853fb3e9a 100644 --- a/src/simulator/high-precision-128.h +++ b/src/simulator/high-precision-128.h @@ -47,6 +47,26 @@ * If you want to monitor the efficiency of this strategy, you can * enable the macro HP128INC below and call the HighPrecision::PrintStats * method at the end of the simulation. + * + * Explanation of Slow and Fast values: + * + * HighPrecision class create a fastValue and a slowValue depending on the + * input number. If the input is an integer with 0 fractional part, it will + * use the fastValue which will contain the integer in a 64 bits format. If + * it has a fractional part, the slowValue will be used. It is represented + * simply as a high part slowValue.hi which will contain the integer part + * and the fractional part slowValue.lo which will contain the factional + * part as an integer (obtained by multiplying the fractional part by 2^64). + * + * Explanation of Slow and Fast operations: + * + * If both operands are fastValues, we will perform fast operations, i-e + * simply using integer operations. If we have though one of the value is + * slowValue we need to convert the fastValue into a slow one. It is simply + * obtained by putting the slowValue.lo = 0 and slowValue.hi = fastValue. + * After that we apply the slow operation which will be a 128 bits operation + * with two 128 bits operands. + * */ From 2051a68af5b1ca9e9ea6f0f6442aa69cc087c726 Mon Sep 17 00:00:00 2001 From: Mirko Banchi Date: Fri, 24 Apr 2009 08:52:46 +0200 Subject: [PATCH 07/35] ensure we use a correct typename for the TypeId --- src/devices/wifi/dca-txop.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/devices/wifi/dca-txop.cc b/src/devices/wifi/dca-txop.cc index 023774f31..c20bca9fe 100644 --- a/src/devices/wifi/dca-txop.cc +++ b/src/devices/wifi/dca-txop.cc @@ -93,10 +93,12 @@ private: DcaTxop *m_txop; }; +NS_OBJECT_ENSURE_REGISTERED (DcaTxop); + TypeId DcaTxop::GetTypeId (void) { - static TypeId tid = TypeId ("DcaTxop") + static TypeId tid = TypeId ("ns3::DcaTxop") .SetParent () .AddConstructor () .AddAttribute ("MinCw", "The minimum value of the contention window.", From 31806d13041cdfc04847cd789928e3a83fa78a8c Mon Sep 17 00:00:00 2001 From: Mirko Banchi Date: Fri, 24 Apr 2009 08:57:04 +0200 Subject: [PATCH 08/35] keep track of sequence number on per-destination basis --- src/devices/wifi/mac-tx-middle.cc | 34 ++++++++++++++++++++++++------- src/devices/wifi/mac-tx-middle.h | 9 ++++++-- 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/src/devices/wifi/mac-tx-middle.cc b/src/devices/wifi/mac-tx-middle.cc index 7c9d265df..4e9b5bc5a 100644 --- a/src/devices/wifi/mac-tx-middle.cc +++ b/src/devices/wifi/mac-tx-middle.cc @@ -1,6 +1,7 @@ /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2005 INRIA + * Copyright (c) 2005, 2009 INRIA + * Copyright (c) 2009 MIRKO BANCHI * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -16,6 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: Mathieu Lacage + * Author: Mirko Banchi */ #include "ns3/assert.h" @@ -26,11 +28,15 @@ namespace ns3 { MacTxMiddle::MacTxMiddle () + : m_sequence (0) +{} + +MacTxMiddle::~MacTxMiddle () { - m_sequence = 0; - for (uint8_t i = 0; i < 16; i++) + std::map::iterator i = m_qosSequences.begin(); + for (; i != m_qosSequences.end (); i++) { - m_qosSequences[i] = 0; + delete [] i->second; } } @@ -43,9 +49,23 @@ MacTxMiddle::GetNextSequenceNumberfor (const WifiMacHeader *hdr) { uint8_t tid = hdr->GetQosTid (); NS_ASSERT (tid < 16); - retval = m_qosSequences[tid]; - m_qosSequences[tid]++; - m_qosSequences[tid] %= 4096; + std::map::iterator it = m_qosSequences.find (hdr->GetAddr1 ()); + if (it != m_qosSequences.end ()) + { + retval = it->second[tid]; + it->second[tid]++; + it->second[tid] %= 4096; + } + else + { + retval = 0; + std::pair newSeq (hdr->GetAddr1 (), new uint16_t[16]); + std::pair ::iterator,bool> newIns = m_qosSequences.insert (newSeq); + NS_ASSERT(newIns.second == true); + for (uint8_t i = 0; i < 16; i++) + newIns.first->second[i] = 0; + newIns.first->second[tid]++; + } } else { diff --git a/src/devices/wifi/mac-tx-middle.h b/src/devices/wifi/mac-tx-middle.h index f6f7d7d4a..a701a93eb 100644 --- a/src/devices/wifi/mac-tx-middle.h +++ b/src/devices/wifi/mac-tx-middle.h @@ -1,6 +1,7 @@ /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2005 INRIA + * Copyright (c) 2005, 2009 INRIA + * Copyright (c) 2009 MIRKO BANCHI * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -16,12 +17,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: Mathieu Lacage + * Author: Mirko Banchi */ #ifndef MAC_TX_MIDDLE_H #define MAC_TX_MIDDLE_H #include +#include +#include "ns3/mac48-address.h" namespace ns3 { @@ -30,11 +34,12 @@ class WifiMacHeader; class MacTxMiddle { public: MacTxMiddle (); + ~MacTxMiddle (); uint16_t GetNextSequenceNumberfor (const WifiMacHeader *hdr); private: - uint16_t m_qosSequences[16]; + std::map m_qosSequences; uint16_t m_sequence; }; From fa14d105374e8c0c5c7917e56cbd7f47b325fc7c Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Fri, 24 Apr 2009 09:04:39 +0200 Subject: [PATCH 09/35] coding style --- src/devices/wifi/mac-tx-middle.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/devices/wifi/mac-tx-middle.cc b/src/devices/wifi/mac-tx-middle.cc index 4e9b5bc5a..74a5b6207 100644 --- a/src/devices/wifi/mac-tx-middle.cc +++ b/src/devices/wifi/mac-tx-middle.cc @@ -33,8 +33,7 @@ MacTxMiddle::MacTxMiddle () MacTxMiddle::~MacTxMiddle () { - std::map::iterator i = m_qosSequences.begin(); - for (; i != m_qosSequences.end (); i++) + for (std::map::iterator i = m_qosSequences.begin(); i != m_qosSequences.end (); i++) { delete [] i->second; } @@ -63,7 +62,9 @@ MacTxMiddle::GetNextSequenceNumberfor (const WifiMacHeader *hdr) std::pair ::iterator,bool> newIns = m_qosSequences.insert (newSeq); NS_ASSERT(newIns.second == true); for (uint8_t i = 0; i < 16; i++) - newIns.first->second[i] = 0; + { + newIns.first->second[i] = 0; + } newIns.first->second[tid]++; } } From 7562c13a09005952f62540ff86fd71e4b007c57f Mon Sep 17 00:00:00 2001 From: Mirko Banchi Date: Fri, 24 Apr 2009 09:07:00 +0200 Subject: [PATCH 10/35] add amsdu field --- src/devices/wifi/wifi-mac-header.cc | 84 +++++++++++++++++++++++++++-- src/devices/wifi/wifi-mac-header.h | 33 ++++++++++-- 2 files changed, 108 insertions(+), 9 deletions(-) diff --git a/src/devices/wifi/wifi-mac-header.cc b/src/devices/wifi/wifi-mac-header.cc index 057e3a875..78acd4d38 100644 --- a/src/devices/wifi/wifi-mac-header.cc +++ b/src/devices/wifi/wifi-mac-header.cc @@ -1,6 +1,7 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2006 INRIA + * Copyright (c) 2006, 2009 INRIA + * Copyright (c) 2009 MIRKO BANCHI * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -16,6 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: Mathieu Lacage + * Author: Mirko Banchi */ #include "ns3/assert.h" #include "ns3/address-utils.h" @@ -43,7 +45,8 @@ WifiMacHeader::WifiMacHeader () : m_ctrlPwrMgt (0), m_ctrlMoreData (0), m_ctrlWep (0), - m_ctrlOrder (1) + m_ctrlOrder (1), + m_amsduPresent (0) {} WifiMacHeader::~WifiMacHeader () {} @@ -126,7 +129,7 @@ WifiMacHeader::SetTypeData (void) m_ctrlSubtype = 0; } void -WifiMacHeader::SetType (enum WifiMacType_e type) +WifiMacHeader::SetType (enum WifiMacType type) { switch (type) { case WIFI_MAC_CTL_BACKREQ: @@ -299,6 +302,39 @@ void WifiMacHeader::SetQosTid (uint8_t tid) { m_qosTid = tid; } +void WifiMacHeader::SetQosEosp () +{ + m_qosEosp = 1; +} +void WifiMacHeader::SetQosNoEosp () +{ + m_qosEosp = 0; +} +void WifiMacHeader::SetQosAckPolicy (enum QosAckPolicy policy) +{ + switch (policy) { + case NORMAL_ACK : + m_qosAckPolicy = 0; + break; + case NO_ACK : + m_qosAckPolicy = 2; + break; + case NO_EXPLICIT_ACK : + m_qosAckPolicy = 1; + break; + case BLOCK_ACK : + m_qosAckPolicy = 3; + break; + } +} +void WifiMacHeader::SetQosAmsdu (void) +{ + m_amsduPresent = 1; +} +void WifiMacHeader::SetQosNoAmsdu (void) +{ + m_amsduPresent = 0; +} void WifiMacHeader::SetQosTxopLimit (uint8_t txop) { m_qosStuff = txop; @@ -324,7 +360,8 @@ WifiMacHeader::GetAddr4 (void) const { return m_addr4; } -enum WifiMacType_e + +enum WifiMacType WifiMacHeader::GetType (void) const { switch (m_ctrlType) { @@ -435,7 +472,7 @@ WifiMacHeader::GetType (void) const } // NOTREACHED NS_ASSERT (false); - return (enum WifiMacType_e)-1; + return (enum WifiMacType)-1; } bool WifiMacHeader::IsFromDs (void) const @@ -608,12 +645,46 @@ WifiMacHeader::IsQosAck (void) const NS_ASSERT (IsQosData ()); return (m_qosAckPolicy == 0)?true:false; } +bool +WifiMacHeader::IsQosEosp (void) const +{ + NS_ASSERT (IsQosData ()); + return (m_qosEosp == 1)?true:false; +} +bool +WifiMacHeader::IsQosAmsdu (void) const +{ + NS_ASSERT (IsQosData ()); + return (m_amsduPresent == 1)?true:false; +} uint8_t WifiMacHeader::GetQosTid (void) const { NS_ASSERT (IsQosData ()); return m_qosTid; } +enum WifiMacHeader::QosAckPolicy +WifiMacHeader::GetQosAckPolicy (void) const +{ + switch (m_qosAckPolicy) { + case 0 : + return NORMAL_ACK; + break; + case 1 : + return NO_ACK; + break; + case 2 : + return NO_EXPLICIT_ACK; + break; + case 3 : + return BLOCK_ACK; + break; + } + // NOTREACHED + NS_ASSERT (false); + return (enum QosAckPolicy)-1; +} + uint8_t WifiMacHeader::GetQosTxopLimit (void) const { @@ -644,6 +715,7 @@ WifiMacHeader::GetQosControl (void) const val |= m_qosTid; val |= m_qosEosp << 4; val |= m_qosAckPolicy << 5; + val |= m_amsduPresent << 7; val |= m_qosStuff << 8; return val; } @@ -673,6 +745,7 @@ WifiMacHeader::SetQosControl (uint16_t qos) m_qosTid = qos & 0x000f; m_qosEosp = (qos >> 4) & 0x0001; m_qosAckPolicy = (qos >> 5) & 0x0003; + m_amsduPresent = (qos >> 7) & 0x0001; m_qosStuff = (qos >> 8) & 0x00ff; } @@ -770,6 +843,7 @@ WifiMacHeader::GetTypeId (void) ; return tid; } + TypeId WifiMacHeader::GetInstanceTypeId (void) const { diff --git a/src/devices/wifi/wifi-mac-header.h b/src/devices/wifi/wifi-mac-header.h index 01498364a..1cb29f819 100644 --- a/src/devices/wifi/wifi-mac-header.h +++ b/src/devices/wifi/wifi-mac-header.h @@ -1,6 +1,7 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2006 INRIA + * Copyright (c) 2006, 2009 INRIA + * Copyright (c) 2009 MIRKO BANCHI * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -16,6 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: Mathieu Lacage + * Author: Mirko Banchi */ #ifndef WIFI_MAC_HEADER_H #define WIFI_MAC_HEADER_H @@ -27,7 +29,7 @@ namespace ns3 { -enum WifiMacType_e { +enum WifiMacType { WIFI_MAC_CTL_RTS = 0, WIFI_MAC_CTL_CTS, WIFI_MAC_CTL_ACK, @@ -65,6 +67,19 @@ enum WifiMacType_e { class WifiMacHeader : public Header { public: + enum QosAckPolicy { + NORMAL_ACK = 0, + NO_ACK = 1, + NO_EXPLICIT_ACK = 2, + BLOCK_ACK = 3, + }; + + enum AddressType { + ADDR1, + ADDR2, + ADDR3, + ADDR4 + }; WifiMacHeader (); ~WifiMacHeader (); @@ -91,7 +106,7 @@ public: void SetAddr2 (Mac48Address address); void SetAddr3 (Mac48Address address); void SetAddr4 (Mac48Address address); - void SetType (enum WifiMacType_e type); + void SetType (enum WifiMacType type); void SetRawDuration (uint16_t duration); void SetDuration (Time duration); void SetId (uint16_t id); @@ -102,13 +117,19 @@ public: void SetRetry (void); void SetNoRetry (void); void SetQosTid (uint8_t tid); + void SetQosEosp (); + void SetQosNoEosp (); + void SetQosAckPolicy (enum QosAckPolicy); + void SetQosAmsdu (void); + void SetQosNoAmsdu (void); void SetQosTxopLimit (uint8_t txop); + Mac48Address GetAddr1 (void) const; Mac48Address GetAddr2 (void) const; Mac48Address GetAddr3 (void) const; Mac48Address GetAddr4 (void) const; - enum WifiMacType_e GetType (void) const; + enum WifiMacType GetType (void) const; bool IsFromDs (void) const; bool IsToDs (void) const; bool IsData (void) const; @@ -139,7 +160,10 @@ public: bool IsQosBlockAck (void) const; bool IsQosNoAck (void) const; bool IsQosAck (void) const; + bool IsQosEosp (void) const; + bool IsQosAmsdu (void) const; uint8_t GetQosTid (void) const; + enum QosAckPolicy GetQosAckPolicy (void) const; uint8_t GetQosTxopLimit (void) const; uint32_t GetSize (void) const; @@ -174,6 +198,7 @@ private: uint8_t m_qosTid; uint8_t m_qosEosp; uint8_t m_qosAckPolicy; + uint8_t m_amsduPresent; uint16_t m_qosStuff; }; From 2f101f268fe5a0d076706523eb46c2c6e9044af1 Mon Sep 17 00:00:00 2001 From: Mirko Banchi Date: Fri, 24 Apr 2009 09:10:14 +0200 Subject: [PATCH 11/35] new methods to look in the packet queue --- src/devices/wifi/wifi-mac-queue.cc | 112 +++++++++++++++++++++++++++-- src/devices/wifi/wifi-mac-queue.h | 52 +++++++++++--- 2 files changed, 151 insertions(+), 13 deletions(-) diff --git a/src/devices/wifi/wifi-mac-queue.cc b/src/devices/wifi/wifi-mac-queue.cc index ab7d5e30b..186749c7d 100644 --- a/src/devices/wifi/wifi-mac-queue.cc +++ b/src/devices/wifi/wifi-mac-queue.cc @@ -1,6 +1,7 @@ /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2005 INRIA + * Copyright (c) 2005, 2009 INRIA + * Copyright (c) 2009 MIRKO BANCHI * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -16,8 +17,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: Mathieu Lacage + * Author: Mirko Banchi */ - #include "ns3/simulator.h" #include "ns3/packet.h" #include "ns3/uinteger.h" @@ -30,7 +31,6 @@ namespace ns3 { NS_OBJECT_ENSURE_REGISTERED (WifiMacQueue); - WifiMacQueue::Item::Item (Ptr packet, WifiMacHeader const &hdr, Time tstamp) @@ -69,16 +69,19 @@ WifiMacQueue::SetMaxSize (uint32_t maxSize) { m_maxSize = maxSize; } -void + +void WifiMacQueue::SetMaxDelay (Time delay) { m_maxDelay = delay; } + uint32_t WifiMacQueue::GetMaxSize (void) const { return m_maxSize; } + Time WifiMacQueue::GetMaxDelay (void) const { @@ -97,6 +100,7 @@ WifiMacQueue::Enqueue (Ptr packet, WifiMacHeader const &hdr) m_queue.push_back (Item (packet, hdr, now)); m_size++; } + void WifiMacQueue::Cleanup (void) { @@ -136,6 +140,72 @@ WifiMacQueue::Dequeue (WifiMacHeader *hdr) return 0; } +Ptr +WifiMacQueue::Peek (WifiMacHeader *hdr) +{ + Cleanup (); + if (!m_queue.empty ()) + { + Item i = m_queue.front (); + *hdr = i.hdr; + return i.packet; + } + return 0; +} + +Ptr +WifiMacQueue::DequeueByTidAndAddress (WifiMacHeader *hdr, uint8_t tid, + WifiMacHeader::AddressType index, Mac48Address dest) +{ + Cleanup (); + Ptr packet = 0; + if (!m_queue.empty ()) + { + PacketQueueI it; + NS_ASSERT (index <= 4); + for (it = m_queue.begin (); it != m_queue.end (); ++it) + { + if (it->hdr.IsQosData ()) + { + if (GetAddressForPacket (index, it) == dest && + it->hdr.GetQosTid () == tid) + { + packet = it->packet; + *hdr = it->hdr; + m_queue.erase (it); + m_size--; + break; + } + } + } + } + return packet; +} + +Ptr +WifiMacQueue::PeekByTidAndAddress (WifiMacHeader *hdr, uint8_t tid, + WifiMacHeader::AddressType index, Mac48Address dest) +{ + Cleanup (); + if (!m_queue.empty ()) + { + PacketQueueI it; + NS_ASSERT (index <= 4); + for (it = m_queue.begin (); it != m_queue.end (); ++it) + { + if (it->hdr.IsQosData ()) + { + if (GetAddressForPacket (index, it) == dest && + it->hdr.GetQosTid () == tid) + { + *hdr = it->hdr; + return it->packet; + } + } + } + } + return 0; +} bool WifiMacQueue::IsEmpty (void) @@ -144,7 +214,6 @@ WifiMacQueue::IsEmpty (void) return m_queue.empty (); } - uint32_t WifiMacQueue::GetSize (void) { @@ -158,4 +227,37 @@ WifiMacQueue::Flush (void) m_size = 0; } +Mac48Address +WifiMacQueue::GetAddressForPacket (uint8_t index, PacketQueueI it) +{ + if (index == WifiMacHeader::ADDR1) + { + return it->hdr.GetAddr1 (); + } + if (index == WifiMacHeader::ADDR2) + { + return it->hdr.GetAddr2 (); + } + if (index == WifiMacHeader::ADDR3) + { + return it->hdr.GetAddr3 (); + } + return 0; +} + +bool +WifiMacQueue::Remove (Ptr packet) +{ + PacketQueueI it = m_queue.begin (); + for (; it != m_queue.end (); it++) + { + if (it->packet == packet) + { + m_queue.erase (it); + return true; + } + } + return false; +} + } // namespace ns3 diff --git a/src/devices/wifi/wifi-mac-queue.h b/src/devices/wifi/wifi-mac-queue.h index ec77506a4..20498c7a0 100644 --- a/src/devices/wifi/wifi-mac-queue.h +++ b/src/devices/wifi/wifi-mac-queue.h @@ -1,6 +1,7 @@ /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2005 INRIA + * Copyright (c) 2005, 2009 INRIA + * Copyright (c) 2009 MIRKO BANCHI * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -16,11 +17,12 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: Mathieu Lacage + * Author: Mirko Banchi */ #ifndef WIFI_MAC_QUEUE_H #define WIFI_MAC_QUEUE_H -#include +#include #include #include "ns3/packet.h" #include "ns3/nstime.h" @@ -60,25 +62,60 @@ public: void Enqueue (Ptr packet, WifiMacHeader const &hdr); Ptr Dequeue (WifiMacHeader *hdr); - + Ptr Peek (WifiMacHeader *hdr); + /** + * Searchs and returns, if is present in this queue, first packet having + * address indicated by index equals to addr, and tid + * equals to tid. This method removes the packet from this queue. + * Is typically used by ns3::EdcaTxopN in order to perform correct MSDU + * aggregation (A-MSDU). + */ + Ptr DequeueByTidAndAddress (WifiMacHeader *hdr, + uint8_t tid, + WifiMacHeader::AddressType index, + Mac48Address addr); + /** + * Searchs and returns, if is present in this queue, first packet having + * address indicated by index equals to addr, and tid + * equals to tid. This method doesn't remove the packet from this queue. + * Is typically used by ns3::EdcaTxopN in order to perform correct MSDU + * aggregation (A-MSDU). + */ + Ptr PeekByTidAndAddress (WifiMacHeader *hdr, + uint8_t tid, + WifiMacHeader::AddressType index, + Mac48Address addr); + /** + * If exists, removes packet from queue and returns true. Otherwise it + * takes no effects and return false. Deletion of the packet is + * performed in linear time (O(n)). + */ + bool Remove (Ptr packet); + void Flush (void); bool IsEmpty (void); uint32_t GetSize (void); private: + struct Item; + + typedef std::list PacketQueue; + typedef std::list::reverse_iterator PacketQueueRI; + typedef std::list::iterator PacketQueueI; + void Cleanup (void); + Mac48Address GetAddressForPacket (uint8_t index, PacketQueueI); + struct Item { Item (Ptr packet, - WifiMacHeader const&hdr, + WifiMacHeader const &hdr, Time tstamp); Ptr packet; WifiMacHeader hdr; Time tstamp; }; - typedef std::deque PacketQueue; - typedef std::deque::reverse_iterator PacketQueueRI; - typedef std::deque::iterator PacketQueueI; + PacketQueue m_queue; WifiMacParameters *m_parameters; uint32_t m_size; @@ -88,5 +125,4 @@ private: } // namespace ns3 - #endif /* WIFI_MAC_QUEUE_H */ From 80ea9e64e6af79d42c566ef79273ed72c26c9430 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Fri, 24 Apr 2009 09:11:48 +0200 Subject: [PATCH 12/35] rename 'index' variable to 'type' --- src/devices/wifi/wifi-mac-queue.cc | 20 ++++++++++---------- src/devices/wifi/wifi-mac-queue.h | 10 +++++----- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/devices/wifi/wifi-mac-queue.cc b/src/devices/wifi/wifi-mac-queue.cc index 186749c7d..d3355aeab 100644 --- a/src/devices/wifi/wifi-mac-queue.cc +++ b/src/devices/wifi/wifi-mac-queue.cc @@ -155,19 +155,19 @@ WifiMacQueue::Peek (WifiMacHeader *hdr) Ptr WifiMacQueue::DequeueByTidAndAddress (WifiMacHeader *hdr, uint8_t tid, - WifiMacHeader::AddressType index, Mac48Address dest) + WifiMacHeader::AddressType type, Mac48Address dest) { Cleanup (); Ptr packet = 0; if (!m_queue.empty ()) { PacketQueueI it; - NS_ASSERT (index <= 4); + NS_ASSERT (type <= 4); for (it = m_queue.begin (); it != m_queue.end (); ++it) { if (it->hdr.IsQosData ()) { - if (GetAddressForPacket (index, it) == dest && + if (GetAddressForPacket (type, it) == dest && it->hdr.GetQosTid () == tid) { packet = it->packet; @@ -184,18 +184,18 @@ WifiMacQueue::DequeueByTidAndAddress (WifiMacHeader *hdr, uint8_t tid, Ptr WifiMacQueue::PeekByTidAndAddress (WifiMacHeader *hdr, uint8_t tid, - WifiMacHeader::AddressType index, Mac48Address dest) + WifiMacHeader::AddressType type, Mac48Address dest) { Cleanup (); if (!m_queue.empty ()) { PacketQueueI it; - NS_ASSERT (index <= 4); + NS_ASSERT (type <= 4); for (it = m_queue.begin (); it != m_queue.end (); ++it) { if (it->hdr.IsQosData ()) { - if (GetAddressForPacket (index, it) == dest && + if (GetAddressForPacket (type, it) == dest && it->hdr.GetQosTid () == tid) { *hdr = it->hdr; @@ -228,17 +228,17 @@ WifiMacQueue::Flush (void) } Mac48Address -WifiMacQueue::GetAddressForPacket (uint8_t index, PacketQueueI it) +WifiMacQueue::GetAddressForPacket (uint8_t type, PacketQueueI it) { - if (index == WifiMacHeader::ADDR1) + if (type == WifiMacHeader::ADDR1) { return it->hdr.GetAddr1 (); } - if (index == WifiMacHeader::ADDR2) + if (type == WifiMacHeader::ADDR2) { return it->hdr.GetAddr2 (); } - if (index == WifiMacHeader::ADDR3) + if (type == WifiMacHeader::ADDR3) { return it->hdr.GetAddr3 (); } diff --git a/src/devices/wifi/wifi-mac-queue.h b/src/devices/wifi/wifi-mac-queue.h index 20498c7a0..584f75ec4 100644 --- a/src/devices/wifi/wifi-mac-queue.h +++ b/src/devices/wifi/wifi-mac-queue.h @@ -65,25 +65,25 @@ public: Ptr Peek (WifiMacHeader *hdr); /** * Searchs and returns, if is present in this queue, first packet having - * address indicated by index equals to addr, and tid + * address indicated by type equals to addr, and tid * equals to tid. This method removes the packet from this queue. * Is typically used by ns3::EdcaTxopN in order to perform correct MSDU * aggregation (A-MSDU). */ Ptr DequeueByTidAndAddress (WifiMacHeader *hdr, uint8_t tid, - WifiMacHeader::AddressType index, + WifiMacHeader::AddressType type, Mac48Address addr); /** * Searchs and returns, if is present in this queue, first packet having - * address indicated by index equals to addr, and tid + * address indicated by type equals to addr, and tid * equals to tid. This method doesn't remove the packet from this queue. * Is typically used by ns3::EdcaTxopN in order to perform correct MSDU * aggregation (A-MSDU). */ Ptr PeekByTidAndAddress (WifiMacHeader *hdr, uint8_t tid, - WifiMacHeader::AddressType index, + WifiMacHeader::AddressType type, Mac48Address addr); /** * If exists, removes packet from queue and returns true. Otherwise it @@ -105,7 +105,7 @@ private: typedef std::list::iterator PacketQueueI; void Cleanup (void); - Mac48Address GetAddressForPacket (uint8_t index, PacketQueueI); + Mac48Address GetAddressForPacket (uint8_t type, PacketQueueI); struct Item { Item (Ptr packet, From abf50ad835c9cb3168ef134b4ef6b9d722489080 Mon Sep 17 00:00:00 2001 From: Mirko Banchi Date: Fri, 24 Apr 2009 09:16:28 +0200 Subject: [PATCH 13/35] shared facility for qos support --- src/devices/wifi/qos-tag.cc | 85 +++++++++++++++++++++++++++++++++++ src/devices/wifi/qos-tag.h | 49 ++++++++++++++++++++ src/devices/wifi/qos-utils.cc | 72 +++++++++++++++++++++++++++++ src/devices/wifi/qos-utils.h | 49 ++++++++++++++++++++ src/devices/wifi/wscript | 2 + 5 files changed, 257 insertions(+) create mode 100644 src/devices/wifi/qos-tag.cc create mode 100644 src/devices/wifi/qos-tag.h create mode 100644 src/devices/wifi/qos-utils.cc create mode 100644 src/devices/wifi/qos-utils.h diff --git a/src/devices/wifi/qos-tag.cc b/src/devices/wifi/qos-tag.cc new file mode 100644 index 000000000..98bed65b6 --- /dev/null +++ b/src/devices/wifi/qos-tag.cc @@ -0,0 +1,85 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2009 MIRKO BANCHI + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Mirko Banchi + */ +#include "qos-tag.h" +#include "ns3/tag.h" +#include "ns3/uinteger.h" + +namespace ns3 { + +TypeId +QosTag::GetTypeId (void) +{ + static TypeId tid = TypeId ("ns3::QosTag") + .SetParent () + .AddConstructor () + .AddAttribute ("tid", "The tid that indicates AC which packet belongs", + UintegerValue (0), + MakeUintegerAccessor (&QosTag::Get), + MakeUintegerChecker ()) + ; + return tid; +} + +TypeId +QosTag::GetInstanceTypeId (void) const +{ + return GetTypeId (); +} + +QosTag::QosTag() +{} + +uint32_t +QosTag::GetSerializedSize (void) const +{ + return 1; +} + +void +QosTag::Serialize (TagBuffer i) const +{ + i.WriteU8 (m_tid); +} + +void +QosTag::Deserialize (TagBuffer i) +{ + m_tid = i.ReadU8 (); +} + +void +QosTag::Set (uint8_t tid) +{ + m_tid = tid; +} + +uint8_t +QosTag::Get () const +{ + return m_tid; +} + +void +QosTag::Print (std::ostream &os) const +{ + os << "Tid=" << m_tid; +} + +} //namespace ns3 diff --git a/src/devices/wifi/qos-tag.h b/src/devices/wifi/qos-tag.h new file mode 100644 index 000000000..51f13a908 --- /dev/null +++ b/src/devices/wifi/qos-tag.h @@ -0,0 +1,49 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2009 MIRKO BANCHI + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Mirko Banchi + */ +#ifndef QOS_TAG_H +#define QOS_TAG_H + +#include "ns3/packet.h" + +namespace ns3 { + +class Tag; + +class QosTag : public Tag +{ +public: + static TypeId GetTypeId (void); + virtual TypeId GetInstanceTypeId (void) const; + + QosTag (); + virtual void Serialize (TagBuffer i) const; + virtual void Deserialize (TagBuffer i); + virtual uint32_t GetSerializedSize () const; + virtual void Print (std::ostream &os) const; + + uint8_t Get (void) const; + void Set (uint8_t tid); +private: + uint8_t m_tid; +}; + +} //namespace ns3 + +#endif /* QOS_TAG_H */ diff --git a/src/devices/wifi/qos-utils.cc b/src/devices/wifi/qos-utils.cc new file mode 100644 index 000000000..347db4038 --- /dev/null +++ b/src/devices/wifi/qos-utils.cc @@ -0,0 +1,72 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2009 MIRKO BANCHI + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Mirko Banchi + */ +#include "qos-utils.h" +#include "qos-tag.h" + +namespace ns3 { + +AccessClass +QosUtilsMapTidToAc (uint8_t tid) +{ + switch (tid) { + case 0 : + return AC_BE; + break; + case 1 : + return AC_BK; + break; + case 2 : + return AC_BK; + break; + case 3 : + return AC_BE; + break; + case 4 : + return AC_VI; + break; + case 5 : + return AC_VI; + break; + case 6 : + return AC_VO; + break; + case 7 : + return AC_VO; + break; + } + return AC_UNDEF; +} + +uint8_t +QosUtilsGetTidForPacket (Ptr packet) +{ + QosTag qos; + uint8_t tid = 8; + if (packet->FindFirstMatchingTag (qos)) + { + if (qos.Get () < 8) + { + tid = qos.Get (); + } + } + return tid; +} + +} //namespace ns3 diff --git a/src/devices/wifi/qos-utils.h b/src/devices/wifi/qos-utils.h new file mode 100644 index 000000000..b54a60fe4 --- /dev/null +++ b/src/devices/wifi/qos-utils.h @@ -0,0 +1,49 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2009 MIRKO BANCHI + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Mirko Banchi + */ +#ifndef QOS_UTILS_H +#define QOS_UTILS_H + +#include "ns3/uinteger.h" +#include "ns3/ptr.h" +#include "ns3/packet.h" + +namespace ns3 { + +enum AccessClass { + AC_VO = 0, + AC_VI = 1, + AC_BE = 2, + AC_BK = 3, + AC_UNDEF +}; + +/* Maps TID (Traffic ID) to Access classes. + * For more details see table 9-1 of IEEE802.11 standard. + */ +AccessClass QosUtilsMapTidToAc (uint8_t tid); + +/* If a qos tag is attached to the packet, returns a value < 8. + A value >= 8 is returned otherwise. + */ +uint8_t QosUtilsGetTidForPacket (Ptr packet); + +} //namespace ns3 + +#endif /* QOS_UTILS_H */ diff --git a/src/devices/wifi/wscript b/src/devices/wifi/wscript index 379e46f14..0dec4df21 100644 --- a/src/devices/wifi/wscript +++ b/src/devices/wifi/wscript @@ -46,6 +46,8 @@ def build(bld): 'cara-wifi-manager.cc', 'constant-rate-wifi-manager.cc', 'wifi-test.cc', + 'qos-tag.cc', + 'qos-utils.cc', ] headers = bld.new_task_gen('ns3header') headers.module = 'wifi' From 3a2586631b3a4f81b0ed99f9f9676077ccf9bc36 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Fri, 24 Apr 2009 09:57:16 +0200 Subject: [PATCH 14/35] mark copy constructor and assignment operator as private to avoid exporting wifi-mac-queue.h for python bindings --- src/devices/wifi/dca-txop.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/devices/wifi/dca-txop.h b/src/devices/wifi/dca-txop.h index 7765520b2..55a4f2106 100644 --- a/src/devices/wifi/dca-txop.h +++ b/src/devices/wifi/dca-txop.h @@ -115,6 +115,9 @@ private: friend class TransmissionListener; friend class WifiRemoteStation; + DcaTxop &operator = (const DcaTxop &); + DcaTxop (const DcaTxop &o); + // Inherited from ns3::Object Ptr Low (void); From 9f0c9cd9756ecdaf04ef244cee525b41f4f39983 Mon Sep 17 00:00:00 2001 From: Mirko Banchi Date: Fri, 24 Apr 2009 10:01:41 +0200 Subject: [PATCH 15/35] Add WifiMacHelper --- examples/mixed-wireless.cc | 14 +++-- examples/stats/wifi-example-sim.cc | 5 +- examples/tap-wifi-dumbbell.cc | 19 +++--- examples/third.cc | 10 ++-- examples/wifi-adhoc.cc | 41 +++++++------ examples/wifi-ap.cc | 9 +-- examples/wifi-wired-bridging.cc | 9 +-- src/devices/wifi/adhoc-wifi-mac.cc | 18 ++++-- src/devices/wifi/adhoc-wifi-mac.h | 3 +- src/devices/wifi/nqap-wifi-mac.cc | 25 ++++---- src/devices/wifi/nqap-wifi-mac.h | 4 +- src/devices/wifi/nqsta-wifi-mac.cc | 20 ++++--- src/devices/wifi/nqsta-wifi-mac.h | 3 +- src/devices/wifi/wifi-test.cc | 4 ++ src/devices/wifi/wscript | 2 + src/helper/nqos-wifi-mac-helper.cc | 86 +++++++++++++++++++++++++++ src/helper/nqos-wifi-mac-helper.h | 95 ++++++++++++++++++++++++++++++ src/helper/wifi-helper.cc | 45 +++++--------- src/helper/wifi-helper.h | 68 ++++++++++----------- src/helper/wscript | 2 + 20 files changed, 341 insertions(+), 141 deletions(-) create mode 100644 src/helper/nqos-wifi-mac-helper.cc create mode 100644 src/helper/nqos-wifi-mac-helper.h diff --git a/examples/mixed-wireless.cc b/examples/mixed-wireless.cc index 355dfa344..eafe01a67 100644 --- a/examples/mixed-wireless.cc +++ b/examples/mixed-wireless.cc @@ -144,13 +144,14 @@ main (int argc, char *argv[]) // our container // WifiHelper wifi; - wifi.SetMac ("ns3::AdhocWifiMac"); + NqosWifiMacHelper mac = NqosWifiMacHelper::Default (); + mac.SetType ("ns3::AdhocWifiMac"); wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode", StringValue ("wifia-54mbs")); YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default (); YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default (); wifiPhy.SetChannel (wifiChannel.Create ()); - NetDeviceContainer backboneDevices = wifi.Install (wifiPhy, backbone); + NetDeviceContainer backboneDevices = wifi.Install (wifiPhy, mac, backbone); // // Add the IPv4 protocol stack to the nodes in our container // @@ -258,6 +259,7 @@ main (int argc, char *argv[]) // Create an infrastructure network // WifiHelper wifiInfra = WifiHelper::Default (); + NqosWifiMacHelper macInfra = NqosWifiMacHelper::Default (); wifiPhy.SetChannel (wifiChannel.Create ()); // Create unique ssids for these networks std::string ssidString("wifi-infra"); @@ -267,15 +269,15 @@ main (int argc, char *argv[]) Ssid ssid = Ssid (ssidString); wifiInfra.SetRemoteStationManager ("ns3::ArfWifiManager"); // setup stas - wifiInfra.SetMac ("ns3::NqstaWifiMac", + macInfra.SetType ("ns3::NqstaWifiMac", "Ssid", SsidValue (ssid), "ActiveProbing", BooleanValue (false)); - NetDeviceContainer staDevices = wifiInfra.Install (wifiPhy, stas); + NetDeviceContainer staDevices = wifiInfra.Install (wifiPhy, macInfra, stas); // setup ap. - wifiInfra.SetMac ("ns3::NqapWifiMac", "Ssid", SsidValue (ssid), + macInfra.SetType ("ns3::NqapWifiMac", "Ssid", SsidValue (ssid), "BeaconGeneration", BooleanValue (true), "BeaconInterval", TimeValue (Seconds (2.5))); - NetDeviceContainer apDevices = wifiInfra.Install (wifiPhy, backbone.Get (i)); + NetDeviceContainer apDevices = wifiInfra.Install (wifiPhy, macInfra, backbone.Get (i)); // Collect all of these new devices NetDeviceContainer infraDevices (apDevices, staDevices); diff --git a/examples/stats/wifi-example-sim.cc b/examples/stats/wifi-example-sim.cc index f0c1fdebc..63044c701 100644 --- a/examples/stats/wifi-example-sim.cc +++ b/examples/stats/wifi-example-sim.cc @@ -128,11 +128,12 @@ int main(int argc, char *argv[]) { NS_LOG_INFO("Installing WiFi and Internet stack."); WifiHelper wifi = WifiHelper::Default (); - wifi.SetMac("ns3::AdhocWifiMac"); + NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default (); + wifiMac.SetType ("ns3::AdhocWifiMac"); YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default (); YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default (); wifiPhy.SetChannel (wifiChannel.Create ()); - NetDeviceContainer nodeDevices = wifi.Install(wifiPhy, nodes); + NetDeviceContainer nodeDevices = wifi.Install(wifiPhy, wifiMac, nodes); InternetStackHelper internet; internet.Install(nodes); diff --git a/examples/tap-wifi-dumbbell.cc b/examples/tap-wifi-dumbbell.cc index c149b6248..3930e5325 100644 --- a/examples/tap-wifi-dumbbell.cc +++ b/examples/tap-wifi-dumbbell.cc @@ -151,19 +151,20 @@ main (int argc, char *argv[]) Ssid ssid = Ssid ("left"); WifiHelper wifi = WifiHelper::Default (); + NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default (); wifi.SetRemoteStationManager ("ns3::ArfWifiManager"); - wifi.SetMac ("ns3::NqapWifiMac", - "Ssid", SsidValue (ssid), - "BeaconGeneration", BooleanValue (true), - "BeaconInterval", TimeValue (Seconds (2.5))); - NetDeviceContainer devicesLeft = wifi.Install (wifiPhy, nodesLeft.Get (0)); + wifiMac.SetType ("ns3::NqapWifiMac", + "Ssid", SsidValue (ssid), + "BeaconGeneration", BooleanValue (true), + "BeaconInterval", TimeValue (Seconds (2.5))); + NetDeviceContainer devicesLeft = wifi.Install (wifiPhy, wifiMac, nodesLeft.Get (0)); - wifi.SetMac ("ns3::NqstaWifiMac", - "Ssid", SsidValue (ssid), - "ActiveProbing", BooleanValue (false)); - devicesLeft.Add (wifi.Install (wifiPhy, NodeContainer (nodesLeft.Get (1), nodesLeft.Get (2), nodesLeft.Get (3)))); + wifiMac.SetType ("ns3::NqstaWifiMac", + "Ssid", SsidValue (ssid), + "ActiveProbing", BooleanValue (false)); + devicesLeft.Add (wifi.Install (wifiPhy, wifiMac, NodeContainer (nodesLeft.Get (1), nodesLeft.Get (2), nodesLeft.Get (3)))); MobilityHelper mobility; mobility.Install (nodesLeft); diff --git a/examples/third.cc b/examples/third.cc index b6a5551bc..f655dc21d 100644 --- a/examples/third.cc +++ b/examples/third.cc @@ -89,21 +89,23 @@ main (int argc, char *argv[]) WifiHelper wifi = WifiHelper::Default (); wifi.SetRemoteStationManager ("ns3::AarfWifiManager"); + NqosWifiMacHelper mac = NqosWifiMacHelper::Default (); + Ssid ssid = Ssid ("ns-3-ssid"); - wifi.SetMac ("ns3::NqstaWifiMac", + mac.SetType ("ns3::NqstaWifiMac", "Ssid", SsidValue (ssid), "ActiveProbing", BooleanValue (false)); NetDeviceContainer staDevices; - staDevices = wifi.Install (phy, wifiStaNodes); + staDevices = wifi.Install (phy, mac, wifiStaNodes); - wifi.SetMac ("ns3::NqapWifiMac", + mac.SetType ("ns3::NqapWifiMac", "Ssid", SsidValue (ssid), "BeaconGeneration", BooleanValue (true), "BeaconInterval", TimeValue (Seconds (2.5))); NetDeviceContainer apDevices; - apDevices = wifi.Install (phy, wifiApNode); + apDevices = wifi.Install (phy, mac, wifiApNode); MobilityHelper mobility; diff --git a/examples/wifi-adhoc.cc b/examples/wifi-adhoc.cc index 6f0e0bc54..d24ca101e 100644 --- a/examples/wifi-adhoc.cc +++ b/examples/wifi-adhoc.cc @@ -36,7 +36,8 @@ class Experiment public: Experiment (); Experiment (std::string name); - Gnuplot2dDataset Run (const WifiHelper &wifi, const YansWifiPhyHelper &wifiPhy, const YansWifiChannelHelper &wifiChannel); + Gnuplot2dDataset Run (const WifiHelper &wifi, const YansWifiPhyHelper &wifiPhy, + const NqosWifiMacHelper &wifiMac, const YansWifiChannelHelper &wifiChannel); private: void ReceivePacket (Ptr socket); void SetPosition (Ptr node, Vector position); @@ -109,7 +110,8 @@ Experiment::SetupPacketReceive (Ptr node) } Gnuplot2dDataset -Experiment::Run (const WifiHelper &wifi, const YansWifiPhyHelper &wifiPhy, const YansWifiChannelHelper &wifiChannel) +Experiment::Run (const WifiHelper &wifi, const YansWifiPhyHelper &wifiPhy, + const NqosWifiMacHelper &wifiMac, const YansWifiChannelHelper &wifiChannel) { m_bytesTotal = 0; @@ -121,7 +123,9 @@ Experiment::Run (const WifiHelper &wifi, const YansWifiPhyHelper &wifiPhy, const YansWifiPhyHelper phy = wifiPhy; phy.SetChannel (wifiChannel.Create ()); - NetDeviceContainer devices = wifi.Install (phy, c); + + NqosWifiMacHelper mac = wifiMac; + NetDeviceContainer devices = wifi.Install (phy, mac, c); MobilityHelper mobility; Ptr positionAlloc = CreateObject (); @@ -170,66 +174,67 @@ int main (int argc, char *argv[]) Experiment experiment; WifiHelper wifi = WifiHelper::Default (); + NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default (); YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default (); YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default (); Gnuplot2dDataset dataset; - wifi.SetMac ("ns3::AdhocWifiMac"); + wifiMac.SetType ("ns3::AdhocWifiMac"); NS_LOG_DEBUG ("54"); experiment = Experiment ("54mb"); wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode", StringValue ("wifia-54mbs")); - dataset = experiment.Run (wifi, wifiPhy, wifiChannel); + dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel); gnuplot.AddDataset (dataset); NS_LOG_DEBUG ("48"); experiment = Experiment ("48mb"); wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode", StringValue ("wifia-48mbs")); - dataset = experiment.Run (wifi, wifiPhy, wifiChannel); + dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel); gnuplot.AddDataset (dataset); NS_LOG_DEBUG ("36"); experiment = Experiment ("36mb"); wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode", StringValue ("wifia-36mbs")); - dataset = experiment.Run (wifi, wifiPhy, wifiChannel); + dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel); gnuplot.AddDataset (dataset); NS_LOG_DEBUG ("24"); experiment = Experiment ("24mb"); wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode", StringValue ("wifia-24mbs")); - dataset = experiment.Run (wifi, wifiPhy, wifiChannel); + dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel); gnuplot.AddDataset (dataset); NS_LOG_DEBUG ("18"); experiment = Experiment ("18mb"); wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode", StringValue ("wifia-18mbs")); - dataset = experiment.Run (wifi, wifiPhy, wifiChannel); + dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel); gnuplot.AddDataset (dataset); NS_LOG_DEBUG ("12"); experiment = Experiment ("12mb"); wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode", StringValue ("wifia-12mbs")); - dataset = experiment.Run (wifi, wifiPhy, wifiChannel); + dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel); gnuplot.AddDataset (dataset); NS_LOG_DEBUG ("9"); experiment = Experiment ("9mb"); wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode", StringValue ("wifia-9mbs")); - dataset = experiment.Run (wifi, wifiPhy, wifiChannel); + dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel); gnuplot.AddDataset (dataset); NS_LOG_DEBUG ("6"); experiment = Experiment ("6mb"); wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode", StringValue ("wifia-6mbs")); - dataset = experiment.Run (wifi, wifiPhy, wifiChannel); + dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel); gnuplot.AddDataset (dataset); gnuplot.GenerateOutput (std::cout); @@ -242,37 +247,37 @@ int main (int argc, char *argv[]) NS_LOG_DEBUG ("arf"); experiment = Experiment ("arf"); wifi.SetRemoteStationManager ("ns3::ArfWifiManager"); - dataset = experiment.Run (wifi, wifiPhy, wifiChannel); + dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel); gnuplot.AddDataset (dataset); NS_LOG_DEBUG ("aarf"); experiment = Experiment ("aarf"); wifi.SetRemoteStationManager ("ns3::AarfWifiManager"); - dataset = experiment.Run (wifi, wifiPhy, wifiChannel); + dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel); gnuplot.AddDataset (dataset); NS_LOG_DEBUG ("aarf-cd"); experiment = Experiment ("aarf-cd"); wifi.SetRemoteStationManager ("ns3::AarfcdWifiManager"); - dataset = experiment.Run (wifi, wifiPhy, wifiChannel); + dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel); gnuplot.AddDataset (dataset); NS_LOG_DEBUG ("cara"); experiment = Experiment ("cara"); wifi.SetRemoteStationManager ("ns3::CaraWifiManager"); - dataset = experiment.Run (wifi, wifiPhy, wifiChannel); + dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel); gnuplot.AddDataset (dataset); NS_LOG_DEBUG ("rraa"); experiment = Experiment ("rraa"); wifi.SetRemoteStationManager ("ns3::RraaWifiManager"); - dataset = experiment.Run (wifi, wifiPhy, wifiChannel); + dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel); gnuplot.AddDataset (dataset); NS_LOG_DEBUG ("ideal"); experiment = Experiment ("ideal"); wifi.SetRemoteStationManager ("ns3::IdealWifiManager"); - dataset = experiment.Run (wifi, wifiPhy, wifiChannel); + dataset = experiment.Run (wifi, wifiPhy, wifiMac, wifiChannel); gnuplot.AddDataset (dataset); gnuplot.GenerateOutput (std::cout); diff --git a/examples/wifi-ap.cc b/examples/wifi-ap.cc index e5cc5d84e..39d91ee7d 100644 --- a/examples/wifi-ap.cc +++ b/examples/wifi-ap.cc @@ -131,21 +131,22 @@ int main (int argc, char *argv[]) packetSocket.Install (stas); packetSocket.Install (ap); + NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default (); YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default (); YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default (); wifiPhy.SetChannel (wifiChannel.Create ()); Ssid ssid = Ssid ("wifi-default"); wifi.SetRemoteStationManager ("ns3::ArfWifiManager"); // setup stas. - wifi.SetMac ("ns3::NqstaWifiMac", + wifiMac.SetType ("ns3::NqstaWifiMac", "Ssid", SsidValue (ssid), "ActiveProbing", BooleanValue (false)); - staDevs = wifi.Install (wifiPhy, stas); + staDevs = wifi.Install (wifiPhy, wifiMac, stas); // setup ap. - wifi.SetMac ("ns3::NqapWifiMac", "Ssid", SsidValue (ssid), + wifiMac.SetType ("ns3::NqapWifiMac", "Ssid", SsidValue (ssid), "BeaconGeneration", BooleanValue (true), "BeaconInterval", TimeValue (Seconds (2.5))); - wifi.Install (wifiPhy, ap); + wifi.Install (wifiPhy, wifiMac, ap); // mobility. mobility.Install (stas); diff --git a/examples/wifi-wired-bridging.cc b/examples/wifi-wired-bridging.cc index 0ce26cab5..78e968c60 100644 --- a/examples/wifi-wired-bridging.cc +++ b/examples/wifi-wired-bridging.cc @@ -104,6 +104,7 @@ int main (int argc, char *argv[]) MobilityHelper mobility; BridgeHelper bridge; WifiHelper wifi = WifiHelper::Default (); + NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default (); YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default (); YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default (); wifiPhy.SetChannel (wifiChannel.Create ()); @@ -121,11 +122,11 @@ int main (int argc, char *argv[]) // setup the AP. mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); mobility.Install (backboneNodes.Get (i)); - wifi.SetMac ("ns3::NqapWifiMac", + wifiMac.SetType ("ns3::NqapWifiMac", "Ssid", SsidValue (ssid), "BeaconGeneration", BooleanValue (true), "BeaconInterval", TimeValue (Seconds (2.5))); - apDev = wifi.Install (wifiPhy, backboneNodes.Get (i)); + apDev = wifi.Install (wifiPhy, wifiMac, backboneNodes.Get (i)); NetDeviceContainer bridgeDev; bridgeDev = bridge.Install (backboneNodes.Get (i), NetDeviceContainer (apDev, backboneDevices.Get (i))); @@ -141,10 +142,10 @@ int main (int argc, char *argv[]) "Speed", StringValue ("Constant:1.0"), "Bounds", RectangleValue (Rectangle (wifiX, wifiX+5.0,0.0, (nStas+1)*5.0))); mobility.Install (sta); - wifi.SetMac ("ns3::NqstaWifiMac", + wifiMac.SetType ("ns3::NqstaWifiMac", "Ssid", SsidValue (ssid), "ActiveProbing", BooleanValue (false)); - staDev = wifi.Install (wifiPhy, sta); + staDev = wifi.Install (wifiPhy, wifiMac, sta); staInterface = ip.Assign (staDev); // save everything in containers. diff --git a/src/devices/wifi/adhoc-wifi-mac.cc b/src/devices/wifi/adhoc-wifi-mac.cc index d7539d738..89462a3ee 100644 --- a/src/devices/wifi/adhoc-wifi-mac.cc +++ b/src/devices/wifi/adhoc-wifi-mac.cc @@ -46,7 +46,8 @@ AdhocWifiMac::GetTypeId (void) .AddConstructor () .AddAttribute ("DcaTxop", "The DcaTxop object", PointerValue (), - MakePointerAccessor (&AdhocWifiMac::DoGetDcaTxop), + MakePointerAccessor (&AdhocWifiMac::GetDcaTxop, + &AdhocWifiMac::SetDcaTxop), MakePointerChecker ()) ; return tid; @@ -63,10 +64,6 @@ AdhocWifiMac::AdhocWifiMac () m_dcfManager = new DcfManager (); m_dcfManager->SetupLowListener (m_low); - - m_dca = CreateObject (); - m_dca->SetLow (m_low); - m_dca->SetManager (m_dcfManager); } AdhocWifiMac::~AdhocWifiMac () {} @@ -250,9 +247,18 @@ AdhocWifiMac::ForwardUp (Ptr packet, WifiMacHeader const *hdr) m_upCallback (packet, hdr->GetAddr2 (), hdr->GetAddr1 ()); } Ptr -AdhocWifiMac::DoGetDcaTxop(void) const +AdhocWifiMac::GetDcaTxop(void) const { return m_dca; } +void +AdhocWifiMac::SetDcaTxop (Ptr dcaTxop) +{ + m_dca = dcaTxop; + m_dca->SetLow (m_low); + m_dca->SetManager (m_dcfManager); +} + + } // namespace ns3 diff --git a/src/devices/wifi/adhoc-wifi-mac.h b/src/devices/wifi/adhoc-wifi-mac.h index 047798376..b1b70b73c 100644 --- a/src/devices/wifi/adhoc-wifi-mac.h +++ b/src/devices/wifi/adhoc-wifi-mac.h @@ -86,7 +86,8 @@ private: void ForwardUp (Ptr packet, WifiMacHeader const*hdr); AdhocWifiMac (const AdhocWifiMac & ctor_arg); AdhocWifiMac &operator = (const AdhocWifiMac &o); - Ptr DoGetDcaTxop(void) const; + Ptr GetDcaTxop(void) const; + void SetDcaTxop (Ptr dcaTxop); Ptr m_dca; Callback, Mac48Address, Mac48Address> m_upCallback; diff --git a/src/devices/wifi/nqap-wifi-mac.cc b/src/devices/wifi/nqap-wifi-mac.cc index 85c91364a..0e019e32e 100644 --- a/src/devices/wifi/nqap-wifi-mac.cc +++ b/src/devices/wifi/nqap-wifi-mac.cc @@ -60,7 +60,8 @@ NqapWifiMac::GetTypeId (void) MakeBooleanChecker ()) .AddAttribute ("DcaTxop", "The DcaTxop object", PointerValue (), - MakePointerAccessor (&NqapWifiMac::DoGetDcaTxop), + MakePointerAccessor (&NqapWifiMac::GetDcaTxop, + &NqapWifiMac::SetDcaTxop), MakePointerChecker ()) ; return tid; @@ -78,12 +79,6 @@ NqapWifiMac::NqapWifiMac () m_dcfManager = new DcfManager (); m_dcfManager->SetupLowListener (m_low); - m_dca = CreateObject (); - m_dca->SetLow (m_low); - m_dca->SetManager (m_dcfManager); - m_dca->SetTxOkCallback (MakeCallback (&NqapWifiMac::TxOk, this)); - m_dca->SetTxFailedCallback (MakeCallback (&NqapWifiMac::TxFailed, this)); - m_beaconDca = CreateObject (); m_beaconDca->SetAifsn(1); m_beaconDca->SetMinCw(0); @@ -108,6 +103,7 @@ NqapWifiMac::DoDispose (void) m_phy = 0; m_dca = 0; m_beaconDca = 0; + m_stationManager = 0; m_beaconEvent.Cancel (); WifiMac::DoDispose (); } @@ -300,8 +296,7 @@ NqapWifiMac::ForwardDown (Ptr packet, Mac48Address from, Mac48Addr hdr.SetAddr3 (from); hdr.SetDsFrom (); hdr.SetDsNotTo (); - - m_dca->Queue (packet, hdr); + m_dca->Queue (packet, hdr); } void NqapWifiMac::Enqueue (Ptr packet, Mac48Address to, Mac48Address from) @@ -565,9 +560,19 @@ NqapWifiMac::Receive (Ptr packet, WifiMacHeader const *hdr) } } Ptr -NqapWifiMac::DoGetDcaTxop(void) const +NqapWifiMac::GetDcaTxop(void) const { return m_dca; } +void +NqapWifiMac::SetDcaTxop (Ptr dcaTxop) +{ + m_dca = dcaTxop; + m_dca->SetLow (m_low); + m_dca->SetManager (m_dcfManager); + m_dca->SetTxOkCallback (MakeCallback (&NqapWifiMac::TxOk, this)); + m_dca->SetTxFailedCallback (MakeCallback (&NqapWifiMac::TxFailed, this)); +} + } // namespace ns3 diff --git a/src/devices/wifi/nqap-wifi-mac.h b/src/devices/wifi/nqap-wifi-mac.h index f3498bc25..a7e792fc6 100644 --- a/src/devices/wifi/nqap-wifi-mac.h +++ b/src/devices/wifi/nqap-wifi-mac.h @@ -21,6 +21,7 @@ #define MAC_HIGH_NQAP_H #include + #include "ns3/mac48-address.h" #include "ns3/callback.h" #include "ns3/packet.h" @@ -113,7 +114,8 @@ private: virtual void DoDispose (void); NqapWifiMac (const NqapWifiMac & ctor_arg); NqapWifiMac &operator = (const NqapWifiMac &o); - Ptr DoGetDcaTxop(void) const; + Ptr GetDcaTxop (void) const; + void SetDcaTxop (Ptr dcaTxop); Ptr m_dca; Ptr m_beaconDca; diff --git a/src/devices/wifi/nqsta-wifi-mac.cc b/src/devices/wifi/nqsta-wifi-mac.cc index 7a78f071f..e7ff5eafa 100644 --- a/src/devices/wifi/nqsta-wifi-mac.cc +++ b/src/devices/wifi/nqsta-wifi-mac.cc @@ -89,7 +89,8 @@ NqstaWifiMac::GetTypeId (void) MakeBooleanChecker ()) .AddAttribute ("DcaTxop", "The DcaTxop object", PointerValue (), - MakePointerAccessor (&NqstaWifiMac::DoGetDcaTxop), + MakePointerAccessor (&NqstaWifiMac::GetDcaTxop, + &NqstaWifiMac::SetDcaTxop), MakePointerChecker ()) .AddTraceSource ("Assoc", "Associated with an access point.", MakeTraceSourceAccessor (&NqstaWifiMac::m_assocLogger)) @@ -99,7 +100,6 @@ NqstaWifiMac::GetTypeId (void) return tid; } - NqstaWifiMac::NqstaWifiMac () : m_state (BEACON_MISSED), m_probeRequestEvent (), @@ -115,10 +115,6 @@ NqstaWifiMac::NqstaWifiMac () m_dcfManager = new DcfManager (); m_dcfManager->SetupLowListener (m_low); - - m_dca = CreateObject (); - m_dca->SetLow (m_low); - m_dca->SetManager (m_dcfManager); } NqstaWifiMac::~NqstaWifiMac () @@ -137,6 +133,7 @@ NqstaWifiMac::DoDispose (void) m_dcfManager = 0; m_phy = 0; m_dca = 0; + m_stationManager = 0; WifiMac::DoDispose (); } @@ -207,10 +204,17 @@ NqstaWifiMac::GetPifs (void) const return m_low->GetPifs (); } Ptr -NqstaWifiMac::DoGetDcaTxop(void) const +NqstaWifiMac::GetDcaTxop(void) const { return m_dca; } +void +NqstaWifiMac::SetDcaTxop (Ptr dcaTxop) +{ + m_dca = dcaTxop; + m_dca->SetLow (m_low); + m_dca->SetManager (m_dcfManager); +} void NqstaWifiMac::SetWifiPhy (Ptr phy) { @@ -565,7 +569,7 @@ NqstaWifiMac::Receive (Ptr packet, WifiMacHeader const *hdr) SetState (WAIT_ASSOC_RESP); SendAssociationRequest (); } - } + } else if (hdr->IsProbeResp ()) { if (m_state == WAIT_PROBE_RESP) diff --git a/src/devices/wifi/nqsta-wifi-mac.h b/src/devices/wifi/nqsta-wifi-mac.h index b48a01a49..414596bf1 100644 --- a/src/devices/wifi/nqsta-wifi-mac.h +++ b/src/devices/wifi/nqsta-wifi-mac.h @@ -137,7 +137,8 @@ private: virtual void DoDispose (void); NqstaWifiMac (const NqstaWifiMac & ctor_arg); NqstaWifiMac &operator = (const NqstaWifiMac & ctor_arg); - Ptr DoGetDcaTxop(void) const; + Ptr GetDcaTxop(void) const; + void SetDcaTxop (Ptr dcaTxop); void SetState (enum MacState value); enum MacState m_state; diff --git a/src/devices/wifi/wifi-test.cc b/src/devices/wifi/wifi-test.cc index 2e15b4965..c2a9ba532 100644 --- a/src/devices/wifi/wifi-test.cc +++ b/src/devices/wifi/wifi-test.cc @@ -33,6 +33,8 @@ #include "ns3/simulator.h" #include "ns3/test.h" #include "ns3/object-factory.h" +#include "dca-txop.h" +#include "ns3/pointer.h" namespace ns3 { @@ -69,7 +71,9 @@ WifiTest::CreateOne (Vector pos, Ptr channel) Ptr node = CreateObject (); Ptr dev = CreateObject (); + Ptr queue = CreateObject (); Ptr mac = m_mac.Create (); + mac->SetAttribute("DcaTxop", PointerValue (queue)); Ptr mobility = CreateObject (); Ptr phy = CreateObject (); Ptr error = CreateObject (); diff --git a/src/devices/wifi/wscript b/src/devices/wifi/wscript index 0dec4df21..7d91299a3 100644 --- a/src/devices/wifi/wscript +++ b/src/devices/wifi/wscript @@ -81,6 +81,8 @@ def build(bld): 'supported-rates.h', 'error-rate-model.h', 'yans-error-rate-model.h', + 'dca-txop.h', + 'wifi-mac-header.h' ] obj = bld.create_ns3_program('wifi-phy-test', diff --git a/src/helper/nqos-wifi-mac-helper.cc b/src/helper/nqos-wifi-mac-helper.cc new file mode 100644 index 000000000..fbe904ab9 --- /dev/null +++ b/src/helper/nqos-wifi-mac-helper.cc @@ -0,0 +1,86 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2009 MIRKO BANCHI + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Mirko Banchi + */ +#include "nqos-wifi-mac-helper.h" +#include "ns3/wifi-mac.h" +#include "ns3/pointer.h" +#include "ns3/dca-txop.h" + +namespace ns3 { + +NqosWifiMacHelper::NqosWifiMacHelper () +{ + m_queue.SetTypeId ("ns3::DcaTxop"); +} + +NqosWifiMacHelper::~NqosWifiMacHelper () +{} + +NqosWifiMacHelper +NqosWifiMacHelper::Default (void) +{ + NqosWifiMacHelper helper; + helper.SetType ("ns3::AdhocWifiMac"); + return helper; +} + +void +NqosWifiMacHelper::SetType (std::string type, + std::string n0, const AttributeValue &v0, + std::string n1, const AttributeValue &v1, + std::string n2, const AttributeValue &v2, + std::string n3, const AttributeValue &v3, + std::string n4, const AttributeValue &v4, + std::string n5, const AttributeValue &v5, + std::string n6, const AttributeValue &v6, + std::string n7, const AttributeValue &v7) +{ + m_mac.SetTypeId (type); + m_mac.Set (n0, v0); + m_mac.Set (n1, v1); + m_mac.Set (n2, v2); + m_mac.Set (n3, v3); + m_mac.Set (n4, v4); + m_mac.Set (n5, v5); + m_mac.Set (n6, v6); + m_mac.Set (n7, v7); +} + +void +NqosWifiMacHelper::SetDcaParameters (std::string n0, const AttributeValue &v0, + std::string n1, const AttributeValue &v1, + std::string n2, const AttributeValue &v2, + std::string n3, const AttributeValue &v3) +{ + m_queue.Set (n0, v0); + m_queue.Set (n1, v1); + m_queue.Set (n2, v2); + m_queue.Set (n3, v3); +} + +Ptr +NqosWifiMacHelper::Create (void) const +{ + Ptr mac = m_mac.Create (); + Ptr queue = m_queue.Create (); + mac->SetAttribute ("DcaTxop", PointerValue (queue)); + return mac; +} + +} //namespace ns3 diff --git a/src/helper/nqos-wifi-mac-helper.h b/src/helper/nqos-wifi-mac-helper.h new file mode 100644 index 000000000..d582e3743 --- /dev/null +++ b/src/helper/nqos-wifi-mac-helper.h @@ -0,0 +1,95 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2009 MIRKO BANCHI + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Mirko Banchi + */ +#ifndef NQOS_WIFI_MAC_HELPER_H +#define NQOS_WIFI_MAC_HELPER_H + +#include "wifi-helper.h" + +namespace ns3 { + +class NqosWifiMacHelper : public WifiMacHelper +{ +public: + NqosWifiMacHelper (); + virtual ~NqosWifiMacHelper (); + /** + * Create a mac helper in a default working state. + */ + static NqosWifiMacHelper Default (void); + /** + * \param type the type of ns3::WifiMac to create. + * \param n0 the name of the attribute to set + * \param v0 the value of the attribute to set + * \param n1 the name of the attribute to set + * \param v1 the value of the attribute to set + * \param n2 the name of the attribute to set + * \param v2 the value of the attribute to set + * \param n3 the name of the attribute to set + * \param v3 the value of the attribute to set + * \param n4 the name of the attribute to set + * \param v4 the value of the attribute to set + * \param n5 the name of the attribute to set + * \param v5 the value of the attribute to set + * \param n6 the name of the attribute to set + * \param v6 the value of the attribute to set + * \param n7 the name of the attribute to set + * \param v7 the value of the attribute to set + * + * All the attributes specified in this method should exist + * in the requested mac. + */ + void SetType (std::string type, + std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (), + std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (), + std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (), + std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (), + std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (), + std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (), + std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (), + std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ()); + /** + * \param type the type of ns3::WifiMac to create. + * \param n0 the name of the attribute to set + * \param v0 the value of the attribute to set + * \param n1 the name of the attribute to set + * \param v1 the value of the attribute to set + * \param n2 the name of the attribute to set + * \param v2 the value of the attribute to set + * \param n3 the name of the attribute to set + */ + void SetDcaParameters (std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (), + std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (), + std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (), + std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue ()); +private: + /** + * \returns a newly-created MAC object. + * + * This method implements the pure virtual method defined in \ref ns3::WifiMacHelper. + */ + virtual Ptr Create (void) const; + + ObjectFactory m_mac; + ObjectFactory m_queue; +}; + +} //namespace ns3 + +#endif /* NQOS_WIFI_MAC_HELPER_H */ diff --git a/src/helper/wifi-helper.cc b/src/helper/wifi-helper.cc index e5a3e5991..efa4227eb 100644 --- a/src/helper/wifi-helper.cc +++ b/src/helper/wifi-helper.cc @@ -1,6 +1,7 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2008 INRIA + * Copyright (c) 2009 MIRKO BANCHI * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -16,6 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: Mathieu Lacage + * Author: Mirko Banchi */ #include "wifi-helper.h" #include "ns3/wifi-net-device.h" @@ -40,6 +42,8 @@ namespace ns3 { WifiPhyHelper::~WifiPhyHelper () {} +WifiMacHelper::~WifiMacHelper () +{} WifiHelper::WifiHelper () {} @@ -49,7 +53,6 @@ WifiHelper::Default (void) { WifiHelper helper; helper.SetRemoteStationManager ("ns3::ArfWifiManager"); - helper.SetMac ("ns3::AdhocWifiMac"); return helper; } @@ -76,31 +79,9 @@ WifiHelper::SetRemoteStationManager (std::string type, m_stationManager.Set (n7, v7); } -void -WifiHelper::SetMac (std::string type, - std::string n0, const AttributeValue &v0, - std::string n1, const AttributeValue &v1, - std::string n2, const AttributeValue &v2, - std::string n3, const AttributeValue &v3, - std::string n4, const AttributeValue &v4, - std::string n5, const AttributeValue &v5, - std::string n6, const AttributeValue &v6, - std::string n7, const AttributeValue &v7) -{ - m_mac = ObjectFactory (); - m_mac.SetTypeId (type); - m_mac.Set (n0, v0); - m_mac.Set (n1, v1); - m_mac.Set (n2, v2); - m_mac.Set (n3, v3); - m_mac.Set (n4, v4); - m_mac.Set (n5, v5); - m_mac.Set (n6, v6); - m_mac.Set (n7, v7); -} - NetDeviceContainer -WifiHelper::Install (const WifiPhyHelper &phyHelper, NodeContainer c) const +WifiHelper::Install (const WifiPhyHelper &phyHelper, + const WifiMacHelper &macHelper, NodeContainer c) const { NetDeviceContainer devices; for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i) @@ -108,7 +89,7 @@ WifiHelper::Install (const WifiPhyHelper &phyHelper, NodeContainer c) const Ptr node = *i; Ptr device = CreateObject (); Ptr manager = m_stationManager.Create (); - Ptr mac = m_mac.Create (); + Ptr mac = macHelper.Create (); Ptr phy = phyHelper.Create (node, device); mac->SetAddress (Mac48Address::Allocate ()); device->SetMac (mac); @@ -120,16 +101,20 @@ WifiHelper::Install (const WifiPhyHelper &phyHelper, NodeContainer c) const } return devices; } + NetDeviceContainer -WifiHelper::Install (const WifiPhyHelper &phy, Ptr node) const +WifiHelper::Install (const WifiPhyHelper &phy, + const WifiMacHelper &mac, Ptr node) const { - return Install (phy, NodeContainer (node)); + return Install (phy, mac, NodeContainer (node)); } + NetDeviceContainer -WifiHelper::Install (const WifiPhyHelper &phy, std::string nodeName) const +WifiHelper::Install (const WifiPhyHelper &phy, + const WifiMacHelper &mac, std::string nodeName) const { Ptr node = Names::Find (nodeName); - return Install (phy, NodeContainer (node)); + return Install (phy, mac, NodeContainer (node)); } } // namespace ns3 diff --git a/src/helper/wifi-helper.h b/src/helper/wifi-helper.h index b8b49630a..5983c4c7c 100644 --- a/src/helper/wifi-helper.h +++ b/src/helper/wifi-helper.h @@ -1,6 +1,7 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2008 INRIA + * Copyright (c) 2009 MIRKO BANCHI * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -16,6 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: Mathieu Lacage + * Author: Mirko Banchi */ #ifndef WIFI_HELPER_H #define WIFI_HELPER_H @@ -29,6 +31,7 @@ namespace ns3 { class WifiPhy; +class WifiMac; class WifiNetDevice; class Node; @@ -53,6 +56,25 @@ public: virtual Ptr Create (Ptr node, Ptr device) const = 0; }; +/** + * \brief create MAC objects + * + * This base class must be implemented by new MAC implementation which wish to integrate + * with the \ref ns3::WifiHelper class. + */ +class WifiMacHelper +{ +public: + virtual ~WifiMacHelper (); + /** + * \returns a new MAC object. + * + * Subclasses must implement this method to allow the ns3::WifiHelper class + * to create MAC objects from ns3::WifiHelper::Install. + */ + virtual Ptr Create (void) const = 0; +}; + /** * \brief helps to create WifiNetDevice objects * @@ -108,61 +130,33 @@ public: std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (), std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (), std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ()); - - /** - * \param type the type of ns3::WifiMac to create. - * \param n0 the name of the attribute to set - * \param v0 the value of the attribute to set - * \param n1 the name of the attribute to set - * \param v1 the value of the attribute to set - * \param n2 the name of the attribute to set - * \param v2 the value of the attribute to set - * \param n3 the name of the attribute to set - * \param v3 the value of the attribute to set - * \param n4 the name of the attribute to set - * \param v4 the value of the attribute to set - * \param n5 the name of the attribute to set - * \param v5 the value of the attribute to set - * \param n6 the name of the attribute to set - * \param v6 the value of the attribute to set - * \param n7 the name of the attribute to set - * \param v7 the value of the attribute to set - * - * All the attributes specified in this method should exist - * in the requested mac. - */ - void SetMac (std::string type, - std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (), - std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (), - std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (), - std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (), - std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (), - std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (), - std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (), - std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ()); - /** * \param phy the PHY helper to create PHY objects + * \param mac the MAC helper to create MAC objects * \param c the set of nodes on which a wifi device must be created * \returns a device container which contains all the devices created by this method. */ - NetDeviceContainer Install (const WifiPhyHelper &phy, NodeContainer c) const; + NetDeviceContainer Install (const WifiPhyHelper &phy, + const WifiMacHelper &mac, NodeContainer c) const; /** * \param phy the PHY helper to create PHY objects + * \param mac the MAC helper to create MAC objects * \param node the node on which a wifi device must be created * \returns a device container which contains all the devices created by this method. */ - NetDeviceContainer Install (const WifiPhyHelper &phy, Ptr node) const; + NetDeviceContainer Install (const WifiPhyHelper &phy, + const WifiMacHelper &mac, Ptr node) const; /** * \param phy the PHY helper to create PHY objects + * \param mac the MAC helper to create MAC objects * \param nodeName the name of node on which a wifi device must be created * \returns a device container which contains all the devices created by this method. */ - NetDeviceContainer Install (const WifiPhyHelper &phy, std::string nodeName) const; + NetDeviceContainer Install (const WifiPhyHelper &phy, + const WifiMacHelper &mac, std::string nodeName) const; private: ObjectFactory m_stationManager; - ObjectFactory m_mac; }; } // namespace ns3 diff --git a/src/helper/wscript b/src/helper/wscript index 79fe4abe5..46203b155 100644 --- a/src/helper/wscript +++ b/src/helper/wscript @@ -23,6 +23,7 @@ def build(bld): 'bridge-helper.cc', 'yans-wifi-helper.cc', 'v4ping-helper.cc', + 'nqos-wifi-mac-helper.cc', ] headers = bld.new_task_gen('ns3header') @@ -48,6 +49,7 @@ def build(bld): 'bridge-helper.h', 'yans-wifi-helper.h', 'v4ping-helper.h', + 'nqos-wifi-mac-helper.h', ] env = bld.env_of_name('default') From cc5c5444ec667e419f326f5f8fdbae479616f451 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Fri, 24 Apr 2009 10:02:10 +0200 Subject: [PATCH 16/35] rescan python --- bindings/python/callbacks_list.py | 1 + bindings/python/ns3_module_bridge.py | 6 +- bindings/python/ns3_module_common.py | 4 +- bindings/python/ns3_module_contrib.py | 4 +- bindings/python/ns3_module_core.py | 8 +- bindings/python/ns3_module_helper.py | 59 ++- bindings/python/ns3_module_internet_stack.py | 8 +- bindings/python/ns3_module_node.py | 6 +- bindings/python/ns3_module_stats.py | 8 +- bindings/python/ns3_module_tap_bridge.py | 2 +- bindings/python/ns3_module_wifi.py | 525 +++++++++++++++++-- 11 files changed, 564 insertions(+), 67 deletions(-) diff --git a/bindings/python/callbacks_list.py b/bindings/python/callbacks_list.py index 352a6ca1a..679214ead 100644 --- a/bindings/python/callbacks_list.py +++ b/bindings/python/callbacks_list.py @@ -5,6 +5,7 @@ callback_classes = [ ['void', 'ns3::Ptr', 'ns3::Address const&', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'], ['bool', 'ns3::Ptr', 'ns3::Address const&', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'], ['void', 'ns3::Ptr', 'ns3::Mac48Address', 'ns3::Mac48Address', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'], + ['void', 'ns3::WifiMacHeader const&', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'], ['bool', 'std::string', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'], ['bool', 'ns3::Ptr', 'ns3::Ptr', 'unsigned short', 'ns3::Address const&', 'ns3::Address const&', 'ns3::NetDevice::PacketType', 'ns3::empty', 'ns3::empty', 'ns3::empty'], ['bool', 'ns3::Ptr', 'ns3::Ptr', 'unsigned short', 'ns3::Address const&', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'], diff --git a/bindings/python/ns3_module_bridge.py b/bindings/python/ns3_module_bridge.py index 647193174..e63db6b91 100644 --- a/bindings/python/ns3_module_bridge.py +++ b/bindings/python/ns3_module_bridge.py @@ -223,17 +223,17 @@ def register_Ns3BridgeNetDevice_methods(root_module, cls): 'void', [], visibility='protected', is_virtual=True) - ## bridge-net-device.h: void ns3::BridgeNetDevice::ReceiveFromDevice(ns3::Ptr device, ns3::Ptr packet, uint16_t protocol, ns3::Address const & source, ns3::Address const & destination, ns3::NetDevice::PacketType packetType) [member function] + ## bridge-net-device.h: void ns3::BridgeNetDevice::ReceiveFromDevice(ns3::Ptr device, ns3::Ptr packet, uint16_t protocol, ns3::Address const & source, ns3::Address const & destination, ns3::NetDevice::PacketType packetType) [member function] cls.add_method('ReceiveFromDevice', 'void', [param('ns3::Ptr< ns3::NetDevice >', 'device'), param('ns3::Ptr< ns3::Packet const >', 'packet'), param('uint16_t', 'protocol'), param('ns3::Address const &', 'source'), param('ns3::Address const &', 'destination'), param('ns3::NetDevice::PacketType', 'packetType')], visibility='protected') - ## bridge-net-device.h: void ns3::BridgeNetDevice::ForwardUnicast(ns3::Ptr incomingPort, ns3::Ptr packet, uint16_t protocol, ns3::Mac48Address src, ns3::Mac48Address dst) [member function] + ## bridge-net-device.h: void ns3::BridgeNetDevice::ForwardUnicast(ns3::Ptr incomingPort, ns3::Ptr packet, uint16_t protocol, ns3::Mac48Address src, ns3::Mac48Address dst) [member function] cls.add_method('ForwardUnicast', 'void', [param('ns3::Ptr< ns3::NetDevice >', 'incomingPort'), param('ns3::Ptr< ns3::Packet const >', 'packet'), param('uint16_t', 'protocol'), param('ns3::Mac48Address', 'src'), param('ns3::Mac48Address', 'dst')], visibility='protected') - ## bridge-net-device.h: void ns3::BridgeNetDevice::ForwardBroadcast(ns3::Ptr incomingPort, ns3::Ptr packet, uint16_t protocol, ns3::Mac48Address src, ns3::Mac48Address dst) [member function] + ## bridge-net-device.h: void ns3::BridgeNetDevice::ForwardBroadcast(ns3::Ptr incomingPort, ns3::Ptr packet, uint16_t protocol, ns3::Mac48Address src, ns3::Mac48Address dst) [member function] cls.add_method('ForwardBroadcast', 'void', [param('ns3::Ptr< ns3::NetDevice >', 'incomingPort'), param('ns3::Ptr< ns3::Packet const >', 'packet'), param('uint16_t', 'protocol'), param('ns3::Mac48Address', 'src'), param('ns3::Mac48Address', 'dst')], diff --git a/bindings/python/ns3_module_common.py b/bindings/python/ns3_module_common.py index 7877692dd..b12fb8e79 100644 --- a/bindings/python/ns3_module_common.py +++ b/bindings/python/ns3_module_common.py @@ -374,7 +374,7 @@ def register_Ns3Packet_methods(root_module, cls): cls.add_constructor([param('uint32_t', 'size')]) ## packet.h: ns3::Packet::Packet(uint8_t const * buffer, uint32_t size) [constructor] cls.add_constructor([param('uint8_t const *', 'buffer'), param('uint32_t', 'size')]) - ## packet.h: void ns3::Packet::AddAtEnd(ns3::Ptr packet) [member function] + ## packet.h: void ns3::Packet::AddAtEnd(ns3::Ptr packet) [member function] cls.add_method('AddAtEnd', 'void', [param('ns3::Ptr< ns3::Packet const >', 'packet')]) @@ -940,7 +940,7 @@ def register_Ns3PcapWriter_methods(root_module, cls): cls.add_method('WritePppHeader', 'void', []) - ## pcap-writer.h: void ns3::PcapWriter::WritePacket(ns3::Ptr packet) [member function] + ## pcap-writer.h: void ns3::PcapWriter::WritePacket(ns3::Ptr packet) [member function] cls.add_method('WritePacket', 'void', [param('ns3::Ptr< ns3::Packet const >', 'packet')]) diff --git a/bindings/python/ns3_module_contrib.py b/bindings/python/ns3_module_contrib.py index c6ae60703..f334a7a30 100644 --- a/bindings/python/ns3_module_contrib.py +++ b/bindings/python/ns3_module_contrib.py @@ -102,12 +102,12 @@ def register_Ns3DelayJitterEstimation_methods(root_module, cls): cls.add_constructor([param('ns3::DelayJitterEstimation const &', 'arg0')]) ## delay-jitter-estimation.h: ns3::DelayJitterEstimation::DelayJitterEstimation() [constructor] cls.add_constructor([]) - ## delay-jitter-estimation.h: static void ns3::DelayJitterEstimation::PrepareTx(ns3::Ptr packet) [member function] + ## delay-jitter-estimation.h: static void ns3::DelayJitterEstimation::PrepareTx(ns3::Ptr packet) [member function] cls.add_method('PrepareTx', 'void', [param('ns3::Ptr< ns3::Packet const >', 'packet')], is_static=True) - ## delay-jitter-estimation.h: void ns3::DelayJitterEstimation::RecordRx(ns3::Ptr packet) [member function] + ## delay-jitter-estimation.h: void ns3::DelayJitterEstimation::RecordRx(ns3::Ptr packet) [member function] cls.add_method('RecordRx', 'void', [param('ns3::Ptr< ns3::Packet const >', 'packet')]) diff --git a/bindings/python/ns3_module_core.py b/bindings/python/ns3_module_core.py index f92b4d19a..e108eba13 100644 --- a/bindings/python/ns3_module_core.py +++ b/bindings/python/ns3_module_core.py @@ -2028,7 +2028,7 @@ def register_Ns3TracedValue__Unsigned_int_methods(root_module, cls): cls.add_method('ConnectWithoutContext', 'void', [param('ns3::CallbackBase const &', 'cb')]) - ## traced-value.h: void ns3::TracedValue::Connect(ns3::CallbackBase const & cb, std::basic_string,std::allocator > path) [member function] + ## traced-value.h: void ns3::TracedValue::Connect(ns3::CallbackBase const & cb, std::string path) [member function] cls.add_method('Connect', 'void', [param('ns3::CallbackBase const &', 'cb'), param('std::string', 'path')]) @@ -2036,7 +2036,7 @@ def register_Ns3TracedValue__Unsigned_int_methods(root_module, cls): cls.add_method('DisconnectWithoutContext', 'void', [param('ns3::CallbackBase const &', 'cb')]) - ## traced-value.h: void ns3::TracedValue::Disconnect(ns3::CallbackBase const & cb, std::basic_string,std::allocator > path) [member function] + ## traced-value.h: void ns3::TracedValue::Disconnect(ns3::CallbackBase const & cb, std::string path) [member function] cls.add_method('Disconnect', 'void', [param('ns3::CallbackBase const &', 'cb'), param('std::string', 'path')]) @@ -2184,7 +2184,7 @@ def register_functions(root_module): module.add_function('TypeNameGet', 'std::string', [], - template_parameters=['long']) + template_parameters=['long long']) ## type-name.h: extern std::string ns3::TypeNameGet() [free function] module.add_function('TypeNameGet', 'std::string', @@ -2204,7 +2204,7 @@ def register_functions(root_module): module.add_function('TypeNameGet', 'std::string', [], - template_parameters=['unsigned long']) + template_parameters=['unsigned long long']) ## type-name.h: extern std::string ns3::TypeNameGet() [free function] module.add_function('TypeNameGet', 'std::string', diff --git a/bindings/python/ns3_module_helper.py b/bindings/python/ns3_module_helper.py index 770173eda..2faa17bca 100644 --- a/bindings/python/ns3_module_helper.py +++ b/bindings/python/ns3_module_helper.py @@ -47,12 +47,16 @@ def register_types(module): module.add_class('V4PingHelper', allow_subclassing=False) ## wifi-helper.h: ns3::WifiHelper [class] module.add_class('WifiHelper', allow_subclassing=False) + ## wifi-helper.h: ns3::WifiMacHelper [class] + module.add_class('WifiMacHelper', allow_subclassing=False) ## wifi-helper.h: ns3::WifiPhyHelper [class] module.add_class('WifiPhyHelper', allow_subclassing=False) ## yans-wifi-helper.h: ns3::YansWifiChannelHelper [class] module.add_class('YansWifiChannelHelper', allow_subclassing=False) ## yans-wifi-helper.h: ns3::YansWifiPhyHelper [class] module.add_class('YansWifiPhyHelper', allow_subclassing=False, parent=root_module['ns3::WifiPhyHelper']) + ## nqos-wifi-mac-helper.h: ns3::NqosWifiMacHelper [class] + module.add_class('NqosWifiMacHelper', allow_subclassing=False, parent=root_module['ns3::WifiMacHelper']) ## Register a nested module for the namespace Config @@ -117,9 +121,11 @@ def register_methods(root_module): register_Ns3UdpEchoServerHelper_methods(root_module, root_module['ns3::UdpEchoServerHelper']) register_Ns3V4PingHelper_methods(root_module, root_module['ns3::V4PingHelper']) register_Ns3WifiHelper_methods(root_module, root_module['ns3::WifiHelper']) + register_Ns3WifiMacHelper_methods(root_module, root_module['ns3::WifiMacHelper']) register_Ns3WifiPhyHelper_methods(root_module, root_module['ns3::WifiPhyHelper']) register_Ns3YansWifiChannelHelper_methods(root_module, root_module['ns3::YansWifiChannelHelper']) register_Ns3YansWifiPhyHelper_methods(root_module, root_module['ns3::YansWifiPhyHelper']) + register_Ns3NqosWifiMacHelper_methods(root_module, root_module['ns3::NqosWifiMacHelper']) return def register_Ns3ApplicationContainer_methods(root_module, cls): @@ -1068,27 +1074,35 @@ def register_Ns3WifiHelper_methods(root_module, cls): cls.add_method('SetRemoteStationManager', 'void', [param('std::string', 'type'), param('std::string', 'n0', default_value='""'), param('ns3::AttributeValue const &', 'v0', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n1', default_value='""'), param('ns3::AttributeValue const &', 'v1', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n2', default_value='""'), param('ns3::AttributeValue const &', 'v2', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n3', default_value='""'), param('ns3::AttributeValue const &', 'v3', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n4', default_value='""'), param('ns3::AttributeValue const &', 'v4', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n5', default_value='""'), param('ns3::AttributeValue const &', 'v5', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n6', default_value='""'), param('ns3::AttributeValue const &', 'v6', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n7', default_value='""'), param('ns3::AttributeValue const &', 'v7', default_value='ns3::EmptyAttributeValue()')]) - ## wifi-helper.h: void ns3::WifiHelper::SetMac(std::string type, std::string n0="", ns3::AttributeValue const & v0=ns3::EmptyAttributeValue(), std::string n1="", ns3::AttributeValue const & v1=ns3::EmptyAttributeValue(), std::string n2="", ns3::AttributeValue const & v2=ns3::EmptyAttributeValue(), std::string n3="", ns3::AttributeValue const & v3=ns3::EmptyAttributeValue(), std::string n4="", ns3::AttributeValue const & v4=ns3::EmptyAttributeValue(), std::string n5="", ns3::AttributeValue const & v5=ns3::EmptyAttributeValue(), std::string n6="", ns3::AttributeValue const & v6=ns3::EmptyAttributeValue(), std::string n7="", ns3::AttributeValue const & v7=ns3::EmptyAttributeValue()) [member function] - cls.add_method('SetMac', - 'void', - [param('std::string', 'type'), param('std::string', 'n0', default_value='""'), param('ns3::AttributeValue const &', 'v0', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n1', default_value='""'), param('ns3::AttributeValue const &', 'v1', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n2', default_value='""'), param('ns3::AttributeValue const &', 'v2', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n3', default_value='""'), param('ns3::AttributeValue const &', 'v3', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n4', default_value='""'), param('ns3::AttributeValue const &', 'v4', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n5', default_value='""'), param('ns3::AttributeValue const &', 'v5', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n6', default_value='""'), param('ns3::AttributeValue const &', 'v6', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n7', default_value='""'), param('ns3::AttributeValue const &', 'v7', default_value='ns3::EmptyAttributeValue()')]) - ## wifi-helper.h: ns3::NetDeviceContainer ns3::WifiHelper::Install(ns3::WifiPhyHelper const & phy, ns3::NodeContainer c) const [member function] + ## wifi-helper.h: ns3::NetDeviceContainer ns3::WifiHelper::Install(ns3::WifiPhyHelper const & phy, ns3::WifiMacHelper const & mac, ns3::NodeContainer c) const [member function] cls.add_method('Install', 'ns3::NetDeviceContainer', - [param('ns3::WifiPhyHelper const &', 'phy'), param('ns3::NodeContainer', 'c')], + [param('ns3::WifiPhyHelper const &', 'phy'), param('ns3::WifiMacHelper const &', 'mac'), param('ns3::NodeContainer', 'c')], is_const=True) - ## wifi-helper.h: ns3::NetDeviceContainer ns3::WifiHelper::Install(ns3::WifiPhyHelper const & phy, ns3::Ptr node) const [member function] + ## wifi-helper.h: ns3::NetDeviceContainer ns3::WifiHelper::Install(ns3::WifiPhyHelper const & phy, ns3::WifiMacHelper const & mac, ns3::Ptr node) const [member function] cls.add_method('Install', 'ns3::NetDeviceContainer', - [param('ns3::WifiPhyHelper const &', 'phy'), param('ns3::Ptr< ns3::Node >', 'node')], + [param('ns3::WifiPhyHelper const &', 'phy'), param('ns3::WifiMacHelper const &', 'mac'), param('ns3::Ptr< ns3::Node >', 'node')], is_const=True) - ## wifi-helper.h: ns3::NetDeviceContainer ns3::WifiHelper::Install(ns3::WifiPhyHelper const & phy, std::string nodeName) const [member function] + ## wifi-helper.h: ns3::NetDeviceContainer ns3::WifiHelper::Install(ns3::WifiPhyHelper const & phy, ns3::WifiMacHelper const & mac, std::string nodeName) const [member function] cls.add_method('Install', 'ns3::NetDeviceContainer', - [param('ns3::WifiPhyHelper const &', 'phy'), param('std::string', 'nodeName')], + [param('ns3::WifiPhyHelper const &', 'phy'), param('ns3::WifiMacHelper const &', 'mac'), param('std::string', 'nodeName')], is_const=True) return +def register_Ns3WifiMacHelper_methods(root_module, cls): + ## wifi-helper.h: ns3::WifiMacHelper::WifiMacHelper(ns3::WifiMacHelper const & arg0) [copy constructor] + cls.add_constructor([param('ns3::WifiMacHelper const &', 'arg0')]) + ## wifi-helper.h: ns3::WifiMacHelper::WifiMacHelper() [constructor] + cls.add_constructor([]) + ## wifi-helper.h: ns3::Ptr ns3::WifiMacHelper::Create() const [member function] + cls.add_method('Create', + 'ns3::Ptr< ns3::WifiMac >', + [], + is_pure_virtual=True, is_const=True, is_virtual=True) + return + def register_Ns3WifiPhyHelper_methods(root_module, cls): ## wifi-helper.h: ns3::WifiPhyHelper::WifiPhyHelper(ns3::WifiPhyHelper const & arg0) [copy constructor] cls.add_constructor([param('ns3::WifiPhyHelper const &', 'arg0')]) @@ -1209,6 +1223,31 @@ def register_Ns3YansWifiPhyHelper_methods(root_module, cls): is_const=True, visibility='private', is_virtual=True) return +def register_Ns3NqosWifiMacHelper_methods(root_module, cls): + ## nqos-wifi-mac-helper.h: ns3::NqosWifiMacHelper::NqosWifiMacHelper(ns3::NqosWifiMacHelper const & arg0) [copy constructor] + cls.add_constructor([param('ns3::NqosWifiMacHelper const &', 'arg0')]) + ## nqos-wifi-mac-helper.h: ns3::NqosWifiMacHelper::NqosWifiMacHelper() [constructor] + cls.add_constructor([]) + ## nqos-wifi-mac-helper.h: static ns3::NqosWifiMacHelper ns3::NqosWifiMacHelper::Default() [member function] + cls.add_method('Default', + 'ns3::NqosWifiMacHelper', + [], + is_static=True) + ## nqos-wifi-mac-helper.h: void ns3::NqosWifiMacHelper::SetType(std::string type, std::string n0="", ns3::AttributeValue const & v0=ns3::EmptyAttributeValue(), std::string n1="", ns3::AttributeValue const & v1=ns3::EmptyAttributeValue(), std::string n2="", ns3::AttributeValue const & v2=ns3::EmptyAttributeValue(), std::string n3="", ns3::AttributeValue const & v3=ns3::EmptyAttributeValue(), std::string n4="", ns3::AttributeValue const & v4=ns3::EmptyAttributeValue(), std::string n5="", ns3::AttributeValue const & v5=ns3::EmptyAttributeValue(), std::string n6="", ns3::AttributeValue const & v6=ns3::EmptyAttributeValue(), std::string n7="", ns3::AttributeValue const & v7=ns3::EmptyAttributeValue()) [member function] + cls.add_method('SetType', + 'void', + [param('std::string', 'type'), param('std::string', 'n0', default_value='""'), param('ns3::AttributeValue const &', 'v0', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n1', default_value='""'), param('ns3::AttributeValue const &', 'v1', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n2', default_value='""'), param('ns3::AttributeValue const &', 'v2', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n3', default_value='""'), param('ns3::AttributeValue const &', 'v3', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n4', default_value='""'), param('ns3::AttributeValue const &', 'v4', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n5', default_value='""'), param('ns3::AttributeValue const &', 'v5', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n6', default_value='""'), param('ns3::AttributeValue const &', 'v6', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n7', default_value='""'), param('ns3::AttributeValue const &', 'v7', default_value='ns3::EmptyAttributeValue()')]) + ## nqos-wifi-mac-helper.h: void ns3::NqosWifiMacHelper::SetDcaParameters(std::string n0="", ns3::AttributeValue const & v0=ns3::EmptyAttributeValue(), std::string n1="", ns3::AttributeValue const & v1=ns3::EmptyAttributeValue(), std::string n2="", ns3::AttributeValue const & v2=ns3::EmptyAttributeValue(), std::string n3="", ns3::AttributeValue const & v3=ns3::EmptyAttributeValue()) [member function] + cls.add_method('SetDcaParameters', + 'void', + [param('std::string', 'n0', default_value='""'), param('ns3::AttributeValue const &', 'v0', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n1', default_value='""'), param('ns3::AttributeValue const &', 'v1', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n2', default_value='""'), param('ns3::AttributeValue const &', 'v2', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n3', default_value='""'), param('ns3::AttributeValue const &', 'v3', default_value='ns3::EmptyAttributeValue()')]) + ## nqos-wifi-mac-helper.h: ns3::Ptr ns3::NqosWifiMacHelper::Create() const [member function] + cls.add_method('Create', + 'ns3::Ptr< ns3::WifiMac >', + [], + is_const=True, visibility='private', is_virtual=True) + return + def register_functions(root_module): module = root_module register_functions_ns3_Config(module.get_submodule('Config'), root_module) diff --git a/bindings/python/ns3_module_internet_stack.py b/bindings/python/ns3_module_internet_stack.py index 329cbede6..c29a3992a 100644 --- a/bindings/python/ns3_module_internet_stack.py +++ b/bindings/python/ns3_module_internet_stack.py @@ -95,7 +95,7 @@ def register_Ns3Icmpv4DestinationUnreachable_methods(root_module, cls): 'uint16_t', [], is_const=True) - ## icmpv4.h: void ns3::Icmpv4DestinationUnreachable::SetData(ns3::Ptr data) [member function] + ## icmpv4.h: void ns3::Icmpv4DestinationUnreachable::SetData(ns3::Ptr data) [member function] cls.add_method('SetData', 'void', [param('ns3::Ptr< ns3::Packet const >', 'data')]) @@ -151,7 +151,7 @@ def register_Ns3Icmpv4Echo_methods(root_module, cls): cls.add_method('SetSequenceNumber', 'void', [param('uint16_t', 'seq')]) - ## icmpv4.h: void ns3::Icmpv4Echo::SetData(ns3::Ptr data) [member function] + ## icmpv4.h: void ns3::Icmpv4Echo::SetData(ns3::Ptr data) [member function] cls.add_method('SetData', 'void', [param('ns3::Ptr< ns3::Packet const >', 'data')]) @@ -165,7 +165,7 @@ def register_Ns3Icmpv4Echo_methods(root_module, cls): 'uint16_t', [], is_const=True) - ## icmpv4.h: ns3::Ptr ns3::Icmpv4Echo::GetData() const [member function] + ## icmpv4.h: ns3::Ptr ns3::Icmpv4Echo::GetData() const [member function] cls.add_method('GetData', 'ns3::Ptr< ns3::Packet const >', [], @@ -266,7 +266,7 @@ def register_Ns3Icmpv4Header_methods(root_module, cls): def register_Ns3Icmpv4TimeExceeded_methods(root_module, cls): ## icmpv4.h: ns3::Icmpv4TimeExceeded::Icmpv4TimeExceeded(ns3::Icmpv4TimeExceeded const & arg0) [copy constructor] cls.add_constructor([param('ns3::Icmpv4TimeExceeded const &', 'arg0')]) - ## icmpv4.h: void ns3::Icmpv4TimeExceeded::SetData(ns3::Ptr data) [member function] + ## icmpv4.h: void ns3::Icmpv4TimeExceeded::SetData(ns3::Ptr data) [member function] cls.add_method('SetData', 'void', [param('ns3::Ptr< ns3::Packet const >', 'data')]) diff --git a/bindings/python/ns3_module_node.py b/bindings/python/ns3_module_node.py index 122afc8f7..4f6cd1e5e 100644 --- a/bindings/python/ns3_module_node.py +++ b/bindings/python/ns3_module_node.py @@ -1696,7 +1696,7 @@ def register_Ns3Queue_methods(root_module, cls): cls.add_method('Dequeue', 'ns3::Ptr< ns3::Packet >', []) - ## queue.h: ns3::Ptr ns3::Queue::Peek() const [member function] + ## queue.h: ns3::Ptr ns3::Queue::Peek() const [member function] cls.add_method('Peek', 'ns3::Ptr< ns3::Packet const >', [], @@ -1754,7 +1754,7 @@ def register_Ns3Queue_methods(root_module, cls): 'ns3::Ptr< ns3::Packet >', [], is_pure_virtual=True, visibility='private', is_virtual=True) - ## queue.h: ns3::Ptr ns3::Queue::DoPeek() const [member function] + ## queue.h: ns3::Ptr ns3::Queue::DoPeek() const [member function] cls.add_method('DoPeek', 'ns3::Ptr< ns3::Packet const >', [], @@ -2420,7 +2420,7 @@ def register_Ns3DropTailQueue_methods(root_module, cls): 'ns3::Ptr< ns3::Packet >', [], visibility='private', is_virtual=True) - ## drop-tail-queue.h: ns3::Ptr ns3::DropTailQueue::DoPeek() const [member function] + ## drop-tail-queue.h: ns3::Ptr ns3::DropTailQueue::DoPeek() const [member function] cls.add_method('DoPeek', 'ns3::Ptr< ns3::Packet const >', [], diff --git a/bindings/python/ns3_module_stats.py b/bindings/python/ns3_module_stats.py index 6da736fe1..59532ca76 100644 --- a/bindings/python/ns3_module_stats.py +++ b/bindings/python/ns3_module_stats.py @@ -303,11 +303,11 @@ def register_Ns3PacketSizeMinMaxAvgTotalCalculator_methods(root_module, cls): cls.add_constructor([param('ns3::PacketSizeMinMaxAvgTotalCalculator const &', 'arg0')]) ## packet-data-calculators.h: ns3::PacketSizeMinMaxAvgTotalCalculator::PacketSizeMinMaxAvgTotalCalculator() [constructor] cls.add_constructor([]) - ## packet-data-calculators.h: void ns3::PacketSizeMinMaxAvgTotalCalculator::PacketUpdate(std::string path, ns3::Ptr packet) [member function] + ## packet-data-calculators.h: void ns3::PacketSizeMinMaxAvgTotalCalculator::PacketUpdate(std::string path, ns3::Ptr packet) [member function] cls.add_method('PacketUpdate', 'void', [param('std::string', 'path'), param('ns3::Ptr< ns3::Packet const >', 'packet')]) - ## packet-data-calculators.h: void ns3::PacketSizeMinMaxAvgTotalCalculator::FrameUpdate(std::string path, ns3::Ptr packet, ns3::Mac48Address realto) [member function] + ## packet-data-calculators.h: void ns3::PacketSizeMinMaxAvgTotalCalculator::FrameUpdate(std::string path, ns3::Ptr packet, ns3::Mac48Address realto) [member function] cls.add_method('FrameUpdate', 'void', [param('std::string', 'path'), param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'realto')]) @@ -400,11 +400,11 @@ def register_Ns3PacketCounterCalculator_methods(root_module, cls): cls.add_constructor([param('ns3::PacketCounterCalculator const &', 'arg0')]) ## packet-data-calculators.h: ns3::PacketCounterCalculator::PacketCounterCalculator() [constructor] cls.add_constructor([]) - ## packet-data-calculators.h: void ns3::PacketCounterCalculator::PacketUpdate(std::string path, ns3::Ptr packet) [member function] + ## packet-data-calculators.h: void ns3::PacketCounterCalculator::PacketUpdate(std::string path, ns3::Ptr packet) [member function] cls.add_method('PacketUpdate', 'void', [param('std::string', 'path'), param('ns3::Ptr< ns3::Packet const >', 'packet')]) - ## packet-data-calculators.h: void ns3::PacketCounterCalculator::FrameUpdate(std::string path, ns3::Ptr packet, ns3::Mac48Address realto) [member function] + ## packet-data-calculators.h: void ns3::PacketCounterCalculator::FrameUpdate(std::string path, ns3::Ptr packet, ns3::Mac48Address realto) [member function] cls.add_method('FrameUpdate', 'void', [param('std::string', 'path'), param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'realto')]) diff --git a/bindings/python/ns3_module_tap_bridge.py b/bindings/python/ns3_module_tap_bridge.py index 060f909a6..ba5310e25 100644 --- a/bindings/python/ns3_module_tap_bridge.py +++ b/bindings/python/ns3_module_tap_bridge.py @@ -206,7 +206,7 @@ def register_Ns3TapBridge_methods(root_module, cls): 'void', [], visibility='protected', is_virtual=True) - ## tap-bridge.h: void ns3::TapBridge::ReceiveFromBridgedDevice(ns3::Ptr device, ns3::Ptr packet, uint16_t protocol, ns3::Address const & src, ns3::Address const & dst, ns3::NetDevice::PacketType packetType) [member function] + ## tap-bridge.h: void ns3::TapBridge::ReceiveFromBridgedDevice(ns3::Ptr device, ns3::Ptr packet, uint16_t protocol, ns3::Address const & src, ns3::Address const & dst, ns3::NetDevice::PacketType packetType) [member function] cls.add_method('ReceiveFromBridgedDevice', 'void', [param('ns3::Ptr< ns3::NetDevice >', 'device'), param('ns3::Ptr< ns3::Packet const >', 'packet'), param('uint16_t', 'protocol'), param('ns3::Address const &', 'src'), param('ns3::Address const &', 'dst'), param('ns3::NetDevice::PacketType', 'packetType')], diff --git a/bindings/python/ns3_module_wifi.py b/bindings/python/ns3_module_wifi.py index 4d9546dd0..78870a202 100644 --- a/bindings/python/ns3_module_wifi.py +++ b/bindings/python/ns3_module_wifi.py @@ -3,6 +3,8 @@ from pybindgen import Module, FileCodeSink, param, retval, cppclass def register_types(module): root_module = module.get_root() + ## wifi-mac-header.h: ns3::WifiMacType [enumeration] + module.add_enum('WifiMacType', ['WIFI_MAC_CTL_RTS', 'WIFI_MAC_CTL_CTS', 'WIFI_MAC_CTL_ACK', 'WIFI_MAC_CTL_BACKREQ', 'WIFI_MAC_CTL_BACKRESP', 'WIFI_MAC_MGT_BEACON', 'WIFI_MAC_MGT_ASSOCIATION_REQUEST', 'WIFI_MAC_MGT_ASSOCIATION_RESPONSE', 'WIFI_MAC_MGT_DISASSOCIATION', 'WIFI_MAC_MGT_REASSOCIATION_REQUEST', 'WIFI_MAC_MGT_REASSOCIATION_RESPONSE', 'WIFI_MAC_MGT_PROBE_REQUEST', 'WIFI_MAC_MGT_PROBE_RESPONSE', 'WIFI_MAC_MGT_AUTHENTICATION', 'WIFI_MAC_MGT_DEAUTHENTICATION', 'WIFI_MAC_DATA', 'WIFI_MAC_DATA_CFACK', 'WIFI_MAC_DATA_CFPOLL', 'WIFI_MAC_DATA_CFACK_CFPOLL', 'WIFI_MAC_DATA_NULL', 'WIFI_MAC_DATA_NULL_CFACK', 'WIFI_MAC_DATA_NULL_CFPOLL', 'WIFI_MAC_DATA_NULL_CFACK_CFPOLL', 'WIFI_MAC_QOSDATA', 'WIFI_MAC_QOSDATA_CFACK', 'WIFI_MAC_QOSDATA_CFPOLL', 'WIFI_MAC_QOSDATA_CFACK_CFPOLL', 'WIFI_MAC_QOSDATA_NULL', 'WIFI_MAC_QOSDATA_NULL_CFPOLL', 'WIFI_MAC_QOSDATA_NULL_CFACK_CFPOLL']) ## wifi-preamble.h: ns3::WifiPreamble [enumeration] module.add_enum('WifiPreamble', ['WIFI_PREAMBLE_LONG', 'WIFI_PREAMBLE_SHORT']) ## wifi-phy-standard.h: ns3::WifiPhyStandard [enumeration] @@ -55,6 +57,12 @@ def register_types(module): module.add_class('ThreeLogDistancePropagationLossModel', parent=root_module['ns3::PropagationLossModel']) ## wifi-mac.h: ns3::WifiMac [class] module.add_class('WifiMac', parent=root_module['ns3::Object']) + ## wifi-mac-header.h: ns3::WifiMacHeader [class] + module.add_class('WifiMacHeader', parent=root_module['ns3::Header']) + ## wifi-mac-header.h: ns3::WifiMacHeader::QosAckPolicy [enumeration] + module.add_enum('QosAckPolicy', ['NORMAL_ACK', 'NO_ACK', 'NO_EXPLICIT_ACK', 'BLOCK_ACK'], outer_class=root_module['ns3::WifiMacHeader']) + ## wifi-mac-header.h: ns3::WifiMacHeader::AddressType [enumeration] + module.add_enum('AddressType', ['ADDR1', 'ADDR2', 'ADDR3', 'ADDR4'], outer_class=root_module['ns3::WifiMacHeader']) ## wifi-mode.h: ns3::WifiModeChecker [class] module.add_class('WifiModeChecker', parent=root_module['ns3::AttributeChecker']) ## wifi-mode.h: ns3::WifiModeValue [class] @@ -79,6 +87,8 @@ def register_types(module): module.add_class('ConstantRateWifiManager', parent=root_module['ns3::WifiRemoteStationManager']) ## propagation-delay-model.h: ns3::ConstantSpeedPropagationDelayModel [class] module.add_class('ConstantSpeedPropagationDelayModel', parent=root_module['ns3::PropagationDelayModel']) + ## dca-txop.h: ns3::DcaTxop [class] + module.add_class('DcaTxop', parent=root_module['ns3::Object']) ## error-rate-model.h: ns3::ErrorRateModel [class] module.add_class('ErrorRateModel', parent=root_module['ns3::Object']) ## propagation-loss-model.h: ns3::FriisPropagationLossModel [class] @@ -172,6 +182,7 @@ def register_methods(root_module): register_Ns3SsidValue_methods(root_module, root_module['ns3::SsidValue']) register_Ns3ThreeLogDistancePropagationLossModel_methods(root_module, root_module['ns3::ThreeLogDistancePropagationLossModel']) register_Ns3WifiMac_methods(root_module, root_module['ns3::WifiMac']) + register_Ns3WifiMacHeader_methods(root_module, root_module['ns3::WifiMacHeader']) register_Ns3WifiModeChecker_methods(root_module, root_module['ns3::WifiModeChecker']) register_Ns3WifiModeValue_methods(root_module, root_module['ns3::WifiModeValue']) register_Ns3WifiPhy_methods(root_module, root_module['ns3::WifiPhy']) @@ -183,6 +194,7 @@ def register_methods(root_module): register_Ns3ArfWifiManager_methods(root_module, root_module['ns3::ArfWifiManager']) register_Ns3ConstantRateWifiManager_methods(root_module, root_module['ns3::ConstantRateWifiManager']) register_Ns3ConstantSpeedPropagationDelayModel_methods(root_module, root_module['ns3::ConstantSpeedPropagationDelayModel']) + register_Ns3DcaTxop_methods(root_module, root_module['ns3::DcaTxop']) register_Ns3ErrorRateModel_methods(root_module, root_module['ns3::ErrorRateModel']) register_Ns3FriisPropagationLossModel_methods(root_module, root_module['ns3::FriisPropagationLossModel']) register_Ns3IdealWifiManager_methods(root_module, root_module['ns3::IdealWifiManager']) @@ -522,15 +534,15 @@ def register_Ns3WifiRemoteStation_methods(root_module, cls): cls.add_method('RecordDisassociated', 'void', []) - ## wifi-remote-station-manager.h: void ns3::WifiRemoteStation::PrepareForQueue(ns3::Ptr packet, uint32_t fullPacketSize) [member function] + ## wifi-remote-station-manager.h: void ns3::WifiRemoteStation::PrepareForQueue(ns3::Ptr packet, uint32_t fullPacketSize) [member function] cls.add_method('PrepareForQueue', 'void', [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('uint32_t', 'fullPacketSize')]) - ## wifi-remote-station-manager.h: ns3::WifiMode ns3::WifiRemoteStation::GetDataMode(ns3::Ptr packet, uint32_t fullPacketSize) [member function] + ## wifi-remote-station-manager.h: ns3::WifiMode ns3::WifiRemoteStation::GetDataMode(ns3::Ptr packet, uint32_t fullPacketSize) [member function] cls.add_method('GetDataMode', 'ns3::WifiMode', [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('uint32_t', 'fullPacketSize')]) - ## wifi-remote-station-manager.h: ns3::WifiMode ns3::WifiRemoteStation::GetRtsMode(ns3::Ptr packet) [member function] + ## wifi-remote-station-manager.h: ns3::WifiMode ns3::WifiRemoteStation::GetRtsMode(ns3::Ptr packet) [member function] cls.add_method('GetRtsMode', 'ns3::WifiMode', [param('ns3::Ptr< ns3::Packet const >', 'packet')]) @@ -562,37 +574,37 @@ def register_Ns3WifiRemoteStation_methods(root_module, cls): cls.add_method('ReportRxOk', 'void', [param('double', 'rxSnr'), param('ns3::WifiMode', 'txMode')]) - ## wifi-remote-station-manager.h: bool ns3::WifiRemoteStation::NeedRts(ns3::Ptr packet) [member function] + ## wifi-remote-station-manager.h: bool ns3::WifiRemoteStation::NeedRts(ns3::Ptr packet) [member function] cls.add_method('NeedRts', 'bool', [param('ns3::Ptr< ns3::Packet const >', 'packet')], is_virtual=True) - ## wifi-remote-station-manager.h: bool ns3::WifiRemoteStation::NeedRtsRetransmission(ns3::Ptr packet) [member function] + ## wifi-remote-station-manager.h: bool ns3::WifiRemoteStation::NeedRtsRetransmission(ns3::Ptr packet) [member function] cls.add_method('NeedRtsRetransmission', 'bool', [param('ns3::Ptr< ns3::Packet const >', 'packet')], is_virtual=True) - ## wifi-remote-station-manager.h: bool ns3::WifiRemoteStation::NeedDataRetransmission(ns3::Ptr packet) [member function] + ## wifi-remote-station-manager.h: bool ns3::WifiRemoteStation::NeedDataRetransmission(ns3::Ptr packet) [member function] cls.add_method('NeedDataRetransmission', 'bool', [param('ns3::Ptr< ns3::Packet const >', 'packet')], is_virtual=True) - ## wifi-remote-station-manager.h: bool ns3::WifiRemoteStation::NeedFragmentation(ns3::Ptr packet) [member function] + ## wifi-remote-station-manager.h: bool ns3::WifiRemoteStation::NeedFragmentation(ns3::Ptr packet) [member function] cls.add_method('NeedFragmentation', 'bool', [param('ns3::Ptr< ns3::Packet const >', 'packet')], is_virtual=True) - ## wifi-remote-station-manager.h: uint32_t ns3::WifiRemoteStation::GetFragmentSize(ns3::Ptr packet, uint32_t fragmentNumber) [member function] + ## wifi-remote-station-manager.h: uint32_t ns3::WifiRemoteStation::GetFragmentSize(ns3::Ptr packet, uint32_t fragmentNumber) [member function] cls.add_method('GetFragmentSize', 'uint32_t', [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('uint32_t', 'fragmentNumber')], is_virtual=True) - ## wifi-remote-station-manager.h: uint32_t ns3::WifiRemoteStation::GetFragmentOffset(ns3::Ptr packet, uint32_t fragmentNumber) [member function] + ## wifi-remote-station-manager.h: uint32_t ns3::WifiRemoteStation::GetFragmentOffset(ns3::Ptr packet, uint32_t fragmentNumber) [member function] cls.add_method('GetFragmentOffset', 'uint32_t', [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('uint32_t', 'fragmentNumber')], is_virtual=True) - ## wifi-remote-station-manager.h: bool ns3::WifiRemoteStation::IsLastFragment(ns3::Ptr packet, uint32_t fragmentNumber) [member function] + ## wifi-remote-station-manager.h: bool ns3::WifiRemoteStation::IsLastFragment(ns3::Ptr packet, uint32_t fragmentNumber) [member function] cls.add_method('IsLastFragment', 'bool', [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('uint32_t', 'fragmentNumber')], @@ -1070,7 +1082,7 @@ def register_Ns3RraaWifiRemoteStation_methods(root_module, cls): cls.add_constructor([param('ns3::RraaWifiRemoteStation const &', 'arg0')]) ## rraa-wifi-manager.h: ns3::RraaWifiRemoteStation::RraaWifiRemoteStation(ns3::Ptr stations) [constructor] cls.add_constructor([param('ns3::Ptr< ns3::RraaWifiManager >', 'stations')]) - ## rraa-wifi-manager.h: bool ns3::RraaWifiRemoteStation::NeedRts(ns3::Ptr packet) [member function] + ## rraa-wifi-manager.h: bool ns3::RraaWifiRemoteStation::NeedRts(ns3::Ptr packet) [member function] cls.add_method('NeedRts', 'bool', [param('ns3::Ptr< ns3::Packet const >', 'packet')], @@ -1296,12 +1308,12 @@ def register_Ns3WifiMac_methods(root_module, cls): 'ns3::Mac48Address', [], is_pure_virtual=True, is_const=True, is_virtual=True) - ## wifi-mac.h: void ns3::WifiMac::Enqueue(ns3::Ptr packet, ns3::Mac48Address to, ns3::Mac48Address from) [member function] + ## wifi-mac.h: void ns3::WifiMac::Enqueue(ns3::Ptr packet, ns3::Mac48Address to, ns3::Mac48Address from) [member function] cls.add_method('Enqueue', 'void', [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to'), param('ns3::Mac48Address', 'from')], is_pure_virtual=True, is_virtual=True) - ## wifi-mac.h: void ns3::WifiMac::Enqueue(ns3::Ptr packet, ns3::Mac48Address to) [member function] + ## wifi-mac.h: void ns3::WifiMac::Enqueue(ns3::Ptr packet, ns3::Mac48Address to) [member function] cls.add_method('Enqueue', 'void', [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to')], @@ -1336,28 +1348,399 @@ def register_Ns3WifiMac_methods(root_module, cls): 'void', [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'linkDown')], is_pure_virtual=True, is_virtual=True) - ## wifi-mac.h: void ns3::WifiMac::NotifyTx(ns3::Ptr packet) [member function] + ## wifi-mac.h: void ns3::WifiMac::NotifyTx(ns3::Ptr packet) [member function] cls.add_method('NotifyTx', 'void', [param('ns3::Ptr< ns3::Packet const >', 'packet')]) - ## wifi-mac.h: void ns3::WifiMac::NotifyTxDrop(ns3::Ptr packet) [member function] + ## wifi-mac.h: void ns3::WifiMac::NotifyTxDrop(ns3::Ptr packet) [member function] cls.add_method('NotifyTxDrop', 'void', [param('ns3::Ptr< ns3::Packet const >', 'packet')]) - ## wifi-mac.h: void ns3::WifiMac::NotifyRx(ns3::Ptr packet) [member function] + ## wifi-mac.h: void ns3::WifiMac::NotifyRx(ns3::Ptr packet) [member function] cls.add_method('NotifyRx', 'void', [param('ns3::Ptr< ns3::Packet const >', 'packet')]) - ## wifi-mac.h: void ns3::WifiMac::NotifyPromiscRx(ns3::Ptr packet) [member function] + ## wifi-mac.h: void ns3::WifiMac::NotifyPromiscRx(ns3::Ptr packet) [member function] cls.add_method('NotifyPromiscRx', 'void', [param('ns3::Ptr< ns3::Packet const >', 'packet')]) - ## wifi-mac.h: void ns3::WifiMac::NotifyRxDrop(ns3::Ptr packet) [member function] + ## wifi-mac.h: void ns3::WifiMac::NotifyRxDrop(ns3::Ptr packet) [member function] cls.add_method('NotifyRxDrop', 'void', [param('ns3::Ptr< ns3::Packet const >', 'packet')]) return +def register_Ns3WifiMacHeader_methods(root_module, cls): + ## wifi-mac-header.h: ns3::WifiMacHeader::WifiMacHeader(ns3::WifiMacHeader const & arg0) [copy constructor] + cls.add_constructor([param('ns3::WifiMacHeader const &', 'arg0')]) + ## wifi-mac-header.h: ns3::WifiMacHeader::WifiMacHeader() [constructor] + cls.add_constructor([]) + ## wifi-mac-header.h: static ns3::TypeId ns3::WifiMacHeader::GetTypeId() [member function] + cls.add_method('GetTypeId', + 'ns3::TypeId', + [], + is_static=True) + ## wifi-mac-header.h: ns3::TypeId ns3::WifiMacHeader::GetInstanceTypeId() const [member function] + cls.add_method('GetInstanceTypeId', + 'ns3::TypeId', + [], + is_const=True, is_virtual=True) + ## wifi-mac-header.h: void ns3::WifiMacHeader::Print(std::ostream & os) const [member function] + cls.add_method('Print', + 'void', + [param('std::ostream &', 'os')], + is_const=True, is_virtual=True) + ## wifi-mac-header.h: uint32_t ns3::WifiMacHeader::GetSerializedSize() const [member function] + cls.add_method('GetSerializedSize', + 'uint32_t', + [], + is_const=True, is_virtual=True) + ## wifi-mac-header.h: void ns3::WifiMacHeader::Serialize(ns3::Buffer::Iterator start) const [member function] + cls.add_method('Serialize', + 'void', + [param('ns3::Buffer::Iterator', 'start')], + is_const=True, is_virtual=True) + ## wifi-mac-header.h: uint32_t ns3::WifiMacHeader::Deserialize(ns3::Buffer::Iterator start) [member function] + cls.add_method('Deserialize', + 'uint32_t', + [param('ns3::Buffer::Iterator', 'start')], + is_virtual=True) + ## wifi-mac-header.h: void ns3::WifiMacHeader::SetAssocReq() [member function] + cls.add_method('SetAssocReq', + 'void', + []) + ## wifi-mac-header.h: void ns3::WifiMacHeader::SetAssocResp() [member function] + cls.add_method('SetAssocResp', + 'void', + []) + ## wifi-mac-header.h: void ns3::WifiMacHeader::SetProbeReq() [member function] + cls.add_method('SetProbeReq', + 'void', + []) + ## wifi-mac-header.h: void ns3::WifiMacHeader::SetProbeResp() [member function] + cls.add_method('SetProbeResp', + 'void', + []) + ## wifi-mac-header.h: void ns3::WifiMacHeader::SetBeacon() [member function] + cls.add_method('SetBeacon', + 'void', + []) + ## wifi-mac-header.h: void ns3::WifiMacHeader::SetTypeData() [member function] + cls.add_method('SetTypeData', + 'void', + []) + ## wifi-mac-header.h: void ns3::WifiMacHeader::SetDsFrom() [member function] + cls.add_method('SetDsFrom', + 'void', + []) + ## wifi-mac-header.h: void ns3::WifiMacHeader::SetDsNotFrom() [member function] + cls.add_method('SetDsNotFrom', + 'void', + []) + ## wifi-mac-header.h: void ns3::WifiMacHeader::SetDsTo() [member function] + cls.add_method('SetDsTo', + 'void', + []) + ## wifi-mac-header.h: void ns3::WifiMacHeader::SetDsNotTo() [member function] + cls.add_method('SetDsNotTo', + 'void', + []) + ## wifi-mac-header.h: void ns3::WifiMacHeader::SetAddr1(ns3::Mac48Address address) [member function] + cls.add_method('SetAddr1', + 'void', + [param('ns3::Mac48Address', 'address')]) + ## wifi-mac-header.h: void ns3::WifiMacHeader::SetAddr2(ns3::Mac48Address address) [member function] + cls.add_method('SetAddr2', + 'void', + [param('ns3::Mac48Address', 'address')]) + ## wifi-mac-header.h: void ns3::WifiMacHeader::SetAddr3(ns3::Mac48Address address) [member function] + cls.add_method('SetAddr3', + 'void', + [param('ns3::Mac48Address', 'address')]) + ## wifi-mac-header.h: void ns3::WifiMacHeader::SetAddr4(ns3::Mac48Address address) [member function] + cls.add_method('SetAddr4', + 'void', + [param('ns3::Mac48Address', 'address')]) + ## wifi-mac-header.h: void ns3::WifiMacHeader::SetType(ns3::WifiMacType type) [member function] + cls.add_method('SetType', + 'void', + [param('ns3::WifiMacType', 'type')]) + ## wifi-mac-header.h: void ns3::WifiMacHeader::SetRawDuration(uint16_t duration) [member function] + cls.add_method('SetRawDuration', + 'void', + [param('uint16_t', 'duration')]) + ## wifi-mac-header.h: void ns3::WifiMacHeader::SetDuration(ns3::Time duration) [member function] + cls.add_method('SetDuration', + 'void', + [param('ns3::Time', 'duration')]) + ## wifi-mac-header.h: void ns3::WifiMacHeader::SetId(uint16_t id) [member function] + cls.add_method('SetId', + 'void', + [param('uint16_t', 'id')]) + ## wifi-mac-header.h: void ns3::WifiMacHeader::SetSequenceNumber(uint16_t seq) [member function] + cls.add_method('SetSequenceNumber', + 'void', + [param('uint16_t', 'seq')]) + ## wifi-mac-header.h: void ns3::WifiMacHeader::SetFragmentNumber(uint8_t frag) [member function] + cls.add_method('SetFragmentNumber', + 'void', + [param('uint8_t', 'frag')]) + ## wifi-mac-header.h: void ns3::WifiMacHeader::SetNoMoreFragments() [member function] + cls.add_method('SetNoMoreFragments', + 'void', + []) + ## wifi-mac-header.h: void ns3::WifiMacHeader::SetMoreFragments() [member function] + cls.add_method('SetMoreFragments', + 'void', + []) + ## wifi-mac-header.h: void ns3::WifiMacHeader::SetRetry() [member function] + cls.add_method('SetRetry', + 'void', + []) + ## wifi-mac-header.h: void ns3::WifiMacHeader::SetNoRetry() [member function] + cls.add_method('SetNoRetry', + 'void', + []) + ## wifi-mac-header.h: void ns3::WifiMacHeader::SetQosTid(uint8_t tid) [member function] + cls.add_method('SetQosTid', + 'void', + [param('uint8_t', 'tid')]) + ## wifi-mac-header.h: void ns3::WifiMacHeader::SetQosEosp() [member function] + cls.add_method('SetQosEosp', + 'void', + []) + ## wifi-mac-header.h: void ns3::WifiMacHeader::SetQosNoEosp() [member function] + cls.add_method('SetQosNoEosp', + 'void', + []) + ## wifi-mac-header.h: void ns3::WifiMacHeader::SetQosAckPolicy(ns3::WifiMacHeader::QosAckPolicy arg0) [member function] + cls.add_method('SetQosAckPolicy', + 'void', + [param('ns3::WifiMacHeader::QosAckPolicy', 'arg0')]) + ## wifi-mac-header.h: void ns3::WifiMacHeader::SetQosAmsdu() [member function] + cls.add_method('SetQosAmsdu', + 'void', + []) + ## wifi-mac-header.h: void ns3::WifiMacHeader::SetQosNoAmsdu() [member function] + cls.add_method('SetQosNoAmsdu', + 'void', + []) + ## wifi-mac-header.h: void ns3::WifiMacHeader::SetQosTxopLimit(uint8_t txop) [member function] + cls.add_method('SetQosTxopLimit', + 'void', + [param('uint8_t', 'txop')]) + ## wifi-mac-header.h: ns3::Mac48Address ns3::WifiMacHeader::GetAddr1() const [member function] + cls.add_method('GetAddr1', + 'ns3::Mac48Address', + [], + is_const=True) + ## wifi-mac-header.h: ns3::Mac48Address ns3::WifiMacHeader::GetAddr2() const [member function] + cls.add_method('GetAddr2', + 'ns3::Mac48Address', + [], + is_const=True) + ## wifi-mac-header.h: ns3::Mac48Address ns3::WifiMacHeader::GetAddr3() const [member function] + cls.add_method('GetAddr3', + 'ns3::Mac48Address', + [], + is_const=True) + ## wifi-mac-header.h: ns3::Mac48Address ns3::WifiMacHeader::GetAddr4() const [member function] + cls.add_method('GetAddr4', + 'ns3::Mac48Address', + [], + is_const=True) + ## wifi-mac-header.h: ns3::WifiMacType ns3::WifiMacHeader::GetType() const [member function] + cls.add_method('GetType', + 'ns3::WifiMacType', + [], + is_const=True) + ## wifi-mac-header.h: bool ns3::WifiMacHeader::IsFromDs() const [member function] + cls.add_method('IsFromDs', + 'bool', + [], + is_const=True) + ## wifi-mac-header.h: bool ns3::WifiMacHeader::IsToDs() const [member function] + cls.add_method('IsToDs', + 'bool', + [], + is_const=True) + ## wifi-mac-header.h: bool ns3::WifiMacHeader::IsData() const [member function] + cls.add_method('IsData', + 'bool', + [], + is_const=True) + ## wifi-mac-header.h: bool ns3::WifiMacHeader::IsQosData() const [member function] + cls.add_method('IsQosData', + 'bool', + [], + is_const=True) + ## wifi-mac-header.h: bool ns3::WifiMacHeader::IsCtl() const [member function] + cls.add_method('IsCtl', + 'bool', + [], + is_const=True) + ## wifi-mac-header.h: bool ns3::WifiMacHeader::IsMgt() const [member function] + cls.add_method('IsMgt', + 'bool', + [], + is_const=True) + ## wifi-mac-header.h: bool ns3::WifiMacHeader::IsCfpoll() const [member function] + cls.add_method('IsCfpoll', + 'bool', + [], + is_const=True) + ## wifi-mac-header.h: bool ns3::WifiMacHeader::IsRts() const [member function] + cls.add_method('IsRts', + 'bool', + [], + is_const=True) + ## wifi-mac-header.h: bool ns3::WifiMacHeader::IsCts() const [member function] + cls.add_method('IsCts', + 'bool', + [], + is_const=True) + ## wifi-mac-header.h: bool ns3::WifiMacHeader::IsAck() const [member function] + cls.add_method('IsAck', + 'bool', + [], + is_const=True) + ## wifi-mac-header.h: bool ns3::WifiMacHeader::IsAssocReq() const [member function] + cls.add_method('IsAssocReq', + 'bool', + [], + is_const=True) + ## wifi-mac-header.h: bool ns3::WifiMacHeader::IsAssocResp() const [member function] + cls.add_method('IsAssocResp', + 'bool', + [], + is_const=True) + ## wifi-mac-header.h: bool ns3::WifiMacHeader::IsReassocReq() const [member function] + cls.add_method('IsReassocReq', + 'bool', + [], + is_const=True) + ## wifi-mac-header.h: bool ns3::WifiMacHeader::IsReassocResp() const [member function] + cls.add_method('IsReassocResp', + 'bool', + [], + is_const=True) + ## wifi-mac-header.h: bool ns3::WifiMacHeader::IsProbeReq() const [member function] + cls.add_method('IsProbeReq', + 'bool', + [], + is_const=True) + ## wifi-mac-header.h: bool ns3::WifiMacHeader::IsProbeResp() const [member function] + cls.add_method('IsProbeResp', + 'bool', + [], + is_const=True) + ## wifi-mac-header.h: bool ns3::WifiMacHeader::IsBeacon() const [member function] + cls.add_method('IsBeacon', + 'bool', + [], + is_const=True) + ## wifi-mac-header.h: bool ns3::WifiMacHeader::IsDisassociation() const [member function] + cls.add_method('IsDisassociation', + 'bool', + [], + is_const=True) + ## wifi-mac-header.h: bool ns3::WifiMacHeader::IsAuthentication() const [member function] + cls.add_method('IsAuthentication', + 'bool', + [], + is_const=True) + ## wifi-mac-header.h: bool ns3::WifiMacHeader::IsDeauthentication() const [member function] + cls.add_method('IsDeauthentication', + 'bool', + [], + is_const=True) + ## wifi-mac-header.h: uint16_t ns3::WifiMacHeader::GetRawDuration() const [member function] + cls.add_method('GetRawDuration', + 'uint16_t', + [], + is_const=True) + ## wifi-mac-header.h: ns3::Time ns3::WifiMacHeader::GetDuration() const [member function] + cls.add_method('GetDuration', + 'ns3::Time', + [], + is_const=True) + ## wifi-mac-header.h: uint16_t ns3::WifiMacHeader::GetSequenceControl() const [member function] + cls.add_method('GetSequenceControl', + 'uint16_t', + [], + is_const=True) + ## wifi-mac-header.h: uint16_t ns3::WifiMacHeader::GetSequenceNumber() const [member function] + cls.add_method('GetSequenceNumber', + 'uint16_t', + [], + is_const=True) + ## wifi-mac-header.h: uint16_t ns3::WifiMacHeader::GetFragmentNumber() const [member function] + cls.add_method('GetFragmentNumber', + 'uint16_t', + [], + is_const=True) + ## wifi-mac-header.h: bool ns3::WifiMacHeader::IsRetry() const [member function] + cls.add_method('IsRetry', + 'bool', + [], + is_const=True) + ## wifi-mac-header.h: bool ns3::WifiMacHeader::IsMoreFragments() const [member function] + cls.add_method('IsMoreFragments', + 'bool', + [], + is_const=True) + ## wifi-mac-header.h: bool ns3::WifiMacHeader::IsQosBlockAck() const [member function] + cls.add_method('IsQosBlockAck', + 'bool', + [], + is_const=True) + ## wifi-mac-header.h: bool ns3::WifiMacHeader::IsQosNoAck() const [member function] + cls.add_method('IsQosNoAck', + 'bool', + [], + is_const=True) + ## wifi-mac-header.h: bool ns3::WifiMacHeader::IsQosAck() const [member function] + cls.add_method('IsQosAck', + 'bool', + [], + is_const=True) + ## wifi-mac-header.h: bool ns3::WifiMacHeader::IsQosEosp() const [member function] + cls.add_method('IsQosEosp', + 'bool', + [], + is_const=True) + ## wifi-mac-header.h: bool ns3::WifiMacHeader::IsQosAmsdu() const [member function] + cls.add_method('IsQosAmsdu', + 'bool', + [], + is_const=True) + ## wifi-mac-header.h: uint8_t ns3::WifiMacHeader::GetQosTid() const [member function] + cls.add_method('GetQosTid', + 'uint8_t', + [], + is_const=True) + ## wifi-mac-header.h: ns3::WifiMacHeader::QosAckPolicy ns3::WifiMacHeader::GetQosAckPolicy() const [member function] + cls.add_method('GetQosAckPolicy', + 'ns3::WifiMacHeader::QosAckPolicy', + [], + is_const=True) + ## wifi-mac-header.h: uint8_t ns3::WifiMacHeader::GetQosTxopLimit() const [member function] + cls.add_method('GetQosTxopLimit', + 'uint8_t', + [], + is_const=True) + ## wifi-mac-header.h: uint32_t ns3::WifiMacHeader::GetSize() const [member function] + cls.add_method('GetSize', + 'uint32_t', + [], + is_const=True) + ## wifi-mac-header.h: char const * ns3::WifiMacHeader::GetTypeString() const [member function] + cls.add_method('GetTypeString', + 'char const *', + [], + is_const=True) + return + def register_Ns3WifiModeChecker_methods(root_module, cls): ## wifi-mode.h: ns3::WifiModeChecker::WifiModeChecker(ns3::WifiModeChecker const & arg0) [copy constructor] cls.add_constructor([param('ns3::WifiModeChecker const &', 'arg0')]) @@ -1433,7 +1816,7 @@ def register_Ns3WifiPhy_methods(root_module, cls): 'void', [param('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, double, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')], is_pure_virtual=True, is_virtual=True) - ## wifi-phy.h: void ns3::WifiPhy::SendPacket(ns3::Ptr packet, ns3::WifiMode mode, ns3::WifiPreamble preamble, uint8_t txPowerLevel) [member function] + ## wifi-phy.h: void ns3::WifiPhy::SendPacket(ns3::Ptr packet, ns3::WifiMode mode, ns3::WifiPreamble preamble, uint8_t txPowerLevel) [member function] cls.add_method('SendPacket', 'void', [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::WifiMode', 'mode'), param('ns3::WifiPreamble', 'preamble'), param('uint8_t', 'txPowerLevel')], @@ -1548,31 +1931,31 @@ def register_Ns3WifiPhy_methods(root_module, cls): 'ns3::WifiMode', [], is_static=True) - ## wifi-phy.h: void ns3::WifiPhy::NotifyTxBegin(ns3::Ptr packet) [member function] + ## wifi-phy.h: void ns3::WifiPhy::NotifyTxBegin(ns3::Ptr packet) [member function] cls.add_method('NotifyTxBegin', 'void', [param('ns3::Ptr< ns3::Packet const >', 'packet')]) - ## wifi-phy.h: void ns3::WifiPhy::NotifyTxEnd(ns3::Ptr packet) [member function] + ## wifi-phy.h: void ns3::WifiPhy::NotifyTxEnd(ns3::Ptr packet) [member function] cls.add_method('NotifyTxEnd', 'void', [param('ns3::Ptr< ns3::Packet const >', 'packet')]) - ## wifi-phy.h: void ns3::WifiPhy::NotifyTxDrop(ns3::Ptr packet) [member function] + ## wifi-phy.h: void ns3::WifiPhy::NotifyTxDrop(ns3::Ptr packet) [member function] cls.add_method('NotifyTxDrop', 'void', [param('ns3::Ptr< ns3::Packet const >', 'packet')]) - ## wifi-phy.h: void ns3::WifiPhy::NotifyRxBegin(ns3::Ptr packet) [member function] + ## wifi-phy.h: void ns3::WifiPhy::NotifyRxBegin(ns3::Ptr packet) [member function] cls.add_method('NotifyRxBegin', 'void', [param('ns3::Ptr< ns3::Packet const >', 'packet')]) - ## wifi-phy.h: void ns3::WifiPhy::NotifyRxEnd(ns3::Ptr packet) [member function] + ## wifi-phy.h: void ns3::WifiPhy::NotifyRxEnd(ns3::Ptr packet) [member function] cls.add_method('NotifyRxEnd', 'void', [param('ns3::Ptr< ns3::Packet const >', 'packet')]) - ## wifi-phy.h: void ns3::WifiPhy::NotifyRxDrop(ns3::Ptr packet) [member function] + ## wifi-phy.h: void ns3::WifiPhy::NotifyRxDrop(ns3::Ptr packet) [member function] cls.add_method('NotifyRxDrop', 'void', [param('ns3::Ptr< ns3::Packet const >', 'packet')]) - ## wifi-phy.h: void ns3::WifiPhy::NotifyPromiscSniff(ns3::Ptr packet) [member function] + ## wifi-phy.h: void ns3::WifiPhy::NotifyPromiscSniff(ns3::Ptr packet) [member function] cls.add_method('NotifyPromiscSniff', 'void', [param('ns3::Ptr< ns3::Packet const >', 'packet')]) @@ -1820,7 +2203,7 @@ def register_Ns3YansWifiPhy_methods(root_module, cls): 'void', [param('ns3::Callback< void, ns3::Ptr< ns3::Packet const >, double, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')], is_virtual=True) - ## yans-wifi-phy.h: void ns3::YansWifiPhy::SendPacket(ns3::Ptr packet, ns3::WifiMode mode, ns3::WifiPreamble preamble, uint8_t txPowerLevel) [member function] + ## yans-wifi-phy.h: void ns3::YansWifiPhy::SendPacket(ns3::Ptr packet, ns3::WifiMode mode, ns3::WifiPreamble preamble, uint8_t txPowerLevel) [member function] cls.add_method('SendPacket', 'void', [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::WifiMode', 'mode'), param('ns3::WifiPreamble', 'preamble'), param('uint8_t', 'txPowerLevel')], @@ -2002,12 +2385,12 @@ def register_Ns3AdhocWifiMac_methods(root_module, cls): 'void', [param('ns3::Ptr< ns3::WifiRemoteStationManager >', 'stationManager')], is_virtual=True) - ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::Enqueue(ns3::Ptr packet, ns3::Mac48Address to, ns3::Mac48Address from) [member function] + ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::Enqueue(ns3::Ptr packet, ns3::Mac48Address to, ns3::Mac48Address from) [member function] cls.add_method('Enqueue', 'void', [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to'), param('ns3::Mac48Address', 'from')], is_virtual=True) - ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::Enqueue(ns3::Ptr packet, ns3::Mac48Address to) [member function] + ## adhoc-wifi-mac.h: void ns3::AdhocWifiMac::Enqueue(ns3::Ptr packet, ns3::Mac48Address to) [member function] cls.add_method('Enqueue', 'void', [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to')], @@ -2151,6 +2534,80 @@ def register_Ns3ConstantSpeedPropagationDelayModel_methods(root_module, cls): is_const=True) return +def register_Ns3DcaTxop_methods(root_module, cls): + ## dca-txop.h: static ns3::TypeId ns3::DcaTxop::GetTypeId() [member function] + cls.add_method('GetTypeId', + 'ns3::TypeId', + [], + is_static=True) + ## dca-txop.h: ns3::DcaTxop::DcaTxop() [constructor] + cls.add_constructor([]) + ## dca-txop.h: void ns3::DcaTxop::SetLow(ns3::Ptr low) [member function] + cls.add_method('SetLow', + 'void', + [param('ns3::Ptr< ns3::MacLow >', 'low')]) + ## dca-txop.h: void ns3::DcaTxop::SetManager(ns3::DcfManager * manager) [member function] + cls.add_method('SetManager', + 'void', + [param('ns3::DcfManager *', 'manager')]) + ## dca-txop.h: void ns3::DcaTxop::SetWifiRemoteStationManager(ns3::Ptr remoteManager) [member function] + cls.add_method('SetWifiRemoteStationManager', + 'void', + [param('ns3::Ptr< ns3::WifiRemoteStationManager >', 'remoteManager')]) + ## dca-txop.h: void ns3::DcaTxop::SetTxOkCallback(ns3::Callback callback) [member function] + cls.add_method('SetTxOkCallback', + 'void', + [param('ns3::Callback< void, ns3::WifiMacHeader const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')]) + ## dca-txop.h: void ns3::DcaTxop::SetTxFailedCallback(ns3::Callback callback) [member function] + cls.add_method('SetTxFailedCallback', + 'void', + [param('ns3::Callback< void, ns3::WifiMacHeader const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')]) + ## dca-txop.h: void ns3::DcaTxop::SetMaxQueueSize(uint32_t size) [member function] + cls.add_method('SetMaxQueueSize', + 'void', + [param('uint32_t', 'size')]) + ## dca-txop.h: void ns3::DcaTxop::SetMaxQueueDelay(ns3::Time delay) [member function] + cls.add_method('SetMaxQueueDelay', + 'void', + [param('ns3::Time', 'delay')]) + ## dca-txop.h: void ns3::DcaTxop::SetMinCw(uint32_t minCw) [member function] + cls.add_method('SetMinCw', + 'void', + [param('uint32_t', 'minCw')]) + ## dca-txop.h: void ns3::DcaTxop::SetMaxCw(uint32_t maxCw) [member function] + cls.add_method('SetMaxCw', + 'void', + [param('uint32_t', 'maxCw')]) + ## dca-txop.h: void ns3::DcaTxop::SetAifsn(uint32_t aifsn) [member function] + cls.add_method('SetAifsn', + 'void', + [param('uint32_t', 'aifsn')]) + ## dca-txop.h: uint32_t ns3::DcaTxop::GetMinCw() const [member function] + cls.add_method('GetMinCw', + 'uint32_t', + [], + is_const=True) + ## dca-txop.h: uint32_t ns3::DcaTxop::GetMaxCw() const [member function] + cls.add_method('GetMaxCw', + 'uint32_t', + [], + is_const=True) + ## dca-txop.h: uint32_t ns3::DcaTxop::GetAifsn() const [member function] + cls.add_method('GetAifsn', + 'uint32_t', + [], + is_const=True) + ## dca-txop.h: void ns3::DcaTxop::Queue(ns3::Ptr packet, ns3::WifiMacHeader const & hdr) [member function] + cls.add_method('Queue', + 'void', + [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::WifiMacHeader const &', 'hdr')]) + ## dca-txop.h: void ns3::DcaTxop::DoDispose() [member function] + cls.add_method('DoDispose', + 'void', + [], + visibility='private', is_virtual=True) + return + def register_Ns3ErrorRateModel_methods(root_module, cls): ## error-rate-model.h: ns3::ErrorRateModel::ErrorRateModel(ns3::ErrorRateModel const & arg0) [copy constructor] cls.add_constructor([param('ns3::ErrorRateModel const &', 'arg0')]) @@ -2379,12 +2836,12 @@ def register_Ns3NqapWifiMac_methods(root_module, cls): 'void', [param('ns3::Ptr< ns3::WifiRemoteStationManager >', 'stationManager')], is_virtual=True) - ## nqap-wifi-mac.h: void ns3::NqapWifiMac::Enqueue(ns3::Ptr packet, ns3::Mac48Address to, ns3::Mac48Address from) [member function] + ## nqap-wifi-mac.h: void ns3::NqapWifiMac::Enqueue(ns3::Ptr packet, ns3::Mac48Address to, ns3::Mac48Address from) [member function] cls.add_method('Enqueue', 'void', [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to'), param('ns3::Mac48Address', 'from')], is_virtual=True) - ## nqap-wifi-mac.h: void ns3::NqapWifiMac::Enqueue(ns3::Ptr packet, ns3::Mac48Address to) [member function] + ## nqap-wifi-mac.h: void ns3::NqapWifiMac::Enqueue(ns3::Ptr packet, ns3::Mac48Address to) [member function] cls.add_method('Enqueue', 'void', [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to')], @@ -2532,12 +2989,12 @@ def register_Ns3NqstaWifiMac_methods(root_module, cls): 'void', [param('ns3::Ptr< ns3::WifiRemoteStationManager >', 'stationManager')], is_virtual=True) - ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::Enqueue(ns3::Ptr packet, ns3::Mac48Address to, ns3::Mac48Address from) [member function] + ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::Enqueue(ns3::Ptr packet, ns3::Mac48Address to, ns3::Mac48Address from) [member function] cls.add_method('Enqueue', 'void', [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to'), param('ns3::Mac48Address', 'from')], is_virtual=True) - ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::Enqueue(ns3::Ptr packet, ns3::Mac48Address to) [member function] + ## nqsta-wifi-mac.h: void ns3::NqstaWifiMac::Enqueue(ns3::Ptr packet, ns3::Mac48Address to) [member function] cls.add_method('Enqueue', 'void', [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to')], @@ -2878,7 +3335,7 @@ def register_Ns3YansWifiChannel_methods(root_module, cls): cls.add_method('SetPropagationDelayModel', 'void', [param('ns3::Ptr< ns3::PropagationDelayModel >', 'delay')]) - ## yans-wifi-channel.h: void ns3::YansWifiChannel::Send(ns3::Ptr sender, ns3::Ptr packet, double txPowerDbm, ns3::WifiMode wifiMode, ns3::WifiPreamble preamble) const [member function] + ## yans-wifi-channel.h: void ns3::YansWifiChannel::Send(ns3::Ptr sender, ns3::Ptr packet, double txPowerDbm, ns3::WifiMode wifiMode, ns3::WifiPreamble preamble) const [member function] cls.add_method('Send', 'void', [param('ns3::Ptr< ns3::YansWifiPhy >', 'sender'), param('ns3::Ptr< ns3::Packet const >', 'packet'), param('double', 'txPowerDbm'), param('ns3::WifiMode', 'wifiMode'), param('ns3::WifiPreamble', 'preamble')], From 8a94aee8aa38fd59bb858642411b456df281e8bf Mon Sep 17 00:00:00 2001 From: Mirko Banchi Date: Fri, 24 Apr 2009 10:21:37 +0200 Subject: [PATCH 17/35] add qos MACs --- examples/simple-wifi-frame-aggregation.cc | 151 ++++ examples/wscript | 4 + src/devices/wifi/amsdu-subframe-header.cc | 116 +++ src/devices/wifi/amsdu-subframe-header.h | 57 ++ src/devices/wifi/edca-txop-n.cc | 691 ++++++++++++++++ src/devices/wifi/edca-txop-n.h | 170 ++++ src/devices/wifi/msdu-aggregator.cc | 78 ++ src/devices/wifi/msdu-aggregator.h | 55 ++ src/devices/wifi/msdu-standard-aggregator.cc | 86 ++ src/devices/wifi/msdu-standard-aggregator.h | 56 ++ src/devices/wifi/qadhoc-wifi-mac.cc | 441 +++++++++++ src/devices/wifi/qadhoc-wifi-mac.h | 120 +++ src/devices/wifi/qap-wifi-mac.cc | 790 +++++++++++++++++++ src/devices/wifi/qap-wifi-mac.h | 145 ++++ src/devices/wifi/qsta-wifi-mac.cc | 768 ++++++++++++++++++ src/devices/wifi/qsta-wifi-mac.h | 168 ++++ src/devices/wifi/wscript | 16 +- src/helper/qos-wifi-mac-helper.cc | 191 +++++ src/helper/qos-wifi-mac-helper.h | 123 +++ src/helper/wscript | 2 + 20 files changed, 4227 insertions(+), 1 deletion(-) create mode 100644 examples/simple-wifi-frame-aggregation.cc create mode 100644 src/devices/wifi/amsdu-subframe-header.cc create mode 100644 src/devices/wifi/amsdu-subframe-header.h create mode 100644 src/devices/wifi/edca-txop-n.cc create mode 100644 src/devices/wifi/edca-txop-n.h create mode 100644 src/devices/wifi/msdu-aggregator.cc create mode 100644 src/devices/wifi/msdu-aggregator.h create mode 100644 src/devices/wifi/msdu-standard-aggregator.cc create mode 100644 src/devices/wifi/msdu-standard-aggregator.h create mode 100644 src/devices/wifi/qadhoc-wifi-mac.cc create mode 100644 src/devices/wifi/qadhoc-wifi-mac.h create mode 100644 src/devices/wifi/qap-wifi-mac.cc create mode 100644 src/devices/wifi/qap-wifi-mac.h create mode 100644 src/devices/wifi/qsta-wifi-mac.cc create mode 100644 src/devices/wifi/qsta-wifi-mac.h create mode 100644 src/helper/qos-wifi-mac-helper.cc create mode 100644 src/helper/qos-wifi-mac-helper.h diff --git a/examples/simple-wifi-frame-aggregation.cc b/examples/simple-wifi-frame-aggregation.cc new file mode 100644 index 000000000..765b108ca --- /dev/null +++ b/examples/simple-wifi-frame-aggregation.cc @@ -0,0 +1,151 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2009 MIRKO BANCHI + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Mirko Banchi + */ +#include "ns3/core-module.h" +#include "ns3/simulator-module.h" +#include "ns3/node-module.h" +#include "ns3/helper-module.h" +#include "ns3/global-routing-module.h" +#include "ns3/wifi-module.h" +#include "ns3/mobility-module.h" + +//This is a simple example in order to show how 802.11n frame aggregation feature (A-MSDU) works. +// +//Network topology: +// +// Wifi 192.168.1.0 +// +// AP +// * * * +// | | | +// n1 n2 n3 +// +//Packets in this simulation aren't marked with a QosTag so they are considered +//belonging to BestEffort Access Class (AC_BE). + +using namespace ns3; + +NS_LOG_COMPONENT_DEFINE ("SimpleWifiFrameAggregation"); + +int main (int argc, char *argv[]) +{ + //LogComponentEnable ("EdcaTxopN", LOG_LEVEL_DEBUG); + LogComponentEnable ("MsduAggregator", LOG_LEVEL_INFO); + LogComponentEnable ("UdpEchoClientApplication", LOG_LEVEL_INFO); + LogComponentEnable ("UdpEchoServerApplication", LOG_LEVEL_INFO); + + uint32_t nWifi = 1; + CommandLine cmd; + cmd.AddValue ("nWifi", "Number of wifi STA devices", nWifi); + cmd.Parse (argc,argv); + + NodeContainer wifiNodes; + wifiNodes.Create (2); + NodeContainer wifiApNode; + wifiApNode.Create (1); + + YansWifiChannelHelper channel = YansWifiChannelHelper::Default (); + YansWifiPhyHelper phy = YansWifiPhyHelper::Default (); + phy.SetChannel (channel.Create ()); + + WifiHelper wifi = WifiHelper::Default (); + QosWifiMacHelper mac = QosWifiMacHelper::Default (); + wifi.SetRemoteStationManager ("ns3::AarfWifiManager", "FragmentationThreshold", UintegerValue (2500)); + + Ssid ssid = Ssid ("ns-3-802.11n"); + mac.SetType ("ns3::QstaWifiMac", + "Ssid", SsidValue (ssid), + "ActiveProbing", BooleanValue (false)); + mac.SetMsduAggregatorForAc (AC_BE, "ns3::MsduStandardAggregator", + "MaxAmsduSize", UintegerValue (3839)); + + NetDeviceContainer staDevices; + staDevices = wifi.Install (phy, mac, wifiNodes); + + mac.SetType ("ns3::QapWifiMac", + "Ssid", SsidValue (ssid), + "BeaconGeneration", BooleanValue (true), + "BeaconInterval", TimeValue (Seconds (2.5))); + mac.SetMsduAggregatorForAc (AC_BE, "ns3::MsduStandardAggregator", + "MaxAmsduSize", UintegerValue (7935)); + + NetDeviceContainer apDevice; + apDevice = wifi.Install (phy, mac, wifiApNode); + + /* Setting mobility model */ + MobilityHelper mobility; + + mobility.SetPositionAllocator ("ns3::GridPositionAllocator", + "MinX", DoubleValue (0.0), + "MinY", DoubleValue (0.0), + "DeltaX", DoubleValue (5.0), + "DeltaY", DoubleValue (10.0), + "GridWidth", UintegerValue (3), + "LayoutType", StringValue ("RowFirst")); + + mobility.SetMobilityModel ("ns3::RandomWalk2dMobilityModel", + "Bounds", RectangleValue (Rectangle (-50, 50, -50, 50))); + mobility.Install (wifiNodes); + + mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); + mobility.Install (wifiApNode); + + /* Internet stack*/ + InternetStackHelper stack; + stack.Install (wifiApNode); + stack.Install (wifiNodes); + + Ipv4AddressHelper address; + + address.SetBase ("192.168.1.0", "255.255.255.0"); + Ipv4InterfaceContainer wifiNodesInterfaces; + Ipv4InterfaceContainer apNodeInterface; + + wifiNodesInterfaces = address.Assign (staDevices); + apNodeInterface = address.Assign (apDevice); + + /* Setting applications */ + UdpEchoServerHelper echoServer (9); + + ApplicationContainer serverApps = echoServer.Install (wifiNodes.Get (1)); + serverApps.Start (Seconds (1.0)); + serverApps.Stop (Seconds (10.0)); + + UdpEchoClientHelper echoClient (wifiNodesInterfaces.GetAddress (1), 9); + echoClient.SetAttribute ("MaxPackets", UintegerValue (3)); + echoClient.SetAttribute ("Interval", TimeValue (Seconds (0.000001))); + echoClient.SetAttribute ("PacketSize", UintegerValue (1500)); + + ApplicationContainer clientApps = + echoClient.Install (wifiNodes.Get (0)); + clientApps.Start (Seconds (2.0)); + clientApps.Stop (Seconds (10.0)); + + GlobalRouteManager::PopulateRoutingTables (); + + Simulator::Stop (Seconds (10.0)); + + YansWifiPhyHelper::EnablePcap ("test-802.11n", + wifiNodes.Get (nWifi - 1)->GetId (), 0); + + Simulator::Run (); + Simulator::Destroy (); + + return 0; +} diff --git a/examples/wscript b/examples/wscript index f56a6e8e0..a324e865a 100644 --- a/examples/wscript +++ b/examples/wscript @@ -149,3 +149,7 @@ def build(bld): obj = bld.create_ns3_program('tap-wifi-dumbbell', ['wifi', 'csma', 'point-to-point', 'tap-bridge', 'internet-stack']) obj.source = 'tap-wifi-dumbbell.cc' + + obj = bld.create_ns3_program('simple-wifi-frame-aggregation', + ['core', 'simulator', 'mobility', 'wifi']) + obj.source = 'simple-wifi-frame-aggregation.cc' diff --git a/src/devices/wifi/amsdu-subframe-header.cc b/src/devices/wifi/amsdu-subframe-header.cc new file mode 100644 index 000000000..f30278bf3 --- /dev/null +++ b/src/devices/wifi/amsdu-subframe-header.cc @@ -0,0 +1,116 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2009 MIRKO BANCHI + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Mirko Banchi + */ +#include "amsdu-subframe-header.h" +#include "ns3/address-utils.h" + +namespace ns3 { + +NS_OBJECT_ENSURE_REGISTERED (AmsduSubframeHeader); + +TypeId +AmsduSubframeHeader::GetTypeId () +{ + static TypeId tid = TypeId ("ns3::AmsduSubframeHeader") + .SetParent
() + .AddConstructor () + ; + return tid; +} + +TypeId +AmsduSubframeHeader::GetInstanceTypeId (void) const +{ + return GetTypeId (); +} + +AmsduSubframeHeader::AmsduSubframeHeader () + : m_length (0) +{} + +AmsduSubframeHeader::~AmsduSubframeHeader () +{} + +uint32_t +AmsduSubframeHeader::GetSerializedSize () const +{ + return (6 + 6 + 2); +} + +void +AmsduSubframeHeader::Serialize (Buffer::Iterator i) const +{ + WriteTo (i, m_da); + WriteTo (i, m_sa); + i.WriteHtonU16 (m_length); +} + +uint32_t +AmsduSubframeHeader::Deserialize (Buffer::Iterator start) +{ + Buffer::Iterator i = start; + ReadFrom (i, m_da); + ReadFrom (i, m_sa); + m_length = i.ReadNtohU16 (); + return i.GetDistanceFrom (start); +} + +void +AmsduSubframeHeader::Print (std::ostream &os) const +{ + os << "DA = " << m_da << ", SA = " << m_sa << ", length = " << m_length; +} + +void +AmsduSubframeHeader::SetDestinationAddr (Mac48Address to) +{ + m_da = to; +} + +void +AmsduSubframeHeader::SetSourceAddr (Mac48Address from) +{ + m_sa = from; +} + +void +AmsduSubframeHeader::SetLength (uint16_t length) +{ + m_length = length; +} + +Mac48Address +AmsduSubframeHeader::GetDestinationAddr (void) const +{ + return m_da; +} + +Mac48Address +AmsduSubframeHeader::GetSourceAddr (void) const +{ + return m_sa; +} + +uint16_t +AmsduSubframeHeader::GetLength (void) const +{ + return m_length; +} + +} //namespace ns3 diff --git a/src/devices/wifi/amsdu-subframe-header.h b/src/devices/wifi/amsdu-subframe-header.h new file mode 100644 index 000000000..a19dfcc77 --- /dev/null +++ b/src/devices/wifi/amsdu-subframe-header.h @@ -0,0 +1,57 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2009 MIRKO BANCHI + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Mirko Banchi + */ +#ifndef AMSDU_SUBFRAME_HEADER_H +#define AMSDU_SUBFRAME_HEADER_H + +#include "ns3/header.h" +#include "ns3/mac48-address.h" + +namespace ns3 { + +class AmsduSubframeHeader : public Header +{ +public: + + AmsduSubframeHeader (); + virtual ~AmsduSubframeHeader (); + + static TypeId GetTypeId (void); + virtual TypeId GetInstanceTypeId (void) const; + virtual void Print (std::ostream &os) const; + virtual uint32_t GetSerializedSize (void) const; + virtual void Serialize (Buffer::Iterator start) const; + virtual uint32_t Deserialize (Buffer::Iterator start); + + void SetDestinationAddr (Mac48Address to); + void SetSourceAddr (Mac48Address to); + void SetLength (uint16_t); + Mac48Address GetDestinationAddr (void) const; + Mac48Address GetSourceAddr (void) const; + uint16_t GetLength (void) const; + +private: + Mac48Address m_da; + Mac48Address m_sa; + uint16_t m_length; +}; + +} //namespace ns3 + +#endif /* AMSDU_SUBFRAME_HEADER_H */ diff --git a/src/devices/wifi/edca-txop-n.cc b/src/devices/wifi/edca-txop-n.cc new file mode 100644 index 000000000..dc5052c7a --- /dev/null +++ b/src/devices/wifi/edca-txop-n.cc @@ -0,0 +1,691 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2006, 2009 INRIA + * Copyright (c) 2009 MIRKO BANCHI + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Mathieu Lacage + * Author: Mirko Banchi + */ +#include "ns3/log.h" +#include "ns3/assert.h" + +#include "edca-txop-n.h" +#include "mac-low.h" +#include "dcf-manager.h" +#include "mac-tx-middle.h" +#include "wifi-mac-trailer.h" +#include "wifi-mac.h" +#include "random-stream.h" +#include "wifi-mac-queue.h" +#include "msdu-aggregator.h" + +NS_LOG_COMPONENT_DEFINE ("EdcaTxopN"); + +#define MY_DEBUG(x) \ + NS_LOG_DEBUG (m_low->GetAddress () << " " << x) + +namespace ns3 { + +class EdcaTxopN::Dcf : public DcfState +{ +public: + Dcf (EdcaTxopN *txop) + : m_txop (txop) + {} +private: + virtual void DoNotifyAccessGranted (void) { + m_txop->NotifyAccessGranted (); + } + virtual void DoNotifyInternalCollision (void) { + m_txop->NotifyInternalCollision (); + } + virtual void DoNotifyCollision (void) { + m_txop->NotifyCollision (); + } + EdcaTxopN *m_txop; +}; + +class EdcaTxopN::TransmissionListener : public MacLowTransmissionListener +{ +public: + TransmissionListener (EdcaTxopN *txop) + : MacLowTransmissionListener (), + m_txop (txop) {} + + virtual ~TransmissionListener () {} + + virtual void GotCts (double snr, WifiMode txMode) { + m_txop->GotCts (snr, txMode); + } + virtual void MissedCts (void) { + m_txop->MissedCts (); + } + virtual void GotAck (double snr, WifiMode txMode) { + m_txop->GotAck (snr, txMode); + } + virtual void MissedAck (void) { + m_txop->MissedAck (); + } + virtual void StartNext (void) { + m_txop->StartNext (); + } + virtual void Cancel (void) { + m_txop->Cancel (); + } + +private: + EdcaTxopN *m_txop; +}; + +NS_OBJECT_ENSURE_REGISTERED (EdcaTxopN); + +TypeId +EdcaTxopN::GetTypeId (void) +{ + static TypeId tid = TypeId ("ns3::EdcaTxopN") + .SetParent () + .AddConstructor () + .AddAttribute ("MinCw", "The minimun value of the contention window.", + UintegerValue (31), + MakeUintegerAccessor (&EdcaTxopN::SetMinCw, + &EdcaTxopN::GetMinCw), + MakeUintegerChecker ()) + .AddAttribute ("MaxCw", "The maximum value of the contention window.", + UintegerValue (1023), + MakeUintegerAccessor (&EdcaTxopN::SetMaxCw, + &EdcaTxopN::GetMaxCw), + MakeUintegerChecker ()) + .AddAttribute ("Aifsn", "The AIFSN: the default value conforms to simple DCA.", + UintegerValue (3), + MakeUintegerAccessor (&EdcaTxopN::SetAifsn, + &EdcaTxopN::GetAifsn), + MakeUintegerChecker ()) + ; + return tid; +} + +EdcaTxopN::EdcaTxopN () + : m_manager (0), + m_currentPacket(0), + m_aggregator (0) +{ + NS_LOG_FUNCTION (this); + m_transmissionListener = new EdcaTxopN::TransmissionListener (this); + m_dcf = new EdcaTxopN::Dcf (this); + m_queue = CreateObject (); + m_rng = new RealRandomStream (); +} + +EdcaTxopN::~EdcaTxopN () +{ + NS_LOG_FUNCTION (this); +} + +void +EdcaTxopN::DoDispose (void) +{ + NS_LOG_FUNCTION (this); + m_queue = 0; + m_low = 0; + m_stationManager = 0; + delete m_transmissionListener; + delete m_dcf; + delete m_rng; + m_transmissionListener = 0; + m_dcf = 0; + m_rng = 0; + m_txMiddle = 0; + m_aggregator = 0; +} + +void +EdcaTxopN::SetManager (DcfManager *manager) +{ + NS_LOG_FUNCTION (this << manager); + m_manager = manager; + m_manager->Add (m_dcf); +} + +void +EdcaTxopN::SetTxOkCallback (TxOk callback) +{ + m_txOkCallback = callback; +} + +void +EdcaTxopN::SetTxFailedCallback (TxFailed callback) +{ + m_txFailedCallback = callback; +} + +void +EdcaTxopN::SetWifiRemoteStationManager (Ptr remoteManager) +{ + NS_LOG_FUNCTION (this << remoteManager); + m_stationManager = remoteManager; +} +void +EdcaTxopN::SetTypeOfStation (enum TypeOfStation type) +{ + NS_LOG_FUNCTION (this << type); + m_typeOfStation = type; +} + +enum TypeOfStation +EdcaTxopN::GetTypeOfStation (void) const +{ + return m_typeOfStation; +} + +void +EdcaTxopN::SetMaxQueueSize (uint32_t size) +{ + NS_LOG_FUNCTION (this << size); + m_queue->SetMaxSize (size); +} + +void +EdcaTxopN::SetMaxQueueDelay (Time delay) +{ + NS_LOG_FUNCTION (this << delay); + m_queue->SetMaxDelay (delay); +} + +void +EdcaTxopN::SetMinCw (uint32_t minCw) +{ + NS_LOG_FUNCTION (this << minCw); + m_dcf->SetCwMin (minCw); +} + +void +EdcaTxopN::SetMaxCw (uint32_t maxCw) +{ + NS_LOG_FUNCTION (this << maxCw); + m_dcf->SetCwMax (maxCw); +} + +void +EdcaTxopN::SetAifsn (uint32_t aifsn) +{ + NS_LOG_FUNCTION (this << aifsn); + m_dcf->SetAifsn (aifsn); +} + +uint32_t +EdcaTxopN::GetMinCw (void) const +{ + return m_dcf->GetCwMin (); +} + +uint32_t +EdcaTxopN::GetMaxCw (void) const +{ + return m_dcf->GetCwMax (); +} + +uint32_t +EdcaTxopN::GetAifsn (void) const +{ + return m_dcf->GetAifsn (); +} + +void +EdcaTxopN::SetTxMiddle (MacTxMiddle *txMiddle) +{ + m_txMiddle = txMiddle; +} + +Ptr +EdcaTxopN::Low (void) +{ + return m_low; +} + +void +EdcaTxopN::SetLow(Ptr low) +{ + NS_LOG_FUNCTION (this << low); + m_low = low; +} + +bool +EdcaTxopN::NeedsAccess (void) const +{ + return !m_queue->IsEmpty () || m_currentPacket != 0; +} + +void +EdcaTxopN::NotifyAccessGranted (void) +{ + NS_LOG_FUNCTION (this); + if (m_currentPacket == 0) + { + if (m_queue->IsEmpty ()) + { + MY_DEBUG ("queue is empty"); + return; + } + m_currentPacket = m_queue->Dequeue (&m_currentHdr); + NS_ASSERT (m_currentPacket != 0); + + uint16_t sequence = m_txMiddle->GetNextSequenceNumberfor (&m_currentHdr); + m_currentHdr.SetSequenceNumber (sequence); + m_currentHdr.SetFragmentNumber (0); + m_currentHdr.SetNoMoreFragments (); + m_currentHdr.SetNoRetry (); + m_fragmentNumber = 0; + MY_DEBUG ("dequeued size="<GetSize ()<< + ", to="< fragment = GetFragmentPacket (&hdr); + if (IsLastFragment ()) + { + MY_DEBUG ("fragmenting last fragment size=" << fragment->GetSize ()); + params.DisableNextData (); + } + else + { + MY_DEBUG ("fragmenting size=" << fragment->GetSize ()); + params.EnableNextData (GetNextFragmentSize ()); + } + m_low->StartTransmission (fragment, &hdr, params, + m_transmissionListener); + } + else + { + WifiMacHeader peekedHdr; + if (m_currentHdr.IsQosData () && + m_queue->PeekByTidAndAddress (&peekedHdr, m_currentHdr.GetQosTid (), + WifiMacHeader::ADDR1, m_currentHdr.GetAddr1 ()) && + !m_currentHdr.GetAddr1 ().IsBroadcast () && + m_aggregator != 0) + { + /* here is performed aggregation */ + Ptr currentAggregatedPacket = Create (); + m_aggregator->Aggregate (m_currentPacket, currentAggregatedPacket, + MapSrcAddressForAggregation (peekedHdr), + MapDestAddressForAggregation (peekedHdr)); + bool aggregated = false; + bool isAmsdu = false; + Ptr peekedPacket = m_queue->PeekByTidAndAddress (&peekedHdr, m_currentHdr.GetQosTid (), + WifiMacHeader::ADDR1, + m_currentHdr.GetAddr1 ()); + while (peekedPacket != 0) + { + aggregated = m_aggregator->Aggregate (peekedPacket, currentAggregatedPacket, + MapSrcAddressForAggregation (peekedHdr), + MapDestAddressForAggregation (peekedHdr)); + if (aggregated) + { + isAmsdu = true; + m_queue->Remove (peekedPacket); + } + else + { + break; + } + peekedPacket = m_queue->PeekByTidAndAddress (&peekedHdr, m_currentHdr.GetQosTid (), + WifiMacHeader::ADDR1, m_currentHdr.GetAddr1 ()); + } + if (isAmsdu) + { + m_currentHdr.SetQosAmsdu (); + m_currentHdr.SetAddr3 (m_low->GetBssid ()); + m_currentPacket = currentAggregatedPacket; + currentAggregatedPacket = 0; + MY_DEBUG ("tx unicast A-MSDU"); + } + } + if (NeedRts ()) + { + params.EnableRts (); + MY_DEBUG ("tx unicast rts"); + } + else + { + params.DisableRts (); + MY_DEBUG ("tx unicast"); + } + params.DisableNextData (); + m_low->StartTransmission (m_currentPacket, &m_currentHdr, + params, m_transmissionListener); + } + } +} + +void EdcaTxopN::NotifyInternalCollision (void) +{ + NS_LOG_FUNCTION (this); + NotifyCollision (); +} + +void +EdcaTxopN::NotifyCollision (void) +{ + NS_LOG_FUNCTION (this); + m_dcf->StartBackoffNow (m_rng->GetNext (0, m_dcf->GetCw ())); + RestartAccessIfNeeded (); +} + +void +EdcaTxopN::GotCts (double snr, WifiMode txMode) +{ + NS_LOG_FUNCTION (this << snr << txMode); + MY_DEBUG ("got cts"); +} + +void +EdcaTxopN::MissedCts (void) +{ + NS_LOG_FUNCTION (this); + MY_DEBUG ("missed cts"); + if (!NeedRtsRetransmission ()) + { + MY_DEBUG ("Cts Fail"); + WifiRemoteStation *station = GetStation (m_currentHdr.GetAddr1 ()); + station->ReportFinalRtsFailed (); + if (!m_txFailedCallback.IsNull ()) + { + m_txFailedCallback (m_currentHdr); + } + // to reset the dcf. + m_currentPacket = 0; + m_dcf->ResetCw (); + } + else + { + m_dcf->UpdateFailedCw (); + } + m_dcf->StartBackoffNow (m_rng->GetNext (0, m_dcf->GetCw ())); + RestartAccessIfNeeded (); +} + +void +EdcaTxopN::Queue (Ptr packet, WifiMacHeader const &hdr) +{ + NS_LOG_FUNCTION (this << packet << &hdr); + WifiMacTrailer fcs; + uint32_t fullPacketSize = hdr.GetSerializedSize () + packet->GetSize () + fcs.GetSerializedSize (); + WifiRemoteStation *station = GetStation (hdr.GetAddr1 ()); + station->PrepareForQueue (packet, fullPacketSize); + m_queue->Enqueue (packet, hdr); + StartAccessIfNeeded (); +} + +void +EdcaTxopN::GotAck (double snr, WifiMode txMode) +{ + NS_LOG_FUNCTION (this << snr << txMode); + if (!NeedFragmentation () || + IsLastFragment () || + m_currentHdr.IsQosAmsdu ()) + { + MY_DEBUG ("got ack. tx done."); + if (!m_txOkCallback.IsNull ()) + { + m_txOkCallback (m_currentHdr); + } + m_currentPacket = 0; + + m_dcf->ResetCw (); + m_dcf->StartBackoffNow (m_rng->GetNext (0, m_dcf->GetCw ())); + RestartAccessIfNeeded (); + } + else + { + MY_DEBUG ("got ack. tx not done, size="<GetSize ()); + } +} + +void +EdcaTxopN::MissedAck (void) +{ + NS_LOG_FUNCTION (this); + MY_DEBUG ("missed ack"); + if (!NeedDataRetransmission ()) + { + MY_DEBUG ("Ack Fail"); + WifiRemoteStation *station = GetStation (m_currentHdr.GetAddr1 ()); + station->ReportFinalDataFailed (); + if (!m_txFailedCallback.IsNull ()) + { + m_txFailedCallback (m_currentHdr); + } + // to reset the dcf. + m_currentPacket = 0; + m_dcf->ResetCw (); + } + else + { + MY_DEBUG ("Retransmit"); + m_currentHdr.SetRetry (); + m_dcf->UpdateFailedCw (); + } + m_dcf->StartBackoffNow (m_rng->GetNext (0, m_dcf->GetCw ())); + RestartAccessIfNeeded (); +} + +Ptr +EdcaTxopN::GetMsduAggregator (void) const +{ + return m_aggregator; +} + +void +EdcaTxopN::RestartAccessIfNeeded (void) +{ + NS_LOG_FUNCTION (this); + if ((m_currentPacket != 0 || + !m_queue->IsEmpty ()) && + !m_dcf->IsAccessRequested ()) + { + m_manager->RequestAccess (m_dcf); + } +} + +void +EdcaTxopN::StartAccessIfNeeded (void) +{ + NS_LOG_FUNCTION (this); + if (m_currentPacket == 0 && + !m_queue->IsEmpty () && + !m_dcf->IsAccessRequested ()) + { + m_manager->RequestAccess (m_dcf); + } +} + +bool +EdcaTxopN::NeedRts (void) +{ + WifiRemoteStation *station = GetStation (m_currentHdr.GetAddr1 ()); + return station->NeedRts (m_currentPacket); +} + +bool +EdcaTxopN::NeedRtsRetransmission (void) +{ + WifiRemoteStation *station = GetStation (m_currentHdr.GetAddr1 ()); + return station->NeedRtsRetransmission (m_currentPacket); +} + +bool +EdcaTxopN::NeedDataRetransmission (void) +{ + WifiRemoteStation *station = GetStation (m_currentHdr.GetAddr1 ()); + return station->NeedDataRetransmission (m_currentPacket); +} + +void +EdcaTxopN::NextFragment (void) +{ + m_fragmentNumber++; +} + +void +EdcaTxopN::StartNext (void) +{ + NS_LOG_FUNCTION (this); + MY_DEBUG ("start next packet fragment"); + /* this callback is used only for fragments. */ + NextFragment (); + WifiMacHeader hdr; + Ptr fragment = GetFragmentPacket (&hdr); + MacLowTransmissionParameters params; + params.EnableAck (); + params.DisableRts (); + params.DisableOverrideDurationId (); + if (IsLastFragment ()) + { + params.DisableNextData (); + } + else + { + params.EnableNextData (GetNextFragmentSize ()); + } + Low ()->StartTransmission (fragment, &hdr, params, m_transmissionListener); +} + +void +EdcaTxopN::Cancel (void) +{ + NS_LOG_FUNCTION (this); + MY_DEBUG ("transmission cancelled"); +} + +bool +EdcaTxopN::NeedFragmentation (void) const +{ + WifiRemoteStation *station = GetStation (m_currentHdr.GetAddr1 ()); + return station->NeedFragmentation (m_currentPacket); +} + +uint32_t +EdcaTxopN::GetFragmentSize (void) +{ + WifiRemoteStation *station = GetStation (m_currentHdr.GetAddr1 ()); + return station->GetFragmentSize (m_currentPacket, m_fragmentNumber); +} + +uint32_t +EdcaTxopN::GetNextFragmentSize (void) +{ + WifiRemoteStation *station = GetStation (m_currentHdr.GetAddr1 ()); + return station->GetFragmentSize (m_currentPacket, m_fragmentNumber + 1); +} + +uint32_t +EdcaTxopN::GetFragmentOffset (void) +{ + WifiRemoteStation *station = GetStation (m_currentHdr.GetAddr1 ()); + return station->GetFragmentOffset (m_currentPacket, m_fragmentNumber); +} + +WifiRemoteStation * +EdcaTxopN::GetStation (Mac48Address ad) const +{ + return m_stationManager->Lookup (ad); +} + +bool +EdcaTxopN::IsLastFragment (void) const +{ + WifiRemoteStation *station = GetStation (m_currentHdr.GetAddr1 ()); + return station->IsLastFragment (m_currentPacket, m_fragmentNumber); +} + +Ptr +EdcaTxopN::GetFragmentPacket (WifiMacHeader *hdr) +{ + *hdr = m_currentHdr; + hdr->SetFragmentNumber (m_fragmentNumber); + uint32_t startOffset = GetFragmentOffset (); + Ptr fragment; + if (IsLastFragment ()) + { + hdr->SetNoMoreFragments (); + } + else + { + hdr->SetMoreFragments (); + } + fragment = m_currentPacket->CreateFragment (startOffset, + GetFragmentSize ()); + return fragment; +} + +Mac48Address +EdcaTxopN::MapSrcAddressForAggregation (WifiMacHeader const &hdr) +{ + if (m_typeOfStation == STA || m_typeOfStation == ADHOC_STA) + { + return hdr.GetAddr2 (); + } + else + { + return hdr.GetAddr3 (); + } +} + +Mac48Address +EdcaTxopN::MapDestAddressForAggregation (WifiMacHeader const &hdr) +{ + if (m_typeOfStation == AP || m_typeOfStation == ADHOC_STA) + { + return hdr.GetAddr1 (); + } + else + { + return hdr.GetAddr3 (); + } +} + +void +EdcaTxopN::SetMsduAggregator (Ptr aggr) +{ + m_aggregator = aggr; +} + +} //namespace ns3 diff --git a/src/devices/wifi/edca-txop-n.h b/src/devices/wifi/edca-txop-n.h new file mode 100644 index 000000000..497871b61 --- /dev/null +++ b/src/devices/wifi/edca-txop-n.h @@ -0,0 +1,170 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2006, 2009 INRIA + * Copyright (c) 2009 MIRKO BANCHI + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Mathieu Lacage + * Author: Mirko Banchi + */ +#ifndef EDCA_TXOP_N_H +#define EDCA_TXOP_N_H + +#include "ns3/object.h" +#include "ns3/mac48-address.h" +#include "ns3/packet.h" + +#include "wifi-mode.h" +#include "wifi-mac.h" +#include "wifi-mac-header.h" +#include "qos-utils.h" + +#include +#include + +namespace ns3 { + +class DcfState; +class DcfManager; +class MacLow; +class MacTxMiddle; +class WifiMacParameters; +class WifiMacQueue; +class RandomStream; +class MsduAggregator; + +/* This queue contains packets for a particular access class. + * possibles access classes are: + * + * -AC_VO : voice, tid = 6,7 ^ + * -AC_VI : video, tid = 4,5 | + * -AC_BE : best-effort, tid = 0,3 | priority + * -AC_BK : background, tid = 1,2 | + * + * For more details see section 9.1.3.1 in 802.11 standard. + */ +enum TypeOfStation +{ + STA, + AP, + ADHOC_STA +}; + +class EdcaTxopN : public Object +{ +public: + + typedef Callback TxOk; + typedef Callback TxFailed; + + static TypeId GetTypeId (void); + EdcaTxopN (); + virtual ~EdcaTxopN (); + void DoDispose (); + + void SetLow (Ptr low); + void SetTxMiddle (MacTxMiddle *txMiddle); + void SetManager (DcfManager *manager); + void SetTxOkCallback (TxOk callback); + void SetTxFailedCallback (TxFailed callback); + void SetWifiRemoteStationManager (Ptr remoteManager); + void SetTypeOfStation (enum TypeOfStation type); + enum TypeOfStation GetTypeOfStation (void) const; + + void SetMaxQueueSize (uint32_t size); + void SetMaxQueueDelay (Time delay); + void SetMinCw (uint32_t minCw); + void SetMaxCw (uint32_t maxCw); + void SetAifsn (uint32_t aifsn); + uint32_t GetMinCw (void) const; + uint32_t GetMaxCw (void) const; + uint32_t GetAifsn (void) const; + + Ptr Low (void); + Ptr GetMsduAggregator (void) const; + + /* dcf notifications forwarded here */ + bool NeedsAccess (void) const; + void NotifyAccessGranted (void); + void NotifyInternalCollision (void); + void NotifyCollision (void); + + /*event handlers*/ + void GotCts (double snr, WifiMode txMode); + void MissedCts (void); + void GotAck (double snr, WifiMode txMode); + void MissedAck (void); + void StartNext (void); + void Cancel (void); + + void RestartAccessIfNeeded (void); + void StartAccessIfNeeded (void); + bool NeedRts (void); + bool NeedRtsRetransmission (void); + bool NeedDataRetransmission (void); + bool NeedFragmentation (void) const; + uint32_t GetNextFragmentSize (void); + uint32_t GetFragmentSize (void); + uint32_t GetFragmentOffset (void); + WifiRemoteStation *GetStation (Mac48Address to) const; + bool IsLastFragment (void) const; + void NextFragment (void); + Ptr GetFragmentPacket (WifiMacHeader *hdr); + + void Queue (Ptr packet, WifiMacHeader const &hdr); + void SetMsduAggregator (Ptr aggr); + +private: + /** + * This functions are used only to correctly set addresses in a-msdu subframe. + * If aggregating sta is a STA (in an infrastructured network): + * SA = Address2 + * DA = Address3 + * If aggregating sta is an AP + * SA = Address3 + * DA = Address1 + */ + Mac48Address MapSrcAddressForAggregation (WifiMacHeader const &hdr); + Mac48Address MapDestAddressForAggregation (WifiMacHeader const &hdr); + + class Dcf; + class TransmissionListener; + friend class Dcf; + friend class TransmissionListener; + Dcf *m_dcf; + DcfManager *m_manager; + Ptr m_queue; + TxOk m_txOkCallback; + TxFailed m_txFailedCallback; + Ptr m_low; + MacTxMiddle *m_txMiddle; + TransmissionListener *m_transmissionListener; + RandomStream *m_rng; + Ptr m_stationManager; + uint8_t m_fragmentNumber; + + /* current packet could be a simple MSDU or, if an aggregator for this queue is + present, could be an A-MSDU. + */ + Ptr m_currentPacket; + + WifiMacHeader m_currentHdr; + Ptr m_aggregator; + TypeOfStation m_typeOfStation; +}; + +} //namespace ns3 + +#endif /* EDCA_TXOP_N_H */ diff --git a/src/devices/wifi/msdu-aggregator.cc b/src/devices/wifi/msdu-aggregator.cc new file mode 100644 index 000000000..5455bcb79 --- /dev/null +++ b/src/devices/wifi/msdu-aggregator.cc @@ -0,0 +1,78 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2009 MIRKO BANCHI + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Mirko Banchi + */ +#include "ns3/log.h" + +#include "msdu-aggregator.h" +#include "wifi-mac-header.h" + +NS_LOG_COMPONENT_DEFINE ("MsduAggregator"); + +namespace ns3 { + +NS_OBJECT_ENSURE_REGISTERED (MsduAggregator); + +TypeId +MsduAggregator::GetTypeId (void) +{ + static TypeId tid = TypeId ("ns3::MsduAggregator") + .SetParent () + ; + return tid; +} + +MsduAggregator::DeaggregatedMsdus +MsduAggregator::Deaggregate (Ptr aggregatedPacket) +{ + NS_LOG_FUNCTION_NOARGS (); + DeaggregatedMsdus set; + + AmsduSubframeHeader hdr; + uint32_t maxSize = aggregatedPacket->GetSize (); + // The worst condition is: two aggregated packets with no padding. + // 28 bytes is the size of two Amsdu subframe headers. + uint8_t *buffer = new uint8_t[maxSize-28]; + uint32_t padding; + uint32_t deserialized = 0; + + while (deserialized < maxSize) + { + deserialized += aggregatedPacket->RemoveHeader (hdr); + deserialized += aggregatedPacket->CopyData (buffer, hdr.GetLength ()); + aggregatedPacket->RemoveAtStart (hdr.GetLength ()); + + padding = (4 - ((hdr.GetLength () + 14) %4 )) % 4; + + if (padding > 0) + { + aggregatedPacket->RemoveAtStart (padding); + deserialized += padding; + } + //a new packet is created with the content of extracted msdu + Ptr p = Create (buffer, hdr.GetLength ()); + + std::pair, AmsduSubframeHeader> packetHdr (p,hdr); + set.push_back (packetHdr); + } + delete [] buffer; + NS_LOG_INFO ("Deaggreated A-MSDU: extracted "<< set.size () << " MSDUs"); + return set; +} + +} //namespace ns3 diff --git a/src/devices/wifi/msdu-aggregator.h b/src/devices/wifi/msdu-aggregator.h new file mode 100644 index 000000000..3845766a7 --- /dev/null +++ b/src/devices/wifi/msdu-aggregator.h @@ -0,0 +1,55 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2009 MIRKO BANCHI + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Mirko Banchi + */ +#ifndef MSDU_AGGREGATOR_H +#define MSDU_AGGREGATOR_H + +#include "ns3/ptr.h" +#include "ns3/packet.h" +#include "ns3/object.h" + +#include "amsdu-subframe-header.h" + +#include + +namespace ns3 { + +class WifiMacHeader; +/** + * \brief Abstract class that concrete msdu aggregators have to implement + */ +class MsduAggregator : public Object +{ +public: + typedef std::list, AmsduSubframeHeader> > DeaggregatedMsdus; + + static TypeId GetTypeId (void); + /* Adds packet to aggregatedPacket. In concrete aggregator's implementation is + * specified how and if packet can be added to aggregatedPacket. If packet + * can be added returns true, false otherwise. + */ + virtual bool Aggregate (Ptr packet, Ptr aggregatedPacket, + Mac48Address src, Mac48Address dest) = 0; + + static DeaggregatedMsdus Deaggregate (Ptr aggregatedPacket); +}; + +} //namespace ns3 + +#endif /* MSDU_AGGREGATOR_H */ diff --git a/src/devices/wifi/msdu-standard-aggregator.cc b/src/devices/wifi/msdu-standard-aggregator.cc new file mode 100644 index 000000000..5fcb0ca24 --- /dev/null +++ b/src/devices/wifi/msdu-standard-aggregator.cc @@ -0,0 +1,86 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2009 MIRKO BANCHI + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Mirko Banchi + */ +#include "ns3/log.h" +#include "ns3/uinteger.h" + +#include "amsdu-subframe-header.h" +#include "msdu-standard-aggregator.h" + +NS_LOG_COMPONENT_DEFINE ("MsduStandardAggregator"); + +namespace ns3 { + +NS_OBJECT_ENSURE_REGISTERED (MsduStandardAggregator); + +TypeId +MsduStandardAggregator::GetTypeId (void) +{ + static TypeId tid = TypeId ("ns3::MsduStandardAggregator") + .SetParent () + .AddConstructor () + .AddAttribute ("MaxAmsduSize", "Max length in byte of an A-MSDU", + UintegerValue (7935), + MakeUintegerAccessor (&MsduStandardAggregator::m_maxAmsduLength), + MakeUintegerChecker ()) + ; + return tid; +} + +MsduStandardAggregator::MsduStandardAggregator () +{} + +MsduStandardAggregator::~MsduStandardAggregator () +{} + +bool +MsduStandardAggregator::Aggregate (Ptr packet, Ptr aggregatedPacket, + Mac48Address src, Mac48Address dest) +{ + NS_LOG_FUNCTION (this); + Ptr currentPacket; + AmsduSubframeHeader currentHdr; + + uint32_t padding = CalculatePadding (packet); + uint32_t actualSize = aggregatedPacket->GetSize (); + + if ((14 + packet->GetSize () + actualSize + padding) <= m_maxAmsduLength) + { + currentHdr.SetDestinationAddr (dest); + currentHdr.SetSourceAddr (src); + currentHdr.SetLength (packet->GetSize ()); + currentPacket = packet->Copy (); + if (padding) + { + currentPacket->AddPaddingAtEnd (padding); + } + currentPacket->AddHeader (currentHdr); + aggregatedPacket->AddAtEnd (currentPacket); + return true; + } + return false; +} + +uint32_t +MsduStandardAggregator::CalculatePadding (Ptr packet) +{ + return (4 - ((packet->GetSize() + 14) %4 )) % 4; +} + +} //namespace ns3 diff --git a/src/devices/wifi/msdu-standard-aggregator.h b/src/devices/wifi/msdu-standard-aggregator.h new file mode 100644 index 000000000..7e626fe2d --- /dev/null +++ b/src/devices/wifi/msdu-standard-aggregator.h @@ -0,0 +1,56 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2009 MIRKO BANCHI + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Mirko Banchi + */ +#ifndef MSDU_STANDARD_AGGREGATOR_H +#define MSDU_STANDARD_AGGREGATOR_H + +#include "msdu-aggregator.h" + +namespace ns3 { + +class MsduStandardAggregator : public MsduAggregator +{ +public: + + static TypeId GetTypeId (void); + MsduStandardAggregator (); + ~MsduStandardAggregator (); + /** + * \param packet Packet we have to insert into aggregatedPacket. + * \param aggregatedPacket Packet that will contain packet, if aggregation is possible, + * \param src Source address of packet. + * \param dest Destination address of packet. + * + * This method performs an MSDU aggregation. + * Returns true if packet can be aggregated to aggregatedPacket, false otherwise. + */ + virtual bool Aggregate (Ptr packet, Ptr aggregatedPacket, + Mac48Address src, Mac48Address dest); +private: + /* Calculates how much padding must be added to the end of packet. + Each A-MSDU subframe is padded so that its length is multiple of 4 octects. + */ + uint32_t CalculatePadding (Ptr packet); + + uint32_t m_maxAmsduLength; +}; + +} //namespace ns3 + +#endif /* MSDU_STANDARD_AGGREGATOR_H */ diff --git a/src/devices/wifi/qadhoc-wifi-mac.cc b/src/devices/wifi/qadhoc-wifi-mac.cc new file mode 100644 index 000000000..66793e4fa --- /dev/null +++ b/src/devices/wifi/qadhoc-wifi-mac.cc @@ -0,0 +1,441 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2006, 2009 INRIA + * Copyright (c) 2009 MIRKO BANCHI + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Mathieu Lacage + * Author: Mirko Banchi + */ +#include "ns3/pointer.h" +#include "ns3/log.h" +#include "ns3/string.h" + +#include "qos-tag.h" +#include "edca-txop-n.h" +#include "qadhoc-wifi-mac.h" +#include "mac-low.h" +#include "dcf-manager.h" +#include "mac-rx-middle.h" +#include "mac-tx-middle.h" +#include "wifi-mac-header.h" +#include "msdu-aggregator.h" +#include "amsdu-subframe-header.h" +#include "mgt-headers.h" + +NS_LOG_COMPONENT_DEFINE ("QadhocWifiMac"); + +namespace ns3 { + +NS_OBJECT_ENSURE_REGISTERED (QadhocWifiMac); + +TypeId +QadhocWifiMac::GetTypeId (void) +{ + static TypeId tid = TypeId ("ns3::QadhocWifiMac") + .SetParent () + .AddConstructor () + .AddAttribute ("VO_EdcaTxopN", + "Queue that manages packets belonging to AC_VO access class", + PointerValue (), + MakePointerAccessor(&QadhocWifiMac::GetVOQueue, + &QadhocWifiMac::SetVOQueue), + MakePointerChecker ()) + .AddAttribute ("VI_EdcaTxopN", + "Queue that manages packets belonging to AC_VI access class", + PointerValue (), + MakePointerAccessor(&QadhocWifiMac::GetVIQueue, + &QadhocWifiMac::SetVIQueue), + MakePointerChecker ()) + .AddAttribute ("BE_EdcaTxopN", + "Queue that manages packets belonging to AC_BE access class", + PointerValue (), + MakePointerAccessor(&QadhocWifiMac::GetBEQueue, + &QadhocWifiMac::SetBEQueue), + MakePointerChecker ()) + .AddAttribute ("BK_EdcaTxopN", + "Queue that manages packets belonging to AC_BK access class", + PointerValue (), + MakePointerAccessor(&QadhocWifiMac::GetBKQueue, + &QadhocWifiMac::SetBKQueue), + MakePointerChecker ()) + ; + return tid; +} + +QadhocWifiMac::QadhocWifiMac () +{ + NS_LOG_FUNCTION (this); + m_rxMiddle = new MacRxMiddle (); + m_rxMiddle->SetForwardCallback (MakeCallback (&QadhocWifiMac::Receive, this)); + + m_txMiddle = new MacTxMiddle (); + + m_low = CreateObject (); + m_low->SetRxCallback (MakeCallback (&MacRxMiddle::Receive, m_rxMiddle)); + + m_dcfManager = new DcfManager (); + m_dcfManager->SetupLowListener (m_low); +} + +QadhocWifiMac::~QadhocWifiMac () +{ + NS_LOG_FUNCTION (this); +} + +void +QadhocWifiMac::DoDispose (void) +{ + NS_LOG_FUNCTION (this); + delete m_rxMiddle; + m_rxMiddle = 0; + delete m_txMiddle; + m_txMiddle = 0; + delete m_dcfManager; + m_dcfManager = 0; + m_low = 0; + m_phy = 0; + m_voEdca = 0; + m_viEdca = 0; + m_beEdca = 0; + m_bkEdca = 0; + m_stationManager = 0; + std::map >::iterator it = m_queues.begin (); + for (;it != m_queues.end (); it++) + { + it->second = 0; + } + WifiMac::DoDispose (); +} + +void +QadhocWifiMac::SetSlot (Time slotTime) +{ + m_dcfManager->SetSlot (slotTime); + m_low->SetSlotTime (slotTime); +} + +void +QadhocWifiMac::SetSifs (Time sifs) +{ + m_dcfManager->SetSifs (sifs); + m_low->SetSifs (sifs); +} + +void +QadhocWifiMac::SetEifsNoDifs (Time eifsNoDifs) +{ + m_dcfManager->SetEifsNoDifs (eifsNoDifs); + m_eifsNoDifs = eifsNoDifs; +} + +void +QadhocWifiMac::SetAckTimeout (Time ackTimeout) +{ + m_low->SetAckTimeout (ackTimeout); +} + +void +QadhocWifiMac::SetCtsTimeout (Time ctsTimeout) +{ + m_low->SetCtsTimeout (ctsTimeout); +} + +void +QadhocWifiMac::SetPifs (Time pifs) +{ + m_low->SetPifs (pifs); +} + +Time +QadhocWifiMac::GetSlot (void) const +{ + return m_low->GetSlotTime (); +} + +Time +QadhocWifiMac::GetSifs (void) const +{ + return m_low->GetSifs (); +} + +Time +QadhocWifiMac::GetEifsNoDifs (void) const +{ + return m_eifsNoDifs; +} + +Time +QadhocWifiMac::GetAckTimeout (void) const +{ + return m_low->GetAckTimeout (); +} + +Time +QadhocWifiMac::GetCtsTimeout (void) const +{ + return m_low->GetCtsTimeout (); +} + +Time +QadhocWifiMac::GetPifs (void) const +{ + return m_low->GetPifs (); +} + +void +QadhocWifiMac::SetWifiPhy (Ptr phy) +{ + m_phy = phy; + m_dcfManager->SetupPhyListener (phy); + m_low->SetPhy (phy); +} + +void +QadhocWifiMac::SetWifiRemoteStationManager (Ptr stationManager) +{ + NS_LOG_FUNCTION (this << stationManager); + m_stationManager = stationManager; + m_voEdca->SetWifiRemoteStationManager (stationManager); + m_viEdca->SetWifiRemoteStationManager (stationManager); + m_beEdca->SetWifiRemoteStationManager (stationManager); + m_bkEdca->SetWifiRemoteStationManager (stationManager); + m_low->SetWifiRemoteStationManager (stationManager); +} + +void +QadhocWifiMac::Enqueue (Ptr packet, Mac48Address to, Mac48Address from) +{ + NS_FATAL_ERROR ("Adhoc does not support a from != m_low->GetAddress ()"); +} + +void +QadhocWifiMac::Enqueue (Ptr packet, Mac48Address to) +{ + /* For now Qos adhoc stations sends only Qos frame. In the future they + * should be able to send frames also to Non-Qos Stas. + */ + NS_LOG_FUNCTION (packet->GetSize () << to); + WifiMacHeader hdr; + hdr.SetType (WIFI_MAC_QOSDATA); + hdr.SetQosAckPolicy (WifiMacHeader::NORMAL_ACK); + hdr.SetQosNoEosp (); + hdr.SetQosNoAmsdu (); + /* Transmission of multiple frames in the same + Txop is not supported for now */ + hdr.SetQosTxopLimit (0); + + hdr.SetAddr1 (to); + hdr.SetAddr2 (m_low->GetAddress ()); + hdr.SetAddr3 (GetBssid ()); + hdr.SetDsNotFrom (); + hdr.SetDsNotTo (); + + WifiRemoteStation *destination = m_stationManager->Lookup (to); + if (destination->IsBrandNew ()) + { + // in adhoc mode, we assume that every destination + // supports all the rates we support. + for (uint32_t i = 0; i < m_phy->GetNModes (); i++) + { + destination->AddSupportedMode (m_phy->GetMode (i)); + } + destination->RecordDisassociated (); + } + + uint8_t tid = QosUtilsGetTidForPacket (packet); + if (tid < 8) + { + hdr.SetQosTid (tid); + AccessClass ac = QosUtilsMapTidToAc (tid); + m_queues[ac]->Queue (packet, hdr); + } + else + { + //packet is considerated belonging to BestEffort AC + hdr.SetQosTid (0); + m_queues[AC_BE]->Queue (packet, hdr); + } +} + +bool +QadhocWifiMac::SupportsSendFrom (void) const +{ + return false; +} + +void +QadhocWifiMac::SetForwardUpCallback (Callback, Mac48Address, Mac48Address> upCallback) +{ + m_forwardUp = upCallback; +} + +void +QadhocWifiMac::SetLinkUpCallback (Callback linkUp) +{ + // an Adhoc network is always UP. + linkUp (); +} + +void +QadhocWifiMac::SetLinkDownCallback (Callback linkDown) +{} + +Mac48Address +QadhocWifiMac::GetAddress (void) const +{ + return m_low->GetAddress (); +} + +Ssid +QadhocWifiMac::GetSsid (void) const +{ + return m_ssid; +} + +void +QadhocWifiMac::SetAddress (Mac48Address address) +{ + m_low->SetAddress (address); + m_low->SetBssid (address); +} + +void +QadhocWifiMac::SetSsid (Ssid ssid) +{ + NS_LOG_FUNCTION (this << ssid); + // XXX: here, we should start a special adhoc network + m_ssid = ssid; +} + +Mac48Address +QadhocWifiMac::GetBssid (void) const +{ + return m_low->GetBssid (); +} + +void +QadhocWifiMac::ForwardUp (Ptr packet, Mac48Address from, Mac48Address to) +{ + NS_LOG_FUNCTION (this << packet << from); + m_forwardUp (packet, from, to); +} + +void +QadhocWifiMac::Receive (Ptr packet, WifiMacHeader const *hdr) +{ + NS_LOG_FUNCTION (this << packet << hdr); + NS_ASSERT (!hdr->IsCtl ()); + Mac48Address from = hdr->GetAddr2 (); + Mac48Address to = hdr->GetAddr1 (); + if (hdr->IsData ()) + { + if (hdr->IsQosData () && hdr->IsQosAmsdu ()) + { + NS_LOG_DEBUG ("Received A-MSDU from"<IsMgt ()) + { + //Handling action frames + } +} + +void +QadhocWifiMac::DeaggregateAmsduAndForward (Ptr aggregatedPacket, + WifiMacHeader const *hdr) +{ + DeaggregatedMsdus packets = MsduAggregator::Deaggregate (aggregatedPacket); + for (DeaggregatedMsdusCI i = packets.begin (); i != packets.end (); ++i) + { + ForwardUp ((*i).first, (*i).second.GetSourceAddr (), + (*i).second.GetDestinationAddr ()); + } +} + +Ptr +QadhocWifiMac::GetVOQueue (void) const +{ + return m_voEdca; +} + +Ptr +QadhocWifiMac::GetVIQueue (void) const +{ + return m_viEdca; +} + +Ptr +QadhocWifiMac::GetBEQueue (void) const +{ + return m_beEdca; +} + +Ptr +QadhocWifiMac::GetBKQueue (void) const +{ + return m_bkEdca; +} + +void +QadhocWifiMac::SetVOQueue (Ptr voQueue) +{ + m_voEdca = voQueue; + m_queues.insert (std::make_pair(AC_VO, m_voEdca)); + m_queues[AC_VO]->SetLow (m_low); + m_queues[AC_VO]->SetManager (m_dcfManager); + m_queues[AC_VO]->SetTypeOfStation (ADHOC_STA); + m_queues[AC_VO]->SetTxMiddle (m_txMiddle); +} + +void +QadhocWifiMac::SetVIQueue (Ptr viQueue) +{ + m_viEdca = viQueue; + m_queues.insert (std::make_pair(AC_VI, m_viEdca)); + m_queues[AC_VI]->SetLow (m_low); + m_queues[AC_VI]->SetManager (m_dcfManager); + m_queues[AC_VI]->SetTypeOfStation (ADHOC_STA); + m_queues[AC_VI]->SetTxMiddle (m_txMiddle); +} + +void +QadhocWifiMac::SetBEQueue (Ptr beQueue) +{ + m_beEdca = beQueue; + m_queues.insert (std::make_pair(AC_BE, m_beEdca)); + m_queues[AC_BE]->SetLow (m_low); + m_queues[AC_BE]->SetManager (m_dcfManager); + m_queues[AC_BE]->SetTypeOfStation (ADHOC_STA); + m_queues[AC_BE]->SetTxMiddle (m_txMiddle); +} + +void +QadhocWifiMac::SetBKQueue (Ptr bkQueue) +{ + m_bkEdca = bkQueue; + m_queues.insert (std::make_pair(AC_BK, m_bkEdca)); + m_queues[AC_BK]->SetLow (m_low); + m_queues[AC_BK]->SetManager (m_dcfManager); + m_queues[AC_BK]->SetTypeOfStation (ADHOC_STA); + m_queues[AC_BK]->SetTxMiddle (m_txMiddle); +} + +} //namespace ns3 diff --git a/src/devices/wifi/qadhoc-wifi-mac.h b/src/devices/wifi/qadhoc-wifi-mac.h new file mode 100644 index 000000000..52573c46d --- /dev/null +++ b/src/devices/wifi/qadhoc-wifi-mac.h @@ -0,0 +1,120 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2006, 2009 INRIA + * Copyright (c) 2009 MIRKO BANCHI + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Mathieu Lacage + * Author: Mirko Banchi + */ +#ifndef QADHOC_WIFI_MAC_H +#define QADHOC_WIFI_MAC_H + +#include "ns3/mac48-address.h" +#include "ns3/callback.h" +#include "ns3/packet.h" + +#include "wifi-mac.h" +#include "qos-utils.h" +#include "amsdu-subframe-header.h" + +namespace ns3 { + +class EdcaTxopN; +class WifiMacHeader; +class WifiPhy; +class DcfManager; +class MacLow; +class MacRxMiddle; + +class QadhocWifiMac : public WifiMac +{ +public: + static TypeId GetTypeId (void); + + QadhocWifiMac (); + ~QadhocWifiMac (); + + // all inherited from WifiMac base class. + virtual void SetSlot (Time slotTime); + virtual void SetSifs (Time sifs); + virtual void SetEifsNoDifs (Time eifsNoDifs); + virtual void SetAckTimeout (Time ackTimeout); + virtual void SetCtsTimeout (Time ctsTimeout); + virtual void SetPifs (Time pifs); + virtual Time GetSlot (void) const; + virtual Time GetSifs (void) const; + virtual Time GetEifsNoDifs (void) const; + virtual Time GetAckTimeout (void) const; + virtual Time GetCtsTimeout (void) const; + virtual Time GetPifs (void) const; + virtual void SetWifiPhy (Ptr phy); + virtual void SetWifiRemoteStationManager (Ptr stationManager); + virtual void Enqueue (Ptr packet, Mac48Address to, Mac48Address from); + virtual void Enqueue (Ptr packet, Mac48Address to); + virtual bool SupportsSendFrom (void) const; + virtual void SetForwardUpCallback (Callback, Mac48Address, Mac48Address> upCallback); + virtual void SetLinkUpCallback (Callback linkUp); + virtual void SetLinkDownCallback (Callback linkDown); + virtual Mac48Address GetAddress (void) const; + virtual Ssid GetSsid (void) const; + virtual void SetAddress (Mac48Address address); + virtual void SetSsid (Ssid ssid); + virtual Mac48Address GetBssid (void) const; + +private: + Callback, Mac48Address, Mac48Address> m_forwardUp; + virtual void DoDispose (void); + void Receive (Ptr packet, WifiMacHeader const *hdr); + void ForwardUp (Ptr packet, Mac48Address from, Mac48Address to); + + /** + * When an A-MSDU is received, is deaggregated by this method and all extracted packets are + * forwarded up. + */ + void DeaggregateAmsduAndForward (Ptr aggregatedPacket, WifiMacHeader const *hdr); + + typedef std::map > Queues; + typedef std::list, AmsduSubframeHeader> > DeaggregatedMsdus; + typedef std::list, AmsduSubframeHeader> >::const_iterator DeaggregatedMsdusCI; + + Ptr GetVOQueue (void) const; + Ptr GetVIQueue (void) const; + Ptr GetBEQueue (void) const; + Ptr GetBKQueue (void) const; + + void SetVOQueue (Ptr voQueue); + void SetVIQueue (Ptr viQueue); + void SetBEQueue (Ptr beQueue); + void SetBKQueue (Ptr bkQueue); + + Queues m_queues; + Ptr m_voEdca; + Ptr m_viEdca; + Ptr m_beEdca; + Ptr m_bkEdca; + Ptr m_low; + Ptr m_phy; + Ptr m_stationManager; + MacRxMiddle *m_rxMiddle; + MacTxMiddle *m_txMiddle; + DcfManager *m_dcfManager; + Ssid m_ssid; + Time m_eifsNoDifs; +}; + +} //namespace ns3 + +#endif /* QADHOC_WIFI_MAC_H */ diff --git a/src/devices/wifi/qap-wifi-mac.cc b/src/devices/wifi/qap-wifi-mac.cc new file mode 100644 index 000000000..fae27f94a --- /dev/null +++ b/src/devices/wifi/qap-wifi-mac.cc @@ -0,0 +1,790 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2006, 2009 INRIA + * Copyright (c) 2009 MIRKO BANCHI + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Mathieu Lacage + * Author: Mirko Banchi + */ +#include "ns3/assert.h" +#include "ns3/log.h" +#include "ns3/simulator.h" +#include "ns3/string.h" +#include "ns3/pointer.h" + +#include "qos-tag.h" +#include "qap-wifi-mac.h" +#include "dca-txop.h" +#include "edca-txop-n.h" +#include "wifi-phy.h" +#include "dcf-manager.h" +#include "mac-rx-middle.h" +#include "mac-tx-middle.h" +#include "mgt-headers.h" +#include "mac-low.h" +#include "amsdu-subframe-header.h" +#include "msdu-aggregator.h" + +NS_LOG_COMPONENT_DEFINE ("QapWifiMac"); + +namespace ns3 { + +NS_OBJECT_ENSURE_REGISTERED (QapWifiMac); + +TypeId +QapWifiMac::GetTypeId (void) +{ + static TypeId tid = TypeId ("ns3::QapWifiMac") + .SetParent () + .AddConstructor () + .AddAttribute ("BeaconInterval", "Delay between two beacons", + TimeValue (Seconds (0.1)), + MakeTimeAccessor (&QapWifiMac::GetBeaconInterval, + &QapWifiMac::SetBeaconInterval), + MakeTimeChecker ()) + .AddAttribute ("BeaconGeneration", "Whether or not beacons are generated.", + BooleanValue (true), + MakeBooleanAccessor (&QapWifiMac::SetBeaconGeneration, + &QapWifiMac::GetBeaconGeneration), + MakeBooleanChecker ()) + .AddAttribute ("VO_EdcaTxopN", + "Queue that manages packets belonging to AC_VO access class", + PointerValue (), + MakePointerAccessor(&QapWifiMac::GetVOQueue, + &QapWifiMac::SetVOQueue), + MakePointerChecker ()) + .AddAttribute ("VI_EdcaTxopN", + "Queue that manages packets belonging to AC_VI access class", + PointerValue (), + MakePointerAccessor(&QapWifiMac::GetVIQueue, + &QapWifiMac::SetVIQueue), + MakePointerChecker ()) + .AddAttribute ("BE_EdcaTxopN", + "Queue that manages packets belonging to AC_BE access class", + PointerValue (), + MakePointerAccessor(&QapWifiMac::GetBEQueue, + &QapWifiMac::SetBEQueue), + MakePointerChecker ()) + .AddAttribute ("BK_EdcaTxopN", + "Queue that manages packets belonging to AC_BK access class", + PointerValue (), + MakePointerAccessor(&QapWifiMac::GetBKQueue, + &QapWifiMac::SetBKQueue), + MakePointerChecker ()) + ; + return tid; +} + +QapWifiMac::QapWifiMac () +{ + NS_LOG_FUNCTION (this); + m_rxMiddle = new MacRxMiddle (); + m_rxMiddle->SetForwardCallback (MakeCallback (&QapWifiMac::Receive, this)); + + m_txMiddle = new MacTxMiddle (); + + m_low = CreateObject (); + m_low->SetRxCallback (MakeCallback (&MacRxMiddle::Receive, m_rxMiddle)); + + m_dcfManager = new DcfManager (); + m_dcfManager->SetupLowListener (m_low); + + m_beaconDca = CreateObject (); + m_beaconDca->SetAifsn(1); + m_beaconDca->SetMinCw(0); + m_beaconDca->SetMaxCw(0); + m_beaconDca->SetLow (m_low); + m_beaconDca->SetManager (m_dcfManager); +} + +QapWifiMac::~QapWifiMac () +{ + NS_LOG_FUNCTION (this); +} + +void +QapWifiMac::DoDispose () +{ + delete m_rxMiddle; + m_rxMiddle = 0; + delete m_txMiddle; + m_txMiddle = 0; + delete m_dcfManager; + m_dcfManager = 0; + m_low = 0; + m_phy = 0; + m_beaconDca = 0; + m_beaconEvent.Cancel (); + m_voEdca = 0; + m_viEdca = 0; + m_beEdca = 0; + m_bkEdca = 0; + m_stationManager = 0; + std::map >::iterator it = m_queues.begin (); + for (;it != m_queues.end (); it++) + { + it->second = 0; + } + WifiMac::DoDispose (); +} + +void +QapWifiMac::SetBeaconGeneration (bool enable) +{ + NS_LOG_FUNCTION (this << enable); + if (enable) + { + m_beaconEvent = Simulator::ScheduleNow (&QapWifiMac::SendOneBeacon, this); + } + else + { + m_beaconEvent.Cancel (); + } +} + +bool +QapWifiMac::GetBeaconGeneration (void) const +{ + return m_beaconEvent.IsRunning (); +} + +Time +QapWifiMac::GetBeaconInterval (void) const +{ + return m_beaconInterval; +} + +void +QapWifiMac::SetSlot (Time slotTime) +{ + NS_LOG_FUNCTION (this << slotTime); + m_dcfManager->SetSlot (slotTime); + m_low->SetSlotTime (slotTime); +} + +void +QapWifiMac::SetSifs (Time sifs) +{ + NS_LOG_FUNCTION (this << sifs); + m_dcfManager->SetSifs (sifs); + m_low->SetSifs (sifs); +} + +void +QapWifiMac::SetEifsNoDifs (Time eifsNoDifs) +{ + NS_LOG_FUNCTION (this << eifsNoDifs); + m_dcfManager->SetEifsNoDifs (eifsNoDifs); + m_eifsNoDifs = eifsNoDifs; +} + +void +QapWifiMac::SetAckTimeout (Time ackTimeout) +{ + m_low->SetAckTimeout (ackTimeout); +} + +void +QapWifiMac::SetCtsTimeout (Time ctsTimeout) +{ + m_low->SetCtsTimeout (ctsTimeout); +} + +void +QapWifiMac::SetPifs (Time pifs) +{ + m_low->SetPifs (pifs); +} + +Time +QapWifiMac::GetSlot (void) const +{ + return m_low->GetSlotTime (); +} + +Time +QapWifiMac::GetSifs (void) const +{ + return m_low->GetSifs (); +} + +Time +QapWifiMac::GetEifsNoDifs (void) const +{ + return m_eifsNoDifs; +} + +Time +QapWifiMac::GetAckTimeout (void) const +{ + return m_low->GetAckTimeout (); +} + +Time +QapWifiMac::GetCtsTimeout (void) const +{ + return m_low->GetCtsTimeout (); +} + +Time +QapWifiMac::GetPifs (void) const +{ + return m_low->GetPifs (); +} + +void +QapWifiMac::SetWifiPhy (Ptr phy) +{ + NS_LOG_FUNCTION (this << phy); + m_phy = phy; + m_dcfManager->SetupPhyListener (phy); + m_low->SetPhy (phy); +} + +void +QapWifiMac::SetWifiRemoteStationManager (Ptr stationManager) +{ + NS_LOG_FUNCTION (this << stationManager); + m_stationManager = stationManager; + m_voEdca->SetWifiRemoteStationManager (stationManager); + m_viEdca->SetWifiRemoteStationManager (stationManager); + m_beEdca->SetWifiRemoteStationManager (stationManager); + m_bkEdca->SetWifiRemoteStationManager (stationManager); + m_beaconDca->SetWifiRemoteStationManager (stationManager); + m_low->SetWifiRemoteStationManager (stationManager); +} + +void +QapWifiMac::SetForwardUpCallback (Callback, Mac48Address, Mac48Address> upCallback) +{ + NS_LOG_FUNCTION (this); + m_forwardUp = upCallback; +} + +void +QapWifiMac::SetLinkUpCallback (Callback linkUp) +{ + NS_LOG_FUNCTION (this); + if (!linkUp.IsNull ()) + { + linkUp (); + } +} + +void +QapWifiMac::SetLinkDownCallback (Callback linkDown) +{ + NS_LOG_FUNCTION (this); +} + +Mac48Address +QapWifiMac::GetAddress () const +{ + return m_low->GetAddress (); +} + +Ssid +QapWifiMac::GetSsid (void) const +{ + return m_ssid; +} + +void +QapWifiMac::SetAddress (Mac48Address address) +{ + NS_LOG_FUNCTION (address); + m_low->SetAddress (address); + m_low->SetBssid (address); +} + +void +QapWifiMac::SetSsid (Ssid ssid) +{ + NS_LOG_FUNCTION (this << ssid); + m_ssid = ssid; +} + +Mac48Address +QapWifiMac::GetBssid (void) const +{ + return m_low->GetBssid (); +} + +void +QapWifiMac::SetBeaconInterval (Time interval) +{ + NS_LOG_FUNCTION (this << interval); + m_beaconInterval = interval; +} + +void +QapWifiMac::StartBeaconing (void) +{ + NS_LOG_FUNCTION (this); + SendOneBeacon (); +} + +void +QapWifiMac::ForwardUp (Ptr packet, Mac48Address from, Mac48Address to) +{ + NS_LOG_FUNCTION (this << packet << from); + m_forwardUp (packet, from, to); +} + +void +QapWifiMac::ForwardDown (Ptr packet, Mac48Address from, Mac48Address to) +{ + /* For now Qos AP sends only Qos frame. In the future it should be able to + send frames also to Non-Qos Stas. + */ + NS_LOG_FUNCTION (this << packet << from << to); + WifiMacHeader hdr; + hdr.SetType (WIFI_MAC_QOSDATA); + hdr.SetQosAckPolicy (WifiMacHeader::NORMAL_ACK); + hdr.SetQosNoEosp (); + hdr.SetQosNoAmsdu (); + /* Transmission of multiple frames in the same + Txop is not supported for now */ + hdr.SetQosTxopLimit (0); + + hdr.SetAddr1 (to); + hdr.SetAddr2 (GetAddress ()); + hdr.SetAddr3 (from); + hdr.SetDsFrom (); + hdr.SetDsNotTo (); + + uint8_t tid = QosUtilsGetTidForPacket (packet); + if (tid < 8) + { + hdr.SetQosTid (tid); + AccessClass ac = QosUtilsMapTidToAc (tid); + m_queues[ac]->Queue (packet, hdr); + } + else + { + //packet is considerated belonging to BestEffort AC + hdr.SetQosTid (0); + m_queues[AC_BE]->Queue (packet, hdr); + } +} + +void +QapWifiMac::ForwardDown (Ptr packet, Mac48Address from, Mac48Address to, + WifiMacHeader const *oldHdr) +{ + /* For now Qos AP sends only Qos frame. In the future it should be able to + send frames also to Non-Qos Stas. + */ + NS_LOG_FUNCTION (this << packet << from << to); + NS_ASSERT (oldHdr->IsQosData ()); + WifiMacHeader hdr; + hdr.SetType (WIFI_MAC_QOSDATA); + hdr.SetQosAckPolicy (WifiMacHeader::NORMAL_ACK); + hdr.SetQosNoEosp (); + hdr.SetQosNoAmsdu (); + /* Transmission of multiple frames in the same + Txop is not supported for now */ + hdr.SetQosTxopLimit (0); + hdr.SetQosTid (oldHdr->GetQosTid ()); + + hdr.SetAddr1 (to); + hdr.SetAddr2 (GetAddress ()); + hdr.SetAddr3 (from); + hdr.SetDsFrom (); + hdr.SetDsNotTo (); + + AccessClass ac = QosUtilsMapTidToAc (oldHdr->GetQosTid ()); + m_queues[ac]->Queue (packet, hdr); +} + +void +QapWifiMac::Enqueue (Ptr packet, Mac48Address to, Mac48Address from) +{ + NS_LOG_FUNCTION (this << packet << from << to); + ForwardDown (packet, from, to); +} + +void +QapWifiMac::Enqueue (Ptr packet, Mac48Address to) +{ + NS_LOG_FUNCTION (this << packet << to); + ForwardDown (packet, m_low->GetAddress (), to); +} + +bool +QapWifiMac::SupportsSendFrom (void) const +{ + return true; +} + +SupportedRates +QapWifiMac::GetSupportedRates (void) const +{ + // send the set of supported rates and make sure that we indicate + // the Basic Rate set in this set of supported rates. + SupportedRates rates; + for (uint32_t i = 0; i < m_phy->GetNModes (); i++) + { + WifiMode mode = m_phy->GetMode (i); + rates.AddSupportedRate (mode.GetDataRate ()); + } + // set the basic rates + for (uint32_t j = 0; j < m_stationManager->GetNBasicModes (); j++) + { + WifiMode mode = m_stationManager->GetBasicMode (j); + rates.SetBasicRate (mode.GetDataRate ()); + } + return rates; +} + +void +QapWifiMac::SendProbeResp (Mac48Address to) +{ + NS_LOG_FUNCTION (this << to); + WifiMacHeader hdr; + hdr.SetProbeResp (); + hdr.SetAddr1 (to); + hdr.SetAddr2 (GetAddress ()); + hdr.SetAddr3 (GetAddress ()); + hdr.SetDsNotFrom (); + hdr.SetDsNotTo (); + Ptr packet = Create (); + MgtProbeResponseHeader probe; + probe.SetSsid (GetSsid ()); + probe.SetSupportedRates (GetSupportedRates ()); + probe.SetBeaconIntervalUs (m_beaconInterval.GetMicroSeconds ()); + packet->AddHeader (probe); + + /* Which is correct queue for management frames ? */ + m_queues[AC_VO]->Queue (packet, hdr); +} + +void +QapWifiMac::SendAssocResp (Mac48Address to, bool success) +{ + NS_LOG_FUNCTION (this << to << success); + WifiMacHeader hdr; + hdr.SetAssocResp (); + hdr.SetAddr1 (to); + hdr.SetAddr2 (GetAddress ()); + hdr.SetAddr3 (GetAddress ()); + hdr.SetDsNotFrom (); + hdr.SetDsNotTo (); + Ptr packet = Create (); + MgtAssocResponseHeader assoc; + StatusCode code; + if (success) + { + code.SetSuccess (); + } + else + { + code.SetFailure (); + } + assoc.SetSupportedRates (GetSupportedRates ()); + assoc.SetStatusCode (code); + packet->AddHeader (assoc); + + /* Which is correct queue for management frames ? */ + m_queues[AC_VO]->Queue (packet, hdr); +} + +void +QapWifiMac::SendOneBeacon (void) +{ + NS_LOG_FUNCTION (this); + WifiMacHeader hdr; + hdr.SetBeacon (); + hdr.SetAddr1 (Mac48Address::GetBroadcast ()); + hdr.SetAddr2 (GetAddress ()); + hdr.SetAddr3 (GetAddress ()); + hdr.SetDsNotFrom (); + hdr.SetDsNotTo (); + Ptr packet = Create (); + MgtBeaconHeader beacon; + beacon.SetSsid (GetSsid ()); + beacon.SetSupportedRates (GetSupportedRates ()); + beacon.SetBeaconIntervalUs (m_beaconInterval.GetMicroSeconds ()); + + packet->AddHeader (beacon); + + m_beaconDca->Queue (packet, hdr); + m_beaconEvent = Simulator::Schedule (m_beaconInterval, &QapWifiMac::SendOneBeacon, this); +} + +void +QapWifiMac::TxOk (WifiMacHeader const &hdr) +{ + NS_LOG_FUNCTION (this); + WifiRemoteStation *station = m_stationManager->Lookup (hdr.GetAddr1 ()); + if (hdr.IsAssocResp () && + station->IsWaitAssocTxOk ()) + { + NS_LOG_DEBUG ("associated with sta="<RecordGotAssocTxOk (); + } +} + +void +QapWifiMac::TxFailed (WifiMacHeader const &hdr) +{ + NS_LOG_FUNCTION (this); + WifiRemoteStation *station = m_stationManager->Lookup (hdr.GetAddr1 ()); + if (hdr.IsAssocResp () && + station->IsWaitAssocTxOk ()) + { + NS_LOG_DEBUG ("assoc failed with sta="<RecordGotAssocTxFailed (); + } +} + +void +QapWifiMac::Receive (Ptr packet, WifiMacHeader const *hdr) +{ + NS_LOG_FUNCTION (this << packet << hdr); + + Mac48Address from = hdr->GetAddr2 (); + WifiRemoteStation *fromStation = m_stationManager->Lookup (from); + + if (hdr->IsData ()) + { + Mac48Address bssid = hdr->GetAddr1 (); + if (!hdr->IsFromDs () && + hdr->IsToDs () && + bssid == GetAddress () && + fromStation->IsAssociated ()) + { + Mac48Address to = hdr->GetAddr3 (); + WifiRemoteStation *toStation = m_stationManager->Lookup (to); + + if (to == GetAddress ()) + { + NS_LOG_DEBUG ("frame for me (Qap) from="<IsQosData ()) + { + if (hdr->IsQosAmsdu ()) + { + NS_LOG_DEBUG ("Received A-MSDU from="< + * Author: Mirko Banchi + */ +#ifndef QAP_WIFI_MAC_H +#define QAP_WIFI_MAC_H + +#include "ns3/mac48-address.h" +#include "ns3/callback.h" +#include "ns3/packet.h" +#include "ns3/nstime.h" +#include "ns3/event-id.h" + +#include "supported-rates.h" +#include "wifi-remote-station-manager.h" +#include "wifi-mac.h" +#include "qos-utils.h" + +#include + +namespace ns3 { + +class DcaTxop; +class EdcaTxopN; +class WifiMacHeader; +class WifiPhy; +class MacLow; +class MacRxMiddle; +class MacTxMiddle; +class DcfManager; +class AmsduSubframeHeader; +class MsduAggregator; + +class QapWifiMac : public WifiMac +{ +public: + static TypeId GetTypeId (void); + QapWifiMac (); + virtual ~QapWifiMac (); + + // inherited from WifiMac. + virtual void SetSlot (Time slotTime); + virtual void SetSifs (Time sifs); + virtual void SetEifsNoDifs (Time eifsNoDifs); + virtual void SetAckTimeout (Time ackTimeout); + virtual void SetCtsTimeout (Time ctsTimeout); + virtual void SetPifs (Time pifs); + virtual Time GetSlot (void) const; + virtual Time GetSifs (void) const; + virtual Time GetEifsNoDifs (void) const; + virtual Time GetAckTimeout (void) const; + virtual Time GetCtsTimeout (void) const; + virtual Time GetPifs (void) const; + virtual void SetWifiPhy (Ptr phy); + virtual void SetWifiRemoteStationManager (Ptr stationManager); + virtual void Enqueue (Ptr packet, Mac48Address to, Mac48Address from); + virtual void Enqueue (Ptr packet, Mac48Address to); + virtual bool SupportsSendFrom (void) const; + virtual void SetForwardUpCallback (Callback, Mac48Address, Mac48Address> upCallback); + virtual void SetLinkUpCallback (Callback linkUp); + virtual void SetLinkDownCallback (Callback linkDown); + virtual Mac48Address GetAddress (void) const; + virtual Ssid GetSsid (void) const; + virtual void SetAddress (Mac48Address address); + virtual void SetSsid (Ssid ssid); + virtual Mac48Address GetBssid (void) const; + + void SetBeaconInterval (Time interval); + Time GetBeaconInterval (void) const; + void StartBeaconing (void); + +private: + virtual void DoDispose (void); + void Receive (Ptr packet, WifiMacHeader const *hdr); + void ForwardUp (Ptr packet, Mac48Address from, Mac48Address to); + void ForwardDown (Ptr packet, Mac48Address from, Mac48Address to); + /* Next function is invoked only when ap relies a frame. */ + void ForwardDown (Ptr packet, Mac48Address from, Mac48Address to, + WifiMacHeader const *oldHdr); + void TxOk (WifiMacHeader const &hdr); + void TxFailed (WifiMacHeader const &hdr); + void SendProbeResp (Mac48Address to); + void SendAssocResp (Mac48Address to, bool success); + void SendOneBeacon (void); + SupportedRates GetSupportedRates (void) const; + void SetBeaconGeneration (bool enable); + bool GetBeaconGeneration (void) const; + + void DeaggregateAmsduAndForward (Ptr aggregatedPacket, WifiMacHeader const *hdr); + + typedef std::map > Queues; + typedef std::list, AmsduSubframeHeader> > DeaggregatedMsdus; + typedef std::list, AmsduSubframeHeader> >::const_iterator DeaggregatedMsdusCI; + + Callback, Mac48Address, Mac48Address> m_forwardUp; + + Ptr GetVOQueue (void) const; + Ptr GetVIQueue (void) const; + Ptr GetBEQueue (void) const; + Ptr GetBKQueue (void) const; + + void SetVOQueue (Ptr voQueue); + void SetVIQueue (Ptr viQueue); + void SetBEQueue (Ptr beQueue); + void SetBKQueue (Ptr bkQueue); + + /*Next map is used only for an esay access to a specific queue*/ + Queues m_queues; + Ptr m_voEdca; + Ptr m_viEdca; + Ptr m_beEdca; + Ptr m_bkEdca; + Ptr m_beaconDca; + Ptr m_low; + Ptr m_phy; + Ptr m_stationManager; + MacRxMiddle *m_rxMiddle; + MacTxMiddle *m_txMiddle; + DcfManager *m_dcfManager; + Ssid m_ssid; + EventId m_beaconEvent; + Time m_beaconInterval; + Time m_eifsNoDifs; +}; + +} //namespace ns3 + +#endif /* QAP_WIFI_MAC_H */ diff --git a/src/devices/wifi/qsta-wifi-mac.cc b/src/devices/wifi/qsta-wifi-mac.cc new file mode 100644 index 000000000..3bcaca399 --- /dev/null +++ b/src/devices/wifi/qsta-wifi-mac.cc @@ -0,0 +1,768 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2006, 2009 INRIA + * Copyright (c) 2009 MIRKO BANCHI + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Mathieu Lacage + * Author: Mirko Banchi + */ +#include "ns3/log.h" +#include "ns3/simulator.h" +#include "ns3/string.h" +#include "ns3/pointer.h" + +#include "qos-tag.h" +#include "edca-txop-n.h" +#include "qsta-wifi-mac.h" +#include "mac-low.h" +#include "dcf-manager.h" +#include "mac-rx-middle.h" +#include "mac-tx-middle.h" +#include "wifi-mac-header.h" +#include "msdu-aggregator.h" +#include "amsdu-subframe-header.h" +#include "mgt-headers.h" + +NS_LOG_COMPONENT_DEFINE ("QstaWifiMac"); + +namespace ns3 { + +NS_OBJECT_ENSURE_REGISTERED (QstaWifiMac); + +TypeId +QstaWifiMac::GetTypeId (void) +{ + static TypeId tid = TypeId ("ns3::QstaWifiMac") + .SetParent () + .AddConstructor () + .AddAttribute ("ProbeRequestTimeout", "The interval between two consecutive probe request attempts.", + TimeValue (Seconds (0.05)), + MakeTimeAccessor (&QstaWifiMac::m_probeRequestTimeout), + MakeTimeChecker ()) + .AddAttribute ("AssocRequestTimeout", "The interval between two consecutive assoc request attempts.", + TimeValue (Seconds (0.5)), + MakeTimeAccessor (&QstaWifiMac::m_assocRequestTimeout), + MakeTimeChecker ()) + .AddAttribute ("MaxMissedBeacons", + "Number of beacons which much be consecutively missed before " + "we attempt to restart association.", + UintegerValue (10), + MakeUintegerAccessor (&QstaWifiMac::m_maxMissedBeacons), + MakeUintegerChecker ()) + .AddAttribute ("ActiveProbing", "If true, we send probe requests. If false, we don't.", + BooleanValue (false), + MakeBooleanAccessor (&QstaWifiMac::SetActiveProbing), + MakeBooleanChecker ()) + .AddAttribute ("VO_EdcaTxopN", + "Queue that manages packets belonging to AC_VO access class", + PointerValue (), + MakePointerAccessor(&QstaWifiMac::GetVOQueue, + &QstaWifiMac::SetVOQueue), + MakePointerChecker ()) + .AddAttribute ("VI_EdcaTxopN", + "Queue that manages packets belonging to AC_VI access class", + PointerValue (), + MakePointerAccessor(&QstaWifiMac::GetVIQueue, + &QstaWifiMac::SetVIQueue), + MakePointerChecker ()) + .AddAttribute ("BE_EdcaTxopN", + "Queue that manages packets belonging to AC_BE access class", + PointerValue (), + MakePointerAccessor(&QstaWifiMac::GetBEQueue, + &QstaWifiMac::SetBEQueue), + MakePointerChecker ()) + .AddAttribute ("BK_EdcaTxopN", + "Queue that manages packets belonging to AC_BK access class", + PointerValue (), + MakePointerAccessor(&QstaWifiMac::GetBKQueue, + &QstaWifiMac::SetBKQueue), + MakePointerChecker ()) + ; + return tid; +} + +QstaWifiMac::QstaWifiMac () + : m_state (BEACON_MISSED), + m_probeRequestEvent (), + m_assocRequestEvent (), + m_beaconWatchdogEnd (Seconds (0.0)) +{ + NS_LOG_FUNCTION (this); + m_rxMiddle = new MacRxMiddle (); + m_rxMiddle->SetForwardCallback (MakeCallback (&QstaWifiMac::Receive, this)); + /*TxMiddle can be shared between all queues */ + m_txMiddle= new MacTxMiddle (); + + m_low = CreateObject (); + m_low->SetRxCallback (MakeCallback (&MacRxMiddle::Receive, m_rxMiddle)); + + m_dcfManager = new DcfManager (); + m_dcfManager->SetupLowListener (m_low); +} + +QstaWifiMac::~QstaWifiMac () +{ + NS_LOG_FUNCTION (this); +} + +void +QstaWifiMac::DoDispose () +{ + NS_LOG_FUNCTION (this); + delete m_rxMiddle; + delete m_txMiddle; + delete m_dcfManager; + m_rxMiddle = 0; + m_txMiddle = 0; + m_low = 0; + m_phy = 0; + m_dcfManager = 0; + m_voEdca = 0; + m_viEdca = 0; + m_beEdca = 0; + m_bkEdca = 0; + m_stationManager = 0; + std::map >::iterator it = m_queues.begin (); + for (;it != m_queues.end (); it++) + { + it->second = 0; + } + WifiMac::DoDispose (); +} + +void +QstaWifiMac::SetSlot (Time slotTime) +{ + NS_LOG_FUNCTION (this << slotTime); + m_dcfManager->SetSlot (slotTime); + m_low->SetSlotTime (slotTime); +} + +void +QstaWifiMac::SetSifs (Time sifs) +{ + NS_LOG_FUNCTION (this << sifs); + m_dcfManager->SetSifs (sifs); + m_low->SetSifs (sifs); +} + +void +QstaWifiMac::SetEifsNoDifs (Time eifsNoDifs) +{ + NS_LOG_FUNCTION (this << eifsNoDifs); + m_dcfManager->SetEifsNoDifs (eifsNoDifs); + m_eifsNoDifs = eifsNoDifs; +} + +void +QstaWifiMac::SetAckTimeout (Time ackTimeout) +{ + m_low->SetAckTimeout (ackTimeout); +} + +void +QstaWifiMac::SetCtsTimeout (Time ctsTimeout) +{ + m_low->SetCtsTimeout (ctsTimeout); +} + +void +QstaWifiMac::SetPifs (Time pifs) +{ + m_low->SetPifs (pifs); +} + +Time +QstaWifiMac::GetSlot (void) const +{ + return m_low->GetSlotTime (); +} + +Time +QstaWifiMac::GetSifs (void) const +{ + return m_low->GetSifs (); +} + +Time +QstaWifiMac::GetEifsNoDifs (void) const +{ + return m_eifsNoDifs; +} + +Time +QstaWifiMac::GetAckTimeout (void) const +{ + return m_low->GetAckTimeout (); +} + +Time +QstaWifiMac::GetCtsTimeout (void) const +{ + return m_low->GetCtsTimeout (); +} + +Time +QstaWifiMac::GetPifs (void) const +{ + return m_low->GetPifs (); +} + +void +QstaWifiMac::SetWifiPhy (Ptr phy) +{ + m_phy = phy; + m_dcfManager->SetupPhyListener (phy); + m_low->SetPhy (phy); +} + +void +QstaWifiMac::SetWifiRemoteStationManager (Ptr stationManager) +{ + m_stationManager = stationManager; + m_queues[AC_VO]->SetWifiRemoteStationManager (stationManager); + m_queues[AC_VI]->SetWifiRemoteStationManager (stationManager); + m_queues[AC_BE]->SetWifiRemoteStationManager (stationManager); + m_queues[AC_BK]->SetWifiRemoteStationManager (stationManager); + m_low->SetWifiRemoteStationManager (stationManager); +} + +void +QstaWifiMac::SetForwardUpCallback (Callback, Mac48Address, Mac48Address> upCallback) +{ + m_forwardUp = upCallback; +} + +void +QstaWifiMac::SetLinkUpCallback (Callback linkUp) +{ + m_linkUp = linkUp; +} + +void +QstaWifiMac::SetLinkDownCallback (Callback linkDown) +{ + m_linkDown = linkDown; +} + +Mac48Address +QstaWifiMac::GetAddress (void) const +{ + return m_low->GetAddress (); +} + +Ssid +QstaWifiMac::GetSsid (void) const +{ + return m_ssid; +} + +Mac48Address +QstaWifiMac::GetBssid () const +{ + return m_low->GetBssid (); +} + +void +QstaWifiMac::SetAddress (Mac48Address address) +{ + NS_LOG_FUNCTION (this << address); + m_low->SetAddress (address); +} + +void +QstaWifiMac::SetSsid (Ssid ssid) +{ + NS_LOG_FUNCTION (this << ssid); + m_ssid = ssid; +} + +void +QstaWifiMac::SetMaxMissedBeacons (uint32_t missed) +{ + NS_LOG_FUNCTION (this << missed); + m_maxMissedBeacons = missed; +} + +void +QstaWifiMac::SetProbeRequestTimeout (Time timeout) +{ + NS_LOG_FUNCTION (this << timeout); + m_probeRequestTimeout = timeout; +} + +void +QstaWifiMac::SetAssocRequestTimeout (Time timeout) +{ + NS_LOG_FUNCTION (this << timeout); + m_assocRequestTimeout = timeout; +} + +void +QstaWifiMac::StartActiveAssociation (void) +{ + NS_LOG_FUNCTION (this); + TryToEnsureAssociated (); +} + +Mac48Address +QstaWifiMac::GetBroadcastBssid (void) +{ + return Mac48Address::GetBroadcast (); +} + +void +QstaWifiMac::SetBssid (Mac48Address bssid) +{ + NS_LOG_FUNCTION (this << bssid); + m_low->SetBssid (bssid); +} + +void +QstaWifiMac::SetActiveProbing (bool enable) +{ + NS_LOG_FUNCTION (this << enable); + if (enable) + { + TryToEnsureAssociated (); + } + else + { + m_probeRequestEvent.Cancel (); + } +} + +void +QstaWifiMac::ForwardUp (Ptr packet, Mac48Address from, Mac48Address to) +{ + NS_LOG_FUNCTION (this << packet << from << to); + m_forwardUp (packet, from, to); +} + +void +QstaWifiMac::SendProbeRequest (void) +{ + NS_LOG_FUNCTION (this); + WifiMacHeader hdr; + hdr.SetProbeReq (); + hdr.SetAddr1 (GetBroadcastBssid ()); + hdr.SetAddr2 (GetAddress ()); + hdr.SetAddr3 (GetBroadcastBssid ()); + hdr.SetDsNotFrom (); + hdr.SetDsNotTo (); + Ptr packet = Create (); + MgtProbeRequestHeader probe; + probe.SetSsid (GetSsid ()); + probe.SetSupportedRates (GetSupportedRates ()); + packet->AddHeader (probe); + + /* Which is correct queue for management frames ? */ + m_queues[AC_VO]->Queue (packet, hdr); + + m_probeRequestEvent = Simulator::Schedule (m_probeRequestTimeout, + &QstaWifiMac::ProbeRequestTimeout, this); +} + +void +QstaWifiMac::SendAssociationRequest (void) +{ + NS_LOG_FUNCTION (this << GetBssid ()); + WifiMacHeader hdr; + hdr.SetAssocReq (); + hdr.SetAddr1 (GetBssid ()); + hdr.SetAddr2 (GetAddress ()); + hdr.SetAddr3 (GetBssid ()); + hdr.SetDsNotFrom (); + hdr.SetDsNotTo (); + Ptr packet = Create (); + MgtAssocRequestHeader assoc; + assoc.SetSsid (GetSsid ()); + assoc.SetSupportedRates (GetSupportedRates ()); + packet->AddHeader (assoc); + + /* Which is correct queue for management frames ? */ + m_queues[AC_VO]->Queue (packet, hdr); + + m_assocRequestEvent = Simulator::Schedule (m_assocRequestTimeout, + &QstaWifiMac::AssocRequestTimeout, this); +} + +void +QstaWifiMac::TryToEnsureAssociated (void) +{ + NS_LOG_FUNCTION (this); + switch (m_state) { + case ASSOCIATED: + return; + break; + case WAIT_PROBE_RESP: + /* we have sent a probe request earlier so we + do not need to re-send a probe request immediately. + We just need to wait until probe-request-timeout + or until we get a probe response + */ + break; + case BEACON_MISSED: + /* we were associated but we missed a bunch of beacons + * so we should assume we are not associated anymore. + * We try to initiate a probe request now. + */ + m_linkDown (); + m_state = WAIT_PROBE_RESP; + SendProbeRequest (); + break; + case WAIT_ASSOC_RESP: + /* we have sent an assoc request so we do not need to + re-send an assoc request right now. We just need to + wait until either assoc-request-timeout or until + we get an assoc response. + */ + break; + case REFUSED: + /* we have sent an assoc request and received a negative + assoc resp. We wait until someone restarts an + association with a given ssid. + */ + break; + } +} + +void +QstaWifiMac::AssocRequestTimeout (void) +{ + NS_LOG_FUNCTION (this); + m_state = WAIT_ASSOC_RESP; + SendAssociationRequest (); +} + +void +QstaWifiMac::ProbeRequestTimeout (void) +{ + NS_LOG_FUNCTION (this); + m_state = WAIT_PROBE_RESP; + SendProbeRequest (); +} + +void +QstaWifiMac::MissedBeacons (void) +{ + NS_LOG_FUNCTION (this); + if (m_beaconWatchdogEnd > Simulator::Now ()) + { + m_beaconWatchdog = Simulator::Schedule (m_beaconWatchdogEnd - Simulator::Now (), + &QstaWifiMac::MissedBeacons, this); + return; + } + NS_LOG_DEBUG ("beacon missed"); + m_state = BEACON_MISSED; + TryToEnsureAssociated (); +} + +void +QstaWifiMac::RestartBeaconWatchdog (Time delay) +{ + NS_LOG_FUNCTION (this << delay); + m_beaconWatchdogEnd = std::max (Simulator::Now () + delay, m_beaconWatchdogEnd); + if (Simulator::GetDelayLeft (m_beaconWatchdog) < delay && + m_beaconWatchdog.IsExpired ()) + { + NS_LOG_DEBUG ("really restart watchdog."); + m_beaconWatchdog = Simulator::Schedule (delay, &QstaWifiMac::MissedBeacons, this); + } +} + +bool +QstaWifiMac::IsAssociated () +{ + return (m_state == ASSOCIATED)?true:false; +} + +void +QstaWifiMac::Enqueue (Ptr packet, Mac48Address to) +{ + NS_LOG_FUNCTION (this << packet << to); + if (!IsAssociated ()) + { + TryToEnsureAssociated (); + return; + } + WifiMacHeader hdr; + + hdr.SetType (WIFI_MAC_QOSDATA); + hdr.SetQosAckPolicy (WifiMacHeader::NORMAL_ACK); + hdr.SetQosNoAmsdu (); + hdr.SetQosNoEosp (); + /* Transmission of multiple frames in the same + Txop is not supported for now */ + hdr.SetQosTxopLimit (0); + + hdr.SetAddr1 (GetBssid ()); + hdr.SetAddr2 (m_low->GetAddress ()); + hdr.SetAddr3 (to); + hdr.SetDsNotFrom (); + hdr.SetDsTo (); + + uint8_t tid = QosUtilsGetTidForPacket (packet); + if (tid < 8) + { + hdr.SetQosTid (tid); + AccessClass ac = QosUtilsMapTidToAc (tid); + m_queues[ac]->Queue (packet, hdr); + } + else + { + //packet is considerated belonging to BestEffort Access Class (AC_BE) + hdr.SetQosTid (0); + m_queues[AC_BE]->Queue (packet, hdr); + } +} + +bool +QstaWifiMac::SupportsSendFrom (void) const +{ + return true; +} + +void +QstaWifiMac::Receive (Ptr packet, const WifiMacHeader *hdr) +{ + NS_LOG_FUNCTION (this); + NS_ASSERT (!hdr->IsCtl ()); + if (hdr->GetAddr1 () != GetAddress () && + !hdr->GetAddr1 ().IsBroadcast ()) + { + NS_LOG_LOGIC ("packet is not for us"); + } + else if (hdr->IsData ()) + { + if (!IsAssociated ()) + { + NS_LOG_LOGIC ("Received data frame while not associated: ignore"); + return; + } + if (!(hdr->IsFromDs () && !hdr->IsToDs ())) + { + NS_LOG_LOGIC ("Received data frame not from the DS: ignore"); + return; + } + if (hdr->GetAddr2 () != GetBssid ()) + { + NS_LOG_LOGIC ("Received data frame not from the BSS we are associated with: ignore"); + return; + } + if (hdr->GetAddr3 () != GetAddress ()) + { + if (hdr->IsQosData ()) + { + if (hdr->IsQosAmsdu ()) + { + NS_ASSERT (hdr->GetAddr3 () == GetBssid ()); + DeaggregateAmsduAndForward (packet, hdr); + packet = 0; + } + else + { + ForwardUp (packet, hdr->GetAddr3 (), hdr->GetAddr1 ()); + } + } + else + { + ForwardUp (packet, hdr->GetAddr3 (), hdr->GetAddr1 ()); + } + } + } + else if (hdr->IsBeacon ()) + { + MgtBeaconHeader beacon; + packet->RemoveHeader (beacon); + bool goodBeacon = false; + if (GetSsid ().IsBroadcast () || + beacon.GetSsid ().IsEqual (GetSsid ())) + { + goodBeacon = true; + } + if (IsAssociated () && hdr->GetAddr3 () != GetBssid ()) + { + goodBeacon = false; + } + if (goodBeacon) + { + Time delay = MicroSeconds (beacon.GetBeaconIntervalUs () * m_maxMissedBeacons); + RestartBeaconWatchdog (delay); + SetBssid (hdr->GetAddr3 ()); + } + if (goodBeacon && m_state == BEACON_MISSED) + { + m_state = WAIT_ASSOC_RESP; + SendAssociationRequest (); + } + } + else if (hdr->IsProbeResp ()) + { + if (m_state == WAIT_PROBE_RESP) + { + MgtProbeResponseHeader probeResp; + packet->RemoveHeader (probeResp); + if (!probeResp.GetSsid ().IsEqual (GetSsid ())) + { + //not a probe resp for our ssid. + return; + } + SetBssid (hdr->GetAddr3 ()); + Time delay = MicroSeconds (probeResp.GetBeaconIntervalUs () * m_maxMissedBeacons); + RestartBeaconWatchdog (delay); + if (m_probeRequestEvent.IsRunning ()) + { + m_probeRequestEvent.Cancel (); + } + m_state = WAIT_ASSOC_RESP; + SendAssociationRequest (); + } + } + else if (hdr->IsAssocResp ()) + { + if (m_state == WAIT_ASSOC_RESP) + { + MgtAssocResponseHeader assocResp; + packet->RemoveHeader (assocResp); + if (m_assocRequestEvent.IsRunning ()) + { + m_assocRequestEvent.Cancel (); + } + if (assocResp.GetStatusCode ().IsSuccess ()) + { + m_state = ASSOCIATED; + NS_LOG_DEBUG ("assoc completed"); + SupportedRates rates = assocResp.GetSupportedRates (); + WifiRemoteStation *ap = m_stationManager->Lookup (hdr->GetAddr2 ()); + for (uint32_t i = 0; i < m_phy->GetNModes (); i++) + { + WifiMode mode = m_phy->GetMode (i); + if (rates.IsSupportedRate (mode.GetDataRate ())) + { + ap->AddSupportedMode (mode); + if (rates.IsBasicRate (mode.GetDataRate ())) + { + m_stationManager->AddBasicMode (mode); + } + } + } + if (!m_linkUp.IsNull ()) + { + m_linkUp (); + } + } + else + { + NS_LOG_DEBUG ("assoc refused"); + m_state = REFUSED; + } + } + } +} + +SupportedRates +QstaWifiMac::GetSupportedRates (void) const +{ + SupportedRates rates; + for (uint32_t i = 0; i < m_phy->GetNModes (); i++) + { + WifiMode mode = m_phy->GetMode (i); + rates.AddSupportedRate (mode.GetDataRate ()); + } + return rates; +} + +void +QstaWifiMac::DeaggregateAmsduAndForward (Ptr aggregatedPacket, WifiMacHeader const *hdr) +{ + DeaggregatedMsdus packets = MsduAggregator::Deaggregate (aggregatedPacket); + for (DeaggregatedMsdusCI i = packets.begin (); i != packets.end (); ++i) + { + ForwardUp ((*i).first, (*i).second.GetSourceAddr (), + (*i).second.GetDestinationAddr ()); + } +} + +Ptr +QstaWifiMac::GetVOQueue (void) const +{ + return m_voEdca; +} + +Ptr +QstaWifiMac::GetVIQueue (void) const +{ + return m_viEdca; +} + +Ptr +QstaWifiMac::GetBEQueue (void) const +{ + return m_beEdca; +} + +Ptr +QstaWifiMac::GetBKQueue (void) const +{ + return m_bkEdca; +} + +void +QstaWifiMac::SetVOQueue (Ptr voQueue) +{ + m_voEdca = voQueue; + m_queues.insert (std::make_pair(AC_VO, m_voEdca)); + m_queues[AC_VO]->SetLow (m_low); + m_queues[AC_VO]->SetManager (m_dcfManager); + m_queues[AC_VO]->SetTypeOfStation (STA); + m_queues[AC_VO]->SetTxMiddle (m_txMiddle); +} + +void +QstaWifiMac::SetVIQueue (Ptr viQueue) +{ + m_viEdca = viQueue; + m_queues.insert (std::make_pair(AC_VI, m_viEdca)); + m_queues[AC_VI]->SetLow (m_low); + m_queues[AC_VI]->SetManager (m_dcfManager); + m_queues[AC_VI]->SetTypeOfStation (STA); + m_queues[AC_VI]->SetTxMiddle (m_txMiddle); +} + +void +QstaWifiMac::SetBEQueue (Ptr beQueue) +{ + m_beEdca = beQueue; + m_queues.insert (std::make_pair(AC_BE, m_beEdca)); + m_queues[AC_BE]->SetLow (m_low); + m_queues[AC_BE]->SetManager (m_dcfManager); + m_queues[AC_BE]->SetTypeOfStation (STA); + m_queues[AC_BE]->SetTxMiddle (m_txMiddle); +} + +void +QstaWifiMac::SetBKQueue (Ptr bkQueue) +{ + m_bkEdca = bkQueue; + m_queues.insert (std::make_pair(AC_BK, m_bkEdca)); + m_queues[AC_BK]->SetLow (m_low); + m_queues[AC_BK]->SetManager (m_dcfManager); + m_queues[AC_BK]->SetTypeOfStation (STA); + m_queues[AC_BK]->SetTxMiddle (m_txMiddle); +} + +} //namespace ns3 diff --git a/src/devices/wifi/qsta-wifi-mac.h b/src/devices/wifi/qsta-wifi-mac.h new file mode 100644 index 000000000..68edb913d --- /dev/null +++ b/src/devices/wifi/qsta-wifi-mac.h @@ -0,0 +1,168 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2006, 2009 INRIA + * Copyright (c) 2009 MIRKO BANCHI + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Mathieu Lacage + * Author: Mirko Banchi + */ +#ifndef QSTA_WIFI_MAC_H +#define QSTA_WIFI_MAC_H + +#include "ns3/callback.h" +#include "ns3/packet.h" +#include "ns3/event-id.h" + +#include "wifi-mac.h" +#include "supported-rates.h" +#include "qos-utils.h" + +#include +#include +#include +#include + +namespace ns3 { + +class DcfManager; +class EdcaTxopN; +class MacRxMiddle; +class MacTxMiddle; +class MacLow; +class WifiMacHeader; +class AmsduSubframeHeader; +class MsduAggregator; + +class QstaWifiMac : public WifiMac +{ +public: + static TypeId GetTypeId (void); + + QstaWifiMac (); + virtual ~QstaWifiMac (); + + // inherited from WifiMac. + virtual void SetSlot (Time slotTime); + virtual void SetSifs (Time sifs); + virtual void SetEifsNoDifs (Time eifsNoDifs); + virtual void SetAckTimeout (Time ackTimeout); + virtual void SetCtsTimeout (Time ctsTimeout); + virtual void SetPifs (Time pifs); + virtual Time GetSlot (void) const; + virtual Time GetSifs (void) const; + virtual Time GetEifsNoDifs (void) const; + virtual Time GetAckTimeout (void) const; + virtual Time GetCtsTimeout (void) const; + virtual Time GetPifs (void) const; + virtual void SetWifiPhy (Ptr phy); + virtual void SetWifiRemoteStationManager (Ptr stationManager); + virtual void Enqueue (Ptr packet, Mac48Address to, Mac48Address from){}; + virtual void Enqueue (Ptr packet, Mac48Address to); + virtual bool SupportsSendFrom (void) const; + virtual void SetForwardUpCallback (Callback, Mac48Address, Mac48Address> upCallback); + virtual void SetLinkUpCallback (Callback linkUp); + virtual void SetLinkDownCallback (Callback linkDown); + virtual Mac48Address GetAddress (void) const; + virtual Ssid GetSsid (void) const; + virtual void SetAddress (Mac48Address address); + virtual void SetSsid (Ssid ssid); + virtual Mac48Address GetBssid (void) const; + + void SetMaxMissedBeacons (uint32_t missed); + void SetProbeRequestTimeout (Time timeout); + void SetAssocRequestTimeout (Time timeout); + void StartActiveAssociation (void); + +private: + void SetBssid (Mac48Address bssid); + Mac48Address GetBroadcastBssid (void); + void Receive (Ptr p, const WifiMacHeader *hdr); + void ForwardUp (Ptr packet, Mac48Address from, Mac48Address to); + void SetActiveProbing (bool enable); + bool GetActiveProbing (void) const; + void MissedBeacons (void); + SupportedRates GetSupportedRates (void) const; + void RestartBeaconWatchdog (Time delay); + void AssocRequestTimeout (void); + void ProbeRequestTimeout (void); + void SendAssociationRequest (void); + void SendProbeRequest (void); + void TryToEnsureAssociated (void); + bool IsAssociated (void); + virtual void DoDispose (void); + + /** + * When an A-MSDU is received, is deaggregated by this method and all extracted packets are + * forwarded up. + */ + void DeaggregateAmsduAndForward (Ptr aggregatedPacket, WifiMacHeader const *hdr); + + Ptr GetVOQueue (void) const; + Ptr GetVIQueue (void) const; + Ptr GetBEQueue (void) const; + Ptr GetBKQueue (void) const; + + void SetVOQueue (Ptr voQueue); + void SetVIQueue (Ptr viQueue); + void SetBEQueue (Ptr beQueue); + void SetBKQueue (Ptr bkQueue); + + typedef std::map > Queues; + typedef std::list, AmsduSubframeHeader> > DeaggregatedMsdus; + typedef std::list, AmsduSubframeHeader> >::const_iterator DeaggregatedMsdusCI; + + enum { + ASSOCIATED, + WAIT_PROBE_RESP, + WAIT_ASSOC_RESP, + BEACON_MISSED, + REFUSED + } m_state; + + /*Next map is used only for an esay access to a specific queue*/ + Queues m_queues; + Ptr m_voEdca; + Ptr m_viEdca; + Ptr m_beEdca; + Ptr m_bkEdca; + + Ptr m_low; + Ptr m_phy; + Ptr m_stationManager; + DcfManager *m_dcfManager; + MacRxMiddle *m_rxMiddle; + MacTxMiddle *m_txMiddle; + Ssid m_ssid; + + Callback, Mac48Address, Mac48Address> m_forwardUp; + Callback m_linkUp; + Callback m_linkDown; + + Time m_probeRequestTimeout; + Time m_assocRequestTimeout; + EventId m_probeRequestEvent; + EventId m_assocRequestEvent; + + Time m_beaconWatchdogEnd; + EventId m_beaconWatchdog; + + uint32_t m_maxMissedBeacons; + Time m_eifsNoDifs; +}; + +} //namespace ns3 + +#endif /* QSTA_WIFI_MAC_H */ diff --git a/src/devices/wifi/wscript b/src/devices/wifi/wscript index 7d91299a3..58a5dc08c 100644 --- a/src/devices/wifi/wscript +++ b/src/devices/wifi/wscript @@ -48,6 +48,13 @@ def build(bld): 'wifi-test.cc', 'qos-tag.cc', 'qos-utils.cc', + 'qadhoc-wifi-mac.cc', + 'qap-wifi-mac.cc', + 'qsta-wifi-mac.cc', + 'edca-txop-n.cc', + 'msdu-aggregator.cc', + 'amsdu-subframe-header.cc', + 'msdu-standard-aggregator.cc', ] headers = bld.new_task_gen('ns3header') headers.module = 'wifi' @@ -82,7 +89,14 @@ def build(bld): 'error-rate-model.h', 'yans-error-rate-model.h', 'dca-txop.h', - 'wifi-mac-header.h' + 'wifi-mac-header.h', + 'qadhoc-wifi-mac.h', + 'qap-wifi-mac.h', + 'qsta-wifi-mac.h', + 'qos-utils.h', + 'edca-txop-n.h', + 'msdu-aggregator.h', + 'amsdu-subframe-header.h', ] obj = bld.create_ns3_program('wifi-phy-test', diff --git a/src/helper/qos-wifi-mac-helper.cc b/src/helper/qos-wifi-mac-helper.cc new file mode 100644 index 000000000..634c80cd0 --- /dev/null +++ b/src/helper/qos-wifi-mac-helper.cc @@ -0,0 +1,191 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2009 MIRKO BANCHI + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Mirko Banchi + */ +#include "qos-wifi-mac-helper.h" +#include "ns3/msdu-aggregator.h" +#include "ns3/wifi-mac.h" +#include "ns3/edca-txop-n.h" +#include "ns3/pointer.h" +#include "ns3/uinteger.h" + +namespace ns3 { + +QosWifiMacHelper::QosWifiMacHelper () +{ + m_aggregators.insert (std::make_pair (AC_VO, ObjectFactory ())); + m_aggregators.insert (std::make_pair (AC_VI, ObjectFactory ())); + m_aggregators.insert (std::make_pair (AC_BE, ObjectFactory ())); + m_aggregators.insert (std::make_pair (AC_BK, ObjectFactory ())); + + m_queues.insert (std::make_pair (AC_VO, ObjectFactory ())); + m_queues.insert (std::make_pair (AC_VI, ObjectFactory ())); + m_queues.insert (std::make_pair (AC_BE, ObjectFactory ())); + m_queues.insert (std::make_pair (AC_BK, ObjectFactory ())); + + m_queues[AC_VO].SetTypeId ("ns3::EdcaTxopN"); + m_queues[AC_VI].SetTypeId ("ns3::EdcaTxopN"); + m_queues[AC_BE].SetTypeId ("ns3::EdcaTxopN"); + m_queues[AC_BK].SetTypeId ("ns3::EdcaTxopN"); +} + +QosWifiMacHelper::~QosWifiMacHelper () +{} + +QosWifiMacHelper +QosWifiMacHelper::Default (void) +{ + QosWifiMacHelper helper; + helper.SetType ("ns3::QstaWifiMac"); + /* For more details about this default parameters see IEE802.11 section 7.3.2.29 */ + helper.SetEdcaParametersForAc (AC_VO,"MinCw", UintegerValue (3), + "MaxCw", UintegerValue (7), + "Aifsn", UintegerValue (2)); + helper.SetEdcaParametersForAc (AC_VI,"MinCw", UintegerValue (7), + "MaxCw", UintegerValue (15), + "Aifsn", UintegerValue (2)); + helper.SetEdcaParametersForAc (AC_BE,"MinCw", UintegerValue (15), + "MaxCw", UintegerValue (1023), + "Aifsn", UintegerValue (3)); + helper.SetEdcaParametersForAc (AC_BK,"MinCw", UintegerValue (15), + "MaxCw", UintegerValue (1023), + "Aifsn", UintegerValue (7)); + return helper; +} + +void +QosWifiMacHelper::SetType (std::string type, + std::string n0, const AttributeValue &v0, + std::string n1, const AttributeValue &v1, + std::string n2, const AttributeValue &v2, + std::string n3, const AttributeValue &v3, + std::string n4, const AttributeValue &v4, + std::string n5, const AttributeValue &v5, + std::string n6, const AttributeValue &v6, + std::string n7, const AttributeValue &v7) +{ + m_mac.SetTypeId (type); + m_mac.Set (n0, v0); + m_mac.Set (n1, v1); + m_mac.Set (n2, v2); + m_mac.Set (n3, v3); + m_mac.Set (n4, v4); + m_mac.Set (n5, v5); + m_mac.Set (n6, v6); + m_mac.Set (n7, v7); +} + +void +QosWifiMacHelper::SetMsduAggregatorForAc (AccessClass accessClass, std::string type, + std::string n0, const AttributeValue &v0, + std::string n1, const AttributeValue &v1, + std::string n2, const AttributeValue &v2, + std::string n3, const AttributeValue &v3) +{ + std::map::iterator it; + it = m_aggregators.find (accessClass); + if (it != m_aggregators.end ()) + { + it->second.SetTypeId (type); + it->second.Set (n0, v0); + it->second.Set (n1, v1); + it->second.Set (n2, v2); + it->second.Set (n3, v3); + } +} + +void +QosWifiMacHelper::SetEdcaParametersForAc (AccessClass accessClass, + std::string n0, const AttributeValue &v0, + std::string n1, const AttributeValue &v1, + std::string n2, const AttributeValue &v2, + std::string n3, const AttributeValue &v3) +{ + std::map::iterator it; + it = m_queues.find (accessClass); + if (it != m_queues.end ()) + { + it->second.Set (n0, v0); + it->second.Set (n1, v1); + it->second.Set (n2, v2); + it->second.Set (n3, v3); + } +} + +Ptr +QosWifiMacHelper::Create (void) const +{ + Ptr mac = m_mac.Create (); + + Ptr edcaQueue; + Ptr aggregator; + std::map::const_iterator itQueue; + std::map::const_iterator itAggr; + + /* Setting for VO queue */ + itQueue = m_queues.find (AC_VO); + itAggr = m_aggregators.find (AC_VO); + + edcaQueue = itQueue->second.Create (); + if (itAggr->second.GetTypeId ().GetUid () != 0) + { + aggregator = itAggr->second.Create (); + edcaQueue->SetMsduAggregator (aggregator); + } + mac->SetAttribute ("VO_EdcaTxopN", PointerValue (edcaQueue)); + + /* Setting for VI queue */ + itQueue = m_queues.find (AC_VI); + itAggr = m_aggregators.find (AC_VI); + + edcaQueue = itQueue->second.Create (); + if (itAggr->second.GetTypeId ().GetUid () != 0) + { + aggregator = itAggr->second.Create (); + edcaQueue->SetMsduAggregator (aggregator); + } + mac->SetAttribute ("VI_EdcaTxopN", PointerValue (edcaQueue)); + + /* Setting for BE queue */ + itQueue = m_queues.find (AC_BE); + itAggr = m_aggregators.find (AC_BE); + + edcaQueue = itQueue->second.Create (); + if (itAggr->second.GetTypeId ().GetUid () != 0) + { + aggregator = itAggr->second.Create (); + edcaQueue->SetMsduAggregator (aggregator); + } + mac->SetAttribute ("BE_EdcaTxopN", PointerValue (edcaQueue)); + + /* Setting for BK queue */ + itQueue = m_queues.find (AC_BK); + itAggr = m_aggregators.find (AC_BK); + + edcaQueue = itQueue->second.Create (); + if (itAggr->second.GetTypeId ().GetUid () != 0) + { + aggregator = itAggr->second.Create (); + edcaQueue->SetMsduAggregator (aggregator); + } + mac->SetAttribute ("BK_EdcaTxopN", PointerValue (edcaQueue)); + + return mac; +} + +} //namespace ns3 diff --git a/src/helper/qos-wifi-mac-helper.h b/src/helper/qos-wifi-mac-helper.h new file mode 100644 index 000000000..ea2c6fdcc --- /dev/null +++ b/src/helper/qos-wifi-mac-helper.h @@ -0,0 +1,123 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2009 MIRKO BANCHI + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Mirko Banchi + */ +#ifndef QOS_WIFI_MAC_HELPER_H +#define QOS_WIFI_MAC_HELPER_H + +#include "wifi-helper.h" +#include "ns3/qos-utils.h" + +#include + +namespace ns3 { + +class QosWifiMacHelper : public WifiMacHelper +{ +public: + QosWifiMacHelper (); + virtual ~QosWifiMacHelper (); + /** + * Create a mac helper in a default working state. + */ + static QosWifiMacHelper Default (void); + /** + * \param type the type of ns3::WifiMac to create. + * \param n0 the name of the attribute to set + * \param v0 the value of the attribute to set + * \param n1 the name of the attribute to set + * \param v1 the value of the attribute to set + * \param n2 the name of the attribute to set + * \param v2 the value of the attribute to set + * \param n3 the name of the attribute to set + * \param v3 the value of the attribute to set + * \param n4 the name of the attribute to set + * \param v4 the value of the attribute to set + * \param n5 the name of the attribute to set + * \param v5 the value of the attribute to set + * \param n6 the name of the attribute to set + * \param v6 the value of the attribute to set + * \param n7 the name of the attribute to set + * \param v7 the value of the attribute to set + * + * All the attributes specified in this method should exist + * in the requested mac. + */ + void SetType (std::string type, + std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (), + std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (), + std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (), + std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (), + std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (), + std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (), + std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (), + std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ()); + /** + * \param accessClass access class for which we are setting aggregator. Possibilities + * are: AC_BK, AC_BE, AC_VI, AC_VO. + * \param aggregatorType type of aggregator. + * \param n0 the name of the attribute to set + * \param v0 the value of the attribute to set + * \param n1 the name of the attribute to set + * \param v1 the value of the attribute to set + * \param n2 the name of the attribute to set + * \param v2 the value of the attribute to set + * \param n3 the name of the attribute to set + * \param v3 the value of the attribute to set + * + * All the attributes specified in this method should exist + * in the requested aggregator. + */ + void SetMsduAggregatorForAc (AccessClass accessClass, std::string type, + std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (), + std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (), + std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (), + std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue ()); + /** + * \param accessClass access class for which we are setting edca params. Possibilities + * are: AC_BK, AC_BE, AC_VI, AC_VO. + * \param n0 the name of the attribute to set + * \param v0 the value of the attribute to set + * \param n1 the name of the attribute to set + * \param v1 the value of the attribute to set + * \param n2 the name of the attribute to set + * \param v2 the value of the attribute to set + * \param n3 the name of the attribute to set + * \param v3 the value of the attribute to set + */ + void SetEdcaParametersForAc (AccessClass accessClass, + std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (), + std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (), + std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (), + std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue ()); +private: + /** + * \returns a newly-created MAC object. + * + * This method implements the pure virtual method defined in \ref ns3::WifiMacHelper. + */ + virtual Ptr Create (void) const; + + ObjectFactory m_mac; + std::map m_queues; + std::map m_aggregators; +}; + +} //namespace ns3 + +#endif /* QOS_WIFI_MAC_HELPER_H */ diff --git a/src/helper/wscript b/src/helper/wscript index 46203b155..97825f307 100644 --- a/src/helper/wscript +++ b/src/helper/wscript @@ -24,6 +24,7 @@ def build(bld): 'yans-wifi-helper.cc', 'v4ping-helper.cc', 'nqos-wifi-mac-helper.cc', + 'qos-wifi-mac-helper.cc', ] headers = bld.new_task_gen('ns3header') @@ -50,6 +51,7 @@ def build(bld): 'yans-wifi-helper.h', 'v4ping-helper.h', 'nqos-wifi-mac-helper.h', + 'qos-wifi-mac-helper.h', ] env = bld.env_of_name('default') From 3113083edeff29c67804568c496d8e2c771478e2 Mon Sep 17 00:00:00 2001 From: Faker Moatamri Date: Fri, 24 Apr 2009 11:14:10 +0200 Subject: [PATCH 18/35] bug 377: --lcov-report not working fully --- utils/lcov/geninfo | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/utils/lcov/geninfo b/utils/lcov/geninfo index 2c534dfc8..9e2faec6b 100755 --- a/utils/lcov/geninfo +++ b/utils/lcov/geninfo @@ -1292,6 +1292,12 @@ sub read_gcno_file($) { next; } + #added because if length is zero the following + #reading process will die, it will read garbage + if ($length == 0) + { + next; + } ($blocks, $filename) = read_gcno_string(*INPUT, $endianness); if ($blocks > 1) From 2df852c18ba6071d4043fc07878f9a31af062660 Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Fri, 24 Apr 2009 16:00:44 -0700 Subject: [PATCH 19/35] Add explicit socket close to udp echo for consistency --- src/applications/udp-echo/udp-echo-client.cc | 2 ++ src/applications/udp-echo/udp-echo-server.cc | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/applications/udp-echo/udp-echo-client.cc b/src/applications/udp-echo/udp-echo-client.cc index d92779aa3..4e34020b6 100644 --- a/src/applications/udp-echo/udp-echo-client.cc +++ b/src/applications/udp-echo/udp-echo-client.cc @@ -76,6 +76,7 @@ UdpEchoClient::UdpEchoClient () UdpEchoClient::~UdpEchoClient() { NS_LOG_FUNCTION_NOARGS (); + m_socket = 0; } void @@ -117,6 +118,7 @@ UdpEchoClient::StopApplication () if (m_socket != 0) { + m_socket->Close (); m_socket->SetRecvCallback(MakeNullCallback > ()); } diff --git a/src/applications/udp-echo/udp-echo-server.cc b/src/applications/udp-echo/udp-echo-server.cc index af7747c0a..bc05993cc 100644 --- a/src/applications/udp-echo/udp-echo-server.cc +++ b/src/applications/udp-echo/udp-echo-server.cc @@ -55,6 +55,7 @@ UdpEchoServer::UdpEchoServer () UdpEchoServer::~UdpEchoServer() { NS_LOG_FUNCTION_NOARGS (); + m_socket = 0; } void @@ -87,6 +88,7 @@ UdpEchoServer::StopApplication () if (m_socket != 0) { + m_socket->Close (); m_socket->SetRecvCallback(MakeNullCallback > ()); } } From a8a6bc74c3a247fb7420baf95d37dfdf7aea09b5 Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Sat, 25 Apr 2009 14:56:52 -0700 Subject: [PATCH 20/35] fix texinfo errors --- doc/manual/attributes.texi | 2 +- doc/manual/csma.texi | 8 ++++---- doc/manual/emulation.texi | 2 +- doc/manual/manual.texi | 2 ++ doc/manual/new-models.texi | 2 +- doc/manual/point-to-point.texi | 6 +++--- doc/manual/realtime.texi | 4 ++-- doc/manual/tcp.texi | 2 +- 8 files changed, 15 insertions(+), 13 deletions(-) diff --git a/doc/manual/attributes.texi b/doc/manual/attributes.texi index 5461d7172..35c29a178 100644 --- a/doc/manual/attributes.texi +++ b/doc/manual/attributes.texi @@ -72,7 +72,7 @@ For most basic usage (syntax), treat a smart pointer like a regular pointer: @node CreateObject @subsection CreateObject -As we discussed above in @ref{Object Creation}, +As we discussed above in @ref{CreateObject and Create}, at the lowest-level API, objects of type @code{ns3::Object} are not instantiated using @code{operator new} as usual but instead by a templated function called @code{CreateObject()}. diff --git a/doc/manual/csma.texi b/doc/manual/csma.texi index 73121817a..055306490 100644 --- a/doc/manual/csma.texi +++ b/doc/manual/csma.texi @@ -5,13 +5,13 @@ This is the introduction to CSMA NetDevice chapter, to complement the Csma model doxygen. @menu -* Overview of the model:: +* Overview of the CSMA model:: * Using the CsmaNetDevice:: * CSMA Tracing:: @end menu -@node Overview of the model -@section Overview of the model +@node Overview of the CSMA model +@section Overview of the CSMA model The ns-3 CSMA device models a simple bus network in the spirit of Ethernet. Although it does not model any real physical network you could ever build @@ -254,7 +254,7 @@ takes just one line of code. NetDeviceContainer csmaDevices = csma.Install (csmaNodes); @end verbatim -@node Csma Tracing +@node CSMA Tracing @section CSMA Tracing Like all ns-3 devices, the CSMA Model provides a number of trace sources. diff --git a/doc/manual/emulation.texi b/doc/manual/emulation.texi index 75b1d551c..2da41b556 100644 --- a/doc/manual/emulation.texi +++ b/doc/manual/emulation.texi @@ -4,7 +4,7 @@ ns-3 has been designed for integration into testbed and virtual machine environments. We have addressed this need by providing two kinds of -net devices. The first kind, which we call an @code{Emu} @code {NetDevice} +net devices. The first kind, which we call an @code{Emu} @code{NetDevice} allows ns-3 simulations to send data on a ``real'' network. The second kind, called a @code{Tap} @code{NetDevice} allows a ``real'' host to participate in an ns-3 simulation as if it were one of the simulated nodes. An ns-3 diff --git a/doc/manual/manual.texi b/doc/manual/manual.texi index e99dbe3b6..c2241c22f 100644 --- a/doc/manual/manual.texi +++ b/doc/manual/manual.texi @@ -65,7 +65,9 @@ along with this program. If not, see @uref{http://www.gnu.org/licenses/}. @c So the toc is printed at the start. @anchor{Full Table of Contents} +@ifnottex @contents +@end ifnottex @ifnottex @node Top, Overview, Full Table of Contents diff --git a/doc/manual/new-models.texi b/doc/manual/new-models.texi index fd8dc29c5..86c9f1901 100644 --- a/doc/manual/new-models.texi +++ b/doc/manual/new-models.texi @@ -399,7 +399,7 @@ LOG_COMPONENT_DEFINE is done outside the namespace ns3 @subsection Object Framework - +@verbatim static const ClassId cid; diff --git a/doc/manual/point-to-point.texi b/doc/manual/point-to-point.texi index 48faf05ae..aef61f4bd 100644 --- a/doc/manual/point-to-point.texi +++ b/doc/manual/point-to-point.texi @@ -5,13 +5,13 @@ This is the introduction to PointToPoint NetDevice chapter, to complement the PointToPoint model doxygen. @menu -* Overview of the model:: +* Overview of the PointToPoint model:: * Using the PointToPointNetDevice:: * PointToPoint Tracing:: @end menu -@node Overview of the model -@section Overview of the model +@node Overview of the PointToPoint model +@section Overview of the PointToPoint model The ns-3 point-to-point model is of a very simple point to point data link connecting exactly two PointToPointNetDevice devices over an diff --git a/doc/manual/realtime.texi b/doc/manual/realtime.texi index e5d3c7d4b..5abcec0cf 100644 --- a/doc/manual/realtime.texi +++ b/doc/manual/realtime.texi @@ -77,8 +77,8 @@ fashion is governed by the attributes explained in the previous section. The implementation is contained in the following files: @itemize @bullet -@item @code{src/simulator/realtime-simulator-impl.{cc,h}} -@item @code{src/simulator/wall-clock-synchronizer.{cc,h}} +@item @code{src/simulator/realtime-simulator-impl.@{cc,h@}} +@item @code{src/simulator/wall-clock-synchronizer.@{cc,h@}} @end itemize In order to create a realtime scheduler, to a first approximation you diff --git a/doc/manual/tcp.texi b/doc/manual/tcp.texi index f21315837..5e9f9ef73 100644 --- a/doc/manual/tcp.texi +++ b/doc/manual/tcp.texi @@ -13,7 +13,7 @@ with minimal changes to the scripts. There are two important abstract base classes: @itemize @bullet -@item @code{class TcpSocket}: This is defined in @code{src/node/tcp-socket.{cc,h}}. This class exists for hosting TcpSocket attributes that can be +@item @code{class TcpSocket}: This is defined in @code{src/node/tcp-socket.@{cc,h@}}. This class exists for hosting TcpSocket attributes that can be reused across different implementations. For instance, @code{TcpSocket::SetInitialCwnd()} can be used for any of the implementations that derive from @code{class TcpSocket}. From edec79c2c68232fc733cf5ef0061930ac028bf9a Mon Sep 17 00:00:00 2001 From: Mirko Banchi Date: Sun, 26 Apr 2009 12:49:24 +0200 Subject: [PATCH 21/35] Added new ns-3.5 wifi features in RELEASE_NOTES --- RELEASE_NOTES | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/RELEASE_NOTES b/RELEASE_NOTES index bed5b44b9..12972faaa 100644 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -8,6 +8,23 @@ http://www.nsnam.org including tutorials: http://www.nsnam.org/tutorials.html +Release 3.5 +=========== + +Availability +------------ +This release is scheduled for June/July 2009 + +New user-visible features +------------------------- + a) 802.11e EDCA support: Has been added possibilty to manage QoS traffic on wifi stations. + + b) 802.11n initial support: Has been added support for A-MSDU frame aggregation feature. + +API changes from ns-3.4 +----------------------- +API changes for this release are documented in the file CHANGES.html + Release 3.4 =========== From af293e7d1d77c0d8164d74e0a9c14abe90a58e4b Mon Sep 17 00:00:00 2001 From: Mirko Banchi Date: Sun, 26 Apr 2009 13:27:23 +0200 Subject: [PATCH 22/35] Added API changes for wifi helpers --- CHANGES.html | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/CHANGES.html b/CHANGES.html index 45a26e499..5cccc4117 100644 --- a/CHANGES.html +++ b/CHANGES.html @@ -105,6 +105,32 @@ We provide also an overloaded variant for the multi-address case: Ipv4Address Ipv4InterfaceContainer::GetAddress (uint32_t i) + Ipv4Address Ipv4InterfaceContainer::GetAddress (uint32_t i, uint32_t j) + + + + +
    +
  • new WifiMacHelper objects. +
      +
    • +Type of wifi MAC is now setted by two new specific helpers, NqosWifiMacHelper for non QoS MACs and QosWifiMacHelper for Qos MACs. They are passed as argument to WifiHelper::Install methods.
    • +
      +
      +- void WifiHelper::SetMac (std::string type, std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),...)
      +
      +- NetDeviceContainer WifiHelper::Install (const WifiPhyHelper &phyHelper, NodeContainer c) const
      ++ NetDeviceContainer WifiHelper::Install (const WifiPhyHelper &phyHelper, const WifiMacHelper &macHelper, NodeContainer c) const
      +
      +- NetDeviceContainer WifiHelper::Install (const WifiPhyHelper &phy, Ptr<Node> node) const
      ++ NetDeviceContainer WifiHelper::Install (const WifiPhyHelper &phy, const WifiMacHelper &mac, Ptr<Node> node) const
      +
      +- NetDeviceContainer WifiHelper::Install (const WifiPhyHelper &phy, std::string nodeName) const
      ++ NetDeviceContainer WifiHelper::Install (const WifiPhyHelper &phy, const WifiMacHelper &mac, std::string nodeName) const
      +
      +  see src/helper/nqos-wifi-mac-helper.h
      +      src/helper/qos-wifi-mac-helper.h
      +  for more details.
      +
From 392183de1023b23bb1bc34c86516988d74ec3ef1 Mon Sep 17 00:00:00 2001 From: Mirko Banchi Date: Sun, 26 Apr 2009 23:47:09 +0200 Subject: [PATCH 23/35] Swap values of QosAckPolicy --- src/devices/wifi/wifi-mac-header.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/devices/wifi/wifi-mac-header.cc b/src/devices/wifi/wifi-mac-header.cc index 78acd4d38..3d49525e8 100644 --- a/src/devices/wifi/wifi-mac-header.cc +++ b/src/devices/wifi/wifi-mac-header.cc @@ -317,10 +317,10 @@ void WifiMacHeader::SetQosAckPolicy (enum QosAckPolicy policy) m_qosAckPolicy = 0; break; case NO_ACK : - m_qosAckPolicy = 2; + m_qosAckPolicy = 1; break; case NO_EXPLICIT_ACK : - m_qosAckPolicy = 1; + m_qosAckPolicy = 2; break; case BLOCK_ACK : m_qosAckPolicy = 3; From cb77b5984632d7e99b36ab8e0509e5a8d4a4b693 Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Sun, 26 Apr 2009 15:36:15 -0700 Subject: [PATCH 24/35] fix texinfo warnings --- doc/manual/attributes.texi | 12 ++---------- doc/manual/callbacks.texi | 3 --- doc/manual/manual.texi | 6 ++---- doc/manual/new-models.texi | 8 ++++++++ doc/manual/objects.texi | 10 ++++++++-- doc/manual/random.texi | 14 ++++++++++++++ doc/manual/routing.texi | 13 +++++++++++++ doc/manual/troubleshoot.texi | 5 +++++ 8 files changed, 52 insertions(+), 19 deletions(-) diff --git a/doc/manual/attributes.texi b/doc/manual/attributes.texi index 35c29a178..e24e9caa7 100644 --- a/doc/manual/attributes.texi +++ b/doc/manual/attributes.texi @@ -3,7 +3,7 @@ @anchor{chap:Attributes} @menu -* Object Overview:: +* Object Overview:::: * Attribute Overview:: * Extending attributes:: * Adding new class type:: @@ -54,7 +54,6 @@ from @code{ns3::ObjectBase}. Let's review a couple of properties of these objects. -@node Smart pointers @subsection Smart pointers As introduced in the ns-3 tutorial, ns-3 objects are memory managed by a @@ -69,10 +68,9 @@ For most basic usage (syntax), treat a smart pointer like a regular pointer: // etc. @end verbatim -@node CreateObject @subsection CreateObject -As we discussed above in @ref{CreateObject and Create}, +As we discussed above in @ref{Memory management and class Ptr}, at the lowest-level API, objects of type @code{ns3::Object} are not instantiated using @code{operator new} as usual but instead by a templated function called @code{CreateObject()}. @@ -97,7 +95,6 @@ in the code; this is because there are some helper objects in effect that are doing the CreateObject()s for you. -@node TypeId @subsection TypeId ns-3 classes that derive from class ns3::Object can include @@ -110,7 +107,6 @@ manager systems: @item the set of accessible constructors in the subclass @end itemize -@node Object Summary @subsection Object Summary Putting all of these concepts together, let's look at a specific @@ -175,7 +171,6 @@ organized list of parameters that are settable on the node and its constituent member objects, and help text and default values for each parameter. -@node Functional overview @subsection Functional overview We provide a way for users to access values deep in the system, without @@ -244,7 +239,6 @@ strings such as "MaxPackets" and TypeId strings. In the next section, we will provide an example script that shows how users may manipulate these values. -@node Basic usage @subsection Basic usage Let's look at how a user script might access these values. @@ -379,7 +373,6 @@ effect as the previous Set()) limit.Get () << " packets"); @end verbatim -@node Setting through constructors and helper classes @subsection Setting through constructors helper classes Arbitrary combinations of attributes can be set and fetched from @@ -398,7 +391,6 @@ or from the higher-level helper APIs, such as: "LayoutType", StringValue ("RowFirst")); @end verbatim -@node Value classes @subsection Value classes Readers will note the new FooValue classes which are subclasses of the AttributeValue base class. These can be thought of as diff --git a/doc/manual/callbacks.texi b/doc/manual/callbacks.texi index 38a4f07a6..908fb0c52 100644 --- a/doc/manual/callbacks.texi +++ b/doc/manual/callbacks.texi @@ -129,7 +129,6 @@ to another C++ class member method or C++ function. This is best observed via walking through an example, based on @code{samples/main-callback.cc}. -@node Using the Callback API with static functions @subsection Using the Callback API with static functions Consider a function: @@ -205,7 +204,6 @@ is a function to call behind this callback. Then, @code{one()} returns the same result as if @code{CbOne()} had been called directly. -@node Using the Callback API with member functions @subsection Using the Callback API with member functions Generally, you will not be calling static functions but instead @@ -267,7 +265,6 @@ int main () } @end verbatim -@node Building Null Callbacks @subsection Building Null Callbacks It is possible for callbacks to be null; hence it may be wise to diff --git a/doc/manual/manual.texi b/doc/manual/manual.texi index c2241c22f..726fa23f8 100644 --- a/doc/manual/manual.texi +++ b/doc/manual/manual.texi @@ -65,12 +65,10 @@ along with this program. If not, see @uref{http://www.gnu.org/licenses/}. @c So the toc is printed at the start. @anchor{Full Table of Contents} -@ifnottex -@contents -@end ifnottex +@shortcontents @ifnottex -@node Top, Overview, Full Table of Contents +@node Top @top ns-3 Manual (html version) For a pdf version of this manual, diff --git a/doc/manual/new-models.texi b/doc/manual/new-models.texi index 86c9f1901..a73e3e201 100644 --- a/doc/manual/new-models.texi +++ b/doc/manual/new-models.texi @@ -1,6 +1,14 @@ @node Creating a new ns-3 model @chapter Creating a new ns-3 model +@menu +* Design-approach:: +* Scaffolding:: +* Initial Implementation:: +* Adding-a-sample-script:: +* Build-core-functions-and-unit-tests:: +@end menu + This chapter walks through the design process of an @command{ns-3} model. In many research cases, users will not be satisfied to merely adapt existing models, but may want to extend the core of the simulator in diff --git a/doc/manual/objects.texi b/doc/manual/objects.texi index cf782be9b..5db0b34aa 100644 --- a/doc/manual/objects.texi +++ b/doc/manual/objects.texi @@ -5,6 +5,14 @@ @node Object model @chapter Object model +@menu +* Object model:: +* Object-oriented behavior:: +* Object base classes:: +* Memory management and class Ptr:: +* Downcasting:: +@end menu + @command{ns-3} is fundamentally a C++ object system. Objects can be declared and instantiated as usual, per C++ rules. ns-3 also adds some features to traditional C++ objects, as described below, @@ -129,7 +137,6 @@ memory leaks. These functions are really small convenience functions and their goal is just is save you a small bit of typing. -@node CreateObject and Create @subsection CreateObject and Create Objects in C++ may be statically, dynamically, or automatically created. @@ -155,7 +162,6 @@ a templated helper function is available and recommended to be used: This is simply a wrapper around operator new that correctly handles the reference counting system. -@node Aggregation @subsection Aggregation The ns-3 object aggregation system is motivated in strong part by diff --git a/doc/manual/random.texi b/doc/manual/random.texi index ea083349c..d00ff5a10 100644 --- a/doc/manual/random.texi +++ b/doc/manual/random.texi @@ -2,6 +2,20 @@ @node Random variables @chapter Random variables +@menu +* Quick Overview:: +* Background:: +* Seeding and independent replications:: +* class RandomVariable:: +* Base class public API:: +* Types of RandomVariables:: +* Semantics of RandomVariable objects:: +* Using other PRNG:: +* More advanced usage:: +* Publishing your results:: +* Summary:: +@end menu + ns-3 contains a built-in pseudo-random number generator (PRNG). It is important for serious users of the simulator to understand the functionality, configuration, and usage of this PRNG, and diff --git a/doc/manual/routing.texi b/doc/manual/routing.texi index f7fc6d076..c39f4f4b1 100644 --- a/doc/manual/routing.texi +++ b/doc/manual/routing.texi @@ -1,6 +1,19 @@ @node Routing overview @chapter Routing overview +@menu +* Routing-Overview:: +* Support for multiple routing protocols:: +* Roadmap and Future work:: +* Static routing:: +* Unicast routing:: +* Multicast routing:: +* Global centralized routing:: +* Global Unicast Routing API:: +* Global Routing Implementation:: +* Optimized Link State Routing (OLSR):: +@end menu + This chapter describes the overall design of routing in the @code{src/internet-stack} module, and some details about the routing approachs currently diff --git a/doc/manual/troubleshoot.texi b/doc/manual/troubleshoot.texi index 6ac901d15..623420ae3 100644 --- a/doc/manual/troubleshoot.texi +++ b/doc/manual/troubleshoot.texi @@ -4,6 +4,11 @@ This chapter posts some information about possibly common errors in building or running ns-3 programs. +@menu +* Build errors:: +* Run-time errors:: +@end menu + Please note that the wiki (@uref{http://www.nsnam.org/wiki/index.php/Troubleshooting}) may have contributed items. @node Build errors From 5ff4351d9223a7042d6c3eef92a963ed54191833 Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Sun, 26 Apr 2009 18:20:07 -0700 Subject: [PATCH 25/35] expand emu search for creator, don't check FCS --- src/devices/emu/emu-net-device.cc | 53 ++++++++++++++++++++----------- src/devices/emu/emu-net-device.h | 2 +- 2 files changed, 36 insertions(+), 19 deletions(-) diff --git a/src/devices/emu/emu-net-device.cc b/src/devices/emu/emu-net-device.cc index 6b57baf53..a8f881edd 100644 --- a/src/devices/emu/emu-net-device.cc +++ b/src/devices/emu/emu-net-device.cc @@ -385,7 +385,10 @@ EmuNetDevice::CreateSocket (void) // // Execute the socket creation process image. // - status = ::execl (FindCreator ().c_str (), "emu-sock-creator", oss.str ().c_str (), (char *)NULL); + status = ::execl (FindCreator ("emu-sock-creator").c_str (), + "emu-sock-creator", // argv[0] (filename) + oss.str ().c_str (), // argv[1] (-p locations; - if (::stat (optimized.c_str (), &st) == 0) + // The path to the bits if we're sitting there with them + locations.push_back ("./"); + locations.push_back ("./"); + + // The path to the bits if we're sitting in the root of the repo + locations.push_back ("./build/optimized/src/devices/emu/"); + locations.push_back ("./build/debug/src/devices/emu/"); + + // if at the level of src (or build) + locations.push_back ("../build/optimized/src/devices/emu/"); + locations.push_back ("../build/debug/src/devices/emu/"); + + // src/devices (or build/debug) + locations.push_back ("../../build/optimized/src/devices/emu/"); + locations.push_back ("../../build/debug/src/devices/emu/"); + + // src/devices/emu (or build/debug/examples) + locations.push_back ("../../../build/optimized/src/devices/emu/"); + locations.push_back ("../../../build/debug/src/devices/emu/"); + + for (std::list::const_iterator i = locations.begin (); i != locations.end (); ++i) { - return optimized; + struct stat st; + + if (::stat ((*i + creatorName).c_str (), &st) == 0) + { + NS_LOG_INFO ("Found Creator " << *i + creatorName); + return *i + creatorName; + } } NS_FATAL_ERROR ("EmuNetDevice::FindCreator(): Couldn't find creator"); @@ -586,13 +610,6 @@ EmuNetDevice::ForwardUp (uint8_t *buf, uint32_t len) // Ptr originalPacket = packet->Copy (); - // - // Checksum the packet - // - EthernetTrailer trailer; - packet->RemoveTrailer (trailer); - trailer.CheckFcs (packet); - EthernetHeader header (false); packet->RemoveHeader (header); diff --git a/src/devices/emu/emu-net-device.h b/src/devices/emu/emu-net-device.h index 189a81833..4dbb3ffa6 100644 --- a/src/devices/emu/emu-net-device.h +++ b/src/devices/emu/emu-net-device.h @@ -196,7 +196,7 @@ private: /** * Figure out where the raw socket creation process lives on the system. */ - std::string FindCreator (void); + std::string FindCreator (std::string creatorName); /** * Get a copy of the attached Queue. From 8e75aa36cbeec2deb9179a9d41083fe3742d3ac9 Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Sun, 26 Apr 2009 18:44:03 -0700 Subject: [PATCH 26/35] new emu-ping example --- examples/emu-ping.cc | 217 +++++++++++++++++++++++++++++++++++++++++++ examples/wscript | 6 +- 2 files changed, 221 insertions(+), 2 deletions(-) create mode 100644 examples/emu-ping.cc diff --git a/examples/emu-ping.cc b/examples/emu-ping.cc new file mode 100644 index 000000000..b38461612 --- /dev/null +++ b/examples/emu-ping.cc @@ -0,0 +1,217 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +// Allow ns-3 to ping a real host somewhere, using emulation mode +// +// ------------ +// | node n0 | +// | | +// | --- | +// | | | | +// | |emu| | +// | | | | +// | --- | +// | | | +// ----|------- +// | +// (device on host system, set to promiscuous mode) +// | +// --------- (Internet) ------- +// +// To use this example: +// 1) You need to decide on a physical device on your real system, and either +// overwrite the hard-configured device name below (eth0) or pass this +// device name in as a command-line argument +// 2) The host device must be set to promiscuous mode +// (e.g. "sudo ifconfig eth0 promisc") +// 3) Be aware that ns-3 will generate a fake mac address, and that in +// some enterprise networks, this may be considered bad form to be +// sending packets out of your device with "unauthorized" mac addresses +// 4) You will need to assign an IP address to the ns-3 simulation node that +// is consistent with the subnet that is active on the host device's link. +// That is, you will have to assign an IP address to the ns-3 node as if +// it were on your real subnet. Search for "Ipv4Address localIp" and +// replace the string "1.2.3.4" with a valid IP address. +// 5) You will need to configure a default route in the ns-3 node to tell it +// how to get off of your subnet. One thing you could do is a +// 'netstat -rn' command and find the IP address of the default gateway +// on your host. Search for "Ipv4Address gateway" and replace the string +// "1.2.3.4" string with the gateway IP address. + +#include "ns3/abort.h" +#include "ns3/core-module.h" +#include "ns3/simulator-module.h" +#include "ns3/node-module.h" +#include "ns3/internet-stack-module.h" +#include "ns3/emu-module.h" +#include "ns3/v4ping-module.h" +#include "ns3/helper-module.h" + +using namespace ns3; + +NS_LOG_COMPONENT_DEFINE ("PingEmulationExample"); + +static void +PingRtt (std::string context, Time rtt) +{ + NS_LOG_UNCOND ("Received Response with RTT = " << rtt); +} + +int +main (int argc, char *argv[]) +{ + NS_LOG_INFO ("Ping Emulation Example"); + + std::string deviceName ("eth0"); + std::string remote ("208.77.188.166"); // example.com + + // + // Allow the user to override any of the defaults at run-time, via + // command-line arguments + // + CommandLine cmd; + cmd.AddValue("deviceName", "Device name", deviceName); + cmd.AddValue("remote", "Remote IP address (dotted decimal only please)", remote); + cmd.Parse (argc, argv); + + Ipv4Address remoteIp (remote.c_str ()); + Ipv4Address localIp ("1.2.3.4"); + NS_ABORT_MSG_IF (localIp == "1.2.3.4", "You must change the local IP address before running this example"); + + Ipv4Mask localMask ("255.255.255.0"); + + // + // Since we are using a real piece of hardware we need to use the realtime + // simulator. + // + GlobalValue::Bind ("SimulatorImplementationType", StringValue ("ns3::RealtimeSimulatorImpl")); + + // + // Since we are going to be talking to real-world machines, we need to enable + // calculation of checksums in our protocols. + // + Config::SetDefault ("ns3::Ipv4L3Protocol::CalcChecksum", BooleanValue (true)); + Config::SetDefault ("ns3::Icmpv4L4Protocol::CalcChecksum", BooleanValue (true)); + Config::SetDefault ("ns3::TcpL4Protocol::CalcChecksum", BooleanValue (true)); + Config::SetDefault ("ns3::UdpL4Protocol::CalcChecksum", BooleanValue (true)); + + // + // In such a simple topology, the use of the helper API can be a hindrance + // so we drop down into the low level API and do it manually. + // + // First we need a single node. + // + NS_LOG_INFO ("Create Node"); + Ptr node = CreateObject (); + + // + // Create an emu device, allocate a MAC address and point the device to the + // Linux device name. The device needs a transmit queueing discipline so + // create a droptail queue and give it to the device. Finally, "install" + // the device into the node. + // + // Do understand that the ns-3 allocated MAC address will be sent out over + // your network since the emu net device will spoof it. By default, this + // address will have an Organizationally Unique Identifier (OUI) of zero. + // The Internet Assigned Number Authority IANA + // + // http://www.iana.org/assignments/ethernet-numbers + // + // reports that this OUI is unassigned, and so should not conflict with + // real hardware on your net. It may raise all kinds of red flags in a + // real environment to have packets from a device with an obviously bogus + // OUI flying around. Be aware. + // + NS_LOG_INFO ("Create Device"); + Ptr device = CreateObject (); + device->SetAttribute ("Address", Mac48AddressValue (Mac48Address::Allocate ())); + device->SetAttribute ("DeviceName", StringValue (deviceName)); + + Ptr queue = CreateObject (); + device->SetQueue (queue); + node->AddDevice (device); + + // + // Add a default internet stack to the node. This gets us the ns-3 versions + // of ARP, IPv4, ICMP, UDP and TCP. + // + NS_LOG_INFO ("Add Internet Stack"); + AddInternetStack (node); + + NS_LOG_INFO ("Create IPv4 Interface"); + Ptr ipv4 = node->GetObject (); + uint32_t interface = ipv4->AddInterface (device); + Ipv4InterfaceAddress address = Ipv4InterfaceAddress (localIp, localMask); + ipv4->AddAddress (interface, address); + ipv4->SetMetric (interface, 1); + ipv4->SetUp (interface); + + // + // When the ping appliation sends its ICMP packet, it will happily send it + // down the ns-3 protocol stack. We set the IP address of the destination + // to the address corresponding to example.com above. This address is off + // our local network so we have got to provide some kind of default route + // to ns-3 to be able to get that ICMP packet forwarded off of our network. + // + // You have got to provide an IP address of a real host that you can send + // real packets to and have them forwarded off of your local network. One + // thing you could do is a 'netstat -rn' command and find the IP address of + // the default gateway on your host and add it below, replacing the + // "1.2.3.4" string. + // + Ipv4Address gateway ("1.2.3.4"); + NS_ABORT_MSG_IF (gateway == "1.2.3.4", "You must change the gateway IP address before running this example"); + + ipv4->SetDefaultRoute (gateway, interface); + + // + // Create the ping application. This application knows how to send + // ICMP echo requests. Setting up the packet sink manually is a bit + // of a hassle and since there is no law that says we cannot mix the + // helper API with the low level API, let's just use the helper. + // + NS_LOG_INFO ("Create V4Ping Appliation"); + Ptr app = CreateObject (); + app->SetAttribute ("Remote", Ipv4AddressValue (remoteIp)); + node->AddApplication (app); + app->Start (Seconds (1.0)); + app->Stop (Seconds (5.0)); + + // + // Give the application a name. This makes life much easier when constructing + // config paths. + // + Names::Add ("app", app); + + // + // Hook a trace to print something when the response comes back. + // + Config::Connect ("/Names/app/Rtt", MakeCallback (&PingRtt)); + + // + // Enable a promiscuous pcap trace to see what is coming and going on our device. + // + EmuHelper::EnablePcap ("emu-ping", device, true); + + // + // Now, do the actual emulation. + // + NS_LOG_INFO ("Run Emulation."); + Simulator::Stop (Seconds (5.0)); + Simulator::Run (); + Simulator::Destroy (); + NS_LOG_INFO ("Done."); +} diff --git a/examples/wscript b/examples/wscript index a324e865a..03ea28855 100644 --- a/examples/wscript +++ b/examples/wscript @@ -141,10 +141,12 @@ def build(bld): env = bld.env_of_name('default') if env['ENABLE_EMU']: - obj = bld.create_ns3_program('emu-udp-echo', - ['emu', 'internet-stack']) + obj = bld.create_ns3_program('emu-udp-echo', ['emu', 'internet-stack']) obj.source = 'emu-udp-echo.cc' + obj = bld.create_ns3_program('emu-ping', ['emu', 'internet-stack']) + obj.source = 'emu-ping.cc' + if env['ENABLE_TAP']: obj = bld.create_ns3_program('tap-wifi-dumbbell', ['wifi', 'csma', 'point-to-point', 'tap-bridge', 'internet-stack']) From 0c4d04a0af3423cf8f1a3bdb6064562999e54c3b Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Mon, 27 Apr 2009 09:09:35 +0200 Subject: [PATCH 27/35] bug 558: qos-tag.h is gone missing from wscript --- src/devices/wifi/wscript | 1 + 1 file changed, 1 insertion(+) diff --git a/src/devices/wifi/wscript b/src/devices/wifi/wscript index 58a5dc08c..9218bab67 100644 --- a/src/devices/wifi/wscript +++ b/src/devices/wifi/wscript @@ -97,6 +97,7 @@ def build(bld): 'edca-txop-n.h', 'msdu-aggregator.h', 'amsdu-subframe-header.h', + 'qos-tag.h', ] obj = bld.create_ns3_program('wifi-phy-test', From 9ad38da3988e753d6c718f58b23a977d9514fde3 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Mon, 27 Apr 2009 09:25:05 +0200 Subject: [PATCH 28/35] explain rationale for current GetMulticast methods --- src/node/net-device.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/node/net-device.h b/src/node/net-device.h index dcdaa6d75..dcbd06451 100644 --- a/src/node/net-device.h +++ b/src/node/net-device.h @@ -60,6 +60,17 @@ class Packet; * If you want to write a new MAC layer, you need to subclass * this base class and implement your own version of the * NetDevice::SendTo method. + * + * This class was designed to hide as many MAC-level details as + * possible from the perspective of layer 3 to allow a single layer 3 + * to work with any kind of MAC layer. Specifically, this class + * encapsulates the specific format of MAC addresses used by a + * device such that the layer 3 does not need any modification + * to handle new address formats. This means obviously that the + * NetDevice class must know about the address format of all potential + * layer 3 protocols through its GetMulticast methods: the current + * API has been optimized to make it easy to add new MAC protocols, + * not to add new layer 3 protocols. */ class NetDevice : public Object { From 14323090c0d774030f048bf347c71e57e9b3e4cd Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Mon, 27 Apr 2009 16:49:40 +0200 Subject: [PATCH 29/35] help python bindings --- src/devices/wifi/edca-txop-n.h | 2 ++ src/devices/wifi/qadhoc-wifi-mac.h | 2 ++ src/devices/wifi/qap-wifi-mac.h | 2 ++ src/devices/wifi/qsta-wifi-mac.h | 3 +++ 4 files changed, 9 insertions(+) diff --git a/src/devices/wifi/edca-txop-n.h b/src/devices/wifi/edca-txop-n.h index 497871b61..a89b5292d 100644 --- a/src/devices/wifi/edca-txop-n.h +++ b/src/devices/wifi/edca-txop-n.h @@ -138,6 +138,8 @@ private: */ Mac48Address MapSrcAddressForAggregation (WifiMacHeader const &hdr); Mac48Address MapDestAddressForAggregation (WifiMacHeader const &hdr); + EdcaTxopN &operator = (const EdcaTxopN &); + EdcaTxopN (const EdcaTxopN &); class Dcf; class TransmissionListener; diff --git a/src/devices/wifi/qadhoc-wifi-mac.h b/src/devices/wifi/qadhoc-wifi-mac.h index 52573c46d..a5b16a3f1 100644 --- a/src/devices/wifi/qadhoc-wifi-mac.h +++ b/src/devices/wifi/qadhoc-wifi-mac.h @@ -79,6 +79,8 @@ private: virtual void DoDispose (void); void Receive (Ptr packet, WifiMacHeader const *hdr); void ForwardUp (Ptr packet, Mac48Address from, Mac48Address to); + QadhocWifiMac &operator = (const QadhocWifiMac &); + QadhocWifiMac (const QadhocWifiMac &); /** * When an A-MSDU is received, is deaggregated by this method and all extracted packets are diff --git a/src/devices/wifi/qap-wifi-mac.h b/src/devices/wifi/qap-wifi-mac.h index 063c5a6ad..5ae25dc3c 100644 --- a/src/devices/wifi/qap-wifi-mac.h +++ b/src/devices/wifi/qap-wifi-mac.h @@ -104,6 +104,8 @@ private: bool GetBeaconGeneration (void) const; void DeaggregateAmsduAndForward (Ptr aggregatedPacket, WifiMacHeader const *hdr); + QapWifiMac &operator = (const QapWifiMac &); + QapWifiMac (const QapWifiMac &); typedef std::map > Queues; typedef std::list, AmsduSubframeHeader> > DeaggregatedMsdus; diff --git a/src/devices/wifi/qsta-wifi-mac.h b/src/devices/wifi/qsta-wifi-mac.h index 68edb913d..7e7a1661e 100644 --- a/src/devices/wifi/qsta-wifi-mac.h +++ b/src/devices/wifi/qsta-wifi-mac.h @@ -120,6 +120,9 @@ private: void SetBEQueue (Ptr beQueue); void SetBKQueue (Ptr bkQueue); + QstaWifiMac &operator = (const QstaWifiMac &); + QstaWifiMac (const QstaWifiMac &); + typedef std::map > Queues; typedef std::list, AmsduSubframeHeader> > DeaggregatedMsdus; typedef std::list, AmsduSubframeHeader> >::const_iterator DeaggregatedMsdusCI; From 09191d648efeedaa309c946284e379fc740385ad Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Mon, 27 Apr 2009 16:50:16 +0200 Subject: [PATCH 30/35] rescan python bindings --- bindings/python/callbacks_list.py | 2 +- bindings/python/ns3_module_helper.py | 32 + bindings/python/ns3_module_wifi.py | 810 ++++++++++++++++++++++ bindings/python/ns3modulegen_generated.py | 1 + 4 files changed, 844 insertions(+), 1 deletion(-) diff --git a/bindings/python/callbacks_list.py b/bindings/python/callbacks_list.py index 679214ead..f18b3fc1e 100644 --- a/bindings/python/callbacks_list.py +++ b/bindings/python/callbacks_list.py @@ -1,10 +1,10 @@ callback_classes = [ ['void', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'], + ['void', 'ns3::Ptr', 'ns3::Mac48Address', 'ns3::Mac48Address', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'], ['void', 'ns3::Ptr', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'], ['void', 'ns3::Ptr', 'unsigned int', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'], ['void', 'ns3::Ptr', 'ns3::Address const&', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'], ['bool', 'ns3::Ptr', 'ns3::Address const&', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'], - ['void', 'ns3::Ptr', 'ns3::Mac48Address', 'ns3::Mac48Address', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'], ['void', 'ns3::WifiMacHeader const&', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'], ['bool', 'std::string', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'], ['bool', 'ns3::Ptr', 'ns3::Ptr', 'unsigned short', 'ns3::Address const&', 'ns3::Address const&', 'ns3::NetDevice::PacketType', 'ns3::empty', 'ns3::empty', 'ns3::empty'], diff --git a/bindings/python/ns3_module_helper.py b/bindings/python/ns3_module_helper.py index 2faa17bca..2b4b7f2f5 100644 --- a/bindings/python/ns3_module_helper.py +++ b/bindings/python/ns3_module_helper.py @@ -57,6 +57,8 @@ def register_types(module): module.add_class('YansWifiPhyHelper', allow_subclassing=False, parent=root_module['ns3::WifiPhyHelper']) ## nqos-wifi-mac-helper.h: ns3::NqosWifiMacHelper [class] module.add_class('NqosWifiMacHelper', allow_subclassing=False, parent=root_module['ns3::WifiMacHelper']) + ## qos-wifi-mac-helper.h: ns3::QosWifiMacHelper [class] + module.add_class('QosWifiMacHelper', allow_subclassing=False, parent=root_module['ns3::WifiMacHelper']) ## Register a nested module for the namespace Config @@ -126,6 +128,7 @@ def register_methods(root_module): register_Ns3YansWifiChannelHelper_methods(root_module, root_module['ns3::YansWifiChannelHelper']) register_Ns3YansWifiPhyHelper_methods(root_module, root_module['ns3::YansWifiPhyHelper']) register_Ns3NqosWifiMacHelper_methods(root_module, root_module['ns3::NqosWifiMacHelper']) + register_Ns3QosWifiMacHelper_methods(root_module, root_module['ns3::QosWifiMacHelper']) return def register_Ns3ApplicationContainer_methods(root_module, cls): @@ -1248,6 +1251,35 @@ def register_Ns3NqosWifiMacHelper_methods(root_module, cls): is_const=True, visibility='private', is_virtual=True) return +def register_Ns3QosWifiMacHelper_methods(root_module, cls): + ## qos-wifi-mac-helper.h: ns3::QosWifiMacHelper::QosWifiMacHelper(ns3::QosWifiMacHelper const & arg0) [copy constructor] + cls.add_constructor([param('ns3::QosWifiMacHelper const &', 'arg0')]) + ## qos-wifi-mac-helper.h: ns3::QosWifiMacHelper::QosWifiMacHelper() [constructor] + cls.add_constructor([]) + ## qos-wifi-mac-helper.h: static ns3::QosWifiMacHelper ns3::QosWifiMacHelper::Default() [member function] + cls.add_method('Default', + 'ns3::QosWifiMacHelper', + [], + is_static=True) + ## qos-wifi-mac-helper.h: void ns3::QosWifiMacHelper::SetType(std::string type, std::string n0="", ns3::AttributeValue const & v0=ns3::EmptyAttributeValue(), std::string n1="", ns3::AttributeValue const & v1=ns3::EmptyAttributeValue(), std::string n2="", ns3::AttributeValue const & v2=ns3::EmptyAttributeValue(), std::string n3="", ns3::AttributeValue const & v3=ns3::EmptyAttributeValue(), std::string n4="", ns3::AttributeValue const & v4=ns3::EmptyAttributeValue(), std::string n5="", ns3::AttributeValue const & v5=ns3::EmptyAttributeValue(), std::string n6="", ns3::AttributeValue const & v6=ns3::EmptyAttributeValue(), std::string n7="", ns3::AttributeValue const & v7=ns3::EmptyAttributeValue()) [member function] + cls.add_method('SetType', + 'void', + [param('std::string', 'type'), param('std::string', 'n0', default_value='""'), param('ns3::AttributeValue const &', 'v0', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n1', default_value='""'), param('ns3::AttributeValue const &', 'v1', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n2', default_value='""'), param('ns3::AttributeValue const &', 'v2', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n3', default_value='""'), param('ns3::AttributeValue const &', 'v3', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n4', default_value='""'), param('ns3::AttributeValue const &', 'v4', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n5', default_value='""'), param('ns3::AttributeValue const &', 'v5', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n6', default_value='""'), param('ns3::AttributeValue const &', 'v6', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n7', default_value='""'), param('ns3::AttributeValue const &', 'v7', default_value='ns3::EmptyAttributeValue()')]) + ## qos-wifi-mac-helper.h: void ns3::QosWifiMacHelper::SetMsduAggregatorForAc(ns3::AccessClass accessClass, std::string type, std::string n0="", ns3::AttributeValue const & v0=ns3::EmptyAttributeValue(), std::string n1="", ns3::AttributeValue const & v1=ns3::EmptyAttributeValue(), std::string n2="", ns3::AttributeValue const & v2=ns3::EmptyAttributeValue(), std::string n3="", ns3::AttributeValue const & v3=ns3::EmptyAttributeValue()) [member function] + cls.add_method('SetMsduAggregatorForAc', + 'void', + [param('ns3::AccessClass', 'accessClass'), param('std::string', 'type'), param('std::string', 'n0', default_value='""'), param('ns3::AttributeValue const &', 'v0', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n1', default_value='""'), param('ns3::AttributeValue const &', 'v1', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n2', default_value='""'), param('ns3::AttributeValue const &', 'v2', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n3', default_value='""'), param('ns3::AttributeValue const &', 'v3', default_value='ns3::EmptyAttributeValue()')]) + ## qos-wifi-mac-helper.h: void ns3::QosWifiMacHelper::SetEdcaParametersForAc(ns3::AccessClass accessClass, std::string n0="", ns3::AttributeValue const & v0=ns3::EmptyAttributeValue(), std::string n1="", ns3::AttributeValue const & v1=ns3::EmptyAttributeValue(), std::string n2="", ns3::AttributeValue const & v2=ns3::EmptyAttributeValue(), std::string n3="", ns3::AttributeValue const & v3=ns3::EmptyAttributeValue()) [member function] + cls.add_method('SetEdcaParametersForAc', + 'void', + [param('ns3::AccessClass', 'accessClass'), param('std::string', 'n0', default_value='""'), param('ns3::AttributeValue const &', 'v0', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n1', default_value='""'), param('ns3::AttributeValue const &', 'v1', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n2', default_value='""'), param('ns3::AttributeValue const &', 'v2', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n3', default_value='""'), param('ns3::AttributeValue const &', 'v3', default_value='ns3::EmptyAttributeValue()')]) + ## qos-wifi-mac-helper.h: ns3::Ptr ns3::QosWifiMacHelper::Create() const [member function] + cls.add_method('Create', + 'ns3::Ptr< ns3::WifiMac >', + [], + is_const=True, visibility='private', is_virtual=True) + return + def register_functions(root_module): module = root_module register_functions_ns3_Config(module.get_submodule('Config'), root_module) diff --git a/bindings/python/ns3_module_wifi.py b/bindings/python/ns3_module_wifi.py index 78870a202..e13cc31ea 100644 --- a/bindings/python/ns3_module_wifi.py +++ b/bindings/python/ns3_module_wifi.py @@ -9,6 +9,10 @@ def register_types(module): module.add_enum('WifiPreamble', ['WIFI_PREAMBLE_LONG', 'WIFI_PREAMBLE_SHORT']) ## wifi-phy-standard.h: ns3::WifiPhyStandard [enumeration] module.add_enum('WifiPhyStandard', ['WIFI_PHY_STANDARD_80211a', 'WIFI_PHY_STANDARD_holland']) + ## qos-utils.h: ns3::AccessClass [enumeration] + module.add_enum('AccessClass', ['AC_VO', 'AC_VI', 'AC_BE', 'AC_BK', 'AC_UNDEF']) + ## edca-txop-n.h: ns3::TypeOfStation [enumeration] + module.add_enum('TypeOfStation', ['STA', 'AP', 'ADHOC_STA']) ## interference-helper.h: ns3::InterferenceHelper [class] module.add_class('InterferenceHelper', allow_subclassing=False) ## interference-helper.h: ns3::InterferenceHelper::SnrPer [struct] @@ -43,6 +47,8 @@ def register_types(module): module.add_class('PropagationDelayModel', parent=root_module['ns3::Object']) ## propagation-loss-model.h: ns3::PropagationLossModel [class] module.add_class('PropagationLossModel', parent=root_module['ns3::Object']) + ## qos-tag.h: ns3::QosTag [class] + module.add_class('QosTag', parent=root_module['ns3::Tag']) ## propagation-delay-model.h: ns3::RandomPropagationDelayModel [class] module.add_class('RandomPropagationDelayModel', parent=root_module['ns3::PropagationDelayModel']) ## propagation-loss-model.h: ns3::RandomPropagationLossModel [class] @@ -81,6 +87,8 @@ def register_types(module): module.add_class('AdhocWifiMac', parent=root_module['ns3::WifiMac']) ## amrr-wifi-manager.h: ns3::AmrrWifiManager [class] module.add_class('AmrrWifiManager', parent=root_module['ns3::WifiRemoteStationManager']) + ## amsdu-subframe-header.h: ns3::AmsduSubframeHeader [class] + module.add_class('AmsduSubframeHeader', parent=root_module['ns3::Header']) ## arf-wifi-manager.h: ns3::ArfWifiManager [class] module.add_class('ArfWifiManager', parent=root_module['ns3::WifiRemoteStationManager']) ## constant-rate-wifi-manager.h: ns3::ConstantRateWifiManager [class] @@ -89,6 +97,8 @@ def register_types(module): module.add_class('ConstantSpeedPropagationDelayModel', parent=root_module['ns3::PropagationDelayModel']) ## dca-txop.h: ns3::DcaTxop [class] module.add_class('DcaTxop', parent=root_module['ns3::Object']) + ## edca-txop-n.h: ns3::EdcaTxopN [class] + module.add_class('EdcaTxopN', parent=root_module['ns3::Object']) ## error-rate-model.h: ns3::ErrorRateModel [class] module.add_class('ErrorRateModel', parent=root_module['ns3::Object']) ## propagation-loss-model.h: ns3::FriisPropagationLossModel [class] @@ -99,12 +109,20 @@ def register_types(module): module.add_class('JakesPropagationLossModel', parent=root_module['ns3::PropagationLossModel']) ## propagation-loss-model.h: ns3::LogDistancePropagationLossModel [class] module.add_class('LogDistancePropagationLossModel', parent=root_module['ns3::PropagationLossModel']) + ## msdu-aggregator.h: ns3::MsduAggregator [class] + module.add_class('MsduAggregator', parent=root_module['ns3::Object']) ## nqap-wifi-mac.h: ns3::NqapWifiMac [class] module.add_class('NqapWifiMac', parent=root_module['ns3::WifiMac']) ## nqsta-wifi-mac.h: ns3::NqstaWifiMac [class] module.add_class('NqstaWifiMac', parent=root_module['ns3::WifiMac']) ## onoe-wifi-manager.h: ns3::OnoeWifiManager [class] module.add_class('OnoeWifiManager', parent=root_module['ns3::WifiRemoteStationManager']) + ## qadhoc-wifi-mac.h: ns3::QadhocWifiMac [class] + module.add_class('QadhocWifiMac', parent=root_module['ns3::WifiMac']) + ## qap-wifi-mac.h: ns3::QapWifiMac [class] + module.add_class('QapWifiMac', parent=root_module['ns3::WifiMac']) + ## qsta-wifi-mac.h: ns3::QstaWifiMac [class] + module.add_class('QstaWifiMac', parent=root_module['ns3::WifiMac']) ## rraa-wifi-manager.h: ns3::RraaWifiManager [class] module.add_class('RraaWifiManager', parent=root_module['ns3::WifiRemoteStationManager']) ## wifi-channel.h: ns3::WifiChannel [class] @@ -175,6 +193,7 @@ def register_methods(root_module): register_Ns3OnoeWifiRemoteStation_methods(root_module, root_module['ns3::OnoeWifiRemoteStation']) register_Ns3PropagationDelayModel_methods(root_module, root_module['ns3::PropagationDelayModel']) register_Ns3PropagationLossModel_methods(root_module, root_module['ns3::PropagationLossModel']) + register_Ns3QosTag_methods(root_module, root_module['ns3::QosTag']) register_Ns3RandomPropagationDelayModel_methods(root_module, root_module['ns3::RandomPropagationDelayModel']) register_Ns3RandomPropagationLossModel_methods(root_module, root_module['ns3::RandomPropagationLossModel']) register_Ns3RraaWifiRemoteStation_methods(root_module, root_module['ns3::RraaWifiRemoteStation']) @@ -191,18 +210,24 @@ def register_methods(root_module): register_Ns3AarfWifiRemoteStation_methods(root_module, root_module['ns3::AarfWifiRemoteStation']) register_Ns3AdhocWifiMac_methods(root_module, root_module['ns3::AdhocWifiMac']) register_Ns3AmrrWifiManager_methods(root_module, root_module['ns3::AmrrWifiManager']) + register_Ns3AmsduSubframeHeader_methods(root_module, root_module['ns3::AmsduSubframeHeader']) register_Ns3ArfWifiManager_methods(root_module, root_module['ns3::ArfWifiManager']) register_Ns3ConstantRateWifiManager_methods(root_module, root_module['ns3::ConstantRateWifiManager']) register_Ns3ConstantSpeedPropagationDelayModel_methods(root_module, root_module['ns3::ConstantSpeedPropagationDelayModel']) register_Ns3DcaTxop_methods(root_module, root_module['ns3::DcaTxop']) + register_Ns3EdcaTxopN_methods(root_module, root_module['ns3::EdcaTxopN']) register_Ns3ErrorRateModel_methods(root_module, root_module['ns3::ErrorRateModel']) register_Ns3FriisPropagationLossModel_methods(root_module, root_module['ns3::FriisPropagationLossModel']) register_Ns3IdealWifiManager_methods(root_module, root_module['ns3::IdealWifiManager']) register_Ns3JakesPropagationLossModel_methods(root_module, root_module['ns3::JakesPropagationLossModel']) register_Ns3LogDistancePropagationLossModel_methods(root_module, root_module['ns3::LogDistancePropagationLossModel']) + register_Ns3MsduAggregator_methods(root_module, root_module['ns3::MsduAggregator']) register_Ns3NqapWifiMac_methods(root_module, root_module['ns3::NqapWifiMac']) register_Ns3NqstaWifiMac_methods(root_module, root_module['ns3::NqstaWifiMac']) register_Ns3OnoeWifiManager_methods(root_module, root_module['ns3::OnoeWifiManager']) + register_Ns3QadhocWifiMac_methods(root_module, root_module['ns3::QadhocWifiMac']) + register_Ns3QapWifiMac_methods(root_module, root_module['ns3::QapWifiMac']) + register_Ns3QstaWifiMac_methods(root_module, root_module['ns3::QstaWifiMac']) register_Ns3RraaWifiManager_methods(root_module, root_module['ns3::RraaWifiManager']) register_Ns3WifiChannel_methods(root_module, root_module['ns3::WifiChannel']) register_Ns3WifiNetDevice_methods(root_module, root_module['ns3::WifiNetDevice']) @@ -1045,6 +1070,52 @@ def register_Ns3PropagationLossModel_methods(root_module, cls): is_pure_virtual=True, is_const=True, visibility='private', is_virtual=True) return +def register_Ns3QosTag_methods(root_module, cls): + ## qos-tag.h: ns3::QosTag::QosTag(ns3::QosTag const & arg0) [copy constructor] + cls.add_constructor([param('ns3::QosTag const &', 'arg0')]) + ## qos-tag.h: static ns3::TypeId ns3::QosTag::GetTypeId() [member function] + cls.add_method('GetTypeId', + 'ns3::TypeId', + [], + is_static=True) + ## qos-tag.h: ns3::TypeId ns3::QosTag::GetInstanceTypeId() const [member function] + cls.add_method('GetInstanceTypeId', + 'ns3::TypeId', + [], + is_const=True, is_virtual=True) + ## qos-tag.h: ns3::QosTag::QosTag() [constructor] + cls.add_constructor([]) + ## qos-tag.h: void ns3::QosTag::Serialize(ns3::TagBuffer i) const [member function] + cls.add_method('Serialize', + 'void', + [param('ns3::TagBuffer', 'i')], + is_const=True, is_virtual=True) + ## qos-tag.h: void ns3::QosTag::Deserialize(ns3::TagBuffer i) [member function] + cls.add_method('Deserialize', + 'void', + [param('ns3::TagBuffer', 'i')], + is_virtual=True) + ## qos-tag.h: uint32_t ns3::QosTag::GetSerializedSize() const [member function] + cls.add_method('GetSerializedSize', + 'uint32_t', + [], + is_const=True, is_virtual=True) + ## qos-tag.h: void ns3::QosTag::Print(std::ostream & os) const [member function] + cls.add_method('Print', + 'void', + [param('std::ostream &', 'os')], + is_const=True, is_virtual=True) + ## qos-tag.h: uint8_t ns3::QosTag::Get() const [member function] + cls.add_method('Get', + 'uint8_t', + [], + is_const=True) + ## qos-tag.h: void ns3::QosTag::Set(uint8_t tid) [member function] + cls.add_method('Set', + 'void', + [param('uint8_t', 'tid')]) + return + def register_Ns3RandomPropagationDelayModel_methods(root_module, cls): ## propagation-delay-model.h: ns3::RandomPropagationDelayModel::RandomPropagationDelayModel(ns3::RandomPropagationDelayModel const & arg0) [copy constructor] cls.add_constructor([param('ns3::RandomPropagationDelayModel const &', 'arg0')]) @@ -2464,6 +2535,70 @@ def register_Ns3AmrrWifiManager_methods(root_module, cls): visibility='private', is_virtual=True) return +def register_Ns3AmsduSubframeHeader_methods(root_module, cls): + ## amsdu-subframe-header.h: ns3::AmsduSubframeHeader::AmsduSubframeHeader(ns3::AmsduSubframeHeader const & arg0) [copy constructor] + cls.add_constructor([param('ns3::AmsduSubframeHeader const &', 'arg0')]) + ## amsdu-subframe-header.h: ns3::AmsduSubframeHeader::AmsduSubframeHeader() [constructor] + cls.add_constructor([]) + ## amsdu-subframe-header.h: static ns3::TypeId ns3::AmsduSubframeHeader::GetTypeId() [member function] + cls.add_method('GetTypeId', + 'ns3::TypeId', + [], + is_static=True) + ## amsdu-subframe-header.h: ns3::TypeId ns3::AmsduSubframeHeader::GetInstanceTypeId() const [member function] + cls.add_method('GetInstanceTypeId', + 'ns3::TypeId', + [], + is_const=True, is_virtual=True) + ## amsdu-subframe-header.h: void ns3::AmsduSubframeHeader::Print(std::ostream & os) const [member function] + cls.add_method('Print', + 'void', + [param('std::ostream &', 'os')], + is_const=True, is_virtual=True) + ## amsdu-subframe-header.h: uint32_t ns3::AmsduSubframeHeader::GetSerializedSize() const [member function] + cls.add_method('GetSerializedSize', + 'uint32_t', + [], + is_const=True, is_virtual=True) + ## amsdu-subframe-header.h: void ns3::AmsduSubframeHeader::Serialize(ns3::Buffer::Iterator start) const [member function] + cls.add_method('Serialize', + 'void', + [param('ns3::Buffer::Iterator', 'start')], + is_const=True, is_virtual=True) + ## amsdu-subframe-header.h: uint32_t ns3::AmsduSubframeHeader::Deserialize(ns3::Buffer::Iterator start) [member function] + cls.add_method('Deserialize', + 'uint32_t', + [param('ns3::Buffer::Iterator', 'start')], + is_virtual=True) + ## amsdu-subframe-header.h: void ns3::AmsduSubframeHeader::SetDestinationAddr(ns3::Mac48Address to) [member function] + cls.add_method('SetDestinationAddr', + 'void', + [param('ns3::Mac48Address', 'to')]) + ## amsdu-subframe-header.h: void ns3::AmsduSubframeHeader::SetSourceAddr(ns3::Mac48Address to) [member function] + cls.add_method('SetSourceAddr', + 'void', + [param('ns3::Mac48Address', 'to')]) + ## amsdu-subframe-header.h: void ns3::AmsduSubframeHeader::SetLength(uint16_t arg0) [member function] + cls.add_method('SetLength', + 'void', + [param('uint16_t', 'arg0')]) + ## amsdu-subframe-header.h: ns3::Mac48Address ns3::AmsduSubframeHeader::GetDestinationAddr() const [member function] + cls.add_method('GetDestinationAddr', + 'ns3::Mac48Address', + [], + is_const=True) + ## amsdu-subframe-header.h: ns3::Mac48Address ns3::AmsduSubframeHeader::GetSourceAddr() const [member function] + cls.add_method('GetSourceAddr', + 'ns3::Mac48Address', + [], + is_const=True) + ## amsdu-subframe-header.h: uint16_t ns3::AmsduSubframeHeader::GetLength() const [member function] + cls.add_method('GetLength', + 'uint16_t', + [], + is_const=True) + return + def register_Ns3ArfWifiManager_methods(root_module, cls): ## arf-wifi-manager.h: ns3::ArfWifiManager::ArfWifiManager(ns3::ArfWifiManager const & arg0) [copy constructor] cls.add_constructor([param('ns3::ArfWifiManager const &', 'arg0')]) @@ -2608,6 +2743,202 @@ def register_Ns3DcaTxop_methods(root_module, cls): visibility='private', is_virtual=True) return +def register_Ns3EdcaTxopN_methods(root_module, cls): + ## edca-txop-n.h: static ns3::TypeId ns3::EdcaTxopN::GetTypeId() [member function] + cls.add_method('GetTypeId', + 'ns3::TypeId', + [], + is_static=True) + ## edca-txop-n.h: ns3::EdcaTxopN::EdcaTxopN() [constructor] + cls.add_constructor([]) + ## edca-txop-n.h: void ns3::EdcaTxopN::DoDispose() [member function] + cls.add_method('DoDispose', + 'void', + [], + is_virtual=True) + ## edca-txop-n.h: void ns3::EdcaTxopN::SetLow(ns3::Ptr low) [member function] + cls.add_method('SetLow', + 'void', + [param('ns3::Ptr< ns3::MacLow >', 'low')]) + ## edca-txop-n.h: void ns3::EdcaTxopN::SetTxMiddle(ns3::MacTxMiddle * txMiddle) [member function] + cls.add_method('SetTxMiddle', + 'void', + [param('ns3::MacTxMiddle *', 'txMiddle')]) + ## edca-txop-n.h: void ns3::EdcaTxopN::SetManager(ns3::DcfManager * manager) [member function] + cls.add_method('SetManager', + 'void', + [param('ns3::DcfManager *', 'manager')]) + ## edca-txop-n.h: void ns3::EdcaTxopN::SetTxOkCallback(ns3::Callback callback) [member function] + cls.add_method('SetTxOkCallback', + 'void', + [param('ns3::Callback< void, ns3::WifiMacHeader const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')]) + ## edca-txop-n.h: void ns3::EdcaTxopN::SetTxFailedCallback(ns3::Callback callback) [member function] + cls.add_method('SetTxFailedCallback', + 'void', + [param('ns3::Callback< void, ns3::WifiMacHeader const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')]) + ## edca-txop-n.h: void ns3::EdcaTxopN::SetWifiRemoteStationManager(ns3::Ptr remoteManager) [member function] + cls.add_method('SetWifiRemoteStationManager', + 'void', + [param('ns3::Ptr< ns3::WifiRemoteStationManager >', 'remoteManager')]) + ## edca-txop-n.h: void ns3::EdcaTxopN::SetTypeOfStation(ns3::TypeOfStation type) [member function] + cls.add_method('SetTypeOfStation', + 'void', + [param('ns3::TypeOfStation', 'type')]) + ## edca-txop-n.h: ns3::TypeOfStation ns3::EdcaTxopN::GetTypeOfStation() const [member function] + cls.add_method('GetTypeOfStation', + 'ns3::TypeOfStation', + [], + is_const=True) + ## edca-txop-n.h: void ns3::EdcaTxopN::SetMaxQueueSize(uint32_t size) [member function] + cls.add_method('SetMaxQueueSize', + 'void', + [param('uint32_t', 'size')]) + ## edca-txop-n.h: void ns3::EdcaTxopN::SetMaxQueueDelay(ns3::Time delay) [member function] + cls.add_method('SetMaxQueueDelay', + 'void', + [param('ns3::Time', 'delay')]) + ## edca-txop-n.h: void ns3::EdcaTxopN::SetMinCw(uint32_t minCw) [member function] + cls.add_method('SetMinCw', + 'void', + [param('uint32_t', 'minCw')]) + ## edca-txop-n.h: void ns3::EdcaTxopN::SetMaxCw(uint32_t maxCw) [member function] + cls.add_method('SetMaxCw', + 'void', + [param('uint32_t', 'maxCw')]) + ## edca-txop-n.h: void ns3::EdcaTxopN::SetAifsn(uint32_t aifsn) [member function] + cls.add_method('SetAifsn', + 'void', + [param('uint32_t', 'aifsn')]) + ## edca-txop-n.h: uint32_t ns3::EdcaTxopN::GetMinCw() const [member function] + cls.add_method('GetMinCw', + 'uint32_t', + [], + is_const=True) + ## edca-txop-n.h: uint32_t ns3::EdcaTxopN::GetMaxCw() const [member function] + cls.add_method('GetMaxCw', + 'uint32_t', + [], + is_const=True) + ## edca-txop-n.h: uint32_t ns3::EdcaTxopN::GetAifsn() const [member function] + cls.add_method('GetAifsn', + 'uint32_t', + [], + is_const=True) + ## edca-txop-n.h: ns3::Ptr ns3::EdcaTxopN::Low() [member function] + cls.add_method('Low', + 'ns3::Ptr< ns3::MacLow >', + []) + ## edca-txop-n.h: ns3::Ptr ns3::EdcaTxopN::GetMsduAggregator() const [member function] + cls.add_method('GetMsduAggregator', + 'ns3::Ptr< ns3::MsduAggregator >', + [], + is_const=True) + ## edca-txop-n.h: bool ns3::EdcaTxopN::NeedsAccess() const [member function] + cls.add_method('NeedsAccess', + 'bool', + [], + is_const=True) + ## edca-txop-n.h: void ns3::EdcaTxopN::NotifyAccessGranted() [member function] + cls.add_method('NotifyAccessGranted', + 'void', + []) + ## edca-txop-n.h: void ns3::EdcaTxopN::NotifyInternalCollision() [member function] + cls.add_method('NotifyInternalCollision', + 'void', + []) + ## edca-txop-n.h: void ns3::EdcaTxopN::NotifyCollision() [member function] + cls.add_method('NotifyCollision', + 'void', + []) + ## edca-txop-n.h: void ns3::EdcaTxopN::GotCts(double snr, ns3::WifiMode txMode) [member function] + cls.add_method('GotCts', + 'void', + [param('double', 'snr'), param('ns3::WifiMode', 'txMode')]) + ## edca-txop-n.h: void ns3::EdcaTxopN::MissedCts() [member function] + cls.add_method('MissedCts', + 'void', + []) + ## edca-txop-n.h: void ns3::EdcaTxopN::GotAck(double snr, ns3::WifiMode txMode) [member function] + cls.add_method('GotAck', + 'void', + [param('double', 'snr'), param('ns3::WifiMode', 'txMode')]) + ## edca-txop-n.h: void ns3::EdcaTxopN::MissedAck() [member function] + cls.add_method('MissedAck', + 'void', + []) + ## edca-txop-n.h: void ns3::EdcaTxopN::StartNext() [member function] + cls.add_method('StartNext', + 'void', + []) + ## edca-txop-n.h: void ns3::EdcaTxopN::Cancel() [member function] + cls.add_method('Cancel', + 'void', + []) + ## edca-txop-n.h: void ns3::EdcaTxopN::RestartAccessIfNeeded() [member function] + cls.add_method('RestartAccessIfNeeded', + 'void', + []) + ## edca-txop-n.h: void ns3::EdcaTxopN::StartAccessIfNeeded() [member function] + cls.add_method('StartAccessIfNeeded', + 'void', + []) + ## edca-txop-n.h: bool ns3::EdcaTxopN::NeedRts() [member function] + cls.add_method('NeedRts', + 'bool', + []) + ## edca-txop-n.h: bool ns3::EdcaTxopN::NeedRtsRetransmission() [member function] + cls.add_method('NeedRtsRetransmission', + 'bool', + []) + ## edca-txop-n.h: bool ns3::EdcaTxopN::NeedDataRetransmission() [member function] + cls.add_method('NeedDataRetransmission', + 'bool', + []) + ## edca-txop-n.h: bool ns3::EdcaTxopN::NeedFragmentation() const [member function] + cls.add_method('NeedFragmentation', + 'bool', + [], + is_const=True) + ## edca-txop-n.h: uint32_t ns3::EdcaTxopN::GetNextFragmentSize() [member function] + cls.add_method('GetNextFragmentSize', + 'uint32_t', + []) + ## edca-txop-n.h: uint32_t ns3::EdcaTxopN::GetFragmentSize() [member function] + cls.add_method('GetFragmentSize', + 'uint32_t', + []) + ## edca-txop-n.h: uint32_t ns3::EdcaTxopN::GetFragmentOffset() [member function] + cls.add_method('GetFragmentOffset', + 'uint32_t', + []) + ## edca-txop-n.h: ns3::WifiRemoteStation * ns3::EdcaTxopN::GetStation(ns3::Mac48Address to) const [member function] + cls.add_method('GetStation', + 'ns3::WifiRemoteStation *', + [param('ns3::Mac48Address', 'to')], + is_const=True) + ## edca-txop-n.h: bool ns3::EdcaTxopN::IsLastFragment() const [member function] + cls.add_method('IsLastFragment', + 'bool', + [], + is_const=True) + ## edca-txop-n.h: void ns3::EdcaTxopN::NextFragment() [member function] + cls.add_method('NextFragment', + 'void', + []) + ## edca-txop-n.h: ns3::Ptr ns3::EdcaTxopN::GetFragmentPacket(ns3::WifiMacHeader * hdr) [member function] + cls.add_method('GetFragmentPacket', + 'ns3::Ptr< ns3::Packet >', + [param('ns3::WifiMacHeader *', 'hdr')]) + ## edca-txop-n.h: void ns3::EdcaTxopN::Queue(ns3::Ptr packet, ns3::WifiMacHeader const & hdr) [member function] + cls.add_method('Queue', + 'void', + [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::WifiMacHeader const &', 'hdr')]) + ## edca-txop-n.h: void ns3::EdcaTxopN::SetMsduAggregator(ns3::Ptr aggr) [member function] + cls.add_method('SetMsduAggregator', + 'void', + [param('ns3::Ptr< ns3::MsduAggregator >', 'aggr')]) + return + def register_Ns3ErrorRateModel_methods(root_module, cls): ## error-rate-model.h: ns3::ErrorRateModel::ErrorRateModel(ns3::ErrorRateModel const & arg0) [copy constructor] cls.add_constructor([param('ns3::ErrorRateModel const &', 'arg0')]) @@ -2758,6 +3089,28 @@ def register_Ns3LogDistancePropagationLossModel_methods(root_module, cls): is_const=True, visibility='private', is_virtual=True) return +def register_Ns3MsduAggregator_methods(root_module, cls): + ## msdu-aggregator.h: ns3::MsduAggregator::MsduAggregator(ns3::MsduAggregator const & arg0) [copy constructor] + cls.add_constructor([param('ns3::MsduAggregator const &', 'arg0')]) + ## msdu-aggregator.h: ns3::MsduAggregator::MsduAggregator() [constructor] + cls.add_constructor([]) + ## msdu-aggregator.h: static ns3::TypeId ns3::MsduAggregator::GetTypeId() [member function] + cls.add_method('GetTypeId', + 'ns3::TypeId', + [], + is_static=True) + ## msdu-aggregator.h: bool ns3::MsduAggregator::Aggregate(ns3::Ptr packet, ns3::Ptr aggregatedPacket, ns3::Mac48Address src, ns3::Mac48Address dest) [member function] + cls.add_method('Aggregate', + 'bool', + [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Ptr< ns3::Packet >', 'aggregatedPacket'), param('ns3::Mac48Address', 'src'), param('ns3::Mac48Address', 'dest')], + is_pure_virtual=True, is_virtual=True) + ## msdu-aggregator.h: static std::list, ns3::AmsduSubframeHeader>, std::allocator, ns3::AmsduSubframeHeader> > > ns3::MsduAggregator::Deaggregate(ns3::Ptr aggregatedPacket) [member function] + cls.add_method('Deaggregate', + 'std::list< std::pair< ns3::Ptr< ns3::Packet >, ns3::AmsduSubframeHeader > >', + [param('ns3::Ptr< ns3::Packet >', 'aggregatedPacket')], + is_static=True) + return + def register_Ns3NqapWifiMac_methods(root_module, cls): ## nqap-wifi-mac.h: static ns3::TypeId ns3::NqapWifiMac::GetTypeId() [member function] cls.add_method('GetTypeId', @@ -3084,6 +3437,455 @@ def register_Ns3OnoeWifiManager_methods(root_module, cls): visibility='private', is_virtual=True) return +def register_Ns3QadhocWifiMac_methods(root_module, cls): + ## qadhoc-wifi-mac.h: static ns3::TypeId ns3::QadhocWifiMac::GetTypeId() [member function] + cls.add_method('GetTypeId', + 'ns3::TypeId', + [], + is_static=True) + ## qadhoc-wifi-mac.h: ns3::QadhocWifiMac::QadhocWifiMac() [constructor] + cls.add_constructor([]) + ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::SetSlot(ns3::Time slotTime) [member function] + cls.add_method('SetSlot', + 'void', + [param('ns3::Time', 'slotTime')], + is_virtual=True) + ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::SetSifs(ns3::Time sifs) [member function] + cls.add_method('SetSifs', + 'void', + [param('ns3::Time', 'sifs')], + is_virtual=True) + ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::SetEifsNoDifs(ns3::Time eifsNoDifs) [member function] + cls.add_method('SetEifsNoDifs', + 'void', + [param('ns3::Time', 'eifsNoDifs')], + is_virtual=True) + ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::SetAckTimeout(ns3::Time ackTimeout) [member function] + cls.add_method('SetAckTimeout', + 'void', + [param('ns3::Time', 'ackTimeout')], + is_virtual=True) + ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::SetCtsTimeout(ns3::Time ctsTimeout) [member function] + cls.add_method('SetCtsTimeout', + 'void', + [param('ns3::Time', 'ctsTimeout')], + is_virtual=True) + ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::SetPifs(ns3::Time pifs) [member function] + cls.add_method('SetPifs', + 'void', + [param('ns3::Time', 'pifs')], + is_virtual=True) + ## qadhoc-wifi-mac.h: ns3::Time ns3::QadhocWifiMac::GetSlot() const [member function] + cls.add_method('GetSlot', + 'ns3::Time', + [], + is_const=True, is_virtual=True) + ## qadhoc-wifi-mac.h: ns3::Time ns3::QadhocWifiMac::GetSifs() const [member function] + cls.add_method('GetSifs', + 'ns3::Time', + [], + is_const=True, is_virtual=True) + ## qadhoc-wifi-mac.h: ns3::Time ns3::QadhocWifiMac::GetEifsNoDifs() const [member function] + cls.add_method('GetEifsNoDifs', + 'ns3::Time', + [], + is_const=True, is_virtual=True) + ## qadhoc-wifi-mac.h: ns3::Time ns3::QadhocWifiMac::GetAckTimeout() const [member function] + cls.add_method('GetAckTimeout', + 'ns3::Time', + [], + is_const=True, is_virtual=True) + ## qadhoc-wifi-mac.h: ns3::Time ns3::QadhocWifiMac::GetCtsTimeout() const [member function] + cls.add_method('GetCtsTimeout', + 'ns3::Time', + [], + is_const=True, is_virtual=True) + ## qadhoc-wifi-mac.h: ns3::Time ns3::QadhocWifiMac::GetPifs() const [member function] + cls.add_method('GetPifs', + 'ns3::Time', + [], + is_const=True, is_virtual=True) + ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::SetWifiPhy(ns3::Ptr phy) [member function] + cls.add_method('SetWifiPhy', + 'void', + [param('ns3::Ptr< ns3::WifiPhy >', 'phy')], + is_virtual=True) + ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::SetWifiRemoteStationManager(ns3::Ptr stationManager) [member function] + cls.add_method('SetWifiRemoteStationManager', + 'void', + [param('ns3::Ptr< ns3::WifiRemoteStationManager >', 'stationManager')], + is_virtual=True) + ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::Enqueue(ns3::Ptr packet, ns3::Mac48Address to, ns3::Mac48Address from) [member function] + cls.add_method('Enqueue', + 'void', + [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to'), param('ns3::Mac48Address', 'from')], + is_virtual=True) + ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::Enqueue(ns3::Ptr packet, ns3::Mac48Address to) [member function] + cls.add_method('Enqueue', + 'void', + [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to')], + is_virtual=True) + ## qadhoc-wifi-mac.h: bool ns3::QadhocWifiMac::SupportsSendFrom() const [member function] + cls.add_method('SupportsSendFrom', + 'bool', + [], + is_const=True, is_virtual=True) + ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::SetForwardUpCallback(ns3::Callback, ns3::Mac48Address, ns3::Mac48Address, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> upCallback) [member function] + cls.add_method('SetForwardUpCallback', + 'void', + [param('ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::Mac48Address, ns3::Mac48Address, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'upCallback')], + is_virtual=True) + ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::SetLinkUpCallback(ns3::Callback linkUp) [member function] + cls.add_method('SetLinkUpCallback', + 'void', + [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'linkUp')], + is_virtual=True) + ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::SetLinkDownCallback(ns3::Callback linkDown) [member function] + cls.add_method('SetLinkDownCallback', + 'void', + [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'linkDown')], + is_virtual=True) + ## qadhoc-wifi-mac.h: ns3::Mac48Address ns3::QadhocWifiMac::GetAddress() const [member function] + cls.add_method('GetAddress', + 'ns3::Mac48Address', + [], + is_const=True, is_virtual=True) + ## qadhoc-wifi-mac.h: ns3::Ssid ns3::QadhocWifiMac::GetSsid() const [member function] + cls.add_method('GetSsid', + 'ns3::Ssid', + [], + is_const=True, is_virtual=True) + ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::SetAddress(ns3::Mac48Address address) [member function] + cls.add_method('SetAddress', + 'void', + [param('ns3::Mac48Address', 'address')], + is_virtual=True) + ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::SetSsid(ns3::Ssid ssid) [member function] + cls.add_method('SetSsid', + 'void', + [param('ns3::Ssid', 'ssid')], + is_virtual=True) + ## qadhoc-wifi-mac.h: ns3::Mac48Address ns3::QadhocWifiMac::GetBssid() const [member function] + cls.add_method('GetBssid', + 'ns3::Mac48Address', + [], + is_const=True, is_virtual=True) + ## qadhoc-wifi-mac.h: void ns3::QadhocWifiMac::DoDispose() [member function] + cls.add_method('DoDispose', + 'void', + [], + visibility='private', is_virtual=True) + return + +def register_Ns3QapWifiMac_methods(root_module, cls): + ## qap-wifi-mac.h: static ns3::TypeId ns3::QapWifiMac::GetTypeId() [member function] + cls.add_method('GetTypeId', + 'ns3::TypeId', + [], + is_static=True) + ## qap-wifi-mac.h: ns3::QapWifiMac::QapWifiMac() [constructor] + cls.add_constructor([]) + ## qap-wifi-mac.h: void ns3::QapWifiMac::SetSlot(ns3::Time slotTime) [member function] + cls.add_method('SetSlot', + 'void', + [param('ns3::Time', 'slotTime')], + is_virtual=True) + ## qap-wifi-mac.h: void ns3::QapWifiMac::SetSifs(ns3::Time sifs) [member function] + cls.add_method('SetSifs', + 'void', + [param('ns3::Time', 'sifs')], + is_virtual=True) + ## qap-wifi-mac.h: void ns3::QapWifiMac::SetEifsNoDifs(ns3::Time eifsNoDifs) [member function] + cls.add_method('SetEifsNoDifs', + 'void', + [param('ns3::Time', 'eifsNoDifs')], + is_virtual=True) + ## qap-wifi-mac.h: void ns3::QapWifiMac::SetAckTimeout(ns3::Time ackTimeout) [member function] + cls.add_method('SetAckTimeout', + 'void', + [param('ns3::Time', 'ackTimeout')], + is_virtual=True) + ## qap-wifi-mac.h: void ns3::QapWifiMac::SetCtsTimeout(ns3::Time ctsTimeout) [member function] + cls.add_method('SetCtsTimeout', + 'void', + [param('ns3::Time', 'ctsTimeout')], + is_virtual=True) + ## qap-wifi-mac.h: void ns3::QapWifiMac::SetPifs(ns3::Time pifs) [member function] + cls.add_method('SetPifs', + 'void', + [param('ns3::Time', 'pifs')], + is_virtual=True) + ## qap-wifi-mac.h: ns3::Time ns3::QapWifiMac::GetSlot() const [member function] + cls.add_method('GetSlot', + 'ns3::Time', + [], + is_const=True, is_virtual=True) + ## qap-wifi-mac.h: ns3::Time ns3::QapWifiMac::GetSifs() const [member function] + cls.add_method('GetSifs', + 'ns3::Time', + [], + is_const=True, is_virtual=True) + ## qap-wifi-mac.h: ns3::Time ns3::QapWifiMac::GetEifsNoDifs() const [member function] + cls.add_method('GetEifsNoDifs', + 'ns3::Time', + [], + is_const=True, is_virtual=True) + ## qap-wifi-mac.h: ns3::Time ns3::QapWifiMac::GetAckTimeout() const [member function] + cls.add_method('GetAckTimeout', + 'ns3::Time', + [], + is_const=True, is_virtual=True) + ## qap-wifi-mac.h: ns3::Time ns3::QapWifiMac::GetCtsTimeout() const [member function] + cls.add_method('GetCtsTimeout', + 'ns3::Time', + [], + is_const=True, is_virtual=True) + ## qap-wifi-mac.h: ns3::Time ns3::QapWifiMac::GetPifs() const [member function] + cls.add_method('GetPifs', + 'ns3::Time', + [], + is_const=True, is_virtual=True) + ## qap-wifi-mac.h: void ns3::QapWifiMac::SetWifiPhy(ns3::Ptr phy) [member function] + cls.add_method('SetWifiPhy', + 'void', + [param('ns3::Ptr< ns3::WifiPhy >', 'phy')], + is_virtual=True) + ## qap-wifi-mac.h: void ns3::QapWifiMac::SetWifiRemoteStationManager(ns3::Ptr stationManager) [member function] + cls.add_method('SetWifiRemoteStationManager', + 'void', + [param('ns3::Ptr< ns3::WifiRemoteStationManager >', 'stationManager')], + is_virtual=True) + ## qap-wifi-mac.h: void ns3::QapWifiMac::Enqueue(ns3::Ptr packet, ns3::Mac48Address to, ns3::Mac48Address from) [member function] + cls.add_method('Enqueue', + 'void', + [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to'), param('ns3::Mac48Address', 'from')], + is_virtual=True) + ## qap-wifi-mac.h: void ns3::QapWifiMac::Enqueue(ns3::Ptr packet, ns3::Mac48Address to) [member function] + cls.add_method('Enqueue', + 'void', + [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to')], + is_virtual=True) + ## qap-wifi-mac.h: bool ns3::QapWifiMac::SupportsSendFrom() const [member function] + cls.add_method('SupportsSendFrom', + 'bool', + [], + is_const=True, is_virtual=True) + ## qap-wifi-mac.h: void ns3::QapWifiMac::SetForwardUpCallback(ns3::Callback, ns3::Mac48Address, ns3::Mac48Address, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> upCallback) [member function] + cls.add_method('SetForwardUpCallback', + 'void', + [param('ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::Mac48Address, ns3::Mac48Address, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'upCallback')], + is_virtual=True) + ## qap-wifi-mac.h: void ns3::QapWifiMac::SetLinkUpCallback(ns3::Callback linkUp) [member function] + cls.add_method('SetLinkUpCallback', + 'void', + [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'linkUp')], + is_virtual=True) + ## qap-wifi-mac.h: void ns3::QapWifiMac::SetLinkDownCallback(ns3::Callback linkDown) [member function] + cls.add_method('SetLinkDownCallback', + 'void', + [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'linkDown')], + is_virtual=True) + ## qap-wifi-mac.h: ns3::Mac48Address ns3::QapWifiMac::GetAddress() const [member function] + cls.add_method('GetAddress', + 'ns3::Mac48Address', + [], + is_const=True, is_virtual=True) + ## qap-wifi-mac.h: ns3::Ssid ns3::QapWifiMac::GetSsid() const [member function] + cls.add_method('GetSsid', + 'ns3::Ssid', + [], + is_const=True, is_virtual=True) + ## qap-wifi-mac.h: void ns3::QapWifiMac::SetAddress(ns3::Mac48Address address) [member function] + cls.add_method('SetAddress', + 'void', + [param('ns3::Mac48Address', 'address')], + is_virtual=True) + ## qap-wifi-mac.h: void ns3::QapWifiMac::SetSsid(ns3::Ssid ssid) [member function] + cls.add_method('SetSsid', + 'void', + [param('ns3::Ssid', 'ssid')], + is_virtual=True) + ## qap-wifi-mac.h: ns3::Mac48Address ns3::QapWifiMac::GetBssid() const [member function] + cls.add_method('GetBssid', + 'ns3::Mac48Address', + [], + is_const=True, is_virtual=True) + ## qap-wifi-mac.h: void ns3::QapWifiMac::SetBeaconInterval(ns3::Time interval) [member function] + cls.add_method('SetBeaconInterval', + 'void', + [param('ns3::Time', 'interval')]) + ## qap-wifi-mac.h: ns3::Time ns3::QapWifiMac::GetBeaconInterval() const [member function] + cls.add_method('GetBeaconInterval', + 'ns3::Time', + [], + is_const=True) + ## qap-wifi-mac.h: void ns3::QapWifiMac::StartBeaconing() [member function] + cls.add_method('StartBeaconing', + 'void', + []) + ## qap-wifi-mac.h: void ns3::QapWifiMac::DoDispose() [member function] + cls.add_method('DoDispose', + 'void', + [], + visibility='private', is_virtual=True) + return + +def register_Ns3QstaWifiMac_methods(root_module, cls): + ## qsta-wifi-mac.h: static ns3::TypeId ns3::QstaWifiMac::GetTypeId() [member function] + cls.add_method('GetTypeId', + 'ns3::TypeId', + [], + is_static=True) + ## qsta-wifi-mac.h: ns3::QstaWifiMac::QstaWifiMac() [constructor] + cls.add_constructor([]) + ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetSlot(ns3::Time slotTime) [member function] + cls.add_method('SetSlot', + 'void', + [param('ns3::Time', 'slotTime')], + is_virtual=True) + ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetSifs(ns3::Time sifs) [member function] + cls.add_method('SetSifs', + 'void', + [param('ns3::Time', 'sifs')], + is_virtual=True) + ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetEifsNoDifs(ns3::Time eifsNoDifs) [member function] + cls.add_method('SetEifsNoDifs', + 'void', + [param('ns3::Time', 'eifsNoDifs')], + is_virtual=True) + ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetAckTimeout(ns3::Time ackTimeout) [member function] + cls.add_method('SetAckTimeout', + 'void', + [param('ns3::Time', 'ackTimeout')], + is_virtual=True) + ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetCtsTimeout(ns3::Time ctsTimeout) [member function] + cls.add_method('SetCtsTimeout', + 'void', + [param('ns3::Time', 'ctsTimeout')], + is_virtual=True) + ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetPifs(ns3::Time pifs) [member function] + cls.add_method('SetPifs', + 'void', + [param('ns3::Time', 'pifs')], + is_virtual=True) + ## qsta-wifi-mac.h: ns3::Time ns3::QstaWifiMac::GetSlot() const [member function] + cls.add_method('GetSlot', + 'ns3::Time', + [], + is_const=True, is_virtual=True) + ## qsta-wifi-mac.h: ns3::Time ns3::QstaWifiMac::GetSifs() const [member function] + cls.add_method('GetSifs', + 'ns3::Time', + [], + is_const=True, is_virtual=True) + ## qsta-wifi-mac.h: ns3::Time ns3::QstaWifiMac::GetEifsNoDifs() const [member function] + cls.add_method('GetEifsNoDifs', + 'ns3::Time', + [], + is_const=True, is_virtual=True) + ## qsta-wifi-mac.h: ns3::Time ns3::QstaWifiMac::GetAckTimeout() const [member function] + cls.add_method('GetAckTimeout', + 'ns3::Time', + [], + is_const=True, is_virtual=True) + ## qsta-wifi-mac.h: ns3::Time ns3::QstaWifiMac::GetCtsTimeout() const [member function] + cls.add_method('GetCtsTimeout', + 'ns3::Time', + [], + is_const=True, is_virtual=True) + ## qsta-wifi-mac.h: ns3::Time ns3::QstaWifiMac::GetPifs() const [member function] + cls.add_method('GetPifs', + 'ns3::Time', + [], + is_const=True, is_virtual=True) + ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetWifiPhy(ns3::Ptr phy) [member function] + cls.add_method('SetWifiPhy', + 'void', + [param('ns3::Ptr< ns3::WifiPhy >', 'phy')], + is_virtual=True) + ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetWifiRemoteStationManager(ns3::Ptr stationManager) [member function] + cls.add_method('SetWifiRemoteStationManager', + 'void', + [param('ns3::Ptr< ns3::WifiRemoteStationManager >', 'stationManager')], + is_virtual=True) + ## qsta-wifi-mac.h: void ns3::QstaWifiMac::Enqueue(ns3::Ptr packet, ns3::Mac48Address to, ns3::Mac48Address from) [member function] + cls.add_method('Enqueue', + 'void', + [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to'), param('ns3::Mac48Address', 'from')], + is_virtual=True) + ## qsta-wifi-mac.h: void ns3::QstaWifiMac::Enqueue(ns3::Ptr packet, ns3::Mac48Address to) [member function] + cls.add_method('Enqueue', + 'void', + [param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'to')], + is_virtual=True) + ## qsta-wifi-mac.h: bool ns3::QstaWifiMac::SupportsSendFrom() const [member function] + cls.add_method('SupportsSendFrom', + 'bool', + [], + is_const=True, is_virtual=True) + ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetForwardUpCallback(ns3::Callback, ns3::Mac48Address, ns3::Mac48Address, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> upCallback) [member function] + cls.add_method('SetForwardUpCallback', + 'void', + [param('ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::Mac48Address, ns3::Mac48Address, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'upCallback')], + is_virtual=True) + ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetLinkUpCallback(ns3::Callback linkUp) [member function] + cls.add_method('SetLinkUpCallback', + 'void', + [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'linkUp')], + is_virtual=True) + ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetLinkDownCallback(ns3::Callback linkDown) [member function] + cls.add_method('SetLinkDownCallback', + 'void', + [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'linkDown')], + is_virtual=True) + ## qsta-wifi-mac.h: ns3::Mac48Address ns3::QstaWifiMac::GetAddress() const [member function] + cls.add_method('GetAddress', + 'ns3::Mac48Address', + [], + is_const=True, is_virtual=True) + ## qsta-wifi-mac.h: ns3::Ssid ns3::QstaWifiMac::GetSsid() const [member function] + cls.add_method('GetSsid', + 'ns3::Ssid', + [], + is_const=True, is_virtual=True) + ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetAddress(ns3::Mac48Address address) [member function] + cls.add_method('SetAddress', + 'void', + [param('ns3::Mac48Address', 'address')], + is_virtual=True) + ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetSsid(ns3::Ssid ssid) [member function] + cls.add_method('SetSsid', + 'void', + [param('ns3::Ssid', 'ssid')], + is_virtual=True) + ## qsta-wifi-mac.h: ns3::Mac48Address ns3::QstaWifiMac::GetBssid() const [member function] + cls.add_method('GetBssid', + 'ns3::Mac48Address', + [], + is_const=True, is_virtual=True) + ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetMaxMissedBeacons(uint32_t missed) [member function] + cls.add_method('SetMaxMissedBeacons', + 'void', + [param('uint32_t', 'missed')]) + ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetProbeRequestTimeout(ns3::Time timeout) [member function] + cls.add_method('SetProbeRequestTimeout', + 'void', + [param('ns3::Time', 'timeout')]) + ## qsta-wifi-mac.h: void ns3::QstaWifiMac::SetAssocRequestTimeout(ns3::Time timeout) [member function] + cls.add_method('SetAssocRequestTimeout', + 'void', + [param('ns3::Time', 'timeout')]) + ## qsta-wifi-mac.h: void ns3::QstaWifiMac::StartActiveAssociation() [member function] + cls.add_method('StartActiveAssociation', + 'void', + []) + ## qsta-wifi-mac.h: void ns3::QstaWifiMac::DoDispose() [member function] + cls.add_method('DoDispose', + 'void', + [], + visibility='private', is_virtual=True) + return + def register_Ns3RraaWifiManager_methods(root_module, cls): ## rraa-wifi-manager.h: ns3::RraaWifiManager::RraaWifiManager(ns3::RraaWifiManager const & arg0) [copy constructor] cls.add_constructor([param('ns3::RraaWifiManager const &', 'arg0')]) @@ -3369,6 +4171,14 @@ def register_functions(root_module): module.add_function('MakeWifiModeChecker', 'ns3::Ptr< ns3::AttributeChecker const >', []) + ## qos-utils.h: extern uint8_t ns3::QosUtilsGetTidForPacket(ns3::Ptr packet) [free function] + module.add_function('QosUtilsGetTidForPacket', + 'uint8_t', + [param('ns3::Ptr< ns3::Packet const >', 'packet')]) + ## qos-utils.h: extern ns3::AccessClass ns3::QosUtilsMapTidToAc(uint8_t tid) [free function] + module.add_function('QosUtilsMapTidToAc', + 'ns3::AccessClass', + [param('uint8_t', 'tid')]) register_functions_ns3_Config(module.get_submodule('Config'), root_module) register_functions_ns3_TimeStepPrecision(module.get_submodule('TimeStepPrecision'), root_module) register_functions_ns3_internal(module.get_submodule('internal'), root_module) diff --git a/bindings/python/ns3modulegen_generated.py b/bindings/python/ns3modulegen_generated.py index 5d682396c..694befa0b 100644 --- a/bindings/python/ns3modulegen_generated.py +++ b/bindings/python/ns3modulegen_generated.py @@ -274,6 +274,7 @@ def register_types(module): root_module.end_section('ns3_module_helper') module.add_container('std::vector< unsigned int >', 'unsigned int', container_type='vector') module.add_container('std::list< unsigned int >', 'unsigned int', container_type='list') + module.add_container('std::list< std::pair< ns3::Ptr< ns3::Packet >, ns3::AmsduSubframeHeader > >', 'std::pair< ns3::Ptr< ns3::Packet >, ns3::AmsduSubframeHeader >', container_type='list') ## Register a nested module for the namespace Config From aec5c8817d3e8e1c5bc959feca9a3e19f7a3e8cb Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Mon, 27 Apr 2009 22:46:50 -0700 Subject: [PATCH 31/35] fix small pdf generation problem reported by Faker --- doc/manual/manual.texi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/manual/manual.texi b/doc/manual/manual.texi index 726fa23f8..ba1a18a59 100644 --- a/doc/manual/manual.texi +++ b/doc/manual/manual.texi @@ -64,7 +64,9 @@ along with this program. If not, see @uref{http://www.gnu.org/licenses/}. @end titlepage @c So the toc is printed at the start. +@ifnottex @anchor{Full Table of Contents} +@end ifnottex @shortcontents @ifnottex From cf746e147e5bd6a5f87338022bd6c21d5c18f85d Mon Sep 17 00:00:00 2001 From: Fabian Mauchle Date: Tue, 28 Apr 2009 09:25:33 +0200 Subject: [PATCH 32/35] remove Mac48Address::IsMulticast --- src/devices/csma/csma-net-device.cc | 22 ++-------------------- src/devices/emu/emu-net-device.cc | 21 ++------------------- src/devices/wifi/qap-wifi-mac.cc | 3 +-- src/node/mac48-address.cc | 12 ------------ src/node/mac48-address.h | 5 +---- src/node/simple-net-device.cc | 2 +- 6 files changed, 7 insertions(+), 58 deletions(-) diff --git a/src/devices/csma/csma-net-device.cc b/src/devices/csma/csma-net-device.cc index dc953e7b6..4267371f7 100644 --- a/src/devices/csma/csma-net-device.cc +++ b/src/devices/csma/csma-net-device.cc @@ -722,20 +722,6 @@ CsmaNetDevice::Receive (Ptr packet, Ptr senderDevice) NS_LOG_FUNCTION (packet << senderDevice); NS_LOG_LOGIC ("UID is " << packet->GetUid ()); - /* IPv6 support*/ - uint8_t mac[6]; - Mac48Address multicast6AllNodes("33:33:00:00:00:01"); - Mac48Address multicast6AllRouters("33:33:00:00:00:02"); - Mac48Address multicast6AllHosts("33:33:00:00:00:03"); - Mac48Address multicast6Node; /* multicast address addressed to our MAC address */ - - /* generate IPv6 multicast ethernet destination that nodes will accept */ - GetAddress().CopyTo(mac); - mac[0]=0x33; - mac[1]=0x33; - /* mac[2]=0xff; */ - multicast6Node.CopyFrom(mac); - // // We never forward up packets that we sent. Real devices don't do this since // their receivers are disabled during send, so we don't. @@ -805,16 +791,12 @@ CsmaNetDevice::Receive (Ptr packet, Ptr senderDevice) // Classify the packet based on its destination. // PacketType packetType; - + if (header.GetDestination ().IsBroadcast ()) { packetType = PACKET_BROADCAST; } - else if (header.GetDestination ().IsMulticast () || - header.GetDestination() == multicast6Node || - header.GetDestination() == multicast6AllNodes || - header.GetDestination() == multicast6AllRouters || - header.GetDestination() == multicast6AllHosts) + else if (header.GetDestination ().IsGroup ()) { packetType = PACKET_MULTICAST; } diff --git a/src/devices/emu/emu-net-device.cc b/src/devices/emu/emu-net-device.cc index a8f881edd..93eab5939 100644 --- a/src/devices/emu/emu-net-device.cc +++ b/src/devices/emu/emu-net-device.cc @@ -584,19 +584,6 @@ EmuNetDevice::ForwardUp (uint8_t *buf, uint32_t len) { NS_LOG_FUNCTION (buf << len); - /* IPv6 support*/ - uint8_t mac[6]; - Mac48Address multicast6AllNodes("33:33:00:00:00:01"); - Mac48Address multicast6AllRouters("33:33:00:00:00:02"); - Mac48Address multicast6AllHosts("33:33:00:00:00:03"); - Mac48Address multicast6Node; /* multicast address addressed to our MAC address */ - - /* generate IPv6 multicast ethernet destination that nodes will accept */ - GetAddress().CopyTo(mac); - mac[0]=0x33; - mac[1]=0x33; - multicast6Node.CopyFrom(mac); - // // Create a packet out of the buffer we received and free that buffer. // @@ -636,16 +623,12 @@ EmuNetDevice::ForwardUp (uint8_t *buf, uint32_t len) } PacketType packetType; - + if (header.GetDestination ().IsBroadcast ()) { packetType = NS3_PACKET_BROADCAST; } - else if (header.GetDestination ().IsMulticast () || - header.GetDestination() == multicast6Node || - header.GetDestination() == multicast6AllNodes || - header.GetDestination() == multicast6AllRouters || - header.GetDestination() == multicast6AllHosts) + else if (header.GetDestination ().IsGroup ()) { packetType = NS3_PACKET_MULTICAST; } diff --git a/src/devices/wifi/qap-wifi-mac.cc b/src/devices/wifi/qap-wifi-mac.cc index fae27f94a..c125abbfd 100644 --- a/src/devices/wifi/qap-wifi-mac.cc +++ b/src/devices/wifi/qap-wifi-mac.cc @@ -591,8 +591,7 @@ QapWifiMac::Receive (Ptr packet, WifiMacHeader const *hdr) ForwardUp (packet, from, bssid); } } - else if (to.IsBroadcast () || - to.IsMulticast () || + else if (to.IsGroup () || toStation->IsAssociated ()) { NS_LOG_DEBUG ("forwarding frame from="<Deconflict NetDevice::ifIndex and Ipv4::ifIndex (bug 85). +

All function parameters named "ifIndex" that refer to an Ipv4 interface are instead named "interface".

 - static const uint32_t Ipv4RoutingProtocol::IF_INDEX_ANY = 0xffffffff;
@@ -74,48 +76,45 @@ proposed IPv4 routing refactoring)
 + bool Ipv4::GetInterfaceForDestination (Ipv4Address dest, uint32_t &interface) const;
 (N.B. this function is not needed in the proposed Ipv4 routing refactoring)
 
-
  • allow multiple IPv4 addresses to be assigned to an interface (bug 188). -
      -
    • Add class Ipv4InterfaceAddress: -This is a new class to resemble Linux's struct in_ifaddr. It holds IP addressing information, including mask, -broadcast address, scope, whether primary or secondary, etc. -
      +
      +
      +
    • Allow multiple IPv4 addresses to be assigned to an interface (bug 188) +
        +
      • Add class Ipv4InterfaceAddress: + This is a new class to resemble Linux's struct in_ifaddr. It holds IP addressing information, including mask, + broadcast address, scope, whether primary or secondary, etc. +
         +  virtual uint32_t AddAddress (uint32_t interface, Ipv4InterfaceAddress address) = 0;
         +  virtual Ipv4InterfaceAddress GetAddress (uint32_t interface, uint32_t addressIndex) const = 0;
         +  virtual uint32_t GetNAddresses (uint32_t interface) const = 0;
        -
        -
      • Regarding legacy API usage, typically where you once did the following, -using the public Ipv4 class interface (e.g.): -
        +  
        +
      • Regarding legacy API usage, typically where you once did the following, + using the public Ipv4 class interface (e.g.): +
           ipv4A->SetAddress (ifIndexA, Ipv4Address ("172.16.1.1"));
           ipv4A->SetNetworkMask (ifIndexA, Ipv4Mask ("255.255.255.255"));
        -
        -you now do: -
        +  
        + you now do: +
           Ipv4InterfaceAddress ipv4IfAddrA = Ipv4InterfaceAddress (Ipv4Address ("172.16.1.1"), Ipv4Mask ("255.255.255.255"));
           ipv4A->AddAddress (ifIndexA, ipv4IfAddrA);
        -
        -
      • At the helper API level, one often gets an address from an interface -container. We preserve the legacy GetAddress (uint32_t i) but it -is documented that this will return only the first (address index 0) -address on the interface, if there are multiple such addresses. -We provide also an overloaded variant for the multi-address case: +
    • +
    • At the helper API level, one often gets an address from an interface + container. We preserve the legacy GetAddress (uint32_t i) but it + is documented that this will return only the first (address index 0) + address on the interface, if there are multiple such addresses. + We provide also an overloaded variant for the multi-address case: -
      +  
       Ipv4Address Ipv4InterfaceContainer::GetAddress (uint32_t i)
       + Ipv4Address Ipv4InterfaceContainer::GetAddress (uint32_t i, uint32_t j)
      -
      +
      -
    - - -
      -
    • new WifiMacHelper objects. -
        -
      • -Type of wifi MAC is now setted by two new specific helpers, NqosWifiMacHelper for non QoS MACs and QosWifiMacHelper for Qos MACs. They are passed as argument to WifiHelper::Install methods.
      • -
        +  
      +
    • New WifiMacHelper objects +

      The type of wifi MAC is now set by two new specific helpers, NqosWifiMacHelper for non QoS MACs and QosWifiMacHelper for Qos MACs. They are passed as argument to WifiHelper::Install methods.

    • +
       - void WifiHelper::SetMac (std::string type, std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),...)
       
       - NetDeviceContainer WifiHelper::Install (const WifiPhyHelper &phyHelper, NodeContainer c) const
      @@ -126,12 +125,14 @@ Type of wifi MAC is now setted by two new specific helpers, NqosWifiMacHelper fo
       
       - NetDeviceContainer WifiHelper::Install (const WifiPhyHelper &phy, std::string nodeName) const
       + NetDeviceContainer WifiHelper::Install (const WifiPhyHelper &phy, const WifiMacHelper &mac, std::string nodeName) const
      +  
      + See src/helper/nqos-wifi-mac-helper.h and src/helper/qos-wifi-mac-helper.h for more details. +

      + +
    • Remove Mac48Address::IsMulticast +

      This method was considered buggy and unsafe to call. Its replacement is Mac48Address::IsGroup. +

    • - see src/helper/nqos-wifi-mac-helper.h - src/helper/qos-wifi-mac-helper.h - for more details. - -

    Changed behavior:

    From 16b6cfbe71fd287ea69fe1890b0ad3737edd0657 Mon Sep 17 00:00:00 2001 From: Mirko Banchi Date: Tue, 28 Apr 2009 14:26:28 +0200 Subject: [PATCH 35/35] update wifi.h --- src/devices/wifi/wifi.h | 51 +++++++++++++++++++++++++++++++++-------- 1 file changed, 41 insertions(+), 10 deletions(-) diff --git a/src/devices/wifi/wifi.h b/src/devices/wifi/wifi.h index 38df2a3a4..bc07540e5 100644 --- a/src/devices/wifi/wifi.h +++ b/src/devices/wifi/wifi.h @@ -11,30 +11,61 @@ * * The current implementation provides roughly 4 levels of models: * - the PHY layer models - * - the so-called MAC low models: they implement DCF + * - the so-called MAC low models: they implement DCF and EDCAF * - the so-called MAC high models: they implement the MAC-level * beacon generation, probing, and association state machines. * - a set of Rate control algorithms used by the MAC low models. * - * We have today 3 MAC high models: + * We have today 6 MAC high models, 3 for non QoS MACs and 3 for QoS MACs. + * + * a)non QoS MACs: + * * - a simple adhoc state machine which does not perform any * kind of beacon generation, probing, or association. This - * state machine is implemented by the ns3::AdhocWifiNetDevice - * and ns3::MacHighAdhoc classes. + * state machine is implemented by the ns3::AdhocWifiMac class. * - an active probing and association state machine which handles * automatic re-association whenever too many beacons are missed - * is implemented by the ns3::NqstaWifiNetDevice and - * ns3::MacHighNqsta classes. + * is implemented by the ns3::NqstaWifiMac class. * - an access point which generates periodic beacons, and which * accepts every attempt to associate. This AP state machine - * is implemented by the ns3::NqapWifiNetDevice and - * ns3::MacHighNqap classes. + * is implemented by the ns3::NqapWifiMac class. + * + * b)QoS MACs: + * + * - like above but these MAC models are also able to manage QoS traffic. + * These MAC layers are implemented respectively by ns3::QadhocWifiMac, + * ns3::QstaWifiMac and ns3::QapWifiMac classes. + * With these MAC models is possible to work with traffic belonging to + * four different access classes: AC_VO for voice traffic, AC_VI for video + * traffic, AC_BE for best-effort traffic and AC_BK for background traffic. + * In order to determine MSDU's access class, every packet forwarded down + * to these MAC layers should be marked using ns3::QosTag in order to set + * a TID (traffic id) for that packet otherwise it will be considered + * belonging to AC_BE access class. + * How TIDs are mapped to access classes are shown in the table below. + * + * TID-AccessClass mapping: + * + * TID | Access class + * -------------------- + * 7 | AC_VO ^ + * 6 | AC_VO | + * 5 | AC_VI | + * 4 | AC_VI | + * 3 | AC_BE | priority + * 0 | AC_BE | + * 2 | AC_BK | + * 1 | AC_BK | + * * * The MAC low layer is split in 3 components: * - ns3::MacLow which takes care of RTS/CTS/DATA/ACK transactions. * - ns3::DcfManager and ns3::DcfState which implements the DCF function. - * - ns3::DcaTxop which handles the packet queue, packet fragmentation, - * and packet retransmissions if they are needed. + * - ns3::DcaTxop or ns3::EdcaTxopN which handle the packet queue, packet + * fragmentation, and packet retransmissions if they are needed. + * ns3::DcaTxop object is used by non QoS high MACs. ns3::EdcaTxopN is + * used by Qos high MACs and performs also QoS operations like 802.11n MSDU + * aggregation. * * The PHY layer implements a single model in the ns3::WifiPhy class: the * physical layer model implemented there is described fully in a paper titled