#include "Webserver.h"
+ #include "Lib/uIPManagement.h"
#include "Descriptors.h"
#include "Lib/SCSI.h"
+ /* External Variables: */
+ extern USB_ClassInfo_RNDIS_Device_t Ethernet_RNDIS_Interface_Device;
+
/* Function Prototypes: */
void USBDeviceMode_USBTask(void);
diff --git a/Projects/Webserver/USBHostMode.c b/Projects/Webserver/USBHostMode.c
index 941ebba8dfe..1fcec3491b1 100644
--- a/Projects/Webserver/USBHostMode.c
+++ b/Projects/Webserver/USBHostMode.c
@@ -40,7 +40,7 @@
* passed to all RNDIS Class driver functions, so that multiple instances of the same class
* within a device can be differentiated from one another.
*/
-USB_ClassInfo_RNDIS_Host_t Ethernet_RNDIS_Interface =
+USB_ClassInfo_RNDIS_Host_t Ethernet_RNDIS_Interface_Host =
{
.Config =
{
@@ -82,7 +82,7 @@ void USBHostMode_USBTask(void)
break;
}
- if (RNDIS_Host_ConfigurePipes(&Ethernet_RNDIS_Interface,
+ if (RNDIS_Host_ConfigurePipes(&Ethernet_RNDIS_Interface_Host,
ConfigDescriptorSize, ConfigDescriptorData) != RNDIS_ENUMERROR_NoError)
{
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
@@ -97,7 +97,7 @@ void USBHostMode_USBTask(void)
break;
}
- if (RNDIS_Host_InitializeDevice(&Ethernet_RNDIS_Interface) != HOST_SENDCONTROL_Successful)
+ if (RNDIS_Host_InitializeDevice(&Ethernet_RNDIS_Interface_Host) != HOST_SENDCONTROL_Successful)
{
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
@@ -105,7 +105,7 @@ void USBHostMode_USBTask(void)
}
uint32_t PacketFilter = (REMOTE_NDIS_PACKET_DIRECTED | REMOTE_NDIS_PACKET_BROADCAST);
- if (RNDIS_Host_SetRNDISProperty(&Ethernet_RNDIS_Interface, OID_GEN_CURRENT_PACKET_FILTER,
+ if (RNDIS_Host_SetRNDISProperty(&Ethernet_RNDIS_Interface_Host, OID_GEN_CURRENT_PACKET_FILTER,
&PacketFilter, sizeof(PacketFilter)) != HOST_SENDCONTROL_Successful)
{
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
@@ -113,7 +113,7 @@ void USBHostMode_USBTask(void)
break;
}
- if (RNDIS_Host_QueryRNDISProperty(&Ethernet_RNDIS_Interface, OID_802_3_CURRENT_ADDRESS,
+ if (RNDIS_Host_QueryRNDISProperty(&Ethernet_RNDIS_Interface_Host, OID_802_3_CURRENT_ADDRESS,
&MACAddress, sizeof(MACAddress)) != HOST_SENDCONTROL_Successful)
{
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
@@ -133,7 +133,7 @@ void USBHostMode_USBTask(void)
break;
}
- RNDIS_Host_USBTask(&Ethernet_RNDIS_Interface);
+ RNDIS_Host_USBTask(&Ethernet_RNDIS_Interface_Host);
}
/** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and
diff --git a/Projects/Webserver/USBHostMode.h b/Projects/Webserver/USBHostMode.h
index fa914013fcc..bb710707352 100644
--- a/Projects/Webserver/USBHostMode.h
+++ b/Projects/Webserver/USBHostMode.h
@@ -43,7 +43,7 @@
#include "Lib/uIPManagement.h"
/* External Variables: */
- extern USB_ClassInfo_RNDIS_Host_t Ethernet_RNDIS_Interface;
+ extern USB_ClassInfo_RNDIS_Host_t Ethernet_RNDIS_Interface_Host;
/* Function Prototypes: */
void USBHostMode_USBTask(void);
diff --git a/Projects/Webserver/Webserver.aps b/Projects/Webserver/Webserver.aps
index aaf3114f988..4c47287d036 100644
--- a/Projects/Webserver/Webserver.aps
+++ b/Projects/Webserver/Webserver.aps
@@ -1 +1 @@
-Webserver13-Jul-2010 14:36:1913-Jul-2010 14:37:18241013-Jul-2010 14:36:1944, 18, 0, 685AVR GCCWebserver.elfC:\Users\Dean\Documents\Electronics\Projects\WORK\LUFAWORK\Projects\Webserver\falseR00R01R02R03R04R05R06R07R08R09R10R11R12R13R14R15R16R17R18R19R20R21R22R23R24R25R26R27R28R29R30R31000Descriptors.cUSBDeviceMode.cUSBHostMode.cWebserver.cLib\DataflashManager.cLib\DHCPClientApp.cLib\HTTPServerApp.cLib\SCSI.cLib\TELNETServerApp.cLib\uIPManagement.cDescriptors.hUSBDeviceMode.hUSBHostMode.hWebserver.hLib\DataflashManager.hLib\DHCPClientApp.hLib\HTTPServerApp.hLib\SCSI.hLib\TELNETServerApp.hLib\uIPManagement.hmakefiledefaultYESmakefileatmega12811
Webserver.elfdefault\1-Wall -gdwarf-2 -std=gnu99 -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enumsdefault1C:\WinAVR-20100110\bin\avr-gcc.exeC:\WinAVR-20100110\utils\bin\make.exeC:\Users\Dean\Documents\Electronics\Projects\WORK\LUFAWORK\Projects\Webserver\Descriptors.hC:\Users\Dean\Documents\Electronics\Projects\WORK\LUFAWORK\Projects\Webserver\USBDeviceMode.hC:\Users\Dean\Documents\Electronics\Projects\WORK\LUFAWORK\Projects\Webserver\USBHostMode.hC:\Users\Dean\Documents\Electronics\Projects\WORK\LUFAWORK\Projects\Webserver\Webserver.hC:\Users\Dean\Documents\Electronics\Projects\WORK\LUFAWORK\Projects\Webserver\Lib\DataflashManager.hC:\Users\Dean\Documents\Electronics\Projects\WORK\LUFAWORK\Projects\Webserver\Lib\DHCPClientApp.hC:\Users\Dean\Documents\Electronics\Projects\WORK\LUFAWORK\Projects\Webserver\Lib\HTTPServerApp.hC:\Users\Dean\Documents\Electronics\Projects\WORK\LUFAWORK\Projects\Webserver\Lib\SCSI.hC:\Users\Dean\Documents\Electronics\Projects\WORK\LUFAWORK\Projects\Webserver\Lib\TELNETServerApp.hC:\Users\Dean\Documents\Electronics\Projects\WORK\LUFAWORK\Projects\Webserver\Lib\uIPManagement.hC:\Users\Dean\Documents\Electronics\Projects\WORK\LUFAWORK\Projects\Webserver\Descriptors.cC:\Users\Dean\Documents\Electronics\Projects\WORK\LUFAWORK\Projects\Webserver\USBDeviceMode.cC:\Users\Dean\Documents\Electronics\Projects\WORK\LUFAWORK\Projects\Webserver\USBHostMode.cC:\Users\Dean\Documents\Electronics\Projects\WORK\LUFAWORK\Projects\Webserver\Webserver.cC:\Users\Dean\Documents\Electronics\Projects\WORK\LUFAWORK\Projects\Webserver\Lib\DataflashManager.cC:\Users\Dean\Documents\Electronics\Projects\WORK\LUFAWORK\Projects\Webserver\Lib\DHCPClientApp.cC:\Users\Dean\Documents\Electronics\Projects\WORK\LUFAWORK\Projects\Webserver\Lib\HTTPServerApp.cC:\Users\Dean\Documents\Electronics\Projects\WORK\LUFAWORK\Projects\Webserver\Lib\SCSI.cC:\Users\Dean\Documents\Electronics\Projects\WORK\LUFAWORK\Projects\Webserver\Lib\TELNETServerApp.cC:\Users\Dean\Documents\Electronics\Projects\WORK\LUFAWORK\Projects\Webserver\Lib\uIPManagement.c
+Webserver13-Jul-2010 14:36:1913-Jul-2010 14:37:18241013-Jul-2010 14:36:1944, 18, 0, 685AVR GCCWebserver.elfC:\Users\Dean\Documents\Electronics\Projects\WORK\LUFAWORK\Projects\Webserver\falseR00R01R02R03R04R05R06R07R08R09R10R11R12R13R14R15R16R17R18R19R20R21R22R23R24R25R26R27R28R29R30R31000Descriptors.cUSBDeviceMode.cUSBHostMode.cWebserver.cLib\DataflashManager.cLib\DHCPClientApp.cLib\DHCPServerApp.cLib\DHCPCommon.cLib\HTTPServerApp.cLib\SCSI.cLib\TELNETServerApp.cLib\uIPManagement.cDescriptors.hUSBDeviceMode.hUSBHostMode.hWebserver.hLib\DataflashManager.hLib\DHCPClientApp.hLib\DHCPServerApp.hLib\DHCPCommon.hLib\HTTPServerApp.hLib\SCSI.hLib\TELNETServerApp.hLib\uIPManagement.hmakefiledefaultYESmakefileatmega12811
Webserver.elfdefault\1-Wall -gdwarf-2 -std=gnu99 -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enumsdefault1C:\WinAVR-20100110\bin\avr-gcc.exeC:\WinAVR-20100110\utils\bin\make.exeC:\Users\Dean\Documents\Electronics\Projects\WORK\LUFAWORK\Projects\Webserver\Descriptors.hC:\Users\Dean\Documents\Electronics\Projects\WORK\LUFAWORK\Projects\Webserver\USBDeviceMode.hC:\Users\Dean\Documents\Electronics\Projects\WORK\LUFAWORK\Projects\Webserver\USBHostMode.hC:\Users\Dean\Documents\Electronics\Projects\WORK\LUFAWORK\Projects\Webserver\Webserver.hC:\Users\Dean\Documents\Electronics\Projects\WORK\LUFAWORK\Projects\Webserver\Lib\DataflashManager.hC:\Users\Dean\Documents\Electronics\Projects\WORK\LUFAWORK\Projects\Webserver\Lib\DHCPClientApp.hC:\Users\Dean\Documents\Electronics\Projects\WORK\LUFAWORK\Projects\Webserver\Lib\HTTPServerApp.hC:\Users\Dean\Documents\Electronics\Projects\WORK\LUFAWORK\Projects\Webserver\Lib\SCSI.hC:\Users\Dean\Documents\Electronics\Projects\WORK\LUFAWORK\Projects\Webserver\Lib\TELNETServerApp.hC:\Users\Dean\Documents\Electronics\Projects\WORK\LUFAWORK\Projects\Webserver\Lib\uIPManagement.hC:\Users\Dean\Documents\Electronics\Projects\WORK\LUFAWORK\Projects\Webserver\Descriptors.cC:\Users\Dean\Documents\Electronics\Projects\WORK\LUFAWORK\Projects\Webserver\USBDeviceMode.cC:\Users\Dean\Documents\Electronics\Projects\WORK\LUFAWORK\Projects\Webserver\USBHostMode.cC:\Users\Dean\Documents\Electronics\Projects\WORK\LUFAWORK\Projects\Webserver\Webserver.cC:\Users\Dean\Documents\Electronics\Projects\WORK\LUFAWORK\Projects\Webserver\Lib\DataflashManager.cC:\Users\Dean\Documents\Electronics\Projects\WORK\LUFAWORK\Projects\Webserver\Lib\DHCPClientApp.cC:\Users\Dean\Documents\Electronics\Projects\WORK\LUFAWORK\Projects\Webserver\Lib\HTTPServerApp.cC:\Users\Dean\Documents\Electronics\Projects\WORK\LUFAWORK\Projects\Webserver\Lib\SCSI.cC:\Users\Dean\Documents\Electronics\Projects\WORK\LUFAWORK\Projects\Webserver\Lib\TELNETServerApp.cC:\Users\Dean\Documents\Electronics\Projects\WORK\LUFAWORK\Projects\Webserver\Lib\uIPManagement.c
diff --git a/Projects/Webserver/Webserver.txt b/Projects/Webserver/Webserver.txt
index ddb06590aa6..32bdb597a37 100644
--- a/Projects/Webserver/Webserver.txt
+++ b/Projects/Webserver/Webserver.txt
@@ -52,10 +52,12 @@
* demonstrates how the libraries can be combined into a robust network enabled application, with the addition of a RNDIS
* network device.
*
- * To use this project, plug the USB AVR into a computer, so that it enumerates as a standard Mass Storage device. Load
- * HTML files onto the disk, so that they can be served out to clients -- the default file to serve should be called
+ * To use this project, plug the USB AVR into a computer, so that it enumerates as a standard Mass Storage and RNDIS composite
+ * device. Load HTML files onto the disk, so that they can be served out to clients -- the default file to serve should be called
* index.htm. Filenames must be in 8.3 format for them to be retrieved correctly by the webserver, and the total
- * requested file path must be equal to or less than the maximum URI length (\see \ref Sec_Options).
+ * requested file path must be equal to or less than the maximum URI length (\see \ref Sec_Options). Supply the included INF
+ * file when requested on Windows machines to enable the RNDIS interface, and allow the files to be viewed on a standard web-browser
+ * using the IP address 10.0.0.2.
*
* When attached to a RNDIS class device, such as a USB (desktop) modem, the system will enumerate the device, set the
* appropriate parameters needed for connectivity and begin listening for new HTTP connections on port 80 and TELNET
@@ -89,6 +91,11 @@
* When defined, this enables the DHCP client for dynamic IP allocation of the network settings from a DHCP server. |
*
*
+ * ENABLE_DHCP_SERVER |
+ * Makefile LUFA_OPTS |
+ * When defined, this enables the DHCP server for dynamic IP allocation of the network settings to a DHCP client. |
+ *
+ *
* DEVICE_IP_ADDRESS |
* Lib/uIPManagement.h |
* IP address that the webserver should use when connected to a RNDIS device (when ENABLE_DHCP_CLIENT is not defined). |
diff --git a/Projects/Webserver/makefile b/Projects/Webserver/makefile
index bba6d057b20..1602b2ff488 100644
--- a/Projects/Webserver/makefile
+++ b/Projects/Webserver/makefile
@@ -128,22 +128,25 @@ LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENAB
LUFA_OPTS += -D INTERRUPT_CONTROL_ENDPOINT
LUFA_OPTS += -D ENABLE_DHCP_CLIENT
+LUFA_OPTS += -D ENABLE_DHCP_SERVER
LUFA_OPTS += -D ENABLE_TELNET_SERVER
LUFA_OPTS += -D MAX_URI_LENGTH=50
-LUFA_OPTS += -D UIP_CONF_UDP="defined(ENABLE_DHCP_CLIENT)"
+
+LUFA_OPTS += -D UIP_CONF_UDP="defined(ENABLE_DHCP_CLIENT) || defined(ENABLE_DHCP_SERVER)"
+LUFA_OPTS += -D UIP_CONF_BROADCAST=1
LUFA_OPTS += -D UIP_CONF_TCP=1
LUFA_OPTS += -D UIP_CONF_UDP_CONNS=1
LUFA_OPTS += -D UIP_CONF_MAX_CONNECTIONS=3
LUFA_OPTS += -D UIP_CONF_MAX_LISTENPORTS=5
-LUFA_OPTS += -D UIP_URGDATA=0
LUFA_OPTS += -D UIP_CONF_BUFFER_SIZE=1514
-LUFA_OPTS += -D UIP_ARCH_CHKSUM=0
LUFA_OPTS += -D UIP_CONF_LL_802154=0
LUFA_OPTS += -D UIP_CONF_LL_80211=0
LUFA_OPTS += -D UIP_CONF_ROUTER=0
LUFA_OPTS += -D UIP_CONF_ICMP6=0
-LUFA_OPTS += -D UIP_ARCH_ADD32=0
LUFA_OPTS += -D UIP_CONF_ICMP_DEST_UNREACH=1
+LUFA_OPTS += -D UIP_URGDATA=0
+LUFA_OPTS += -D UIP_ARCH_CHKSUM=0
+LUFA_OPTS += -D UIP_ARCH_ADD32=0
LUFA_OPTS += -D UIP_NEIGHBOR_CONF_ADDRTYPE=0
@@ -159,7 +162,9 @@ SRC = $(TARGET).c \
Lib/SCSI.c \
Lib/DataflashManager.c \
Lib/uIPManagement.c \
+ Lib/DHCPCommon.c \
Lib/DHCPClientApp.c \
+ Lib/DHCPServerApp.c \
Lib/HTTPServerApp.c \
Lib/TELNETServerApp.c \
Lib/uip/uip.c \