Crate netlink_wi

Crate netlink_wi 

Source
Expand description

netlink_wi is a Rust library for interacting with wireless devices on Linux systems through the nl80211 netlink interface.

It provides programmatic access to wireless configuration and status information, allowing developers to query and control Wi-Fi interfaces directly from Rust code.

With netlink_wi, you can:

  • Enumerate and inspect wireless network interfaces
  • Retrieve hardware capabilities and detailed device specifications
  • Access information about connected stations and peers
  • Query wireless regulatory domain settings
  • Configure wireless interface parameters

§Usage

Synchronous example using NlSocket:

use netlink_wi::NlSocket;

fn list_interfaces() {
   let mut socket = NlSocket::connect().unwrap();
   let interfaces = socket.list_interfaces().unwrap();
   for interface in interfaces {
       println!("{:#?}", interface);
   }
}

Asynchronous example using AsyncNlSocket (requires async feature):

use netlink_wi::AsyncNlSocket;

#[tokio::main]
async fn main() {
    let socket = AsyncNlSocket::connect().await.unwrap();
    let interfaces = socket.list_interfaces().await.unwrap();

    for interface in interfaces {
        println!("{:#?}", interface);
    }
}

See more examples in Github.

Modules§

interface
Wireless network interface types and information.
reg_domain
Wireless regulatory domain information and rules.
station
Wireless station information and statistics.
wiphy
Physical wireless device (wiphy) information.

Structs§

AsyncNlSocket
An asynchronous netlink socket for interacting with nl80211.
ChannelConfig
Configuration for setting a channel.
NlError
The main error type for netlink_wi operations.
NlSocket
A synchronous netlink socket for interacting with nl80211.

Enums§

MonitorFlags
Monitor mode configuration flags.

Type Aliases§

NlResult