handle packet fragmentation and retransmissions.This class implements the packet fragmentation and retransmission policy. It uses the ns3::MacLow and ns3::DcfManager helper classes to respectively send packets and decide when to send them. Packets are stored in a ns3::WifiMacQueue until they can be sent. More...
#include <dca-txop.h>
Classes | |
struct | ActiveChannels |
class | Dcf |
class | TransmissionListener |
Public Types | |
typedef Callback< void, const WifiMacHeader & > | TxFailed |
typedef Callback< void, const WifiMacHeader & > | TxOk |
Public Member Functions | |
int64_t | AssignStreams (int64_t stream) |
virtual uint32_t | GetAifsn (void) const |
virtual uint32_t | GetMaxCw (void) const |
virtual uint32_t | GetMinCw (void) const |
Ptr< WifiMacQueue > | GetQueue () const |
void | Queue (Ptr< const Packet > packet, const WifiMacHeader &hdr) |
void | RestartAccessIfNeeded (void) |
virtual void | SetAifsn (uint32_t aifsn) |
void | SetLow (Ptr< MacLow > low) |
void | SetManager (DcfManager *manager) |
virtual void | SetMaxCw (uint32_t maxCw) |
virtual void | SetMinCw (uint32_t minCw) |
void | SetTxFailedCallback (TxFailed callback) |
void | SetTxOkCallback (TxOk callback) |
void | SetWifiRemoteStationManager (Ptr< WifiRemoteStationManager > remoteManager) |
Public Member Functions inherited from ns3::Object | |
void | AggregateObject (Ptr< Object > other) |
void | Dispose (void) |
AggregateIterator | GetAggregateIterator (void) const |
virtual TypeId | GetInstanceTypeId (void) const |
template<typename T > | |
Ptr< T > | GetObject (void) const |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
void | Initialize (void) |
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
SimpleRefCount (const SimpleRefCount &o) | |
uint32_t | GetReferenceCount (void) const |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
void | Ref (void) const |
void | Unref (void) const |
Public Member Functions inherited from ns3::ObjectBase | |
void | GetAttribute (std::string name, AttributeValue &value) const |
bool | GetAttributeFailSafe (std::string name, AttributeValue &attribute) const |
void | SetAttribute (std::string name, const AttributeValue &value) |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
Static Public Member Functions inherited from ns3::Dcf | |
static TypeId | GetTypeId (void) |
Static Public Member Functions inherited from ns3::Object | |
static TypeId | GetTypeId (void) |
Static Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
static void | Cleanup (void) |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId (void) |
Private Types | |
typedef std::list< struct ActiveChannels > | ListActiveChannels |
typedef std::list< struct ActiveChannels >::iterator | ListActiveChannelsI |
Private Member Functions | |
DcaTxop (const DcaTxop &o) | |
void | Cancel (void) |
virtual void | DoDispose (void) |
void | DoInitialize () |
void | EndTxNoAck (void) |
uint32_t | GetFragmentOffset (void) |
Ptr< Packet > | GetFragmentPacket (WifiMacHeader *hdr) |
uint32_t | GetFragmentSize (void) |
uint16_t | GetNextActiveChannel (void) |
uint32_t | GetNextFragmentSize (void) |
void | GotAck (double snr, WifiMode txMode) |
void | GotCts (double snr, WifiMode txMode) |
bool | IsLastFragment (void) |
Ptr< MacLow > | Low (void) |
void | MissedAck (void) |
void | MissedCts (void) |
bool | NeedDataRetransmission (void) |
bool | NeedFragmentation (void) |
bool | NeedRts (Ptr< const Packet > packet, const WifiMacHeader *header) |
bool | NeedRtsRetransmission (void) |
bool | NeedsAccess (void) const |
void | NextFragment (void) |
void | NotifyAccessGranted (void) |
void | NotifyChannelSensing (void) |
void | NotifyChannelSwitching (Time duration, uint16_t toChannel) |
void | NotifyCollision (void) |
void | NotifyInternalCollision (void) |
DcaTxop & | operator= (const DcaTxop &) |
void | StartAccessIfNeeded (void) |
void | StartNext (void) |
void | SwitchQueueHandler (void) |
void | UpdateActiveChannels (uint16_t channel) |
Private Attributes | |
bool | m_accessOngoing |
ListActiveChannels | m_activeChannels |
Time | m_activeChannelTimeout |
uint16_t | m_currentChannel |
WifiMacHeader | m_currentHdr |
Ptr< const Packet > | m_currentPacket |
Dcf * | m_dcf |
uint8_t | m_fragmentNumber |
Ptr< MacLow > | m_low |
DcfManager * | m_manager |
Ptr< WifiMacQueue > | m_queue |
Time | m_queueUtilizationTime |
RandomStream * | m_rng |
Ptr< WifiRemoteStationManager > | m_stationManager |
EventId | m_switchQueueTimer |
TransmissionListener * | m_transmissionListener |
TxFailed | m_txFailedCallback |
MacTxMiddle * | m_txMiddle |
TxOk | m_txOkCallback |
Friends | |
class | Dcf |
class | TransmissionListener |
Additional Inherited Members | |
Protected Member Functions inherited from ns3::Object | |
Object (const Object &o) | |
virtual void | NotifyNewAggregate (void) |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
virtual void | NotifyConstructionCompleted (void) |
handle packet fragmentation and retransmissions.
This class implements the packet fragmentation and retransmission policy. It uses the ns3::MacLow and ns3::DcfManager helper classes to respectively send packets and decide when to send them. Packets are stored in a ns3::WifiMacQueue until they can be sent.
The policy currently implemented uses a simple fragmentation threshold: any packet bigger than this threshold is fragmented in fragments whose size is smaller than the threshold.
The retransmission policy is also very simple: every packet is retransmitted until it is either successfully transmitted or it has been retransmitted up until the ssrc or slrc thresholds.
The rts/cts policy is similar to the fragmentation policy: when a packet is bigger than a threshold, the rts/cts protocol is used.
ns3::DcaTxop is accessible through the following paths with Config::Set and Config::Connect:
No TraceSources are defined for this type.
Definition at line 70 of file dca-txop.h.
int64_t ns3::DcaTxop::AssignStreams | ( | int64_t | stream | ) |
Assign a fixed random variable stream number to the random variables used by this model. Return the number of streams (possibly zero) that have been assigned.
stream | first stream index to use |
Definition at line 388 of file dca-txop.cc.
References ns3::RandomStream::AssignStreams(), and NS_LOG_FUNCTION.
|
private |
This happens in only one case: in an AP, you have two DcaTxop:
If the normal queue tries to send a unicast data frame, but if the tx fails (ack timeout), it starts a backoff. If the beacon queue gets a tx oportunity during this backoff, it will trigger a call to this Cancel function.
Since we are already doing a backoff, we will get access to the medium when we can, we have nothing to do here. We just ignore the cancel event and wait until we are given again a tx oportunity.
Note that this is really non-trivial because each of these frames is assigned a sequence number from the same sequence counter (because this is a non-802.11e device) so, the scheme described here fails to ensure in-order delivery of frames at the receiving side. This, however, does not matter in this case because we assume that the receiving side does not update its <seq,ad> tupple for packets whose destination address is a broadcast address.
Definition at line 753 of file dca-txop.cc.
References NS_LOG_DEBUG, and NS_LOG_FUNCTION.
Referenced by ns3::DcaTxop::TransmissionListener::Cancel().
|
privatevirtual |
This method is called by Object::Dispose or by the object's destructor, whichever comes first.
Subclasses are expected to implement their real destruction code in an overriden version of this method and chain up to their parent's implementation once they are done. i.e., for simplicity, the destructor of every subclass should be empty and its content should be moved to the associated DoDispose method.
It is safe to call GetObject from within this method.
Reimplemented from ns3::Object.
Definition at line 173 of file dca-txop.cc.
References NS_LOG_FUNCTION.
|
privatevirtual |
This method is called only once by Object::Initialize. If the user calls Object::Initialize multiple times, DoInitialize is called only the first time.
Subclasses are expected to override this method and chain up to their parent's implementation once they are done. It is safe to call GetObject and AggregateObject from within this method.
Reimplemented from ns3::Object.
Definition at line 436 of file dca-txop.cc.
References ns3::Object::DoInitialize(), ns3::DcfState::GetCw(), NS_LOG_FUNCTION, ns3::DcfState::ResetCw(), and ns3::DcfState::StartBackoffNow().
|
private |
When a channel switching occurs, enqueued packets are removed.
Definition at line 632 of file dca-txop.cc.
References NS_LOG_FUNCTION.
Referenced by ns3::DcaTxop::Dcf::DoNotifyChannelSwitching().
void ns3::DcaTxop::Queue | ( | Ptr< const Packet > | packet, |
const WifiMacHeader & | hdr | ||
) |
packet | packet to send |
hdr | header of packet to send. |
Store the packet in the internal queue until it can be sent safely.
Definition at line 267 of file dca-txop.cc.
References ns3::WifiMacTrailer::GetSerializedSize(), ns3::WifiMacHeader::GetSerializedSize(), ns3::Packet::GetSize(), ns3::EventId::IsRunning(), NS_LOG_FUNCTION, NS_LOG_LOGIC, and ns3::Simulator::Schedule().
void ns3::DcaTxop::RestartAccessIfNeeded | ( | void | ) |
Restart the backoff timer if packets are queued This can be used after sensing/handoff in CR networks
Definition at line 396 of file dca-txop.cc.
References ns3::DcfState::IsAccessRequested(), NS_LOG_FUNCTION, and ns3::DcfManager::RequestAccess().
void ns3::DcaTxop::SetTxFailedCallback | ( | TxFailed | callback | ) |
callback | the callback to invoke when a packet transmission was completed unsuccessfully. |
Definition at line 216 of file dca-txop.cc.
References NS_LOG_FUNCTION.
void ns3::DcaTxop::SetTxOkCallback | ( | TxOk | callback | ) |
callback | the callback to invoke when a packet transmission was completed successfully. |
Definition at line 210 of file dca-txop.cc.
References NS_LOG_FUNCTION.