Main Site Documentation

Extension - NetConfig : Wiz5100 Http configuration framework


#1

[title]NetConfig : Wiz5100 Http configuration framework[/title]
http://code.tinyclr.com/project/308/netconfig-wiz5100-http-configuration-framework/
[line]
This class is a network framework for using & configuring an USBizi FEZ Wiznet5100 like an appliance, through a web interface (http://yourip/netconfig)

It allows to configure the network parameters (mac & ip addresses, dhcp) plus several options (Netbios name server, NTP client) with a web interface protected by a password ; The parameters are stored in flash memory, so won’t be lost when switched off (there is plenty of space left for your own data there; you can even tell the class where in Flashmemory to write its data). If the user loses hiss password or forget his network configuration, an optional button or jumper can be chosen, to be pressed during startup (to ground), which is recovering the default configuration (that you can change). Immediatly after startup the pin is released so you can reuse it in another part of your software.

The built in http server can be used by your program to handle your own regular web pages, or you can even add your own « html tabs » to the configuration framework, protected by the same password and interface.

The CSS styling can be easyly adapted to meet your own design needs.

The board also include an optional extra network feature forgotten by the Wiznet5100 chip, the ability to monitor the ethernet link status from the software (and to reinitialize the network when the cable is (re)connected). You will just need to add a simple wire between the W5100 chip pin going to the Link Led and connect it to an interrupt capable pin.

Another html page (/netstatus) gives you plenty of information about your board (basic web statistics, statuses, available memory, uptime, hardware and software installed…). An option, disabled by default allows you to remotly reboot the board.

Since the class is handling almost everything on the network side, depending on what options the user configured, it can use all the 4 sockets allowed by the Wiz5100 chip, thus leaving none for you network needs (1 socket possibly reserved for dhcp/dns, one for netbios if enabled, one for the web server monitoring socket, one for http incoming socket). However you have an option to temporary switch off the http server to free up 2 sockets, and you can start it over when you are done. Or you can also deactivate the Netbios Server, freeing one socket.

Another option allows you to have the network reinitialize automaticaly at specified time, or with a specified frequency (everyday at 1am, or ervery 6 hours, etc). This can be usefull as the server or the ip stack can sometimes crash (I did all I could to prevent it!!!), or just to force renewing DHCP and update NTP time.

All of this is very simple, please have a look at the included example.

The default defaults are aa:aa:aa:aa:aa:aa mac address, DHCP enabled, netbios enabled with “defaultconfig” netbios name. So when you power up, and if you have a dhcp server on your LAN, you should be able to “ping defaultconfig” or access it on your browser at adresse http://defaultconfig/netconfig (there default password is not set, ie by default no password).

The code is distributed using the Appache 2.0 licence. Since the code will most likely be updated to correct bugs or add features, I would advise checking it here sometimes to see if there is something new. The code is easily extendable (plugins) so in the future there might be extentions in their own tabs (I am thinking right now of software remote update, or UPNP for an example). Please report bugs to f1iqf@ hotmail.com ; For question you can use the dedicated forum http://www.tinyclr.com/forum/2/2795/

Since the code was too big to fit in the below « code » section, it is inside file you can download here.

Notes

  • It is normal seeing exceptions while the code is starting / running : the httplistener class used is throwing a lot of them, but it should be catched properly…
  • It requires at least GHI SDK 4.1.5.1
  • Updated 0.1.0b 5/19/2011 with a correction to a possible netbios bug