4 #include <linux/types.h>
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 __be32 reg_country_ptr;
42 __be32 reg_country_num;
43 /* length (in bytes) of the signature at the end of the file */
44 __be32 signature_length;
47 struct regdb_file_freq_range {
48 __be32 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 __be32 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 __be32 freq_range_ptr; /* pointer to a struct regdb_file_freq_range */
84 __be32 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 {
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 __be32 reg_rule_ptrs[];
97 struct regdb_file_reg_country {
100 /* pointer (offset) into the file to a struct
101 * regdb_file_reg_rules_collection */
102 __be32 reg_collection_ptr;
107 * Verify that no unexpected padding is added to structures
111 #define ERROR_ON(cond) \
112 ((void)sizeof(char[1 - 2*!!(cond)]))
114 #define CHECK_STRUCT(name, size) \
115 ERROR_ON(sizeof(struct name) != size)
117 static inline void check_db_binary_structs(void)
119 CHECK_STRUCT(regdb_file_header, 20);
120 CHECK_STRUCT(regdb_file_freq_range, 12);
121 CHECK_STRUCT(regdb_file_power_rule, 8);
122 CHECK_STRUCT(regdb_file_reg_rule, 12);
123 CHECK_STRUCT(regdb_file_reg_rules_collection, 4);
124 CHECK_STRUCT(regdb_file_reg_country, 8);