which c/c++ library can be used for handling wifi connections for linux? which c/c++ library can be used for handling wifi connections for linux? linux linux

which c/c++ library can be used for handling wifi connections for linux?


On Fedora (at least), the preferred way to interact with NetworkManager is via DBus.

While wireless-tools and the like will work — even direct kernel calls, if you must — there are a couple of problems:

  • You'll probably need superuser privileges
  • NetworkManager will probably have a panic attack and get into fights with you, unless you stop its service
  • The user's normal networking controls (e.g. desktop tray icons) are almost certainly configured to use NetworkManager.

You can send and receive DBus messages for all the tasks you mentioned, for WiFi as well as arbitrary other types of network interfaces. The API is published here, for version 0.8.

For newer operating systems, there are apparently changes in the API, with a migration guide.

Their wiki should be really helpful.

I know both Fedora and Ubuntu use NetworkManager by default; I believe many other systems do, as well, but don't have an exhaustive list.

Of course, if you're using an embedded system, custom distribution, or something, then your mileage may vary.


I would recommend using directly the NetworkManager Library.

You can use low-level D-Bus library or libnm-glib library, that makes communication easier: example add connection glib

For more info, you can take a look into the code of the command line client nmcli.