LEFT | RIGHT |
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 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 WriteTo (i, m_destinationAddress); | 155 WriteTo (i, m_destinationAddress); |
156 i.WriteHtolsbU32 (m_destSeqNumber); | 156 i.WriteHtolsbU32 (m_destSeqNumber); |
157 i.WriteHtolsbU32 (m_lifetime); | 157 i.WriteHtolsbU32 (m_lifetime); |
158 i.WriteHtolsbU32 (m_metric); | 158 i.WriteHtolsbU32 (m_metric); |
159 WriteTo (i, m_originatorAddress); | 159 WriteTo (i, m_originatorAddress); |
160 i.WriteHtolsbU32 (m_originatorSeqNumber); | 160 i.WriteHtolsbU32 (m_originatorSeqNumber); |
161 } | 161 } |
162 uint8_t | 162 uint8_t |
163 IePrep::DeserializeInformationField (Buffer::Iterator start, uint8_t length) | 163 IePrep::DeserializeInformationField (Buffer::Iterator start, uint8_t length) |
164 { | 164 { |
165 NS_UNUSED(length); | 165 NS_UNUSED (length); |
166 Buffer::Iterator i = start; | 166 Buffer::Iterator i = start; |
167 m_flags = i.ReadU8 (); | 167 m_flags = i.ReadU8 (); |
168 m_hopcount = i.ReadU8 (); | 168 m_hopcount = i.ReadU8 (); |
169 m_ttl = i.ReadU8 (); | 169 m_ttl = i.ReadU8 (); |
170 ReadFrom (i, m_destinationAddress); | 170 ReadFrom (i, m_destinationAddress); |
171 m_destSeqNumber = i.ReadLsbtohU32 (); | 171 m_destSeqNumber = i.ReadLsbtohU32 (); |
172 m_lifetime = i.ReadLsbtohU32 (); | 172 m_lifetime = i.ReadLsbtohU32 (); |
173 m_metric = i.ReadLsbtohU32 (); | 173 m_metric = i.ReadLsbtohU32 (); |
174 ReadFrom (i, m_originatorAddress); | 174 ReadFrom (i, m_originatorAddress); |
175 m_originatorSeqNumber = i.ReadLsbtohU32 (); | 175 m_originatorSeqNumber = i.ReadLsbtohU32 (); |
176 return (uint8_t)i.GetDistanceFrom (start); | 176 return static_cast<uint8_t> (i.GetDistanceFrom (start)); |
177 } | 177 } |
178 uint8_t | 178 uint8_t |
179 IePrep::GetInformationFieldSize () const | 179 IePrep::GetInformationFieldSize () const |
180 { | 180 { |
181 uint32_t retval = 1 //Flags | 181 uint8_t retval = 1 //Flags |
182 + 1 //Hopcount | 182 + 1 //Hopcount |
183 + 1 //Ttl | 183 + 1 //Ttl |
184 + 6 //Dest address | 184 + 6 //Dest address |
185 + 4 //Dest seqno | 185 + 4 //Dest seqno |
186 + 4 //Lifetime | 186 + 4 //Lifetime |
187 + 4 //metric | 187 + 4 //metric |
188 + 6 //Originator address | 188 + 6 //Originator address |
189 + 4; //Originator seqno | 189 + 4; //Originator seqno |
190 return (uint8_t)retval; | 190 return retval; |
191 } | 191 } |
192 void | 192 void |
193 IePrep::Print (std::ostream& os) const | 193 IePrep::Print (std::ostream& os) const |
194 { | 194 { |
195 os << "PREP=(Flags=" << m_flags << ", Hopcount=" << m_hopcount << ", TTL=" <<
m_ttl | 195 os << "PREP=(Flags=" << m_flags << ", Hopcount=" << m_hopcount << ", TTL=" <<
m_ttl |
196 << ",Destination=" << m_destinationAddress << ", Dest. seqnum=" << m_destSe
qNumber | 196 << ",Destination=" << m_destinationAddress << ", Dest. seqnum=" << m_destSe
qNumber |
197 << ", Lifetime=" << m_lifetime << ", Metric=" << m_metric << ", Originator=
" | 197 << ", Lifetime=" << m_lifetime << ", Metric=" << m_metric << ", Originator=
" |
198 << m_originatorAddress << ", Orig. seqnum=" << m_originatorSeqNumber << ")"
; | 198 << m_originatorAddress << ", Orig. seqnum=" << m_originatorSeqNumber << ")"
; |
199 } | 199 } |
200 bool | 200 bool |
201 operator== (const IePrep & a, const IePrep & b) | 201 operator== (const IePrep & a, const IePrep & b) |
202 { | 202 { |
203 return ((a.m_flags == b.m_flags) && (a.m_hopcount == b.m_hopcount) && (a.m_ttl
== b.m_ttl) | 203 return ((a.m_flags == b.m_flags) && (a.m_hopcount == b.m_hopcount) && (a.m_ttl
== b.m_ttl) |
204 && (a.m_destinationAddress == b.m_destinationAddress) && (a.m_destSeqN
umber == b.m_destSeqNumber) | 204 && (a.m_destinationAddress == b.m_destinationAddress) && (a.m_destSeqN
umber == b.m_destSeqNumber) |
205 && (a.m_lifetime == b.m_lifetime) && (a.m_metric == b.m_metric) && (a.
m_originatorAddress | 205 && (a.m_lifetime == b.m_lifetime) && (a.m_metric == b.m_metric) && (a.
m_originatorAddress |
206 ==
b.m_originatorAddress) && (a.m_originatorSeqNumber == b.m_originatorSeqNumber))
; | 206 ==
b.m_originatorAddress) && (a.m_originatorSeqNumber == b.m_originatorSeqNumber))
; |
207 } | 207 } |
208 std::ostream & | 208 std::ostream & |
209 operator << (std::ostream &os, const IePrep &a) | 209 operator << (std::ostream &os, const IePrep &a) |
210 { | 210 { |
211 a.Print (os); | 211 a.Print (os); |
212 return os; | 212 return os; |
213 } | 213 } |
214 } // namespace dot11s | 214 } // namespace dot11s |
215 } // namespace ns3 | 215 } // namespace ns3 |
216 | 216 |
LEFT | RIGHT |