View | Details | Raw Unified | Return to bug 1359
Collapse All | Expand All

(-)a/src/internet/model/tcp-socket-base.cc (+37 lines)
 Lines 75-80    Link Here 
75
                   UintegerValue (65535),
75
                   UintegerValue (65535),
76
                   MakeUintegerAccessor (&TcpSocketBase::m_maxWinSize),
76
                   MakeUintegerAccessor (&TcpSocketBase::m_maxWinSize),
77
                   MakeUintegerChecker<uint16_t> ())
77
                   MakeUintegerChecker<uint16_t> ())
78
    .AddAttribute ("IcmpCallback", "Callback invoked whenever an icmp error is received on this socket.",
79
                   CallbackValue (),
80
                   MakeCallbackAccessor (&TcpSocketBase::m_icmpCallback),
81
                   MakeCallbackChecker ())
82
    .AddAttribute ("IcmpCallback6", "Callback invoked whenever an icmpv6 error is received on this socket.",
83
                   CallbackValue (),
84
                   MakeCallbackAccessor (&TcpSocketBase::m_icmpCallback6),
85
                   MakeCallbackChecker ())
78
    .AddTraceSource ("RTO",
86
    .AddTraceSource ("RTO",
79
                     "Retransmission timeout",
87
                     "Retransmission timeout",
80
                     MakeTraceSourceAccessor (&TcpSocketBase::m_rto))
88
                     MakeTraceSourceAccessor (&TcpSocketBase::m_rto))
 Lines 640-650    Link Here 
640
  if (m_endPoint != 0)
648
  if (m_endPoint != 0)
641
    {
649
    {
642
      m_endPoint->SetRxCallback (MakeCallback (&TcpSocketBase::ForwardUp, Ptr<TcpSocketBase> (this)));
650
      m_endPoint->SetRxCallback (MakeCallback (&TcpSocketBase::ForwardUp, Ptr<TcpSocketBase> (this)));
651
      m_endPoint->SetIcmpCallback (MakeCallback (&TcpSocketBase::ForwardIcmp, Ptr<TcpSocketBase> (this)));
643
      m_endPoint->SetDestroyCallback (MakeCallback (&TcpSocketBase::Destroy, Ptr<TcpSocketBase> (this)));
652
      m_endPoint->SetDestroyCallback (MakeCallback (&TcpSocketBase::Destroy, Ptr<TcpSocketBase> (this)));
644
    }
653
    }
645
  if (m_endPoint6 != 0)
654
  if (m_endPoint6 != 0)
646
    {
655
    {
647
      m_endPoint6->SetRxCallback (MakeCallback (&TcpSocketBase::ForwardUp6, Ptr<TcpSocketBase> (this)));
656
      m_endPoint6->SetRxCallback (MakeCallback (&TcpSocketBase::ForwardUp6, Ptr<TcpSocketBase> (this)));
657
      m_endPoint6->SetIcmpCallback (MakeCallback (&TcpSocketBase::ForwardIcmp6, Ptr<TcpSocketBase> (this)));
648
      m_endPoint6->SetDestroyCallback (MakeCallback (&TcpSocketBase::Destroy6, Ptr<TcpSocketBase> (this)));
658
      m_endPoint6->SetDestroyCallback (MakeCallback (&TcpSocketBase::Destroy6, Ptr<TcpSocketBase> (this)));
649
    }
659
    }
650
660
 Lines 772-777    Link Here 
772
  DoForwardUp (packet, saddr, daddr, port);
782
  DoForwardUp (packet, saddr, daddr, port);
773
}
783
}
774
784
785
void
786
TcpSocketBase::ForwardIcmp (Ipv4Address icmpSource, uint8_t icmpTtl,
787
                            uint8_t icmpType, uint8_t icmpCode,
788
                            uint32_t icmpInfo)
789
{
790
  NS_LOG_FUNCTION (this << icmpSource << (uint32_t)icmpTtl << (uint32_t)icmpType <<
791
                   (uint32_t)icmpCode << icmpInfo);
792
  if (!m_icmpCallback.IsNull ())
793
    {
794
      m_icmpCallback (icmpSource, icmpTtl, icmpType, icmpCode, icmpInfo);
795
    }
796
}
797
798
void
799
TcpSocketBase::ForwardIcmp6 (Ipv6Address icmpSource, uint8_t icmpTtl,
800
                            uint8_t icmpType, uint8_t icmpCode,
801
                            uint32_t icmpInfo)
802
{
803
  NS_LOG_FUNCTION (this << icmpSource << (uint32_t)icmpTtl << (uint32_t)icmpType <<
804
                   (uint32_t)icmpCode << icmpInfo);
805
  if (!m_icmpCallback6.IsNull ())
806
    {
807
      m_icmpCallback6 (icmpSource, icmpTtl, icmpType, icmpCode, icmpInfo);
808
    }
809
}
810
811
775
/** The real function to handle the incoming packet from lower layers. This is
812
/** The real function to handle the incoming packet from lower layers. This is
776
    wrapped by ForwardUp() so that this function can be overloaded by daughter
813
    wrapped by ForwardUp() so that this function can be overloaded by daughter
777
    classes. */
814
    classes. */
(-)a/src/internet/model/tcp-socket-base.h (+4 lines)
 Lines 138-143    Link Here 
138
  void ForwardUp6 (Ptr<Packet> packet, Ipv6Address saddr, Ipv6Address daddr, uint16_t port);
138
  void ForwardUp6 (Ptr<Packet> packet, Ipv6Address saddr, Ipv6Address daddr, uint16_t port);
139
  virtual void DoForwardUp (Ptr<Packet> packet, Ipv4Header header, uint16_t port, Ptr<Ipv4Interface> incomingInterface); //Get a pkt from L3
139
  virtual void DoForwardUp (Ptr<Packet> packet, Ipv4Header header, uint16_t port, Ptr<Ipv4Interface> incomingInterface); //Get a pkt from L3
140
  virtual void DoForwardUp (Ptr<Packet> packet, Ipv6Address saddr, Ipv6Address daddr, uint16_t port); // Ipv6 version
140
  virtual void DoForwardUp (Ptr<Packet> packet, Ipv6Address saddr, Ipv6Address daddr, uint16_t port); // Ipv6 version
141
  void ForwardIcmp (Ipv4Address icmpSource, uint8_t icmpTtl, uint8_t icmpType, uint8_t icmpCode, uint32_t icmpInfo);
142
  void ForwardIcmp6 (Ipv6Address icmpSource, uint8_t icmpTtl, uint8_t icmpType, uint8_t icmpCode, uint32_t icmpInfo);
141
  bool SendPendingData (bool withAck = false); // Send as much as the window allows
143
  bool SendPendingData (bool withAck = false); // Send as much as the window allows
142
  uint32_t SendDataPacket (SequenceNumber32 seq, uint32_t maxSize, bool withAck); // Send a data packet
144
  uint32_t SendDataPacket (SequenceNumber32 seq, uint32_t maxSize, bool withAck); // Send a data packet
143
  void SendEmptyPacket (uint8_t flags); // Send a empty packet that carries a flag, e.g. ACK
145
  void SendEmptyPacket (uint8_t flags); // Send a empty packet that carries a flag, e.g. ACK
 Lines 211-216    Link Here 
211
  Ipv6EndPoint*       m_endPoint6;
213
  Ipv6EndPoint*       m_endPoint6;
212
  Ptr<Node>           m_node;
214
  Ptr<Node>           m_node;
213
  Ptr<TcpL4Protocol>  m_tcp;
215
  Ptr<TcpL4Protocol>  m_tcp;
216
  Callback<void, Ipv4Address,uint8_t,uint8_t,uint8_t,uint32_t> m_icmpCallback;
217
  Callback<void, Ipv6Address,uint8_t,uint8_t,uint8_t,uint32_t> m_icmpCallback6;
214
218
215
  // Round trip time estimation
219
  // Round trip time estimation
216
  Ptr<RttEstimator> m_rtt;
220
  Ptr<RttEstimator> m_rtt;

Return to bug 1359