OSDN Git Service

Accumulative patch from commit dc013f1e37df3462085cf01a13f0c432f146ad7a
[android-x86/external-wpa_supplicant_8.git] / src / common / ieee802_11_common.c
index b0d310d..98fadda 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * IEEE 802.11 Common routines
- * Copyright (c) 2002-2009, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2002-2012, Jouni Malinen <j@w1.fi>
  *
  * This software may be distributed under the terms of the BSD license.
  * See README for more details.
@@ -97,6 +97,16 @@ static int ieee802_11_parse_vendor_specific(const u8 *pos, size_t elen,
                        elems->p2p = pos;
                        elems->p2p_len = elen;
                        break;
+               case WFD_OUI_TYPE:
+                       /* Wi-Fi Alliance - WFD IE */
+                       elems->wfd = pos;
+                       elems->wfd_len = elen;
+                       break;
+               case HS20_INDICATION_OUI_TYPE:
+                       /* Hotspot 2.0 */
+                       elems->hs20 = pos;
+                       elems->hs20_len = elen;
+                       break;
                default:
                        wpa_printf(MSG_MSGDUMP, "Unknown WFA "
                                   "information element ignored "
@@ -248,6 +258,14 @@ ParseRes ieee802_11_parse_elems(const u8 *start, size_t len,
                        elems->ht_operation = pos;
                        elems->ht_operation_len = elen;
                        break;
+               case WLAN_EID_VHT_CAP:
+                       elems->vht_capabilities = pos;
+                       elems->vht_capabilities_len = elen;
+                       break;
+               case WLAN_EID_VHT_OPERATION:
+                       elems->vht_operation = pos;
+                       elems->vht_operation_len = elen;
+                       break;
                case WLAN_EID_LINK_ID:
                        if (elen < 18)
                                break;
@@ -257,6 +275,19 @@ ParseRes ieee802_11_parse_elems(const u8 *start, size_t len,
                        elems->interworking = pos;
                        elems->interworking_len = elen;
                        break;
+               case WLAN_EID_EXT_CAPAB:
+                       elems->ext_capab = pos;
+                       elems->ext_capab_len = elen;
+                       break;
+               case WLAN_EID_BSS_MAX_IDLE_PERIOD:
+                       if (elen < 3)
+                               break;
+                       elems->bss_max_idle_period = pos;
+                       break;
+               case WLAN_EID_SSID_LIST:
+                       elems->ssid_list = pos;
+                       elems->ssid_list_len = elen;
+                       break;
                default:
                        unknown++;
                        if (!show_errors)
@@ -383,3 +414,75 @@ const u8 * get_hdr_bssid(const struct ieee80211_hdr *hdr, size_t len)
                return NULL;
        }
 }
+
+
+int hostapd_config_wmm_ac(struct hostapd_wmm_ac_params wmm_ac_params[],
+                         const char *name, const char *val)
+{
+       int num, v;
+       const char *pos;
+       struct hostapd_wmm_ac_params *ac;
+
+       /* skip 'wme_ac_' or 'wmm_ac_' prefix */
+       pos = name + 7;
+       if (os_strncmp(pos, "be_", 3) == 0) {
+               num = 0;
+               pos += 3;
+       } else if (os_strncmp(pos, "bk_", 3) == 0) {
+               num = 1;
+               pos += 3;
+       } else if (os_strncmp(pos, "vi_", 3) == 0) {
+               num = 2;
+               pos += 3;
+       } else if (os_strncmp(pos, "vo_", 3) == 0) {
+               num = 3;
+               pos += 3;
+       } else {
+               wpa_printf(MSG_ERROR, "Unknown WMM name '%s'", pos);
+               return -1;
+       }
+
+       ac = &wmm_ac_params[num];
+
+       if (os_strcmp(pos, "aifs") == 0) {
+               v = atoi(val);
+               if (v < 1 || v > 255) {
+                       wpa_printf(MSG_ERROR, "Invalid AIFS value %d", v);
+                       return -1;
+               }
+               ac->aifs = v;
+       } else if (os_strcmp(pos, "cwmin") == 0) {
+               v = atoi(val);
+               if (v < 0 || v > 12) {
+                       wpa_printf(MSG_ERROR, "Invalid cwMin value %d", v);
+                       return -1;
+               }
+               ac->cwmin = v;
+       } else if (os_strcmp(pos, "cwmax") == 0) {
+               v = atoi(val);
+               if (v < 0 || v > 12) {
+                       wpa_printf(MSG_ERROR, "Invalid cwMax value %d", v);
+                       return -1;
+               }
+               ac->cwmax = v;
+       } else if (os_strcmp(pos, "txop_limit") == 0) {
+               v = atoi(val);
+               if (v < 0 || v > 0xffff) {
+                       wpa_printf(MSG_ERROR, "Invalid txop value %d", v);
+                       return -1;
+               }
+               ac->txop_limit = v;
+       } else if (os_strcmp(pos, "acm") == 0) {
+               v = atoi(val);
+               if (v < 0 || v > 1) {
+                       wpa_printf(MSG_ERROR, "Invalid acm value %d", v);
+                       return -1;
+               }
+               ac->admission_control_mandatory = v;
+       } else {
+               wpa_printf(MSG_ERROR, "Unknown wmm_ac_ field '%s'", pos);
+               return -1;
+       }
+
+       return 0;
+}