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 
21 #include "wifi-phy-tag.h"
22 
23 namespace ns3 {
24 
25 TypeId
27 {
28  static TypeId tid = TypeId ("ns3::WifiPhyTag")
29  .SetParent<Tag> ()
30  ;
31  return tid;
32 }
33 
34 TypeId
36 {
37  return GetTypeId ();
38 }
39 
40 uint32_t
42 {
43  return 3;
44 }
45 
46 void
48 {
49  i.WriteU8 (static_cast<uint8_t> (m_preamble));
50  i.WriteU8 (static_cast<uint8_t> (m_modulation));
52 }
53 
54 void
56 {
57  m_preamble = static_cast<WifiPreamble> (i.ReadU8 ());
58  m_modulation = static_cast<WifiModulationClass> (i.ReadU8 ());
59  m_frameComplete = i.ReadU8 ();
60 }
61 
62 void
63 WifiPhyTag::Print (std::ostream &os) const
64 {
65  os << +m_preamble << " " << +m_modulation << " " << m_frameComplete;
66 }
67 
69 {
70 }
71 
72 WifiPhyTag::WifiPhyTag (WifiPreamble preamble, WifiModulationClass modulation, uint8_t frameComplete)
73  : m_preamble (preamble),
74  m_modulation (modulation),
75  m_frameComplete (frameComplete)
76 {
77 }
78 
81 {
82  return m_preamble;
83 }
84 
87 {
88  return m_modulation;
89 }
90 
91 uint8_t
93 {
94  return m_frameComplete;
95 }
96 
97 } // namespace ns3
WifiModulationClass
This enumeration defines the modulation classes per (Table 10-6 "Modulation classes"; IEEE 802...
WifiModulationClass m_modulation
modulation used for transmission
Definition: wifi-phy-tag.h:82
TAG_BUFFER_INLINE uint8_t ReadU8(void)
Definition: tag-buffer.h:195
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
WifiPhyTag()
Constructor.
Definition: wifi-phy-tag.cc:68
uint8_t m_frameComplete
Used to indicate that TX stopped sending before the end of the frame.
Definition: wifi-phy-tag.h:83
static TypeId GetTypeId(void)
Get the type ID.
Definition: wifi-phy-tag.cc:26
void Deserialize(TagBuffer i)
Definition: wifi-phy-tag.cc:55
WifiPreamble GetPreambleType(void) const
Getter for preamble parameter.
Definition: wifi-phy-tag.cc:80
WifiPreamble m_preamble
preamble type
Definition: wifi-phy-tag.h:81
void Print(std::ostream &os) const
Definition: wifi-phy-tag.cc:63
tag a set of bytes in a packet
Definition: tag.h:36
uint32_t GetSerializedSize(void) const
Definition: wifi-phy-tag.cc:41
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void Serialize(TagBuffer i) const
Definition: wifi-phy-tag.cc:47
TAG_BUFFER_INLINE void WriteU8(uint8_t v)
Definition: tag-buffer.h:172
WifiModulationClass GetModulation(void) const
Getter for modulation parameter.
Definition: wifi-phy-tag.cc:86
uint8_t GetFrameComplete(void) const
Getter for frameComplete parameter.
Definition: wifi-phy-tag.cc:92
read and write tag data
Definition: tag-buffer.h:51
TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition: wifi-phy-tag.cc:35
a unique identifier for an interface.
Definition: type-id.h:58
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:923