#define FUNC(f) #f, wpa_config_process_ ## f, OFFSET(f), NULL, NULL #define FUNC_NO_VAR(f) #f, wpa_config_process_ ## f, NULL, NULL, NULL #define _INT(f) #f, wpa_config_parse_int, OFFSET(f) #define INT(f) _INT(f), NULL, NULL #define INT_RANGE(f, min, max) _INT(f), (void *) min, (void *) max #define _STR(f) #f, wpa_config_parse_str, OFFSET(f) #define STR(f) _STR(f), NULL, NULL #define STR_RANGE(f, min, max) _STR(f), (void *) min, (void *) max static const struct global_parse_data global_fields[] = { #ifdef CONFIG_CTRL_IFACE { STR(ctrl_interface) }, { STR(ctrl_interface_group) } /* deprecated */, #endif /* CONFIG_CTRL_IFACE */ { INT_RANGE(eapol_version, 1, 2) }, { INT(ap_scan) }, { INT(fast_reauth) }, #ifdef EAP_TLS_OPENSSL { STR(opensc_engine_path) }, { STR(pkcs11_engine_path) }, { STR(pkcs11_module_path) }, #endif /* EAP_TLS_OPENSSL */ { STR(driver_param) }, { INT(dot11RSNAConfigPMKLifetime) }, { INT(dot11RSNAConfigPMKReauthThreshold) }, { INT(dot11RSNAConfigSATimeout) }, #ifndef CONFIG_NO_CONFIG_WRITE { INT(update_config) }, #endif /* CONFIG_NO_CONFIG_WRITE */ { FUNC_NO_VAR(load_dynamic_eap) },
* .param3 and .param4 can be used to mark the allowed range (length for STR * and value for INT). * * For each configuration line in wpa_supplicant.conf, the parser goes through * this table and select the entry that matches with the field name. The parser * function (.parser) is then called to parse the actual value of the field. * * This kind of mechanism makes it easy to add new configuration parameters, * since only one line needs to be added into this table and into the * struct wpa_ssid definition if the new variable is either a string or * integer. More complex types will need to use their own parser and writer * functions. */ static const struct parse_data ssid_fields[] = { { STR_RANGE(ssid, 0, MAX_SSID_LEN) }, { INT_RANGE(scan_ssid, 0, 1) }, { FUNC(bssid) }, { FUNC_KEY(psk) }, { FUNC(proto) }, { FUNC(key_mgmt) }, { FUNC(pairwise) }, { FUNC(group) }, { FUNC(auth_alg) }, #ifdef IEEE8021X_EAPOL { FUNC(eap) }, { STR_LENe(identity) }, { STR_LENe(anonymous_identity) }, { FUNC_KEY(password) }, { STRe(ca_cert) }, { STRe(ca_path) }, { STRe(client_cert) },
#define OFFSET(v) ((void *) &((struct wpa_ssid *) 0)->v) #define STR(f) .name = #f, .parser = wpa_config_parse_str, .param1 = OFFSET(f) #define STR_LEN(f) STR(f), .param2 = OFFSET(f ## _len) #define STR_RANGE(f, min, max) STR_LEN(f), .param3 = (void *) (min), \ .param4 = (void *) (max) #define INT(f) .name = #f, .parser = wpa_config_parse_int, \ .param1 = OFFSET(f), .param2 = (void *) 0 #define INT_RANGE(f, min, max) INT(f), .param3 = (void *) (min), \ .param4 = (void *) (max) #define FUNC(f) .name = #f, .parser = wpa_config_parse_ ## f static struct parse_data ssid_fields[] = { { STR_RANGE(ssid, 0, MAX_SSID_LEN) }, { INT_RANGE(scan_ssid, 0, 1) }, { FUNC(bssid) }, { FUNC(psk), .key_data = 1 }, { FUNC(proto) }, { FUNC(key_mgmt) }, { FUNC(pairwise) }, { FUNC(group) }, { FUNC(auth_alg) }, { FUNC(eap) }, { STR_LEN(identity) }, { STR_LEN(anonymous_identity) }, { STR_RANGE(eappsk, EAP_PSK_LEN, EAP_PSK_LEN), .key_data = 1 }, { STR_LEN(nai) }, { STR_LEN(server_nai) }, { STR_LEN(password), .key_data = 1 }, { STR(ca_cert) },
#define FUNC(f) #f, wpa_config_process_ ## f, OFFSET(f), NULL, NULL #define FUNC_NO_VAR(f) #f, wpa_config_process_ ## f, NULL, NULL, NULL #define _INT(f) #f, wpa_config_parse_int, OFFSET(f) #define INT(f) _INT(f), NULL, NULL #define INT_RANGE(f, min, max) _INT(f), (void *) min, (void *) max #define _STR(f) #f, wpa_config_parse_str, OFFSET(f) #define STR(f) _STR(f), NULL, NULL #define STR_RANGE(f, min, max) _STR(f), (void *) min, (void *) max static const struct global_parse_data global_fields[] = { #ifdef CONFIG_CTRL_IFACE { STR(ctrl_interface) }, { STR(ctrl_interface_group) } /* deprecated */, #endif /* CONFIG_CTRL_IFACE */ { INT_RANGE(eapol_version, 1, 2) }, { INT(ap_scan) }, { INT(fast_reauth) }, #ifdef EAP_TLS_OPENSSL { STR(opensc_engine_path) }, { STR(pkcs11_engine_path) }, { STR(pkcs11_module_path) }, #endif /* EAP_TLS_OPENSSL */ { STR(driver_param) }, { INT(dot11RSNAConfigPMKLifetime) }, { INT(dot11RSNAConfigPMKReauthThreshold) }, { INT(dot11RSNAConfigSATimeout) }, #ifndef CONFIG_NO_CONFIG_WRITE { INT(update_config) }, #endif /* CONFIG_NO_CONFIG_WRITE */ { FUNC_NO_VAR(load_dynamic_eap) },
#define STR(f) _STR(f), NULL, NULL, NULL, 0 #define STR_KEY(f) _STR(f), NULL, NULL, NULL, 1 #define _STR_LEN(f) _STR(f), OFFSET(f ## _len) #define STR_LEN(f) _STR_LEN(f), NULL, NULL, 0 #define _INT(f) #f, gct_config_parse_int, OFFSET(f), (void *) 0 #define INT(f) _INT(f), NULL, NULL, 0 #define INT_RANGE(f, min, max) _INT(f), (void *) (min), (void *) (max), 0 #define _FUNC(f) #f, gct_config_parse_ ## f, NULL, NULL, NULL, NULL #define FUNC(f) _FUNC(f), 0 #define FUNC_KEY(f) _FUNC(f), 1 static const struct parse_data ssid_fields[] = { { INT_RANGE(nspid, 0, 0xffffff) }, { INT_RANGE(use_pkm, 0, 1) }, { INT_RANGE(use_nv, 0, 1) }, { INT_RANGE(eap_type, -1, 7) }, { INT_RANGE(ca_cert_null, 0, 1) }, { INT_RANGE(dev_cert_null, 0, 1) }, { INT_RANGE(cert_nv, 0, 1) }, { INT_RANGE(wimax_verbose_level, -1, 3) }, { INT_RANGE(wpa_debug_level, 0, 4) }, { STR(log_file) }, { STR(event_script) }, { FUNC(eap) }, { STR_LEN(identity) }, { STR_LEN(anonymous_identity) }, { FUNC_KEY(password) }, { STR(ca_cert) },