Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(3287)

Delta Between Two Patch Sets: src/internet-stack/udp-socket-impl.cc

Issue 849047: add packet-info-tag.cc for IP_PKTINFO/IPV6_PKTINFO (Closed)
Left Patch Set: Update with Tom's 2nd comments Created 14 years, 7 months ago
Right Patch Set: Remove redundant ipv4-src/dst args Created 14 years, 6 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/internet-stack/udp-socket-impl.h ('k') | src/node/ipv4-packet-info-tag.h » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 INRIA 3 * Copyright (c) 2007 INRIA
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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> 18 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19 */ 19 */
20 20
21 #include "ns3/log.h" 21 #include "ns3/log.h"
22 #include "ns3/node.h" 22 #include "ns3/node.h"
23 #include "ns3/inet-socket-address.h" 23 #include "ns3/inet-socket-address.h"
24 #include "ns3/ipv4-route.h" 24 #include "ns3/ipv4-route.h"
25 #include "ns3/ipv4.h" 25 #include "ns3/ipv4.h"
26 #include "ns3/ipv4-header.h" 26 #include "ns3/ipv4-header.h"
27 #include "ns3/ipv4-routing-protocol.h" 27 #include "ns3/ipv4-routing-protocol.h"
28 #include "ns3/udp-socket-factory.h" 28 #include "ns3/udp-socket-factory.h"
29 #include "ns3/trace-source-accessor.h" 29 #include "ns3/trace-source-accessor.h"
30 #include "ns3/ipv4-packet-info-tag.h"
30 #include "udp-socket-impl.h" 31 #include "udp-socket-impl.h"
31 #include "udp-l4-protocol.h" 32 #include "udp-l4-protocol.h"
32 #include "ipv4-end-point.h" 33 #include "ipv4-end-point.h"
33 #include "ipv4-packet-info-tag.h"
34 #include <limits> 34 #include <limits>
35 35
36 NS_LOG_COMPONENT_DEFINE ("UdpSocketImpl"); 36 NS_LOG_COMPONENT_DEFINE ("UdpSocketImpl");
37 37
38 namespace ns3 { 38 namespace ns3 {
39 39
40 static const uint32_t MAX_IPV4_UDP_DATAGRAM_SIZE = 65507; 40 static const uint32_t MAX_IPV4_UDP_DATAGRAM_SIZE = 65507;
41 41
42 // Add attributes generic to all UdpSockets to base class UdpSocket 42 // Add attributes generic to all UdpSockets to base class UdpSocket
43 TypeId 43 TypeId
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 NS_ASSERT (m_endPoint == 0); 582 NS_ASSERT (m_endPoint == 0);
583 return; 583 return;
584 } 584 }
585 NS_ASSERT (m_endPoint != 0); 585 NS_ASSERT (m_endPoint != 0);
586 } 586 }
587 m_endPoint->BindToNetDevice (netdevice); 587 m_endPoint->BindToNetDevice (netdevice);
588 return; 588 return;
589 } 589 }
590 590
591 void· 591 void·
592 UdpSocketImpl::ForwardUp (Ptr<Packet> packet, Ipv4Address saddr, Ipv4Address dad dr, uint16_t port, 592 UdpSocketImpl::ForwardUp (Ptr<Packet> packet, Ipv4Header header, uint16_t port,
593 Ptr<NetDevice> device) 593 Ptr<Ipv4Interface> incomingInterface)
594 { 594 {
595 NS_LOG_FUNCTION (this << packet << saddr << daddr << port); 595 NS_LOG_FUNCTION (this << packet << header << port);
596 596
597 if (m_shutdownRecv) 597 if (m_shutdownRecv)
598 { 598 {
599 return; 599 return;
600 } 600 }
601 601
602 // Should check via getsockopt ().. 602 // Should check via getsockopt ()..
603 if (this->m_recvpktinfo) 603 if (this->m_recvpktinfo)
604 { 604 {
605 Ipv4PacketInfoTag tag; 605 Ipv4PacketInfoTag tag;
606 packet->RemovePacketTag (tag); 606 packet->RemovePacketTag (tag);
607 tag.SetRecvIf (device->GetIfIndex ()); 607 tag.SetRecvIf (incomingInterface->GetDevice ()->GetIfIndex ());
608 packet->AddPacketTag (tag); 608 packet->AddPacketTag (tag);
609 } 609 }
610 610
611 if ((m_rxAvailable + packet->GetSize ()) <= m_rcvBufSize) 611 if ((m_rxAvailable + packet->GetSize ()) <= m_rcvBufSize)
612 { 612 {
613 Address address = InetSocketAddress (saddr, port); 613 Address address = InetSocketAddress (header.GetSource (), port);
614 SocketAddressTag tag; 614 SocketAddressTag tag;
615 tag.SetAddress (address); 615 tag.SetAddress (address);
616 packet->AddPacketTag (tag); 616 packet->AddPacketTag (tag);
617 m_deliveryQueue.push (packet); 617 m_deliveryQueue.push (packet);
618 m_rxAvailable += packet->GetSize (); 618 m_rxAvailable += packet->GetSize ();
619 NotifyDataRecv (); 619 NotifyDataRecv ();
620 } 620 }
621 else 621 else
622 { 622 {
623 // In general, this case should not occur unless the 623 // In general, this case should not occur unless the
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 m_mtuDiscover = discover; 710 m_mtuDiscover = discover;
711 } 711 }
712 bool· 712 bool·
713 UdpSocketImpl::GetMtuDiscover (void) const 713 UdpSocketImpl::GetMtuDiscover (void) const
714 { 714 {
715 return m_mtuDiscover; 715 return m_mtuDiscover;
716 } 716 }
717 717
718 718
719 } //namespace ns3 719 } //namespace ns3
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b