Lines 269-275
TcpSocketBase::Bind6 (void)
|
Link Here
|
---|
|
269 |
{ |
269 |
{ |
270 |
m_errno = ERROR_ADDRNOTAVAIL; |
270 |
m_errno = ERROR_ADDRNOTAVAIL; |
271 |
return -1; |
271 |
return -1; |
272 |
} |
272 |
} |
273 |
m_tcp->m_sockets.push_back (this); |
273 |
m_tcp->m_sockets.push_back (this); |
274 |
return SetupCallback (); |
274 |
return SetupCallback (); |
275 |
} |
275 |
} |
Lines 281-310
TcpSocketBase::Bind (const Address &address)
|
Link Here
|
---|
|
281 |
NS_LOG_FUNCTION (this << address); |
281 |
NS_LOG_FUNCTION (this << address); |
282 |
if (InetSocketAddress::IsMatchingType (address)) |
282 |
if (InetSocketAddress::IsMatchingType (address)) |
283 |
{ |
283 |
{ |
284 |
InetSocketAddress transport = InetSocketAddress::ConvertFrom (address); |
284 |
InetSocketAddress transport = InetSocketAddress::ConvertFrom (address); |
285 |
Ipv4Address ipv4 = transport.GetIpv4 (); |
285 |
Ipv4Address ipv4 = transport.GetIpv4 (); |
286 |
uint16_t port = transport.GetPort (); |
286 |
uint16_t port = transport.GetPort (); |
287 |
if (ipv4 == Ipv4Address::GetAny () && port == 0) |
287 |
if (ipv4 == Ipv4Address::GetAny () && port == 0) |
288 |
{ |
288 |
{ |
289 |
m_endPoint = m_tcp->Allocate (); |
289 |
m_endPoint = m_tcp->Allocate (); |
290 |
} |
290 |
} |
291 |
else if (ipv4 == Ipv4Address::GetAny () && port != 0) |
291 |
else if (ipv4 == Ipv4Address::GetAny () && port != 0) |
292 |
{ |
292 |
{ |
293 |
m_endPoint = m_tcp->Allocate (port); |
293 |
m_endPoint = m_tcp->Allocate (port); |
294 |
} |
294 |
} |
295 |
else if (ipv4 != Ipv4Address::GetAny () && port == 0) |
295 |
else if (ipv4 != Ipv4Address::GetAny () && port == 0) |
296 |
{ |
296 |
{ |
297 |
m_endPoint = m_tcp->Allocate (ipv4); |
297 |
m_endPoint = m_tcp->Allocate (ipv4); |
298 |
} |
298 |
} |
299 |
else if (ipv4 != Ipv4Address::GetAny () && port != 0) |
299 |
else if (ipv4 != Ipv4Address::GetAny () && port != 0) |
300 |
{ |
300 |
{ |
301 |
m_endPoint = m_tcp->Allocate (ipv4, port); |
301 |
m_endPoint = m_tcp->Allocate (ipv4, port); |
302 |
} |
302 |
} |
303 |
if (0 == m_endPoint) |
303 |
if (0 == m_endPoint) |
304 |
{ |
304 |
{ |
305 |
m_errno = port ? ERROR_ADDRINUSE : ERROR_ADDRNOTAVAIL; |
305 |
m_errno = port ? ERROR_ADDRINUSE : ERROR_ADDRNOTAVAIL; |
306 |
return -1; |
306 |
return -1; |
307 |
} |
307 |
} |
308 |
} |
308 |
} |
309 |
else if (Inet6SocketAddress::IsMatchingType (address)) |
309 |
else if (Inet6SocketAddress::IsMatchingType (address)) |
310 |
{ |
310 |
{ |
Lines 353-376
TcpSocketBase::Connect (const Address & address)
|
Link Here
|
---|
|
353 |
// If haven't do so, Bind() this socket first |
353 |
// If haven't do so, Bind() this socket first |
354 |
if (InetSocketAddress::IsMatchingType (address) && m_endPoint6 == 0) |
354 |
if (InetSocketAddress::IsMatchingType (address) && m_endPoint6 == 0) |
355 |
{ |
355 |
{ |
356 |
if (m_endPoint == 0) |
356 |
if (m_endPoint == 0) |
|
|
357 |
{ |
358 |
if (Bind () == -1) |
357 |
{ |
359 |
{ |
358 |
if (Bind () == -1) |
360 |
NS_ASSERT (m_endPoint == 0); |
359 |
{ |
361 |
return -1; // Bind() failed |
360 |
NS_ASSERT (m_endPoint == 0); |
|
|
361 |
return -1; // Bind() failed |
362 |
} |
363 |
NS_ASSERT (m_endPoint != 0); |
364 |
} |
362 |
} |
365 |
InetSocketAddress transport = InetSocketAddress::ConvertFrom (address); |
363 |
NS_ASSERT (m_endPoint != 0); |
366 |
m_endPoint->SetPeer (transport.GetIpv4 (), transport.GetPort ()); |
364 |
} |
|
|
365 |
InetSocketAddress transport = InetSocketAddress::ConvertFrom (address); |
366 |
m_endPoint->SetPeer (transport.GetIpv4 (), transport.GetPort ()); |
367 |
m_endPoint6 = 0; |
367 |
m_endPoint6 = 0; |
368 |
|
368 |
|
369 |
// Get the appropriate local address and port number from the routing protocol and set up endpoint |
369 |
// Get the appropriate local address and port number from the routing protocol and set up endpoint |
370 |
if (SetupEndpoint () != 0) |
370 |
if (SetupEndpoint () != 0) |
371 |
{ // Route to destination does not exist |
371 |
{ // Route to destination does not exist |
372 |
return -1; |
372 |
return -1; |
373 |
} |
373 |
} |
374 |
} |
374 |
} |
375 |
else if (Inet6SocketAddress::IsMatchingType (address) && m_endPoint == 0) |
375 |
else if (Inet6SocketAddress::IsMatchingType (address) && m_endPoint == 0) |
376 |
{ |
376 |
{ |
Lines 381-387
TcpSocketBase::Connect (const Address & address)
|
Link Here
|
---|
|
381 |
if (v6Addr.IsIpv4MappedAddress () == true) |
381 |
if (v6Addr.IsIpv4MappedAddress () == true) |
382 |
{ |
382 |
{ |
383 |
Ipv4Address v4Addr = v6Addr.GetIpv4MappedAddress (); |
383 |
Ipv4Address v4Addr = v6Addr.GetIpv4MappedAddress (); |
384 |
return Connect (InetSocketAddress (v4Addr, transport.GetPort ())); |
384 |
return Connect(InetSocketAddress(v4Addr, transport.GetPort ())); |
385 |
} |
385 |
} |
386 |
|
386 |
|
387 |
if (m_endPoint6 == 0) |
387 |
if (m_endPoint6 == 0) |
Lines 526-540
TcpSocketBase::Recv (uint32_t maxSize, uint32_t flags)
|
Link Here
|
---|
|
526 |
Ptr<Packet> outPacket = m_rxBuffer.Extract (maxSize); |
526 |
Ptr<Packet> outPacket = m_rxBuffer.Extract (maxSize); |
527 |
if (outPacket != 0 && outPacket->GetSize () != 0) |
527 |
if (outPacket != 0 && outPacket->GetSize () != 0) |
528 |
{ |
528 |
{ |
529 |
SocketAddressTag tag; |
529 |
Ptr<SocketAddressTag> tag = CreateObject<SocketAddressTag> (); |
530 |
if (m_endPoint != 0) |
530 |
if (m_endPoint != 0) |
531 |
{ |
531 |
{ |
532 |
tag.SetAddress (InetSocketAddress (m_endPoint->GetPeerAddress (), m_endPoint->GetPeerPort ())); |
532 |
tag->SetAddress (InetSocketAddress (m_endPoint->GetPeerAddress (), m_endPoint->GetPeerPort ())); |
533 |
} |
533 |
} |
534 |
else if (m_endPoint6 != 0) |
534 |
else if (m_endPoint6 != 0) |
535 |
{ |
535 |
{ |
536 |
tag.SetAddress (Inet6SocketAddress (m_endPoint6->GetPeerAddress (), m_endPoint6->GetPeerPort ())); |
536 |
tag->SetAddress (Inet6SocketAddress (m_endPoint6->GetPeerAddress (), m_endPoint6->GetPeerPort ())); |
537 |
} |
537 |
} |
|
|
538 |
|
538 |
outPacket->AddPacketTag (tag); |
539 |
outPacket->AddPacketTag (tag); |
539 |
} |
540 |
} |
540 |
return outPacket; |
541 |
return outPacket; |
Lines 621-627
TcpSocketBase::BindToNetDevice (Ptr<NetDevice> netdevice)
|
Link Here
|
---|
|
621 |
|
622 |
|
622 |
if (m_endPoint != 0) |
623 |
if (m_endPoint != 0) |
623 |
{ |
624 |
{ |
624 |
m_endPoint->BindToNetDevice (netdevice); |
625 |
m_endPoint->BindToNetDevice (netdevice); |
625 |
} |
626 |
} |
626 |
// No BindToNetDevice() for Ipv6EndPoint |
627 |
// No BindToNetDevice() for Ipv6EndPoint |
627 |
return; |
628 |
return; |
Lines 639-646
TcpSocketBase::SetupCallback (void)
|
Link Here
|
---|
|
639 |
} |
640 |
} |
640 |
if (m_endPoint != 0) |
641 |
if (m_endPoint != 0) |
641 |
{ |
642 |
{ |
642 |
m_endPoint->SetRxCallback (MakeCallback (&TcpSocketBase::ForwardUp, Ptr<TcpSocketBase> (this))); |
643 |
m_endPoint->SetRxCallback (MakeCallback (&TcpSocketBase::ForwardUp, Ptr<TcpSocketBase> (this))); |
643 |
m_endPoint->SetDestroyCallback (MakeCallback (&TcpSocketBase::Destroy, Ptr<TcpSocketBase> (this))); |
644 |
m_endPoint->SetDestroyCallback (MakeCallback (&TcpSocketBase::Destroy, Ptr<TcpSocketBase> (this))); |
644 |
} |
645 |
} |
645 |
if (m_endPoint6 != 0) |
646 |
if (m_endPoint6 != 0) |
646 |
{ |
647 |
{ |
Lines 791-797
TcpSocketBase::DoForwardUp (Ptr<Packet> packet, Ipv4Header header, uint16_t port
|
Link Here
|
---|
|
791 |
TcpHeader tcpHeader; |
792 |
TcpHeader tcpHeader; |
792 |
packet->RemoveHeader (tcpHeader); |
793 |
packet->RemoveHeader (tcpHeader); |
793 |
if (tcpHeader.GetFlags () & TcpHeader::ACK) |
794 |
if (tcpHeader.GetFlags () & TcpHeader::ACK) |
794 |
{ |
795 |
{ |
795 |
EstimateRtt (tcpHeader); |
796 |
EstimateRtt (tcpHeader); |
796 |
} |
797 |
} |
797 |
ReadOptions (tcpHeader); |
798 |
ReadOptions (tcpHeader); |
Lines 810-816
TcpSocketBase::DoForwardUp (Ptr<Packet> packet, Ipv4Header header, uint16_t port
|
Link Here
|
---|
|
810 |
{ |
811 |
{ |
811 |
NS_LOG_LOGIC ("At state " << TcpStateName[m_state] << |
812 |
NS_LOG_LOGIC ("At state " << TcpStateName[m_state] << |
812 |
" received packet of seq [" << tcpHeader.GetSequenceNumber () << |
813 |
" received packet of seq [" << tcpHeader.GetSequenceNumber () << |
813 |
":" << tcpHeader.GetSequenceNumber () + packet->GetSize () << |
814 |
":" << tcpHeader.GetSequenceNumber () + packet->GetSize() << |
814 |
") out of range [" << m_rxBuffer.NextRxSequence () << ":" << |
815 |
") out of range [" << m_rxBuffer.NextRxSequence () << ":" << |
815 |
m_rxBuffer.MaxRxSequence () << ")"); |
816 |
m_rxBuffer.MaxRxSequence () << ")"); |
816 |
// Acknowledgement should be sent for all unacceptable packets (RFC793, p.69) |
817 |
// Acknowledgement should be sent for all unacceptable packets (RFC793, p.69) |
Lines 905-911
TcpSocketBase::DoForwardUp (Ptr<Packet> packet, Ipv6Address saddr, Ipv6Address d
|
Link Here
|
---|
|
905 |
{ |
906 |
{ |
906 |
NS_LOG_LOGIC ("At state " << TcpStateName[m_state] << |
907 |
NS_LOG_LOGIC ("At state " << TcpStateName[m_state] << |
907 |
" received packet of seq [" << tcpHeader.GetSequenceNumber () << |
908 |
" received packet of seq [" << tcpHeader.GetSequenceNumber () << |
908 |
":" << tcpHeader.GetSequenceNumber () + packet->GetSize () << |
909 |
":" << tcpHeader.GetSequenceNumber () + packet->GetSize() << |
909 |
") out of range [" << m_rxBuffer.NextRxSequence () << ":" << |
910 |
") out of range [" << m_rxBuffer.NextRxSequence () << ":" << |
910 |
m_rxBuffer.MaxRxSequence () << ")"); |
911 |
m_rxBuffer.MaxRxSequence () << ")"); |
911 |
// Acknowledgement should be sent for all unacceptable packets (RFC793, p.69) |
912 |
// Acknowledgement should be sent for all unacceptable packets (RFC793, p.69) |
Lines 1130-1136
TcpSocketBase::ProcessSynSent (Ptr<Packet> packet, const TcpHeader& tcpHeader)
|
Link Here
|
---|
|
1130 |
{ // Other in-sequence input |
1131 |
{ // Other in-sequence input |
1131 |
if (tcpflags != TcpHeader::RST) |
1132 |
if (tcpflags != TcpHeader::RST) |
1132 |
{ // When (1) rx of FIN+ACK; (2) rx of FIN; (3) rx of bad flags |
1133 |
{ // When (1) rx of FIN+ACK; (2) rx of FIN; (3) rx of bad flags |
1133 |
NS_LOG_LOGIC ("Illegal flag " << std::hex << static_cast<uint32_t> (tcpflags) << std::dec << " received. Reset packet is sent."); |
1134 |
NS_LOG_LOGIC ("Illegal flag " << std::hex << static_cast<uint32_t>(tcpflags) << std::dec << " received. Reset packet is sent."); |
1134 |
SendRST (); |
1135 |
SendRST (); |
1135 |
} |
1136 |
} |
1136 |
CloseAndNotify (); |
1137 |
CloseAndNotify (); |
Lines 1149-1155
TcpSocketBase::ProcessSynRcvd (Ptr<Packet> packet, const TcpHeader& tcpHeader,
|
Link Here
|
---|
|
1149 |
|
1150 |
|
1150 |
if (tcpflags == 0 |
1151 |
if (tcpflags == 0 |
1151 |
|| (tcpflags == TcpHeader::ACK |
1152 |
|| (tcpflags == TcpHeader::ACK |
1152 |
&& m_nextTxSequence + SequenceNumber32 (1) == tcpHeader.GetAckNumber ())) |
1153 |
&& m_nextTxSequence + SequenceNumber32 (1) == tcpHeader.GetAckNumber ())) |
1153 |
{ // If it is bare data, accept it and move to ESTABLISHED state. This is |
1154 |
{ // If it is bare data, accept it and move to ESTABLISHED state. This is |
1154 |
// possibly due to ACK lost in 3WHS. If in-sequence ACK is received, the |
1155 |
// possibly due to ACK lost in 3WHS. If in-sequence ACK is received, the |
1155 |
// handshake is completed nicely. |
1156 |
// handshake is completed nicely. |
Lines 1161-1168
TcpSocketBase::ProcessSynRcvd (Ptr<Packet> packet, const TcpHeader& tcpHeader,
|
Link Here
|
---|
|
1161 |
m_txBuffer.SetHeadSequence (m_nextTxSequence); |
1162 |
m_txBuffer.SetHeadSequence (m_nextTxSequence); |
1162 |
if (m_endPoint) |
1163 |
if (m_endPoint) |
1163 |
{ |
1164 |
{ |
1164 |
m_endPoint->SetPeer (InetSocketAddress::ConvertFrom (fromAddress).GetIpv4 (), |
1165 |
m_endPoint->SetPeer (InetSocketAddress::ConvertFrom (fromAddress).GetIpv4 (), |
1165 |
InetSocketAddress::ConvertFrom (fromAddress).GetPort ()); |
1166 |
InetSocketAddress::ConvertFrom (fromAddress).GetPort ()); |
1166 |
} |
1167 |
} |
1167 |
else if (m_endPoint6) |
1168 |
else if (m_endPoint6) |
1168 |
{ |
1169 |
{ |
Lines 1195-1202
TcpSocketBase::ProcessSynRcvd (Ptr<Packet> packet, const TcpHeader& tcpHeader,
|
Link Here
|
---|
|
1195 |
m_txBuffer.SetHeadSequence (m_nextTxSequence); |
1196 |
m_txBuffer.SetHeadSequence (m_nextTxSequence); |
1196 |
if (m_endPoint) |
1197 |
if (m_endPoint) |
1197 |
{ |
1198 |
{ |
1198 |
m_endPoint->SetPeer (InetSocketAddress::ConvertFrom (fromAddress).GetIpv4 (), |
1199 |
m_endPoint->SetPeer (InetSocketAddress::ConvertFrom (fromAddress).GetIpv4 (), |
1199 |
InetSocketAddress::ConvertFrom (fromAddress).GetPort ()); |
1200 |
InetSocketAddress::ConvertFrom (fromAddress).GetPort ()); |
1200 |
} |
1201 |
} |
1201 |
else if (m_endPoint6) |
1202 |
else if (m_endPoint6) |
1202 |
{ |
1203 |
{ |
Lines 1213-1220
TcpSocketBase::ProcessSynRcvd (Ptr<Packet> packet, const TcpHeader& tcpHeader,
|
Link Here
|
---|
|
1213 |
NS_LOG_LOGIC ("Illegal flag " << tcpflags << " received. Reset packet is sent."); |
1214 |
NS_LOG_LOGIC ("Illegal flag " << tcpflags << " received. Reset packet is sent."); |
1214 |
if (m_endPoint) |
1215 |
if (m_endPoint) |
1215 |
{ |
1216 |
{ |
1216 |
m_endPoint->SetPeer (InetSocketAddress::ConvertFrom (fromAddress).GetIpv4 (), |
1217 |
m_endPoint->SetPeer (InetSocketAddress::ConvertFrom (fromAddress).GetIpv4 (), |
1217 |
InetSocketAddress::ConvertFrom (fromAddress).GetPort ()); |
1218 |
InetSocketAddress::ConvertFrom (fromAddress).GetPort ()); |
1218 |
} |
1219 |
} |
1219 |
else if (m_endPoint6) |
1220 |
else if (m_endPoint6) |
1220 |
{ |
1221 |
{ |
Lines 1294-1302
TcpSocketBase::ProcessWait (Ptr<Packet> packet, const TcpHeader& tcpHeader)
|
Link Here
|
---|
|
1294 |
if (!m_shutdownRecv) |
1295 |
if (!m_shutdownRecv) |
1295 |
{ |
1296 |
{ |
1296 |
NotifyDataRecv (); |
1297 |
NotifyDataRecv (); |
1297 |
} |
|
|
1298 |
} |
1298 |
} |
1299 |
} |
1299 |
} |
|
|
1300 |
} |
1300 |
|
1301 |
|
1301 |
/** Received a packet upon CLOSING */ |
1302 |
/** Received a packet upon CLOSING */ |
1302 |
void |
1303 |
void |
Lines 1450-1461
TcpSocketBase::Destroy (void)
|
Link Here
|
---|
|
1450 |
m_endPoint = 0; |
1451 |
m_endPoint = 0; |
1451 |
if (m_tcp != 0) |
1452 |
if (m_tcp != 0) |
1452 |
{ |
1453 |
{ |
1453 |
std::vector<Ptr<TcpSocketBase> >::iterator it |
1454 |
std::vector<Ptr<TcpSocketBase> >::iterator it |
1454 |
= std::find (m_tcp->m_sockets.begin (), m_tcp->m_sockets.end (), this); |
1455 |
= std::find (m_tcp->m_sockets.begin (), m_tcp->m_sockets.end (), this); |
1455 |
if (it != m_tcp->m_sockets.end ()) |
1456 |
if (it != m_tcp->m_sockets.end ()) |
1456 |
{ |
1457 |
{ |
1457 |
m_tcp->m_sockets.erase (it); |
1458 |
m_tcp->m_sockets.erase (it); |
1458 |
} |
1459 |
} |
1459 |
} |
1460 |
} |
1460 |
NS_LOG_LOGIC (this << " Cancelled ReTxTimeout event which was set to expire at " << |
1461 |
NS_LOG_LOGIC (this << " Cancelled ReTxTimeout event which was set to expire at " << |
1461 |
(Simulator::Now () + Simulator::GetDelayLeft (m_retxEvent)).GetSeconds ()); |
1462 |
(Simulator::Now () + Simulator::GetDelayLeft (m_retxEvent)).GetSeconds ()); |
Lines 1511-1518
TcpSocketBase::SendEmptyPacket (uint8_t flags)
|
Link Here
|
---|
|
1511 |
header.SetAckNumber (m_rxBuffer.NextRxSequence ()); |
1512 |
header.SetAckNumber (m_rxBuffer.NextRxSequence ()); |
1512 |
if (m_endPoint != 0) |
1513 |
if (m_endPoint != 0) |
1513 |
{ |
1514 |
{ |
1514 |
header.SetSourcePort (m_endPoint->GetLocalPort ()); |
1515 |
header.SetSourcePort (m_endPoint->GetLocalPort ()); |
1515 |
header.SetDestinationPort (m_endPoint->GetPeerPort ()); |
1516 |
header.SetDestinationPort (m_endPoint->GetPeerPort ()); |
1516 |
} |
1517 |
} |
1517 |
else |
1518 |
else |
1518 |
{ |
1519 |
{ |
Lines 1601-1607
TcpSocketBase::DeallocateEndPoint (void)
|
Link Here
|
---|
|
1601 |
if (it != m_tcp->m_sockets.end ()) |
1602 |
if (it != m_tcp->m_sockets.end ()) |
1602 |
{ |
1603 |
{ |
1603 |
m_tcp->m_sockets.erase (it); |
1604 |
m_tcp->m_sockets.erase (it); |
1604 |
} |
1605 |
} |
1605 |
CancelAllTimers (); |
1606 |
CancelAllTimers (); |
1606 |
} |
1607 |
} |
1607 |
} |
1608 |
} |
Lines 1677-1686
TcpSocketBase::CompleteFork (Ptr<Packet> p, const TcpHeader& h,
|
Link Here
|
---|
|
1677 |
// Get port and address from peer (connecting host) |
1678 |
// Get port and address from peer (connecting host) |
1678 |
if (InetSocketAddress::IsMatchingType (toAddress)) |
1679 |
if (InetSocketAddress::IsMatchingType (toAddress)) |
1679 |
{ |
1680 |
{ |
1680 |
m_endPoint = m_tcp->Allocate (InetSocketAddress::ConvertFrom (toAddress).GetIpv4 (), |
1681 |
m_endPoint = m_tcp->Allocate (InetSocketAddress::ConvertFrom (toAddress).GetIpv4 (), |
1681 |
InetSocketAddress::ConvertFrom (toAddress).GetPort (), |
1682 |
InetSocketAddress::ConvertFrom (toAddress).GetPort (), |
1682 |
InetSocketAddress::ConvertFrom (fromAddress).GetIpv4 (), |
1683 |
InetSocketAddress::ConvertFrom (fromAddress).GetIpv4 (), |
1683 |
InetSocketAddress::ConvertFrom (fromAddress).GetPort ()); |
1684 |
InetSocketAddress::ConvertFrom (fromAddress).GetPort ()); |
1684 |
m_endPoint6 = 0; |
1685 |
m_endPoint6 = 0; |
1685 |
} |
1686 |
} |
1686 |
else if (Inet6SocketAddress::IsMatchingType (toAddress)) |
1687 |
else if (Inet6SocketAddress::IsMatchingType (toAddress)) |
Lines 1748-1755
TcpSocketBase::SendDataPacket (SequenceNumber32 seq, uint32_t maxSize, bool with
|
Link Here
|
---|
|
1748 |
header.SetAckNumber (m_rxBuffer.NextRxSequence ()); |
1749 |
header.SetAckNumber (m_rxBuffer.NextRxSequence ()); |
1749 |
if (m_endPoint) |
1750 |
if (m_endPoint) |
1750 |
{ |
1751 |
{ |
1751 |
header.SetSourcePort (m_endPoint->GetLocalPort ()); |
1752 |
header.SetSourcePort (m_endPoint->GetLocalPort ()); |
1752 |
header.SetDestinationPort (m_endPoint->GetPeerPort ()); |
1753 |
header.SetDestinationPort (m_endPoint->GetPeerPort ()); |
1753 |
} |
1754 |
} |
1754 |
else |
1755 |
else |
1755 |
{ |
1756 |
{ |
Lines 1769-1776
TcpSocketBase::SendDataPacket (SequenceNumber32 seq, uint32_t maxSize, bool with
|
Link Here
|
---|
|
1769 |
NS_LOG_LOGIC ("Send packet via TcpL4Protocol with flags 0x" << std::hex << static_cast<uint32_t> (flags) << std::dec); |
1770 |
NS_LOG_LOGIC ("Send packet via TcpL4Protocol with flags 0x" << std::hex << static_cast<uint32_t> (flags) << std::dec); |
1770 |
if (m_endPoint) |
1771 |
if (m_endPoint) |
1771 |
{ |
1772 |
{ |
1772 |
m_tcp->SendPacket (p, header, m_endPoint->GetLocalAddress (), |
1773 |
m_tcp->SendPacket (p, header, m_endPoint->GetLocalAddress (), |
1773 |
m_endPoint->GetPeerAddress (), m_boundnetdevice); |
1774 |
m_endPoint->GetPeerAddress (), m_boundnetdevice); |
1774 |
} |
1775 |
} |
1775 |
else |
1776 |
else |
1776 |
{ |
1777 |
{ |
Lines 2061-2068
TcpSocketBase::PersistTimeout ()
|
Link Here
|
---|
|
2061 |
tcpHeader.SetWindowSize (AdvertisedWindowSize ()); |
2062 |
tcpHeader.SetWindowSize (AdvertisedWindowSize ()); |
2062 |
if (m_endPoint != 0) |
2063 |
if (m_endPoint != 0) |
2063 |
{ |
2064 |
{ |
2064 |
tcpHeader.SetSourcePort (m_endPoint->GetLocalPort ()); |
2065 |
tcpHeader.SetSourcePort (m_endPoint->GetLocalPort ()); |
2065 |
tcpHeader.SetDestinationPort (m_endPoint->GetPeerPort ()); |
2066 |
tcpHeader.SetDestinationPort (m_endPoint->GetPeerPort ()); |
2066 |
} |
2067 |
} |
2067 |
else |
2068 |
else |
2068 |
{ |
2069 |
{ |
Lines 2073-2080
TcpSocketBase::PersistTimeout ()
|
Link Here
|
---|
|
2073 |
|
2074 |
|
2074 |
if (m_endPoint != 0) |
2075 |
if (m_endPoint != 0) |
2075 |
{ |
2076 |
{ |
2076 |
m_tcp->SendPacket (p, tcpHeader, m_endPoint->GetLocalAddress (), |
2077 |
m_tcp->SendPacket (p, tcpHeader, m_endPoint->GetLocalAddress (), |
2077 |
m_endPoint->GetPeerAddress (), m_boundnetdevice); |
2078 |
m_endPoint->GetPeerAddress (), m_boundnetdevice); |
2078 |
} |
2079 |
} |
2079 |
else |
2080 |
else |
2080 |
{ |
2081 |
{ |
Lines 2149-2155
TcpSocketBase::TimeWait ()
|
Link Here
|
---|
|
2149 |
CancelAllTimers (); |
2150 |
CancelAllTimers (); |
2150 |
// Move from TIME_WAIT to CLOSED after 2*MSL. Max segment lifetime is 2 min |
2151 |
// Move from TIME_WAIT to CLOSED after 2*MSL. Max segment lifetime is 2 min |
2151 |
// according to RFC793, p.28 |
2152 |
// according to RFC793, p.28 |
2152 |
m_timewaitEvent = Simulator::Schedule (Seconds (2 * m_msl), |
2153 |
m_timewaitEvent = Simulator::Schedule (Seconds (2*m_msl), |
2153 |
&TcpSocketBase::CloseAndNotify, this); |
2154 |
&TcpSocketBase::CloseAndNotify, this); |
2154 |
} |
2155 |
} |
2155 |
|
2156 |
|