aboutsummaryrefslogtreecommitdiff
path: root/.config/awesome/quarrel/native/src/net/wireless.rs
blob: d3999dbee37725ca5eb388290f2aa31f74782644 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
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,
}