Linux – Which API provides wireless network notifications in Linux?

Which API provides wireless network notifications in Linux?… here is a solution to the problem.

Which API provides wireless network notifications in Linux?

Every time my network card sends new information about available networks, I want to trigger some callbacks. I don’t really mind if I need to poll for information myself. I just don’t want to rely on generating “iwlist scan last” every second, but that’s exactly the information I need (network name + channel + encryption type).

Is there a library that can do this? (Or are there some ioctl calls that do this?) )

I’m only interested in the ndiswrapper module.

Solution

If NetworkManager is running, it can > DBUS APIs through its Access it — View WirelessNetworkAppeared and WirelessNetworkDisappeared events.

Otherwise, you will have to deal with wext yourself (this is the NM used below), you will be interested in IWEVREGISTERED and from NETLINK_ROUTE IWEVEXPIRED Event Interest Interface.

Related Problems and Solutions