User Tools

Site Tools


This is an old revision of the document!

direct loading regdb file format

(suggestion by Johannes)

Everything in the file is aligned to 4-byte boundaries. As a consequence, positions can be represented by 16-bit word offsets while allowing for a 256KiB big file (currently, the database is about 4k with 32-bit pointers!)

offset contents comment
0x0000 0x52474442 magic
0x0004 0x00000014 version 2
0x0008 - start of country list

Each country is represented by 4 bytes, containing the following struct:

struct country {
  u8 code[2];
  __be16 collection_ptr;

The country list is terminated by an (otherwise invalid) entry containing a 0 collection_ptr.

To allow binary searches, the country list must be sorted alphabetically by country code. However, there's no country count - searchers wishing to do binary search must count the countries first and store that data out of band.

The remaining structures in the file contain their own length (but are padded to a multiple of 4 bytes, which is *not* represented in the length) for extension purposes. They're also never iterated directly.

struct reg_collection {
  __be16 len;
  __be16 n_rules;
  u8 dfs_region;
  u8 pad_reserved;
  __be16 rules[n_rules];
struct rule {
  __be16 len;
  __be16 flags;
  __be32 start_freq, end_freq;
  __be16 max_bw;
  __be16 max_antenna_gain; // TODO: remove? seems mostly unused/useless
  __be16 max_eirp; // mBm
  __be16 cac_timeout;


* add spectral power limits, which is more important now with 5/10 MHz channels

en/developers/todo-list/regdb-file-format.1444858237.txt.gz ยท Last modified: 2015/10/14 21:30 by Johannes Berg