_Right after_ wifiMac.SetType, I do
Config::SetDefault("ns3::WifiMacQueue::MaxPacketNumber", UintegerValue
(20));
R
--
Ruben Merz Deutsche Telekom Laboratories
http://www.net.t-labs.tu-berlin.de/people/ruben_merz.shtml
On 4/1/11 11:10 PM, David Taylor wrote:
> Doesn't that change MaxPacketNumber for ALL WifiMacQueue's? What if u
Yes, you're right.
For a single queue, I have never tried with Config::Set(), but I did it
with the pointers with ns-3.9 (and with a catch). Now, for ns-3.10, you
probably want to do something like:
From your simulation, get the NetDevice, cast it to WifiNetDevice.
Then, with the WifiNetDevice pointer, do a GetMac() to get the
RegularWifiMac (maybe a cast is necessary), and finally, get the DcaTxop
object and a pointer to the queue and appropriate functions (but a patch
is needed and again, the patch is specific to MaxPacketNumber).
Unless, I'm mistaken, there is no other way. No I wonder whether you
cannot access WifiMacQueue through the Config system because the DcaTxop
object is protected in RegularWifiMac. I'm cc'ing Nicola to double check.
Here is the patch:
diff --git a/src/devices/wifi/dca-txop.cc b/src/devices/wifi/dca-txop.cc
--- a/src/devices/wifi/dca-txop.cc
+++ b/src/devices/wifi/dca-txop.cc
@@ -229,12 +229,6 @@
StartAccessIfNeeded ();
}
-uint32_t
-DcaTxop::GetWifiMacQueueSize(void)
-{
- return m_queue->GetSize();
-}
-
bool
DcaTxop::WifiMacQueueIsFull (void)
{
diff --git a/src/devices/wifi/dca-txop.h b/src/devices/wifi/dca-txop.h
--- a/src/devices/wifi/dca-txop.h
+++ b/src/devices/wifi/dca-txop.h
@@ -106,10 +106,7 @@
* can be sent safely.
*/
void Queue (Ptr<const Packet> packet, const WifiMacHeader &hdr);
- /*
- * \brief return the current size of the internal queue
- */
- uint32_t GetWifiMacQueueSize(void);
+
/**
* Verify whether the MacQueue is full.
* \return 1 if full, 0 otherwise.
diff --git a/src/devices/wifi/regular-wifi-mac.h
b/src/devices/wifi/regular-wifi-mac.h
--- a/src/devices/wifi/regular-wifi-mac.h
+++ b/src/devices/wifi/regular-wifi-mac.h
@@ -205,9 +205,6 @@
virtual void SetCompressedBlockAckTimeout (Time blockAckTimeout);
virtual Time GetCompressedBlockAckTimeout (void) const;
- /** Accessor for the DCF object */
- Ptr<DcaTxop> GetDcaTxop (void) const;
-
protected:
virtual void DoStart ();
virtual void DoDispose ();
@@ -328,6 +325,8 @@
*/
void SetupEdcaQueue (enum AcIndex ac);
+ /** Accessor for the DCF object */
+ Ptr<DcaTxop> GetDcaTxop (void) const;
/** Accessor for the AC_VO channel access function */
Ptr<EdcaTxopN> GetVOQueue (void) const;
/** Accessor for the AC_VI channel access function */
/NodeList/0/DeviceList/0/RegularWifiMac/DcaTxop/WifiMacQueue ?
R
/NodeList/0/DeviceList/0/Mac/RegularWifiMac/DcaTxop/WifiMacQueue
and/or
/NodeList/0/DeviceList/0/WifiNetDevice/Mac/RegularWifiMac/DcaTxop/WifiMacQueue
?
(I'm looking at how the DcaTxop attributes are accessed in
http://www.nsnam.org/doxygen-release/classns3_1_1_dca_txop.html)
Ah, and this resource might also be helpful:
http://www.nsnam.org/wiki/index.php/HOWTO_determine_the_path_of_an_attribute_or_trace_source
Btw, if you get it to work, please post your solution back! So that we
can document it somewhere
R
On 4/3/11 11:44 AM, David Taylor wrote:
> Still doesn't work... From the link u gave it seems like it shouldn't
> work anyway, since WifiMacQueue is never aggregated... (I might be
> wrong - that's my current understanding).
Grmmbll. I think I anyway found why it is not working: ns3::DcaTxop has
no WifiMacQueue attribute.
However, ns3::WifiNetDevice has a Mac attribute and ns3::RegularWifiMac
has a DcaTxop attribute (you can check it by running your program with
--PrintAttributes=ns3::WifiNetDevice).
Now, as I said above, if you look at dca-txop.cc, you'll see there is no
WifiMacQueue attribute. However, if I am not mistaken, WifiMacQueue is
aggregated:
DcaTxop::DcaTxop ()
: m_manager (0),
m_currentPacket (0)
{
NS_LOG_FUNCTION (this);
m_transmissionListener = new DcaTxop::TransmissionListener (this);
m_dcf = new DcaTxop::Dcf (this);
m_queue = CreateObject<WifiMacQueue> ();
m_rng = new RealRandomStream ();
m_txMiddle = new MacTxMiddle ();
}
And see also
http://www.nsnam.org/docs/manual/html/object-model.html#aggregation-example
for reference purpose.
Hence, can you try (sorry, again) the two earlier path with
$ns3::WifiMacQueue ?
If that does not work, we will file a bug to resolve it. It should not
be that complicated (or undocumented) to access WifiMacQueue attributes
for Wifi.
Thanks
On 4/3/11 2:41 PM, Ruben Merz wrote:
>
>
> On 4/3/11 11:44 AM, David Taylor wrote:
>> Still doesn't work... From the link u gave it seems like it shouldn't
>> work anyway, since WifiMacQueue is never aggregated... (I might be
>> wrong - that's my current understanding).
>
> Grmmbll. I think I anyway found why it is not working: ns3::DcaTxop has
> no WifiMacQueue attribute.
>
> However, ns3::WifiNetDevice has a Mac attribute and ns3::RegularWifiMac
> has a DcaTxop attribute (you can check it by running your program with
> --PrintAttributes=ns3::WifiNetDevice).
>
> Now, as I said above, if you look at dca-txop.cc, you'll see there is no
> WifiMacQueue attribute. However, if I am not mistaken, WifiMacQueue is
> aggregated:
I'm tired, WifiMacQueue is not aggregated (no call to
AggregateObject()). So yes, won't work.
See http://www.nsnam.org/bugzilla/show_bug.cgi?id=1090
Do you care to write a patch?
R
R
Or,at least, please post some example code (I can use it for a HOWTO
afterwards).
Thanks,
Best,
Ruben