cfg80211.h 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  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. /* from net/wireless.h */
  152. struct wiphy;
  153. /**
  154. * struct cfg80211_ops - backend description for wireless configuration
  155. *
  156. * This struct is registered by fullmac card drivers and/or wireless stacks
  157. * in order to handle configuration requests on their interfaces.
  158. *
  159. * All callbacks except where otherwise noted should return 0
  160. * on success or a negative error code.
  161. *
  162. * All operations are currently invoked under rtnl for consistency with the
  163. * wireless extensions but this is subject to reevaluation as soon as this
  164. * code is used more widely and we have a first user without wext.
  165. *
  166. * @add_virtual_intf: create a new virtual interface with the given name
  167. *
  168. * @del_virtual_intf: remove the virtual interface determined by ifindex.
  169. *
  170. * @change_virtual_intf: change type of virtual interface
  171. *
  172. * @add_key: add a key with the given parameters. @mac_addr will be %NULL
  173. * when adding a group key.
  174. *
  175. * @get_key: get information about the key with the given parameters.
  176. * @mac_addr will be %NULL when requesting information for a group
  177. * key. All pointers given to the @callback function need not be valid
  178. * after it returns.
  179. *
  180. * @del_key: remove a key given the @mac_addr (%NULL for a group key)
  181. * and @key_index
  182. *
  183. * @set_default_key: set the default key on an interface
  184. *
  185. * @add_beacon: Add a beacon with given parameters, @head, @interval
  186. * and @dtim_period will be valid, @tail is optional.
  187. * @set_beacon: Change the beacon parameters for an access point mode
  188. * interface. This should reject the call when no beacon has been
  189. * configured.
  190. * @del_beacon: Remove beacon configuration and stop sending the beacon.
  191. *
  192. * @add_station: Add a new station.
  193. *
  194. * @del_station: Remove a station; @mac may be NULL to remove all stations.
  195. *
  196. * @change_station: Modify a given station.
  197. */
  198. struct cfg80211_ops {
  199. int (*add_virtual_intf)(struct wiphy *wiphy, char *name,
  200. enum nl80211_iftype type);
  201. int (*del_virtual_intf)(struct wiphy *wiphy, int ifindex);
  202. int (*change_virtual_intf)(struct wiphy *wiphy, int ifindex,
  203. enum nl80211_iftype type);
  204. int (*add_key)(struct wiphy *wiphy, struct net_device *netdev,
  205. u8 key_index, u8 *mac_addr,
  206. struct key_params *params);
  207. int (*get_key)(struct wiphy *wiphy, struct net_device *netdev,
  208. u8 key_index, u8 *mac_addr, void *cookie,
  209. void (*callback)(void *cookie, struct key_params*));
  210. int (*del_key)(struct wiphy *wiphy, struct net_device *netdev,
  211. u8 key_index, u8 *mac_addr);
  212. int (*set_default_key)(struct wiphy *wiphy,
  213. struct net_device *netdev,
  214. u8 key_index);
  215. int (*add_beacon)(struct wiphy *wiphy, struct net_device *dev,
  216. struct beacon_parameters *info);
  217. int (*set_beacon)(struct wiphy *wiphy, struct net_device *dev,
  218. struct beacon_parameters *info);
  219. int (*del_beacon)(struct wiphy *wiphy, struct net_device *dev);
  220. int (*add_station)(struct wiphy *wiphy, struct net_device *dev,
  221. u8 *mac, struct station_parameters *params);
  222. int (*del_station)(struct wiphy *wiphy, struct net_device *dev,
  223. u8 *mac);
  224. int (*change_station)(struct wiphy *wiphy, struct net_device *dev,
  225. u8 *mac, struct station_parameters *params);
  226. int (*get_station)(struct wiphy *wiphy, struct net_device *dev,
  227. u8 *mac, struct station_stats *stats);
  228. };
  229. #endif /* __NET_CFG80211_H */