9 /* Common regulatory structures, functions and helpers */
11 /* This matches the kernel's data structures */
12 struct ieee80211_freq_range {
13 uint32_t start_freq_khz;
14 uint32_t end_freq_khz;
15 uint32_t max_bandwidth_khz;
18 struct ieee80211_power_rule {
19 uint32_t max_antenna_gain;
23 struct ieee80211_reg_rule {
24 struct ieee80211_freq_range freq_range;
25 struct ieee80211_power_rule power_rule;
29 struct ieee80211_regdomain {
32 struct ieee80211_reg_rule reg_rules[];
35 static inline int is_world_regdom(const char *alpha2)
37 if (alpha2[0] == '0' && alpha2[1] == '0')
42 static inline int isalpha_upper(char letter)
44 if (letter >= 'A' && letter <= 'Z')
49 static inline int is_alpha2(const char *alpha2)
51 if (isalpha_upper(alpha2[0]) && isalpha_upper(alpha2[1]))
56 static inline int is_valid_regdom(const char *alpha2)
58 if (!is_alpha2(alpha2) && !is_world_regdom(alpha2))
64 static inline uint32_t max(uint32_t a, uint32_t b)
66 return (a > b) ? a : b;
69 static inline uint32_t min(uint32_t a, uint32_t b)
71 return (a > b) ? b : a;
74 void *crda_get_file_ptr(uint8_t *db, int dblen, int structlen, uint32_t ptr);
75 int crda_verify_db_signature(uint8_t *db, int dblen, int siglen);
77 /* File reg db entry -> rd converstion utilities */
78 struct ieee80211_regdomain *country2rd(uint8_t *db, int dblen,
79 struct regdb_file_reg_country *country);
82 void print_regdom(struct ieee80211_regdomain *rd);