Netmanager and network config

Does any one know how netmanager works?
What goes on under the hood?

Ok silly question perhaps, but here is why.

I have a device that has three network interfaces, 2 ethernet and one wireless.
The GUI is browser based so I can’t use phlip for the settings.

So I have a GUI that calls some scripts to get the information, it’s quite inneficient and slow but it works.
I use net manager to gather the data and then parse the file to extract the fields required.

To speed this up a bit I am in the process of implementing this in C.

This raised a few questions!

It was fairly easy to get the ip address and interface specific stuff via the sockets lib
Thanks to Mezec’s article openqnx.com/PNphpBB2-viewtopic-t5002-.html
Hostname is easy, gethostname()

But how can I get/set the other info, specifically:

domain name
name server
gateway (default route)

Interface setting mode (manual / DHCP)

I can parse net.cfg to get the info but it struck me that there must be a series of devctls to get this info,
how does natmanager do it?

Thanks
Brendan

“domain name” setconf(_CS_DOMAIN, …)
“name server” setconf(_CS_RESOVLE, …)

                For the 2 above, you can always use "getconf" to find the real format on an already configured machine

“gateway” spawn "route add default " is easier, or
use the “routing socket” (AF_ROUTE)

“interface manual” spawn “ifconfig …” or use ioctl(SIOCSIFADDR, …)
“interface dhcp” spawn “dhcp.client -i …”

               if DHCP, you probably could add "-m" on dhcp.client, so _CS_RESOLVE could be
               setup by dhcp.client

Thanks Xtang

It strikes me as odd that this is not all satisfied with a set of library calls, or even 1 call that returns a
struct with all the info.

I also found confstr to get the _CS_DOMAIN and _CS_RESOLVE info.
That should give me all I need.

Thanks again
Brendan