7 * WARNING: This file needs to be kept in sync with
8 * - the parser (dbparse.py)
9 * - the generator code (db2bin.py)
13 #define REGDB_MAGIC 0x52474442
16 * Only supported version now, start at arbitrary number
17 * to have some more magic. We still consider this to be
18 * "Version 1" of the file.
20 #define REGDB_VERSION 19
23 * The signature at the end of the file is an RSA-signed
24 * SHA-1 hash of the file.
27 /* db file starts with a struct regdb_file_header */
29 struct regdb_file_header {
30 /* must be REGDB_MAGIC */
32 /* must be REGDB_VERSION */
35 * Pointer (offset) into file where country list starts
36 * and number of countries. The country list is sorted
37 * alphabetically to allow binary searching (should it
38 * become really huge). Each country is described by a
39 * struct regdb_file_reg_country.
41 uint32_t reg_country_ptr;
42 uint32_t reg_country_num;
43 /* length (in bytes) of the signature at the end of the file */
44 uint32_t signature_length;
47 struct regdb_file_freq_range {
48 uint32_t start_freq, /* in kHz */
49 end_freq, /* in kHz */
50 max_bandwidth; /* in kHz */
54 * Values of zero mean "not applicable", i.e. the regulatory
55 * does not limit a certain value.
57 struct regdb_file_power_rule {
58 /* antenna gain is in mBi (100 * dBi) */
59 uint32_t max_antenna_gain;
60 /* this is in mBm (100 * dBm) */
64 /* must match <linux/nl80211.h> enum nl80211_reg_rule_flags */
67 RRF_NO_OFDM = 1<<0, /* OFDM modulation not allowed */
68 RRF_NO_CCK = 1<<1, /* CCK modulation not allowed */
69 RRF_NO_INDOOR = 1<<2, /* indoor operation not allowed */
70 RRF_NO_OUTDOOR = 1<<3, /* outdoor operation not allowed */
71 RRF_DFS = 1<<4, /* DFS support is required to be
73 RRF_PTP_ONLY = 1<<5, /* this is only for Point To Point
75 RRF_PTMP_ONLY = 1<<6, /* this is only for Point To Multi
77 RRF_PASSIVE_SCAN = 1<<7, /* passive scan is required */
78 RRF_NO_IBSS = 1<<8, /* IBSS is not allowed */
81 struct regdb_file_reg_rule {
82 /* pointers (offsets) into the file */
83 uint32_t freq_range_ptr; /* pointer to a struct regdb_file_freq_range */
84 uint32_t power_rule_ptr; /* pointer to a struct regdb_file_power_rule */
85 /* rule flags using enum reg_rule_flags */
89 struct regdb_file_reg_rules_collection {
90 uint32_t reg_rule_num;
91 /* pointers (offsets) into the file. There are reg_rule_num elements
92 * in the reg_rule_ptrs array pointing to struct
93 * regdb_file_reg_rule */
94 uint32_t reg_rule_ptrs[];
97 struct regdb_file_reg_country {
100 uint8_t creqs; /* first two bits define DFS region */
101 /* pointer (offset) into the file to a struct
102 * regdb_file_reg_rules_collection */
103 uint32_t reg_collection_ptr;
108 * Verify that no unexpected padding is added to structures
112 #define ERROR_ON(cond) \
113 ((void)sizeof(char[1 - 2*!!(cond)]))
115 #define CHECK_STRUCT(name, size) \
116 ERROR_ON(sizeof(struct name) != size)
118 static inline void check_db_binary_structs(void)
120 CHECK_STRUCT(regdb_file_header, 20);
121 CHECK_STRUCT(regdb_file_freq_range, 12);
122 CHECK_STRUCT(regdb_file_power_rule, 8);
123 CHECK_STRUCT(regdb_file_reg_rule, 12);
124 CHECK_STRUCT(regdb_file_reg_rules_collection, 4);
125 CHECK_STRUCT(regdb_file_reg_country, 8);