}
-int hostapd_parse_csa_settings(const char *pos,
- struct csa_settings *settings)
+int hostapd_parse_freq_params(const char *pos,
+ struct hostapd_freq_params *params,
+ unsigned int freq)
{
- char *end;
+ os_memset(params, 0, sizeof(*params));
- os_memset(settings, 0, sizeof(*settings));
- settings->cs_count = strtol(pos, &end, 10);
- if (pos == end) {
- wpa_printf(MSG_ERROR, "chanswitch: invalid cs_count provided");
- return -1;
- }
+ if (freq)
+ params->freq = freq;
+ else
+ params->freq = atoi(pos);
- settings->freq_params.freq = atoi(end);
- if (settings->freq_params.freq == 0) {
- wpa_printf(MSG_ERROR, "chanswitch: invalid freq provided");
+ if (params->freq == 0) {
+ wpa_printf(MSG_ERROR, "freq_params: invalid freq provided");
return -1;
}
-#define SET_CSA_SETTING(str) \
+#define SET_FREQ_PARAM(str) \
do { \
const char *pos2 = os_strstr(pos, " " #str "="); \
if (pos2) { \
pos2 += sizeof(" " #str "=") - 1; \
- settings->freq_params.str = atoi(pos2); \
+ params->str = atoi(pos2); \
} \
} while (0)
- SET_CSA_SETTING(center_freq1);
- SET_CSA_SETTING(center_freq2);
- SET_CSA_SETTING(bandwidth);
- SET_CSA_SETTING(sec_channel_offset);
- SET_CSA_SETTING(punct_bitmap);
- settings->freq_params.ht_enabled = !!os_strstr(pos, " ht");
- settings->freq_params.vht_enabled = !!os_strstr(pos, " vht");
- settings->freq_params.eht_enabled = !!os_strstr(pos, " eht");
- settings->freq_params.he_enabled = !!os_strstr(pos, " he") ||
- settings->freq_params.eht_enabled;
- settings->block_tx = !!os_strstr(pos, " blocktx");
-#undef SET_CSA_SETTING
+ SET_FREQ_PARAM(center_freq1);
+ SET_FREQ_PARAM(center_freq2);
+ SET_FREQ_PARAM(bandwidth);
+ SET_FREQ_PARAM(sec_channel_offset);
+ SET_FREQ_PARAM(punct_bitmap);
+ params->ht_enabled = !!os_strstr(pos, " ht");
+ params->vht_enabled = !!os_strstr(pos, " vht");
+ params->eht_enabled = !!os_strstr(pos, " eht");
+ params->he_enabled = !!os_strstr(pos, " he") ||
+ params->eht_enabled;
+#undef SET_FREQ_PARAM
return 0;
}
+int hostapd_parse_csa_settings(const char *pos,
+ struct csa_settings *settings)
+{
+ char *end;
+
+ os_memset(settings, 0, sizeof(*settings));
+ settings->cs_count = strtol(pos, &end, 10);
+ if (pos == end) {
+ wpa_printf(MSG_ERROR, "chanswitch: invalid cs_count provided");
+ return -1;
+ }
+
+ settings->block_tx = !!os_strstr(pos, " blocktx");
+
+ return hostapd_parse_freq_params(end, &settings->freq_params, 0);
+}
+
+
int hostapd_ctrl_iface_stop_ap(struct hostapd_data *hapd)
{
return hostapd_drv_stop_ap(hapd);