A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ns3::UanMacRc Class Reference

Non-gateway node MAC for reservation channel MAC protocol. More...

#include <uan-mac-rc.h>

+ Inheritance diagram for ns3::UanMacRc:
+ Collaboration diagram for ns3::UanMacRc:

Public Types

enum  {
  TYPE_DATA, TYPE_GWPING, TYPE_RTS, TYPE_CTS,
  TYPE_ACK
}

Public Member Functions

 UanMacRc ()
virtual ~UanMacRc ()
int64_t AssignStreams (int64_t stream)
virtual void AttachPhy (Ptr< UanPhy > phy)
virtual void Clear (void)
virtual bool Enqueue (Ptr< Packet > pkt, const Address &dest, uint16_t protocolNumber)
virtual Address GetAddress (void)
virtual Address GetBroadcast (void) const
virtual void SetAddress (UanAddress addr)
virtual void SetForwardUpCb (Callback< void, Ptr< Packet >, const UanAddress & > cb)

Static Public Member Functions

static TypeId GetTypeId (void)
 This method returns the TypeId associated to ns3::UanMacRc.

Protected Member Functions

void DoDispose ()

Private Types

enum  State {
  UNASSOCIATED, GWPSENT, IDLE, RTSSENT,
  DATATX
}

Private Member Functions

void Associate (void)
void AssociateTimeout (void)
void BlockRtsing (void)
UanHeaderRcRts CreateRtsHeader (const Reservation &res)
bool IsPhy1Ok (void)
void ProcessAck (Ptr< Packet > ack)
void ReceiveOkFromPhy (Ptr< Packet >, double sinr, UanTxMode mode)
void RtsTimeout (void)
void ScheduleData (const UanHeaderRcCts &ctsh, const UanHeaderRcCtsGlobal &ctsg, uint32_t ctsBytes)
void SendPacket (Ptr< Packet > pkt, uint32_t rate)
void SendRts (void)

Private Attributes

UanAddress m_address
UanAddress m_assocAddr
bool m_cleared
uint32_t m_ctsSizeG
uint32_t m_ctsSizeN
uint32_t m_currentRate
TracedCallback< Ptr< const
Packet >, uint16_t > 
m_dequeueLogger
TracedCallback< Ptr< const
Packet >, uint16_t > 
m_enqueueLogger
Ptr< ExponentialRandomVariablem_ev
 Provides exponential random variables.
Callback< void, Ptr< Packet >
, const UanAddress & > 
m_forwardUpCb
uint8_t m_frameNo
Time m_learnedProp
uint32_t m_maxFrames
double m_minRetryRate
uint32_t m_numRates
uint16_t m_numRetryRates
Ptr< UanPhym_phy
std::list< std::pair< Ptr
< Packet >, UanAddress > > 
m_pktQueue
uint32_t m_queueLimit
std::list< Reservationm_resList
double m_retryRate
double m_retryStep
bool m_rtsBlocked
EventId m_rtsEvent
TracedCallback< Ptr< const
Packet >, UanTxMode
m_rxLogger
Time m_sifs
EventId m_startAgain
State m_state

Static Private Attributes

static uint32_t m_cntrlSends = 0

Detailed Description

Non-gateway node MAC for reservation channel MAC protocol.

This MAC protocol assumes a network topology where all traffic is destined for a set of GW nodes which are connected via some out of band (RF?) means. This particular implementation assumes that there is only a single gateway.

For more information on class operation email lentr.nosp@m.acy@.nosp@m.u.was.nosp@m.hing.nosp@m.ton.e.nosp@m.du (This work is, as of yet, unpublished)

Definition at line 137 of file uan-mac-rc.h.

Member Enumeration Documentation

anonymous enum
Enumerator:
TYPE_DATA 
TYPE_GWPING 
TYPE_RTS 
TYPE_CTS 
TYPE_ACK 

Definition at line 140 of file uan-mac-rc.h.

enum ns3::UanMacRc::State
private
Enumerator:
UNASSOCIATED 
GWPSENT 
IDLE 
RTSSENT 
DATATX 

Definition at line 168 of file uan-mac-rc.h.

Constructor & Destructor Documentation

ns3::UanMacRc::UanMacRc ( )

Definition at line 153 of file uan-mac-rc.cc.

References ns3::UanHeaderRcCtsGlobal::GetSerializedSize(), ns3::UanHeaderRcCts::GetSerializedSize(), m_ctsSizeG, m_ctsSizeN, and m_ev.

+ Here is the call graph for this function:

ns3::UanMacRc::~UanMacRc ( )
virtual

Definition at line 171 of file uan-mac-rc.cc.

Member Function Documentation

int64_t ns3::UanMacRc::AssignStreams ( int64_t  stream)
virtual

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.

Parameters
streamfirst stream index to use
Returns
the number of stream indices assigned by this model

Implements ns3::UanMac.

Definition at line 271 of file uan-mac-rc.cc.

References m_ev, NS_LOG_FUNCTION, and ns3::RandomVariableStream::SetStream().

+ Here is the call graph for this function:

void ns3::UanMacRc::AttachPhy ( Ptr< UanPhy phy)
virtual

Attach PHY layer to this MAC. Some MACs may be designed to work with multiple PHY layers. Others may only work with one.

Parameters
phyPhy layer to attach to this MAC

Implements ns3::UanMac.

Definition at line 333 of file uan-mac-rc.cc.

References m_phy, ns3::MakeCallback(), ReceiveOkFromPhy(), and ns3::UanPhy::SetReceiveOkCallback().

+ Here is the call graph for this function:

void ns3::UanMacRc::BlockRtsing ( void  )
private

Definition at line 776 of file uan-mac-rc.cc.

References m_rtsBlocked.

Referenced by ReceiveOkFromPhy().

+ Here is the caller graph for this function:

void ns3::UanMacRc::Clear ( void  )
virtual

Clears all pointer references

Implements ns3::UanMac.

Definition at line 176 of file uan-mac-rc.cc.

References ns3::EventId::Cancel(), ns3::UanPhy::Clear(), m_cleared, m_phy, m_pktQueue, m_resList, m_rtsEvent, and m_startAgain.

Referenced by DoDispose().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::UanMacRc::DoDispose ( void  )
protectedvirtual

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 200 of file uan-mac-rc.cc.

References Clear().

+ Here is the call graph for this function:

bool ns3::UanMacRc::Enqueue ( Ptr< Packet pkt,
const Address dest,
uint16_t  protocolNumber 
)
virtual

Enqueue packet to be transmitted

Parameters
pktPacket to be transmitted
destDestination address
protocolNumberProtocol #. Usage varies by MAC

Implements ns3::UanMac.

Definition at line 291 of file uan-mac-rc.cc.

References Associate(), ns3::UanAddress::ConvertFrom(), DATATX, GWPSENT, IDLE, ns3::EventId::IsRunning(), m_pktQueue, m_queueLimit, m_rtsEvent, m_state, NS_LOG_WARN, RTSSENT, SendRts(), and UNASSOCIATED.

+ Here is the call graph for this function:

Address ns3::UanMacRc::GetAddress ( void  )
virtual
Returns
MAC Address

Implements ns3::UanMac.

Definition at line 279 of file uan-mac-rc.cc.

References m_address.

Referenced by ReceiveOkFromPhy().

+ Here is the caller graph for this function:

Address ns3::UanMacRc::GetBroadcast ( void  ) const
virtual
Returns
Broadcast address

Implements ns3::UanMac.

Definition at line 340 of file uan-mac-rc.cc.

Referenced by ReceiveOkFromPhy().

+ Here is the caller graph for this function:

TypeId ns3::UanMacRc::GetTypeId ( void  )
static

This method returns the TypeId associated to ns3::UanMacRc.

This object is accessible through the following paths with Config::Set and Config::Connect:

  • /NodeList/[i]/DeviceList/[i]/$ns3::UanNetDevice/Mac/$ns3::UanMacRc

Attributes defined for this type:

  • RetryRate: Number of retry attempts per second (of RTS/GWPING)
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: 0.2
    • Flags: construct write read
  • MaxFrames: Maximum number of frames to include in a single RTS
  • QueueLimit: Maximum packets to queue at MAC
  • SIFS: Spacing to give between frames (this should match gateway)
    • Set with class: TimeValue
    • Underlying type: Time
    • Initial value: +200000000.0ns
    • Flags: construct write read
  • NumberOfRates: Number of rate divisions supported by each PHY
  • MinRetryRate: Smallest allowed RTS retry rate
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: 0.01
    • Flags: construct write read
  • RetryStep: Retry rate increment
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: 0.01
    • Flags: construct write read
  • NumberOfRetryRates: Number of retry rates
  • MaxPropDelay: Maximum possible propagation delay to gateway
    • Set with class: TimeValue
    • Underlying type: Time
    • Initial value: +2000000000.0ns
    • Flags: construct write read

TraceSources defined for this type:

  • Enqueue: A (data) packet arrived at MAC for transmission
  • Dequeue: A (data) packet was passed down to PHY from MAC
  • RX: A packet was destined for and received at this MAC layer

Reimplemented from ns3::UanMac.

Definition at line 207 of file uan-mac-rc.cc.

References m_dequeueLogger, m_enqueueLogger, m_learnedProp, m_maxFrames, m_minRetryRate, m_numRates, m_numRetryRates, m_queueLimit, m_retryRate, m_retryStep, m_rxLogger, m_sifs, ns3::MakeTraceSourceAccessor(), ns3::Seconds(), and ns3::TypeId::SetParent().

+ Here is the call graph for this function:

bool ns3::UanMacRc::IsPhy1Ok ( void  )
private

Definition at line 714 of file uan-mac-rc.cc.

References ns3::UanHeaderCommon::GetDest(), ns3::Object::GetObject(), ns3::UanHeaderCommon::GetType(), m_address, m_phy, ns3::Packet::PeekHeader(), TYPE_ACK, and TYPE_CTS.

Referenced by Associate(), AssociateTimeout(), RtsTimeout(), and SendRts().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::UanMacRc::ProcessAck ( Ptr< Packet ack)
private

Definition at line 558 of file uan-mac-rc.cc.

References ns3::UanHeaderRcAck::GetFrameNo(), ns3::UanHeaderRcAck::GetNackedFrames(), ns3::UanHeaderRcAck::GetNoNacks(), m_address, m_pktQueue, m_resList, ns3::Simulator::Now(), NS_LOG_DEBUG, and ns3::Packet::RemoveHeader().

Referenced by ReceiveOkFromPhy().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::UanMacRc::SendPacket ( Ptr< Packet pkt,
uint32_t  rate 
)
private
void ns3::UanMacRc::SetAddress ( UanAddress  addr)
virtual
Parameters
addrUanAddress for this MAC

Implements ns3::UanMac.

Definition at line 285 of file uan-mac-rc.cc.

References m_address.

void ns3::UanMacRc::SetForwardUpCb ( Callback< void, Ptr< Packet >, const UanAddress & >  cb)
virtual
Parameters
cbCallback to be called when a packet is forwarded up to higher layer

Implements ns3::UanMac.

Definition at line 327 of file uan-mac-rc.cc.

References m_forwardUpCb.

Member Data Documentation

UanAddress ns3::UanMacRc::m_assocAddr
private

Definition at line 178 of file uan-mac-rc.h.

Referenced by ReceiveOkFromPhy(), and ScheduleData().

bool ns3::UanMacRc::m_cleared
private

Definition at line 195 of file uan-mac-rc.h.

Referenced by Clear().

uint32_t ns3::UanMacRc::m_cntrlSends = 0
staticprivate

Definition at line 220 of file uan-mac-rc.h.

Referenced by Associate(), AssociateTimeout(), RtsTimeout(), and SendRts().

uint32_t ns3::UanMacRc::m_ctsSizeG
private

Definition at line 193 of file uan-mac-rc.h.

Referenced by UanMacRc().

uint32_t ns3::UanMacRc::m_ctsSizeN
private

Definition at line 192 of file uan-mac-rc.h.

Referenced by UanMacRc().

uint32_t ns3::UanMacRc::m_currentRate
private
TracedCallback<Ptr<const Packet>, uint16_t > ns3::UanMacRc::m_dequeueLogger
private

Definition at line 204 of file uan-mac-rc.h.

Referenced by GetTypeId(), and SendPacket().

TracedCallback<Ptr<const Packet>, uint16_t > ns3::UanMacRc::m_enqueueLogger
private

Definition at line 203 of file uan-mac-rc.h.

Referenced by GetTypeId().

Ptr<ExponentialRandomVariable> ns3::UanMacRc::m_ev
private

Provides exponential random variables.

Definition at line 223 of file uan-mac-rc.h.

Referenced by AssignStreams(), Associate(), AssociateTimeout(), RtsTimeout(), ScheduleData(), SendRts(), and UanMacRc().

Callback<void, Ptr<Packet>, const UanAddress& > ns3::UanMacRc::m_forwardUpCb
private

Definition at line 200 of file uan-mac-rc.h.

Referenced by ReceiveOkFromPhy(), and SetForwardUpCb().

uint8_t ns3::UanMacRc::m_frameNo
private

Definition at line 184 of file uan-mac-rc.h.

Referenced by Associate(), and SendRts().

Time ns3::UanMacRc::m_learnedProp
private

Definition at line 186 of file uan-mac-rc.h.

Referenced by GetTypeId(), and ScheduleData().

uint32_t ns3::UanMacRc::m_maxFrames
private

Definition at line 182 of file uan-mac-rc.h.

Referenced by Associate(), GetTypeId(), and SendRts().

double ns3::UanMacRc::m_minRetryRate
private

Definition at line 189 of file uan-mac-rc.h.

Referenced by GetTypeId(), and ReceiveOkFromPhy().

uint32_t ns3::UanMacRc::m_numRates
private

Definition at line 180 of file uan-mac-rc.h.

Referenced by Associate(), AssociateTimeout(), GetTypeId(), RtsTimeout(), and SendRts().

uint16_t ns3::UanMacRc::m_numRetryRates
private

Definition at line 188 of file uan-mac-rc.h.

Referenced by GetTypeId().

Ptr<UanPhy> ns3::UanMacRc::m_phy
private
std::list<std::pair <Ptr<Packet>, UanAddress > > ns3::UanMacRc::m_pktQueue
private

Definition at line 197 of file uan-mac-rc.h.

Referenced by Associate(), Clear(), Enqueue(), ProcessAck(), ScheduleData(), and SendRts().

uint32_t ns3::UanMacRc::m_queueLimit
private

Definition at line 183 of file uan-mac-rc.h.

Referenced by Enqueue(), and GetTypeId().

std::list<Reservation> ns3::UanMacRc::m_resList
private
double ns3::UanMacRc::m_retryRate
private
double ns3::UanMacRc::m_retryStep
private

Definition at line 190 of file uan-mac-rc.h.

Referenced by GetTypeId(), and ReceiveOkFromPhy().

bool ns3::UanMacRc::m_rtsBlocked
private
EventId ns3::UanMacRc::m_rtsEvent
private
TracedCallback<Ptr<const Packet>, UanTxMode > ns3::UanMacRc::m_rxLogger
private

Definition at line 202 of file uan-mac-rc.h.

Referenced by GetTypeId(), and ReceiveOkFromPhy().

Time ns3::UanMacRc::m_sifs
private

Definition at line 185 of file uan-mac-rc.h.

Referenced by GetTypeId(), and ScheduleData().

EventId ns3::UanMacRc::m_startAgain
private

Definition at line 175 of file uan-mac-rc.h.

Referenced by Clear().

State ns3::UanMacRc::m_state
private

The documentation for this class was generated from the following files: