A Discrete-Event Network Simulator
API
uan-header-rc.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2009 University of Washington
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Leonard Tracy <lentracy@gmail.com>
19  */
20 
21 
22 #ifndef UAN_HEADER_RC_H
23 #define UAN_HEADER_RC_H
24 
25 #include "ns3/header.h"
26 #include "ns3/nstime.h"
27 #include "ns3/mac8-address.h"
28 
29 #include <set>
30 
31 namespace ns3 {
32 
41 class UanHeaderRcData : public Header
42 {
43 public:
45  UanHeaderRcData ();
53  UanHeaderRcData (uint8_t frameNum, Time propDelay);
55  virtual ~UanHeaderRcData ();
56 
61  static TypeId GetTypeId (void);
62 
68  void SetFrameNo (uint8_t frameNum);
75  void SetPropDelay (Time propDelay);
81  uint8_t GetFrameNo (void) const;
88  Time GetPropDelay (void) const;
95  void Print (std::ostream &os, Time::Unit unit) const;
96 
97  // Inherrited methods
98  virtual uint32_t GetSerializedSize (void) const;
99  virtual void Serialize (Buffer::Iterator start) const;
100  virtual uint32_t Deserialize (Buffer::Iterator start);
101  virtual void Print (std::ostream &os) const;
102  virtual TypeId GetInstanceTypeId (void) const;
103 
104 private:
105  uint8_t m_frameNo;
107 
108 }; // class UanHeaderRcData
109 
117 class UanHeaderRcRts : public Header
118 {
119 public:
121  UanHeaderRcRts ();
132  UanHeaderRcRts (uint8_t frameNo, uint8_t retryNo, uint8_t noFrames, uint16_t length, Time ts);
134  virtual ~UanHeaderRcRts ();
135 
140  static TypeId GetTypeId (void);
141 
147  void SetFrameNo (uint8_t fno);
153  void SetNoFrames (uint8_t no);
159  void SetTimeStamp (Time timeStamp);
166  void SetLength (uint16_t length);
174  void SetRetryNo (uint8_t no);
175 
181  uint8_t GetFrameNo (void) const;
187  uint8_t GetNoFrames (void) const;
194  Time GetTimeStamp (void) const;
200  uint16_t GetLength (void) const;
206  uint8_t GetRetryNo (void) const;
213  void Print (std::ostream &os, Time::Unit unit) const;
214 
215  // Inherrited methods
216  virtual uint32_t GetSerializedSize (void) const;
217  virtual void Serialize (Buffer::Iterator start) const;
218  virtual uint32_t Deserialize (Buffer::Iterator start);
219  virtual void Print (std::ostream &os) const;
220  virtual TypeId GetInstanceTypeId (void) const;
221 
222 private:
223  uint8_t m_frameNo;
224  uint8_t m_noFrames;
225  uint16_t m_length;
227  uint8_t m_retryNo;
228 
229 }; // class UanHeaderRcRts
230 
239 {
240 public:
251  UanHeaderRcCtsGlobal (Time wt, Time ts, uint16_t rate, uint16_t retryRate);
254 
259  static TypeId GetTypeId (void);
260 
265  void SetRateNum (uint16_t rate);
270  void SetRetryRate (uint16_t rate);
277  void SetWindowTime (Time t);
278 
284  void SetTxTimeStamp (Time timeStamp);
285 
291  uint16_t GetRateNum (void) const;
297  uint16_t GetRetryRate (void) const;
304  Time GetWindowTime (void) const;
310  Time GetTxTimeStamp (void) const;
317  void Print (std::ostream &os, Time::Unit unit) const;
318 
319  // Inherrited methods
320  virtual uint32_t GetSerializedSize (void) const;
321  virtual void Serialize (Buffer::Iterator start) const;
322  virtual uint32_t Deserialize (Buffer::Iterator start);
323  virtual void Print (std::ostream &os) const;
324  virtual TypeId GetInstanceTypeId (void) const;
325 
326 private:
329  uint16_t m_retryRate;
330  uint16_t m_rateNum;
331 
332 }; // class UanHeaderRcCtsGlobal
333 
342 class UanHeaderRcCts : public Header
343 {
344 public:
346  UanHeaderRcCts ();
357  UanHeaderRcCts (uint8_t frameNo, uint8_t retryNo, Time rtsTs, Time delay, Mac8Address addr);
359  virtual ~UanHeaderRcCts ();
360 
365  static TypeId GetTypeId (void);
366 
372  void SetFrameNo (uint8_t frameNo);
378  void SetRtsTimeStamp (Time timeStamp);
384  void SetDelayToTx (Time delay);
390  void SetRetryNo (uint8_t no);
396  void SetAddress (Mac8Address addr);
397 
403  uint8_t GetFrameNo (void) const;
409  Time GetRtsTimeStamp (void) const;
416  Time GetDelayToTx (void) const;
422  uint8_t GetRetryNo (void) const;
428  Mac8Address GetAddress (void) const;
435  void Print (std::ostream &os, Time::Unit unit) const;
436 
437  // Inherrited methods
438  virtual uint32_t GetSerializedSize (void) const;
439  virtual void Serialize (Buffer::Iterator start) const;
440  virtual uint32_t Deserialize (Buffer::Iterator start);
441  virtual void Print (std::ostream &os) const;
442  virtual TypeId GetInstanceTypeId (void) const;
443 
444 private:
445  uint8_t m_frameNo;
447  uint8_t m_retryNo;
450 
451 }; // class UanHeaderRcCts
452 
458 class UanHeaderRcAck : public Header
459 {
460 public:
462  UanHeaderRcAck ();
464  virtual ~UanHeaderRcAck ();
465 
470  static TypeId GetTypeId (void);
471 
477  void SetFrameNo (uint8_t frameNo);
483  void AddNackedFrame (uint8_t frame);
484 
490  const std::set<uint8_t> &GetNackedFrames (void) const;
496  uint8_t GetFrameNo (void) const;
502  uint8_t GetNoNacks (void) const;
503 
504  // Inherrited methods
505  virtual uint32_t GetSerializedSize (void) const;
506  virtual void Serialize (Buffer::Iterator start) const;
507  virtual uint32_t Deserialize (Buffer::Iterator start);
508  virtual void Print (std::ostream &os) const;
509  virtual TypeId GetInstanceTypeId (void) const;
510 
511 private:
512  uint8_t m_frameNo;
513  std::set<uint8_t> m_nackedFrames;
514 
515 }; // class UanHeaderRcAck
516 
517 } // namespace ns3
518 
519 #endif /* UAN_HEADER_RC_H */
ns3::UanHeaderRcRts::GetTimeStamp
Time GetTimeStamp(void) const
Get the transmit timestamp of this RTS packet.
Definition: uan-header-rc.cc:211
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
ns3::UanHeaderRcRts::m_timeStamp
Time m_timeStamp
RTS TX timestamp.
Definition: uan-header-rc.h:226
ns3::UanHeaderRcData::GetInstanceTypeId
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition: uan-header-rc.cc:125
ns3::UanHeaderRcCts::GetInstanceTypeId
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition: uan-header-rc.cc:550
ns3::UanHeaderRcCts::SetFrameNo
void SetFrameNo(uint8_t frameNo)
Set the RTS frame number being cleared.
Definition: uan-header-rc.cc:446
ns3::Mac8Address
A class used for addressing MAC8 MAC's.
Definition: mac8-address.h:43
ns3::UanHeaderRcRts::GetSerializedSize
virtual uint32_t GetSerializedSize(void) const
Definition: uan-header-rc.cc:229
ns3::UanHeaderRcRts::m_frameNo
uint8_t m_frameNo
Reservation frame number.
Definition: uan-header-rc.h:223
ns3::UanHeaderRcData::UanHeaderRcData
UanHeaderRcData()
Default constructor.
Definition: uan-header-rc.cc:35
ns3::UanHeaderRcRts::SetTimeStamp
void SetTimeStamp(Time timeStamp)
Set RTS transmission time.
Definition: uan-header-rc.cc:188
ns3::UanHeaderRcCts::Serialize
virtual void Serialize(Buffer::Iterator start) const
Definition: uan-header-rc.cc:513
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::UanHeaderRcData::~UanHeaderRcData
virtual ~UanHeaderRcData()
Destructor.
Definition: uan-header-rc.cc:50
ns3::UanHeaderRcCts::m_delay
Time m_delay
Delay until transmission.
Definition: uan-header-rc.h:448
ns3::UanHeaderRcCtsGlobal::m_timeStampTx
Time m_timeStampTx
Timestamp.
Definition: uan-header-rc.h:327
ns3::UanHeaderRcCts::SetAddress
void SetAddress(Mac8Address addr)
Set the destination address, for scheduling info.
Definition: uan-header-rc.cc:471
ns3::UanHeaderRcRts::GetTypeId
static TypeId GetTypeId(void)
Register this type.
Definition: uan-header-rc.cc:159
ns3::UanHeaderRcRts::GetLength
uint16_t GetLength(void) const
Get the total number of bytes in the reservation, including headers.
Definition: uan-header-rc.cc:205
ns3::UanHeaderRcCtsGlobal::GetRateNum
uint16_t GetRateNum(void) const
Get the data rate number.
Definition: uan-header-rc.cc:357
ns3::UanHeaderRcRts::SetLength
void SetLength(uint16_t length)
Set the number of data bytes in the reservation.
Definition: uan-header-rc.cc:183
ns3::UanHeaderRcCts::Print
void Print(std::ostream &os, Time::Unit unit) const
Specialized Print with Time::Unit declared.
Definition: uan-header-rc.cc:538
ns3::UanHeaderRcAck::UanHeaderRcAck
UanHeaderRcAck()
Default constructor.
Definition: uan-header-rc.cc:555
ns3::UanHeaderRcAck::GetInstanceTypeId
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition: uan-header-rc.cc:655
ns3::UanHeaderRcRts::GetRetryNo
uint8_t GetRetryNo(void) const
Get the retry number of this RTS packet.
Definition: uan-header-rc.cc:217
ns3::UanHeaderRcRts::m_noFrames
uint8_t m_noFrames
Number of data frames in reservation.
Definition: uan-header-rc.h:224
ns3::UanHeaderRcData::GetPropDelay
Time GetPropDelay(void) const
Get the propagation delay found in handshaking.
Definition: uan-header-rc.cc:84
ns3::UanHeaderRcCtsGlobal::SetRateNum
void SetRateNum(uint16_t rate)
Set the rate number corresponding to data rate of current cycle.
Definition: uan-header-rc.cc:315
ns3::UanHeaderRcCtsGlobal::GetInstanceTypeId
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition: uan-header-rc.cc:401
ns3::UanHeaderRcAck::Print
virtual void Print(std::ostream &os) const
Definition: uan-header-rc.cc:639
ns3::UanHeaderRcCtsGlobal::Serialize
virtual void Serialize(Buffer::Iterator start) const
Definition: uan-header-rc.cc:368
ns3::UanHeaderRcData::m_frameNo
uint8_t m_frameNo
Data frame number.
Definition: uan-header-rc.h:105
ns3::UanHeaderRcData::m_propDelay
Time m_propDelay
Propagation delay.
Definition: uan-header-rc.h:106
ns3::UanHeaderRcRts::~UanHeaderRcRts
virtual ~UanHeaderRcRts()
Destructor.
Definition: uan-header-rc.cc:153
ns3::UanHeaderRcRts::SetFrameNo
void SetFrameNo(uint8_t fno)
Set the frame number.
Definition: uan-header-rc.cc:171
ns3::UanHeaderRcRts::m_length
uint16_t m_length
Number of bytes (including headers) in data.
Definition: uan-header-rc.h:225
ns3::UanHeaderRcCtsGlobal::m_winTime
Time m_winTime
Window time.
Definition: uan-header-rc.h:328
ns3::UanHeaderRcCts::UanHeaderRcCts
UanHeaderRcCts()
Default constructor.
Definition: uan-header-rc.cc:406
ns3::UanHeaderRcRts::GetFrameNo
uint8_t GetFrameNo(void) const
Get the frame number.
Definition: uan-header-rc.cc:223
visualizer.core.start
def start()
Definition: core.py:1855
ns3::UanHeaderRcData::GetFrameNo
uint8_t GetFrameNo(void) const
Get the frame number of the reservation being transmitted.
Definition: uan-header-rc.cc:78
ns3::UanHeaderRcCts::GetRetryNo
uint8_t GetRetryNo(void) const
Get the retry number of the RTS packet being cleared.
Definition: uan-header-rc.cc:494
ns3::UanHeaderRcData::GetTypeId
static TypeId GetTypeId(void)
Register this type.
Definition: uan-header-rc.cc:55
ns3::UanHeaderRcCts::m_address
Mac8Address m_address
Destination of CTS packet.
Definition: uan-header-rc.h:449
ns3::UanHeaderRcCts::~UanHeaderRcCts
virtual ~UanHeaderRcCts()
Destructor.
Definition: uan-header-rc.cc:428
ns3::UanHeaderRcRts::SetRetryNo
void SetRetryNo(uint8_t no)
Set the retry number of this RTS packet.
Definition: uan-header-rc.cc:194
ns3::UanHeaderRcCts::m_timeStampRts
Time m_timeStampRts
RX time of RTS packet at gateway.
Definition: uan-header-rc.h:446
ns3::UanHeaderRcRts::Print
void Print(std::ostream &os, Time::Unit unit) const
Specialized Print with Time::Unit declared.
Definition: uan-header-rc.cc:258
ns3::UanHeaderRcCtsGlobal::Print
void Print(std::ostream &os, Time::Unit unit) const
Specialized Print with Time::Unit declared.
Definition: uan-header-rc.cc:389
ns3::UanHeaderRcAck::GetFrameNo
uint8_t GetFrameNo(void) const
Get the reservation frame number being ACKed.
Definition: uan-header-rc.cc:595
ns3::UanHeaderRcData::SetPropDelay
void SetPropDelay(Time propDelay)
Set the propagation delay as found in handshaking.
Definition: uan-header-rc.cc:72
ns3::UanHeaderRcCts::m_retryNo
uint8_t m_retryNo
Retry number of received RTS packet.
Definition: uan-header-rc.h:447
ns3::UanHeaderRcCtsGlobal::~UanHeaderRcCtsGlobal
~UanHeaderRcCtsGlobal()
Destructor.
Definition: uan-header-rc.cc:296
ns3::UanHeaderRcAck::SetFrameNo
void SetFrameNo(uint8_t frameNo)
Set the frame number of the reservation being acknowledged.
Definition: uan-header-rc.cc:577
ns3::UanHeaderRcCts::SetDelayToTx
void SetDelayToTx(Time delay)
Set the time delay from CTS transmission to first data frame arrival.
Definition: uan-header-rc.cc:459
ns3::UanHeaderRcAck::GetTypeId
static TypeId GetTypeId(void)
Register this type.
Definition: uan-header-rc.cc:566
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
ns3::Header
Protocol header serialization and deserialization.
Definition: header.h:43
ns3::UanHeaderRcAck::Serialize
virtual void Serialize(Buffer::Iterator start) const
Definition: uan-header-rc.cc:613
ns3::UanHeaderRcRts::GetNoFrames
uint8_t GetNoFrames(void) const
Get the number of data frames in the reservation.
Definition: uan-header-rc.cc:199
ns3::UanHeaderRcCtsGlobal::GetWindowTime
Time GetWindowTime(void) const
Get the window time (time duration following blocking time to allow RTS transmissions).
Definition: uan-header-rc.cc:339
ns3::UanHeaderRcRts::m_retryNo
uint8_t m_retryNo
Retry number of RTS packet.
Definition: uan-header-rc.h:227
ns3::UanHeaderRcRts::UanHeaderRcRts
UanHeaderRcRts()
Default constructor.
Definition: uan-header-rc.cc:131
ns3::UanHeaderRcCtsGlobal::SetRetryRate
void SetRetryRate(uint16_t rate)
Set the retry rate number for the current cycle.
Definition: uan-header-rc.cc:321
ns3::UanHeaderRcData::SetFrameNo
void SetFrameNo(uint8_t frameNum)
Set the frame number of the reservation being transmitted.
Definition: uan-header-rc.cc:66
ns3::UanHeaderRcCtsGlobal::GetTxTimeStamp
Time GetTxTimeStamp(void) const
Get the CTS transmit timestamp.
Definition: uan-header-rc.cc:345
ns3::UanHeaderRcCts::GetSerializedSize
virtual uint32_t GetSerializedSize(void) const
Definition: uan-header-rc.cc:506
ns3::UanHeaderRcAck::AddNackedFrame
void AddNackedFrame(uint8_t frame)
NACK a frame.
Definition: uan-header-rc.cc:583
ns3::UanHeaderRcRts::GetInstanceTypeId
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition: uan-header-rc.cc:270
ns3::UanHeaderRcData
Extra data header information.
Definition: uan-header-rc.h:42
ns3::UanHeaderRcCts::GetFrameNo
uint8_t GetFrameNo(void) const
Get the frame number of the RTS being cleared.
Definition: uan-header-rc.cc:476
ns3::UanHeaderRcAck
Header used for ACK packets by protocol UanMacRc.
Definition: uan-header-rc.h:459
ns3::UanHeaderRcCtsGlobal
Cycle broadcast information.
Definition: uan-header-rc.h:239
ns3::UanHeaderRcData::Print
void Print(std::ostream &os, Time::Unit unit) const
Specialized Print with Time::Unit declared.
Definition: uan-header-rc.cc:113
ns3::Header::Deserialize
virtual uint32_t Deserialize(Buffer::Iterator start)=0
Deserialize the object from a buffer iterator.
ns3::UanHeaderRcCts::SetRetryNo
void SetRetryNo(uint8_t no)
Set the retry number of the RTS frame being cleared.
Definition: uan-header-rc.cc:465
ns3::UanHeaderRcAck::m_frameNo
uint8_t m_frameNo
Next frame number.
Definition: uan-header-rc.h:512
ns3::UanHeaderRcCtsGlobal::m_retryRate
uint16_t m_retryRate
Retry rate.
Definition: uan-header-rc.h:329
ns3::Buffer::Iterator
iterator in a Buffer instance
Definition: buffer.h:99
ns3::UanHeaderRcAck::GetSerializedSize
virtual uint32_t GetSerializedSize(void) const
Definition: uan-header-rc.cc:607
ns3::UanHeaderRcAck::GetNoNacks
uint8_t GetNoNacks(void) const
Get the number of data frames being NACKed.
Definition: uan-header-rc.cc:601
ns3::UanHeaderRcCts::SetRtsTimeStamp
void SetRtsTimeStamp(Time timeStamp)
Set the timestamp for RTS reception.
Definition: uan-header-rc.cc:452
ns3::UanHeaderRcData::GetSerializedSize
virtual uint32_t GetSerializedSize(void) const
Definition: uan-header-rc.cc:90
ns3::UanHeaderRcCtsGlobal::GetSerializedSize
virtual uint32_t GetSerializedSize(void) const
Definition: uan-header-rc.cc:362
ns3::UanHeaderRcCts::GetAddress
Mac8Address GetAddress(void) const
Get the destination address, for scheduling info.
Definition: uan-header-rc.cc:500
ns3::UanHeaderRcData::Serialize
virtual void Serialize(Buffer::Iterator start) const
Definition: uan-header-rc.cc:96
ns3::UanHeaderRcCts::m_frameNo
uint8_t m_frameNo
Reservation frame number being cleared.
Definition: uan-header-rc.h:445
ns3::UanHeaderRcAck::~UanHeaderRcAck
virtual ~UanHeaderRcAck()
Destructor.
Definition: uan-header-rc.cc:560
ns3::UanHeaderRcCtsGlobal::GetTypeId
static TypeId GetTypeId(void)
Register this type.
Definition: uan-header-rc.cc:302
ns3::UanHeaderRcRts::Serialize
virtual void Serialize(Buffer::Iterator start) const
Definition: uan-header-rc.cc:235
ns3::UanHeaderRcRts
RTS header.
Definition: uan-header-rc.h:118
ns3::UanHeaderRcAck::GetNackedFrames
const std::set< uint8_t > & GetNackedFrames(void) const
Get the set of NACK'ed frames.
Definition: uan-header-rc.cc:589
ns3::UanHeaderRcCtsGlobal::GetRetryRate
uint16_t GetRetryRate(void) const
Get the retry rate number.
Definition: uan-header-rc.cc:351
ns3::UanHeaderRcCtsGlobal::UanHeaderRcCtsGlobal
UanHeaderRcCtsGlobal()
Default constructor.
Definition: uan-header-rc.cc:278
ns3::UanHeaderRcAck::m_nackedFrames
std::set< uint8_t > m_nackedFrames
Marker for nacked frames.
Definition: uan-header-rc.h:513
ns3::UanHeaderRcCts
CTS header.
Definition: uan-header-rc.h:343
ns3::UanHeaderRcCts::GetRtsTimeStamp
Time GetRtsTimeStamp(void) const
Get the receive time of the RTS being cleared.
Definition: uan-header-rc.cc:482
ns3::UanHeaderRcCts::GetDelayToTx
Time GetDelayToTx(void) const
Get the time delay from TX time of CTS packet until arrival of first data frame.
Definition: uan-header-rc.cc:488
ns3::UanHeaderRcCtsGlobal::SetWindowTime
void SetWindowTime(Time t)
Set the window time (time duration following blocking time to allow RTS transmissions).
Definition: uan-header-rc.cc:327
ns3::UanHeaderRcCtsGlobal::m_rateNum
uint16_t m_rateNum
Rate number.
Definition: uan-header-rc.h:330
ns3::UanHeaderRcCts::GetTypeId
static TypeId GetTypeId(void)
Register this type.
Definition: uan-header-rc.cc:434
ns3::Time::Unit
Unit
The unit to use to interpret a number representing time.
Definition: nstime.h:110
ns3::UanHeaderRcCtsGlobal::SetTxTimeStamp
void SetTxTimeStamp(Time timeStamp)
Set the CTS timestamp.
Definition: uan-header-rc.cc:333
ns3::UanHeaderRcRts::SetNoFrames
void SetNoFrames(uint8_t no)
Set the number of data frames included in this reservation request.
Definition: uan-header-rc.cc:177