Commit 3b6987bc authored by Dean Camera's avatar Dean Camera
Browse files

Add uIP-split code to the Webserver project, so that each packet is split in...

Add uIP-split code to the Webserver project, so that each packet is split in half to avoid the delayed-ACK problem when communicating with other devices. Condense HTTP server code, so that the HTTP headers are all sent from the one state. Make default filename append to any directory URI, rather than just the root directory.
parent c77b30e9
This diff is collapsed.
...@@ -110,6 +110,7 @@ ISR(TIMER1_COMPA_vect, ISR_BLOCK) ...@@ -110,6 +110,7 @@ ISR(TIMER1_COMPA_vect, ISR_BLOCK)
/* Reset log tick counter to prepare for next logging interval */ /* Reset log tick counter to prepare for next logging interval */
CurrentLoggingTicks = 0; CurrentLoggingTicks = 0;
/* Only log when not connected to a USB host */
if (USB_DeviceState == DEVICE_STATE_Unattached) if (USB_DeviceState == DEVICE_STATE_Unattached)
{ {
uint8_t Day, Month, Year; uint8_t Day, Month, Year;
...@@ -139,15 +140,15 @@ int main(void) ...@@ -139,15 +140,15 @@ int main(void)
/* Fetch logging interval from EEPROM */ /* Fetch logging interval from EEPROM */
LoggingInterval500MS_SRAM = eeprom_read_byte(&LoggingInterval500MS_EEPROM); LoggingInterval500MS_SRAM = eeprom_read_byte(&LoggingInterval500MS_EEPROM);
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
SetupHardware(); SetupHardware();
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
/* Mount and open the log file on the dataflash FAT partition */ /* Mount and open the log file on the dataflash FAT partition */
OpenLogFile(); OpenLogFile();
/* Discard the first sample from the temperature sensor, as it is generally incorrect */ /* Discard the first sample from the temperature sensor, as it is generally incorrect */
uint8_t Dummy = Temperature_GetTemperature(); volatile uint8_t Dummy = Temperature_GetTemperature();
(void)Dummy; (void)Dummy;
for (;;) for (;;)
......
...@@ -54,11 +54,14 @@ const char PROGMEM HTTP404Header[] = "HTTP/1.1 404 Not Found\r\n" ...@@ -54,11 +54,14 @@ const char PROGMEM HTTP404Header[] = "HTTP/1.1 404 Not Found\r\n"
"Connection: close\r\n" "Connection: close\r\n"
"MIME-version: 1.0\r\n" "MIME-version: 1.0\r\n"
"Content-Type: text/plain\r\n\r\n" "Content-Type: text/plain\r\n\r\n"
"Error 404: File Not Found"; "Error 404: File Not Found: /";
/** Default MIME type sent if no other MIME type can be determined. */ /** Default MIME type sent if no other MIME type can be determined. */
const char PROGMEM DefaultMIMEType[] = "text/plain"; const char PROGMEM DefaultMIMEType[] = "text/plain";
/** Default filename to fetch when a directory is requested */
const char PROGMEM DefaultDirFileName[] = "index.htm";
/** List of MIME types for each supported file extension. */ /** List of MIME types for each supported file extension. */
const MIME_Type_t MIMETypes[] = const MIME_Type_t MIMETypes[] =
{ {
...@@ -125,6 +128,12 @@ void HTTPServerApp_Callback(void) ...@@ -125,6 +128,12 @@ void HTTPServerApp_Callback(void)
AppState->HTTPServer.CurrentState = AppState->HTTPServer.NextState; AppState->HTTPServer.CurrentState = AppState->HTTPServer.NextState;
} }
if (uip_rexmit())
{
/* Return file pointer to the last ACKed position */
f_lseek(&AppState->HTTPServer.FileHandle, AppState->HTTPServer.ACKedFilePos);
}
if (uip_rexmit() || uip_acked() || uip_newdata() || uip_connected() || uip_poll()) if (uip_rexmit() || uip_acked() || uip_newdata() || uip_connected() || uip_poll())
{ {
switch (AppState->HTTPServer.CurrentState) switch (AppState->HTTPServer.CurrentState)
...@@ -135,9 +144,6 @@ void HTTPServerApp_Callback(void) ...@@ -135,9 +144,6 @@ void HTTPServerApp_Callback(void)
case WEBSERVER_STATE_SendResponseHeader: case WEBSERVER_STATE_SendResponseHeader:
HTTPServerApp_SendResponseHeader(); HTTPServerApp_SendResponseHeader();
break; break;
case WEBSERVER_STATE_SendMIMETypeHeader:
HTTPServerApp_SendMIMETypeHeader();
break;
case WEBSERVER_STATE_SendData: case WEBSERVER_STATE_SendData:
HTTPServerApp_SendData(); HTTPServerApp_SendData();
break; break;
...@@ -163,6 +169,7 @@ static void HTTPServerApp_OpenRequestedFile(void) ...@@ -163,6 +169,7 @@ static void HTTPServerApp_OpenRequestedFile(void)
return; return;
char* RequestToken = strtok(AppData, " "); char* RequestToken = strtok(AppData, " ");
char* RequestedFileName = strtok(NULL, " ");
/* Must be a GET request, abort otherwise */ /* Must be a GET request, abort otherwise */
if (strcmp(RequestToken, "GET") != 0) if (strcmp(RequestToken, "GET") != 0)
...@@ -170,20 +177,26 @@ static void HTTPServerApp_OpenRequestedFile(void) ...@@ -170,20 +177,26 @@ static void HTTPServerApp_OpenRequestedFile(void)
uip_abort(); uip_abort();
return; return;
} }
char* RequestedFileName = strtok(NULL, " ");
/* If the requested filename has more that just the leading '/' path in it, copy it over */ /* Copy over the requested filename */
if (strlen(RequestedFileName) > 1) strncpy(AppState->HTTPServer.FileName, &RequestedFileName[1], (sizeof(AppState->HTTPServer.FileName) - 1));
strncpy(AppState->HTTPServer.FileName, &RequestedFileName[1], (sizeof(AppState->HTTPServer.FileName) - 1));
else
strcpy(AppState->HTTPServer.FileName, "index.htm");
/* Ensure filename is null-terminated */ /* Ensure filename is null-terminated */
AppState->HTTPServer.FileName[(sizeof(AppState->HTTPServer.FileName) - 1)] = 0x00; AppState->HTTPServer.FileName[(sizeof(AppState->HTTPServer.FileName) - 1)] = 0x00;
/* If the URI is a directory, append the default filename */
if (AppState->HTTPServer.FileName[strlen(AppState->HTTPServer.FileName) - 1] == '/')
{
strncpy_P(&AppState->HTTPServer.FileName[strlen(AppState->HTTPServer.FileName)], DefaultDirFileName,
(sizeof(AppState->HTTPServer.FileName) - (strlen(AppState->HTTPServer.FileName) + 1)));
/* Ensure altered filename is still null-terminated */
AppState->HTTPServer.FileName[(sizeof(AppState->HTTPServer.FileName) - 1)] = 0x00;
}
/* Try to open the file from the Dataflash disk */ /* Try to open the file from the Dataflash disk */
AppState->HTTPServer.FileOpen = (f_open(&AppState->HTTPServer.FileHandle, AppState->HTTPServer.FileName, FA_OPEN_EXISTING | FA_READ) == FR_OK); AppState->HTTPServer.FileOpen = (f_open(&AppState->HTTPServer.FileHandle, AppState->HTTPServer.FileName,
(FA_OPEN_EXISTING | FA_READ)) == FR_OK);
/* Lock to the SendResponseHeader state until connection terminated */ /* Lock to the SendResponseHeader state until connection terminated */
AppState->HTTPServer.CurrentState = WEBSERVER_STATE_SendResponseHeader; AppState->HTTPServer.CurrentState = WEBSERVER_STATE_SendResponseHeader;
...@@ -198,37 +211,25 @@ static void HTTPServerApp_SendResponseHeader(void) ...@@ -198,37 +211,25 @@ static void HTTPServerApp_SendResponseHeader(void)
uip_tcp_appstate_t* const AppState = &uip_conn->appstate; uip_tcp_appstate_t* const AppState = &uip_conn->appstate;
char* const AppData = (char*)uip_appdata; char* const AppData = (char*)uip_appdata;
const char* HeaderToSend; char* Extension = strpbrk(AppState->HTTPServer.FileName, ".");
bool FoundMIMEType = false;
/* Determine which HTTP header should be sent to the client */ /* If the file isn't already open, it wasn't found - send back a 404 error response and abort */
if (AppState->HTTPServer.FileOpen) if (!(AppState->HTTPServer.FileOpen))
{
HeaderToSend = HTTP200Header;
AppState->HTTPServer.NextState = WEBSERVER_STATE_SendMIMETypeHeader;
}
else
{ {
HeaderToSend = HTTP404Header; /* Copy over the HTTP 404 response header and send it to the receiving client */
strcpy_P(AppData, HTTP404Header);
strcpy(&AppData[strlen(AppData)], AppState->HTTPServer.FileName);
uip_send(AppData, strlen(AppData));
AppState->HTTPServer.NextState = WEBSERVER_STATE_Closing; AppState->HTTPServer.NextState = WEBSERVER_STATE_Closing;
return;
} }
/* Copy over the HTTP 200 response header and send it to the receiving client */
strcpy_P(AppData, HTTP200Header);
/* Copy over the HTTP response header and send it to the receiving client */ /* Check to see if a MIME type for the requested file's extension was found */
strcpy_P(AppData, HeaderToSend);
uip_send(AppData, strlen(AppData));
}
/** HTTP Server State handler for the MIME Header Send state. This state manages the transmission of the file
* MIME type header for the requested file to the receiving HTTP client.
*/
static void HTTPServerApp_SendMIMETypeHeader(void)
{
uip_tcp_appstate_t* const AppState = &uip_conn->appstate;
char* const AppData = (char*)uip_appdata;
char* Extension = strpbrk(AppState->HTTPServer.FileName, ".");
uint16_t MIMEHeaderLength = 0;
/* Check to see if a file extension was found for the requested filename */
if (Extension != NULL) if (Extension != NULL)
{ {
/* Look through the MIME type list, copy over the required MIME type if found */ /* Look through the MIME type list, copy over the required MIME type if found */
...@@ -236,27 +237,25 @@ static void HTTPServerApp_SendMIMETypeHeader(void) ...@@ -236,27 +237,25 @@ static void HTTPServerApp_SendMIMETypeHeader(void)
{ {
if (strcmp(&Extension[1], MIMETypes[i].Extension) == 0) if (strcmp(&Extension[1], MIMETypes[i].Extension) == 0)
{ {
MIMEHeaderLength = strlen(MIMETypes[i].MIMEType); strcpy(&AppData[strlen(AppData)], MIMETypes[i].MIMEType);
strncpy(AppData, MIMETypes[i].MIMEType, MIMEHeaderLength); FoundMIMEType = true;
break; break;
} }
} }
} }
/* Check if a MIME type was found and copied to the output buffer */ /* Check if a MIME type was found and copied to the output buffer */
if (!(MIMEHeaderLength)) if (!(FoundMIMEType))
{ {
/* MIME type not found - copy over the default MIME type */ /* MIME type not found - copy over the default MIME type */
MIMEHeaderLength = strlen_P(DefaultMIMEType); strcpy_P(&AppData[strlen(AppData)], DefaultMIMEType);
strncpy_P(AppData, DefaultMIMEType, MIMEHeaderLength);
} }
/* Add the end-of line terminator and end-of-headers terminator after the MIME type */ /* Add the end-of line terminator and end-of-headers terminator after the MIME type */
strncpy(&AppData[MIMEHeaderLength], "\r\n\r\n", sizeof("\r\n\r\n")); strcpy(&AppData[strlen(AppData)], "\r\n\r\n");
MIMEHeaderLength += (sizeof("\r\n\r\n") - 1);
/* Send the MIME header to the receiving client */ /* Send the MIME header to the receiving client */
uip_send(AppData, MIMEHeaderLength); uip_send(AppData, strlen(AppData));
/* When the MIME header is ACKed, progress to the data send stage */ /* When the MIME header is ACKed, progress to the data send stage */
AppState->HTTPServer.NextState = WEBSERVER_STATE_SendData; AppState->HTTPServer.NextState = WEBSERVER_STATE_SendData;
...@@ -270,22 +269,16 @@ static void HTTPServerApp_SendData(void) ...@@ -270,22 +269,16 @@ static void HTTPServerApp_SendData(void)
uip_tcp_appstate_t* const AppState = &uip_conn->appstate; uip_tcp_appstate_t* const AppState = &uip_conn->appstate;
char* const AppData = (char*)uip_appdata; char* const AppData = (char*)uip_appdata;
/* Must determine the maximum segment size to determine maximum file chunk size - never send a completely /* Get the maximum segment size for the current packet */
* full packet, as this will cause some hosts to start delaying ACKs until a non-full packet is received. uint16_t MaxChunkSize = uip_mss();
* since uIP only allows one packet to be in transit at a time, this would cause long delays between packets
* until the host times out and sends the ACK for the last received packet.
*/
uint16_t MaxSegmentSize = (uip_mss() >> 1);
/* Return file pointer to the last ACKed position */
f_lseek(&AppState->HTTPServer.FileHandle, AppState->HTTPServer.ACKedFilePos);
/* Read the next chunk of data from the open file */ /* Read the next chunk of data from the open file */
f_read(&AppState->HTTPServer.FileHandle, AppData, MaxSegmentSize, &AppState->HTTPServer.SentChunkSize); f_read(&AppState->HTTPServer.FileHandle, AppData, MaxChunkSize, &AppState->HTTPServer.SentChunkSize);
/* Send the next file chunk to the receiving client */ /* Send the next file chunk to the receiving client */
uip_send(AppData, AppState->HTTPServer.SentChunkSize); uip_send(AppData, AppState->HTTPServer.SentChunkSize);
/* Check if we are at the last chunk of the file, if so next ACK should close the connection */ /* Check if we are at the last chunk of the file, if so next ACK should close the connection */
AppState->HTTPServer.NextState = (MaxSegmentSize != AppState->HTTPServer.SentChunkSize) ? WEBSERVER_STATE_Closing : WEBSERVER_STATE_SendData; if (MaxChunkSize != AppState->HTTPServer.SentChunkSize)
AppState->HTTPServer.NextState = WEBSERVER_STATE_Closing;
} }
...@@ -51,7 +51,6 @@ ...@@ -51,7 +51,6 @@
{ {
WEBSERVER_STATE_OpenRequestedFile, /**< Currently opening requested file */ WEBSERVER_STATE_OpenRequestedFile, /**< Currently opening requested file */
WEBSERVER_STATE_SendResponseHeader, /**< Currently sending HTTP response headers to the client */ WEBSERVER_STATE_SendResponseHeader, /**< Currently sending HTTP response headers to the client */
WEBSERVER_STATE_SendMIMETypeHeader, /**< Currently sending HTTP MIME type header to the client */
WEBSERVER_STATE_SendData, /**< Currently sending HTTP page data to the client */ WEBSERVER_STATE_SendData, /**< Currently sending HTTP page data to the client */
WEBSERVER_STATE_Closing, /**< Ready to close the connection to the client */ WEBSERVER_STATE_Closing, /**< Ready to close the connection to the client */
WEBSERVER_STATE_Closed, /**< Connection closed after all data sent */ WEBSERVER_STATE_Closed, /**< Connection closed after all data sent */
...@@ -76,7 +75,6 @@ ...@@ -76,7 +75,6 @@
#if defined(INCLUDE_FROM_HTTPSERVERAPP_C) #if defined(INCLUDE_FROM_HTTPSERVERAPP_C)
static void HTTPServerApp_OpenRequestedFile(void); static void HTTPServerApp_OpenRequestedFile(void);
static void HTTPServerApp_SendResponseHeader(void); static void HTTPServerApp_SendResponseHeader(void);
static void HTTPServerApp_SendMIMETypeHeader(void);
static void HTTPServerApp_SendData(void); static void HTTPServerApp_SendData(void);
#endif #endif
......
...@@ -52,7 +52,7 @@ void uIPManagement_Init(void) ...@@ -52,7 +52,7 @@ void uIPManagement_Init(void)
{ {
/* uIP Timing Initialization */ /* uIP Timing Initialization */
clock_init(); clock_init();
timer_set(&ConnectionTimer, CLOCK_SECOND / 10); timer_set(&ConnectionTimer, CLOCK_SECOND / 5);
timer_set(&ARPTimer, CLOCK_SECOND * 10); timer_set(&ARPTimer, CLOCK_SECOND * 10);
/* uIP Stack Initialization */ /* uIP Stack Initialization */
...@@ -153,7 +153,7 @@ static void uIPManagement_ProcessIncomingPacket(void) ...@@ -153,7 +153,7 @@ static void uIPManagement_ProcessIncomingPacket(void)
/* Add destination MAC to outgoing packet */ /* Add destination MAC to outgoing packet */
uip_arp_out(); uip_arp_out();
RNDIS_Host_SendPacket(&Ethernet_RNDIS_Interface, uip_buf, uip_len); uip_split_output();
} }
break; break;
...@@ -163,7 +163,7 @@ static void uIPManagement_ProcessIncomingPacket(void) ...@@ -163,7 +163,7 @@ static void uIPManagement_ProcessIncomingPacket(void)
/* If a response was generated, send it */ /* If a response was generated, send it */
if (uip_len > 0) if (uip_len > 0)
RNDIS_Host_SendPacket(&Ethernet_RNDIS_Interface, uip_buf, uip_len); uip_split_output();
break; break;
} }
...@@ -186,7 +186,8 @@ static void uIPManagement_ManageConnections(void) ...@@ -186,7 +186,8 @@ static void uIPManagement_ManageConnections(void)
/* Add destination MAC to outgoing packet */ /* Add destination MAC to outgoing packet */
uip_arp_out(); uip_arp_out();
RNDIS_Host_SendPacket(&Ethernet_RNDIS_Interface, uip_buf, uip_len); /* Split and send the outgoing packet */
uip_split_output();
} }
} }
...@@ -208,7 +209,8 @@ static void uIPManagement_ManageConnections(void) ...@@ -208,7 +209,8 @@ static void uIPManagement_ManageConnections(void)
/* Add destination MAC to outgoing packet */ /* Add destination MAC to outgoing packet */
uip_arp_out(); uip_arp_out();
RNDIS_Host_SendPacket(&Ethernet_RNDIS_Interface, uip_buf, uip_len); /* Split and send the outgoing packet */
uip_split_output();
} }
} }
...@@ -224,7 +226,8 @@ static void uIPManagement_ManageConnections(void) ...@@ -224,7 +226,8 @@ static void uIPManagement_ManageConnections(void)
/* Add destination MAC to outgoing packet */ /* Add destination MAC to outgoing packet */
uip_arp_out(); uip_arp_out();
RNDIS_Host_SendPacket(&Ethernet_RNDIS_Interface, uip_buf, uip_len); /* Split and send the outgoing packet */
uip_split_output();
} }
} }
#endif #endif
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include <uip.h> #include <uip.h>
#include <uip_arp.h> #include <uip_arp.h>
#include <uip-split.h>
#include <timer.h> #include <timer.h>
#include "Lib/DHCPClientApp.h" #include "Lib/DHCPClientApp.h"
......
/*
* Copyright (c) 2004, Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file is part of the Contiki operating system.
*
* Author: Adam Dunkels <adam@sics.se>
*
* $Id: uip-split.c,v 1.2 2008/10/14 13:39:12 julienabeille Exp $
*/
#include "uip-split.h"
#define BUF ((struct uip_tcpip_hdr *)&uip_buf[UIP_LLH_LEN])
/*-----------------------------------------------------------------------------*/
void
uip_split_output(void)
{
#if UIP_TCP
u16_t tcplen, len1, len2;
/* We only try to split maximum sized TCP segments. */
if(BUF->proto == UIP_PROTO_TCP && uip_len == UIP_BUFSIZE) {
tcplen = uip_len - UIP_TCPIP_HLEN - UIP_LLH_LEN;
/* Split the segment in two. If the original packet length was
odd, we make the second packet one byte larger. */
len1 = len2 = tcplen / 2;
if(len1 + len2 < tcplen) {
++len2;
}
/* Create the first packet. This is done by altering the length
field of the IP header and updating the checksums. */
uip_len = len1 + UIP_TCPIP_HLEN + UIP_LLH_LEN;
#if UIP_CONF_IPV6
/* For IPv6, the IP length field does not include the IPv6 IP header
length. */
BUF->len[0] = ((uip_len - UIP_IPH_LEN) >> 8);
BUF->len[1] = ((uip_len - UIP_IPH_LEN) & 0xff);
#else /* UIP_CONF_IPV6 */
BUF->len[0] = (uip_len - UIP_LLH_LEN) >> 8;
BUF->len[1] = (uip_len - UIP_LLH_LEN) & 0xff;
#endif /* UIP_CONF_IPV6 */
/* Recalculate the TCP checksum. */
BUF->tcpchksum = 0;
BUF->tcpchksum = ~(uip_tcpchksum());
#if !UIP_CONF_IPV6
/* Recalculate the IP checksum. */
BUF->ipchksum = 0;
BUF->ipchksum = ~(uip_ipchksum());
#endif /* UIP_CONF_IPV6 */
/* Transmit the first packet. */
/* uip_fw_output();*/
#if UIP_CONF_IPV6
tcpip_ipv6_output();
#else
RNDIS_Host_SendPacket(&Ethernet_RNDIS_Interface, uip_buf, uip_len);
#endif /* UIP_CONF_IPV6 */
/* Now, create the second packet. To do this, it is not enough to
just alter the length field, but we must also update the TCP
sequence number and point the uip_appdata to a new place in
memory. This place is detemined by the length of the first
packet (len1). */
uip_len = len2 + UIP_TCPIP_HLEN + UIP_LLH_LEN;
#if UIP_CONF_IPV6
/* For IPv6, the IP length field does not include the IPv6 IP header
length. */
BUF->len[0] = ((uip_len - UIP_IPH_LEN) >> 8);
BUF->len[1] = ((uip_len - UIP_IPH_LEN) & 0xff);
#else /* UIP_CONF_IPV6 */
BUF->len[0] = (uip_len - UIP_LLH_LEN) >> 8;
BUF->len[1] = (uip_len - UIP_LLH_LEN) & 0xff;
#endif /* UIP_CONF_IPV6 */
/* uip_appdata += len1;*/
memcpy(uip_appdata, (u8_t *)uip_appdata + len1, len2);
uip_add32(BUF->seqno, len1);
BUF->seqno[0] = uip_acc32[0];
BUF->seqno[1] = uip_acc32[1];
BUF->seqno[2] = uip_acc32[2];
BUF->seqno[3] = uip_acc32[3];
/* Recalculate the TCP checksum. */
BUF->tcpchksum = 0;
BUF->tcpchksum = ~(uip_tcpchksum());
#if !UIP_CONF_IPV6
/* Recalculate the IP checksum. */
BUF->ipchksum = 0;
BUF->ipchksum = ~(uip_ipchksum());
#endif /* UIP_CONF_IPV6 */
/* Transmit the second packet. */
/* uip_fw_output();*/
#if UIP_CONF_IPV6
tcpip_ipv6_output();
#else
RNDIS_Host_SendPacket(&Ethernet_RNDIS_Interface, uip_buf, uip_len);
//tcpip_output();
#endif /* UIP_CONF_IPV6 */
return;
}
#endif /* UIP_TCP */
/* uip_fw_output();*/
#if UIP_CONF_IPV6
tcpip_ipv6_output();
#else
RNDIS_Host_SendPacket(&Ethernet_RNDIS_Interface, uip_buf, uip_len);
#endif /* UIP_CONF_IPV6 */
}
/*-----------------------------------------------------------------------------*/
/*
* Copyright (c) 2004, Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file is part of the Contiki operating system.
*
* Author: Adam Dunkels <adam@sics.se>
*
* $Id: uip-split.h,v 1.1 2006/06/17 22:41:19 adamdunkels Exp $
*/
/**
* \addtogroup uip
* @{
*/
/**
* \defgroup uipsplit uIP TCP throughput booster hack
* @{
*
* The basic uIP TCP implementation only allows each TCP connection to
* have a single TCP segment in flight at any given time. Because of
* the delayed ACK algorithm employed by most TCP receivers, uIP's
* limit on the amount of in-flight TCP segments seriously reduces the