Ashish
Ashish

Reputation: 8529

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

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

Which is the recommended C/C++ WiFi library for Linux to achieve this?

Upvotes: 16

Views: 25583

Answers (3)

asantacreu
asantacreu

Reputation: 310

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.

Upvotes: 4

BRPocock
BRPocock

Reputation: 13914

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.

Upvotes: 8

fge
fge

Reputation: 121810

That would be wireless-tools

Upvotes: 6

Related Questions