A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
higher-tx-tag.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2008 INRIA
4  * Copyright (c) 2013 Dalian University of Technology
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation;
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
20  * Junling Bu <linlinjavaer@gmail.com>
21  */
22 #include "higher-tx-tag.h"
23 #include "ns3/tag.h"
24 #include "ns3/log.h"
25 #include "ns3/uinteger.h"
26 
27 NS_LOG_COMPONENT_DEFINE ("HigherDataTxVectorTag");
28 
29 namespace ns3 {
30 
31 NS_OBJECT_ENSURE_REGISTERED (HigherDataTxVectorTag);
32 
33 TypeId
35 {
36  static TypeId tid = TypeId ("ns3::HigherDataTxVectorTag")
37  .SetParent<Tag> ()
38  .AddConstructor<HigherDataTxVectorTag> ()
39  ;
40  return tid;
41 }
43  : m_adapter (false)
44 {
45  NS_LOG_FUNCTION (this);
46 }
48  : m_dataTxVector (dataTxVector),
49  m_adapter (adapter)
50 {
51  NS_LOG_FUNCTION (this);
52 }
54 {
55  NS_LOG_FUNCTION (this);
56 }
57 TypeId
59 {
60  NS_LOG_FUNCTION (this);
61  return GetTypeId ();
62 }
63 
66 {
67  NS_LOG_FUNCTION (this);
68  return m_dataTxVector;
69 }
70 bool
72 {
73  NS_LOG_FUNCTION (this);
74  return m_adapter;
75 }
76 
77 uint32_t
79 {
80  NS_LOG_FUNCTION (this);
81  return (sizeof (WifiTxVector) + 1);
82 }
83 void
85 {
86  NS_LOG_FUNCTION (this << &i);
87  i.Write ((uint8_t *)&m_dataTxVector, sizeof (WifiTxVector));
88  i.WriteU8 (static_cast<uint8_t> (m_adapter));
89 }
90 void
92 {
93  NS_LOG_FUNCTION (this << &i);
94  i.Read ((uint8_t *)&m_dataTxVector, sizeof (WifiTxVector));
95  m_adapter = i.ReadU8 ();
96 }
97 void
98 HigherDataTxVectorTag::Print (std::ostream &os) const
99 {
100  NS_LOG_FUNCTION (this << &os);
101  os << " Data=" << m_dataTxVector << " Adapter=" << m_adapter;
102 }
103 
104 } // namespace ns3
void Write(const uint8_t *buffer, uint32_t size)
Definition: tag-buffer.cc:125
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register the class in the ns-3 factory.
Definition: object-base.h:38
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:170
TAG_BUFFER_INLINE uint8_t ReadU8(void)
Definition: tag-buffer.h:195
virtual uint32_t GetSerializedSize(void) const
WifiTxVector GetDataTxVector(void) const
tag a set of bytes in a packet
Definition: tag.h:36
virtual void Serialize(TagBuffer i) const
virtual void Deserialize(TagBuffer i)
TAG_BUFFER_INLINE void WriteU8(uint8_t v)
Definition: tag-buffer.h:172
read and write tag data
Definition: tag-buffer.h:51
void Read(uint8_t *buffer, uint32_t size)
Definition: tag-buffer.cc:176
virtual ~HigherDataTxVectorTag(void)
virtual TypeId GetInstanceTypeId(void) const
static TypeId GetTypeId(void)
a unique identifier for an interface.
Definition: type-id.h:49
TypeId SetParent(TypeId tid)
Definition: type-id.cc:610
virtual void Print(std::ostream &os) const
bool IsAdapter(void) const