Move WMM AC parameter parser into a common file
This allows the same implementation to be used for wpa_supplicant, too. Signed-hostap: Yoni Divinsky <yoni.divinsky@ti.com>
This commit is contained in:
parent
504a5839ea
commit
eda070f14f
4 changed files with 86 additions and 81 deletions
|
@ -405,3 +405,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;
|
||||
}
|
||||
|
|
|
@ -85,4 +85,15 @@ struct wpabuf * ieee802_11_vendor_ie_concat(const u8 *ies, size_t ies_len,
|
|||
struct ieee80211_hdr;
|
||||
const u8 * get_hdr_bssid(const struct ieee80211_hdr *hdr, size_t len);
|
||||
|
||||
struct hostapd_wmm_ac_params {
|
||||
int cwmin;
|
||||
int cwmax;
|
||||
int aifs;
|
||||
int txop_limit; /* in units of 32us */
|
||||
int admission_control_mandatory;
|
||||
};
|
||||
|
||||
int hostapd_config_wmm_ac(struct hostapd_wmm_ac_params wmm_ac_params[],
|
||||
const char *name, const char *val);
|
||||
|
||||
#endif /* IEEE802_11_COMMON_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue