ofada,
there are no standard C++ calls to find that out...but,
you can check the contents of /proc/sys/net/ipv4/ip_autoconfig,
if it is 0, then you are using a static IP
if it is 1, then you are using a dynamic IP (BOOT, RARP, DHCP)
I dont trust that file though, since I use DHCP and it is 0 on my machine.
you could reach into /etc/sysconfig/network/ifcfg-eth0 (or any other legal device name) and look for the BOOTPROTO variable, which should equal DHCP. But I am not sure if each distro implements sysconfig the same, if at all.
lastly, with root access, you could parse the output of 'ifstatus' for lease information.
. . .what exactly are you trying to do?
|