What c / C ++ library can I use to handle Wi-Fi connections for Linux?

I want to implement a WiFi manager program that should handle the following.

  • Wi-Fi hotspot notification has come or gone.
  • Provide information about the available Wi-Fi hotspot.
  • connect / disconnect with a given Wi-Fi access point.

What is the recommended Wi-Fi C / C ++ library for Linux?

+6
source share
3 answers

It will be cordless tools.

+4
source

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

While cordless tools, etc. will work - even direct kernel calls, if necessary - there are several problems:

  • You will probably need superuser privileges.
  • NetworkManager is likely to receive a panic attack and will run into you if you don’t stop serving it.
  • Custom network controls (such as desktop icons) are almost certainly configured to use NetworkManager.

You can send and receive DBus messages for all the tasks you specify, for Wi-Fi, as well as for any other types of network interfaces. The API is published here for version 0.8 .

For newer operating systems, there are apparently changes to the API with migration guidance .

Their wiki should be really helpful.

I know that Fedora and Ubuntu use NetworkManager by default; I believe that many other systems, too, but do not have an exhaustive list.

Of course, if you use an embedded system, a custom distribution, or something else, then your mileage may vary.

+4
source

I would recommend using NetworkManager Library directly.

You can use the low-level D-Bus library or the libnm-glib library, which makes communication easier: an example of adding a glib file

For more information, you can read nmcli command line client code.

+1
source

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


All Articles