| Javier Lopez | 7882513 | 2011-06-01 11:26:13 +0200 | [diff] [blame] | 1 | /* | 
 | 2 |  * mac80211_hwsim - software simulator of 802.11 radio(s) for mac80211 | 
 | 3 |  * Copyright (c) 2008, Jouni Malinen <j@w1.fi> | 
 | 4 |  * Copyright (c) 2011, Javier Lopez <jlopex@gmail.com> | 
 | 5 |  * | 
 | 6 |  * This program is free software; you can redistribute it and/or modify | 
 | 7 |  * it under the terms of the GNU General Public License version 2 as | 
 | 8 |  * published by the Free Software Foundation. | 
 | 9 |  */ | 
 | 10 |  | 
 | 11 | #ifndef __MAC80211_HWSIM_H | 
 | 12 | #define __MAC80211_HWSIM_H | 
 | 13 |  | 
 | 14 | /** | 
 | 15 |  * enum hwsim_tx_control_flags - flags to describe transmission info/status | 
 | 16 |  * | 
 | 17 |  * These flags are used to give the wmediumd extra information in order to | 
 | 18 |  * modify its behavior for each frame | 
 | 19 |  * | 
 | 20 |  * @HWSIM_TX_CTL_REQ_TX_STATUS: require TX status callback for this frame. | 
 | 21 |  * @HWSIM_TX_CTL_NO_ACK: tell the wmediumd not to wait for an ack | 
 | 22 |  * @HWSIM_TX_STAT_ACK: Frame was acknowledged | 
 | 23 |  * | 
 | 24 |  */ | 
 | 25 | enum hwsim_tx_control_flags { | 
 | 26 | 	HWSIM_TX_CTL_REQ_TX_STATUS		= BIT(0), | 
 | 27 | 	HWSIM_TX_CTL_NO_ACK			= BIT(1), | 
 | 28 | 	HWSIM_TX_STAT_ACK			= BIT(2), | 
 | 29 | }; | 
 | 30 |  | 
 | 31 | /** | 
 | 32 |  * DOC: Frame transmission/registration support | 
 | 33 |  * | 
 | 34 |  * Frame transmission and registration support exists to allow userspace | 
 | 35 |  * entities such as wmediumd to receive and process all broadcasted | 
 | 36 |  * frames from a mac80211_hwsim radio device. | 
 | 37 |  * | 
 | 38 |  * This allow user space applications to decide if the frame should be | 
 | 39 |  * dropped or not and implement a wireless medium simulator at user space. | 
 | 40 |  * | 
 | 41 |  * Registration is done by sending a register message to the driver and | 
 | 42 |  * will be automatically unregistered if the user application doesn't | 
 | 43 |  * responds to sent frames. | 
 | 44 |  * Once registered the user application has to take responsibility of | 
 | 45 |  * broadcasting the frames to all listening mac80211_hwsim radio | 
 | 46 |  * interfaces. | 
 | 47 |  * | 
 | 48 |  * For more technical details, see the corresponding command descriptions | 
 | 49 |  * below. | 
 | 50 |  */ | 
 | 51 |  | 
 | 52 | /** | 
 | 53 |  * enum hwsim_commands - supported hwsim commands | 
 | 54 |  * | 
 | 55 |  * @HWSIM_CMD_UNSPEC: unspecified command to catch errors | 
 | 56 |  * | 
 | 57 |  * @HWSIM_CMD_REGISTER: request to register and received all broadcasted | 
 | 58 |  *	frames by any mac80211_hwsim radio device. | 
 | 59 |  * @HWSIM_CMD_FRAME: send/receive a broadcasted frame from/to kernel/user | 
 | 60 |  * space, uses: | 
 | 61 |  *	%HWSIM_ATTR_ADDR_TRANSMITTER, %HWSIM_ATTR_ADDR_RECEIVER, | 
 | 62 |  *	%HWSIM_ATTR_FRAME, %HWSIM_ATTR_FLAGS, %HWSIM_ATTR_RX_RATE, | 
 | 63 |  *	%HWSIM_ATTR_SIGNAL, %HWSIM_ATTR_COOKIE | 
 | 64 |  * @HWSIM_CMD_TX_INFO_FRAME: Transmission info report from user space to | 
 | 65 |  * kernel, uses: | 
 | 66 |  *	%HWSIM_ATTR_ADDR_TRANSMITTER, %HWSIM_ATTR_FLAGS, | 
 | 67 |  *	%HWSIM_ATTR_TX_INFO, %HWSIM_ATTR_SIGNAL, %HWSIM_ATTR_COOKIE | 
 | 68 |  * @__HWSIM_CMD_MAX: enum limit | 
 | 69 |  */ | 
 | 70 | enum { | 
 | 71 | 	HWSIM_CMD_UNSPEC, | 
 | 72 | 	HWSIM_CMD_REGISTER, | 
 | 73 | 	HWSIM_CMD_FRAME, | 
 | 74 | 	HWSIM_CMD_TX_INFO_FRAME, | 
 | 75 | 	__HWSIM_CMD_MAX, | 
 | 76 | }; | 
 | 77 | #define HWSIM_CMD_MAX (_HWSIM_CMD_MAX - 1) | 
 | 78 |  | 
 | 79 | /** | 
 | 80 |  * enum hwsim_attrs - hwsim netlink attributes | 
 | 81 |  * | 
 | 82 |  * @HWSIM_ATTR_UNSPEC: unspecified attribute to catch errors | 
 | 83 |  * | 
 | 84 |  * @HWSIM_ATTR_ADDR_RECEIVER: MAC address of the radio device that | 
 | 85 |  *	the frame is broadcasted to | 
 | 86 |  * @HWSIM_ATTR_ADDR_TRANSMITTER: MAC address of the radio device that | 
 | 87 |  *	the frame was broadcasted from | 
 | 88 |  * @HWSIM_ATTR_FRAME: Data array | 
 | 89 |  * @HWSIM_ATTR_FLAGS: mac80211 transmission flags, used to process | 
 | 90 | 	properly the frame at user space | 
 | 91 |  * @HWSIM_ATTR_RX_RATE: estimated rx rate index for this frame at user | 
 | 92 | 	space | 
 | 93 |  * @HWSIM_ATTR_SIGNAL: estimated RX signal for this frame at user | 
 | 94 | 	space | 
 | 95 |  * @HWSIM_ATTR_TX_INFO: ieee80211_tx_rate array | 
 | 96 |  * @HWSIM_ATTR_COOKIE: sk_buff cookie to identify the frame | 
 | 97 |  * @__HWSIM_ATTR_MAX: enum limit | 
 | 98 |  */ | 
 | 99 |  | 
 | 100 |  | 
 | 101 | enum { | 
 | 102 | 	HWSIM_ATTR_UNSPEC, | 
 | 103 | 	HWSIM_ATTR_ADDR_RECEIVER, | 
 | 104 | 	HWSIM_ATTR_ADDR_TRANSMITTER, | 
 | 105 | 	HWSIM_ATTR_FRAME, | 
 | 106 | 	HWSIM_ATTR_FLAGS, | 
 | 107 | 	HWSIM_ATTR_RX_RATE, | 
 | 108 | 	HWSIM_ATTR_SIGNAL, | 
 | 109 | 	HWSIM_ATTR_TX_INFO, | 
 | 110 | 	HWSIM_ATTR_COOKIE, | 
 | 111 | 	__HWSIM_ATTR_MAX, | 
 | 112 | }; | 
 | 113 | #define HWSIM_ATTR_MAX (__HWSIM_ATTR_MAX - 1) | 
 | 114 |  | 
 | 115 | /** | 
 | 116 |  * struct hwsim_tx_rate - rate selection/status | 
 | 117 |  * | 
 | 118 |  * @idx: rate index to attempt to send with | 
 | 119 |  * @count: number of tries in this rate before going to the next rate | 
 | 120 |  * | 
 | 121 |  * A value of -1 for @idx indicates an invalid rate and, if used | 
 | 122 |  * in an array of retry rates, that no more rates should be tried. | 
 | 123 |  * | 
 | 124 |  * When used for transmit status reporting, the driver should | 
 | 125 |  * always report the rate and number of retries used. | 
 | 126 |  * | 
 | 127 |  */ | 
 | 128 | struct hwsim_tx_rate { | 
 | 129 | 	s8 idx; | 
 | 130 | 	u8 count; | 
 | 131 | } __packed; | 
 | 132 |  | 
 | 133 | #endif /* __MAC80211_HWSIM_H */ |