]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
WNM: Use defined macros for WNM-Sleep Mode Action Type values
authorJouni Malinen <j@w1.fi>
Sun, 16 Dec 2012 10:57:38 +0000 (12:57 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 16 Dec 2012 10:57:38 +0000 (12:57 +0200)
Signed-hostap: Jouni Malinen <j@w1.fi>

src/common/ieee802_11_defs.h
wpa_supplicant/ctrl_iface.c
wpa_supplicant/wnm_sta.c

index 07c85807aa493ecd754a1563e77bff50abd841bf..484a5b9c48b331d72ad76bade10a0196a9ed1769 100644 (file)
@@ -1048,11 +1048,14 @@ struct ieee80211_2040_intol_chan_report {
 struct wnm_sleep_element {
        u8 eid;     /* WLAN_EID_WNMSLEEP */
        u8 len;
-       u8 action_type; /* WLAN_WNM_SLEEP_ENTER/EXIT */
+       u8 action_type; /* WNM_SLEEP_ENTER/WNM_SLEEP_MODE_EXIT */
        u8 status;
        le16 intval;
 } STRUCT_PACKED;
 
+#define WNM_SLEEP_MODE_ENTER 0
+#define WNM_SLEEP_MODE_EXIT 1
+
 enum wnm_sleep_mode_response_status {
        WNM_STATUS_SLEEP_ACCEPT = 0,
        WNM_STATUS_SLEEP_EXIT_ACCEPT_GTK_UPDATE = 1,
index 7a27abdb6345ceb8cf92121331e00b544d63e8dd..904a12eaa8196079f2a2ef6aede8033e13766573 100644 (file)
@@ -4715,7 +4715,8 @@ static int wpas_ctrl_iface_wnm_sleep(struct wpa_supplicant *wpa_s, char *cmd)
                }
        }
 
-       ret = ieee802_11_send_wnmsleep_req(wpa_s, enter ? 0 : 1, intval,
+       ret = ieee802_11_send_wnmsleep_req(wpa_s, enter ? WNM_SLEEP_MODE_ENTER :
+                                          WNM_SLEEP_MODE_EXIT, intval,
                                           tfs_req);
        wpabuf_free(tfs_req);
 
index a2abf61acd2b94198c343227257a4ded15c257f0..331b7e74e88845ddffbd155ae0999ec75fac5b93 100644 (file)
@@ -188,7 +188,7 @@ static void ieee802_11_rx_wnmsleep_resp(struct wpa_supplicant *wpa_s,
                wpa_printf(MSG_DEBUG, "Successfully recv WNM-Sleep Response "
                           "frame (action=%d, intval=%d)",
                           wnmsleep_ie->action_type, wnmsleep_ie->intval);
-               if (wnmsleep_ie->action_type == 0) {
+               if (wnmsleep_ie->action_type == WNM_SLEEP_MODE_ENTER) {
                        wpa_drv_wnm_oper(wpa_s, WNM_SLEEP_ENTER_CONFIRM,
                                         wpa_s->bssid, NULL, NULL);
                        /* remove GTK/IGTK ?? */
@@ -212,7 +212,7 @@ static void ieee802_11_rx_wnmsleep_resp(struct wpa_supplicant *wpa_s,
                                        wpa_printf(MSG_DEBUG, "Fail to set "
                                                   "TFS Resp IE");
                        }
-               } else if (wnmsleep_ie->action_type == 1) {
+               } else if (wnmsleep_ie->action_type == WNM_SLEEP_MODE_EXIT) {
                        u8 *ptr, *end;
                        wpa_drv_wnm_oper(wpa_s, WNM_SLEEP_EXIT_CONFIRM,
                                         wpa_s->bssid, NULL, NULL);
@@ -270,10 +270,10 @@ static void ieee802_11_rx_wnmsleep_resp(struct wpa_supplicant *wpa_s,
                wpa_printf(MSG_DEBUG, "Reject recv WNM-Sleep Response frame "
                           "(action=%d, intval=%d)",
                           wnmsleep_ie->action_type, wnmsleep_ie->intval);
-               if (wnmsleep_ie->action_type == 0)
+               if (wnmsleep_ie->action_type == WNM_SLEEP_MODE_ENTER)
                        wpa_drv_wnm_oper(wpa_s, WNM_SLEEP_ENTER_FAIL,
                                         wpa_s->bssid, NULL, NULL);
-               else if (wnmsleep_ie->action_type == 1)
+               else if (wnmsleep_ie->action_type == WNM_SLEEP_MODE_EXIT)
                        wpa_drv_wnm_oper(wpa_s, WNM_SLEEP_EXIT_FAIL,
                                         wpa_s->bssid, NULL, NULL);
        }