views:

450

answers:

6

Hey guys and gals,

I'm starting a new project and I'm trying to figure out what technologies I should use. Here's the deal, I'm writing some software that will run on a wireless router and I would like to provide a web interface. So most likely I will have to do some server-side web development. The only issue is that the device I will be deploying this to only has 16 MB of RAM (Ubiquiti Bullet). Here's some more info:

1.) I'll be using openwrt (linux). 2.) Obviously it has to be lightweight 3.) It's a school project, so I can use any technologies I'd like.

Obviously PHP is the obvious choice, but is there anything else a bit more exciting (I'm not crazy about PHP).

Thanks in advance!

A: 

Write it in C.

A light-weight webserver and either built-in modules, or FastCGI. The actual web stuff written in C. You will learn to appreciate higher-level languages and you'll probably use less RAM.

Or, find a nice small http library and embed the http server into your web UI.

Ryan Graham
+6  A: 

Some of the later versions of OpenWRT come with an interface written entirely in lua (LuCi). Have you checked this out to see if it applies? It runs over standard CGI and is called by the embedded web server that is already running on the OpenWRT (meaning you don't have to add yet another software package).

Check out their website luci.freifunk-halle.net, it apparently is a full featured web framework including MVC, so you are able to get started faster!

LuCI is a collection of free Lua software for embedded devices. It includes several useful tools and libraries for developers as well as an MVC-Webframework and web user interface which is part of OpenWrt Kamikaze starting from release 8.09. The goal of the LuCI Project is to create and maintain user friendly, stable and reliable user interfaces and development frameworks.

PHP is rather big for a router, and I think it won't quite provide the speed that you are looking for! Lua is not a hard scripting language to pick up and start with, it is not that different from PHP, and the Lua website is very good and has loads of documentation!

X-Istence
A: 

I'm in the C camp - go with the smallest server you can find that also allows you to plug in your own API to control the router. Off load as much logic as you can to the browser using javascript to check commands being sent to the back end, and keep yours design to simple form/url handling on the back end.

This link has a list of a number of servers you can look at. Once claims to be only 1k lines of code which is rockin' small http://www.ibm.com/developerworks/web/library/wa-ltwebserv/

jottos
A: 

The webserver is not the problem. Whatever lightweight httpd options supporting CGI will do the job. And for the content generation I would definitely NOT do it in C. Use the LuCI framework, and design a good interface !

shodanex
A: 

Consider making a Webmin plugin. Webmin:

  • Comes with its own web server which can do SSL
  • Will probably squeeze in 16MB no sweat
  • Is specifically made for being a GUI front-end to modify Unix and Linux systems
  • Has a well-documented plugin API
  • Has a ton of example modules (plugins) you can learn from

It's no silver bullet, but for the niche it serves, it satisfies it 100%. The only downside is that the API, having a long legacy, isn't exactly elegant and you won't win any buzzword awards with it.

jhs
A: 

look here http://stackoverflow.com/questions/779573/what-works-for-web-dev-in-c for an almost identical question.

gbrandt