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/uan-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;
89 
90  // Inherrited methods
91  virtual uint32_t GetSerializedSize (void) const;
92  virtual void Serialize (Buffer::Iterator start) const;
93  virtual uint32_t Deserialize (Buffer::Iterator start);
94  virtual void Print (std::ostream &os) const;
95  virtual TypeId GetInstanceTypeId (void) const;
96 
97 private:
98  uint8_t m_frameNo;
100 
101 }; // class UanHeaderRcData
102 
110 class UanHeaderRcRts : public Header
111 {
112 public:
114  UanHeaderRcRts ();
125  UanHeaderRcRts (uint8_t frameNo, uint8_t retryNo, uint8_t noFrames, uint16_t length, Time ts);
127  virtual ~UanHeaderRcRts ();
128 
133  static TypeId GetTypeId (void);
134 
140  void SetFrameNo (uint8_t fno);
146  void SetNoFrames (uint8_t no);
152  void SetTimeStamp (Time timeStamp);
159  void SetLength (uint16_t length);
167  void SetRetryNo (uint8_t no);
168 
174  uint8_t GetFrameNo (void) const;
180  uint8_t GetNoFrames (void) const;
187  Time GetTimeStamp (void) const;
193  uint16_t GetLength (void) const;
199  uint8_t GetRetryNo (void) const;
200 
201  // Inherrited methods
202  virtual uint32_t GetSerializedSize (void) const;
203  virtual void Serialize (Buffer::Iterator start) const;
204  virtual uint32_t Deserialize (Buffer::Iterator start);
205  virtual void Print (std::ostream &os) const;
206  virtual TypeId GetInstanceTypeId (void) const;
207 
208 private:
209  uint8_t m_frameNo;
210  uint8_t m_noFrames;
211  uint16_t m_length;
213  uint8_t m_retryNo;
214 
215 }; // class UanHeaderRcRts
216 
225 {
226 public:
237  UanHeaderRcCtsGlobal (Time wt, Time ts, uint16_t rate, uint16_t retryRate);
240 
245  static TypeId GetTypeId (void);
246 
251  void SetRateNum (uint16_t rate);
256  void SetRetryRate (uint16_t rate);
263  void SetWindowTime (Time t);
264 
270  void SetTxTimeStamp (Time timeStamp);
271 
277  uint16_t GetRateNum (void) const;
283  uint16_t GetRetryRate (void) const;
290  Time GetWindowTime (void) const;
296  Time GetTxTimeStamp (void) const;
297 
298  // Inherrited methods
299  virtual uint32_t GetSerializedSize (void) const;
300  virtual void Serialize (Buffer::Iterator start) const;
301  virtual uint32_t Deserialize (Buffer::Iterator start);
302  virtual void Print (std::ostream &os) const;
303  virtual TypeId GetInstanceTypeId (void) const;
304 
305 private:
308  uint16_t m_retryRate;
309  uint16_t m_rateNum;
310 
311 }; // class UanHeaderRcCtsGlobal
312 
321 class UanHeaderRcCts : public Header
322 {
323 public:
325  UanHeaderRcCts ();
336  UanHeaderRcCts (uint8_t frameNo, uint8_t retryNo, Time rtsTs, Time delay, UanAddress addr);
338  virtual ~UanHeaderRcCts ();
339 
344  static TypeId GetTypeId (void);
345 
351  void SetFrameNo (uint8_t frameNo);
357  void SetRtsTimeStamp (Time timeStamp);
363  void SetDelayToTx (Time delay);
369  void SetRetryNo (uint8_t no);
375  void SetAddress (UanAddress addr);
376 
382  uint8_t GetFrameNo (void) const;
388  Time GetRtsTimeStamp (void) const;
395  Time GetDelayToTx (void) const;
401  uint8_t GetRetryNo (void) const;
407  UanAddress GetAddress (void) const;
408 
409  // Inherrited methods
410  virtual uint32_t GetSerializedSize (void) const;
411  virtual void Serialize (Buffer::Iterator start) const;
412  virtual uint32_t Deserialize (Buffer::Iterator start);
413  virtual void Print (std::ostream &os) const;
414  virtual TypeId GetInstanceTypeId (void) const;
415 
416 private:
417  uint8_t m_frameNo;
419  uint8_t m_retryNo;
422 
423 }; // class UanHeaderRcCts
424 
430 class UanHeaderRcAck : public Header
431 {
432 public:
434  UanHeaderRcAck ();
436  virtual ~UanHeaderRcAck ();
437 
442  static TypeId GetTypeId (void);
443 
449  void SetFrameNo (uint8_t frameNo);
455  void AddNackedFrame (uint8_t frame);
456 
462  const std::set<uint8_t> &GetNackedFrames (void) const;
468  uint8_t GetFrameNo (void) const;
474  uint8_t GetNoNacks (void) const;
475 
476  // Inherrited methods
477  virtual uint32_t GetSerializedSize (void) const;
478  virtual void Serialize (Buffer::Iterator start) const;
479  virtual uint32_t Deserialize (Buffer::Iterator start);
480  virtual void Print (std::ostream &os) const;
481  virtual TypeId GetInstanceTypeId (void) const;
482 
483 private:
484  uint8_t m_frameNo;
485  std::set<uint8_t> m_nackedFrames;
486 
487 }; // class UanHeaderRcAck
488 
489 } // namespace ns3
490 
491 #endif /* UAN_HEADER_RC_H */
Protocol header serialization and deserialization.
Definition: header.h:42
virtual void Serialize(Buffer::Iterator start) const
Time GetPropDelay(void) const
Get the propagation delay found in handshaking.
virtual uint32_t Deserialize(Buffer::Iterator start)
virtual void Serialize(Buffer::Iterator start) const
void SetNoFrames(uint8_t no)
Set the number of data frames included in this reservation request.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
uint8_t GetFrameNo(void) const
Get the reservation frame number being ACKed.
static TypeId GetTypeId(void)
Register this type.
void SetPropDelay(Time propDelay)
Set the propagation delay as found in handshaking.
Cycle broadcast information.
uint8_t GetRetryNo(void) const
Get the retry number of the RTS packet being cleared.
void SetRateNum(uint16_t rate)
Set the rate number corresponding to data rate of current cycle.
UanHeaderRcCtsGlobal()
Default constructor.
virtual uint32_t GetSerializedSize(void) const
void SetRetryNo(uint8_t no)
Set the retry number of the RTS frame being cleared.
void SetFrameNo(uint8_t frameNum)
Set the frame number of the reservation being transmitted.
Header used for ACK packets by protocol UanMacRc.
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
virtual uint32_t Deserialize(Buffer::Iterator start)
void SetAddress(UanAddress addr)
Set the destination address, for scheduling info.
uint8_t m_frameNo
Reservation frame number.
def start()
Definition: core.py:1790
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
uint16_t m_rateNum
Rate number.
Time m_winTime
Window time.
uint8_t m_frameNo
Next frame number.
uint16_t m_length
Number of bytes (including headers) in data.
void SetWindowTime(Time t)
Set the window time (time duration following blocking time to allow RTS transmissions).
uint8_t GetFrameNo(void) const
Get the frame number.
iterator in a Buffer instance
Definition: buffer.h:98
std::set< uint8_t > m_nackedFrames
Marker for nacked frames.
const std::set< uint8_t > & GetNackedFrames(void) const
Get the set of NACK'ed frames.
A class used for addressing UAN MAC's.
Definition: uan-address.h:40
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
uint8_t m_retryNo
Retry number of received RTS packet.
Time GetTimeStamp(void) const
Get the transmit timestamp of this RTS packet.
virtual void Serialize(Buffer::Iterator start) const
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
virtual void Print(std::ostream &os) const
UanAddress m_address
Destination of CTS packet.
virtual uint32_t Deserialize(Buffer::Iterator start)
void AddNackedFrame(uint8_t frame)
NACK a frame.
virtual uint32_t Deserialize(Buffer::Iterator start)
Time m_delay
Delay until transmission.
uint8_t GetRetryNo(void) const
Get the retry number of this RTS packet.
UanAddress GetAddress(void) const
Get the destination address, for scheduling info.
void SetLength(uint16_t length)
Set the number of data bytes in the reservation.
uint8_t GetFrameNo(void) const
Get the frame number of the reservation being transmitted.
void SetTimeStamp(Time timeStamp)
Set RTS transmission time.
Time m_timeStampRts
RX time of RTS packet at gateway.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static TypeId GetTypeId(void)
Register this type.
Time GetRtsTimeStamp(void) const
Get the receive time of the RTS being cleared.
void SetDelayToTx(Time delay)
Set the time delay from CTS transmission to first data frame arrival.
virtual ~UanHeaderRcAck()
Destructor.
void SetFrameNo(uint8_t frameNo)
Set the RTS frame number being cleared.
virtual void Print(std::ostream &os) const
Time m_timeStampTx
Timestamp.
Time GetWindowTime(void) const
Get the window time (time duration following blocking time to allow RTS transmissions).
uint16_t GetRateNum(void) const
Get the data rate number.
virtual ~UanHeaderRcCts()
Destructor.
void SetTxTimeStamp(Time timeStamp)
Set the CTS timestamp.
uint8_t GetNoFrames(void) const
Get the number of data frames in the reservation.
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
void SetRtsTimeStamp(Time timeStamp)
Set the timestamp for RTS reception.
static TypeId GetTypeId(void)
Register this type.
uint8_t m_frameNo
Data frame number.
Definition: uan-header-rc.h:98
UanHeaderRcData()
Default constructor.
virtual void Serialize(Buffer::Iterator start) const
uint16_t m_retryRate
Retry rate.
uint8_t GetNoNacks(void) const
Get the number of data frames being NACKed.
virtual void Serialize(Buffer::Iterator start) const
virtual uint32_t Deserialize(Buffer::Iterator start)
Time m_propDelay
Propagation delay.
Definition: uan-header-rc.h:99
virtual void Print(std::ostream &os) const
virtual void Print(std::ostream &os) const
virtual ~UanHeaderRcRts()
Destructor.
void SetFrameNo(uint8_t frameNo)
Set the frame number of the reservation being acknowledged.
UanHeaderRcCts()
Default constructor.
virtual uint32_t GetSerializedSize(void) const
uint16_t GetRetryRate(void) const
Get the retry rate number.
uint8_t GetFrameNo(void) const
Get the frame number of the RTS being cleared.
Time GetDelayToTx(void) const
Get the time delay from TX time of CTS packet until arrival of first data frame.
static TypeId GetTypeId(void)
Register this type.
void SetRetryRate(uint16_t rate)
Set the retry rate number for the current cycle.
UanHeaderRcRts()
Default constructor.
uint8_t m_retryNo
Retry number of RTS packet.
~UanHeaderRcCtsGlobal()
Destructor.
virtual uint32_t GetSerializedSize(void) const
uint8_t m_frameNo
Reservation frame number being cleared.
a unique identifier for an interface.
Definition: type-id.h:58
Time GetTxTimeStamp(void) const
Get the CTS transmit timestamp.
Time m_timeStamp
RTS TX timestamp.
static TypeId GetTypeId(void)
Register this type.
virtual uint32_t GetSerializedSize(void) const
void SetRetryNo(uint8_t no)
Set the retry number of this RTS packet.
uint8_t m_noFrames
Number of data frames in reservation.
Extra data header information.
Definition: uan-header-rc.h:41
UanHeaderRcAck()
Default constructor.
void SetFrameNo(uint8_t fno)
Set the frame number.
uint16_t GetLength(void) const
Get the total number of bytes in the reservation, including headers.
virtual void Print(std::ostream &os) const
virtual ~UanHeaderRcData()
Destructor.
virtual uint32_t GetSerializedSize(void) const