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 (sizeof (WifiTxVector) + 2);
44 }
45 
46 void
48 {
49  i.Write ((uint8_t *)&m_wifiTxVector, sizeof (WifiTxVector));
50  i.WriteU16 (m_mpduType);
51 }
52 
53 void
55 {
56  i.Read ((uint8_t *)&m_wifiTxVector, sizeof (WifiTxVector));
57  m_mpduType = static_cast<MpduType> (i.ReadU16 ());
58 }
59 void
60 WifiPhyTag::Print (std::ostream &os) const
61 {
62  os << m_wifiTxVector << " " << m_mpduType;
63 }
64 
66 {
67 }
68 
70  : m_wifiTxVector (txVector),
71  m_mpduType (mpdutype)
72 {
73 }
74 
77 {
78  return m_wifiTxVector;
79 }
80 
83 {
84  return m_mpduType;
85 }
86 
87 } // namespace ns3
TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition: wifi-phy-tag.cc:35
void Write(const uint8_t *buffer, uint32_t size)
Definition: tag-buffer.cc:125
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
MpduType m_mpduType
MPDU type.
Definition: wifi-phy-tag.h:75
WifiTxVector m_wifiTxVector
wifi transmit vector
Definition: wifi-phy-tag.h:74
WifiPhyTag()
Constructor.
Definition: wifi-phy-tag.cc:65
static TypeId GetTypeId(void)
Get the type ID.
Definition: wifi-phy-tag.cc:26
void Deserialize(TagBuffer i)
Definition: wifi-phy-tag.cc:54
TAG_BUFFER_INLINE void WriteU16(uint16_t v)
Definition: tag-buffer.h:180
void Print(std::ostream &os) const
Definition: wifi-phy-tag.cc:60
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.
uint32_t GetSerializedSize(void) const
Definition: wifi-phy-tag.cc:41
WifiTxVector GetWifiTxVector(void) const
Getter for WifiTxVector parameter.
Definition: wifi-phy-tag.cc:76
read and write tag data
Definition: tag-buffer.h:51
void Serialize(TagBuffer i) const
Definition: wifi-phy-tag.cc:47
void Read(uint8_t *buffer, uint32_t size)
Definition: tag-buffer.cc:176
TAG_BUFFER_INLINE uint16_t ReadU16(void)
Definition: tag-buffer.h:205
a unique identifier for an interface.
Definition: type-id.h:58
MpduType
This enumeration defines the type of an MPDU.
Definition: wifi-phy.h:56
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:914
MpduType GetMpduType(void) const
Getter for mpduType parameter.
Definition: wifi-phy-tag.cc:82