return RES_OK;\r
}\r
#endif /* _READONLY */\r
-\r
-\r
-\r
-/*-----------------------------------------------------------------------*/\r
-/* Miscellaneous Functions */\r
-\r
-DRESULT disk_ioctl (\r
- BYTE drv, /* Physical drive nmuber (0..) */\r
- BYTE ctrl, /* Control code */\r
- void *buff /* Buffer to send/receive control data */\r
-)\r
-{\r
- if (ctrl == CTRL_SYNC)\r
- return RES_OK;\r
- else\r
- return RES_PARERR;\r
-}\r
-\r
-\r
-DWORD get_fattime (void)\r
-{\r
- return ((DWORD)1 << 25) |\r
- ((DWORD)1 << 21) |\r
- ((DWORD)1 << 16) |\r
- ((DWORD)1 << 11) |\r
- ((DWORD)1 << 5) |\r
- ((DWORD)1 << 0);\r
-}\r
#ifndef _DISKIO\r
\r
#define _READONLY 0 /* 1: Read-only mode */\r
-#define _USE_IOCTL 1\r
+#define _USE_IOCTL 0\r
\r
#include "integer.h"\r
#include "ff.h"\r
/** \file\r
*\r
* Simple HTTP Webserver Application. When connected to the uIP stack,\r
- * this will serve out files to HTTP clients.\r
+ * this will serve out files to HTTP clients on port 80.\r
*/\r
\r
#define INCLUDE_FROM_HTTPSERVERAPP_C\r
uip_tcp_appstate_t* const AppState = &uip_conn->appstate;\r
char* const AppData = (char*)uip_appdata;\r
\r
- /* Must determine the maximum segment size to determine maximum file chunk size */\r
- uint16_t MaxSegmentSize = uip_mss();\r
+ /* Must determine the maximum segment size to determine maximum file chunk size - never send a completely\r
+ * full packet, as this will cause some hosts to start delaying ACKs until a non-full packet is received.\r
+ * since uIP only allows one packet to be in transit at a time, this would cause long delays between packets\r
+ * until the host times out and sends the ACK for the last received packet.\r
+ */\r
+ uint16_t MaxSegmentSize = (uip_mss() >> 1);\r
\r
/* Return file pointer to the last ACKed position */\r
f_lseek(&AppState->HTTPServer.FileHandle, AppState->HTTPServer.ACKedFilePos);\r
/** \file\r
*\r
* TELNET Webserver Application. When connected to the uIP stack,\r
- * this will serve out connection information to the client.\r
+ * this will serve out raw TELNET to the client on port 23.\r
*/\r
\r
#define INCLUDE_FROM_TELNETSERVERAPP_C\r
\r
/** Main TELNET menu, giving the user the list of available commands they may issue */\r
const char PROGMEM TELNETMenu[] = "\r\n"\r
- " Available Commands:\r\n"\r
+ " == Available Commands: ==\r\n"\r
" c) List Active TCP Connections\r\n"\r
- "\r\nCommand>";\r
+ " =========================\r\n"\r
+ "\r\n>";\r
+ \r
+/** Header to print before the current connections are printed to the client */\r
+const char PROGMEM CurrentConnectionsHeader = "\r\n* Current TCP Connections: *\r\n";\r
\r
/** Initialization function for the simple HTTP webserver. */\r
void TELNETServerApp_Init(void)\r
\r
if (uip_connected())\r
{\r
+ /* New connection - initialize connection state values */\r
AppState->TELNETServer.CurrentState = TELNET_STATE_SendHeader;\r
}\r
\r
if (uip_acked())\r
{\r
+ /* Progress to the next state once the current state's data has been ACKed */\r
AppState->TELNETServer.CurrentState = AppState->TELNETServer.NextState; \r
}\r
\r
{\r
char* const AppData = (char*)uip_appdata;\r
\r
- strcpy(AppData, "\r\n* Current TCP Connections: *\r\n");\r
+ strcpy_P(AppData, CurrentConnectionsHeader);\r
\r
uint16_t ResponseLen = strlen(AppData);\r
uint8_t ActiveConnCount = 0;\r
uint8_t CurrentState;
uint8_t NextState;
- char FileName[50];
+ char FileName[MAX_URI_LENGTH];
FIL FileHandle;
bool FileOpen;
uint32_t ACKedFilePos;
* To use this project, plug the USB AVR into a computer, so that it enumerates as a standard Mass Storage device. Load\r
* HTML files onto the disk, so that they can be served out to clients -- the default file to serve should be called\r
* <i>index.htm</i>. Filenames must be in 8.3 format for them to be retrieved correctly by the webserver, and the total\r
- * requested file path must be equal to or less than 50 characters (set in uipopt.h).\r
+ * requested file path must be equal to or less than the maximum URI length (\see \ref SSec_Options).\r
*\r
* When attached to a RNDIS class device, such as a USB (desktop) modem, the system will enumerate the device, set the\r
* appropriate parameters needed for connectivity and begin listening for new HTTP connections on port 80 and TELNET\r
* <td>Default routing gateway that the webserver should use when connected to a RNDIS device (when ENABLE_DHCP_CLIENT\r
* is not defined).</td>\r
* </tr>\r
+ * <tr>\r
+ * <td>MAX_URI_LENGTH</td>\r
+ * <td>Makefile CDEFS</td>\r
+ * <td>Maximum length of a URI for the Webserver. This is the maximum file path, including subdirectories and seperators.</td>\r
+ * </tr>\r
* </table>\r
*/
\ No newline at end of file
# Place -D or -U options here for C sources\r
CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD) $(LUFA_OPTS)\r
CDEFS += -DENABLE_DHCP_CLIENT\r
+CDEFS += -DMAX_URI_LENGTH=50\r
\r
-CDEFS += -DUIP_CONF_UDP="defined(ENABLE_DHCP_CLIENT)" -DUIP_CONF_TCP=1 -DUIP_CONF_UDP_CONNS=1 -DUIP_CONF_MAX_CONNECTIONS=5\r
+CDEFS += -DUIP_CONF_UDP="defined(ENABLE_DHCP_CLIENT)" -DUIP_CONF_TCP=1 -DUIP_CONF_UDP_CONNS=1 -DUIP_CONF_MAX_CONNECTIONS=3\r
CDEFS += -DUIP_CONF_MAX_LISTENPORTS=5 -DUIP_URGDATA=0 -DUIP_CONF_BUFFER_SIZE=1514 -DUIP_ARCH_CHKSUM=0 \r
CDEFS += -DUIP_CONF_LL_802154=0 -DUIP_CONF_LL_80211=0 -DUIP_CONF_ROUTER=0 -DUIP_CONF_ICMP6=0\r
CDEFS += -DUIP_ARCH_ADD32=0 -DUIP_CONF_ICMP_DEST_UNREACH=1 -DUIP_NEIGHBOR_CONF_ADDRTYPE=0\r