cfg80211.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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. /* from net/wireless.h */
  63. struct wiphy;
  64. /**
  65. * struct cfg80211_ops - backend description for wireless configuration
  66. *
  67. * This struct is registered by fullmac card drivers and/or wireless stacks
  68. * in order to handle configuration requests on their interfaces.
  69. *
  70. * All callbacks except where otherwise noted should return 0
  71. * on success or a negative error code.
  72. *
  73. * All operations are currently invoked under rtnl for consistency with the
  74. * wireless extensions but this is subject to reevaluation as soon as this
  75. * code is used more widely and we have a first user without wext.
  76. *
  77. * @add_virtual_intf: create a new virtual interface with the given name
  78. *
  79. * @del_virtual_intf: remove the virtual interface determined by ifindex.
  80. *
  81. * @change_virtual_intf: change type of virtual interface
  82. *
  83. * @add_key: add a key with the given parameters. @mac_addr will be %NULL
  84. * when adding a group key.
  85. *
  86. * @get_key: get information about the key with the given parameters.
  87. * @mac_addr will be %NULL when requesting information for a group
  88. * key. All pointers given to the @callback function need not be valid
  89. * after it returns.
  90. *
  91. * @del_key: remove a key given the @mac_addr (%NULL for a group key)
  92. * and @key_index
  93. *
  94. * @set_default_key: set the default key on an interface
  95. */
  96. struct cfg80211_ops {
  97. int (*add_virtual_intf)(struct wiphy *wiphy, char *name,
  98. enum nl80211_iftype type);
  99. int (*del_virtual_intf)(struct wiphy *wiphy, int ifindex);
  100. int (*change_virtual_intf)(struct wiphy *wiphy, int ifindex,
  101. enum nl80211_iftype type);
  102. int (*add_key)(struct wiphy *wiphy, struct net_device *netdev,
  103. u8 key_index, u8 *mac_addr,
  104. struct key_params *params);
  105. int (*get_key)(struct wiphy *wiphy, struct net_device *netdev,
  106. u8 key_index, u8 *mac_addr, void *cookie,
  107. void (*callback)(void *cookie, struct key_params*));
  108. int (*del_key)(struct wiphy *wiphy, struct net_device *netdev,
  109. u8 key_index, u8 *mac_addr);
  110. int (*set_default_key)(struct wiphy *wiphy,
  111. struct net_device *netdev,
  112. u8 key_index);
  113. };
  114. #endif /* __NET_CFG80211_H */