Skip to content
Snippets Groups Projects
Commit cb4c3a6c authored by patacongo's avatar patacongo
Browse files

Cosmetic renaming of variables

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3135 42af7a65-404d-4744-a932-0658087f49c3
parent c7ef0162
No related branches found
No related tags found
No related merge requests found
......@@ -127,10 +127,10 @@ struct uip_conn
uip_ipaddr_t ripaddr; /* The IP address of the remote host */
uint16_t lport; /* The local TCP port, in network byte order */
uint16_t rport; /* The remoteTCP port, in network byte order */
uint8_t rcv_nxt[4]; /* The sequence number that we expect to
uint8_t rcvseq[4]; /* The sequence number that we expect to
* receive next */
uint8_t snd_nxt[4]; /* The sequence number that was last sent by us */
uint16_t len; /* Length of the data that was previously sent */
uint8_t sndseq[4]; /* The sequence number that was last sent by us */
uint16_t unacked; /* Number bytes sent but not yet ACKed */
uint16_t mss; /* Current maximum segment size for the
* connection */
uint16_t initialmss; /* Initial maximum segment size for the
......
......@@ -243,7 +243,7 @@ static uint16_t send_interrupt(struct uip_driver_s *dev, void *pvconn,
/* Set the sequence number for this packet */
uip_tcpsetsequence(conn->snd_nxt, pstate->snd_sent + pstate->snd_isn);
uip_tcpsetsequence(conn->sndseq, pstate->snd_sent + pstate->snd_isn);
/* Then send that amount of data */
......@@ -415,7 +415,7 @@ ssize_t send(int sockfd, const void *buf, size_t len, int flags)
{
/* Get the initial sequence number that will be used */
state.snd_isn = uip_tcpgetsequence(conn->snd_nxt);
state.snd_isn = uip_tcpgetsequence(conn->sndseq);
/* Update the initial time for calculating timeouts */
......
......@@ -99,8 +99,8 @@ void uip_tcpappsend(struct uip_driver_s *dev, struct uip_conn *conn,
{
/* Handle the result based on the application response */
nllvdbg("result: %04x d_sndlen: %d conn->len: %d\n",
result, dev->d_sndlen, conn->len);
nllvdbg("result: %04x d_sndlen: %d conn->unacked: %d\n",
result, dev->d_sndlen, conn->unacked);
/* Check for connection aborted */
......@@ -118,11 +118,11 @@ void uip_tcpappsend(struct uip_driver_s *dev, struct uip_conn *conn,
else if ((result & UIP_CLOSE) != 0)
{
conn->tcpstateflags = UIP_FIN_WAIT_1;
conn->len = 1;
conn->nrtx = 0;
conn->unacked = 1;
conn->nrtx = 0;
nllvdbg("TCP state: UIP_FIN_WAIT_1\n");
dev->d_sndlen = 0;
dev->d_sndlen = 0;
uip_tcpsend(dev, conn, TCP_FIN | TCP_ACK, UIP_IPTCPH_LEN);
}
......@@ -134,20 +134,20 @@ void uip_tcpappsend(struct uip_driver_s *dev, struct uip_conn *conn,
if (dev->d_sndlen > 0)
{
/* If the connection has acknowledged data, the conn->len count
/* If the connection has acknowledged data, the conn->unacked count
* should be discarded.
*/
if ((result & UIP_ACKDATA) != 0)
{
conn->len = 0;
conn->unacked = 0;
}
/* Remember how much data we send out now so that we know
* when everything has been acknowledged. No attempt is made
* here to keep track of how much outstanding, un-acked data
* there is. That is handled in the TCP send() logic. Here
* need the conn->len to be the same as the size of the packet
* need the conn->unacked to be the same as the size of the packet
* to be sent.
*
* Just increment the amount of data sent. This will be needed
......@@ -155,7 +155,7 @@ void uip_tcpappsend(struct uip_driver_s *dev, struct uip_conn *conn,
* a re-tranmission. Retransmissions do not go through this path.
*/
conn->len += dev->d_sndlen;
conn->unacked += dev->d_sndlen;
/* The application cannot send more than what is allowed by the
* MSS (the minumum of the MSS and the available window).
......@@ -193,8 +193,8 @@ void uip_tcpappsend(struct uip_driver_s *dev, struct uip_conn *conn,
void uip_tcprexmit(struct uip_driver_s *dev, struct uip_conn *conn,
uint16_t result)
{
nllvdbg("result: %04x d_sndlen: %d conn->len: %d\n",
result, dev->d_sndlen, conn->len);
nllvdbg("result: %04x d_sndlen: %d conn->unacked: %d\n",
result, dev->d_sndlen, conn->unacked);
dev->d_appdata = dev->d_snddata;
......@@ -202,7 +202,7 @@ void uip_tcprexmit(struct uip_driver_s *dev, struct uip_conn *conn,
* new data in it, we must send out a packet.
*/
if (dev->d_sndlen > 0 && conn->len > 0)
if (dev->d_sndlen > 0 && conn->unacked > 0)
{
/* We always set the ACK flag in response packets adding the length of
* the IP and TCP headers.
......
/****************************************************************************
* net/uip/uip_tcpconn.c
*
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2010 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Large parts of this file were leveraged from uIP logic:
......@@ -465,12 +465,12 @@ struct uip_conn *uip_tcpaccept(struct uip_tcpip_hdr *buf)
uip_ipaddr_copy(conn->ripaddr, uip_ip4addr_conv(buf->srcipaddr));
conn->tcpstateflags = UIP_SYN_RCVD;
uip_tcpinitsequence(conn->snd_nxt);
conn->len = 1;
uip_tcpinitsequence(conn->sndseq);
conn->unacked = 1;
/* rcv_nxt should be the seqno from the incoming packet + 1. */
/* rcvseq should be the seqno from the incoming packet + 1. */
memcpy(conn->rcv_nxt, buf->seqno, 4);
memcpy(conn->rcvseq, buf->seqno, 4);
/* Initialize the list of TCP read-ahead buffers */
......@@ -595,10 +595,10 @@ int uip_tcpconnect(struct uip_conn *conn, const struct sockaddr_in *addr)
/* Initialize and return the connection structure, bind it to the port number */
conn->tcpstateflags = UIP_SYN_SENT;
uip_tcpinitsequence(conn->snd_nxt);
uip_tcpinitsequence(conn->sndseq);
conn->initialmss = conn->mss = UIP_TCP_MSS;
conn->len = 1; /* TCP length of the SYN is one. */
conn->unacked = 1; /* TCP length of the SYN is one. */
conn->nrtx = 0;
conn->timer = 1; /* Send the SYN next time around. */
conn->rto = UIP_RTO;
......
......@@ -194,7 +194,7 @@ void uip_tcpinput(struct uip_driver_s *dev)
goto drop;
}
uip_incr32(conn->rcv_nxt, 1);
uip_incr32(conn->rcvseq, 1);
/* Parse the TCP MSS option, if present. */
......@@ -313,7 +313,7 @@ found:
((pbuf->flags & TCP_CTL) == (TCP_SYN | TCP_ACK))))
{
if ((dev->d_len > 0 || ((pbuf->flags & (TCP_SYN | TCP_FIN)) != 0)) &&
memcmp(pbuf->seqno, conn->rcv_nxt, 4) != 0)
memcmp(pbuf->seqno, conn->rcvseq, 4) != 0)
{
uip_tcpsend(dev, conn, TCP_ACK, UIP_IPTCPH_LEN);
return;
......@@ -326,16 +326,16 @@ found:
* retransmission timer.
*/
if ((pbuf->flags & TCP_ACK) != 0 && conn->len > 0)
if ((pbuf->flags & TCP_ACK) != 0 && conn->unacked > 0)
{
uint32_t seqno;
uint32_t ackno;
/* The next sequence number is equal to the current sequence
* number (snd_nxt) plus the size of the oustanding data (len).
* number (sndseq) plus the size of the oustanding data (len).
*/
seqno = uip_tcpaddsequence(conn->snd_nxt, conn->len);
seqno = uip_tcpaddsequence(conn->sndseq, conn->unacked);
/* Check if all of the outstanding bytes have been acknowledged. For
* a "generic" send operation, this should always be true. However,
......@@ -349,7 +349,7 @@ found:
{
/* Update sequence number. */
uip_tcpsetsequence(conn->snd_nxt, seqno);
uip_tcpsetsequence(conn->sndseq, seqno);
/* Do RTT estimation, unless we have done retransmissions. */
......@@ -382,7 +382,7 @@ found:
/* Reset length of outstanding data. */
conn->len = 0;
conn->unacked = 0;
}
}
......@@ -406,7 +406,7 @@ found:
if (flags & UIP_ACKDATA)
{
conn->tcpstateflags = UIP_ESTABLISHED;
conn->len = 0;
conn->unacked = 0;
nllvdbg("TCP state: UIP_ESTABLISHED\n");
flags = UIP_CONNECTED;
......@@ -414,7 +414,7 @@ found:
if (dev->d_len > 0)
{
flags |= UIP_NEWDATA;
uip_incr32(conn->rcv_nxt, dev->d_len);
uip_incr32(conn->rcvseq, dev->d_len);
}
dev->d_sndlen = 0;
......@@ -426,7 +426,7 @@ found:
case UIP_SYN_SENT:
/* In SYN_SENT, we wait for a SYNACK that is sent in response to
* our SYN. The rcv_nxt is set to sequence number in the SYNACK
* our SYN. The rcvseq is set to sequence number in the SYNACK
* plus one, and we send an ACK. We move into the ESTABLISHED
* state.
*/
......@@ -488,11 +488,11 @@ found:
}
conn->tcpstateflags = UIP_ESTABLISHED;
memcpy(conn->rcv_nxt, pbuf->seqno, 4);
memcpy(conn->rcvseq, pbuf->seqno, 4);
nllvdbg("TCP state: UIP_ESTABLISHED\n");
uip_incr32(conn->rcv_nxt, 1);
conn->len = 0;
uip_incr32(conn->rcvseq, 1);
conn->unacked = 0;
dev->d_len = 0;
dev->d_sndlen = 0;
result = uip_tcpcallback(dev, conn, UIP_CONNECTED | UIP_NEWDATA);
......@@ -533,12 +533,12 @@ found:
if (pbuf->flags & TCP_FIN && !(conn->tcpstateflags & UIP_STOPPED))
{
if (conn->len > 0)
if (conn->unacked > 0)
{
goto drop;
}
uip_incr32(conn->rcv_nxt, dev->d_len + 1);
uip_incr32(conn->rcvseq, dev->d_len + 1);
flags |= UIP_CLOSE;
if (dev->d_len > 0)
......@@ -549,7 +549,7 @@ found:
(void)uip_tcpcallback(dev, conn, flags);
conn->tcpstateflags = UIP_LAST_ACK;
conn->len = 1;
conn->unacked = 1;
conn->nrtx = 0;
nllvdbg("TCP state: UIP_LAST_ACK\n");
......@@ -572,7 +572,7 @@ found:
dev->d_urglen = dev->d_len;
}
uip_incr32(conn->rcv_nxt, dev->d_urglen);
uip_incr32(conn->rcvseq, dev->d_urglen);
dev->d_len -= dev->d_urglen;
dev->d_urgdata = dev->d_appdata;
dev->d_appdata += dev->d_urglen;
......@@ -598,7 +598,7 @@ found:
if (dev->d_len > 0 && !(conn->tcpstateflags & UIP_STOPPED))
{
flags |= UIP_NEWDATA;
uip_incr32(conn->rcv_nxt, dev->d_len);
uip_incr32(conn->rcvseq, dev->d_len);
}
/* Check if the available buffer space advertised by the other end
......@@ -670,7 +670,7 @@ found:
if (dev->d_len > 0)
{
uip_incr32(conn->rcv_nxt, dev->d_len);
uip_incr32(conn->rcvseq, dev->d_len);
}
if (pbuf->flags & TCP_FIN)
{
......@@ -678,7 +678,7 @@ found:
{
conn->tcpstateflags = UIP_TIME_WAIT;
conn->timer = 0;
conn->len = 0;
conn->unacked = 0;
nllvdbg("TCP state: UIP_TIME_WAIT\n");
}
else
......@@ -687,7 +687,7 @@ found:
nllvdbg("TCP state: UIP_CLOSING\n");
}
uip_incr32(conn->rcv_nxt, 1);
uip_incr32(conn->rcvseq, 1);
(void)uip_tcpcallback(dev, conn, UIP_CLOSE);
uip_tcpsend(dev, conn, TCP_ACK, UIP_IPTCPH_LEN);
return;
......@@ -695,7 +695,7 @@ found:
else if (flags & UIP_ACKDATA)
{
conn->tcpstateflags = UIP_FIN_WAIT_2;
conn->len = 0;
conn->unacked = 0;
nllvdbg("TCP state: UIP_FIN_WAIT_2\n");
goto drop;
}
......@@ -710,7 +710,7 @@ found:
case UIP_FIN_WAIT_2:
if (dev->d_len > 0)
{
uip_incr32(conn->rcv_nxt, dev->d_len);
uip_incr32(conn->rcvseq, dev->d_len);
}
if (pbuf->flags & TCP_FIN)
......@@ -719,7 +719,7 @@ found:
conn->timer = 0;
nllvdbg("TCP state: UIP_TIME_WAIT\n");
uip_incr32(conn->rcv_nxt, 1);
uip_incr32(conn->rcvseq, 1);
(void)uip_tcpcallback(dev, conn, UIP_CLOSE);
uip_tcpsend(dev, conn, TCP_ACK, UIP_IPTCPH_LEN);
return;
......
/****************************************************************************
* net/uip/uip_tcpsend.c
*
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2010 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Adapted for NuttX from logic in uIP which also has a BSD-like license:
......@@ -175,8 +175,8 @@ static void uip_tcpsendcommon(struct uip_driver_s *dev, struct uip_conn *conn)
{
struct uip_tcpip_hdr *pbuf = BUF;
memcpy(pbuf->ackno, conn->rcv_nxt, 4);
memcpy(pbuf->seqno, conn->snd_nxt, 4);
memcpy(pbuf->ackno, conn->rcvseq, 4);
memcpy(pbuf->seqno, conn->sndseq, 4);
pbuf->proto = UIP_PROTO_TCP;
pbuf->srcport = conn->lport;
......
......@@ -133,7 +133,7 @@ void uip_tcptimer(struct uip_driver_s *dev, struct uip_conn *conn, int hsec)
* retransmit.
*/
if (conn->len > 0)
if (conn->unacked > 0)
{
/* The connection has outstanding data */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment