equal
deleted
inserted
replaced
429 { |
429 { |
430 NS_LOG_FUNCTION (this << endPoint); |
430 NS_LOG_FUNCTION (this << endPoint); |
431 m_endPoints->DeAllocate (endPoint); |
431 m_endPoints->DeAllocate (endPoint); |
432 } |
432 } |
433 |
433 |
434 void |
434 enum Ipv4L4Protocol::RxStatus |
435 TcpL4Protocol::Receive (Ptr<Packet> packet, |
435 TcpL4Protocol::Receive (Ptr<Packet> packet, |
436 Ipv4Address const &source, |
436 Ipv4Address const &source, |
437 Ipv4Address const &destination, |
437 Ipv4Address const &destination, |
438 Ptr<Ipv4Interface> incomingInterface) |
438 Ptr<Ipv4Interface> incomingInterface) |
439 { |
439 { |
455 << " data size " << packet->GetSize()); |
455 << " data size " << packet->GetSize()); |
456 |
456 |
457 if(!tcpHeader.IsChecksumOk ()) |
457 if(!tcpHeader.IsChecksumOk ()) |
458 { |
458 { |
459 NS_LOG_INFO("Bad checksum, dropping packet!"); |
459 NS_LOG_INFO("Bad checksum, dropping packet!"); |
460 return; |
460 return Ipv4L4Protocol::RX_CSUM_FAILED; |
461 } |
461 } |
462 |
462 |
463 NS_LOG_LOGIC ("TcpL4Protocol "<<this<<" received a packet"); |
463 NS_LOG_LOGIC ("TcpL4Protocol "<<this<<" received a packet"); |
464 Ipv4EndPointDemux::EndPoints endPoints = |
464 Ipv4EndPointDemux::EndPoints endPoints = |
465 m_endPoints->Lookup (destination, tcpHeader.GetDestinationPort (), |
465 m_endPoints->Lookup (destination, tcpHeader.GetDestinationPort (), |
472 destination.Print (oss); |
472 destination.Print (oss); |
473 oss<<" destination port: "<< tcpHeader.GetDestinationPort ()<<" source IP: "; |
473 oss<<" destination port: "<< tcpHeader.GetDestinationPort ()<<" source IP: "; |
474 source.Print (oss); |
474 source.Print (oss); |
475 oss<<" source port: "<<tcpHeader.GetSourcePort (); |
475 oss<<" source port: "<<tcpHeader.GetSourcePort (); |
476 NS_LOG_LOGIC (oss.str ()); |
476 NS_LOG_LOGIC (oss.str ()); |
477 return; |
477 return Ipv4L4Protocol::RX_ENDPOINT_UNREACH; |
478 } |
478 } |
479 NS_ASSERT_MSG (endPoints.size() == 1 , "Demux returned more than one endpoint"); |
479 NS_ASSERT_MSG (endPoints.size() == 1 , "Demux returned more than one endpoint"); |
480 NS_LOG_LOGIC ("TcpL4Protocol "<<this<<" forwarding up to endpoint/socket"); |
480 NS_LOG_LOGIC ("TcpL4Protocol "<<this<<" forwarding up to endpoint/socket"); |
481 (*endPoints.begin ())->ForwardUp (packet, source, tcpHeader.GetSourcePort ()); |
481 (*endPoints.begin ())->ForwardUp (packet, source, tcpHeader.GetSourcePort ()); |
|
482 return Ipv4L4Protocol::RX_OK; |
482 } |
483 } |
483 |
484 |
484 void |
485 void |
485 TcpL4Protocol::Send (Ptr<Packet> packet, |
486 TcpL4Protocol::Send (Ptr<Packet> packet, |
486 Ipv4Address saddr, Ipv4Address daddr, |
487 Ipv4Address saddr, Ipv4Address daddr, |