Messages on TcpL4Protocol updated

This commit is contained in:
Natale Patriciello
2015-10-16 10:39:29 -07:00
parent c43ad360fd
commit e9bc4886c5

View File

@@ -57,7 +57,7 @@ NS_OBJECT_ENSURE_REGISTERED (TcpL4Protocol);
#undef NS_LOG_APPEND_CONTEXT
#define NS_LOG_APPEND_CONTEXT \
if (m_node) { std::clog << Simulator::Now ().GetSeconds () << " [node " << m_node->GetId () << "] "; }
if (m_node) { std::clog << " [node " << m_node->GetId () << "] "; }
/* see http://www.iana.org/assignments/protocol-numbers */
const uint8_t TcpL4Protocol::PROT_NUMBER = 6;
@@ -96,18 +96,20 @@ TcpL4Protocol::TcpL4Protocol ()
TcpL4Protocol::~TcpL4Protocol ()
{
NS_LOG_FUNCTION_NOARGS ();
NS_LOG_FUNCTION (this);
}
void
TcpL4Protocol::SetNode (Ptr<Node> node)
{
NS_LOG_FUNCTION (this);
m_node = node;
}
void
TcpL4Protocol::NotifyNewAggregate ()
{
NS_LOG_FUNCTION (this);
Ptr<Node> node = this->GetObject<Node> ();
Ptr<Ipv4> ipv4 = this->GetObject<Ipv4> ();
Ptr<Ipv6L3Protocol> ipv6 = node->GetObject<Ipv6L3Protocol> ();
@@ -150,7 +152,7 @@ TcpL4Protocol::GetProtocolNumber (void) const
void
TcpL4Protocol::DoDispose (void)
{
NS_LOG_FUNCTION_NOARGS ();
NS_LOG_FUNCTION (this);
m_sockets.clear ();
if (m_endPoints != 0)
@@ -174,7 +176,7 @@ TcpL4Protocol::DoDispose (void)
Ptr<Socket>
TcpL4Protocol::CreateSocket (TypeId socketTypeId)
{
NS_LOG_FUNCTION_NOARGS ();
NS_LOG_FUNCTION (this << socketTypeId);
ObjectFactory rttFactory;
ObjectFactory socketFactory;
rttFactory.SetTypeId (m_rttTypeId);
@@ -340,6 +342,7 @@ enum IpL4Protocol::RxStatus
TcpL4Protocol::PacketReceived (Ptr<Packet> packet, TcpHeader &incomingTcpHeader,
const Address &source, const Address &destination)
{
NS_LOG_FUNCTION (this << packet << incomingTcpHeader << source << destination);
if (Node::ChecksumEnabled ())
{
@@ -369,6 +372,8 @@ TcpL4Protocol::NoEndPointsFound (const TcpHeader &incomingHeader,
const Address &incomingSAddr,
const Address &incomingDAddr)
{
NS_LOG_FUNCTION (this << incomingHeader << incomingSAddr << incomingDAddr);
if (!(incomingHeader.GetFlags () & TcpHeader::RST))
{
// build a RST packet and send
@@ -418,8 +423,6 @@ TcpL4Protocol::Receive (Ptr<Packet> packet,
return checksumControl;
}
NS_LOG_LOGIC ("TcpL4Protocol " << this << " received a packet");
Ipv4EndPointDemux::EndPoints endPoints;
endPoints = m_endPoints->Lookup (incomingIpHeader.GetDestination (),
incomingTcpHeader.GetDestinationPort (),
@@ -443,7 +446,8 @@ TcpL4Protocol::Receive (Ptr<Packet> packet,
return (this->Receive (packet, ipv6Header, fakeInterface));
}
NS_LOG_LOGIC ("No endpoints matched on TcpL4Protocol "<< this <<
NS_LOG_LOGIC ("TcpL4Protocol " << this << " received a packet but"
" no endpoints matched." <<
" destination IP: " << incomingIpHeader.GetDestination () <<
" destination port: "<< incomingTcpHeader.GetDestinationPort () <<
" source IP: " << incomingIpHeader.GetSource () <<
@@ -457,7 +461,8 @@ TcpL4Protocol::Receive (Ptr<Packet> packet,
}
NS_ASSERT_MSG (endPoints.size () == 1, "Demux returned more than one endpoint");
NS_LOG_LOGIC ("TcpL4Protocol " << this << " forwarding up to endpoint/socket");
NS_LOG_LOGIC ("TcpL4Protocol " << this << " received a packet and"
" now forwarding it up to endpoint/socket");
(*endPoints.begin ())->ForwardUp (packet, incomingIpHeader,
incomingTcpHeader.GetSourcePort (),
@@ -490,7 +495,6 @@ TcpL4Protocol::Receive (Ptr<Packet> packet,
return checksumControl;
}
NS_LOG_LOGIC ("TcpL4Protocol " << this << " received a packet");
Ipv6EndPointDemux::EndPoints endPoints =
m_endPoints6->Lookup (incomingIpHeader.GetDestinationAddress (),
incomingTcpHeader.GetDestinationPort (),
@@ -498,7 +502,8 @@ TcpL4Protocol::Receive (Ptr<Packet> packet,
incomingTcpHeader.GetSourcePort (), interface);
if (endPoints.empty ())
{
NS_LOG_LOGIC ("No endpoints matched on TcpL4Protocol "<< this <<
NS_LOG_LOGIC ("TcpL4Protocol " << this << " received a packet but"
" no endpoints matched." <<
" destination IP: " << incomingIpHeader.GetDestinationAddress () <<
" destination port: "<< incomingTcpHeader.GetDestinationPort () <<
" source IP: " << incomingIpHeader.GetSourceAddress () <<
@@ -511,7 +516,8 @@ TcpL4Protocol::Receive (Ptr<Packet> packet,
}
NS_ASSERT_MSG (endPoints.size () == 1, "Demux returned more than one endpoint");
NS_LOG_LOGIC ("TcpL4Protocol " << this << " forwarding up to endpoint/socket");
NS_LOG_LOGIC ("TcpL4Protocol " << this << " received a packet and"
" now forwarding it up to endpoint/socket");
(*endPoints.begin ())->ForwardUp (packet, incomingIpHeader,
incomingTcpHeader.GetSourcePort (), interface);
@@ -524,12 +530,12 @@ TcpL4Protocol::SendPacketV4 (Ptr<Packet> packet, const TcpHeader &outgoing,
const Ipv4Address &saddr, const Ipv4Address &daddr,
Ptr<NetDevice> oif) const
{
NS_LOG_FUNCTION (this << packet << saddr << daddr << oif);
NS_LOG_LOGIC ("TcpL4Protocol " << this
<< " sending seq " << outgoing.GetSequenceNumber ()
<< " ack " << outgoing.GetAckNumber ()
<< " flags " << TcpHeader::FlagsToString (outgoing.GetFlags ())
<< " data size " << packet->GetSize ());
NS_LOG_FUNCTION (this << packet << saddr << daddr << oif);
// XXX outgoingHeader cannot be logged
TcpHeader outgoingHeader = outgoing;
@@ -575,12 +581,12 @@ TcpL4Protocol::SendPacketV6 (Ptr<Packet> packet, const TcpHeader &outgoing,
const Ipv6Address &saddr, const Ipv6Address &daddr,
Ptr<NetDevice> oif) const
{
NS_LOG_FUNCTION (this << packet << saddr << daddr << oif);
NS_LOG_LOGIC ("TcpL4Protocol " << this
<< " sending seq " << outgoing.GetSequenceNumber ()
<< " ack " << outgoing.GetAckNumber ()
<< " flags " << TcpHeader::FlagsToString (outgoing.GetFlags ())
<< " data size " << packet->GetSize ());
NS_LOG_FUNCTION (this << packet << saddr << daddr << oif);
// XXX outgoingHeader cannot be logged
if (daddr.IsIpv4MappedAddress ())
@@ -629,6 +635,7 @@ TcpL4Protocol::SendPacket (Ptr<Packet> pkt, const TcpHeader &outgoing,
const Address &saddr, const Address &daddr,
Ptr<NetDevice> oif) const
{
NS_LOG_FUNCTION (this << pkt << outgoing << saddr << daddr << oif);
if (Ipv4Address::IsMatchingType (saddr))
{
NS_ASSERT (Ipv4Address::IsMatchingType (daddr));
@@ -672,6 +679,7 @@ TcpL4Protocol::SendPacket (Ptr<Packet> pkt, const TcpHeader &outgoing,
void
TcpL4Protocol::AddSocket (Ptr<TcpSocketBase> socket)
{
NS_LOG_FUNCTION (this << socket);
std::vector<Ptr<TcpSocketBase> >::iterator it = m_sockets.begin ();
while (it != m_sockets.end ())
@@ -690,6 +698,7 @@ TcpL4Protocol::AddSocket (Ptr<TcpSocketBase> socket)
bool
TcpL4Protocol::RemoveSocket (Ptr<TcpSocketBase> socket)
{
NS_LOG_FUNCTION (this << socket);
std::vector<Ptr<TcpSocketBase> >::iterator it = m_sockets.begin ();
while (it != m_sockets.end ())