DHCP option in Qt / C ++

I would like to ask if there is a way to read the DHCP option in Qt or C ++ (Qt would be better) on linux. I have my own cup backend and would like to read option 9 - LPR Servers (all listed IP addresses) and use it as a uri device.

So, I want to know how to get specific (or all) parameter information from a DHCP lease.

I looked at the Qt documentation, but could not find anything useful and could not find the C ++ libraries for Linux.

+5
source share
2 answers

I had exactly the same problem. I found a library called Libcrafter that has many features, including DHCP support. The examples have a good example of using DHCP. This is an example of # 8.

+4
source

This requirement is quite specific. I do not know if there is such a library for simple DHCP options.

So, my suggestion is that within one DHCP implementation ( http://en.wikipedia.org/wiki/Comparison_of_DHCP_server_software ) learn how it handles the parameters.

Take dnsmasq_2.72 as an example in the src / dhcp-common.c file, there is a lookup_dhcp_opt () function.

0
source

Source: https://habr.com/ru/post/1204741/


All Articles