1 #include <linux/types.h>
4 * WARNING: This file needs to be kept in sync with
5 * - the parser (dbparse.py)
6 * - the generator code (db2bin.py)
10 #define REGDB_MAGIC 0x52474442
13 * Only supported version now, start at arbitrary number
14 * to have some more magic. We still consider this to be
15 * "Version 1" of the file.
17 #define REGDB_VERSION 19
20 * The signature at the end of the file is an RSA-signed
21 * SHA-1 hash of the file.
24 struct regdb_file_header {
25 /* must be REGDB_MAGIC */
27 /* must be REGDB_VERSION */
30 * Pointer (offset) into file where country list starts
31 * and number of countries. The country list is sorted
32 * alphabetically to allow binary searching (should it
33 * become really huge.)
35 __be32 reg_country_ptr;
36 __be32 reg_country_num;
37 /* length (in bytes) of the signature at the end of the file */
38 __be32 signature_length;
41 struct regdb_file_freq_range {
48 * Values of zero mean "not applicable", i.e. the regulatory
49 * does not limit a certain value.
51 struct regdb_file_power_rule {
52 /* antenna gain is in mBi (100 * dBi) */
53 __be32 max_antenna_gain;
54 /* this is in mBm (100 * dBm) */
62 RRF_NO_OUTDOOR = 1<<3,
66 RRF_PASSIVE_SCAN= 1<<7,
70 struct regdb_file_reg_rule {
71 /* pointers (offsets) into the file */
72 __be32 freq_range_ptr,
78 struct regdb_file_reg_rules_collection {
80 /* pointers (offsets) into the file */
81 __be32 reg_rule_ptrs[];
84 struct regdb_file_reg_country {
87 /* pointer (offset) into the file */
88 __be32 reg_collection_ptr;
93 * Verify that no unexpected padding is added to structures
97 #define ERROR_ON(cond) \
98 ((void)sizeof(char[1 - 2*!!(cond)]))
100 #define CHECK_STRUCT(name, size) \
101 ERROR_ON(sizeof(struct name) != size)
103 static inline void check_db_binary_structs(void)
105 CHECK_STRUCT(regdb_file_header, 20);
106 CHECK_STRUCT(regdb_file_freq_range, 12);
107 CHECK_STRUCT(regdb_file_power_rule, 8);
108 CHECK_STRUCT(regdb_file_reg_rule, 12);
109 CHECK_STRUCT(regdb_file_reg_rules_collection, 4);
110 CHECK_STRUCT(regdb_file_reg_country, 8);