Check the openserctl script. And the structure evolved between 1.2 and 1.3.
Thanks for the tip
I'm on 1.1 and the IP needs to be converted to integer format for storage in the database. Curiously this seems to be done in reverse order. For example the IP 127.0.0.1 is stored as 16777343 i.e. (1 * 256^3) + (0 * 256^2) + (0 * 256) + (127) rather than 2130706433 (127 * 256^3) + (0 * 256^2) + (0 * 256) + (1) see http://www.aboutmyip.com/AboutMyXApp/IP2Integer.jsp
Cameron