void *ctx;
};
+#define HOSTAPD_RATE_BASIC 0x00000001
+
+struct hostapd_rate_data {
+ int rate; /* rate in 100 kbps */
+ int flags; /* HOSTAPD_RATE_ flags */
+};
+
+
/**
* struct hostapd_data - hostapd per-BSS data structure
*/
hapd->iface->num_rates = 0;
hapd->iface->current_rates =
- os_malloc(mode->num_rates * sizeof(struct hostapd_rate_data));
+ os_zalloc(mode->num_rates * sizeof(struct hostapd_rate_data));
if (!hapd->iface->current_rates) {
wpa_printf(MSG_ERROR, "Failed to allocate memory for rate "
"table.");
if (hapd->iconf->supported_rates &&
!hostapd_rate_found(hapd->iconf->supported_rates,
- mode->rates[i].rate))
+ mode->rates[i]))
continue;
rate = &hapd->iface->current_rates[hapd->iface->num_rates];
- os_memcpy(rate, &mode->rates[i],
- sizeof(struct hostapd_rate_data));
+ rate->rate = mode->rates[i];
if (hostapd_rate_found(basic_rates, rate->rate)) {
rate->flags |= HOSTAPD_RATE_BASIC;
num_basic_rates++;
- } else
- rate->flags &= ~HOSTAPD_RATE_BASIC;
+ }
wpa_printf(MSG_DEBUG, "RATE[%d] rate=%d flags=0x%x",
hapd->iface->num_rates, rate->rate, rate->flags);
hapd->iface->num_rates++;
u8 max_tx_power; /* maximum transmit power in dBm */
};
-#define HOSTAPD_RATE_BASIC 0x00000002
-
-struct hostapd_rate_data {
- int rate; /* rate in 100 kbps */
- int flags; /* HOSTAPD_RATE_ flags for internal use */
-};
-
struct hostapd_hw_modes {
hostapd_hw_mode mode;
int num_channels;
struct hostapd_channel_data *channels;
int num_rates;
- struct hostapd_rate_data *rates;
+ int *rates; /* array of rates in 100 kbps units */
u16 ht_capab;
u8 mcs_set[16];
u8 a_mpdu_params;
mode->num_rates = 4;
clen = mode->num_channels * sizeof(struct hostapd_channel_data);
- rlen = mode->num_rates * sizeof(struct hostapd_rate_data);
+ rlen = mode->num_rates * sizeof(int);
mode->channels = os_zalloc(clen);
mode->rates = os_zalloc(rlen);
mode->channels[i].flag = HOSTAPD_CHAN_DISABLED;
}
- mode->rates[0].rate = 10;
- mode->rates[1].rate = 20;
- mode->rates[2].rate = 55;
- mode->rates[3].rate = 110;
+ mode->rates[0] = 10;
+ mode->rates[1] = 20;
+ mode->rates[2] = 55;
+ mode->rates[3] = 110;
return mode;
}
mode->num_rates++;
}
- mode->rates = calloc(mode->num_rates, sizeof(struct hostapd_rate_data));
+ mode->rates = calloc(mode->num_rates, sizeof(int));
if (!mode->rates)
return NL_SKIP;
nla_len(nl_rate), rate_policy);
if (!tb_rate[NL80211_BITRATE_ATTR_RATE])
continue;
- mode->rates[idx].rate = nla_get_u32(tb_rate[NL80211_BITRATE_ATTR_RATE]);
+ mode->rates[idx] = nla_get_u32(tb_rate[NL80211_BITRATE_ATTR_RATE]);
/* crude heuristic */
if (mode->mode == HOSTAPD_MODE_IEEE80211B &&
- mode->rates[idx].rate > 200)
+ mode->rates[idx] > 200)
mode->mode = HOSTAPD_MODE_IEEE80211G;
idx++;
mode11g->num_channels * sizeof(struct hostapd_channel_data));
mode->num_rates = 0;
- mode->rates = os_malloc(4 * sizeof(struct hostapd_rate_data));
+ mode->rates = os_malloc(4 * sizeof(int));
if (mode->rates == NULL) {
os_free(mode->channels);
(*num_modes)--;
}
for (i = 0; i < mode11g->num_rates; i++) {
- if (mode11g->rates[i].rate != 10 &&
- mode11g->rates[i].rate != 20 &&
- mode11g->rates[i].rate != 55 &&
- mode11g->rates[i].rate != 110)
+ if (mode11g->rates[i] != 10 && mode11g->rates[i] != 20 &&
+ mode11g->rates[i] != 55 && mode11g->rates[i] != 110)
continue;
mode->rates[mode->num_rates] = mode11g->rates[i];
mode->num_rates++;
modes[0].num_channels = 1;
modes[0].num_rates = 1;
modes[0].channels = os_zalloc(sizeof(struct hostapd_channel_data));
- modes[0].rates = os_zalloc(sizeof(struct hostapd_rate_data));
+ modes[0].rates = os_zalloc(sizeof(int));
if (modes[0].channels == NULL || modes[0].rates == NULL)
goto fail;
modes[0].channels[0].chan = 1;
modes[0].channels[0].freq = 2412;
modes[0].channels[0].flag = 0;
- modes[0].rates[0].rate = 10;
+ modes[0].rates[0] = 10;
modes[1].mode = HOSTAPD_MODE_IEEE80211B;
modes[1].num_channels = 1;
modes[1].num_rates = 1;
modes[1].channels = os_zalloc(sizeof(struct hostapd_channel_data));
- modes[1].rates = os_zalloc(sizeof(struct hostapd_rate_data));
+ modes[1].rates = os_zalloc(sizeof(int));
if (modes[1].channels == NULL || modes[1].rates == NULL)
goto fail;
modes[1].channels[0].chan = 1;
modes[1].channels[0].freq = 2412;
modes[1].channels[0].flag = 0;
- modes[1].rates[0].rate = 10;
+ modes[1].rates[0] = 10;
modes[2].mode = HOSTAPD_MODE_IEEE80211A;
modes[2].num_channels = 1;
modes[2].num_rates = 1;
modes[2].channels = os_zalloc(sizeof(struct hostapd_channel_data));
- modes[2].rates = os_zalloc(sizeof(struct hostapd_rate_data));
+ modes[2].rates = os_zalloc(sizeof(int));
if (modes[2].channels == NULL || modes[2].rates == NULL)
goto fail;
modes[2].channels[0].chan = 60;
modes[2].channels[0].freq = 5300;
modes[2].channels[0].flag = 0;
- modes[2].rates[0].rate = 60;
+ modes[2].rates[0] = 60;
return modes;
blen += len + 2;
*pos++ = WLAN_EID_SUPP_RATES;
*pos++ = len;
- for (i = 0; i < len; i++) {
- int rate = wpa_s->mlme.curr_rates[i].rate;
- *pos++ = (u8) (rate / 5);
- }
+ for (i = 0; i < len; i++)
+ *pos++ = (u8) (wpa_s->mlme.curr_rates[i] / 5);
if (wpa_s->mlme.num_curr_rates > len) {
pos = buf + blen;
blen += wpa_s->mlme.num_curr_rates - len + 2;
*pos++ = WLAN_EID_EXT_SUPP_RATES;
*pos++ = wpa_s->mlme.num_curr_rates - len;
- for (i = len; i < wpa_s->mlme.num_curr_rates; i++) {
- int rate = wpa_s->mlme.curr_rates[i].rate;
- *pos++ = (u8) (rate / 5);
- }
+ for (i = len; i < wpa_s->mlme.num_curr_rates; i++)
+ *pos++ = (u8) (wpa_s->mlme.curr_rates[i] / 5);
}
if (wpa_s->mlme.extra_ie && wpa_s->mlme.auth_alg != WLAN_AUTH_FT) {
supp_rates[0] = WLAN_EID_SUPP_RATES;
supp_rates[1] = 0;
for (i = 0; i < wpa_s->mlme.num_curr_rates; i++) {
- struct hostapd_rate_data *rate = &wpa_s->mlme.curr_rates[i];
if (esupp_rates) {
pos = buf + len;
len++;
len++;
supp_rates[1]++;
}
- *pos++ = rate->rate / 5;
+ *pos++ = wpa_s->mlme.curr_rates[i] / 5;
}
if (wpa_s->mlme.extra_probe_ie) {
if (local->conf.phymode == MODE_ATHEROS_TURBO)
rate *= 2;
for (j = 0; j < local->num_curr_rates; j++)
- if (local->curr_rates[j].rate == rate)
+ if (local->curr_rates[j] == rate)
rates |= BIT(j);
}
wpa_s->mlme.supp_rates_bits = rates;
pos = bss->supp_rates;
#if 0 /* FIX */
for (i = 0; i < local->num_curr_rates; i++) {
- int rate = local->curr_rates[i].rate;
+ int rate = local->curr_rates[i];
if (local->conf.phymode == MODE_ATHEROS_TURBO)
rate /= 2;
*pos++ = (u8) (rate / 5);
unsigned int hw_modes; /* bitfield of allowed hardware modes;
* (1 << HOSTAPD_MODE_*) */
int num_curr_rates;
- struct hostapd_rate_data *curr_rates;
+ int *curr_rates;
int freq; /* The current frequency in MHz */
int channel; /* The current IEEE 802.11 channel number */