|
|
| 70 |
m_endPoint (0), |
70 |
m_endPoint (0), |
| 71 |
m_node (0), |
71 |
m_node (0), |
| 72 |
m_tcp (0), |
72 |
m_tcp (0), |
| 73 |
m_localAddress (Ipv4Address::GetZero ()), |
|
|
| 74 |
m_localPort (0), |
| 75 |
m_errno (ERROR_NOTERROR), |
73 |
m_errno (ERROR_NOTERROR), |
| 76 |
m_shutdownSend (false), |
74 |
m_shutdownSend (false), |
| 77 |
m_shutdownRecv (false), |
75 |
m_shutdownRecv (false), |
|
|
| 109 |
m_endPoint (0), |
107 |
m_endPoint (0), |
| 110 |
m_node (sock.m_node), |
108 |
m_node (sock.m_node), |
| 111 |
m_tcp (sock.m_tcp), |
109 |
m_tcp (sock.m_tcp), |
| 112 |
m_remoteAddress (sock.m_remoteAddress), |
|
|
| 113 |
m_remotePort (sock.m_remotePort), |
| 114 |
m_localAddress (sock.m_localAddress), |
| 115 |
m_localPort (sock.m_localPort), |
| 116 |
m_errno (sock.m_errno), |
110 |
m_errno (sock.m_errno), |
| 117 |
m_shutdownSend (sock.m_shutdownSend), |
111 |
m_shutdownSend (sock.m_shutdownSend), |
| 118 |
m_shutdownRecv (sock.m_shutdownRecv), |
112 |
m_shutdownRecv (sock.m_shutdownRecv), |
|
|
| 266 |
} |
260 |
} |
| 267 |
m_endPoint->SetRxCallback (MakeCallback (&TcpSocketImpl::ForwardUp, Ptr<TcpSocketImpl>(this))); |
261 |
m_endPoint->SetRxCallback (MakeCallback (&TcpSocketImpl::ForwardUp, Ptr<TcpSocketImpl>(this))); |
| 268 |
m_endPoint->SetDestroyCallback (MakeCallback (&TcpSocketImpl::Destroy, Ptr<TcpSocketImpl>(this))); |
262 |
m_endPoint->SetDestroyCallback (MakeCallback (&TcpSocketImpl::Destroy, Ptr<TcpSocketImpl>(this))); |
| 269 |
m_localAddress = m_endPoint->GetLocalAddress (); |
|
|
| 270 |
m_localPort = m_endPoint->GetLocalPort (); |
| 271 |
return 0; |
263 |
return 0; |
| 272 |
} |
264 |
} |
| 273 |
|
265 |
|
|
|
| 377 |
NS_ASSERT (m_endPoint != 0); |
369 |
NS_ASSERT (m_endPoint != 0); |
| 378 |
} |
370 |
} |
| 379 |
InetSocketAddress transport = InetSocketAddress::ConvertFrom (address); |
371 |
InetSocketAddress transport = InetSocketAddress::ConvertFrom (address); |
| 380 |
m_remoteAddress = transport.GetIpv4 (); |
372 |
m_endPoint->SetPeer(transport.GetIpv4 (), transport.GetPort ()); |
| 381 |
m_remotePort = transport.GetPort (); |
|
|
| 382 |
|
373 |
|
| 383 |
if (ipv4->GetRoutingProtocol () != 0) |
374 |
if (ipv4->GetRoutingProtocol () != 0) |
| 384 |
{ |
375 |
{ |
| 385 |
Ipv4Header header; |
376 |
Ipv4Header header; |
| 386 |
header.SetDestination (m_remoteAddress); |
377 |
header.SetDestination (m_endPoint->GetPeerAddress()); |
| 387 |
Socket::SocketErrno errno_; |
378 |
Socket::SocketErrno errno_; |
| 388 |
Ptr<Ipv4Route> route; |
379 |
Ptr<Ipv4Route> route; |
| 389 |
Ptr<NetDevice> oif = m_boundnetdevice; //specify non-zero if bound to a source address |
380 |
Ptr<NetDevice> oif = m_boundnetdevice; //specify non-zero if bound to a source address |
|
|
| 396 |
} |
387 |
} |
| 397 |
else |
388 |
else |
| 398 |
{ |
389 |
{ |
| 399 |
NS_LOG_LOGIC ("TcpSocketImpl::Connect(): Route to " << m_remoteAddress << " does not exist"); |
390 |
NS_LOG_LOGIC ("TcpSocketImpl::Connect(): Route to " << m_endPoint->GetPeerAddress() << " does not exist"); |
| 400 |
NS_LOG_ERROR (errno_); |
391 |
NS_LOG_ERROR (errno_); |
| 401 |
m_errno = errno_; |
392 |
m_errno = errno_; |
| 402 |
return -1; |
393 |
return -1; |
|
|
| 602 |
} |
593 |
} |
| 603 |
} |
594 |
} |
| 604 |
SocketAddressTag tag; |
595 |
SocketAddressTag tag; |
| 605 |
tag.SetAddress (InetSocketAddress (m_remoteAddress, m_remotePort)); |
596 |
tag.SetAddress (InetSocketAddress (m_endPoint->GetPeerAddress(), m_endPoint->GetPeerPort())); |
| 606 |
outPacket->AddPacketTag (tag); |
597 |
outPacket->AddPacketTag (tag); |
| 607 |
return outPacket; |
598 |
return outPacket; |
| 608 |
} |
599 |
} |
|
|
| 638 |
TcpSocketImpl::GetSockName (Address &address) const |
629 |
TcpSocketImpl::GetSockName (Address &address) const |
| 639 |
{ |
630 |
{ |
| 640 |
NS_LOG_FUNCTION_NOARGS (); |
631 |
NS_LOG_FUNCTION_NOARGS (); |
| 641 |
address = InetSocketAddress(m_localAddress, m_localPort); |
632 |
address = InetSocketAddress(m_endPoint->GetLocalAddress (), |
|
|
633 |
m_endPoint->GetLocalPort ()); |
| 642 |
return 0; |
634 |
return 0; |
| 643 |
} |
635 |
} |
| 644 |
|
636 |
|
|
|
| 661 |
} |
653 |
} |
| 662 |
|
654 |
|
| 663 |
void |
655 |
void |
| 664 |
TcpSocketImpl::ForwardUp (Ptr<Packet> packet, Ipv4Address ipv4, uint16_t port) |
656 |
TcpSocketImpl::ForwardUp (Ptr<Packet> packet, Ipv4Address saddr, Ipv4Address daddr, uint16_t port) |
| 665 |
{ |
657 |
{ |
| 666 |
NS_LOG_DEBUG("Socket " << this << " got forward up" << |
658 |
NS_LOG_DEBUG("Socket " << this << " got forward up" << |
| 667 |
" dport " << m_endPoint->GetLocalPort() << |
659 |
" dport " << m_endPoint->GetLocalPort() << |
|
|
| 669 |
" sport " << m_endPoint->GetPeerPort() << |
661 |
" sport " << m_endPoint->GetPeerPort() << |
| 670 |
" saddr " << m_endPoint->GetPeerAddress()); |
662 |
" saddr " << m_endPoint->GetPeerAddress()); |
| 671 |
|
663 |
|
| 672 |
NS_LOG_FUNCTION (this << packet << ipv4 << port); |
664 |
NS_LOG_FUNCTION (this << packet << saddr << daddr << port); |
|
|
665 |
|
| 666 |
Address fromAddress = InetSocketAddress (saddr, port); |
| 667 |
Address toAddress = InetSocketAddress (daddr, m_endPoint->GetLocalPort()); |
| 668 |
|
| 673 |
if (m_shutdownRecv) |
669 |
if (m_shutdownRecv) |
| 674 |
{ |
670 |
{ |
| 675 |
return; |
671 |
return; |
|
|
| 695 |
|
691 |
|
| 696 |
Events_t event = SimulationSingleton<TcpStateMachine>::Get ()->FlagsEvent (tcpHeader.GetFlags () ); |
692 |
Events_t event = SimulationSingleton<TcpStateMachine>::Get ()->FlagsEvent (tcpHeader.GetFlags () ); |
| 697 |
Actions_t action = ProcessEvent (event); //updates the state |
693 |
Actions_t action = ProcessEvent (event); //updates the state |
| 698 |
Address address = InetSocketAddress (ipv4, port); |
|
|
| 699 |
NS_LOG_DEBUG("Socket " << this << |
694 |
NS_LOG_DEBUG("Socket " << this << |
| 700 |
" processing pkt action, " << action << |
695 |
" processing pkt action, " << action << |
| 701 |
" current state " << m_state); |
696 |
" current state " << m_state); |
| 702 |
ProcessPacketAction (action, packet, tcpHeader, address); |
697 |
ProcessPacketAction (action, packet, tcpHeader, fromAddress, toAddress); |
| 703 |
} |
698 |
} |
| 704 |
|
699 |
|
| 705 |
Actions_t TcpSocketImpl::ProcessEvent (Events_t e) |
700 |
Actions_t TcpSocketImpl::ProcessEvent (Events_t e) |
|
|
| 727 |
{ |
722 |
{ |
| 728 |
Simulator::ScheduleNow(&TcpSocketImpl::ConnectionSucceeded, this); |
723 |
Simulator::ScheduleNow(&TcpSocketImpl::ConnectionSucceeded, this); |
| 729 |
m_connected = true; |
724 |
m_connected = true; |
| 730 |
m_endPoint->SetPeer (m_remoteAddress, m_remotePort); |
|
|
| 731 |
NS_LOG_LOGIC ("TcpSocketImpl " << this << " Connected!"); |
725 |
NS_LOG_LOGIC ("TcpSocketImpl " << this << " Connected!"); |
| 732 |
} |
726 |
} |
| 733 |
if (saveState < CLOSING && (m_state == CLOSING || m_state == TIMED_WAIT) ) |
727 |
if (saveState < CLOSING && (m_state == CLOSING || m_state == TIMED_WAIT) ) |
|
|
| 787 |
header.SetSequenceNumber (m_nextTxSequence); |
781 |
header.SetSequenceNumber (m_nextTxSequence); |
| 788 |
header.SetAckNumber (m_nextRxSequence); |
782 |
header.SetAckNumber (m_nextRxSequence); |
| 789 |
header.SetSourcePort (m_endPoint->GetLocalPort ()); |
783 |
header.SetSourcePort (m_endPoint->GetLocalPort ()); |
| 790 |
header.SetDestinationPort (m_remotePort); |
784 |
header.SetDestinationPort (m_endPoint->GetPeerPort ()); |
| 791 |
header.SetWindowSize (AdvertisedWindowSize()); |
785 |
header.SetWindowSize (AdvertisedWindowSize()); |
| 792 |
m_tcp->SendPacket (p, header, m_endPoint->GetLocalAddress (), |
786 |
m_tcp->SendPacket (p, header, m_endPoint->GetLocalAddress (), |
| 793 |
m_remoteAddress, m_boundnetdevice); |
787 |
m_endPoint->GetPeerAddress (), m_boundnetdevice); |
| 794 |
Time rto = m_rtt->RetransmitTimeout (); |
788 |
Time rto = m_rtt->RetransmitTimeout (); |
| 795 |
bool hasSyn = flags & TcpHeader::SYN; |
789 |
bool hasSyn = flags & TcpHeader::SYN; |
| 796 |
bool hasFin = flags & TcpHeader::FIN; |
790 |
bool hasFin = flags & TcpHeader::FIN; |
|
|
| 901 |
|
895 |
|
| 902 |
bool TcpSocketImpl::ProcessPacketAction (Actions_t a, Ptr<Packet> p, |
896 |
bool TcpSocketImpl::ProcessPacketAction (Actions_t a, Ptr<Packet> p, |
| 903 |
const TcpHeader& tcpHeader, |
897 |
const TcpHeader& tcpHeader, |
| 904 |
const Address& fromAddress) |
898 |
const Address& fromAddress, |
|
|
899 |
const Address& toAddress) |
| 905 |
{ |
900 |
{ |
| 906 |
NS_LOG_FUNCTION (this << a << p << fromAddress); |
901 |
NS_LOG_FUNCTION (this << a << p << fromAddress); |
| 907 |
Ptr<Ipv4> ipv4 = m_node->GetObject<Ipv4> (); |
902 |
Ptr<Ipv4> ipv4 = m_node->GetObject<Ipv4> (); |
|
|
| 935 |
NS_LOG_LOGIC ("Cloned a TcpSocketImpl " << newSock); |
930 |
NS_LOG_LOGIC ("Cloned a TcpSocketImpl " << newSock); |
| 936 |
//this listening socket should do nothing more |
931 |
//this listening socket should do nothing more |
| 937 |
Simulator::ScheduleNow (&TcpSocketImpl::CompleteFork, newSock, |
932 |
Simulator::ScheduleNow (&TcpSocketImpl::CompleteFork, newSock, |
| 938 |
p, tcpHeader,fromAddress); |
933 |
p, tcpHeader, fromAddress, toAddress); |
| 939 |
return true; |
934 |
return true; |
| 940 |
} |
935 |
} |
| 941 |
// This is the cloned endpoint |
936 |
else |
| 942 |
m_endPoint->SetPeer (m_remoteAddress, m_remotePort); |
937 |
{ |
|
|
938 |
// This is the cloned endpoint |
| 939 |
// TCP SYN consumes one byte |
| 940 |
m_nextRxSequence = tcpHeader.GetSequenceNumber () |
| 941 |
+ SequenceNumber (1); |
| 942 |
SendEmptyPacket (TcpHeader::SYN | TcpHeader::ACK); |
| 943 |
} |
| 943 |
|
944 |
|
| 944 |
// Look up the source address |
|
|
| 945 |
if (ipv4->GetRoutingProtocol () != 0) |
| 946 |
{ |
| 947 |
Ipv4Header header; |
| 948 |
Socket::SocketErrno errno_; |
| 949 |
Ptr<Ipv4Route> route; |
| 950 |
Ptr<NetDevice> oif = m_boundnetdevice; //specify non-zero if bound to a source address |
| 951 |
header.SetDestination (m_remoteAddress); |
| 952 |
route = ipv4->GetRoutingProtocol ()->RouteOutput (Ptr<Packet> (), header, oif, errno_); |
| 953 |
if (route != 0) |
| 954 |
{ |
| 955 |
NS_LOG_LOGIC ("Route exists"); |
| 956 |
m_endPoint->SetLocalAddress (route->GetSource ()); |
| 957 |
} |
| 958 |
else |
| 959 |
{ |
| 960 |
NS_LOG_ERROR (errno_); |
| 961 |
m_errno = errno_; |
| 962 |
return -1; |
| 963 |
} |
| 964 |
} |
| 965 |
else |
| 966 |
{ |
| 967 |
NS_FATAL_ERROR ("No Ipv4RoutingProtocol in the node"); |
| 968 |
} |
| 969 |
// TCP SYN consumes one byte |
| 970 |
m_nextRxSequence = tcpHeader.GetSequenceNumber() + SequenceNumber(1); |
| 971 |
SendEmptyPacket (TcpHeader::SYN | TcpHeader::ACK); |
| 972 |
break; |
945 |
break; |
| 973 |
case ACK_TX_1: |
946 |
case ACK_TX_1: |
| 974 |
NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action ACK_TX_1"); |
947 |
NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action ACK_TX_1"); |
|
|
| 1001 |
NEW_SEQ_RX, |
974 |
NEW_SEQ_RX, |
| 1002 |
p, |
975 |
p, |
| 1003 |
tcpHeader, |
976 |
tcpHeader, |
| 1004 |
fromAddress); |
977 |
fromAddress, |
|
|
978 |
toAddress); |
| 1005 |
} |
979 |
} |
| 1006 |
if (tcpHeader.GetAckNumber () < m_highestRxAck) //old ack, do nothing |
980 |
if (tcpHeader.GetAckNumber () < m_highestRxAck) //old ack, do nothing |
| 1007 |
{ |
981 |
{ |
|
|
| 1025 |
break; |
999 |
break; |
| 1026 |
case NEW_SEQ_RX: |
1000 |
case NEW_SEQ_RX: |
| 1027 |
NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action NEW_SEQ_RX"); |
1001 |
NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action NEW_SEQ_RX"); |
| 1028 |
NewRx (p, tcpHeader, fromAddress); // Process new data received |
1002 |
NewRx (p, tcpHeader, fromAddress, toAddress); // Process new data received |
| 1029 |
break; |
1003 |
break; |
| 1030 |
case PEER_CLOSE: |
1004 |
case PEER_CLOSE: |
| 1031 |
{ |
1005 |
{ |
|
|
| 1039 |
NS_LOG_LOGIC ("TcpSocketImpl " << this << " setting pendingClose" |
1013 |
NS_LOG_LOGIC ("TcpSocketImpl " << this << " setting pendingClose" |
| 1040 |
<< " rxseq " << tcpHeader.GetSequenceNumber () |
1014 |
<< " rxseq " << tcpHeader.GetSequenceNumber () |
| 1041 |
<< " nextRxSeq " << m_nextRxSequence); |
1015 |
<< " nextRxSeq " << m_nextRxSequence); |
| 1042 |
NewRx (p, tcpHeader, fromAddress); |
1016 |
NewRx (p, tcpHeader, fromAddress, toAddress); |
| 1043 |
return true; |
1017 |
return true; |
| 1044 |
} |
1018 |
} |
| 1045 |
// Now we need to see if any data came with the FIN |
1019 |
// Now we need to see if any data came with the FIN |
| 1046 |
// if so, call NewRx |
1020 |
// if so, call NewRx |
| 1047 |
if (p->GetSize () != 0) |
1021 |
if (p->GetSize () != 0) |
| 1048 |
{ |
1022 |
{ |
| 1049 |
NewRx (p, tcpHeader, fromAddress); |
1023 |
NewRx (p, tcpHeader, fromAddress, toAddress); |
| 1050 |
} |
1024 |
} |
| 1051 |
++m_nextRxSequence; //bump this to account for the FIN |
1025 |
++m_nextRxSequence; //bump this to account for the FIN |
| 1052 |
States_t saveState = m_state; // Used to see if app responds |
1026 |
States_t saveState = m_state; // Used to see if app responds |
|
|
| 1078 |
NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action SERV_NOTIFY"); |
1052 |
NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action SERV_NOTIFY"); |
| 1079 |
NS_LOG_LOGIC ("TcpSocketImpl " << this << " Connected!"); |
1053 |
NS_LOG_LOGIC ("TcpSocketImpl " << this << " Connected!"); |
| 1080 |
m_connected = true; // ! This is bogus; fix when we clone the tcp |
1054 |
m_connected = true; // ! This is bogus; fix when we clone the tcp |
| 1081 |
m_endPoint->SetPeer (m_remoteAddress, m_remotePort); |
1055 |
m_endPoint->SetPeer (m_endPoint->GetPeerAddress(), m_endPoint->GetPeerPort()); |
| 1082 |
//treat the connection orientation final ack as a newack |
1056 |
//treat the connection orientation final ack as a newack |
| 1083 |
CommonNewAck (tcpHeader.GetAckNumber (), true); |
1057 |
CommonNewAck (tcpHeader.GetAckNumber (), true); |
| 1084 |
NotifyNewConnectionCreated (this, fromAddress); |
1058 |
NotifyNewConnectionCreated (this, fromAddress); |
|
|
| 1089 |
return true; |
1063 |
return true; |
| 1090 |
} |
1064 |
} |
| 1091 |
|
1065 |
|
| 1092 |
void TcpSocketImpl::CompleteFork(Ptr<Packet> p, const TcpHeader& h, const Address& fromAddress) |
1066 |
void TcpSocketImpl::CompleteFork(Ptr<Packet> p, const TcpHeader& h, const Address& fromAddress, const Address& toAddress) |
| 1093 |
{ |
1067 |
{ |
| 1094 |
// Get port and address from peer (connecting host) |
1068 |
// Get port and address from peer (connecting host) |
| 1095 |
m_remotePort = InetSocketAddress::ConvertFrom (fromAddress).GetPort (); |
1069 |
m_endPoint = m_tcp->Allocate (InetSocketAddress::ConvertFrom(toAddress).GetIpv4 (), |
| 1096 |
m_remoteAddress = InetSocketAddress::ConvertFrom (fromAddress).GetIpv4 (); |
1070 |
InetSocketAddress::ConvertFrom(toAddress).GetPort (), |
| 1097 |
m_endPoint = m_tcp->Allocate (m_localAddress, |
1071 |
InetSocketAddress::ConvertFrom (fromAddress).GetIpv4 (), |
| 1098 |
m_localPort, |
1072 |
InetSocketAddress::ConvertFrom (fromAddress).GetPort ()); |
| 1099 |
m_remoteAddress, |
|
|
| 1100 |
m_remotePort); |
| 1101 |
//the cloned socket with be in listen state, so manually change state |
1073 |
//the cloned socket with be in listen state, so manually change state |
| 1102 |
m_state = SYN_RCVD; |
1074 |
m_state = SYN_RCVD; |
| 1103 |
//equivalent to FinishBind |
1075 |
//equivalent to FinishBind |
| 1104 |
m_endPoint->SetRxCallback (MakeCallback (&TcpSocketImpl::ForwardUp, Ptr<TcpSocketImpl>(this))); |
1076 |
m_endPoint->SetRxCallback (MakeCallback (&TcpSocketImpl::ForwardUp, Ptr<TcpSocketImpl>(this))); |
| 1105 |
m_endPoint->SetDestroyCallback (MakeCallback (&TcpSocketImpl::Destroy, Ptr<TcpSocketImpl>(this))); |
1077 |
m_endPoint->SetDestroyCallback (MakeCallback (&TcpSocketImpl::Destroy, Ptr<TcpSocketImpl>(this))); |
| 1106 |
ProcessPacketAction(SYN_ACK_TX, p, h, fromAddress); |
1078 |
ProcessPacketAction(SYN_ACK_TX, p, h, fromAddress, toAddress); |
| 1107 |
} |
1079 |
} |
| 1108 |
|
1080 |
|
| 1109 |
void TcpSocketImpl::ConnectionSucceeded() |
1081 |
void TcpSocketImpl::ConnectionSucceeded() |
|
|
| 1165 |
header.SetSequenceNumber (m_nextTxSequence); |
1137 |
header.SetSequenceNumber (m_nextTxSequence); |
| 1166 |
header.SetAckNumber (m_nextRxSequence); |
1138 |
header.SetAckNumber (m_nextRxSequence); |
| 1167 |
header.SetSourcePort (m_endPoint->GetLocalPort()); |
1139 |
header.SetSourcePort (m_endPoint->GetLocalPort()); |
| 1168 |
header.SetDestinationPort (m_remotePort); |
1140 |
header.SetDestinationPort (m_endPoint->GetPeerPort()); |
| 1169 |
header.SetWindowSize (AdvertisedWindowSize()); |
1141 |
header.SetWindowSize (AdvertisedWindowSize()); |
| 1170 |
if (m_shutdownSend) |
1142 |
if (m_shutdownSend) |
| 1171 |
{ |
1143 |
{ |
|
|
| 1185 |
NS_LOG_LOGIC ("About to send a packet with flags: " << flags); |
1157 |
NS_LOG_LOGIC ("About to send a packet with flags: " << flags); |
| 1186 |
m_tcp->SendPacket (p, header, |
1158 |
m_tcp->SendPacket (p, header, |
| 1187 |
m_endPoint->GetLocalAddress (), |
1159 |
m_endPoint->GetLocalAddress (), |
| 1188 |
m_remoteAddress, m_boundnetdevice); |
1160 |
m_endPoint->GetPeerAddress (), |
|
|
1161 |
m_boundnetdevice); |
| 1189 |
m_rtt->SentSeq(m_nextTxSequence, sz); // notify the RTT |
1162 |
m_rtt->SentSeq(m_nextTxSequence, sz); // notify the RTT |
| 1190 |
// Notify the application of the data being sent |
1163 |
// Notify the application of the data being sent |
| 1191 |
Simulator::ScheduleNow(&TcpSocketImpl::NotifyDataSent, this, sz); |
1164 |
Simulator::ScheduleNow(&TcpSocketImpl::NotifyDataSent, this, sz); |
|
|
| 1243 |
|
1216 |
|
| 1244 |
void TcpSocketImpl::NewRx (Ptr<Packet> p, |
1217 |
void TcpSocketImpl::NewRx (Ptr<Packet> p, |
| 1245 |
const TcpHeader& tcpHeader, |
1218 |
const TcpHeader& tcpHeader, |
| 1246 |
const Address& fromAddress) |
1219 |
const Address& fromAddress, |
|
|
1220 |
const Address& toAddress) |
| 1247 |
{ |
1221 |
{ |
| 1248 |
NS_LOG_FUNCTION (this << p << "tcpHeader " << fromAddress); |
1222 |
NS_LOG_FUNCTION (this << p << "tcpHeader " << fromAddress); |
| 1249 |
NS_LOG_LOGIC ("TcpSocketImpl " << this << " NewRx," |
1223 |
NS_LOG_LOGIC ("TcpSocketImpl " << this << " NewRx," |
|
|
| 1310 |
{ // See if we can close now |
1284 |
{ // See if we can close now |
| 1311 |
if (m_bufferedData.empty()) |
1285 |
if (m_bufferedData.empty()) |
| 1312 |
{ |
1286 |
{ |
| 1313 |
ProcessPacketAction (PEER_CLOSE, p, tcpHeader, fromAddress); |
1287 |
ProcessPacketAction (PEER_CLOSE, p, tcpHeader, fromAddress, toAddress); |
| 1314 |
} |
1288 |
} |
| 1315 |
} |
1289 |
} |
| 1316 |
} |
1290 |
} |
|
|
| 1627 |
tcpHeader.SetSequenceNumber (m_nextTxSequence); |
1601 |
tcpHeader.SetSequenceNumber (m_nextTxSequence); |
| 1628 |
tcpHeader.SetAckNumber (m_nextRxSequence); |
1602 |
tcpHeader.SetAckNumber (m_nextRxSequence); |
| 1629 |
tcpHeader.SetSourcePort (m_endPoint->GetLocalPort()); |
1603 |
tcpHeader.SetSourcePort (m_endPoint->GetLocalPort()); |
| 1630 |
tcpHeader.SetDestinationPort (m_remotePort); |
1604 |
tcpHeader.SetDestinationPort (m_endPoint->GetPeerPort ()); |
| 1631 |
tcpHeader.SetWindowSize (AdvertisedWindowSize()); |
1605 |
tcpHeader.SetWindowSize (AdvertisedWindowSize()); |
| 1632 |
|
1606 |
|
| 1633 |
m_tcp->SendPacket (p, tcpHeader, m_endPoint->GetLocalAddress (), |
1607 |
m_tcp->SendPacket (p, tcpHeader, m_endPoint->GetLocalAddress (), |
| 1634 |
m_remoteAddress, m_boundnetdevice); |
1608 |
m_endPoint->GetPeerAddress (), m_boundnetdevice); |
| 1635 |
NS_LOG_LOGIC ("Schedule persist timeout at time " |
1609 |
NS_LOG_LOGIC ("Schedule persist timeout at time " |
| 1636 |
<<Simulator::Now ().GetSeconds () << " to expire at time " |
1610 |
<<Simulator::Now ().GetSeconds () << " to expire at time " |
| 1637 |
<< (Simulator::Now () + m_persistTime).GetSeconds()); |
1611 |
<< (Simulator::Now () + m_persistTime).GetSeconds()); |
|
|
| 1692 |
tcpHeader.SetSequenceNumber (m_nextTxSequence); |
1666 |
tcpHeader.SetSequenceNumber (m_nextTxSequence); |
| 1693 |
tcpHeader.SetAckNumber (m_nextRxSequence); |
1667 |
tcpHeader.SetAckNumber (m_nextRxSequence); |
| 1694 |
tcpHeader.SetSourcePort (m_endPoint->GetLocalPort()); |
1668 |
tcpHeader.SetSourcePort (m_endPoint->GetLocalPort()); |
| 1695 |
tcpHeader.SetDestinationPort (m_remotePort); |
1669 |
tcpHeader.SetDestinationPort (m_endPoint->GetPeerPort ()); |
| 1696 |
tcpHeader.SetFlags (flags); |
1670 |
tcpHeader.SetFlags (flags); |
| 1697 |
tcpHeader.SetWindowSize (AdvertisedWindowSize()); |
1671 |
tcpHeader.SetWindowSize (AdvertisedWindowSize()); |
| 1698 |
|
1672 |
|
| 1699 |
m_tcp->SendPacket (p, tcpHeader, m_endPoint->GetLocalAddress (), |
1673 |
m_tcp->SendPacket (p, tcpHeader, m_endPoint->GetLocalAddress (), |
| 1700 |
m_remoteAddress, m_boundnetdevice); |
1674 |
m_endPoint->GetPeerAddress (), m_boundnetdevice); |
| 1701 |
} |
1675 |
} |
| 1702 |
|
1676 |
|
| 1703 |
void |
1677 |
void |