Commit for the 100219 release.
[pub/USBasp.git] / Projects / Webserver / Lib / TELNETServerApp.c
index 7d8c907..d1f1d7f 100644 (file)
@@ -31,7 +31,7 @@
 /** \file\r
  *\r
  *  TELNET Webserver Application. When connected to the uIP stack,\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
  \r
 #define  INCLUDE_FROM_TELNETSERVERAPP_C\r
@@ -44,9 +44,13 @@ const char PROGMEM WelcomeHeader[] = "******************************************
 \r
 /** Main TELNET menu, giving the user the list of available commands they may issue */\r
 const char PROGMEM TELNETMenu[] = "\r\n"\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
                                   "     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
 /** Initialization function for the simple HTTP webserver. */\r
 void TELNETServerApp_Init(void)\r
@@ -65,11 +69,13 @@ void TELNETServerApp_Callback(void)
 \r
        if (uip_connected())\r
        {\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
                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
                AppState->TELNETServer.CurrentState = AppState->TELNETServer.NextState; \r
        }\r
 \r
@@ -124,7 +130,7 @@ static void TELNETServerApp_DisplayTCPConnections(void)
 {\r
        char* const AppData    = (char*)uip_appdata;\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
                                                        \r
        uint16_t ResponseLen     = strlen(AppData);\r
        uint8_t  ActiveConnCount = 0;\r