author | Junling Bu <linlinjavaer@gmail.com> |
Tue, 03 Dec 2013 11:25:59 -0800 | |
changeset 10459 | f2e90c12a44f |
child 10968 | 2d29fee2b7b8 |
permissions | -rw-r--r-- |
10459
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
2 |
/* |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
3 |
* Copyright (c) 2008 INRIA |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
4 |
* Copyright (c) 2013 Dalian University of Technology |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
5 |
* |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
6 |
* This program is free software; you can redistribute it and/or modify |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
7 |
* it under the terms of the GNU General Public License version 2 as |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
8 |
* published by the Free Software Foundation; |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
9 |
* |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
10 |
* This program is distributed in the hope that it will be useful, |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
13 |
* GNU General Public License for more details. |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
14 |
* |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
16 |
* along with this program; if not, write to the Free Software |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
17 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
18 |
* |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
19 |
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
20 |
* Junling Bu <linlinjavaer@gmail.com> |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
21 |
*/ |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
22 |
#include "higher-tx-tag.h" |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
23 |
#include "ns3/tag.h" |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
24 |
#include "ns3/log.h" |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
25 |
#include "ns3/uinteger.h" |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
26 |
|
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
27 |
NS_LOG_COMPONENT_DEFINE ("HigherDataTxVectorTag"); |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
28 |
|
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
29 |
namespace ns3 { |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
30 |
|
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
31 |
NS_OBJECT_ENSURE_REGISTERED (HigherDataTxVectorTag); |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
32 |
|
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
33 |
TypeId |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
34 |
HigherDataTxVectorTag::GetTypeId (void) |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
35 |
{ |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
36 |
static TypeId tid = TypeId ("ns3::HigherDataTxVectorTag") |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
37 |
.SetParent<Tag> () |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
38 |
.AddConstructor<HigherDataTxVectorTag> () |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
39 |
; |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
40 |
return tid; |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
41 |
} |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
42 |
HigherDataTxVectorTag::HigherDataTxVectorTag (void) |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
43 |
: m_adapter (false) |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
44 |
{ |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
45 |
NS_LOG_FUNCTION (this); |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
46 |
} |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
47 |
HigherDataTxVectorTag::HigherDataTxVectorTag (WifiTxVector dataTxVector, bool adapter) |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
48 |
: m_dataTxVector (dataTxVector), |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
49 |
m_adapter (adapter) |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
50 |
{ |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
51 |
NS_LOG_FUNCTION (this); |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
52 |
} |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
53 |
HigherDataTxVectorTag::~HigherDataTxVectorTag (void) |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
54 |
{ |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
55 |
NS_LOG_FUNCTION (this); |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
56 |
} |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
57 |
TypeId |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
58 |
HigherDataTxVectorTag::GetInstanceTypeId (void) const |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
59 |
{ |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
60 |
NS_LOG_FUNCTION (this); |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
61 |
return GetTypeId (); |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
62 |
} |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
63 |
|
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
64 |
WifiTxVector |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
65 |
HigherDataTxVectorTag::GetDataTxVector (void) const |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
66 |
{ |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
67 |
NS_LOG_FUNCTION (this); |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
68 |
return m_dataTxVector; |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
69 |
} |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
70 |
bool |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
71 |
HigherDataTxVectorTag::IsAdapter (void) const |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
72 |
{ |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
73 |
NS_LOG_FUNCTION (this); |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
74 |
return m_adapter; |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
75 |
} |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
76 |
|
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
77 |
uint32_t |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
78 |
HigherDataTxVectorTag::GetSerializedSize (void) const |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
79 |
{ |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
80 |
NS_LOG_FUNCTION (this); |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
81 |
return (sizeof (WifiTxVector) + 1); |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
82 |
} |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
83 |
void |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
84 |
HigherDataTxVectorTag::Serialize (TagBuffer i) const |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
85 |
{ |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
86 |
NS_LOG_FUNCTION (this << &i); |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
87 |
i.Write ((uint8_t *)&m_dataTxVector, sizeof (WifiTxVector)); |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
88 |
i.WriteU8 (static_cast<uint8_t> (m_adapter)); |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
89 |
} |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
90 |
void |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
91 |
HigherDataTxVectorTag::Deserialize (TagBuffer i) |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
92 |
{ |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
93 |
NS_LOG_FUNCTION (this << &i); |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
94 |
i.Read ((uint8_t *)&m_dataTxVector, sizeof (WifiTxVector)); |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
95 |
m_adapter = i.ReadU8 (); |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
96 |
} |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
97 |
void |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
98 |
HigherDataTxVectorTag::Print (std::ostream &os) const |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
99 |
{ |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
100 |
NS_LOG_FUNCTION (this << &os); |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
101 |
os << " Data=" << m_dataTxVector << " Adapter=" << m_adapter; |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
102 |
} |
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
103 |
|
f2e90c12a44f
base implementation of the IEEE 802.11p standard
Junling Bu <linlinjavaer@gmail.com>
parents:
diff
changeset
|
104 |
} // namespace ns3 |