diff --git a/net/devif/devif.h b/net/devif/devif.h index a7ddd18d1d..ce303562d6 100644 --- a/net/devif/devif.h +++ b/net/devif/devif.h @@ -56,67 +56,84 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ -/* The following flags may be set in the set of flags before calling the - * application callback. The UIP_ACKDATA, UIP_NEWDATA, and UIP_CLOSE flags - * may be set at the same time, whereas the others are mutually exclusive. +/* The following flags may be set in the set of flags by the lower, device- + * interfacing layer before calling through the socket layer callback. The + * TCP_ACKDATA, XYZ_NEWDATA, and TCP_CLOSE flags may be set at the same time, + * whereas the others are mutually exclusive. * - * UIP_ACKDATA IN: Signifies that the outstanding data was ACKed and - * the application should send out new data instead + * TCP_ACKDATA IN: Signifies that the outstanding data was ACKed and + * the socket layer should send out new data instead * of retransmitting the last data (TCP only) * OUT: Input state must be preserved on output. - * UIP_NEWDATA IN: Set to indicate that the peer has sent us new data. - * OUT: Cleared (only) by the application logic to indicate - * that the new data was consumed, suppressing further - * attempts to process the new data. - * UIP_SNDACK IN: Not used; always zero - * OUT: Set by the application if the new data was consumed + * + * TCP_NEWDATA IN: Set to indicate that the peer has sent us new data. + * UDP_NEWDATA OUT: Cleared (only) by the socket layer logic to indicate + * PKT_NEWDATA that the new data was consumed, suppressing further + * ICMP_NEWDATA attempts to process the new data. + * + * TCP_SNDACK IN: Not used; always zero + * OUT: Set by the socket layer if the new data was consumed * and an ACK should be sent in the response. (TCP only) - * UIP_REXMIT IN: Tells the application to retransmit the data that + * + * TCP_REXMIT IN: Tells the socket layer to retransmit the data that * was last sent. (TCP only) * OUT: Not used - * UIP_POLL IN: Used for polling the application. This is provided - * periodically from the drivers to support (1) timed - * operations, and (2) to check if the application has - * data that it wants to send + * + * TCP_POLL IN: Used for polling the socket layer. This is provided + * UDP_POLL periodically from the drivers to support (1) timed + * PKT_POLL operations, and (2) to check if the socket layer has + * ICMP_POLL data that it wants to send * OUT: Not used - * UIP_BACKLOG IN: There is a new connection in the backlog list set + * + * TCP_BACKLOG IN: There is a new connection in the backlog list set * up by the listen() command. (TCP only) * OUT: Not used - * UIP_CLOSE IN: The remote host has closed the connection, thus the + * + * TCP_CLOSE IN: The remote host has closed the connection, thus the * connection has gone away. (TCP only) - * OUT: The application signals that it wants to close the + * OUT: The socket layer signals that it wants to close the * connection. (TCP only) - * UIP_ABORT IN: The remote host has aborted the connection, thus the + * + * TCP_ABORT IN: The remote host has aborted the connection, thus the * connection has gone away. (TCP only) - * OUT: The application signals that it wants to abort the + * OUT: The socket layer signals that it wants to abort the * connection. (TCP only) - * UIP_CONNECTED IN: We have got a connection from a remote host and have + * + * TCP_CONNECTED IN: We have got a connection from a remote host and have * set up a new connection for it, or an active connection * has been successfully established. (TCP only) * OUT: Not used - * UIP_TIMEDOUT IN: The connection has been aborted due to too many + * + * TCP_TIMEDOUT IN: The connection has been aborted due to too many * retransmissions. (TCP only) * OUT: Not used - * UIP_ECHOREPLY IN: An ICMP Echo Reply has been received. Used to support - * ICMP ping from applications. (ICMP only) - * OUT: Cleared (only) by the application logic to indicate + * + * ICMP_ECHOREPLY IN: An ICMP Echo Reply has been received. Used to support + * ICMP ping from the socket layer. (ICMP only) + * OUT: Cleared (only) by the socket layer logic to indicate * that the reply was processed, suppressing further * attempts to process the reply. */ -#define UIP_ACKDATA (1 << 0) -#define UIP_NEWDATA (1 << 1) -#define UIP_SNDACK (1 << 2) -#define UIP_REXMIT (1 << 3) -#define UIP_POLL (1 << 4) -#define UIP_BACKLOG (1 << 5) -#define UIP_CLOSE (1 << 6) -#define UIP_ABORT (1 << 7) -#define UIP_CONNECTED (1 << 8) -#define UIP_TIMEDOUT (1 << 9) -#define UIP_ECHOREPLY (1 << 10) +#define TCP_ACKDATA (1 << 0) +#define TCP_NEWDATA (1 << 1) +#define UDP_NEWDATA TCP_NEWDATA +#define PKT_NEWDATA TCP_NEWDATA +#define ICMP_NEWDATA TCP_NEWDATA +#define TCP_SNDACK (1 << 2) +#define TCP_REXMIT (1 << 3) +#define TCP_POLL (1 << 4) +#define UDP_POLL TCP_POLL +#define PKT_POLL TCP_POLL +#define ICMP_POLL TCP_POLL +#define TCP_BACKLOG (1 << 5) +#define TCP_CLOSE (1 << 6) +#define TCP_ABORT (1 << 7) +#define TCP_CONNECTED (1 << 8) +#define TCP_TIMEDOUT (1 << 9) +#define ICMP_ECHOREPLY (1 << 10) -#define UIP_CONN_EVENTS (UIP_CLOSE|UIP_ABORT|UIP_CONNECTED|UIP_TIMEDOUT) +#define TCP_CONN_EVENTS (TCP_CLOSE | TCP_ABORT | TCP_CONNECTED | TCP_TIMEDOUT) /**************************************************************************** * Public Type Definitions @@ -128,9 +145,9 @@ * event - Provides the address of the callback function entry point. * pvconn is a pointer to one of struct tcp_conn_s or struct * udp_conn_s. - * priv - Holds a reference to application specific data that will + * priv - Holds a reference to socket layer specific data that will * provided - * flags - Set by the application to inform the lower layer which flags + * flags - Set by the socket layer to inform the lower layer which flags * were and were not handled by the callback. */ @@ -260,8 +277,8 @@ uint16_t devif_callback_execute(FAR struct net_driver_s *dev, FAR void *pvconn, /**************************************************************************** * Send data on the current connection. * - * This function is used to send out a single segment of TCP - * data. Only applications that have been invoked by uIP for event + * This function is used to send out a single segment of TCP data. Only + * socket logic that have been invoked by the lower level for event * processing can send data. * * The amount of data that actually is sent out after a call to this @@ -270,10 +287,10 @@ uint16_t devif_callback_execute(FAR struct net_driver_s *dev, FAR void *pvconn, * amount of data is sent. The function tcp_mss() can be used to query * uIP for the amount of data that actually will be sent. * - * Note: This function does not guarantee that the sent data will - * arrive at the destination. If the data is lost in the network, the - * application will be invoked with the UIP_REXMIT flag set. The - * application will then have to resend the data using this function. + * Note: This function does not guarantee that the sent data will + * arrive at the destination. If the data is lost in the network, the + * TCP socket layer will be invoked with the TCP_REXMIT flag set. The + * socket layer will then have to resend the data using this function. * * data A pointer to the data which is to be sent. * diff --git a/net/icmp/icmp_input.c b/net/icmp/icmp_input.c index 6ef90ae720..778ce4deec 100644 --- a/net/icmp/icmp_input.c +++ b/net/icmp/icmp_input.c @@ -187,7 +187,7 @@ void icmp_input(FAR struct net_driver_s *dev) #ifdef CONFIG_NET_ICMP_PING else if (picmp->type == ICMP_ECHO_REPLY && g_echocallback) { - (void)devif_callback_execute(dev, picmp, UIP_ECHOREPLY, g_echocallback); + (void)devif_callback_execute(dev, picmp, ICMP_ECHOREPLY, g_echocallback); } #endif @@ -269,7 +269,7 @@ typeerr: #ifdef CONFIG_NET_ICMP_PING else if (picmp->type == ICMP6_ECHO_REPLY && g_echocallback) { - uint16_t flags = UIP_ECHOREPLY; + uint16_t flags = ICMP_ECHOREPLY; if (g_echocallback) { @@ -280,7 +280,7 @@ typeerr: /* If the ECHO reply was not handled, then drop the packet */ - if (flags == UIP_ECHOREPLY) + if (flags == ICMP_ECHOREPLY) { /* The ECHO reply was not handled */ diff --git a/net/icmp/icmp_ping.c b/net/icmp/icmp_ping.c index 2124765b9e..bc615a06b8 100644 --- a/net/icmp/icmp_ping.c +++ b/net/icmp/icmp_ping.c @@ -136,7 +136,8 @@ static inline int ping_timeout(FAR struct icmp_ping_s *pstate) * * Description: * This function is called from the interrupt level to perform the actual - * ECHO request and/or ECHO reply actions when polled by the uIP layer. + * ECHO request and/or ECHO reply actions when polled by the lower, device + * interfacing layer. * * Parameters: * dev The structure of the network driver that caused the interrupt @@ -168,7 +169,7 @@ static uint16_t ping_interrupt(FAR struct net_driver_s *dev, FAR void *conn, * response from a previous ping. */ - if ((flags & UIP_ECHOREPLY) != 0 && conn != NULL) + if ((flags & ICMP_ECHOREPLY) != 0 && conn != NULL) { FAR struct icmp_iphdr_s *icmp = (FAR struct icmp_iphdr_s *)conn; @@ -179,7 +180,7 @@ static uint16_t ping_interrupt(FAR struct net_driver_s *dev, FAR void *conn, { /* Consume the ECHOREPLY */ - flags &= ~UIP_ECHOREPLY; + flags &= ~ICMP_ECHOREPLY; dev->d_len = 0; /* Return the result to the caller */ @@ -204,7 +205,7 @@ static uint16_t ping_interrupt(FAR struct net_driver_s *dev, FAR void *conn, */ if (dev->d_sndlen <= 0 && /* Packet available */ - (flags & UIP_NEWDATA) == 0 && /* No incoming data */ + (flags & ICMP_NEWDATA) == 0 && /* No incoming data */ !pstate->png_sent) /* Request not sent */ { FAR struct icmp_iphdr_s *picmp = ICMPBUF; @@ -350,7 +351,7 @@ int icmp_ping(net_ipaddr_t addr, uint16_t id, uint16_t seqno, state.png_cb = icmp_callback_alloc(); if (state.png_cb) { - state.png_cb->flags = UIP_POLL|UIP_ECHOREPLY; + state.png_cb->flags = (ICMP_POLL | ICMP_ECHOREPLY); state.png_cb->priv = (void*)&state; state.png_cb->event = ping_interrupt; state.png_result = -EINTR; /* Assume sem-wait interrupted by signal */ diff --git a/net/icmp/icmp_poll.c b/net/icmp/icmp_poll.c index 43ae31154a..16f4abf00d 100644 --- a/net/icmp/icmp_poll.c +++ b/net/icmp/icmp_poll.c @@ -98,7 +98,7 @@ void icmp_poll(FAR struct net_driver_s *dev) /* Perform the application callback */ - (void)devif_callback_execute(dev, NULL, UIP_POLL, g_echocallback); + (void)devif_callback_execute(dev, NULL, ICMP_POLL, g_echocallback); } #endif /* CONFIG_NET && CONFIG_NET_ICMP && CONFIG_NET_ICMP_PING */ diff --git a/net/pkt/pkt_input.c b/net/pkt/pkt_input.c index cdaebb66c5..9f0ce783ed 100644 --- a/net/pkt/pkt_input.c +++ b/net/pkt/pkt_input.c @@ -114,13 +114,13 @@ int pkt_input(struct net_driver_s *dev) /* Perform the application callback */ - flags = pkt_callback(dev, conn, UIP_NEWDATA); + flags = pkt_callback(dev, conn, PKT_NEWDATA); - /* If the operation was successful, the UIP_NEWDATA flag is removed + /* If the operation was successful, the PKT_NEWDATA flag is removed * and thus the packet can be deleted (OK will be returned). */ - if ((flags & UIP_NEWDATA) != 0) + if ((flags & PKT_NEWDATA) != 0) { /* No.. the packet was not processed now. Return ERROR so * that the driver may retry again later. diff --git a/net/pkt/pkt_poll.c b/net/pkt/pkt_poll.c index 130ca5a940..0b7c6f08da 100644 --- a/net/pkt/pkt_poll.c +++ b/net/pkt/pkt_poll.c @@ -110,7 +110,7 @@ void pkt_poll(FAR struct net_driver_s *dev, FAR struct pkt_conn_s *conn) /* Perform the application callback */ - (void)pkt_callback(dev, conn, UIP_POLL); + (void)pkt_callback(dev, conn, PKT_POLL); /* If the application has data to send, setup the UDP/IP header */ diff --git a/net/pkt/pkt_send.c b/net/pkt/pkt_send.c index 2420feb177..8de736086c 100644 --- a/net/pkt/pkt_send.c +++ b/net/pkt/pkt_send.c @@ -107,7 +107,7 @@ static uint16_t psock_send_interrupt(FAR struct net_driver_s *dev, * we will just have to wait for the next polling cycle. */ - if (dev->d_sndlen > 0 || (flags & UIP_NEWDATA) != 0) + if (dev->d_sndlen > 0 || (flags & PKT_NEWDATA) != 0) { /* Another thread has beat us sending data or the buffer is busy, * Check for a timeout. If not timed out, wait for the next @@ -251,7 +251,7 @@ ssize_t psock_pkt_send(FAR struct socket *psock, FAR const void *buf, /* Set up the callback in the connection */ - state.snd_cb->flags = UIP_POLL; + state.snd_cb->flags = PKT_POLL; state.snd_cb->priv = (void*)&state; state.snd_cb->event = psock_send_interrupt; diff --git a/net/socket/connect.c b/net/socket/connect.c index 2f90fe8050..d88961e4df 100644 --- a/net/socket/connect.c +++ b/net/socket/connect.c @@ -118,7 +118,8 @@ static inline int psock_setup_callbacks(FAR struct socket *psock, { /* Set up the connection "interrupt" handler */ - pstate->tc_cb->flags = UIP_NEWDATA|UIP_CLOSE|UIP_ABORT|UIP_TIMEDOUT|UIP_CONNECTED; + pstate->tc_cb->flags = (TCP_NEWDATA | TCP_CLOSE | TCP_ABORT | + TCP_TIMEDOUT | TCP_CONNECTED); pstate->tc_cb->priv = (void*)pstate; pstate->tc_cb->event = psock_connect_interrupt; @@ -165,7 +166,7 @@ static inline void psock_teardown_callbacks(FAR struct tcp_connect_s *pstate, * * Description: * This function is called from the interrupt level to perform the actual - * connection operation via by the uIP layer. + * connection operation via by the lower, device interfacing layer. * * Parameters: * dev The sructure of the network driver that caused the interrupt @@ -204,29 +205,29 @@ static uint16_t psock_connect_interrupt(FAR struct net_driver_s *dev, * to accept new connections. */ - /* UIP_CLOSE: The remote host has closed the connection - * UIP_ABORT: The remote host has aborted the connection + /* TCP_CLOSE: The remote host has closed the connection + * TCP_ABORT: The remote host has aborted the connection */ - if ((flags & (UIP_CLOSE|UIP_ABORT)) != 0) + if ((flags & (TCP_CLOSE | TCP_ABORT)) != 0) { /* Indicate that remote host refused the connection */ pstate->tc_result = -ECONNREFUSED; } - /* UIP_TIMEDOUT: Connection aborted due to too many retransmissions. */ + /* TCP_TIMEDOUT: Connection aborted due to too many retransmissions. */ - else if ((flags & UIP_TIMEDOUT) != 0) + else if ((flags & TCP_TIMEDOUT) != 0) { /* Indicate that the remote host is unreachable (or should this be timedout?) */ pstate->tc_result = -ETIMEDOUT; } - /* UIP_CONNECTED: The socket is successfully connected */ + /* TCP_CONNECTED: The socket is successfully connected */ - else if ((flags & UIP_CONNECTED) != 0) + else if ((flags & TCP_CONNECTED) != 0) { /* Indicate that the socket is no longer connected */ @@ -240,7 +241,7 @@ static uint16_t psock_connect_interrupt(FAR struct net_driver_s *dev, /* Drop data received in this state */ dev->d_len = 0; - return flags & ~UIP_NEWDATA; + return flags & ~TCP_NEWDATA; } nllvdbg("Resuming: %d\n", pstate->tc_result); diff --git a/net/socket/net_close.c b/net/socket/net_close.c index de15fcccf8..17464f1d8d 100644 --- a/net/socket/net_close.c +++ b/net/socket/net_close.c @@ -168,12 +168,12 @@ static uint16_t netclose_interrupt(FAR struct net_driver_s *dev, nllvdbg("conn: %p flags: %04x\n", conn, flags); - /* UIP_CLOSE: The remote host has closed the connection - * UIP_ABORT: The remote host has aborted the connection - * UIP_TIMEDOUT: The remote did not respond, the connection timed out + /* TCP_CLOSE: The remote host has closed the connection + * TCP_ABORT: The remote host has aborted the connection + * TCP_TIMEDOUT: The remote did not respond, the connection timed out */ - if ((flags & (UIP_CLOSE | UIP_ABORT | UIP_TIMEDOUT)) != 0) + if ((flags & (TCP_CLOSE | TCP_ABORT | TCP_TIMEDOUT)) != 0) { /* The disconnection is complete */ @@ -225,23 +225,23 @@ static uint16_t netclose_interrupt(FAR struct net_driver_s *dev, else if (conn->unacked != 0) { /* No... we are still waiting for ACKs. Drop any received data, but - * do not yet report UIP_CLOSE in the response. + * do not yet report TCP_CLOSE in the response. */ dev->d_len = 0; - flags = (flags & ~UIP_NEWDATA); + flags = (flags & ~TCP_NEWDATA); } #endif /* CONFIG_NET_TCP_WRITE_BUFFERS */ else { - /* Drop data received in this state and make sure that UIP_CLOSE + /* Drop data received in this state and make sure that TCP_CLOSE * is set in the response */ dev->d_len = 0; - flags = (flags & ~UIP_NEWDATA) | UIP_CLOSE; + flags = (flags & ~TCP_NEWDATA) | TCP_CLOSE; } return flags; @@ -315,8 +315,8 @@ static inline int netclose_disconnect(FAR struct socket *psock) { /* Set up to receive TCP data event callbacks */ - state.cl_cb->flags = (UIP_NEWDATA | UIP_POLL | UIP_CLOSE | UIP_ABORT | \ - UIP_TIMEDOUT); + state.cl_cb->flags = (TCP_NEWDATA | TCP_POLL | TCP_CLOSE | TCP_ABORT | + TCP_TIMEDOUT); state.cl_cb->event = netclose_interrupt; #ifdef CONFIG_NET_SOLINGER diff --git a/net/socket/net_monitor.c b/net/socket/net_monitor.c index c5dd08188e..24e6e1c825 100644 --- a/net/socket/net_monitor.c +++ b/net/socket/net_monitor.c @@ -89,16 +89,16 @@ static void connection_event(FAR struct tcp_conn_s *conn, uint16_t flags) { nllvdbg("flags: %04x s_flags: %02x\n", flags, psock->s_flags); - /* UIP_CLOSE, UIP_ABORT, or UIP_TIMEDOUT: Loss-of-connection events */ + /* TCP_CLOSE, TCP_ABORT, or TCP_TIMEDOUT: Loss-of-connection events */ - if ((flags & (UIP_CLOSE|UIP_ABORT|UIP_TIMEDOUT)) != 0) + if ((flags & (TCP_CLOSE | TCP_ABORT | TCP_TIMEDOUT)) != 0) { net_lostconnection(psock, flags); } - /* UIP_CONNECTED: The socket is successfully connected */ + /* TCP_CONNECTED: The socket is successfully connected */ - else if ((flags & UIP_CONNECTED) != 0) + else if ((flags & TCP_CONNECTED) != 0) { /* Indicate that the socket is now connected */ @@ -144,7 +144,7 @@ int net_startmonitor(FAR struct socket *psock) if (!(conn->tcpstateflags == TCP_ESTABLISHED || conn->tcpstateflags == TCP_SYN_RCVD)) { - connection_event(conn, UIP_CLOSE); + connection_event(conn, TCP_CLOSE); } return OK; @@ -196,9 +196,9 @@ void net_lostconnection(FAR struct socket *psock, uint16_t flags) /* These loss-of-connection events may be reported: * - * UIP_CLOSE: The remote host has closed the connection - * UIP_ABORT: The remote host has aborted the connection - * UIP_TIMEDOUT: Connection aborted due to too many retransmissions. + * TCP_CLOSE: The remote host has closed the connection + * TCP_ABORT: The remote host has aborted the connection + * TCP_TIMEDOUT: Connection aborted due to too many retransmissions. * * And we need to set these two socket status bits appropriately: * @@ -207,7 +207,7 @@ void net_lostconnection(FAR struct socket *psock, uint16_t flags) * _SF_CONNECTED==0 && _SF_CLOSED==0 - the socket was rudely disconnected */ - if ((flags & UIP_CLOSE) != 0) + if ((flags & TCP_CLOSE) != 0) { /* The peer gracefully closed the connection. Marking the * connection as disconnected will suppress some subsequent @@ -218,7 +218,7 @@ void net_lostconnection(FAR struct socket *psock, uint16_t flags) psock->s_flags &= ~_SF_CONNECTED; psock->s_flags |= _SF_CLOSED; } - else if ((flags & (UIP_ABORT|UIP_TIMEDOUT)) != 0) + else if ((flags & (TCP_ABORT | TCP_TIMEDOUT)) != 0) { /* The loss of connection was less than graceful. This will (eventually) * be reported as an ENOTCONN error. diff --git a/net/socket/net_poll.c b/net/socket/net_poll.c index c7d35ea169..a8fa92370f 100644 --- a/net/socket/net_poll.c +++ b/net/socket/net_poll.c @@ -95,7 +95,7 @@ struct net_poll_s * * Description: * This function is called from the interrupt level to perform the actual - * TCP receive operation via by the uIP layer. + * TCP receive operation via by the device interface layer. * * Parameters: * dev The structure of the network driver that caused the interrupt @@ -128,21 +128,21 @@ static uint16_t poll_interrupt(FAR struct net_driver_s *dev, FAR void *conn, /* Check for data or connection availability events. */ - if ((flags & (UIP_NEWDATA|UIP_BACKLOG)) != 0) + if ((flags & (TCP_NEWDATA | TCP_BACKLOG)) != 0) { eventset |= POLLIN & info->fds->events; } /* A poll is a sign that we are free to send data. */ - if ((flags & UIP_POLL) != 0) + if ((flags & TCP_POLL) != 0) { eventset |= (POLLOUT & info->fds->events); } /* Check for a loss of connection events. */ - if ((flags & (UIP_CLOSE|UIP_ABORT|UIP_TIMEDOUT)) != 0) + if ((flags & (TCP_CLOSE | TCP_ABORT | TCP_TIMEDOUT)) != 0) { /* Marki that the connection has been lost */ @@ -230,7 +230,8 @@ static inline int net_pollsetup(FAR struct socket *psock, * callback processing. */ - cb->flags = (UIP_NEWDATA|UIP_BACKLOG|UIP_POLL|UIP_CLOSE|UIP_ABORT|UIP_TIMEDOUT); + cb->flags = (TCP_NEWDATA | TCP_BACKLOG | TCP_POLL | TCP_CLOSE | + TCP_ABORT | TCP_TIMEDOUT); cb->priv = (FAR void *)info; cb->event = poll_interrupt; diff --git a/net/socket/net_sendfile.c b/net/socket/net_sendfile.c index 0242ac11be..40e4f4bdbe 100644 --- a/net/socket/net_sendfile.c +++ b/net/socket/net_sendfile.c @@ -155,7 +155,7 @@ static uint16_t ack_interrupt(FAR struct net_driver_s *dev, FAR void *pvconn, nllvdbg("flags: %04x\n", flags); - if ((flags & UIP_ACKDATA) != 0) + if ((flags & TCP_ACKDATA) != 0) { /* Update the timeout */ @@ -175,9 +175,9 @@ static uint16_t ack_interrupt(FAR struct net_driver_s *dev, FAR void *pvconn, dev->d_sndlen = 0; - flags &= ~UIP_ACKDATA; + flags &= ~TCP_ACKDATA; } - else if ((flags & UIP_REXMIT) != 0) + else if ((flags & TCP_REXMIT) != 0) { nlldbg("REXMIT\n"); @@ -190,7 +190,7 @@ static uint16_t ack_interrupt(FAR struct net_driver_s *dev, FAR void *pvconn, /* Check for a loss of connection */ - else if ((flags & (UIP_CLOSE|UIP_ABORT|UIP_TIMEDOUT)) != 0) + else if ((flags & (TCP_CLOSE | TCP_ABORT | TCP_TIMEDOUT)) != 0) { /* Report not connected */ @@ -212,10 +212,10 @@ static uint16_t ack_interrupt(FAR struct net_driver_s *dev, FAR void *pvconn, * * Description: * This function is called from the interrupt level to perform the actual - * send operation when polled by the uIP layer. + * send operation when polled by the lower, device interfacing layer. * * Parameters: - * dev The sructure of the network driver that caused the interrupt + * dev The structure of the network driver that caused the interrupt * conn The connection structure associated with the socket * flags Set of events describing why the callback was invoked * @@ -239,7 +239,7 @@ static uint16_t sendfile_interrupt(FAR struct net_driver_s *dev, FAR void *pvcon /* Check for a loss of connection */ - if ((flags & (UIP_CLOSE|UIP_ABORT|UIP_TIMEDOUT)) != 0) + if ((flags & (TCP_CLOSE | TCP_ABORT | TCP_TIMEDOUT)) != 0) { /* Report not connected */ @@ -258,7 +258,7 @@ static uint16_t sendfile_interrupt(FAR struct net_driver_s *dev, FAR void *pvcon * next polling cycle. */ - if ((flags & UIP_NEWDATA) == 0 && pstate->snd_sent < pstate->snd_flen) + if ((flags & TCP_NEWDATA) == 0 && pstate->snd_sent < pstate->snd_flen) { /* Get the amount of data that we can send in the next packet */ @@ -531,7 +531,8 @@ ssize_t net_sendfile(int outfd, struct file *infile, off_t *offset, /* Set up the ACK callback in the connection */ - state.snd_ackcb->flags = UIP_ACKDATA|UIP_REXMIT|UIP_CLOSE|UIP_ABORT|UIP_TIMEDOUT; + state.snd_ackcb->flags = (TCP_ACKDATA | TCP_REXMIT | TCP_CLOSE | + TCP_ABORT | TCP_TIMEDOUT); state.snd_ackcb->priv = (void*)&state; state.snd_ackcb->event = ack_interrupt; @@ -539,7 +540,7 @@ ssize_t net_sendfile(int outfd, struct file *infile, off_t *offset, do { - state.snd_datacb->flags = UIP_POLL; + state.snd_datacb->flags = TCP_POLL; state.snd_datacb->priv = (void*)&state; state.snd_datacb->event = sendfile_interrupt; diff --git a/net/socket/recvfrom.c b/net/socket/recvfrom.c index 388281a289..0c447af039 100644 --- a/net/socket/recvfrom.c +++ b/net/socket/recvfrom.c @@ -508,7 +508,7 @@ static uint16_t recvfrom_pktinterrupt(FAR struct net_driver_s *dev, { /* If a new packet is available, then complete the read action. */ - if ((flags & UIP_NEWDATA) != 0) + if ((flags & PKT_NEWDATA) != 0) { /* Copy the packet */ recvfrom_newpktdata(dev, pstate); @@ -529,7 +529,7 @@ static uint16_t recvfrom_pktinterrupt(FAR struct net_driver_s *dev, #endif /* indicate that the data has been consumed */ - flags &= ~UIP_NEWDATA; + flags &= ~PKT_NEWDATA; /* Wake up the waiting thread, returning the number of bytes * actually read. @@ -591,7 +591,7 @@ static inline void recvfrom_tcpsender(FAR struct net_driver_s *dev, * * Description: * This function is called from the interrupt level to perform the actual - * TCP receive operation via by the uIP layer. + * TCP receive operation via by the lower, device interfacing layer. * * Parameters: * dev The structure of the network driver that caused the interrupt @@ -621,7 +621,7 @@ static uint16_t recvfrom_tcpinterrupt(FAR struct net_driver_s *dev, { /* If new data is available, then complete the read action. */ - if ((flags & UIP_NEWDATA) != 0) + if ((flags & TCP_NEWDATA) != 0) { /* Copy the data from the packet (saving any unused bytes from the * packet in the read-ahead buffer). @@ -637,7 +637,7 @@ static uint16_t recvfrom_tcpinterrupt(FAR struct net_driver_s *dev, * should be sent. */ - flags = (flags & ~UIP_NEWDATA) | UIP_SNDACK; + flags = (flags & ~TCP_NEWDATA) | TCP_SNDACK; /* Check for transfer complete. We will consider the transfer * complete in own of two different ways, depending on the setting @@ -690,12 +690,12 @@ static uint16_t recvfrom_tcpinterrupt(FAR struct net_driver_s *dev, /* Check for a loss of connection. * - * UIP_CLOSE: The remote host has closed the connection - * UIP_ABORT: The remote host has aborted the connection - * UIP_TIMEDOUT: Connection aborted due to too many retransmissions. + * TCP_CLOSE: The remote host has closed the connection + * TCP_ABORT: The remote host has aborted the connection + * TCP_TIMEDOUT: Connection aborted due to too many retransmissions. */ - else if ((flags & (UIP_CLOSE|UIP_ABORT|UIP_TIMEDOUT)) != 0) + else if ((flags & (TCP_CLOSE | TCP_ABORT | TCP_TIMEDOUT)) != 0) { nllvdbg("Lost connection\n"); @@ -711,7 +711,7 @@ static uint16_t recvfrom_tcpinterrupt(FAR struct net_driver_s *dev, /* Check if the peer gracefully closed the connection. */ - if ((flags & UIP_CLOSE) != 0) + if ((flags & TCP_CLOSE) != 0) { /* This case should always return success (zero)! The value of * rf_recvlen, if zero, will indicate that the connection was @@ -838,7 +838,7 @@ static inline void recvfrom_udpsender(struct net_driver_s *dev, struct recvfrom_ * * Description: * This function is called from the interrupt level to perform the actual - * UDP receive operation via by the uIP layer. + * UDP receive operation via by the lower, device interfacing layer. * * Parameters: * dev The structure of the network driver that caused the interrupt @@ -867,7 +867,7 @@ static uint16_t recvfrom_udpinterrupt(struct net_driver_s *dev, void *pvconn, { /* If new data is available, then complete the read action. */ - if ((flags & UIP_NEWDATA) != 0) + if ((flags & UDP_NEWDATA) != 0) { /* Copy the data from the packet */ @@ -889,7 +889,7 @@ static uint16_t recvfrom_udpinterrupt(struct net_driver_s *dev, void *pvconn, /* Indicate that the data has been consumed */ - flags &= ~UIP_NEWDATA; + flags &= ~UDP_NEWDATA; /* Wake up the waiting thread, returning the number of bytes * actually read. @@ -1082,7 +1082,7 @@ static ssize_t pkt_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len, state.rf_cb = pkt_callback_alloc(conn); if (state.rf_cb) { - state.rf_cb->flags = UIP_NEWDATA|UIP_POLL; + state.rf_cb->flags = (PKT_NEWDATA | PKT_POLL); state.rf_cb->priv = (void*)&state; state.rf_cb->event = recvfrom_pktinterrupt; @@ -1176,7 +1176,7 @@ static ssize_t udp_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len, { /* Set up the callback in the connection */ - state.rf_cb->flags = UIP_NEWDATA|UIP_POLL; + state.rf_cb->flags = (UDP_NEWDATA | UDP_POLL); state.rf_cb->priv = (void*)&state; state.rf_cb->event = recvfrom_udpinterrupt; @@ -1361,14 +1361,18 @@ static ssize_t tcp_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len, state.rf_cb = tcp_callback_alloc(conn); if (state.rf_cb) { - state.rf_cb->flags = UIP_NEWDATA|UIP_POLL|UIP_CLOSE|UIP_ABORT|UIP_TIMEDOUT; + state.rf_cb->flags = (TCP_NEWDATA | TCP_POLL | TCP_CLOSE | + TCP_ABORT | TCP_TIMEDOUT); state.rf_cb->priv = (void*)&state; state.rf_cb->event = recvfrom_tcpinterrupt; - /* Wait for either the receive to complete or for an error/timeout to occur. - * NOTES: (1) net_lockedwait will also terminate if a signal is received, (2) - * interrupts may be disabled! They will be re-enabled while the task sleeps - * and automatically re-enabled when the task restarts. + /* Wait for either the receive to complete or for an error/timeout + * to occur. + * + * NOTES: (1) net_lockedwait will also terminate if a signal is + * received, (2) interrupts may be disabled! They will be re- + * enabled while the task sleeps and automatically re-enabled when + * the task restarts. */ ret = net_lockedwait(&state.rf_sem); diff --git a/net/socket/sendto.c b/net/socket/sendto.c index 3f06bf1eed..c04c7557e6 100644 --- a/net/socket/sendto.c +++ b/net/socket/sendto.c @@ -147,7 +147,7 @@ static inline int send_timeout(FAR struct sendto_s *pstate) * * Description: * This function is called from the interrupt level to perform the actual - * send operation when polled by the uIP layer. + * send operation when polled by the lower, device interfacing layer. * * Parameters: * dev The sructure of the network driver that caused the interrupt @@ -178,7 +178,7 @@ static uint16_t sendto_interrupt(struct net_driver_s *dev, void *conn, * we will just have to wait for the next polling cycle. */ - if (dev->d_sndlen > 0 || (flags & UIP_NEWDATA) != 0) + if (dev->d_sndlen > 0 || (flags & UDP_NEWDATA) != 0) { /* Another thread has beat us sending data or the buffer is busy, * Check for a timeout. If not timed out, wait for the next @@ -396,7 +396,7 @@ ssize_t psock_sendto(FAR struct socket *psock, FAR const void *buf, state.st_cb = udp_callback_alloc(conn); if (state.st_cb) { - state.st_cb->flags = UIP_POLL; + state.st_cb->flags = UDP_POLL; state.st_cb->priv = (void*)&state; state.st_cb->event = sendto_interrupt; @@ -432,7 +432,7 @@ ssize_t psock_sendto(FAR struct socket *psock, FAR const void *buf, goto errout; } - /* Sucess */ + /* Success */ return state.st_sndlen; #else diff --git a/net/tcp/tcp.h b/net/tcp/tcp.h index d9bb586cca..a9aefbec45 100644 --- a/net/tcp/tcp.h +++ b/net/tcp/tcp.h @@ -183,18 +183,18 @@ struct tcp_conn_s * When an callback is executed from 'list', the input flags are normally * returned, however, the implementation may set one of the following: * - * UIP_CLOSE - Gracefully close the current connection - * UIP_ABORT - Abort (reset) the current connection on an error that - * prevents UIP_CLOSE from working. + * TCP_CLOSE - Gracefully close the current connection + * TCP_ABORT - Abort (reset) the current connection on an error that + * prevents TCP_CLOSE from working. * * And/Or set/clear the following: * - * UIP_NEWDATA - May be cleared to indicate that the data was consumed + * TCP_NEWDATA - May be cleared to indicate that the data was consumed * and that no further process of the new data should be * attempted. - * UIP_SNDACK - If UIP_NEWDATA is cleared, then UIP_SNDACK may be set + * TCP_SNDACK - If TCP_NEWDATA is cleared, then TCP_SNDACK may be set * to indicate that an ACK should be included in the response. - * (In UIP_NEWDATA is cleared bu UIP_SNDACK is not set, then + * (In TCP_NEWDATA is cleared bu TCP_SNDACK is not set, then * dev->d_len should also be cleared). */ @@ -757,7 +757,7 @@ uint16_t tcp_callback(FAR struct net_driver_s *dev, * zero or equal to buflen; partial packets are not buffered. * * Assumptions: - * - The caller has checked that UIP_NEWDATA is set in flags and that is no + * - The caller has checked that TCP_NEWDATA is set in flags and that is no * other handler available to process the incoming data. * - This function is called at the interrupt level with interrupts disabled. * diff --git a/net/tcp/tcp_appsend.c b/net/tcp/tcp_appsend.c index 49702ffb9f..1d1670ca87 100644 --- a/net/tcp/tcp_appsend.c +++ b/net/tcp/tcp_appsend.c @@ -106,7 +106,7 @@ void tcp_appsend(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn, /* Check for connection aborted */ - if ((result & UIP_ABORT) != 0) + if ((result & TCP_ABORT) != 0) { dev->d_sndlen = 0; conn->tcpstateflags = TCP_CLOSED; @@ -117,7 +117,7 @@ void tcp_appsend(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn, /* Check for connection closed */ - else if ((result & UIP_CLOSE) != 0) + else if ((result & TCP_CLOSE) != 0) { conn->tcpstateflags = TCP_FIN_WAIT_1; conn->unacked = 1; @@ -209,7 +209,7 @@ void tcp_rexmit(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn, /* If there is no data to send, just send out a pure ACK if one is requested`. */ - else if ((result & UIP_SNDACK) != 0) + else if ((result & TCP_SNDACK) != 0) { tcp_send(dev, conn, TCP_ACK, IPTCP_HDRLEN); } diff --git a/net/tcp/tcp_callback.c b/net/tcp/tcp_callback.c index 37a67cde52..ece5d87aba 100644 --- a/net/tcp/tcp_callback.c +++ b/net/tcp/tcp_callback.c @@ -68,7 +68,7 @@ * listener in place ready to receive the data. * * Assumptions: - * - The caller has checked that UIP_NEWDATA is set in flags and that is no + * - The caller has checked that TCP_NEWDATA is set in flags and that is no * other handler available to process the incoming data. * - This function is called at the interrupt level with interrupts disabled. * @@ -84,10 +84,10 @@ tcp_data_event(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn, * placed in the read-ahead buffer -OR- if it zero length */ - ret = (flags & ~UIP_NEWDATA) | UIP_SNDACK; + ret = (flags & ~TCP_NEWDATA) | TCP_SNDACK; /* Is there new data? With non-zero length? (Certain connection events - * can have zero-length with UIP_NEWDATA set just to cause an ACK). + * can have zero-length with TCP_NEWDATA set just to cause an ACK). */ if (dev->d_len > 0) @@ -119,9 +119,9 @@ tcp_data_event(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn, g_netstats.tcp.syndrop++; g_netstats.tcp.drop++; #endif - /* Clear the UIP_SNDACK bit so that no ACK will be sent */ + /* Clear the TCP_SNDACK bit so that no ACK will be sent */ - ret &= ~UIP_SNDACK; + ret &= ~TCP_SNDACK; } } @@ -149,9 +149,9 @@ tcp_data_event(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn, uint16_t tcp_callback(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn, uint16_t flags) { - /* Preserve the UIP_ACKDATA, UIP_CLOSE, and UIP_ABORT in the response. + /* Preserve the TCP_ACKDATA, TCP_CLOSE, and TCP_ABORT in the response. * These is needed by uIP to handle responses and buffer state. The - * UIP_NEWDATA indication will trigger the ACK response, but must be + * TCP_NEWDATA indication will trigger the ACK response, but must be * explicitly set in the callback. */ @@ -161,18 +161,18 @@ uint16_t tcp_callback(FAR struct net_driver_s *dev, * the input flags are normally returned, however, the implementation * may set one of the following: * - * UIP_CLOSE - Gracefully close the current connection - * UIP_ABORT - Abort (reset) the current connection on an error that - * prevents UIP_CLOSE from working. + * TCP_CLOSE - Gracefully close the current connection + * TCP_ABORT - Abort (reset) the current connection on an error that + * prevents TCP_CLOSE from working. * * And/Or set/clear the following: * - * UIP_NEWDATA - May be cleared to indicate that the data was consumed + * TCP_NEWDATA - May be cleared to indicate that the data was consumed * and that no further process of the new data should be * attempted. - * UIP_SNDACK - If UIP_NEWDATA is cleared, then UIP_SNDACK may be set + * TCP_SNDACK - If TCP_NEWDATA is cleared, then TCP_SNDACK may be set * to indicate that an ACK should be included in the response. - * (In UIP_NEWDATA is cleared but UIP_SNDACK is not set, then + * (In TCP_NEWDATA is cleared but TCP_SNDACK is not set, then * dev->d_len should also be cleared). */ @@ -185,7 +185,7 @@ uint16_t tcp_callback(FAR struct net_driver_s *dev, * be re-transmitted at a better time. */ - if ((flags & UIP_NEWDATA) != 0) + if ((flags & TCP_NEWDATA) != 0) { /* Data was not handled.. dispose of it appropriately */ @@ -196,7 +196,7 @@ uint16_t tcp_callback(FAR struct net_driver_s *dev, * callback. */ - if (((flags & UIP_CONN_EVENTS) != 0) && conn->connection_event) + if (((flags & TCP_CONN_EVENTS) != 0) && conn->connection_event) { /* Perform the callback */ @@ -226,7 +226,7 @@ uint16_t tcp_callback(FAR struct net_driver_s *dev, * zero or equal to buflen; partial packets are not buffered. * * Assumptions: - * - The caller has checked that UIP_NEWDATA is set in flags and that is no + * - The caller has checked that TCP_NEWDATA is set in flags and that is no * other handler available to process the incoming data. * - This function is called at the interrupt level with interrupts disabled. * diff --git a/net/tcp/tcp_input.c b/net/tcp/tcp_input.c index 08547c61b6..c84777c396 100644 --- a/net/tcp/tcp_input.c +++ b/net/tcp/tcp_input.c @@ -309,7 +309,7 @@ found: conn->tcpstateflags = TCP_CLOSED; nlldbg("RESET - TCP state: TCP_CLOSED\n"); - (void)tcp_callback(dev, conn, UIP_ABORT); + (void)tcp_callback(dev, conn, TCP_ABORT); goto drop; } @@ -435,7 +435,7 @@ found: /* Set the acknowledged flag. */ - flags |= UIP_ACKDATA; + flags |= TCP_ACKDATA; /* Reset the retransmission timer. */ @@ -455,11 +455,11 @@ found: case TCP_SYN_RCVD: /* In SYN_RCVD we have sent out a SYNACK in response to a SYN, and * we are waiting for an ACK that acknowledges the data we sent - * out the last time. Therefore, we want to have the UIP_ACKDATA + * out the last time. Therefore, we want to have the TCP_ACKDATA * flag set. If so, we enter the ESTABLISHED state. */ - if ((flags & UIP_ACKDATA) != 0) + if ((flags & TCP_ACKDATA) != 0) { conn->tcpstateflags = TCP_ESTABLISHED; @@ -469,12 +469,12 @@ found: conn->sent = 0; #endif conn->unacked = 0; - flags = UIP_CONNECTED; + flags = TCP_CONNECTED; nllvdbg("TCP state: TCP_ESTABLISHED\n"); if (dev->d_len > 0) { - flags |= UIP_NEWDATA; + flags |= TCP_NEWDATA; net_incr32(conn->rcvseq, dev->d_len); } @@ -501,7 +501,7 @@ found: * state. */ - if ((flags & UIP_ACKDATA) != 0 && (pbuf->flags & TCP_CTL) == (TCP_SYN | TCP_ACK)) + if ((flags & TCP_ACKDATA) != 0 && (pbuf->flags & TCP_CTL) == (TCP_SYN | TCP_ACK)) { /* Parse the TCP MSS option, if present. */ @@ -569,14 +569,14 @@ found: dev->d_sndlen = 0; nllvdbg("TCP state: TCP_ESTABLISHED\n"); - result = tcp_callback(dev, conn, UIP_CONNECTED | UIP_NEWDATA); + result = tcp_callback(dev, conn, TCP_CONNECTED | TCP_NEWDATA); tcp_appsend(dev, conn, result); return; } /* Inform the application that the connection failed */ - (void)tcp_callback(dev, conn, UIP_ABORT); + (void)tcp_callback(dev, conn, TCP_ABORT); /* The connection is closed after we send the RST */ @@ -595,7 +595,7 @@ found: case TCP_ESTABLISHED: /* In the ESTABLISHED state, we call upon the application to feed - * data into the d_buf. If the UIP_ACKDATA flag is set, the + * data into the d_buf. If the TCP_ACKDATA flag is set, the * application should put new data into the buffer, otherwise we are * retransmitting an old segment, and the application should put that * data into the buffer. @@ -625,11 +625,11 @@ found: */ net_incr32(conn->rcvseq, dev->d_len + 1); - flags |= UIP_CLOSE; + flags |= TCP_CLOSE; if (dev->d_len > 0) { - flags |= UIP_NEWDATA; + flags |= TCP_NEWDATA; } (void)tcp_callback(dev, conn, flags); @@ -673,20 +673,20 @@ found: } /* If d_len > 0 we have TCP data in the packet, and we flag this - * by setting the UIP_NEWDATA flag. If the application has stopped + * by setting the TCP_NEWDATA flag. If the application has stopped * the data flow using TCP_STOPPED, we must not accept any data * packets from the remote host. */ if (dev->d_len > 0 && (conn->tcpstateflags & TCP_STOPPED) == 0) { - flags |= UIP_NEWDATA; + flags |= TCP_NEWDATA; } /* If this packet constitutes an ACK for outstanding data (flagged - * by the UIP_ACKDATA flag), we should call the application since it + * by the TCP_ACKDATA flag), we should call the application since it * might want to send more data. If the incoming packet had data - * from the peer (as flagged by the UIP_NEWDATA flag), the + * from the peer (as flagged by the TCP_NEWDATA flag), the * application must also be notified. * * When the application is called, the d_len field @@ -701,7 +701,7 @@ found: * send, d_len must be set to 0. */ - if ((flags & (UIP_NEWDATA | UIP_ACKDATA)) != 0) + if ((flags & (TCP_NEWDATA | TCP_ACKDATA)) != 0) { /* Clear sndlen and remember the size in d_len. The application * may modify d_len and we will need this value later when we @@ -716,12 +716,12 @@ found: result = tcp_callback(dev, conn, flags); /* If the application successfully handled the incoming data, - * then UIP_SNDACK will be set in the result. In this case, + * then TCP_SNDACK will be set in the result. In this case, * we need to update the sequence number. The ACK will be * send by tcp_appsend(). */ - if ((result & UIP_SNDACK) != 0) + if ((result & TCP_SNDACK) != 0) { /* Update the sequence number using the saved length */ @@ -738,15 +738,15 @@ found: case TCP_LAST_ACK: /* We can close this connection if the peer has acknowledged our - * FIN. This is indicated by the UIP_ACKDATA flag. + * FIN. This is indicated by the TCP_ACKDATA flag. */ - if ((flags & UIP_ACKDATA) != 0) + if ((flags & TCP_ACKDATA) != 0) { conn->tcpstateflags = TCP_CLOSED; nllvdbg("TCP_LAST_ACK TCP state: TCP_CLOSED\n"); - (void)tcp_callback(dev, conn, UIP_CLOSE); + (void)tcp_callback(dev, conn, TCP_CLOSE); } break; @@ -763,7 +763,7 @@ found: if ((pbuf->flags & TCP_FIN) != 0) { - if ((flags & UIP_ACKDATA) != 0) + if ((flags & TCP_ACKDATA) != 0) { conn->tcpstateflags = TCP_TIME_WAIT; conn->timer = 0; @@ -777,11 +777,11 @@ found: } net_incr32(conn->rcvseq, 1); - (void)tcp_callback(dev, conn, UIP_CLOSE); + (void)tcp_callback(dev, conn, TCP_CLOSE); tcp_send(dev, conn, TCP_ACK, IPTCP_HDRLEN); return; } - else if ((flags & UIP_ACKDATA) != 0) + else if ((flags & TCP_ACKDATA) != 0) { conn->tcpstateflags = TCP_FIN_WAIT_2; conn->unacked = 0; @@ -810,7 +810,7 @@ found: nllvdbg("TCP state: TCP_TIME_WAIT\n"); net_incr32(conn->rcvseq, 1); - (void)tcp_callback(dev, conn, UIP_CLOSE); + (void)tcp_callback(dev, conn, TCP_CLOSE); tcp_send(dev, conn, TCP_ACK, IPTCP_HDRLEN); return; } @@ -828,7 +828,7 @@ found: return; case TCP_CLOSING: - if ((flags & UIP_ACKDATA) != 0) + if ((flags & TCP_ACKDATA) != 0) { conn->tcpstateflags = TCP_TIME_WAIT; conn->timer = 0; diff --git a/net/tcp/tcp_listen.c b/net/tcp/tcp_listen.c index a62e628dc2..dbe56b9f2a 100644 --- a/net/tcp/tcp_listen.c +++ b/net/tcp/tcp_listen.c @@ -279,7 +279,7 @@ int tcp_accept_connection(FAR struct net_driver_s *dev, ret = tcp_backlogadd(listener, conn); if (ret == OK) { - (void)tcp_callback(dev, listener, UIP_BACKLOG); + (void)tcp_callback(dev, listener, TCP_BACKLOG); } } #endif diff --git a/net/tcp/tcp_poll.c b/net/tcp/tcp_poll.c index 4899e47d45..ad10129706 100644 --- a/net/tcp/tcp_poll.c +++ b/net/tcp/tcp_poll.c @@ -111,7 +111,7 @@ void tcp_poll(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn) /* Perform the callback */ - result = tcp_callback(dev, conn, UIP_POLL); + result = tcp_callback(dev, conn, TCP_POLL); /* Handle the callback response */ diff --git a/net/tcp/tcp_send_buffered.c b/net/tcp/tcp_send_buffered.c index cdce9ddd67..bb0eb729f4 100644 --- a/net/tcp/tcp_send_buffered.c +++ b/net/tcp/tcp_send_buffered.c @@ -199,7 +199,7 @@ static inline void psock_lost_connection(FAR struct socket *psock, * * Description: * This function is called from the interrupt level to perform the actual - * send operation when polled by the uIP layer. + * send operation when polled by the lower, device interfacing layer. * * Parameters: * dev The structure of the network driver that caused the interrupt @@ -227,7 +227,7 @@ static uint16_t psock_send_interrupt(FAR struct net_driver_s *dev, * acknowledged bytes. */ - if ((flags & UIP_ACKDATA) != 0) + if ((flags & TCP_ACKDATA) != 0) { FAR struct tcp_wrbuffer_s *wrb; FAR sq_entry_t *entry; @@ -346,7 +346,7 @@ static uint16_t psock_send_interrupt(FAR struct net_driver_s *dev, /* Check for a loss of connection */ - else if ((flags & (UIP_CLOSE | UIP_ABORT | UIP_TIMEDOUT)) != 0) + else if ((flags & (TCP_CLOSE | TCP_ABORT | TCP_TIMEDOUT)) != 0) { nllvdbg("Lost connection: %04x\n", flags); @@ -362,7 +362,7 @@ static uint16_t psock_send_interrupt(FAR struct net_driver_s *dev, /* Check if we are being asked to retransmit data */ - else if ((flags & UIP_REXMIT) != 0) + else if ((flags & TCP_REXMIT) != 0) { FAR struct tcp_wrbuffer_s *wrb; FAR sq_entry_t *entry; @@ -527,7 +527,7 @@ static uint16_t psock_send_interrupt(FAR struct net_driver_s *dev, */ if ((conn->tcpstateflags & TCP_ESTABLISHED) && - (flags & (UIP_POLL | UIP_REXMIT)) && + (flags & (TCP_POLL | TCP_REXMIT)) && !(sq_empty(&conn->write_q))) { /* Check if the destination IP address is in the ARP table. If not, @@ -648,7 +648,7 @@ static uint16_t psock_send_interrupt(FAR struct net_driver_s *dev, * tell the caller stop polling the other connection. */ - flags &= ~UIP_POLL; + flags &= ~TCP_POLL; } } @@ -774,8 +774,8 @@ ssize_t psock_tcp_send(FAR struct socket *psock, FAR const void *buf, /* Set up the callback in the connection */ - psock->s_sndcb->flags = (UIP_ACKDATA | UIP_REXMIT |UIP_POLL | \ - UIP_CLOSE | UIP_ABORT | UIP_TIMEDOUT); + psock->s_sndcb->flags = (TCP_ACKDATA | TCP_REXMIT | TCP_POLL | + TCP_CLOSE | TCP_ABORT | TCP_TIMEDOUT); psock->s_sndcb->priv = (void*)psock; psock->s_sndcb->event = psock_send_interrupt; diff --git a/net/tcp/tcp_send_unbuffered.c b/net/tcp/tcp_send_unbuffered.c index aaa19c74cc..aa5f87413c 100644 --- a/net/tcp/tcp_send_unbuffered.c +++ b/net/tcp/tcp_send_unbuffered.c @@ -148,7 +148,7 @@ static inline int send_timeout(FAR struct send_s *pstate) * * Description: * This function is called from the interrupt level to perform the actual - * send operation when polled by the uIP layer. + * send operation when polled by the lower, device interfacing layer. * * Parameters: * dev The structure of the network driver that caused the interrupt @@ -177,7 +177,7 @@ static uint16_t tcpsend_interrupt(FAR struct net_driver_s *dev, * acknowledged bytes. */ - if ((flags & UIP_ACKDATA) != 0) + if ((flags & TCP_ACKDATA) != 0) { /* Update the timeout */ @@ -211,7 +211,7 @@ static uint16_t tcpsend_interrupt(FAR struct net_driver_s *dev, /* Check if we are being asked to retransmit data */ - else if ((flags & UIP_REXMIT) != 0) + else if ((flags & TCP_REXMIT) != 0) { /* Yes.. in this case, reset the number of bytes that have been sent * to the number of bytes that have been ACKed. @@ -232,7 +232,7 @@ static uint16_t tcpsend_interrupt(FAR struct net_driver_s *dev, /* Check for a loss of connection */ - else if ((flags & (UIP_CLOSE|UIP_ABORT|UIP_TIMEDOUT)) != 0) + else if ((flags & (TCP_CLOSE | TCP_ABORT | TCP_TIMEDOUT)) != 0) { /* Report not connected */ @@ -264,7 +264,7 @@ static uint16_t tcpsend_interrupt(FAR struct net_driver_s *dev, * next polling cycle. */ - if ((flags & UIP_NEWDATA) == 0 && pstate->snd_sent < pstate->snd_buflen) + if ((flags & TCP_NEWDATA) == 0 && pstate->snd_sent < pstate->snd_buflen) { uint32_t seqno; @@ -571,7 +571,8 @@ ssize_t psock_tcp_send(FAR struct socket *psock, #endif /* Set up the callback in the connection */ - state.snd_cb->flags = UIP_ACKDATA|UIP_REXMIT|UIP_POLL|UIP_CLOSE|UIP_ABORT|UIP_TIMEDOUT; + state.snd_cb->flags = (TCP_ACKDATA | TCP_REXMIT | TCP_POLL | + TCP_CLOSE | TCP_ABORT | TCP_TIMEDOUT); state.snd_cb->priv = (void*)&state; state.snd_cb->event = tcpsend_interrupt; diff --git a/net/tcp/tcp_timer.c b/net/tcp/tcp_timer.c index 2109f33c59..0a10fffbf1 100644 --- a/net/tcp/tcp_timer.c +++ b/net/tcp/tcp_timer.c @@ -130,7 +130,7 @@ void tcp_timer(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn, /* Notify upper layers about the timeout */ - result = tcp_callback(dev, conn, UIP_TIMEDOUT); + result = tcp_callback(dev, conn, TCP_TIMEDOUT); nllvdbg("TCP state: TCP_CLOSED\n"); } @@ -174,12 +174,12 @@ void tcp_timer(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn, conn->tcpstateflags = TCP_CLOSED; nllvdbg("TCP state: TCP_CLOSED\n"); - /* We call tcp_callback() with UIP_TIMEDOUT to + /* We call tcp_callback() with TCP_TIMEDOUT to * inform the application that the connection has * timed out. */ - result = tcp_callback(dev, conn, UIP_TIMEDOUT); + result = tcp_callback(dev, conn, TCP_TIMEDOUT); /* We also send a reset packet to the remote host. */ @@ -225,7 +225,7 @@ void tcp_timer(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn, * the code for sending out the packet. */ - result = tcp_callback(dev, conn, UIP_REXMIT); + result = tcp_callback(dev, conn, TCP_REXMIT); tcp_rexmit(dev, conn, result); goto done; @@ -248,7 +248,7 @@ void tcp_timer(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn, * application for new data. */ - result = tcp_callback(dev, conn, UIP_POLL); + result = tcp_callback(dev, conn, TCP_POLL); tcp_appsend(dev, conn, result); goto done; } diff --git a/net/udp/udp_input.c b/net/udp/udp_input.c index aaaa5a795e..07699c8f63 100644 --- a/net/udp/udp_input.c +++ b/net/udp/udp_input.c @@ -142,13 +142,13 @@ int udp_input(FAR struct net_driver_s *dev) /* Perform the application callback */ - flags = udp_callback(dev, conn, UIP_NEWDATA); + flags = udp_callback(dev, conn, UDP_NEWDATA); - /* If the operation was successful, the UIP_NEWDATA flag is removed + /* If the operation was successful, the UDP_NEWDATA flag is removed * and thus the packet can be deleted (OK will be returned). */ - if ((flags & UIP_NEWDATA) != 0) + if ((flags & UDP_NEWDATA) != 0) { /* No.. the packet was not processed now. Return ERROR so * that the driver may retry again later. diff --git a/net/udp/udp_poll.c b/net/udp/udp_poll.c index 03f395952b..1007adff03 100644 --- a/net/udp/udp_poll.c +++ b/net/udp/udp_poll.c @@ -108,7 +108,7 @@ void udp_poll(FAR struct net_driver_s *dev, FAR struct udp_conn_s *conn) /* Perform the application callback */ - (void)udp_callback(dev, conn, UIP_POLL); + (void)udp_callback(dev, conn, UDP_POLL); /* If the application has data to send, setup the UDP/IP header */