Skip to contentSkip to conversation

d80211: switch status codes, reason codes, and EIDs to enums

PATCH In review Michael Wu 2 participants 4 messages Aug 13, 2006 – Aug 15, 2006

Subsystems (2)
lore
Share & tools
lore

Michael Wu

author
#0 lore raw

PATCH 1/1 d80211: switch status codes, reason codes, and EIDs to enums

d80211: switch status codes, reason codes, and EIDs to enums

This patch converts the status code, reason code, and EID defines in d80211_mgmt.h to enums. It also adds some status and reason codes, fixes some typos (DENOED, QUITE), and uses the ieee80211.h version of the name where reasonable.

---

 include/net/d80211_mgmt.h |  149 
++++++++++++++++++++++++++-------------------
 1 files changed, 87 insertions(+), 62 deletions(-)
include/net/d80211_mgmt.h +87 -62
index f623db3..6981c6f 100644
@@ -119,76 +119,101 @@ #define WLAN_CAPABILITY_SHORT_SLOT_TIME 
 #define WLAN_CAPABILITY_DSSS_OFDM BIT(13)
 
 /* Status codes */
-#define WLAN_STATUS_SUCCESS 0
-#define WLAN_STATUS_UNSPECIFIED_FAILURE 1
-#define WLAN_STATUS_CAPS_UNSUPPORTED 10
-#define WLAN_STATUS_REASSOC_NO_ASSOC 11
-#define WLAN_STATUS_ASSOC_DENIED_UNSPEC 12
-#define WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG 13
-#define WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION 14
-#define WLAN_STATUS_CHALLENGE_FAIL 15
-#define WLAN_STATUS_AUTH_TIMEOUT 16
-#define WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA 17
-#define WLAN_STATUS_ASSOC_DENIED_RATES 18
-/* 802.11b */
-#define WLAN_STATUS_ASSOC_DENIED_NOSHORT 19
-#define WLAN_STATUS_ASSOC_DENIED_NOPBCC 20
-#define WLAN_STATUS_ASSOC_DENIED_NOAGILITY 21
-/* 802.11h */
-#define WLAN_STATUS_SPEC_MGMT_REQUIRED 22
-#define WLAN_STATUS_PWR_CAPABILITY_NOT_VALID 23
-#define WLAN_STATUS_SUPPORTED_CHANNEL_NOT_VALID 24
-/* 802.11g */
-#define WLAN_STATUS_ASSOC_DENOED_NO_SHORT_SLOT_TIME 25
-#define WLAN_STATUS_ASSOC_DENOED_NO_ER_PBCC 26
-#define WLAN_STATUS_ASSOC_DENOED_NO_DSSS_OFDM 27
+enum ieee80211_statuscode {
+	WLAN_STATUS_SUCCESS = 0,
+	WLAN_STATUS_UNSPECIFIED_FAILURE = 1,
+	WLAN_STATUS_CAPS_UNSUPPORTED = 10,
+	WLAN_STATUS_REASSOC_NO_ASSOC = 11,
+	WLAN_STATUS_ASSOC_DENIED_UNSPEC = 12,
+	WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG = 13,
+	WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION = 14,
+	WLAN_STATUS_CHALLENGE_FAIL = 15,
+	WLAN_STATUS_AUTH_TIMEOUT = 16,
+	WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA = 17,
+	WLAN_STATUS_ASSOC_DENIED_RATES = 18,
+	/* 802.11b */
+	WLAN_STATUS_ASSOC_DENIED_NOSHORTPREAMBLE = 19,
+	WLAN_STATUS_ASSOC_DENIED_NOPBCC = 20,
+	WLAN_STATUS_ASSOC_DENIED_NOAGILITY = 21,
+	/* 802.11h */
+	WLAN_STATUS_ASSOC_DENIED_NOSPECTRUM = 22,
+	WLAN_STATUS_ASSOC_REJECTED_BAD_POWER = 23,
+	WLAN_STATUS_ASSOC_REJECTED_BAD_SUPP_CHAN = 24,
+	/* 802.11g */
+	WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25,
+	WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26,
+	/* 802.11i */
+	WLAN_STATUS_INVALID_IE = 40,
+	WLAN_STATUS_INVALID_GROUP_CIPHER = 41,
+	WLAN_STATUS_INVALID_PAIRWISE_CIPHER = 42,
+	WLAN_STATUS_INVALID_AKMP = 43,
+	WLAN_STATUS_UNSUPP_RSN_VERSION = 44,
+	WLAN_STATUS_INVALID_RSN_IE_CAP = 45,
+	WLAN_STATUS_CIPHER_SUITE_REJECTED = 46,
+};
 
 
 /* Reason codes */
-#define WLAN_REASON_UNSPECIFIED 1
-#define WLAN_REASON_PREV_AUTH_NOT_VALID 2
-#define WLAN_REASON_DEAUTH_LEAVING 3
-#define WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY 4
-#define WLAN_REASON_DISASSOC_AP_BUSY 5
-#define WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA 6
-#define WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA 7
-#define WLAN_REASON_DISASSOC_STA_HAS_LEFT 8
-#define WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH 9
-/* 802.11h */
-#define WLAN_REASON_PWR_CAPABILITY_NOT_VALID 10
-#define WLAN_REASON_SUPPORTED_CHANNEL_NOT_VALID 11
-
-#define WLAN_REASON_MIC_FAILURE 14
+enum ieee80211_reasoncode {
+	WLAN_REASON_UNSPECIFIED = 1,
+	WLAN_REASON_PREV_AUTH_NOT_VALID = 2,
+	WLAN_REASON_DEAUTH_LEAVING = 3,
+	WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY = 4,
+	WLAN_REASON_DISASSOC_AP_BUSY = 5,
+	WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA = 6,
+	WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA = 7,
+	WLAN_REASON_DISASSOC_STA_HAS_LEFT = 8,
+	WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH = 9,
+	/* 802.11h */
+	WLAN_REASON_DISASSOC_BAD_POWER = 10,
+	WLAN_REASON_DISASSOC_BAD_SUPP_CHAN = 11,
+	/* 802.11i */
+	WLAN_REASON_INVALID_IE = 13,
+	WLAN_REASON_MIC_FAILURE = 14,
+	WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT = 15,
+	WLAN_REASON_GROUP_KEY_HANDSHAKE_TIMEOUT = 16,
+	WLAN_REASON_IE_DIFFERENT = 17,
+	WLAN_REASON_INVALID_GROUP_CIPHER = 18,
+	WLAN_REASON_INVALID_PAIRWISE_CIPHER = 19,
+	WLAN_REASON_INVALID_AKMP = 20,
+	WLAN_REASON_UNSUPP_RSN_VERSION = 21,
+	WLAN_REASON_INVALID_RSN_IE_CAP = 22,
+	WLAN_REASON_IEEE8021X_FAILED = 23,
+	WLAN_REASON_CIPHER_SUITE_REJECTED = 24,
+};
 
 
 /* Information Element IDs */
-#define WLAN_EID_SSID 0
-#define WLAN_EID_SUPP_RATES 1
-#define WLAN_EID_FH_PARAMS 2
-#define WLAN_EID_DS_PARAMS 3
-#define WLAN_EID_CF_PARAMS 4
-#define WLAN_EID_TIM 5
-#define WLAN_EID_IBSS_PARAMS 6
-#define WLAN_EID_COUNTRY 7
-#define WLAN_EID_CHALLENGE 16
+enum ieee80211_eid {
+	WLAN_EID_SSID = 0,
+	WLAN_EID_SUPP_RATES = 1,
+	WLAN_EID_FH_PARAMS = 2,
+	WLAN_EID_DS_PARAMS = 3,
+	WLAN_EID_CF_PARAMS = 4,
+	WLAN_EID_TIM = 5,
+	WLAN_EID_IBSS_PARAMS = 6,
+	WLAN_EID_COUNTRY = 7,
+	WLAN_EID_CHALLENGE = 16,
 /* EIDs defined as part fo 11h - starts */
-#define WLAN_EID_PWR_CONSTRAINT	32
-#define WLAN_EID_PWR_CAPABILITY	33
-#define WLAN_EID_TPC_REQUEST	34
-#define WLAN_EID_TPC_REPORT	35
-#define WLAN_EID_SUPPORTED_CHANNELS	36
-#define WLAN_EID_CHANNEL_SWITCH	37
-#define WLAN_EID_MEASURE_REQUEST	38
-#define WLAN_EID_MEASURE_REPORT	39
-#define WLAN_EID_QUITE	40
-#define WLAN_EID_IBSS_DFS	41
+	WLAN_EID_PWR_CONSTRAINT = 32,
+	WLAN_EID_PWR_CAPABILITY = 33,
+	WLAN_EID_TPC_REQUEST = 34,
+	WLAN_EID_TPC_REPORT = 35,
+	WLAN_EID_SUPPORTED_CHANNELS = 36,
+	WLAN_EID_CHANNEL_SWITCH = 37,
+	WLAN_EID_MEASURE_REQUEST = 38,
+	WLAN_EID_MEASURE_REPORT = 39,
+	WLAN_EID_QUIET = 40,
+	WLAN_EID_IBSS_DFS = 41,
 /* EIDs defined as part fo 11h - ends */
-#define WLAN_EID_ERP_INFO 42
-#define WLAN_EID_RSN 48
-#define WLAN_EID_EXT_SUPP_RATES 50
-#define WLAN_EID_WPA 221
-#define WLAN_EID_GENERIC 221
-#define WLAN_EID_VENDOR_SPECIFIC 221
+	WLAN_EID_ERP_INFO = 42,
+	WLAN_EID_RSN = 48,
+	WLAN_EID_EXT_SUPP_RATES = 50,
+	WLAN_EID_WPA = 221,
+	WLAN_EID_GENERIC = 221,
+	WLAN_EID_VENDOR_SPECIFIC = 221,
+	WLAN_EID_QOS_PARAMETER = 222
+};
 
 
 
#1 lore raw

include/net/d80211_mgmt.h #define WLAN_CAPABILITY_SHORT_SLOT_TIME · line 206

Quoted 2 lines · Michael Wu
include/net/d80211_mgmt.h +1 -0
+	WLAN_EID_QUIET = 40,

I was about to send a patch fixing this as well :)

include/net/d80211_mgmt.h #define WLAN_CAPABILITY_SHORT_SLOT_TIME · line 208

Quoted 2 lines
include/net/d80211_mgmt.h +1 -0
+	WLAN_EID_IBSS_DFS = 41,
 /* EIDs defined as part fo 11h - ends */

Care to fix the two occurrences of this typo in a respun patch? (should be 'of' instead of 'fo') If you can't easily recreate that patch I'll send one after this goes in.

johannes

author
#2 lore raw
Quoted 7 lines · Johannes Berg

include/net/d80211_mgmt.h #define WLAN_CAPABILITY_SHORT_SLOT_TIME · line 208

Quoted 2 lines
include/net/d80211_mgmt.h +1 -0
+	WLAN_EID_IBSS_DFS = 41,
 /* EIDs defined as part fo 11h - ends */

Care to fix the two occurrences of this typo in a respun patch? (should be 'of' instead of 'fo')
If you can't easily recreate that patch I'll send one after this goes in.

I don't really like the comments in the EID section. I would rather have the comments resemble the ones in ieee80211_statuscode which identifies 802.11b/h/g/i instead of just pointing out the ones that are 802.11h. If you want to do that, that would be great, though I can probably get to it in a few days.

Thanks,
-Michael Wu

#3 lore raw
Quoted 2 lines · Michael Wu

I don't really like the comments in the EID section. I would rather have the comments resemble the ones in ieee80211_statuscode which identifies 802.11b/h/g/i instead of just pointing out the ones that are 802.11h. If you want to do that, that would be great, though I can probably get to it in a few days.

I'm currently torn between needing some things here for work, and doing that work. I'd prefer if you did it, I can at earliest do it on the weekend.

johannes