+wireless_valid_reg_domain() {
+ local country_code="${1}"
+
+ # Empty country codes are invalid
+ isset country_code || return ${EXIT_FALSE}
+
+ local valid_country_codes="$(wireless_list_reg_domains)"
+
+ if list_match "${country_code}" ${valid_country_codes}; then
+ return ${EXIT_TRUE}
+ fi
+
+ return ${EXIT_FALSE}
+}
+
+wireless_list_reg_domains() {
+ if [ ! -r "${WIRELESS_REGULATORY_DOMAIN_DATABASE}" ]; then
+ log ERROR "Could not read ${WIRELESS_REGULATORY_DOMAIN_DATABASE}"
+ return ${EXIT_ERROR}
+ fi
+
+ local line
+ while read line; do
+ # Check if line starts with "country"
+ [ "${line:0:7}" = "country" ] || continue
+
+ # Print country code
+ print "${line:8:2}"
+ done <<< "$(regdbdump ${WIRELESS_REGULATORY_DOMAIN_DATABASE})"
+}
+