Hi,
My name is Martin. I have a Linux system where I have started the standard ISC DHCP client ('dhclient'). This client aims to contact a DHCP server on my network to get leases/addresses etc. I.e. plain DHCP usage.
Now, I want to monitor and retrieve information/addresses from the DHCP client ('dhclient'), add/remove interfaces of the DHCP client etc., from a C program that I have written myself.
Reading the man pages, I read about 'dhcpctl' as a static lib (dhcpctl.a) that should function as an API towards my 'dhclient'. Thus, the idea is to link the 'dhcpctl' lib into my own C program and then use the API functions described in:
https://linux.die.net/man/3/dhcpctl
...in order to get addresses, lease times, create new interfaces, delete interfaces etc. I.e. fully manage the 'dhclient', according to my needs (I don't exactly know whether the API functions listed are sufficient, but I assume so).
However, when reading the man-text in the link, it says:
"The dhcpctl set of functions provide an API that can be used to communicate with and manipulate a running ISC DHCP server."
...i.e. they mention 'ISC DHCP Server', not DHCP client. Do they actually mean DHCP Server only or is this also applicable to 'dhclient'? If both, any difference in API/usage?
Somewhat contradictory, the man pages of 'dhclient' mentions:
"The DHCP client provides some ability to control it while it is running, without stopping it. This capability is provided using OMAPI, an API for manipulating remote objects. OMAPI clients connect to the client using TCP/IP, authenticate, and can then examine the client's current status and make changes to it.
Rather than implementing the underlying OMAPI protocol directly, user programs should use the dhcpctl API or OMAPI itself. Dhcpctl is a wrapper that handles some of the housekeeping chores that OMAPI does not do automatically."
...which talks in favor of what I want to do here - use 'dhcpctl' lib to communicate with the 'dhclient' (which 'under the hood' seems to use omapi).
Could anyone explain the confusion above?
Do you think 'dhcpctl' lib will work as the suitable API lib fulfilling my communication needs to/from my own program towards the 'dhclient'?
------------------------
Second part:
When building the 'dev' package of dhcp, I get these three static libs:
* dhcpctl.a
* omapi.a
* dst.a
However, when I'm linking all these into my own C program, it still lacks some functions, some 'dst_*' functions, some 'dns_*' functions etc.
Indications gives by hand that I need to also link some BIND lib into my C program as well! Is that true? If yes, howcome the 'dev' package does not produce all the libs needed for my purpose? It sounds very suspicious and makes me feel it is something wrong here?
I am very greatful if someone could please enlight me here?
Thanks in advance!
BR Martin