Change over static strings in the Webserver project to use PROGMEM where possible.
* - Increased the speed of both software and hardware TPI/PDI programming modes of the AVRISP project\r
* - Added a timeout value to the TWI_StartTransmission() function, within which the addressed device must respond\r
* - Webserver project now uses the board LEDs to indicate the current IP configuration state\r
+ * - Added ENABLE_TELNET_SERVER compile time option to the Webserver project to disable the TELNET server if desired\r
*\r
* <b>Fixed:</b>\r
* - Fixed software PDI/TPI programming mode in the AVRISP project not correctly toggling just the clock pin\r
this software.\r
*/\r
\r
+#if defined(ENABLE_DHCP_CLIENT) || defined(__DOXYGEN__)\r
+\r
/** \file\r
*\r
* DHCP Client Application. When connected to the uIP stack, this will retrieve IP configuration settings from the\r
* DHCP server on the network.\r
*/\r
\r
+#define INCLUDE_FROM_DHCPCLIENTAPP_C\r
#include "DHCPClientApp.h"\r
\r
-#if defined(ENABLE_DHCP_CLIENT) || defined(__DOXYGEN__)\r
-\r
/** Initialization function for the DHCP client. */\r
void DHCPClientApp_Init(void)\r
{\r
*\r
* \return Size in bytes of the created DHCP packet\r
*/\r
-uint16_t DHCPClientApp_FillDHCPHeader(DHCP_Header_t* DHCPHeader, uint8_t DHCPMessageType, uip_udp_appstate_t* AppState)\r
+static uint16_t DHCPClientApp_FillDHCPHeader(DHCP_Header_t* DHCPHeader, uint8_t DHCPMessageType, uip_udp_appstate_t* AppState)\r
{\r
/* Erase existing packet data so that we start will all 0x00 DHCP header data */\r
memset(DHCPHeader, 0, sizeof(DHCP_Header_t));\r
*\r
* \return Number of bytes added to the DHCP packet\r
*/\r
-uint8_t DHCPClientApp_SetOption(uint8_t* DHCPOptionList, uint8_t Option, uint8_t DataLen, void* OptionData)\r
+static uint8_t DHCPClientApp_SetOption(uint8_t* DHCPOptionList, uint8_t Option, uint8_t DataLen, void* OptionData)\r
{\r
/* Skip through the DHCP options list until the terminator option is found */\r
while (*DHCPOptionList != DHCP_OPTION_END)\r
*\r
* \return Boolean true if the option was found in the DHCP packet's options list, false otherwise\r
*/\r
-bool DHCPClientApp_GetOption(uint8_t* DHCPOptionList, uint8_t Option, void* Destination)\r
+static bool DHCPClientApp_GetOption(uint8_t* DHCPOptionList, uint8_t Option, void* Destination)\r
{\r
/* Look through the incoming DHCP packet's options list for the requested option */\r
while (*DHCPOptionList != DHCP_OPTION_END)\r
void DHCPClientApp_Init(void);\r
void DHCPClientApp_Callback(void);\r
\r
- uint16_t DHCPClientApp_FillDHCPHeader(DHCP_Header_t* DHCPHeader, uint8_t DHCPMessageType, uip_udp_appstate_t* AppState);\r
- uint8_t DHCPClientApp_SetOption(uint8_t* DHCPOptionList, uint8_t Option, uint8_t DataLen, void* OptionData);\r
- bool DHCPClientApp_GetOption(uint8_t* DHCPOptionList, uint8_t Option, void* Destination);\r
- \r
+ #if defined(INCLUDE_FROM_DHCPCLIENTAPP_C)\r
+ static uint16_t DHCPClientApp_FillDHCPHeader(DHCP_Header_t* DHCPHeader, uint8_t DHCPMessageType,\r
+ uip_udp_appstate_t* AppState);\r
+ static uint8_t DHCPClientApp_SetOption(uint8_t* DHCPOptionList, uint8_t Option, uint8_t DataLen,\r
+ void* OptionData);\r
+ static bool DHCPClientApp_GetOption(uint8_t* DHCPOptionList, uint8_t Option, void* Destination);\r
+ #endif\r
#endif\r
"Content-Type: text/plain\r\n\r\n"\r
"Error 404: File Not Found: /";\r
\r
-/** Default MIME type sent if no other MIME type can be determined. */\r
-const char PROGMEM DefaultMIMEType[] = "text/plain";\r
-\r
/** Default filename to fetch when a directory is requested */\r
const char PROGMEM DefaultDirFileName[] = "index.htm";\r
\r
+/** Default MIME type sent if no other MIME type can be determined. */\r
+const char PROGMEM DefaultMIMEType[] = "text/plain";\r
+\r
/** List of MIME types for each supported file extension. */\r
const MIME_Type_t MIMETypes[] =\r
{\r
char* RequestedFileName = strtok(NULL, " ");\r
\r
/* Must be a GET request, abort otherwise */\r
- if (strcmp(RequestToken, "GET") != 0)\r
+ if (strcmp_P(RequestToken, PSTR("GET")) != 0)\r
{\r
uip_abort();\r
return;\r
}\r
\r
/* Add the end-of-line terminator and end-of-headers terminator after the MIME type */\r
- strcpy(&AppData[strlen(AppData)], "\r\n\r\n");\r
+ strcpy_P(&AppData[strlen(AppData)], PSTR("\r\n\r\n"));\r
\r
/* Send the MIME header to the receiving client */\r
uip_send(AppData, strlen(AppData));\r
this software.\r
*/\r
\r
+#if defined(ENABLE_TELNET_SERVER) || defined(__DOXYGEN__)\r
+\r
/** \file\r
*\r
* TELNET Webserver Application. When connected to the uIP stack,\r
TELNETServerApp_DisplayTCPConnections();\r
break;\r
default:\r
- strcpy(AppData, "Invalid Command.\r\n");\r
+ strcpy_P(AppData, PSTR("Invalid Command.\r\n"));\r
uip_send(AppData, strlen(AppData));\r
break;\r
}\r
if (CurrConnection->tcpstateflags != UIP_CLOSED)\r
{\r
/* Add the current connection's details to the out buffer */\r
- ResponseLen += sprintf(&AppData[ResponseLen], "%u) %02d.%02d.%02d.%02d (Local %u, Remote %u)\r\n",\r
- ++ActiveConnCount, CurrConnection->ripaddr.u8[0],\r
- CurrConnection->ripaddr.u8[1],\r
- CurrConnection->ripaddr.u8[2],\r
- CurrConnection->ripaddr.u8[3],\r
- HTONS(CurrConnection->lport), HTONS(CurrConnection->rport));\r
+ ResponseLen += sprintf_P(&AppData[ResponseLen], PSTR("%u) %02d.%02d.%02d.%02d (Local %u, Remote %u)\r\n"),\r
+ ++ActiveConnCount,\r
+ CurrConnection->ripaddr.u8[0],\r
+ CurrConnection->ripaddr.u8[1],\r
+ CurrConnection->ripaddr.u8[2],\r
+ CurrConnection->ripaddr.u8[3],\r
+ HTONS(CurrConnection->lport), HTONS(CurrConnection->rport));\r
}\r
}\r
\r
uip_send(AppData, ResponseLen);\r
-}
\ No newline at end of file
+}\r
+\r
+#endif\r
HTTPServerApp_Init();\r
\r
/* TELNET Server Initialization */\r
+ #if defined(ENABLE_TELNET_SERVER)\r
TELNETServerApp_Init();\r
+ #endif\r
}\r
\r
/** uIP Management function. This function manages the uIP stack when called while an RNDIS device has been\r
case HTONS(HTTP_SERVER_PORT):\r
HTTPServerApp_Callback();\r
break;\r
+ #if defined(ENABLE_TELNET_SERVER)\r
case HTONS(TELNET_SERVER_PORT):\r
TELNETServerApp_Callback();\r
break;\r
+ #endif\r
}\r
}\r
\r
* <td><b>Description:</b></td>\r
* </tr>\r
* <tr>\r
+ * <td>ENABLE_TELNET_SERVER</td>\r
+ * <td>Makefile CDEFS</td>\r
+ * <td>When defined, this enables the TELNET server in addition to the HTTP webserver, which listens for incomming connections\r
+ * and processes user commands.</td>\r
+ * </tr>\r
+ * <tr>\r
* <td>ENABLE_DHCP_CLIENT</td>\r
* <td>Makefile CDEFS</td>\r
* <td>When defined, this enables the DHCP client for dynamic IP allocation of the network settings from a DHCP server.</td>\r
# 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 += -DENABLE_TELNET_SERVER\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=3\r