Add a TELNET server to the webserver project, which currently can list active TCP connections.

This commit is contained in:
Dean Camera 2010-02-03 10:39:33 +00:00
parent 77e86e7d82
commit 16ea5aa7a2
14 changed files with 383 additions and 106 deletions

View file

@ -58,10 +58,11 @@ void uIPManagement_Init(void)
/* uIP Stack Initialization */
uip_init();
uip_arp_init();
uip_setethaddr(MACAddress);
/* DHCP/Server IP Settings Initialization */
#if defined(ENABLE_DHCP)
DHCPApp_Init();
DHCPClientApp_Init();
#else
uip_ipaddr_t IPAddress, Netmask, GatewayIPAddress;
uip_ipaddr(&IPAddress, DEVICE_IP_ADDRESS[0], DEVICE_IP_ADDRESS[1], DEVICE_IP_ADDRESS[2], DEVICE_IP_ADDRESS[3]);
@ -71,11 +72,12 @@ void uIPManagement_Init(void)
uip_setnetmask(&Netmask);
uip_setdraddr(&GatewayIPAddress);
#endif
uip_setethaddr(MACAddress);
/* HTTP Webserver Initialization */
HTTPServerApp_Init();
/* TELNET Server Initialization */
TELNETServerApp_Init();
}
/** uIP Management function. This function manages the uIP stack when called while an RNDIS device has been
@ -90,6 +92,37 @@ void uIPManagement_ManageNetwork(void)
}
}
/** uIP TCP/IP network stack callback function for the processing of a given TCP connection. This routine dispatches
* to the appropriate TCP protocol application based on the connection's listen port number.
*/
void uIPManagement_TCPCallback(void)
{
/* Call the correct TCP application based on the port number the connection is listening on */
switch (uip_conn->lport)
{
case HTONS(HTTP_SERVER_PORT):
HTTPServerApp_Callback();
break;
case HTONS(TELNET_SERVER_PORT):
TELNETServerApp_Callback();
break;
}
}
/** uIP TCP/IP network stack callback function for the processing of a given UDP connection. This routine dispatches
* to the appropriate UDP protocol application based on the connection's listen port number.
*/
void uIPManagement_UDPCallback(void)
{
/* Call the correct UDP application based on the port number the connection is listening on */
switch (uip_udp_conn->lport)
{
case HTONS(DHCPC_CLIENT_PORT):
DHCPClientApp_Callback();
break;
}
}
/** Processes incomming packets to the server from the connected RNDIS device, creating responses as needed. */
static void uIPManagement_ProcessIncommingPacket(void)
{