This sounds more like a programming question to me. You could take a look at the source code for net-tools (http://freshmeat.net/projects/net-tools/
) and borrow from that but it is pretty opaque. Looks like you basically have to feed the right struct to the right ioctl.
May be worth mailing the author directly, or else asking on one of the kernel lists. I'm not sure many true hackers read LQ.