Added ENABLE_TELNET_SERVER compile time option to the Webserver project to disable the TELNET server if desired.

Change over static strings in the Webserver project to use PROGMEM where possible.
This commit is contained in:
Dean Camera 2010-03-10 12:48:20 +00:00
parent 92418433a5
commit aca7863350
8 changed files with 43 additions and 22 deletions

View file

@ -28,6 +28,8 @@
this software.
*/
#if defined(ENABLE_TELNET_SERVER) || defined(__DOXYGEN__)
/** \file
*
* TELNET Webserver Application. When connected to the uIP stack,
@ -114,7 +116,7 @@ void TELNETServerApp_Callback(void)
TELNETServerApp_DisplayTCPConnections();
break;
default:
strcpy(AppData, "Invalid Command.\r\n");
strcpy_P(AppData, PSTR("Invalid Command.\r\n"));
uip_send(AppData, strlen(AppData));
break;
}
@ -144,14 +146,17 @@ static void TELNETServerApp_DisplayTCPConnections(void)
if (CurrConnection->tcpstateflags != UIP_CLOSED)
{
/* Add the current connection's details to the out buffer */
ResponseLen += sprintf(&AppData[ResponseLen], "%u) %02d.%02d.%02d.%02d (Local %u, Remote %u)\r\n",
++ActiveConnCount, CurrConnection->ripaddr.u8[0],
CurrConnection->ripaddr.u8[1],
CurrConnection->ripaddr.u8[2],
CurrConnection->ripaddr.u8[3],
HTONS(CurrConnection->lport), HTONS(CurrConnection->rport));
ResponseLen += sprintf_P(&AppData[ResponseLen], PSTR("%u) %02d.%02d.%02d.%02d (Local %u, Remote %u)\r\n"),
++ActiveConnCount,
CurrConnection->ripaddr.u8[0],
CurrConnection->ripaddr.u8[1],
CurrConnection->ripaddr.u8[2],
CurrConnection->ripaddr.u8[3],
HTONS(CurrConnection->lport), HTONS(CurrConnection->rport));
}
}
uip_send(AppData, ResponseLen);
}
}
#endif