OLD | NEW |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2008,2009 IITP RAS | 3 * Copyright (c) 2008,2009 IITP RAS |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 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 | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 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 | 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 | 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
17 * | 17 * |
18 * Author: Kirill Andreev <andreev@iitp.ru> | 18 * Author: Kirill Andreev <andreev@iitp.ru> |
19 */ | 19 */ |
20 | 20 |
21 #include "ie-dot11s-rann.h" | 21 #include "ie-dot11s-rann.h" |
22 #include "ns3/assert.h" | 22 #include "ns3/assert.h" |
23 #include "ns3/address-utils.h" | 23 #include "ns3/address-utils.h" |
24 #include "ns3/packet.h" | 24 #include "ns3/packet.h" |
| 25 #include "ns3/unused.h" |
25 | 26 |
26 namespace ns3 { | 27 namespace ns3 { |
27 namespace dot11s { | 28 namespace dot11s { |
28 | 29 |
29 IeRann::~IeRann () | 30 IeRann::~IeRann () |
30 { | 31 { |
31 } | 32 } |
32 IeRann::IeRann () : | 33 IeRann::IeRann () : |
33 m_flags (0), m_hopcount (0), m_ttl (0), m_originatorAddress (Mac48Address::Get
Broadcast ()), | 34 m_flags (0), m_hopcount (0), m_ttl (0), m_originatorAddress (Mac48Address::Get
Broadcast ()), |
34 m_destSeqNumber (0), m_metric (0) | 35 m_destSeqNumber (0), m_metric (0) |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 i.WriteU8 (m_flags); | 121 i.WriteU8 (m_flags); |
121 i.WriteU8 (m_hopcount); | 122 i.WriteU8 (m_hopcount); |
122 i.WriteU8 (m_ttl); | 123 i.WriteU8 (m_ttl); |
123 WriteTo (i, m_originatorAddress); | 124 WriteTo (i, m_originatorAddress); |
124 i.WriteHtolsbU32 (m_destSeqNumber); | 125 i.WriteHtolsbU32 (m_destSeqNumber); |
125 i.WriteHtolsbU32 (m_metric); | 126 i.WriteHtolsbU32 (m_metric); |
126 } | 127 } |
127 uint8_t | 128 uint8_t |
128 IeRann::DeserializeInformationField (Buffer::Iterator start, uint8_t length) | 129 IeRann::DeserializeInformationField (Buffer::Iterator start, uint8_t length) |
129 { | 130 { |
| 131 NS_UNUSED (length); |
130 Buffer::Iterator i = start; | 132 Buffer::Iterator i = start; |
131 m_flags = i.ReadU8 (); | 133 m_flags = i.ReadU8 (); |
132 m_hopcount = i.ReadU8 (); | 134 m_hopcount = i.ReadU8 (); |
133 m_ttl = i.ReadU8 (); | 135 m_ttl = i.ReadU8 (); |
134 ReadFrom (i, m_originatorAddress); | 136 ReadFrom (i, m_originatorAddress); |
135 m_destSeqNumber = i.ReadLsbtohU32 (); | 137 m_destSeqNumber = i.ReadLsbtohU32 (); |
136 m_metric = i.ReadLsbtohU32 (); | 138 m_metric = i.ReadLsbtohU32 (); |
137 return i.GetDistanceFrom (start); | 139 return static_cast<uint8_t> (i.GetDistanceFrom (start)); |
138 } | 140 } |
139 uint8_t | 141 uint8_t |
140 IeRann::GetInformationFieldSize () const | 142 IeRann::GetInformationFieldSize () const |
141 { | 143 { |
142 uint8_t retval = 1 //Flags | 144 uint8_t retval = 1 //Flags |
143 + 1 //Hopcount | 145 + 1 //Hopcount |
144 + 1 //TTL | 146 + 1 //TTL |
145 + 6 //OriginatorAddress | 147 + 6 //OriginatorAddress |
146 + 4 //DestSeqNumber | 148 + 4 //DestSeqNumber |
147 + 4; //Metric | 149 + 4; //Metric |
(...skipping 22 matching lines...) Expand all Loading... |
170 std::ostream & | 172 std::ostream & |
171 operator << (std::ostream &os, const IeRann &a) | 173 operator << (std::ostream &os, const IeRann &a) |
172 { | 174 { |
173 a.Print (os); | 175 a.Print (os); |
174 return os; | 176 return os; |
175 } | 177 } |
176 } | 178 } |
177 } // namespace ns3::dot11s | 179 } // namespace ns3::dot11s |
178 | 180 |
179 | 181 |
OLD | NEW |