cfg80211.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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. /* from net/wireless.h */
  82. struct wiphy;
  83. /**
  84. * struct cfg80211_ops - backend description for wireless configuration
  85. *
  86. * This struct is registered by fullmac card drivers and/or wireless stacks
  87. * in order to handle configuration requests on their interfaces.
  88. *
  89. * All callbacks except where otherwise noted should return 0
  90. * on success or a negative error code.
  91. *
  92. * All operations are currently invoked under rtnl for consistency with the
  93. * wireless extensions but this is subject to reevaluation as soon as this
  94. * code is used more widely and we have a first user without wext.
  95. *
  96. * @add_virtual_intf: create a new virtual interface with the given name
  97. *
  98. * @del_virtual_intf: remove the virtual interface determined by ifindex.
  99. *
  100. * @change_virtual_intf: change type of virtual interface
  101. *
  102. * @add_key: add a key with the given parameters. @mac_addr will be %NULL
  103. * when adding a group key.
  104. *
  105. * @get_key: get information about the key with the given parameters.
  106. * @mac_addr will be %NULL when requesting information for a group
  107. * key. All pointers given to the @callback function need not be valid
  108. * after it returns.
  109. *
  110. * @del_key: remove a key given the @mac_addr (%NULL for a group key)
  111. * and @key_index
  112. *
  113. * @set_default_key: set the default key on an interface
  114. *
  115. * @add_beacon: Add a beacon with given parameters, @head, @interval
  116. * and @dtim_period will be valid, @tail is optional.
  117. * @set_beacon: Change the beacon parameters for an access point mode
  118. * interface. This should reject the call when no beacon has been
  119. * configured.
  120. * @del_beacon: Remove beacon configuration and stop sending the beacon.
  121. */
  122. struct cfg80211_ops {
  123. int (*add_virtual_intf)(struct wiphy *wiphy, char *name,
  124. enum nl80211_iftype type);
  125. int (*del_virtual_intf)(struct wiphy *wiphy, int ifindex);
  126. int (*change_virtual_intf)(struct wiphy *wiphy, int ifindex,
  127. enum nl80211_iftype type);
  128. int (*add_key)(struct wiphy *wiphy, struct net_device *netdev,
  129. u8 key_index, u8 *mac_addr,
  130. struct key_params *params);
  131. int (*get_key)(struct wiphy *wiphy, struct net_device *netdev,
  132. u8 key_index, u8 *mac_addr, void *cookie,
  133. void (*callback)(void *cookie, struct key_params*));
  134. int (*del_key)(struct wiphy *wiphy, struct net_device *netdev,
  135. u8 key_index, u8 *mac_addr);
  136. int (*set_default_key)(struct wiphy *wiphy,
  137. struct net_device *netdev,
  138. u8 key_index);
  139. int (*add_beacon)(struct wiphy *wiphy, struct net_device *dev,
  140. struct beacon_parameters *info);
  141. int (*set_beacon)(struct wiphy *wiphy, struct net_device *dev,
  142. struct beacon_parameters *info);
  143. int (*del_beacon)(struct wiphy *wiphy, struct net_device *dev);
  144. };
  145. #endif /* __NET_CFG80211_H */