Program code

Here we will publish all the program code and software that we will produce during this project. The software is by no means optimized. We do not guarantee the functionality of the code and are not responsible for any damage the code might cause to your system.
Note that many of the programs uses the netwib library. The library can be found here. Unfortunately the library is poorly documented, but there are precompiled lib and dll files available for download. There is also some documentation available for download. Netwib uses Winpcap which can be found here.

The invisible proxy

invproxyv1_1.zip (complete with executable, source code and netwib)
This is the implementation of one of our solutions to the power management problems. It is a proxy that once it is connected to the network, allows UPnP devices to enter power sleep mode without disconnecting from the network. The proxy takes over the device's responsibilities after a certain time of inactivity. Please see the readme file for installation instructions, and the buglist for known bugs and comments.

The cooperating proxy

coopproxyv1_0.zip (complete with executable, source code and netwib)
This is the implementation of one of our solutions to the power management problems. It is a proxy that allows all devices that implement the power management service to enter power sleep mode. The proxy start answering for the device when it receives an event from the service, saying that the device is entering power sleep mode. This proxy can be tested with the power management UPnP service that can be found under proof of concept. Please see the readme file for installation instructions, and the buglist for known bugs and comments.

Proof of concepts

We have made several proof of concepts to make sure that functionality is implementable and to learn how it is done.

Wake on LAN

wol.c
This small program wakes up a sleeping device using Wake on LAN (WOL). The WOL packet contains the receivers ethernet address repeated 16 times. The address is hardcoded. The program is implemented in C and compiled with BCC on Windows. It uses winsock.h.

Spoofing

spooftest.c
This program sends a hard coded SSDP NOTIFY packet from any IP and any ethernet address. The addresses are predefined in the program. The program is written in C, compiled with Dev C++ or Visual C++ and uses the netwib library.

Sniffing

snifftest.c
This program sniffs the network traffic and filters the traffic for UDP packets. All received UDP packets are decoded, but only SSDP NOTIFY and M-SEARCH are printed. Sniffing is only done for ten seconds. The program is written in C, compiled with Dev C++ or Visual C++ and uses the netwib library.

Sniffing and spoofing

recresp.c
This program is a combination of the two above. The network is sniffed and traffic is filtered for udp packets destined for 239.255.255.250:1900 which is the SSDP multicast address. SSDP NOTIFY packets are printed. M-SEARCH packets are answered with a spoofed, hardcoded HTTP OK. The program is written in C, compiled with Dev C++ or Visual C++ and uses the netwib library.

Power management UPnP service

Power.java
GetPowerStatus.java
This is a power management service to enable power management in UPnP. The service has one state variable: power. The variable has two states: true or false. True means that the device that runs the service is fully powered up and false means that the device is in power sleep mode. This service is designed to be run with the cooperating proxy, and the programs communicate using GENA events. To compile and run this program the Atinav Java SDK for UPnP Devices is needed. A trial of the SDK can be downloaded from http://www.avelink.com/upnp/index.htm