Upgrade b43 and mac80211.
[openwrt.git] / package / mac80211 / src / include / net / cfg80211.h
1 #ifndef __NET_CFG80211_H
2 #define __NET_CFG80211_H
3
4 #include <linux/netlink.h>
5 #include <linux/skbuff.h>
6 #include <linux/nl80211.h>
7 #include <net/genetlink.h>
8
9 /*
10  * 802.11 configuration in-kernel interface
11  *
12  * Copyright 2006, 2007 Johannes Berg <johannes@sipsolutions.net>
13  */
14
15 /* Radiotap header iteration
16  *   implemented in net/wireless/radiotap.c
17  *   docs in Documentation/networking/radiotap-headers.txt
18  */
19 /**
20  * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
21  * @rtheader: pointer to the radiotap header we are walking through
22  * @max_length: length of radiotap header in cpu byte ordering
23  * @this_arg_index: IEEE80211_RADIOTAP_... index of current arg
24  * @this_arg: pointer to current radiotap arg
25  * @arg_index: internal next argument index
26  * @arg: internal next argument pointer
27  * @next_bitmap: internal pointer to next present u32
28  * @bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
29  */
30
31 struct ieee80211_radiotap_iterator {
32         struct ieee80211_radiotap_header *rtheader;
33         int max_length;
34         int this_arg_index;
35         u8 *this_arg;
36
37         int arg_index;
38         u8 *arg;
39         __le32 *next_bitmap;
40         u32 bitmap_shifter;
41 };
42
43 extern int ieee80211_radiotap_iterator_init(
44    struct ieee80211_radiotap_iterator *iterator,
45    struct ieee80211_radiotap_header *radiotap_header,
46    int max_length);
47
48 extern int ieee80211_radiotap_iterator_next(
49    struct ieee80211_radiotap_iterator *iterator);
50
51
52  /**
53  * struct key_params - key information
54  *
55  * Information about a key
56  *
57  * @key: key material
58  * @key_len: length of key material
59  * @cipher: cipher suite selector
60  * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used
61  *      with the get_key() callback, must be in little endian,
62  *      length given by @seq_len.
63  */
64 struct key_params {
65         u8 *key;
66         u8 *seq;
67         int key_len;
68         int seq_len;
69         u32 cipher;
70 };
71
72 /**
73  * struct beacon_parameters - beacon parameters
74  *
75  * Used to configure the beacon for an interface.
76  *
77  * @head: head portion of beacon (before TIM IE)
78  *     or %NULL if not changed
79  * @tail: tail portion of beacon (after TIM IE)
80  *     or %NULL if not changed
81  * @interval: beacon interval or zero if not changed
82  * @dtim_period: DTIM period or zero if not changed
83  * @head_len: length of @head
84  * @tail_len: length of @tail
85  */
86 struct beacon_parameters {
87         u8 *head, *tail;
88         int interval, dtim_period;
89         int head_len, tail_len;
90 };
91
92 /**
93  * enum station_flags - station flags
94  *
95  * Station capability flags. Note that these must be the bits
96  * according to the nl80211 flags.
97  *
98  * @STATION_FLAG_CHANGED: station flags were changed
99  * @STATION_FLAG_AUTHORIZED: station is authorized to send frames (802.1X)
100  * @STATION_FLAG_SHORT_PREAMBLE: station is capable of receiving frames
101  *      with short preambles
102  * @STATION_FLAG_WME: station is WME/QoS capable
103  */
104 enum station_flags {
105         STATION_FLAG_CHANGED            = 1<<0,
106         STATION_FLAG_AUTHORIZED         = 1<<NL80211_STA_FLAG_AUTHORIZED,
107         STATION_FLAG_SHORT_PREAMBLE     = 1<<NL80211_STA_FLAG_SHORT_PREAMBLE,
108         STATION_FLAG_WME                = 1<<NL80211_STA_FLAG_WME,
109 };
110
111 /**
112  * struct station_parameters - station parameters
113  *
114  * Used to change and create a new station.
115  *
116  * @vlan: vlan interface station should belong to
117  * @supported_rates: supported rates in IEEE 802.11 format
118  *      (or NULL for no change)
119  * @supported_rates_len: number of supported rates
120  * @station_flags: station flags (see &enum station_flags)
121  * @listen_interval: listen interval or -1 for no change
122  * @aid: AID or zero for no change
123  */
124 struct station_parameters {
125         u8 *supported_rates;
126         struct net_device *vlan;
127         u32 station_flags;
128         int listen_interval;
129         u16 aid;
130         u8 supported_rates_len;
131 };
132
133 /**
134  * enum station_stats_flags - station statistics flags
135  *
136  * Used by the driver to indicate which info in &struct station_stats
137  * it has filled in during get_station().
138  *
139  * @STATION_STAT_INACTIVE_TIME: @inactive_time filled
140  * @STATION_STAT_RX_BYTES: @rx_bytes filled
141  * @STATION_STAT_TX_BYTES: @tx_bytes filled
142  */
143 enum station_stats_flags {
144         STATION_STAT_INACTIVE_TIME      = 1<<0,
145         STATION_STAT_RX_BYTES           = 1<<1,
146         STATION_STAT_TX_BYTES           = 1<<2,
147 };
148
149 /**
150  * struct station_stats - station statistics
151  *
152  * Station information filled by driver for get_station().
153  *
154  * @filled: bitflag of flags from &enum station_stats_flags
155  * @inactive_time: time since last station activity (tx/rx) in milliseconds
156  * @rx_bytes: bytes received from this station
157  * @tx_bytes: bytes transmitted to this station
158  */
159 struct station_stats {
160         u32 filled;
161         u32 inactive_time;
162         u32 rx_bytes;
163         u32 tx_bytes;
164 };
165
166 /**
167  * enum monitor_flags - monitor flags
168  *
169  * Monitor interface configuration flags. Note that these must be the bits
170  * according to the nl80211 flags.
171  *
172  * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS
173  * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP
174  * @MONITOR_FLAG_CONTROL: pass control frames
175  * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering
176  * @MONITOR_FLAG_COOK_FRAMES: report frames after processing
177  */
178 enum monitor_flags {
179         MONITOR_FLAG_FCSFAIL            = 1<<NL80211_MNTR_FLAG_FCSFAIL,
180         MONITOR_FLAG_PLCPFAIL           = 1<<NL80211_MNTR_FLAG_PLCPFAIL,
181         MONITOR_FLAG_CONTROL            = 1<<NL80211_MNTR_FLAG_CONTROL,
182         MONITOR_FLAG_OTHER_BSS          = 1<<NL80211_MNTR_FLAG_OTHER_BSS,
183         MONITOR_FLAG_COOK_FRAMES        = 1<<NL80211_MNTR_FLAG_COOK_FRAMES,
184 };
185
186 /* from net/wireless.h */
187 struct wiphy;
188
189 /**
190  * struct cfg80211_ops - backend description for wireless configuration
191  *
192  * This struct is registered by fullmac card drivers and/or wireless stacks
193  * in order to handle configuration requests on their interfaces.
194  *
195  * All callbacks except where otherwise noted should return 0
196  * on success or a negative error code.
197  *
198  * All operations are currently invoked under rtnl for consistency with the
199  * wireless extensions but this is subject to reevaluation as soon as this
200  * code is used more widely and we have a first user without wext.
201  *
202  * @add_virtual_intf: create a new virtual interface with the given name
203  *
204  * @del_virtual_intf: remove the virtual interface determined by ifindex.
205  *
206  * @change_virtual_intf: change type of virtual interface
207  *
208  * @add_key: add a key with the given parameters. @mac_addr will be %NULL
209  *      when adding a group key.
210  *
211  * @get_key: get information about the key with the given parameters.
212  *      @mac_addr will be %NULL when requesting information for a group
213  *      key. All pointers given to the @callback function need not be valid
214  *      after it returns.
215  *
216  * @del_key: remove a key given the @mac_addr (%NULL for a group key)
217  *      and @key_index
218  *
219  * @set_default_key: set the default key on an interface
220  *
221  * @add_beacon: Add a beacon with given parameters, @head, @interval
222  *      and @dtim_period will be valid, @tail is optional.
223  * @set_beacon: Change the beacon parameters for an access point mode
224  *      interface. This should reject the call when no beacon has been
225  *      configured.
226  * @del_beacon: Remove beacon configuration and stop sending the beacon.
227  *
228  * @add_station: Add a new station.
229  *
230  * @del_station: Remove a station; @mac may be NULL to remove all stations.
231  *
232  * @change_station: Modify a given station.
233  */
234 struct cfg80211_ops {
235         int     (*add_virtual_intf)(struct wiphy *wiphy, char *name,
236                                     enum nl80211_iftype type, u32 *flags);
237         int     (*del_virtual_intf)(struct wiphy *wiphy, int ifindex);
238         int     (*change_virtual_intf)(struct wiphy *wiphy, int ifindex,
239                                        enum nl80211_iftype type, u32 *flags);
240
241         int     (*add_key)(struct wiphy *wiphy, struct net_device *netdev,
242                            u8 key_index, u8 *mac_addr,
243                            struct key_params *params);
244         int     (*get_key)(struct wiphy *wiphy, struct net_device *netdev,
245                            u8 key_index, u8 *mac_addr, void *cookie,
246                            void (*callback)(void *cookie, struct key_params*));
247         int     (*del_key)(struct wiphy *wiphy, struct net_device *netdev,
248                            u8 key_index, u8 *mac_addr);
249         int     (*set_default_key)(struct wiphy *wiphy,
250                                    struct net_device *netdev,
251                                    u8 key_index);
252
253         int     (*add_beacon)(struct wiphy *wiphy, struct net_device *dev,
254                               struct beacon_parameters *info);
255         int     (*set_beacon)(struct wiphy *wiphy, struct net_device *dev,
256                               struct beacon_parameters *info);
257         int     (*del_beacon)(struct wiphy *wiphy, struct net_device *dev);
258
259
260         int     (*add_station)(struct wiphy *wiphy, struct net_device *dev,
261                                u8 *mac, struct station_parameters *params);
262         int     (*del_station)(struct wiphy *wiphy, struct net_device *dev,
263                                u8 *mac);
264         int     (*change_station)(struct wiphy *wiphy, struct net_device *dev,
265                                   u8 *mac, struct station_parameters *params);
266         int     (*get_station)(struct wiphy *wiphy, struct net_device *dev,
267                                u8 *mac, struct station_stats *stats);
268 };
269
270 #endif /* __NET_CFG80211_H */