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 |
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: Sebastien Vincent <vincent@clarinet.u-strasbg.fr> | 18 * Author: Sebastien Vincent <vincent@clarinet.u-strasbg.fr> |
19 */ | 19 */ |
20 | 20 |
21 #include "ns3/inet6-socket-address.h" | 21 #include "ns3/inet6-socket-address.h" |
22 #include "ns3/node.h" | 22 #include "ns3/node.h" |
23 #include "ns3/packet.h" | 23 #include "ns3/packet.h" |
24 #include "ns3/uinteger.h" | 24 #include "ns3/uinteger.h" |
25 #include "ns3/log.h" | 25 #include "ns3/log.h" |
26 #include "ns3/ipv6-route.h" | 26 #include "ns3/ipv6-route.h" |
27 #include "ns3/ipv6-routing-protocol.h" | 27 #include "ns3/ipv6-routing-protocol.h" |
| 28 #include "ns3/ipv6-packet-info-tag.h" |
28 | 29 |
29 #include "ipv6-l3-protocol.h" | 30 #include "ipv6-l3-protocol.h" |
30 #include "ipv6-raw-socket-impl.h" | 31 #include "ipv6-raw-socket-impl.h" |
31 #include "icmpv6-header.h" | 32 #include "icmpv6-header.h" |
32 #include "icmpv6-l4-protocol.h" | 33 #include "icmpv6-l4-protocol.h" |
33 | 34 |
34 namespace ns3 | 35 namespace ns3 |
35 { | 36 { |
36 | 37 |
37 NS_LOG_COMPONENT_DEFINE ("Ipv6RawSocketImpl"); | 38 NS_LOG_COMPONENT_DEFINE ("Ipv6RawSocketImpl"); |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 copy->PeekHeader (icmpHeader); | 315 copy->PeekHeader (icmpHeader); |
315 uint8_t type = icmpHeader.GetType (); | 316 uint8_t type = icmpHeader.GetType (); |
316 | 317 |
317 if ((1 << type) & m_icmpFilter) | 318 if ((1 << type) & m_icmpFilter) |
318 { | 319 { |
319 /* packet filtered */ | 320 /* packet filtered */ |
320 return false; | 321 return false; |
321 } | 322 } |
322 } | 323 } |
323 | 324 |
| 325 // Should check via getsockopt ().. |
| 326 if (this->m_recvpktinfo) |
| 327 { |
| 328 Ipv6PacketInfoTag tag; |
| 329 copy->RemovePacketTag (tag); |
| 330 tag.SetRecvIf (device->GetIfIndex ()); |
| 331 copy->AddPacketTag (tag); |
| 332 } |
| 333 |
324 copy->AddHeader (hdr); | 334 copy->AddHeader (hdr); |
325 struct Data data; | 335 struct Data data; |
326 data.packet = copy; | 336 data.packet = copy; |
327 data.fromIp = hdr.GetSourceAddress (); | 337 data.fromIp = hdr.GetSourceAddress (); |
328 data.fromProtocol = hdr.GetNextHeader (); | 338 data.fromProtocol = hdr.GetNextHeader (); |
329 m_data.push_back (data); | 339 m_data.push_back (data); |
330 NotifyDataRecv (); | 340 NotifyDataRecv (); |
331 return true; | 341 return true; |
332 } | 342 } |
333 return false; | 343 return false; |
334 } | 344 } |
335 | 345 |
336 } /* namespace ns3 */ | 346 } /* namespace ns3 */ |
337 | 347 |
OLD | NEW |