dots/.config/awesome/quarrel/native/src/net/wireless.rs

105 lines
1.6 KiB
Rust

use std::ffi::{
c_char,
c_int,
c_void,
};
use nix::libc::{
__s16,
__s32,
__u16,
__u8,
ifreq as IfReq,
sockaddr as SockAddr,
IF_NAMESIZE,
};
pub static SIOCGIFCONF: c_int = 0x8912;
pub static SIOCGIWESSID: c_int = 0x8B1B;
pub const IW_ESSID_MAX_SIZE: u16 = 32;
#[repr(C)]
pub struct IfConf {
pub ifc_len: c_int,
pub data: IfConfData,
}
#[repr(C)]
pub union IfConfData {
pub ifc_req: *mut IfReq,
pub ifc_buf: *mut c_char,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct IwPoint {
pub pointer: *mut c_void,
pub length: __u16,
pub flags: __u16,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct IwFreq {
pub m: __s32,
pub e: __s16,
pub i: __u8,
pub flags: __u8,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct IwParam {
pub value: __s32,
pub fixed: __u8,
pub disabled: __u8,
pub flags: __u16,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct IwQuality {
pub qual: __u8,
pub level: __u8,
pub noise: __u8,
pub updated: __u8,
}
#[repr(C)]
pub struct IwReq {
pub ifr_ifrn: IwReqName,
pub u: IwReqData,
}
#[repr(C)]
pub union IwReqName {
pub ifrn_name: [c_char; IF_NAMESIZE],
}
#[repr(C)]
pub union IwReqData {
pub name: [c_char; IF_NAMESIZE],
pub essid: IwPoint,
pub nwid: IwParam,
pub freq: IwFreq,
pub sens: IwParam,
pub bitrate: IwParam,
pub txpower: IwParam,
pub rts: IwParam,
pub frag: IwParam,
pub mode: u32,
pub retry: IwParam,
pub encoding: IwPoint,
pub power: IwParam,
pub qual: IwQuality,
pub ap_addr: SockAddr,
pub addr: SockAddr,
pub param: IwParam,
pub data: IwPoint,
}