]> git.lizzy.rs Git - plan9front.git/blob - sys/src/9/pc/wifi.h
pc, pc64: more conservative pcirouting
[plan9front.git] / sys / src / 9 / pc / wifi.h
1 typedef struct Wkey Wkey;
2 typedef struct Wnode Wnode;
3 typedef struct Wifi Wifi;
4 typedef struct Wifipkt Wifipkt;
5
6 enum {
7         Essidlen = 32,
8 };
9
10 /* cipher */
11 enum {
12         TKIP    = 1,
13         CCMP    = 2,
14 };
15
16 struct Wkey
17 {
18         int     cipher;
19         int     len;
20         uchar   key[32];
21         uvlong  tsc;
22 };
23
24 struct Wnode
25 {
26         uchar   bssid[Eaddrlen];
27         char    ssid[Essidlen+2];
28
29         char    *status;
30
31         int     rsnelen;
32         uchar   rsne[258];
33         Wkey    txkey[1];
34         Wkey    rxkey[5];
35
36         int     aid;            /* association id */
37         ulong   lastsend;
38         ulong   lastseen;
39
40         uchar   *minrate;       /* pointers into wifi->rates */
41         uchar   *maxrate;
42
43         /* stuff from beacon */
44         int     ival;
45         int     cap;
46         int     channel;
47         int     brsnelen;
48         uchar   brsne[258];
49 };
50
51 struct Wifi
52 {
53         Ether   *ether;
54
55         int     debug;
56
57         Queue   *iq;
58         ulong   watchdog;
59         Ref     txseq;
60         void    (*transmit)(Wifi*, Wnode*, Block*);
61
62         /* for searching */
63         uchar   bssid[Eaddrlen];
64         char    essid[Essidlen+2];
65
66         /* supported data rates by hardware */
67         uchar   *rates;
68
69         /* effective base station */
70         Wnode   *bss;
71
72         Wnode   node[32];
73 };
74
75 struct Wifipkt
76 {
77         uchar   fc[2];
78         uchar   dur[2];
79         uchar   a1[Eaddrlen];
80         uchar   a2[Eaddrlen];
81         uchar   a3[Eaddrlen];
82         uchar   seq[2];
83         uchar   a4[Eaddrlen];
84 };
85
86 Wifi *wifiattach(Ether *ether, void (*transmit)(Wifi*, Wnode*, Block*));
87 void wifiiq(Wifi*, Block*);
88 int wifihdrlen(Wifipkt*);
89
90 long wifistat(Wifi*, void*, long, ulong);
91 long wifictl(Wifi*, void*, long);