Johannes Berg | 704232c | 2007-04-23 12:20:05 -0700 | [diff] [blame] | 1 | #ifndef __NET_CFG80211_H |
| 2 | #define __NET_CFG80211_H |
| 3 | |
| 4 | #include <linux/netlink.h> |
| 5 | #include <linux/skbuff.h> |
Johannes Berg | 5568296 | 2007-09-20 13:09:35 -0400 | [diff] [blame] | 6 | #include <linux/nl80211.h> |
Johannes Berg | 704232c | 2007-04-23 12:20:05 -0700 | [diff] [blame] | 7 | #include <net/genetlink.h> |
| 8 | |
| 9 | /* |
| 10 | * 802.11 configuration in-kernel interface |
| 11 | * |
Johannes Berg | 5568296 | 2007-09-20 13:09:35 -0400 | [diff] [blame] | 12 | * Copyright 2006, 2007 Johannes Berg <johannes@sipsolutions.net> |
Johannes Berg | 704232c | 2007-04-23 12:20:05 -0700 | [diff] [blame] | 13 | */ |
| 14 | |
Andy Green | 179f831 | 2007-07-10 19:29:38 +0200 | [diff] [blame] | 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 | |
Johannes Berg | 41ade00 | 2007-12-19 02:03:29 +0100 | [diff] [blame] | 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 | |
Johannes Berg | ed1b6cc | 2007-12-19 02:03:32 +0100 | [diff] [blame^] | 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 | |
Johannes Berg | 704232c | 2007-04-23 12:20:05 -0700 | [diff] [blame] | 92 | /* from net/wireless.h */ |
| 93 | struct wiphy; |
| 94 | |
| 95 | /** |
| 96 | * struct cfg80211_ops - backend description for wireless configuration |
| 97 | * |
| 98 | * This struct is registered by fullmac card drivers and/or wireless stacks |
| 99 | * in order to handle configuration requests on their interfaces. |
| 100 | * |
| 101 | * All callbacks except where otherwise noted should return 0 |
| 102 | * on success or a negative error code. |
| 103 | * |
Johannes Berg | 43fb45cb | 2007-04-24 14:07:27 -0700 | [diff] [blame] | 104 | * All operations are currently invoked under rtnl for consistency with the |
| 105 | * wireless extensions but this is subject to reevaluation as soon as this |
| 106 | * code is used more widely and we have a first user without wext. |
| 107 | * |
Johannes Berg | 704232c | 2007-04-23 12:20:05 -0700 | [diff] [blame] | 108 | * @add_virtual_intf: create a new virtual interface with the given name |
| 109 | * |
| 110 | * @del_virtual_intf: remove the virtual interface determined by ifindex. |
Johannes Berg | 5568296 | 2007-09-20 13:09:35 -0400 | [diff] [blame] | 111 | * |
| 112 | * @change_virtual_intf: change type of virtual interface |
| 113 | * |
Johannes Berg | 41ade00 | 2007-12-19 02:03:29 +0100 | [diff] [blame] | 114 | * @add_key: add a key with the given parameters. @mac_addr will be %NULL |
| 115 | * when adding a group key. |
| 116 | * |
| 117 | * @get_key: get information about the key with the given parameters. |
| 118 | * @mac_addr will be %NULL when requesting information for a group |
| 119 | * key. All pointers given to the @callback function need not be valid |
| 120 | * after it returns. |
| 121 | * |
| 122 | * @del_key: remove a key given the @mac_addr (%NULL for a group key) |
| 123 | * and @key_index |
| 124 | * |
| 125 | * @set_default_key: set the default key on an interface |
Johannes Berg | ed1b6cc | 2007-12-19 02:03:32 +0100 | [diff] [blame^] | 126 | * |
| 127 | * @add_beacon: Add a beacon with given parameters, @head, @interval |
| 128 | * and @dtim_period will be valid, @tail is optional. |
| 129 | * @set_beacon: Change the beacon parameters for an access point mode |
| 130 | * interface. This should reject the call when no beacon has been |
| 131 | * configured. |
| 132 | * @del_beacon: Remove beacon configuration and stop sending the beacon. |
Johannes Berg | 704232c | 2007-04-23 12:20:05 -0700 | [diff] [blame] | 133 | */ |
| 134 | struct cfg80211_ops { |
| 135 | int (*add_virtual_intf)(struct wiphy *wiphy, char *name, |
Johannes Berg | 5568296 | 2007-09-20 13:09:35 -0400 | [diff] [blame] | 136 | enum nl80211_iftype type); |
Johannes Berg | 704232c | 2007-04-23 12:20:05 -0700 | [diff] [blame] | 137 | int (*del_virtual_intf)(struct wiphy *wiphy, int ifindex); |
Johannes Berg | 5568296 | 2007-09-20 13:09:35 -0400 | [diff] [blame] | 138 | int (*change_virtual_intf)(struct wiphy *wiphy, int ifindex, |
| 139 | enum nl80211_iftype type); |
Johannes Berg | 41ade00 | 2007-12-19 02:03:29 +0100 | [diff] [blame] | 140 | |
| 141 | int (*add_key)(struct wiphy *wiphy, struct net_device *netdev, |
| 142 | u8 key_index, u8 *mac_addr, |
| 143 | struct key_params *params); |
| 144 | int (*get_key)(struct wiphy *wiphy, struct net_device *netdev, |
| 145 | u8 key_index, u8 *mac_addr, void *cookie, |
| 146 | void (*callback)(void *cookie, struct key_params*)); |
| 147 | int (*del_key)(struct wiphy *wiphy, struct net_device *netdev, |
| 148 | u8 key_index, u8 *mac_addr); |
| 149 | int (*set_default_key)(struct wiphy *wiphy, |
| 150 | struct net_device *netdev, |
| 151 | u8 key_index); |
Johannes Berg | ed1b6cc | 2007-12-19 02:03:32 +0100 | [diff] [blame^] | 152 | |
| 153 | int (*add_beacon)(struct wiphy *wiphy, struct net_device *dev, |
| 154 | struct beacon_parameters *info); |
| 155 | int (*set_beacon)(struct wiphy *wiphy, struct net_device *dev, |
| 156 | struct beacon_parameters *info); |
| 157 | int (*del_beacon)(struct wiphy *wiphy, struct net_device *dev); |
Johannes Berg | 704232c | 2007-04-23 12:20:05 -0700 | [diff] [blame] | 158 | }; |
| 159 | |
| 160 | #endif /* __NET_CFG80211_H */ |