A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
uan-header-rc.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2009 University of Washington
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Leonard Tracy <lentracy@gmail.com>
18 */
19
20#ifndef UAN_HEADER_RC_H
21#define UAN_HEADER_RC_H
22
23#include "ns3/header.h"
24#include "ns3/mac8-address.h"
25#include "ns3/nstime.h"
26
27#include <set>
28
29namespace ns3
30{
31
40class UanHeaderRcData : public Header
41{
42 public:
52 UanHeaderRcData(uint8_t frameNum, Time propDelay);
54 ~UanHeaderRcData() override;
55
60 static TypeId GetTypeId();
61
67 void SetFrameNo(uint8_t frameNum);
74 void SetPropDelay(Time propDelay);
80 uint8_t GetFrameNo() const;
87 Time GetPropDelay() const;
94 void Print(std::ostream& os, Time::Unit unit) const;
95
96 // Inherited methods
97 uint32_t GetSerializedSize() const override;
98 void Serialize(Buffer::Iterator start) const override;
100 void Print(std::ostream& os) const override;
101 TypeId GetInstanceTypeId() const override;
102
103 private:
104 uint8_t m_frameNo;
106
107}; // class UanHeaderRcData
108
116class UanHeaderRcRts : public Header
117{
118 public:
131 UanHeaderRcRts(uint8_t frameNo, uint8_t retryNo, uint8_t noFrames, uint16_t length, Time ts);
133 ~UanHeaderRcRts() override;
134
139 static TypeId GetTypeId();
140
146 void SetFrameNo(uint8_t fno);
152 void SetNoFrames(uint8_t no);
158 void SetTimeStamp(Time timeStamp);
165 void SetLength(uint16_t length);
173 void SetRetryNo(uint8_t no);
174
180 uint8_t GetFrameNo() const;
186 uint8_t GetNoFrames() const;
193 Time GetTimeStamp() const;
199 uint16_t GetLength() const;
205 uint8_t GetRetryNo() const;
212 void Print(std::ostream& os, Time::Unit unit) const;
213
214 // Inherited methods
215 uint32_t GetSerializedSize() const override;
216 void Serialize(Buffer::Iterator start) const override;
217 uint32_t Deserialize(Buffer::Iterator start) override;
218 void Print(std::ostream& os) const override;
219 TypeId GetInstanceTypeId() const override;
220
221 private:
222 uint8_t m_frameNo;
223 uint8_t m_noFrames;
224 uint16_t m_length;
226 uint8_t m_retryNo;
227
228}; // class UanHeaderRcRts
229
238{
239 public:
250 UanHeaderRcCtsGlobal(Time wt, Time ts, uint16_t rate, uint16_t retryRate);
252 ~UanHeaderRcCtsGlobal() override;
253
258 static TypeId GetTypeId();
259
264 void SetRateNum(uint16_t rate);
269 void SetRetryRate(uint16_t rate);
276 void SetWindowTime(Time t);
277
283 void SetTxTimeStamp(Time timeStamp);
284
290 uint16_t GetRateNum() const;
296 uint16_t GetRetryRate() const;
303 Time GetWindowTime() const;
309 Time GetTxTimeStamp() const;
316 void Print(std::ostream& os, Time::Unit unit) const;
317
318 // Inherited methods
319 uint32_t GetSerializedSize() const override;
320 void Serialize(Buffer::Iterator start) const override;
321 uint32_t Deserialize(Buffer::Iterator start) override;
322 void Print(std::ostream& os) const override;
323 TypeId GetInstanceTypeId() const override;
324
325 private:
328 uint16_t m_retryRate;
329 uint16_t m_rateNum;
330
331}; // class UanHeaderRcCtsGlobal
332
341class UanHeaderRcCts : public Header
342{
343 public:
356 UanHeaderRcCts(uint8_t frameNo, uint8_t retryNo, Time rtsTs, Time delay, Mac8Address addr);
358 ~UanHeaderRcCts() override;
359
364 static TypeId GetTypeId();
365
371 void SetFrameNo(uint8_t frameNo);
377 void SetRtsTimeStamp(Time timeStamp);
383 void SetDelayToTx(Time delay);
389 void SetRetryNo(uint8_t no);
395 void SetAddress(Mac8Address addr);
396
402 uint8_t GetFrameNo() const;
408 Time GetRtsTimeStamp() const;
415 Time GetDelayToTx() const;
421 uint8_t GetRetryNo() const;
427 Mac8Address GetAddress() const;
434 void Print(std::ostream& os, Time::Unit unit) const;
435
436 // Inherited methods
437 uint32_t GetSerializedSize() const override;
438 void Serialize(Buffer::Iterator start) const override;
439 uint32_t Deserialize(Buffer::Iterator start) override;
440 void Print(std::ostream& os) const override;
441 TypeId GetInstanceTypeId() const override;
442
443 private:
444 uint8_t m_frameNo;
446 uint8_t m_retryNo;
449
450}; // class UanHeaderRcCts
451
457class UanHeaderRcAck : public Header
458{
459 public:
463 ~UanHeaderRcAck() override;
464
469 static TypeId GetTypeId();
470
476 void SetFrameNo(uint8_t frameNo);
482 void AddNackedFrame(uint8_t frame);
483
489 const std::set<uint8_t>& GetNackedFrames() const;
495 uint8_t GetFrameNo() const;
501 uint8_t GetNoNacks() const;
502
503 // Inherited methods
504 uint32_t GetSerializedSize() const override;
505 void Serialize(Buffer::Iterator start) const override;
506 uint32_t Deserialize(Buffer::Iterator start) override;
507 void Print(std::ostream& os) const override;
508 TypeId GetInstanceTypeId() const override;
509
510 private:
511 uint8_t m_frameNo;
512 std::set<uint8_t> m_nackedFrames;
513
514}; // class UanHeaderRcAck
515
516} // namespace ns3
517
518#endif /* UAN_HEADER_RC_H */
iterator in a Buffer instance
Definition: buffer.h:100
Protocol header serialization and deserialization.
Definition: header.h:44
A class used for addressing MAC8 MAC's.
Definition: mac8-address.h:44
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
Unit
The unit to use to interpret a number representing time.
Definition: nstime.h:111
a unique identifier for an interface.
Definition: type-id.h:59
Header used for ACK packets by protocol UanMacRc.
static TypeId GetTypeId()
Register this type.
uint8_t m_frameNo
Next frame number.
uint32_t GetSerializedSize() const override
uint32_t Deserialize(Buffer::Iterator start) override
std::set< uint8_t > m_nackedFrames
Marker for nacked frames.
const std::set< uint8_t > & GetNackedFrames() const
Get the set of NACK'ed frames.
~UanHeaderRcAck() override
Destructor.
void Serialize(Buffer::Iterator start) const override
UanHeaderRcAck()
Default constructor.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
uint8_t GetFrameNo() const
Get the reservation frame number being ACKed.
void AddNackedFrame(uint8_t frame)
NACK a frame.
void Print(std::ostream &os) const override
uint8_t GetNoNacks() const
Get the number of data frames being NACKed.
void SetFrameNo(uint8_t frameNo)
Set the frame number of the reservation being acknowledged.
Cycle broadcast information.
void Print(std::ostream &os, Time::Unit unit) const
Specialized Print with Time::Unit declared.
uint32_t Deserialize(Buffer::Iterator start) override
UanHeaderRcCtsGlobal()
Default constructor.
static TypeId GetTypeId()
Register this type.
void Serialize(Buffer::Iterator start) const override
void SetRateNum(uint16_t rate)
Set the rate number corresponding to data rate of current cycle.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
~UanHeaderRcCtsGlobal() override
Destructor.
void SetRetryRate(uint16_t rate)
Set the retry rate number for the current cycle.
Time m_timeStampTx
Timestamp.
void SetTxTimeStamp(Time timeStamp)
Set the CTS timestamp.
Time m_winTime
Window time.
uint16_t GetRetryRate() const
Get the retry rate number.
uint16_t m_retryRate
Retry rate.
Time GetTxTimeStamp() const
Get the CTS transmit timestamp.
uint16_t m_rateNum
Rate number.
Time GetWindowTime() const
Get the window time (time duration following blocking time to allow RTS transmissions).
void SetWindowTime(Time t)
Set the window time (time duration following blocking time to allow RTS transmissions).
uint16_t GetRateNum() const
Get the data rate number.
uint32_t GetSerializedSize() const override
Time GetDelayToTx() const
Get the time delay from TX time of CTS packet until arrival of first data frame.
uint8_t GetFrameNo() const
Get the frame number of the RTS being cleared.
uint32_t Deserialize(Buffer::Iterator start) override
void SetRtsTimeStamp(Time timeStamp)
Set the timestamp for RTS reception.
UanHeaderRcCts()
Default constructor.
void SetFrameNo(uint8_t frameNo)
Set the RTS frame number being cleared.
uint32_t GetSerializedSize() const override
~UanHeaderRcCts() override
Destructor.
void SetDelayToTx(Time delay)
Set the time delay from CTS transmission to first data frame arrival.
void Serialize(Buffer::Iterator start) const override
Mac8Address m_address
Destination of CTS packet.
uint8_t GetRetryNo() const
Get the retry number of the RTS packet being cleared.
Mac8Address GetAddress() const
Get the destination address, for scheduling info.
Time m_delay
Delay until transmission.
Time m_timeStampRts
RX time of RTS packet at gateway.
void Print(std::ostream &os, Time::Unit unit) const
Specialized Print with Time::Unit declared.
uint8_t m_frameNo
Reservation frame number being cleared.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
void SetRetryNo(uint8_t no)
Set the retry number of the RTS frame being cleared.
static TypeId GetTypeId()
Register this type.
Time GetRtsTimeStamp() const
Get the receive time of the RTS being cleared.
void SetAddress(Mac8Address addr)
Set the destination address, for scheduling info.
uint8_t m_retryNo
Retry number of received RTS packet.
Extra data header information.
Definition: uan-header-rc.h:41
Time m_propDelay
Propagation delay.
~UanHeaderRcData() override
Destructor.
uint8_t m_frameNo
Data frame number.
void SetFrameNo(uint8_t frameNum)
Set the frame number of the reservation being transmitted.
UanHeaderRcData()
Default constructor.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
uint8_t GetFrameNo() const
Get the frame number of the reservation being transmitted.
static TypeId GetTypeId()
Register this type.
uint32_t GetSerializedSize() const override
void Serialize(Buffer::Iterator start) const override
void SetPropDelay(Time propDelay)
Set the propagation delay as found in handshaking.
Time GetPropDelay() const
Get the propagation delay found in handshaking.
uint32_t Deserialize(Buffer::Iterator start) override
void Print(std::ostream &os, Time::Unit unit) const
Specialized Print with Time::Unit declared.
uint16_t m_length
Number of bytes (including headers) in data.
void Print(std::ostream &os, Time::Unit unit) const
Specialized Print with Time::Unit declared.
UanHeaderRcRts()
Default constructor.
uint8_t GetFrameNo() const
Get the frame number.
uint16_t GetLength() const
Get the total number of bytes in the reservation, including headers.
uint8_t m_retryNo
Retry number of RTS packet.
uint8_t GetNoFrames() const
Get the number of data frames in the reservation.
void SetFrameNo(uint8_t fno)
Set the frame number.
void SetTimeStamp(Time timeStamp)
Set RTS transmission time.
static TypeId GetTypeId()
Register this type.
uint8_t m_noFrames
Number of data frames in reservation.
Time GetTimeStamp() const
Get the transmit timestamp of this RTS packet.
~UanHeaderRcRts() override
Destructor.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
void SetRetryNo(uint8_t no)
Set the retry number of this RTS packet.
uint32_t GetSerializedSize() const override
uint8_t m_frameNo
Reservation frame number.
void Serialize(Buffer::Iterator start) const override
uint8_t GetRetryNo() const
Get the retry number of this RTS packet.
void SetNoFrames(uint8_t no)
Set the number of data frames included in this reservation request.
void SetLength(uint16_t length)
Set the number of data bytes in the reservation.
Time m_timeStamp
RTS TX timestamp.
uint32_t Deserialize(Buffer::Iterator start) override
Every class exported by the ns3 library is enclosed in the ns3 namespace.