diff options
Diffstat (limited to 'Projects/Webserver/Lib/uIPManagement.c')
| -rw-r--r-- | Projects/Webserver/Lib/uIPManagement.c | 39 | 
1 files changed, 36 insertions, 3 deletions
| diff --git a/Projects/Webserver/Lib/uIPManagement.c b/Projects/Webserver/Lib/uIPManagement.c index e207d9ce1..a2cadd674 100644 --- a/Projects/Webserver/Lib/uIPManagement.c +++ b/Projects/Webserver/Lib/uIPManagement.c @@ -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)
  {
 | 
