cfg80211.h 8.4 KB

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