A Discrete-Event Network Simulator
API
wifi-phy-tag.cc
Go to the documentation of this file.
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2009 CTTC
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: Nicola Baldo <nbaldo@cttc.es>
19  */
20 #include <ns3/wifi-phy-tag.h>
21 
22 namespace ns3 {
23 
24 TypeId
26 {
27  static TypeId tid = TypeId ("ns3::WifiPhyTag")
28  .SetParent<Tag> ()
29  ;
30  return tid;
31 }
32 
33 TypeId
35 {
36  return GetTypeId ();
37 }
38 
39 uint32_t
41 {
42  return (4 + (6 * 1) + 4 + 2);
43 }
44 
45 void
47 {
56  i.WriteU16 (m_mpduType);
57 }
58 
59 void
61 {
69  m_wifiPreamble = i.ReadU32 ();
70  m_mpduType = static_cast<enum mpduType> (i.ReadU16 ());
71 }
72 void
73 WifiPhyTag::Print (std::ostream &os) const
74 {
75  os << m_wifiTxVector << " " << (m_wifiPreamble ? "SP " : "LP ") << m_mpduType;
76 }
77 
79 {
80 }
81 
82 WifiPhyTag::WifiPhyTag (WifiTxVector txVector, WifiPreamble preamble, enum mpduType mpdutype)
83  : m_wifiTxVector (txVector),
84  m_wifiPreamble (preamble),
85  m_mpduType (mpdutype)
86 {
87 }
88 
91 {
92  return m_wifiTxVector;
93 }
94 
97 {
98  return ((enum WifiPreamble) m_wifiPreamble);
99 }
100 
101 enum mpduType
103 {
104  return m_mpduType;
105 }
106 
107 } // namespace ns3
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition: wifi-phy-tag.cc:34
void SetShortGuardInterval(bool guardinterval)
Sets if short gurad interval is being used.
int32_t m_wifiPreamble
Definition: wifi-phy-tag.h:77
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
void SetStbc(bool stbc)
Sets if STBC is being used.
bool IsShortGuardInterval(void) const
TAG_BUFFER_INLINE uint32_t ReadU32(void)
Definition: tag-buffer.h:215
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:99
TAG_BUFFER_INLINE uint8_t ReadU8(void)
Definition: tag-buffer.h:195
uint8_t GetTxPowerLevel(void) const
WifiTxVector m_wifiTxVector
Definition: wifi-phy-tag.h:76
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
Definition: wifi-preamble.h:30
WifiPhyTag()
Constructor.
Definition: wifi-phy-tag.cc:78
static TypeId GetTypeId(void)
Definition: wifi-phy-tag.cc:25
virtual void Deserialize(TagBuffer i)
Definition: wifi-phy-tag.cc:60
TAG_BUFFER_INLINE void WriteU32(uint32_t v)
Definition: tag-buffer.h:186
uint8_t GetNess(void) const
TAG_BUFFER_INLINE void WriteU16(uint16_t v)
Definition: tag-buffer.h:180
bool IsStbc(void) const
Check if STBC is used or not.
virtual void Print(std::ostream &os) const
Definition: wifi-phy-tag.cc:73
enum mpduType m_mpduType
Definition: wifi-phy-tag.h:78
void SetNss(uint8_t nss)
Sets the number of Nss refer to IEEE 802.11n Table 20-28 for explanation and range.
tag a set of bytes in a packet
Definition: tag.h:36
Every class exported by the ns3 library is enclosed in the ns3 namespace.
virtual uint32_t GetSerializedSize(void) const
Definition: wifi-phy-tag.cc:40
WifiPreamble GetWifiPreamble(void) const
Getter for WifiPreamble parameter.
Definition: wifi-phy-tag.cc:96
void SetTxPowerLevel(uint8_t powerlevel)
Sets the selected transmission power level.
TAG_BUFFER_INLINE void WriteU8(uint8_t v)
Definition: tag-buffer.h:172
void SetMode(WifiMode mode)
Sets the selected payload transmission mode.
WifiTxVector GetWifiTxVector(void) const
Getter for WifiTxVector parameter.
Definition: wifi-phy-tag.cc:90
uint8_t GetNss(void) const
read and write tag data
Definition: tag-buffer.h:51
virtual void Serialize(TagBuffer i) const
Definition: wifi-phy-tag.cc:46
enum mpduType GetMpduType(void) const
Getter for mpduType parameter.
void SetNess(uint8_t ness)
Sets the Ness number refer to IEEE 802.11n Table 20-6 for explanation.
void SetRetries(uint8_t retries)
Sets the number of retries.
TAG_BUFFER_INLINE uint16_t ReadU16(void)
Definition: tag-buffer.h:205
uint8_t GetRetries(void) const
uint32_t GetUid(void) const
Definition: wifi-mode.cc:373
WifiMode GetMode(void) const
a unique identifier for an interface.
Definition: type-id.h:58
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:904
mpduType
This enumeration defines the type of an MPDU.
Definition: wifi-phy.h:56