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) 2007-2009 Strasbourg University | 3 * Copyright (c) 2007-2009 Strasbourg University |
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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 break; | 221 break; |
222 } | 222 } |
223 | 223 |
224 return Ipv6L4Protocol::RX_OK; | 224 return Ipv6L4Protocol::RX_OK; |
225 } | 225 } |
226 | 226 |
227 void Icmpv6L4Protocol::HandleEchoRequest (Ptr<Packet> packet, Ipv6Address const
&src, Ipv6Address const &dst, Ptr<Ipv6Interface> interface) | 227 void Icmpv6L4Protocol::HandleEchoRequest (Ptr<Packet> packet, Ipv6Address const
&src, Ipv6Address const &dst, Ptr<Ipv6Interface> interface) |
228 { | 228 { |
229 NS_LOG_FUNCTION (this << packet << src << dst << interface); | 229 NS_LOG_FUNCTION (this << packet << src << dst << interface); |
230 Icmpv6Echo request; | 230 Icmpv6Echo request; |
| 231 uint8_t buf[packet->GetSize ()]; |
| 232 |
231 packet->RemoveHeader (request); | 233 packet->RemoveHeader (request); |
| 234 /* XXX IPv6 extension: obtain a fresh copy of data otherwise it crash... */ |
| 235 packet->CopyData (buf, packet->GetSize ()); |
| 236 Ptr<Packet> p = Create<Packet> (buf, packet->GetSize ()); |
232 | 237 |
233 /* if we send message from ff02::* (link-local multicast), we use our link-loc
al address */ | 238 /* if we send message from ff02::* (link-local multicast), we use our link-loc
al address */ |
234 SendEchoReply (dst.IsMulticast () ? interface->GetLinkLocalAddress ().GetAddre
ss () : dst, src, request.GetId (), request.GetSeq (), packet); | 239 SendEchoReply (dst.IsMulticast () ? interface->GetLinkLocalAddress ().GetAddre
ss () : dst, src, request.GetId (), request.GetSeq (), p); |
235 } | 240 } |
236 | 241 |
237 void Icmpv6L4Protocol::HandleRA (Ptr<Packet> packet, Ipv6Address const &src, Ipv
6Address const &dst, Ptr<Ipv6Interface> interface) | 242 void Icmpv6L4Protocol::HandleRA (Ptr<Packet> packet, Ipv6Address const &src, Ipv
6Address const &dst, Ptr<Ipv6Interface> interface) |
238 {· | 243 {· |
239 NS_LOG_FUNCTION (this << packet << src << dst << interface); | 244 NS_LOG_FUNCTION (this << packet << src << dst << interface); |
240 Ptr<Packet> p = packet->Copy (); | 245 Ptr<Packet> p = packet->Copy (); |
241 Icmpv6RA raHeader; | 246 Icmpv6RA raHeader; |
242 Ptr<Ipv6L3Protocol> ipv6 = m_node->GetObject<Ipv6L3Protocol> (); | 247 Ptr<Ipv6L3Protocol> ipv6 = m_node->GetObject<Ipv6L3Protocol> (); |
243 Icmpv6OptionPrefixInformation prefixHdr; | 248 Icmpv6OptionPrefixInformation prefixHdr; |
244 Icmpv6OptionMtu mtuHdr; | 249 Icmpv6OptionMtu mtuHdr; |
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1219 /* XXX because all nodes start at the same time, there will be many of RS
arround 1 second of simulation time· | 1224 /* XXX because all nodes start at the same time, there will be many of RS
arround 1 second of simulation time· |
1220 * TODO Add random delays before sending RS | 1225 * TODO Add random delays before sending RS |
1221 */ | 1226 */ |
1222 Simulator::Schedule (Seconds (0.0), &Icmpv6L4Protocol::SendRS, PeekPointer
(icmpv6), ifaddr.GetAddress (), Ipv6Address::GetAllRoutersMulticast (), interfa
ce->GetDevice ()->GetAddress ()); | 1227 Simulator::Schedule (Seconds (0.0), &Icmpv6L4Protocol::SendRS, PeekPointer
(icmpv6), ifaddr.GetAddress (), Ipv6Address::GetAllRoutersMulticast (), interfa
ce->GetDevice ()->GetAddress ()); |
1223 } | 1228 } |
1224 } | 1229 } |
1225 } | 1230 } |
1226 | 1231 |
1227 } /* namespace ns3 */ | 1232 } /* namespace ns3 */ |
1228 | 1233 |
OLD | NEW |