Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DHCP Option in Qt/C++

Tags:

c++

linux

qt5

dhcp

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

So I want to know how to get specific (or all) option(s) informations from the DHCP lease.

I've looked to Qt's documentation but wasn't able to find anything useful and couldn't find any c++ libraries for linux.

like image 296
user3840048 Avatar asked Sep 30 '22 15:09

user3840048


1 Answers

I had exactly the same problem. I have found a library called Libcrafter which has a lot of features including DHCP support. There is a good example of DHCP usage in their examples. It is example #8.

like image 67
Dávid Kaya Avatar answered Oct 02 '22 14:10

Dávid Kaya