73 MakeDoubleChecker<double> (0)) |
73 MakeDoubleChecker<double> (0)) |
74 .AddAttribute ("MaxWindowSize", "Max size of advertised window", |
74 .AddAttribute ("MaxWindowSize", "Max size of advertised window", |
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)) |
81 .AddTraceSource ("RTT", |
89 .AddTraceSource ("RTT", |
82 "Last RTT sample", |
90 "Last RTT sample", |
638 return -1; |
646 return -1; |
639 } |
647 } |
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 |
651 return 0; |
661 return 0; |
652 } |
662 } |
768 |
778 |
769 void |
779 void |
770 TcpSocketBase::ForwardUp6 (Ptr<Packet> packet, Ipv6Address saddr, Ipv6Address daddr, uint16_t port) |
780 TcpSocketBase::ForwardUp6 (Ptr<Packet> packet, Ipv6Address saddr, Ipv6Address daddr, uint16_t port) |
771 { |
781 { |
772 DoForwardUp (packet, saddr, daddr, port); |
782 DoForwardUp (packet, saddr, daddr, port); |
|
783 } |
|
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 } |
773 } |
809 } |
774 |
810 |
775 /** The real function to handle the incoming packet from lower layers. This is |
811 /** 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 |
812 wrapped by ForwardUp() so that this function can be overloaded by daughter |
777 classes. */ |
813 classes. */ |