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 Telecom Bretagne | 3 * Copyright (c) 2008 Telecom Bretagne |
4 * Copyright (c) 2009 Strasbourg University | 4 * Copyright (c) 2009 Strasbourg University |
5 * | 5 * |
6 * This program is free software; you can redistribute it and/or modify | 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 | 7 * it under the terms of the GNU General Public License version 2 as |
8 * published by the Free Software Foundation; | 8 * published by the Free Software Foundation; |
9 * | 9 * |
10 * This program is distributed in the hope that it will be useful, | 10 * This program is distributed in the hope that it will be useful, |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 | 187 |
188 std::list<Ptr<RadvdPrefix> > prefixes = config->GetPrefixes (); | 188 std::list<Ptr<RadvdPrefix> > prefixes = config->GetPrefixes (); |
189 Ptr<Packet> p = Create<Packet> (); | 189 Ptr<Packet> p = Create<Packet> (); |
190 Ptr<Ipv6> ipv6 = GetNode ()->GetObject<Ipv6> (); | 190 Ptr<Ipv6> ipv6 = GetNode ()->GetObject<Ipv6> (); |
191 | 191 |
192 /* set RA header information */ | 192 /* set RA header information */ |
193 raHdr.SetFlagM (config->IsManagedFlag ()); | 193 raHdr.SetFlagM (config->IsManagedFlag ()); |
194 raHdr.SetFlagO (config->IsOtherConfigFlag ()); | 194 raHdr.SetFlagO (config->IsOtherConfigFlag ()); |
195 raHdr.SetFlagH (config->IsHomeAgentFlag ()); | 195 raHdr.SetFlagH (config->IsHomeAgentFlag ()); |
196 raHdr.SetCurHopLimit (config->GetCurHopLimit ()); | 196 raHdr.SetCurHopLimit (config->GetCurHopLimit ()); |
197 raHdr.SetLifeTime ((uint16_t)config->GetDefaultLifeTime ()); | 197 raHdr.SetLifeTime (static_cast<uint16_t> (config->GetDefaultLifeTime ())); |
198 raHdr.SetReachableTime (config->GetReachableTime ()); | 198 raHdr.SetReachableTime (config->GetReachableTime ()); |
199 raHdr.SetRetransmissionTime (config->GetRetransTimer ()); | 199 raHdr.SetRetransmissionTime (config->GetRetransTimer ()); |
200 | 200 |
201 if (config->IsSourceLLAddress ()) | 201 if (config->IsSourceLLAddress ()) |
202 { | 202 { |
203 /* Get L2 address from NetDevice */ | 203 /* Get L2 address from NetDevice */ |
204 Address addr = ipv6->GetNetDevice (config->GetInterface ())->GetAddress ()
; | 204 Address addr = ipv6->GetNetDevice (config->GetInterface ())->GetAddress ()
; |
205 llaHdr = Icmpv6OptionLinkLayerAddress (true, addr); | 205 llaHdr = Icmpv6OptionLinkLayerAddress (true, addr); |
206 p->AddHeader (llaHdr); | 206 p->AddHeader (llaHdr); |
207 } | 207 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 } | 244 } |
245 | 245 |
246 Address sockAddr; | 246 Address sockAddr; |
247 m_sendSockets[config->GetInterface ()]->GetSockName (sockAddr); | 247 m_sendSockets[config->GetInterface ()]->GetSockName (sockAddr); |
248 Ipv6Address src = Inet6SocketAddress::ConvertFrom (sockAddr).GetIpv6 (); | 248 Ipv6Address src = Inet6SocketAddress::ConvertFrom (sockAddr).GetIpv6 (); |
249 | 249 |
250 /* as we know interface index that will be used to send RA and· | 250 /* as we know interface index that will be used to send RA and· |
251 * we always send RA with router's link-local address, we can· | 251 * we always send RA with router's link-local address, we can· |
252 * calculate checksum here. | 252 * calculate checksum here. |
253 */ | 253 */ |
254 raHdr.CalculatePseudoHeaderChecksum (src, dst, (uint16_t)(p->GetSize () + raHd
r.GetSerializedSize ()), 58 /* ICMPv6 */); | 254 raHdr.CalculatePseudoHeaderChecksum (src, dst, p->GetSize () + raHdr.GetSerial
izedSize (), 58 /* ICMPv6 */); |
255 p->AddHeader (raHdr); | 255 p->AddHeader (raHdr); |
256 | 256 |
257 /* Router advertisements MUST always have a ttl of 255 | 257 /* Router advertisements MUST always have a ttl of 255 |
258 * The ttl value should be set as a socket option, but this is not yet impleme
nted | 258 * The ttl value should be set as a socket option, but this is not yet impleme
nted |
259 */ | 259 */ |
260 SocketIpTtlTag ttl; | 260 SocketIpTtlTag ttl; |
261 ttl.SetTtl (255); | 261 ttl.SetTtl (255); |
262 p->AddPacketTag (ttl); | 262 p->AddPacketTag (ttl); |
263 | 263 |
264 /* send RA */ | 264 /* send RA */ |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 break; | 358 break; |
359 default: | 359 default: |
360 break; | 360 break; |
361 } | 361 } |
362 } | 362 } |
363 } | 363 } |
364 } | 364 } |
365 | 365 |
366 } /* namespace ns3 */ | 366 } /* namespace ns3 */ |
367 | 367 |
LEFT | RIGHT |