diff -r a9796fc4a88c src/devices/wifi/dca-txop.cc --- a/src/devices/wifi/dca-txop.cc Thu Oct 02 16:33:58 2008 +0200 +++ b/src/devices/wifi/dca-txop.cc Fri Oct 03 03:32:39 2008 +0200 @@ -305,12 +305,6 @@ return station->NeedFragmentation (m_currentPacket); } -uint32_t -DcaTxop::GetNFragments (void) -{ - WifiRemoteStation *station = GetStation (m_currentHdr.GetAddr1 ()); - return station->GetNFragments (m_currentPacket); -} void DcaTxop::NextFragment (void) { @@ -337,12 +331,19 @@ return station->GetFragmentSize (m_currentPacket, m_fragmentNumber + 1); } +uint32_t +DcaTxop::GetFragmentOffset (void) +{ + WifiRemoteStation *station = GetStation (m_currentHdr.GetAddr1 ()); + return station->GetFragmentOffset (m_currentPacket, m_fragmentNumber); +} + Ptr DcaTxop::GetFragmentPacket (WifiMacHeader *hdr) { *hdr = m_currentHdr; hdr->SetFragmentNumber (m_fragmentNumber); - uint32_t startOffset = m_fragmentNumber * GetFragmentSize (); + uint32_t startOffset = GetFragmentOffset (); Ptr fragment; if (IsLastFragment ()) { diff -r a9796fc4a88c src/devices/wifi/dca-txop.h --- a/src/devices/wifi/dca-txop.h Thu Oct 02 16:33:58 2008 +0200 +++ b/src/devices/wifi/dca-txop.h Fri Oct 03 03:32:39 2008 +0200 @@ -137,9 +137,9 @@ bool NeedRtsRetransmission (void); bool NeedDataRetransmission (void); bool NeedFragmentation (void); - uint32_t GetNFragments (void); uint32_t GetNextFragmentSize (void); uint32_t GetFragmentSize (void); + uint32_t GetFragmentOffset (void); WifiRemoteStation *GetStation (Mac48Address to) const; bool IsLastFragment (void); void NextFragment (void); diff -r a9796fc4a88c src/devices/wifi/wifi-remote-station-manager.cc --- a/src/devices/wifi/wifi-remote-station-manager.cc Thu Oct 02 16:33:58 2008 +0200 +++ b/src/devices/wifi/wifi-remote-station-manager.cc Fri Oct 03 03:32:39 2008 +0200 @@ -656,6 +656,14 @@ return GetManager ()->GetFragmentationThreshold (); } } +uint32_t +WifiRemoteStation::GetFragmentOffset (Ptr packet, uint32_t fragmentNumber) +{ + uint32_t nFragment = GetNFragments (packet); + NS_ASSERT (fragmentNumber < nFragment); + uint32_t fragmentOffset = fragmentNumber * GetManager ()->GetFragmentationThreshold (); + return fragmentOffset; +} bool WifiRemoteStation::IsLastFragment (Ptr packet, uint32_t fragmentNumber) diff -r a9796fc4a88c src/devices/wifi/wifi-remote-station-manager.h --- a/src/devices/wifi/wifi-remote-station-manager.h Thu Oct 02 16:33:58 2008 +0200 +++ b/src/devices/wifi/wifi-remote-station-manager.h Fri Oct 03 03:32:39 2008 +0200 @@ -228,15 +228,16 @@ virtual bool NeedFragmentation (Ptr packet); /** * \param packet the packet to send - * \returns the number of fragments which should be used for this packet. - */ - virtual uint32_t GetNFragments (Ptr packet); - /** - * \param packet the packet to send * \param fragmentNumber the fragment index of the next fragment to send (starts at zero). * \returns the size of the corresponding fragment. */ virtual uint32_t GetFragmentSize (Ptr packet, uint32_t fragmentNumber); + /** + * \param packet the packet to send + * \param fragmentNumber the fragment index of the next fragment to send (starts at zero). + * \returns the offset within the original packet where this fragment starts. + */ + virtual uint32_t GetFragmentOffset (Ptr packet, uint32_t fragmentNumber); /** * \param packet the packet to send * \param fragmentNumber the fragment index of the next fragment to send (starts at zero). @@ -262,6 +263,7 @@ virtual Ptr GetManager (void) const = 0; virtual WifiMode DoGetDataMode (uint32_t size) = 0; virtual WifiMode DoGetRtsMode (void) = 0; + uint32_t GetNFragments (Ptr packet); protected: virtual void DoReportRtsFailed (void) = 0; virtual void DoReportDataFailed (void) = 0;