A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
hwmp-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,2009 IITP RAS
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
* Authors: Kirill Andreev <andreev@iitp.ru>
19
*/
20
21
#include "
hwmp-tag.h
"
22
23
namespace
ns3 {
24
namespace
dot11s {
25
26
NS_OBJECT_ENSURE_REGISTERED
(HwmpTag)
27
;
28
29
//Class HwmpTag:
30
HwmpTag::HwmpTag
() :
31
m_address (
Mac48Address
::GetBroadcast ()), m_ttl (0), m_metric (0), m_seqno (0)
32
{
33
}
34
35
HwmpTag::~HwmpTag
()
36
{
37
}
38
39
void
40
HwmpTag::SetAddress
(
Mac48Address
retransmitter)
41
{
42
m_address
= retransmitter;
43
}
44
45
Mac48Address
46
HwmpTag::GetAddress
()
47
{
48
return
m_address
;
49
}
50
51
void
52
HwmpTag::SetTtl
(uint8_t ttl)
53
{
54
m_ttl
= ttl;
55
}
56
57
uint8_t
58
HwmpTag::GetTtl
()
59
{
60
return
m_ttl
;
61
}
62
63
void
64
HwmpTag::SetMetric
(uint32_t metric)
65
{
66
m_metric
= metric;
67
}
68
69
uint32_t
70
HwmpTag::GetMetric
()
71
{
72
return
m_metric
;
73
}
74
75
void
76
HwmpTag::SetSeqno
(uint32_t seqno)
77
{
78
m_seqno
= seqno;
79
}
80
81
uint32_t
82
HwmpTag::GetSeqno
()
83
{
84
return
m_seqno
;
85
}
86
87
TypeId
88
HwmpTag::GetTypeId
()
89
{
90
static
TypeId
tid =
TypeId
(
"ns3::dot11s::HwmpTag"
).
SetParent
<
Tag
> ().AddConstructor<HwmpTag> ();
91
return
tid;
92
}
93
94
TypeId
95
HwmpTag::GetInstanceTypeId
()
const
96
{
97
return
GetTypeId
();
98
}
99
100
uint32_t
101
HwmpTag::GetSerializedSize
()
const
102
{
103
return
6
//address
104
+ 1
//ttl
105
+ 4
//metric
106
+ 4;
//seqno
107
}
108
109
void
110
HwmpTag::Serialize
(
TagBuffer
i)
const
111
{
112
uint8_t
address
[6];
113
int
j;
114
m_address
.
CopyTo
(address);
115
i.
WriteU8
(
m_ttl
);
116
i.
WriteU32
(
m_metric
);
117
i.
WriteU32
(
m_seqno
);
118
for
(j = 0; j < 6; j++)
119
{
120
i.
WriteU8
(address[j]);
121
}
122
}
123
124
void
125
HwmpTag::Deserialize
(
TagBuffer
i)
126
{
127
uint8_t
address
[6];
128
int
j;
129
m_ttl
= i.
ReadU8
();
130
m_metric
= i.
ReadU32
();
131
m_seqno
= i.
ReadU32
();
132
for
(j = 0; j < 6; j++)
133
{
134
address[j] = i.
ReadU8
();
135
}
136
m_address
.
CopyFrom
(address);
137
}
138
139
void
140
HwmpTag::Print
(std::ostream &os)
const
141
{
142
os <<
"address="
<<
m_address
;
143
os <<
"ttl="
<<
m_ttl
;
144
os <<
"metrc="
<<
m_metric
;
145
os <<
"seqno="
<<
m_seqno
;
146
}
147
void
148
HwmpTag::DecrementTtl
()
149
{
150
m_ttl
--;
151
}
152
}
// namespace dot11s
153
}
// namespace ns3
hwmp-tag.h
ns3::dot11s::HwmpTag::GetSerializedSize
virtual uint32_t GetSerializedSize() const
Definition:
hwmp-tag.cc:101
ns3::NS_OBJECT_ENSURE_REGISTERED
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
ns3::dot11s::HwmpTag::m_ttl
uint8_t m_ttl
Definition:
hwmp-tag.h:71
ns3::dot11s::HwmpTag::GetInstanceTypeId
virtual TypeId GetInstanceTypeId() const
Definition:
hwmp-tag.cc:95
ns3::TagBuffer::ReadU32
TAG_BUFFER_INLINE uint32_t ReadU32(void)
Definition:
tag-buffer.h:199
ns3::dot11s::HwmpTag::GetTypeId
static TypeId GetTypeId()
Definition:
hwmp-tag.cc:88
ns3::dot11s::HwmpTag::GetSeqno
uint32_t GetSeqno()
Definition:
hwmp-tag.cc:82
ns3::dot11s::HwmpTag::SetTtl
void SetTtl(uint8_t ttl)
Definition:
hwmp-tag.cc:52
ns3::TagBuffer::ReadU8
TAG_BUFFER_INLINE uint8_t ReadU8(void)
Definition:
tag-buffer.h:179
ns3::dot11s::HwmpTag::SetAddress
void SetAddress(Mac48Address retransmitter)
Definition:
hwmp-tag.cc:40
ns3::dot11s::HwmpTag::HwmpTag
HwmpTag()
Definition:
hwmp-tag.cc:30
ns3::dot11s::HwmpTag::GetAddress
Mac48Address GetAddress()
Definition:
hwmp-tag.cc:46
ns3::Mac48Address::CopyTo
void CopyTo(uint8_t buffer[6]) const
Definition:
mac48-address.cc:98
ns3::TagBuffer::WriteU32
TAG_BUFFER_INLINE void WriteU32(uint32_t v)
Definition:
tag-buffer.h:170
ns3::Tag
tag a set of bytes in a packet
Definition:
tag.h:36
ns3::dot11s::HwmpTag::~HwmpTag
~HwmpTag()
Definition:
hwmp-tag.cc:35
ns3::Mac48Address
an EUI-48 address
Definition:
mac48-address.h:41
ns3::dot11s::HwmpTag::SetMetric
void SetMetric(uint32_t metric)
Definition:
hwmp-tag.cc:64
ns3::TagBuffer::WriteU8
TAG_BUFFER_INLINE void WriteU8(uint8_t v)
Definition:
tag-buffer.h:156
ns3::Mac48Address::CopyFrom
void CopyFrom(const uint8_t buffer[6])
Definition:
mac48-address.cc:92
ns3::dot11s::HwmpTag::Print
virtual void Print(std::ostream &os) const
Definition:
hwmp-tag.cc:140
ns3::dot11s::HwmpTag::GetTtl
uint8_t GetTtl()
Definition:
hwmp-tag.cc:58
ns3::TagBuffer
read and write tag data
Definition:
tag-buffer.h:51
ns3::dot11s::HwmpTag::m_address
Mac48Address m_address
Definition:
hwmp-tag.h:70
ns3::dot11s::HwmpTag::GetMetric
uint32_t GetMetric()
Definition:
hwmp-tag.cc:70
ns3::dot11s::HwmpTag::DecrementTtl
void DecrementTtl()
Definition:
hwmp-tag.cc:148
ns3::dot11s::HwmpTag::Serialize
virtual void Serialize(TagBuffer i) const
Definition:
hwmp-tag.cc:110
ns3::dot11s::HwmpTag::m_metric
uint32_t m_metric
Definition:
hwmp-tag.h:72
first.address
tuple address
Definition:
first.py:37
ns3::dot11s::HwmpTag::m_seqno
uint32_t m_seqno
Definition:
hwmp-tag.h:73
ns3::dot11s::HwmpTag::SetSeqno
void SetSeqno(uint32_t seqno)
Definition:
hwmp-tag.cc:76
ns3::dot11s::HwmpTag::Deserialize
virtual void Deserialize(TagBuffer i)
Definition:
hwmp-tag.cc:125
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:49
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Definition:
type-id.cc:611
src
mesh
model
dot11s
hwmp-tag.cc
Generated on Sat Apr 19 2014 14:07:03 for ns-3 by
1.8.6