Most routers run a variant of Linux. There's typically a set of hardware interfaces and a simple web server running on top of a generic Linux kernel, with the routing, filtering and Wi-Fi management running as separate processes. If you want to see this in action, you'll find your router may already offer a back-door debug mode which gives you Telnet access to the file system. For example, for a Netgear DG384G the command is http://[local ip address]/setup.cgi?todo=debug, where the [local IP address] number is the LAN's IP address. Put this line into a browser with the router's IP number, and you'll get a terse message saying 'Debug Enable!'