Project import
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..7f622b1
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,103 @@
+#
+# Copyright (c) 2011 Nest Labs, Inc.
+# All rights reserved.
+#
+# This document is the property of Nest. It is considered
+# confidential and proprietary information.
+#
+# This document may not be reproduced or transmitted in any form,
+# in whole or in part, without the express written permission of
+# Nest.
+#
+# Description:
+# This file is for the wireless regulatory database, a database
+# of the supported wireless channel and power settings for a
+# given region.
+#
+
+BuildConfigSpecialized := No
+BuildProductSpecialized := No
+
+include pre.mak
+
+PackageName := wireless-regdb
+
+PackageExtension := tar.bz2
+PackageSeparator := -
+
+PackagePatchArgs := -p1
+
+PackageArchive := $(PackageName).$(PackageExtension)
+PackageSourceDir := $(PackageName)$(PackageSeparator)$(PackageVersion)
+
+PackageBuildMakefile = $(call GenerateBuildPaths,Makefile)
+
+LicenseSourceFile := LICENSE
+LicenseSourcePath := $(addprefix $(PackageSourceDir)/,$(LicenseSourceFile))
+
+CleanPaths += $(PackageLicenseFile)
+
+all: $(PackageDefaultGoal)
+
+# Generate the package license contents.
+
+$(LicenseSourcePath): source
+
+$(PackageLicenseFile): $(LicenseSourcePath)
+ $(copy-result)
+
+# Extract the source from the archive and apply patches, if any.
+
+$(PackageSourceDir): $(PackageArchive) $(PackagePatchPaths)
+ $(expand-and-patch-package)
+
+# Prepare the sources.
+
+.PHONY: source
+source: | $(PackageSourceDir)
+
+# Patch the sources, if necessary.
+
+.PHONY: patch
+patch: source
+
+# Generate the package build makefile.
+
+$(PackageBuildMakefile): | $(PackageSourceDir) $(BuildDirectory)
+ $(call create-links,$(CURDIR)/$(PackageSourceDir),$(BuildDirectory))
+
+# Configure the source for building.
+
+.PHONY: configure
+configure: source $(PackageBuildMakefile)
+
+# Build the source.
+#
+# We have to unset MAKEFLAGS since they confuse the package build otherwise.
+
+.PHONY: build
+build: configure | $(BuildDirectory)
+ $(Verbose)unset MAKEFLAGS && \
+ $(MAKE) $(JOBSFLAG) -C $(BuildDirectory) \
+ CC="$(CC)" CXX="$(CXX)" AR=$(AR) NM=$(NM) RANLIB=$(RANLIB) STRIP=$(STRIP) \
+ INSTALL="$(INSTALL) $(INSTALLFLAGS)" \
+ all
+
+# Stage the build to a temporary installation area.
+#
+# We have to unset MAKEFLAGS since they confuse the package build otherwise.
+
+.PHONY: stage
+stage: build | $(ResultDirectory)
+ $(Verbose)unset MAKEFLAGS && \
+ $(MAKE) $(JOBSFLAG) -C $(BuildDirectory) \
+ INSTALL="$(INSTALL) $(INSTALLFLAGS)" \
+ DESTDIR=$(ResultDirectory) \
+ install
+
+clean:
+ $(Verbose)$(RM) $(RMFLAGS) -r $(PackageSourceDir)
+ $(Verbose)$(RM) $(RMFLAGS) -r $(BuildDirectory)
+ $(Verbose)$(RM) $(RMFLAGS) -r $(ResultDirectory)
+
+include post.mak
diff --git a/wireless-regdb-2011.04.28/LICENSE b/wireless-regdb-2011.04.28/LICENSE
new file mode 100644
index 0000000..652a6dd
--- /dev/null
+++ b/wireless-regdb-2011.04.28/LICENSE
@@ -0,0 +1,16 @@
+Copyright (c) 2008, Luis R. Rodriguez <mcgrof@gmail.com>
+Copyright (c) 2008, Johannes Berg <johannes@sipsolutions.net>
+Copyright (c) 2008, Michael Green <Michael.Green@Atheros.com>
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
diff --git a/wireless-regdb-2011.04.28/Makefile b/wireless-regdb-2011.04.28/Makefile
new file mode 100644
index 0000000..3d5040d
--- /dev/null
+++ b/wireless-regdb-2011.04.28/Makefile
@@ -0,0 +1,113 @@
+# Install prefix
+PREFIX ?= /usr
+CRDA_PATH ?= $(PREFIX)/lib/crda
+CRDA_KEY_PATH ?= $(CRDA_PATH)/pubkeys
+
+MANDIR ?= $(PREFIX)/share/man/
+
+SHA1SUM ?= /usr/bin/sha1sum
+LSB_RELEASE ?= /usr/bin/lsb_release
+WHOAMI ?= /usr/bin/whoami
+
+# Distro name: Ubuntu, Debian, Fedora, if not present you get
+# "custom-distro", if your distribution does not have the LSB stuff,
+# then set this variable when calling make if you don't want "custom-distro"
+LSB_ID ?= $(shell if [ -f $(LSB_RELEASE) ]; then \
+ $(LSB_RELEASE) -i -s; \
+ else \
+ echo custom-distro; \
+ fi)
+
+DISTRO_PRIVKEY ?= ~/.wireless-regdb-$(LSB_ID).key.priv.pem
+DISTRO_PUBKEY ?= ~/.wireless-regdb-$(LSB_ID).key.priv.pem
+
+REGDB_AUTHOR ?= $(shell if [ -f $(DISTRO_PRIVKEY) ]; then \
+ echo $(LSB_ID) ; \
+ elif [ -f $(WHOAMI) ]; then \
+ $(WHOAMI); \
+ else \
+ echo custom-user; \
+ fi)
+
+REGDB_PRIVKEY ?= ~/.wireless-regdb-$(REGDB_AUTHOR).key.priv.pem
+REGDB_PUBKEY ?= $(REGDB_AUTHOR).key.pub.pem
+
+REGDB_UPSTREAM_PUBKEY ?= linville.key.pub.pem
+
+REGDB_CHANGED = $(shell $(SHA1SUM) -c --status sha1sum.txt >/dev/null 2>&1; \
+ if [ $$? -ne 0 ]; then \
+ echo maintainer-clean $(REGDB_PUBKEY); \
+ fi)
+
+.PHONY: all clean mrproper install maintainer-clean install-distro-key
+
+all: $(REGDB_CHANGED) regulatory.bin sha1sum.txt
+
+clean:
+ @rm -f *.pyc *.gz
+
+maintainer-clean: clean
+ @rm -f regulatory.bin
+
+mrproper: clean maintainer-clean
+ @echo Removed public key, regulatory.bin and compresed man pages
+ @rm -f $(REGDB_PUBKEY) .custom
+
+regulatory.bin: db.txt $(REGDB_PRIVKEY) $(REGDB_PUBKEY)
+ @echo Generating $@ digitally signed by $(REGDB_AUTHOR)...
+ ./db2bin.py regulatory.bin db.txt $(REGDB_PRIVKEY)
+
+sha1sum.txt: db.txt
+ sha1sum $< > $@
+
+$(REGDB_PUBKEY): $(REGDB_PRIVKEY)
+ @echo "Generating public key for $(REGDB_AUTHOR)..."
+ openssl rsa -in $(REGDB_PRIVKEY) -out $(REGDB_PUBKEY) -pubout -outform PEM
+ @echo $(REGDB_PUBKEY) > .custom
+
+
+$(REGDB_PRIVKEY):
+ @echo "Generating private key for $(REGDB_AUTHOR)..."
+ openssl genrsa -out $(REGDB_PRIVKEY) 2048
+
+ifneq ($(shell test -e $(DISTRO_PRIVKEY) && echo yes),yes)
+$(DISTRO_PRIVKEY):
+ @echo "Generating private key for $(LSB_ID) packager..."
+ openssl genrsa -out $(DISTRO_PRIVKEY) 2048
+endif
+
+install-distro-key: maintainer-clean $(DISTRO_PRIVKEY)
+
+%.gz: %
+ gzip < $< > $@
+
+# Users should just do:
+# sudo make install
+#
+# Developers should do:
+# make maintainer-clean
+# make
+# sudo make install
+#
+# Distributions packagers should do only once:
+# make install-distro-key
+# This will create a private key for you and install it into
+# ~/.wireless-regdb-$(LSB_ID).key.priv.pem
+# To make new releaes just do:
+# make maintainer-clean
+# make
+# sudo make install
+install: regulatory.bin.5.gz
+ install -m 755 -d $(DESTDIR)/$(CRDA_PATH)
+ install -m 755 -d $(DESTDIR)/$(CRDA_KEY_PATH)
+ if [ -f .custom ]; then \
+ install -m 644 -t $(DESTDIR)/$(CRDA_KEY_PATH)/ $(shell cat .custom); \
+ fi
+ @# In linville we trust
+ install -m 644 -t $(DESTDIR)/$(CRDA_KEY_PATH)/ $(REGDB_UPSTREAM_PUBKEY)
+ install -m 644 -t $(DESTDIR)/$(CRDA_PATH)/ regulatory.bin
+ install -m 755 -d $(DESTDIR)/$(MANDIR)/man5/
+ install -m 644 -t $(DESTDIR)/$(MANDIR)/man5/ regulatory.bin.5.gz
+
+uninstall:
+ rm -rf $(DESTDIR)/$(CRDA_PATH)/
diff --git a/wireless-regdb-2011.04.28/README b/wireless-regdb-2011.04.28/README
new file mode 100644
index 0000000..065b672
--- /dev/null
+++ b/wireless-regdb-2011.04.28/README
@@ -0,0 +1,29 @@
+This repository contains the plain text version of the regulatory
+database file I maintain for use with Central Regulatory Database
+Agent daemon. Also included is the compiled binary version of this
+file signed with my RSA key. This represents a good faith attempt
+to capture regulatory information that is correct at the time of its last
+modification. This information is provided to you with no warranty
+either expressed or implied.
+
+Also included are the tools used to compile and sign the regulatory.bin
+file as well as a MoinMoin macro used for viewing the database.
+
+ TECHNICAL INFORMATION
+=======================
+
+The regulatory information in `db.txt' is stored in a human-readable
+format which can be read using the `dbparse.py' python module. This
+python module is used by the web viewer (Regulatory.py) which is
+implemented as a MoinMoin macro (and used on http://wireless.kernel.org)
+to allow viewing the database for verification.
+
+The dbparse module is also used by db2bin.py, the `compiler', which
+compiles and signs the binary database.
+
+For more information, please see the CRDA git repository:
+
+ git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/crda.git
+
+John W. Linville
+17 November 2008
diff --git a/wireless-regdb-2011.04.28/db.txt b/wireless-regdb-2011.04.28/db.txt
new file mode 100644
index 0000000..f0b46d8
--- /dev/null
+++ b/wireless-regdb-2011.04.28/db.txt
@@ -0,0 +1,697 @@
+# This is the world regulatory domain
+country 00:
+ (2402 - 2472 @ 40), (3, 20)
+ # Channel 12 - 13. No HT40 channel fits here
+ (2457 - 2482 @ 20), (3, 20), PASSIVE-SCAN, NO-IBSS
+ # Channel 14. Only JP enables this and for 802.11b only
+ (2474 - 2494 @ 20), (3, 20), PASSIVE-SCAN, NO-IBSS, NO-OFDM
+ # Channel 36 - 48
+ (5170 - 5250 @ 40), (3, 20), PASSIVE-SCAN, NO-IBSS
+ # NB: 5260 MHz - 5700 MHz requies DFS
+ # Channel 149 - 165
+ (5735 - 5835 @ 40), (3, 20), PASSIVE-SCAN, NO-IBSS
+
+
+country AE:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 20)
+ (5250 - 5330 @ 40), (N/A, 20), DFS
+ (5490 - 5710 @ 40), (N/A, 27), DFS
+
+country AL:
+ (2402 - 2482 @ 20), (N/A, 20)
+
+country AM:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 20), (N/A, 18)
+ (5250 - 5330 @ 20), (N/A, 18), DFS
+
+country AN:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 20)
+ (5250 - 5330 @ 40), (N/A, 20), DFS
+ (5490 - 5710 @ 40), (N/A, 27), DFS
+
+country AR:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (3, 17)
+ (5250 - 5330 @ 40), (3, 20), DFS
+ (5490 - 5710 @ 40), (3, 20), DFS
+ (5735 - 5835 @ 40), (3, 30)
+
+country AT:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 20)
+ (5250 - 5330 @ 40), (N/A, 20), DFS
+ (5490 - 5710 @ 40), (N/A, 27), DFS
+
+country AU:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (3, 23)
+ (5250 - 5330 @ 40), (3, 23), DFS
+ (5735 - 5835 @ 40), (3, 30)
+
+country AW:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 20)
+ (5250 - 5330 @ 40), (N/A, 20), DFS
+ (5490 - 5710 @ 40), (N/A, 27), DFS
+
+country AZ:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 18)
+ (5250 - 5330 @ 40), (N/A, 18), DFS
+
+country BA:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 20)
+ (5250 - 5330 @ 40), (N/A, 20), DFS
+ (5490 - 5710 @ 40), (N/A, 27), DFS
+
+country BB:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (3, 23)
+ (5250 - 5330 @ 40), (3, 23), DFS
+ (5735 - 5835 @ 40), (3, 30)
+
+country BD:
+ (2402 - 2482 @ 40), (N/A, 20)
+
+country BE:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 20)
+ (5250 - 5330 @ 40), (N/A, 20), DFS
+ (5490 - 5710 @ 40), (N/A, 27), DFS
+
+country BG:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 23)
+ (5250 - 5290 @ 40), (N/A, 23), DFS
+ (5490 - 5710 @ 40), (N/A, 30), DFS
+
+country BH:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 20), (N/A, 20)
+ (5250 - 5330 @ 20), (N/A, 20), DFS
+ (5735 - 5835 @ 20), (N/A, 20)
+
+country BL:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 18)
+ (5250 - 5330 @ 40), (N/A, 18), DFS
+
+country BN:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 20)
+ (5250 - 5330 @ 40), (N/A, 20), DFS
+ (5735 - 5835 @ 40), (N/A, 30)
+
+country BO:
+ (2402 - 2482 @ 40), (N/A, 30)
+ (5735 - 5835 @ 40), (N/A, 30)
+
+country BR:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (3, 17)
+ (5250 - 5330 @ 40), (3, 20), DFS
+ (5490 - 5710 @ 40), (3, 20), DFS
+ (5735 - 5835 @ 40), (3, 30)
+
+country BY:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 20)
+ (5250 - 5330 @ 40), (N/A, 20), DFS
+ (5490 - 5710 @ 40), (N/A, 27), DFS
+
+country BZ:
+ (2402 - 2482 @ 40), (N/A, 30)
+ (5735 - 5835 @ 40), (N/A, 30)
+
+country CA:
+ (2402 - 2472 @ 40), (3, 27)
+ (5170 - 5250 @ 40), (3, 17)
+ (5250 - 5330 @ 40), (3, 20), DFS
+ (5490 - 5710 @ 40), (3, 20), DFS
+ (5735 - 5835 @ 40), (3, 30)
+
+country CH:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 20)
+ (5250 - 5330 @ 40), (N/A, 20), DFS
+ (5490 - 5710 @ 40), (N/A, 27), DFS
+
+country CL:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 20)
+ (5250 - 5330 @ 40), (N/A, 20), DFS
+ (5735 - 5835 @ 40), (N/A, 20)
+
+country CN:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5735 - 5835 @ 40), (N/A, 30)
+
+country CO:
+ (2402 - 2472 @ 40), (3, 27)
+ (5170 - 5250 @ 40), (3, 17)
+ (5250 - 5330 @ 40), (3, 23), DFS
+ (5735 - 5835 @ 40), (3, 30)
+
+country CR:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 20), (3, 17)
+ (5250 - 5330 @ 20), (3, 23), DFS
+ (5735 - 5835 @ 20), (3, 30)
+
+country CS:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 20)
+ (5250 - 5330 @ 40), (N/A, 20), DFS
+ (5490 - 5710 @ 40), (N/A, 27), DFS
+
+country CY:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 20)
+ (5250 - 5330 @ 40), (N/A, 20), DFS
+ (5490 - 5710 @ 40), (N/A, 27), DFS
+
+# Data from http://www.ctu.eu/164/download/VOR/VOR-12-08-2005-34.pdf
+# and http://www.ctu.eu/164/download/VOR/VOR-12-05-2007-6-AN.pdf
+# Power at 5250 - 5350 MHz and 5470 - 5725 MHz can be doubled if TPC is
+# implemented.
+country CZ:
+ (2400 - 2483.5 @ 40), (N/A, 100 mW)
+ (5150 - 5250 @ 40), (N/A, 200 mW), NO-OUTDOOR
+ (5250 - 5350 @ 40), (N/A, 100 mW), NO-OUTDOOR, DFS
+ (5470 - 5725 @ 40), (N/A, 500 mW), DFS
+
+# Data from "Frequenznutzungsplan" (as published in April 2008), downloaded from
+# http://www.bundesnetzagentur.de/cae/servlet/contentblob/38448/publicationFile/2659/Frequenznutzungsplan2008_Id17448pdf.pdf
+# For the 5GHz range also see
+# http://www.bundesnetzagentur.de/cae/servlet/contentblob/38216/publicationFile/6579/WLAN5GHzVfg7_2010_28042010pdf.pdf
+# The values have been reduced by a factor of 2 (3db) for non TPC devices
+# (in other words: devices with TPC can use twice the tx power of this table).
+# Note that the docs do not require TPC for 5150--5250; the reduction to
+# 100mW thus is not strictly required -- however the conservative 100mW
+# limit is used here as the non-interference with radar and satellite
+# apps relies on the attenuation by the building walls only in the
+# absence of DFS; the neighbour countries have 100mW limit here as well.
+
+country DE:
+ # entries 279004 and 280006
+ (2400 - 2483.5 @ 40), (N/A, 100 mW)
+ # entry 303005
+ (5150 - 5250 @ 40), (N/A, 100 mW), NO-OUTDOOR
+ # entries 304002 and 305002
+ (5250 - 5350 @ 40), (N/A, 100 mW), NO-OUTDOOR, DFS
+ # entries 308002, 309001 and 310003
+ (5470 - 5725 @ 40), (N/A, 500 mW), DFS
+
+country DK:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 20)
+ (5250 - 5330 @ 40), (N/A, 20), DFS
+ (5490 - 5710 @ 40), (N/A, 27), DFS
+
+country DO:
+ (2402 - 2472 @ 40), (3, 27)
+ (5170 - 5250 @ 40), (3, 17)
+ (5250 - 5330 @ 40), (3, 23), DFS
+ (5735 - 5835 @ 40), (3, 30)
+
+country DZ:
+ (2402 - 2482 @ 40), (N/A, 20)
+
+country EC:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 20), (3, 17)
+ (5250 - 5330 @ 20), (3, 23), DFS
+ (5735 - 5835 @ 20), (3, 30)
+
+country EE:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 20)
+ (5250 - 5330 @ 40), (N/A, 20), DFS
+ (5490 - 5710 @ 40), (N/A, 27), DFS
+
+country EG:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 20), (N/A, 20)
+ (5250 - 5330 @ 20), (N/A, 20), DFS
+
+country ES:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 20)
+ (5250 - 5330 @ 40), (N/A, 20), DFS
+ (5490 - 5710 @ 40), (N/A, 27), DFS
+
+country FI:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 20)
+ (5250 - 5330 @ 40), (N/A, 20), DFS
+ (5490 - 5710 @ 40), (N/A, 27), DFS
+
+country FR:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 20)
+ (5250 - 5330 @ 40), (N/A, 20), DFS
+ (5490 - 5710 @ 40), (N/A, 27), DFS
+
+country GE:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 18)
+ (5250 - 5330 @ 40), (N/A, 18), DFS
+
+country GB:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 20)
+ (5250 - 5330 @ 40), (N/A, 20), DFS
+ (5490 - 5710 @ 40), (N/A, 27), DFS
+
+country GD:
+ (2402 - 2472 @ 40), (3, 27)
+ (5170 - 5250 @ 40), (3, 17)
+ (5250 - 5330 @ 40), (3, 20), DFS
+ (5490 - 5710 @ 40), (3, 20), DFS
+ (5735 - 5835 @ 40), (3, 30)
+
+country GR:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 20)
+ (5250 - 5330 @ 40), (N/A, 20), DFS
+ (5490 - 5710 @ 40), (N/A, 27), DFS
+
+country GL:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 20), (N/A, 20)
+ (5250 - 5330 @ 20), (N/A, 20), DFS
+ (5490 - 5710 @ 20), (N/A, 27), DFS
+
+country GT:
+ (2402 - 2472 @ 40), (3, 27)
+ (5170 - 5250 @ 40), (3, 17)
+ (5250 - 5330 @ 40), (3, 23), DFS
+ (5735 - 5835 @ 40), (3, 30)
+
+country GU:
+ (2402 - 2472 @ 40), (3, 27)
+ (5170 - 5250 @ 20), (3, 17)
+ (5250 - 5330 @ 20), (3, 23), DFS
+ (5735 - 5835 @ 20), (3, 30)
+
+country HN:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (3, 17)
+ (5250 - 5330 @ 40), (3, 20), DFS
+ (5490 - 5710 @ 40), (3, 20), DFS
+ (5735 - 5835 @ 40), (3, 30)
+
+country HK:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (3, 17)
+ (5250 - 5330 @ 40), (3, 20), DFS
+ (5490 - 5710 @ 40), (3, 20), DFS
+ (5735 - 5835 @ 40), (3, 30)
+
+country HR:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 20)
+ (5250 - 5330 @ 40), (N/A, 20), DFS
+ (5490 - 5710 @ 40), (N/A, 27), DFS
+
+country HT:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 20)
+ (5250 - 5330 @ 40), (N/A, 20), DFS
+ (5490 - 5710 @ 40), (N/A, 27), DFS
+
+country HU:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 20)
+ (5250 - 5330 @ 40), (N/A, 20), DFS
+ (5490 - 5710 @ 40), (N/A, 27), DFS
+
+country ID:
+ (2402 - 2482 @ 40), (N/A, 20)
+
+country IE:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 20)
+ (5250 - 5330 @ 40), (N/A, 20), DFS
+ (5490 - 5710 @ 40), (N/A, 27), DFS
+
+country IL:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5150 - 5250 @ 40), (N/A, 200 mW), NO-OUTDOOR
+ (5250 - 5350 @ 40), (N/A, 200 mW), NO-OUTDOOR, DFS
+
+country IN:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 20)
+ (5250 - 5330 @ 40), (N/A, 20), DFS
+ (5735 - 5835 @ 40), (N/A, 20)
+
+country IS:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 20)
+ (5250 - 5330 @ 40), (N/A, 20), DFS
+ (5490 - 5710 @ 40), (N/A, 27), DFS
+
+country IR:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5735 - 5835 @ 40), (N/A, 30)
+
+country IT:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 20)
+ (5250 - 5330 @ 40), (N/A, 20), DFS
+ (5490 - 5710 @ 40), (N/A, 27), DFS
+
+country JM:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (3, 17)
+ (5250 - 5330 @ 40), (3, 20), DFS
+ (5490 - 5710 @ 40), (3, 20), DFS
+ (5735 - 5835 @ 40), (3, 30)
+
+country JP:
+ (2402 - 2472 @ 40), (N/A, 20)
+ (2457 - 2482 @ 20), (N/A, 20)
+ (2474 - 2494 @ 20), (N/A, 20), NO-OFDM
+ (4910 - 4930 @ 10), (N/A, 23)
+ (4910 - 4990 @ 40), (N/A, 23)
+ (4930 - 4950 @ 10), (N/A, 23)
+ (5030 - 5045 @ 10), (N/A, 23)
+ (5030 - 5090 @ 40), (N/A, 23)
+ (5050 - 5060 @ 10), (N/A, 23)
+ (5170 - 5250 @ 40), (N/A, 20)
+ (5250 - 5330 @ 40), (N/A, 20), DFS
+ (5490 - 5710 @ 40), (N/A, 23), DFS
+
+country JO:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 18)
+
+country KE:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5735 - 5835 @ 40), (N/A, 30)
+
+country KH:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 20)
+ (5250 - 5330 @ 40), (N/A, 20), DFS
+ (5490 - 5710 @ 40), (N/A, 27), DFS
+
+country KP:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5330 @ 40), (3, 20)
+ (5160 - 5250 @ 40), (3, 20), DFS
+ (5490 - 5630 @ 40), (3, 30), DFS
+ (5735 - 5815 @ 40), (3, 30)
+
+country KR:
+ (2402 - 2482 @ 20), (N/A, 20)
+ (5170 - 5250 @ 20), (3, 20)
+ (5250 - 5330 @ 20), (3, 20), DFS
+ (5490 - 5630 @ 20), (3, 30), DFS
+ (5735 - 5815 @ 20), (3, 30)
+
+country KW:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 20)
+ (5250 - 5330 @ 40), (N/A, 20), DFS
+
+country KZ:
+ (2402 - 2482 @ 40), (N/A, 20)
+
+country LB:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5735 - 5835 @ 40), (N/A, 30)
+
+country LI:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 20)
+ (5250 - 5330 @ 40), (N/A, 20), DFS
+ (5490 - 5710 @ 40), (N/A, 27), DFS
+
+country LK:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 20), (3, 17)
+ (5250 - 5330 @ 20), (3, 20), DFS
+ (5490 - 5710 @ 20), (3, 20), DFS
+ (5735 - 5835 @ 20), (3, 30)
+
+country LT:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 20)
+ (5250 - 5330 @ 40), (N/A, 20), DFS
+ (5490 - 5710 @ 40), (N/A, 27), DFS
+
+country LU:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 20)
+ (5250 - 5330 @ 40), (N/A, 20), DFS
+ (5490 - 5710 @ 40), (N/A, 27), DFS
+
+country LV:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 20)
+ (5250 - 5330 @ 40), (N/A, 20), DFS
+ (5490 - 5710 @ 40), (N/A, 27), DFS
+
+country MC:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 18)
+ (5250 - 5330 @ 40), (N/A, 18), DFS
+
+country MA:
+ (2402 - 2482 @ 40), (N/A, 20)
+
+country MO:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (3, 23)
+ (5250 - 5330 @ 40), (3, 23), DFS
+ (5735 - 5835 @ 40), (3, 30)
+
+country MK:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 20)
+ (5250 - 5330 @ 40), (N/A, 20), DFS
+ (5490 - 5710 @ 40), (N/A, 27), DFS
+
+country MT:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 20)
+ (5250 - 5330 @ 40), (N/A, 20), DFS
+ (5490 - 5710 @ 40), (N/A, 27), DFS
+
+country MY:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5250 - 5330 @ 40), (N/A, 30), DFS
+ (5735 - 5835 @ 40), (N/A, 30)
+
+country MX:
+ (2402 - 2472 @ 40), (3, 27)
+ (5170 - 5250 @ 40), (3, 17)
+ (5250 - 5330 @ 40), (3, 23), DFS
+ (5735 - 5835 @ 40), (3, 30)
+
+country NL:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 20), NO-OUTDOOR
+ (5250 - 5330 @ 40), (N/A, 20), NO-OUTDOOR, DFS
+ (5490 - 5710 @ 40), (N/A, 27), DFS
+
+country NO:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 20)
+ (5250 - 5330 @ 40), (N/A, 20), DFS
+ (5490 - 5710 @ 40), (N/A, 27), DFS
+
+country NP:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5735 - 5835 @ 40), (N/A, 30)
+
+country NZ:
+ (2402 - 2482 @ 40), (N/A, 30)
+ (5170 - 5250 @ 20), (3, 23)
+ (5250 - 5330 @ 20), (3, 23), DFS
+ (5735 - 5835 @ 20), (3, 30)
+
+country OM:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (3, 17)
+ (5250 - 5330 @ 40), (3, 20), DFS
+ (5490 - 5710 @ 40), (3, 20), DFS
+ (5735 - 5835 @ 40), (3, 30)
+
+country PA:
+ (2402 - 2472 @ 40), (3, 27)
+ (5170 - 5250 @ 40), (3, 17)
+ (5250 - 5330 @ 40), (3, 23), DFS
+ (5735 - 5835 @ 40), (3, 30)
+
+country PE:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5735 - 5835 @ 40), (N/A, 30)
+
+country PG:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (3, 17)
+ (5250 - 5330 @ 40), (3, 23), DFS
+ (5735 - 5835 @ 40), (3, 30)
+
+country PH:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5735 - 5835 @ 40), (N/A, 30)
+
+country PK:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5735 - 5835 @ 40), (N/A, 30)
+
+country PL:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 20)
+ (5250 - 5330 @ 40), (N/A, 20), DFS
+ (5490 - 5710 @ 40), (N/A, 27), DFS
+
+country PT:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 20)
+ (5250 - 5330 @ 40), (N/A, 20), DFS
+ (5490 - 5710 @ 40), (N/A, 27), DFS
+
+country PR:
+ (2402 - 2472 @ 40), (3, 27)
+ (5170 - 5250 @ 40), (3, 17)
+ (5250 - 5330 @ 40), (3, 23), DFS
+ (5735 - 5835 @ 40), (3, 30)
+
+country QA:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5735 - 5835 @ 40), (N/A, 30)
+
+country RO:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 20)
+ (5250 - 5330 @ 40), (N/A, 20), DFS
+ (5490 - 5710 @ 40), (N/A, 27), DFS
+
+country RU:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5735 - 5835 @ 20), (N/A, 30)
+
+country SA:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 20), (3, 23)
+ (5250 - 5330 @ 20), (3, 23), DFS
+ (5735 - 5835 @ 20), (3, 30)
+
+country SE:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 20)
+ (5250 - 5330 @ 40), (N/A, 20), DFS
+ (5490 - 5710 @ 40), (N/A, 27), DFS
+
+country SG:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 20)
+ (5250 - 5330 @ 40), (N/A, 20), DFS
+ (5735 - 5835 @ 40), (N/A, 20)
+
+country SI:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 20)
+ (5250 - 5330 @ 40), (N/A, 20), DFS
+ (5490 - 5710 @ 40), (N/A, 27), DFS
+
+country SK:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 20)
+ (5250 - 5330 @ 40), (N/A, 20), DFS
+ (5490 - 5710 @ 40), (N/A, 27), DFS
+
+country SV:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 20), (3, 17)
+ (5250 - 5330 @ 20), (3, 23), DFS
+ (5735 - 5835 @ 20), (3, 30)
+
+country SY:
+ (2402 - 2482 @ 40), (N/A, 20)
+
+country TW:
+ (2402 - 2472 @ 40), (3, 27)
+ (5270 - 5330 @ 40), (3, 17), DFS
+ (5735 - 5815 @ 40), (3, 30)
+
+country TH:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (3, 17)
+ (5250 - 5330 @ 40), (3, 20), DFS
+ (5490 - 5710 @ 40), (3, 20), DFS
+ (5735 - 5835 @ 40), (3, 30)
+
+country TT:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (3, 17)
+ (5250 - 5330 @ 40), (3, 20), DFS
+ (5490 - 5710 @ 40), (3, 20), DFS
+ (5735 - 5835 @ 40), (3, 30)
+
+country TN:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 20), (N/A, 20)
+ (5250 - 5330 @ 20), (N/A, 20), DFS
+
+country TR:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 20), (N/A, 20)
+ (5250 - 5330 @ 20), (N/A, 20), DFS
+
+country UA:
+ (2402 - 2482 @ 40), (N/A, 20)
+
+country US:
+ (2402 - 2472 @ 40), (3, 27)
+ (5170 - 5250 @ 40), (3, 17)
+ (5250 - 5330 @ 40), (3, 20), DFS
+ (5490 - 5600 @ 40), (3, 20), DFS
+ (5650 - 5710 @ 40), (3, 20), DFS
+ (5735 - 5835 @ 40), (3, 30)
+
+country UY:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (3, 17)
+ (5250 - 5330 @ 40), (3, 20), DFS
+ (5490 - 5710 @ 40), (3, 20), DFS
+ (5735 - 5835 @ 40), (3, 30)
+
+country UZ:
+ (2402 - 2472 @ 40), (3, 27)
+ (5170 - 5250 @ 40), (3, 17)
+ (5250 - 5330 @ 40), (3, 20), DFS
+ (5490 - 5710 @ 40), (3, 20), DFS
+ (5735 - 5835 @ 40), (3, 30)
+
+country VE:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5735 - 5815 @ 40), (N/A, 23)
+
+country VN:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (N/A, 20)
+ (5250 - 5330 @ 40), (N/A, 20), DFS
+
+country YE:
+ (2402 - 2482 @ 40), (N/A, 20)
+
+country ZA:
+ (2402 - 2482 @ 40), (N/A, 20)
+ (5170 - 5250 @ 40), (3, 17)
+ (5250 - 5330 @ 40), (3, 20), DFS
+ (5490 - 5710 @ 40), (3, 20), DFS
+ (5735 - 5835 @ 40), (3, 30)
+
+country ZW:
+ (2402 - 2482 @ 40), (N/A, 20)
+
diff --git a/wireless-regdb-2011.04.28/db2bin.py b/wireless-regdb-2011.04.28/db2bin.py
new file mode 100755
index 0000000..4df20a8
--- /dev/null
+++ b/wireless-regdb-2011.04.28/db2bin.py
@@ -0,0 +1,145 @@
+#!/usr/bin/python
+
+from cStringIO import StringIO
+import struct
+import hashlib
+from dbparse import DBParser
+import sys
+
+MAGIC = 0x52474442
+VERSION = 19
+
+if len(sys.argv) < 3:
+ print 'Usage: %s output-file input-file [key-file]' % sys.argv[0]
+ sys.exit(2)
+
+def create_rules(countries):
+ result = {}
+ for c in countries.itervalues():
+ for rule in c.permissions:
+ result[rule] = 1
+ return result.keys()
+
+def create_collections(countries):
+ result = {}
+ for c in countries.itervalues():
+ result[c.permissions] = 1
+ return result.keys()
+
+
+def be32(output, val):
+ output.write(struct.pack('>I', val))
+
+class PTR(object):
+ def __init__(self, output):
+ self._output = output
+ self._pos = output.tell()
+ be32(output, 0xFFFFFFFF)
+
+ def set(self, val=None):
+ if val is None:
+ val = self._output.tell()
+ self._offset = val
+ pos = self._output.tell()
+ self._output.seek(self._pos)
+ be32(self._output, val)
+ self._output.seek(pos)
+
+ def get(self):
+ return self._offset
+
+p = DBParser()
+countries = p.parse(file(sys.argv[2]))
+power = []
+bands = []
+for c in countries.itervalues():
+ for perm in c.permissions:
+ if not perm.freqband in bands:
+ bands.append(perm.freqband)
+ if not perm.power in power:
+ power.append(perm.power)
+rules = create_rules(countries)
+rules.sort(cmp=lambda x, y: cmp(x.freqband, y.freqband))
+collections = create_collections(countries)
+collections.sort(cmp=lambda x, y: cmp(x[0].freqband, y[0].freqband))
+
+output = StringIO()
+
+# struct regdb_file_header
+be32(output, MAGIC)
+be32(output, VERSION)
+reg_country_ptr = PTR(output)
+# add number of countries
+be32(output, len(countries))
+siglen = PTR(output)
+
+power_rules = {}
+for pr in power:
+ power_rules[pr] = output.tell()
+ pr = [int(v * 100.0) for v in (pr.max_ant_gain, pr.max_eirp)]
+ # struct regdb_file_power_rule
+ output.write(struct.pack('>II', *pr))
+
+freq_ranges = {}
+for fr in bands:
+ freq_ranges[fr] = output.tell()
+ fr = [int(f * 1000.0) for f in (fr.start, fr.end, fr.maxbw)]
+ # struct regdb_file_freq_range
+ output.write(struct.pack('>III', *fr))
+
+
+reg_rules = {}
+for reg_rule in rules:
+ freq_range, power_rule = reg_rule.freqband, reg_rule.power
+ reg_rules[reg_rule] = output.tell()
+ # struct regdb_file_reg_rule
+ output.write(struct.pack('>III', freq_ranges[freq_range], power_rules[power_rule],
+ reg_rule.flags))
+
+
+reg_rules_collections = {}
+
+for coll in collections:
+ reg_rules_collections[coll] = output.tell()
+ # struct regdb_file_reg_rules_collection
+ coll = list(coll)
+ be32(output, len(coll))
+ coll.sort(cmp=lambda x, y: cmp(x.freqband, y.freqband))
+ for regrule in coll:
+ be32(output, reg_rules[regrule])
+
+# update country pointer now!
+reg_country_ptr.set()
+
+countrynames = countries.keys()
+countrynames.sort()
+for alpha2 in countrynames:
+ coll = countries[alpha2]
+ # struct regdb_file_reg_country
+ output.write(struct.pack('>ccxxI', str(alpha2[0]), str(alpha2[1]), reg_rules_collections[coll.permissions]))
+
+
+if len(sys.argv) > 3:
+ # Load RSA only now so people can use this script
+ # without having those libraries installed to verify
+ # their SQL changes
+ from M2Crypto import RSA
+
+ # determine signature length
+ key = RSA.load_key(sys.argv[3])
+ hash = hashlib.sha1()
+ hash.update(output.getvalue())
+ sig = key.sign(hash.digest())
+ # write it to file
+ siglen.set(len(sig))
+ # sign again
+ hash = hashlib.sha1()
+ hash.update(output.getvalue())
+ sig = key.sign(hash.digest())
+
+ output.write(sig)
+else:
+ siglen.set(0)
+
+outfile = open(sys.argv[1], 'w')
+outfile.write(output.getvalue())
diff --git a/wireless-regdb-2011.04.28/dbparse.py b/wireless-regdb-2011.04.28/dbparse.py
new file mode 100755
index 0000000..2c0d738
--- /dev/null
+++ b/wireless-regdb-2011.04.28/dbparse.py
@@ -0,0 +1,370 @@
+#!/usr/bin/env python
+
+import sys, math
+
+# must match <linux/nl80211.h> enum nl80211_reg_rule_flags
+
+flag_definitions = {
+ 'NO-OFDM': 1<<0,
+ 'NO-CCK': 1<<1,
+ 'NO-INDOOR': 1<<2,
+ 'NO-OUTDOOR': 1<<3,
+ 'DFS': 1<<4,
+ 'PTP-ONLY': 1<<5,
+ 'PTMP-ONLY': 1<<6,
+ 'PASSIVE-SCAN': 1<<7,
+ 'NO-IBSS': 1<<8,
+ # hole at bit 9. FIXME: Where is NO-HT40 defined?
+ 'NO-HT40': 1<<10,
+}
+
+class FreqBand(object):
+ def __init__(self, start, end, bw, comments=None):
+ self.start = start
+ self.end = end
+ self.maxbw = bw
+ self.comments = comments or []
+
+ def __cmp__(self, other):
+ s = self
+ o = other
+ if not isinstance(o, FreqBand):
+ return False
+ return cmp((s.start, s.end, s.maxbw), (o.start, o.end, o.maxbw))
+
+ def __hash__(self):
+ s = self
+ return hash((s.start, s.end, s.maxbw))
+
+ def __str__(self):
+ return '<FreqBand %.3f - %.3f @ %.3f>' % (
+ self.start, self.end, self.maxbw)
+
+class PowerRestriction(object):
+ def __init__(self, max_ant_gain, max_eirp, comments = None):
+ self.max_ant_gain = max_ant_gain
+ self.max_eirp = max_eirp
+ self.comments = comments or []
+
+ def __cmp__(self, other):
+ s = self
+ o = other
+ if not isinstance(o, PowerRestriction):
+ return False
+ return cmp((s.max_ant_gain, s.max_eirp),
+ (o.max_ant_gain, o.max_eirp))
+
+ def __str__(self):
+ return '<PowerRestriction ...>'
+
+ def __hash__(self):
+ s = self
+ return hash((s.max_ant_gain, s.max_eirp))
+
+class FlagError(Exception):
+ def __init__(self, flag):
+ self.flag = flag
+
+class Permission(object):
+ def __init__(self, freqband, power, flags):
+ assert isinstance(freqband, FreqBand)
+ assert isinstance(power, PowerRestriction)
+ self.freqband = freqband
+ self.power = power
+ self.flags = 0
+ for flag in flags:
+ if not flag in flag_definitions:
+ raise FlagError(flag)
+ self.flags |= flag_definitions[flag]
+ self.textflags = flags
+
+ def _as_tuple(self):
+ return (self.freqband, self.power, self.flags)
+
+ def __cmp__(self, other):
+ if not isinstance(other, Permission):
+ return False
+ return cmp(self._as_tuple(), other._as_tuple())
+
+ def __hash__(self):
+ return hash(self._as_tuple())
+
+class Country(object):
+ def __init__(self, permissions=None, comments=None):
+ self._permissions = permissions or []
+ self.comments = comments or []
+
+ def add(self, perm):
+ assert isinstance(perm, Permission)
+ self._permissions.append(perm)
+ self._permissions.sort()
+
+ def __contains__(self, perm):
+ assert isinstance(perm, Permission)
+ return perm in self._permissions
+
+ def __str__(self):
+ r = ['(%s, %s)' % (str(b), str(p)) for b, p in self._permissions]
+ return '<Country (%s)>' % (', '.join(r))
+
+ def _get_permissions_tuple(self):
+ return tuple(self._permissions)
+ permissions = property(_get_permissions_tuple)
+
+class SyntaxError(Exception):
+ pass
+
+class DBParser(object):
+ def __init__(self, warn=None):
+ self._warn_callout = warn or sys.stderr.write
+
+ def _syntax_error(self, txt=None):
+ txt = txt and ' (%s)' % txt or ''
+ raise SyntaxError("Syntax error in line %d%s" % (self._lineno, txt))
+
+ def _warn(self, txt):
+ self._warn_callout("Warning (line %d): %s\n" % (self._lineno, txt))
+
+ def _parse_band_def(self, bname, banddef, dupwarn=True):
+ try:
+ freqs, bw = banddef.split('@')
+ bw = float(bw)
+ except ValueError:
+ bw = 20.0
+
+ try:
+ start, end = freqs.split('-')
+ start = float(start)
+ end = float(end)
+ # The kernel will reject these, so might as well reject this
+ # upon building it.
+ if start <= 0:
+ self._syntax_error("Invalid start freq (%d)" % start)
+ if end <= 0:
+ self._syntax_error("Invalid end freq (%d)" % end)
+ if start > end:
+ self._syntax_error("Inverted freq range (%d - %d)" % (start, end))
+ if start == end:
+ self._syntax_error("Start and end freqs are equal (%d)" % start)
+ if end - start < bw:
+ self._syntax_error("Invalid bandwidth: %d width channel "
+ "cannot possibly fit between %d - %d" % (bw, start, end))
+ except ValueError:
+ self._syntax_error("band must have frequency range")
+
+ b = FreqBand(start, end, bw, comments=self._comments)
+ self._comments = []
+ self._banddup[bname] = bname
+ if b in self._bandrev:
+ if dupwarn:
+ self._warn('Duplicate band definition ("%s" and "%s")' % (
+ bname, self._bandrev[b]))
+ self._banddup[bname] = self._bandrev[b]
+ self._bands[bname] = b
+ self._bandrev[b] = bname
+ self._bandline[bname] = self._lineno
+
+ def _parse_band(self, line):
+ try:
+ bname, line = line.split(':', 1)
+ if not bname:
+ self._syntax_error("'band' keyword must be followed by name")
+ except ValueError:
+ self._syntax_error("band name must be followed by colon")
+
+ if bname in flag_definitions:
+ self._syntax_error("Invalid band name")
+
+ self._parse_band_def(bname, line)
+
+ def _parse_power(self, line):
+ try:
+ pname, line = line.split(':', 1)
+ if not pname:
+ self._syntax_error("'power' keyword must be followed by name")
+ except ValueError:
+ self._syntax_error("power name must be followed by colon")
+
+ if pname in flag_definitions:
+ self._syntax_error("Invalid power name")
+
+ self._parse_power_def(pname, line)
+
+ def _parse_power_def(self, pname, line, dupwarn=True):
+ try:
+ (max_ant_gain,
+ max_eirp) = line.split(',')
+ if max_ant_gain == 'N/A':
+ max_ant_gain = '0'
+ if max_eirp == 'N/A':
+ max_eirp = '0'
+ max_ant_gain = float(max_ant_gain)
+ def conv_pwr(pwr):
+ if pwr.endswith('mW'):
+ pwr = float(pwr[:-2])
+ return 10.0 * math.log10(pwr)
+ else:
+ return float(pwr)
+ max_eirp = conv_pwr(max_eirp)
+ except ValueError:
+ self._syntax_error("invalid power data")
+
+ p = PowerRestriction(max_ant_gain, max_eirp,
+ comments=self._comments)
+ self._comments = []
+ self._powerdup[pname] = pname
+ if p in self._powerrev:
+ if dupwarn:
+ self._warn('Duplicate power definition ("%s" and "%s")' % (
+ pname, self._powerrev[p]))
+ self._powerdup[pname] = self._powerrev[p]
+ self._power[pname] = p
+ self._powerrev[p] = pname
+ self._powerline[pname] = self._lineno
+
+ def _parse_country(self, line):
+ try:
+ cname, line = line.split(':', 1)
+ if not cname:
+ self._syntax_error("'country' keyword must be followed by name")
+ if line:
+ self._syntax_error("extra data at end of country line")
+ except ValueError:
+ self._syntax_error("country name must be followed by colon")
+
+ cnames = cname.split(',')
+
+ self._current_countries = {}
+ for cname in cnames:
+ if len(cname) != 2:
+ self._warn("country '%s' not alpha2" % cname)
+ if not cname in self._countries:
+ self._countries[cname] = Country(comments=self._comments)
+ self._current_countries[cname] = self._countries[cname]
+ self._comments = []
+
+ def _parse_country_item(self, line):
+ if line[0] == '(':
+ try:
+ band, line = line[1:].split('),', 1)
+ bname = 'UNNAMED %d' % self._lineno
+ self._parse_band_def(bname, band, dupwarn=False)
+ except:
+ self._syntax_error("Badly parenthesised band definition")
+ else:
+ try:
+ bname, line = line.split(',', 1)
+ if not bname:
+ self._syntax_error("country definition must have band")
+ if not line:
+ self._syntax_error("country definition must have power")
+ except ValueError:
+ self._syntax_error("country definition must have band and power")
+
+ if line[0] == '(':
+ items = line.split('),', 1)
+ if len(items) == 1:
+ pname = items[0]
+ line = ''
+ if not pname[-1] == ')':
+ self._syntax_error("Badly parenthesised power definition")
+ pname = pname[:-1]
+ flags = []
+ else:
+ pname = items[0]
+ flags = items[1].split(',')
+ power = pname[1:]
+ pname = 'UNNAMED %d' % self._lineno
+ self._parse_power_def(pname, power, dupwarn=False)
+ else:
+ line = line.split(',')
+ pname = line[0]
+ flags = line[1:]
+
+ if not bname in self._bands:
+ self._syntax_error("band does not exist")
+ if not pname in self._power:
+ self._syntax_error("power does not exist")
+ self._bands_used[bname] = True
+ self._power_used[pname] = True
+ # de-duplicate so binary database is more compact
+ bname = self._banddup[bname]
+ pname = self._powerdup[pname]
+ b = self._bands[bname]
+ p = self._power[pname]
+ try:
+ perm = Permission(b, p, flags)
+ except FlagError, e:
+ self._syntax_error("Invalid flag '%s'" % e.flag)
+ for cname, c in self._current_countries.iteritems():
+ if perm in c:
+ self._warn('Rule "%s, %s" added to "%s" twice' % (
+ bname, pname, cname))
+ else:
+ c.add(perm)
+
+ def parse(self, f):
+ self._current_countries = None
+ self._bands = {}
+ self._power = {}
+ self._countries = {}
+ self._bands_used = {}
+ self._power_used = {}
+ self._bandrev = {}
+ self._powerrev = {}
+ self._banddup = {}
+ self._powerdup = {}
+ self._bandline = {}
+ self._powerline = {}
+
+ self._comments = []
+
+ self._lineno = 0
+ for line in f:
+ self._lineno += 1
+ line = line.strip()
+ if line[0:1] == '#':
+ self._comments.append(line[1:].strip())
+ line = line.replace(' ', '').replace('\t', '')
+ if not line:
+ self._comments = []
+ line = line.split('#')[0]
+ if not line:
+ continue
+ if line[0:4] == 'band':
+ self._parse_band(line[4:])
+ self._current_countries = None
+ self._comments = []
+ elif line[0:5] == 'power':
+ self._parse_power(line[5:])
+ self._current_countries = None
+ self._comments = []
+ elif line[0:7] == 'country':
+ self._parse_country(line[7:])
+ self._comments = []
+ elif self._current_countries is not None:
+ self._parse_country_item(line)
+ self._comments = []
+ else:
+ self._syntax_error("Expected band, power or country definition")
+
+ countries = self._countries
+ bands = {}
+ for k, v in self._bands.iteritems():
+ if k in self._bands_used:
+ bands[self._banddup[k]] = v
+ continue
+ # we de-duplicated, but don't warn again about the dupes
+ if self._banddup[k] == k:
+ self._lineno = self._bandline[k]
+ self._warn('Unused band definition "%s"' % k)
+ power = {}
+ for k, v in self._power.iteritems():
+ if k in self._power_used:
+ power[self._powerdup[k]] = v
+ continue
+ # we de-duplicated, but don't warn again about the dupes
+ if self._powerdup[k] == k:
+ self._lineno = self._powerline[k]
+ self._warn('Unused power definition "%s"' % k)
+ return countries
diff --git a/wireless-regdb-2011.04.28/dbparse.pyc b/wireless-regdb-2011.04.28/dbparse.pyc
new file mode 100644
index 0000000..8520adc
--- /dev/null
+++ b/wireless-regdb-2011.04.28/dbparse.pyc
Binary files differ
diff --git a/wireless-regdb-2011.04.28/debian-example/changelog b/wireless-regdb-2011.04.28/debian-example/changelog
new file mode 100644
index 0000000..7bbce5c
--- /dev/null
+++ b/wireless-regdb-2011.04.28/debian-example/changelog
@@ -0,0 +1,5 @@
+wireless-regdb (2009.01.15-1) unstable; urgency=low
+
+ * Initial release
+
+ -- Luis R. Rodriguez <mcgrof@gmail.com> Thu, 22 Jan 2009 16:00:00 +0100
diff --git a/wireless-regdb-2011.04.28/debian-example/compat b/wireless-regdb-2011.04.28/debian-example/compat
new file mode 100644
index 0000000..7ed6ff8
--- /dev/null
+++ b/wireless-regdb-2011.04.28/debian-example/compat
@@ -0,0 +1 @@
+5
diff --git a/wireless-regdb-2011.04.28/debian-example/control b/wireless-regdb-2011.04.28/debian-example/control
new file mode 100644
index 0000000..a5b518b
--- /dev/null
+++ b/wireless-regdb-2011.04.28/debian-example/control
@@ -0,0 +1,15 @@
+Source: wireless-regdb
+Section: admin
+Priority: optional
+Maintainer: Luis R. Rodriguez <mcgrof@gmail.com>
+Build-Depends: cdbs, debhelper (>= 5), python
+Standards-Version: 3.7.3
+
+Package: wireless-regdb
+Architecture: all
+Depends:
+Suggests: crda
+Description: The Linux wireless regulatory database
+ This package contains the wireless regulatory database used by all
+ cfg80211 based Linux wireless drivers. The wireless database being
+ used is maintained by John Linville, the Linux wireless kernel maintainer.
diff --git a/wireless-regdb-2011.04.28/debian-example/copyright b/wireless-regdb-2011.04.28/debian-example/copyright
new file mode 100644
index 0000000..c01f1a0
--- /dev/null
+++ b/wireless-regdb-2011.04.28/debian-example/copyright
@@ -0,0 +1,21 @@
+This package was debianized by Luis Rodriguez <mcgrof@gmail.com> on
+Thu, 22 Jan 2009 16:00:00 +0100.
+
+The wireless-regdb packages was downloaded from <http://wireless.kernel.org/download/wireless-regdb/>
+
+Copyright (c) 2008, Luis R. Rodriguez <mcgrof@gmail.com>
+Copyright (c) 2008, Johannes Berg <johannes@sipsolutions.net>
+Copyright (c) 2008, Michael Green <Michael.Green@Atheros.com>
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
diff --git a/wireless-regdb-2011.04.28/debian-example/docs b/wireless-regdb-2011.04.28/debian-example/docs
new file mode 100644
index 0000000..e845566
--- /dev/null
+++ b/wireless-regdb-2011.04.28/debian-example/docs
@@ -0,0 +1 @@
+README
diff --git a/wireless-regdb-2011.04.28/debian-example/rules b/wireless-regdb-2011.04.28/debian-example/rules
new file mode 100755
index 0000000..34a08a5
--- /dev/null
+++ b/wireless-regdb-2011.04.28/debian-example/rules
@@ -0,0 +1,10 @@
+#!/usr/bin/make -f
+
+include /usr/share/cdbs/1/rules/debhelper.mk
+
+PREFIX = /usr
+CRDA_LIB ?= $(PREFIX)/lib/crda
+
+install/wireless-regdb::
+ install -o 0 -g 0 -m 755 -d debian/$(cdbs_curpkg)/$(CRDA_LIB)
+ install -o 0 -g 0 -m 644 regulatory.bin debian/$(cdbs_curpkg)/$(CRDA_LIB)/regulatory.bin
diff --git a/wireless-regdb-2011.04.28/linville.key.pub.pem b/wireless-regdb-2011.04.28/linville.key.pub.pem
new file mode 100644
index 0000000..3a2e8d0
--- /dev/null
+++ b/wireless-regdb-2011.04.28/linville.key.pub.pem
@@ -0,0 +1,9 @@
+-----BEGIN PUBLIC KEY-----
+MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1leZcYjTXc4qLq1oN2Ak
+8vLP85P5cFTrCpqdSI5W4VOwdaJB4TtaxU2fATcH/A2EsE3h1rOfzI0+fBV9DcOO
+qyID+zdILBMb8xK5Zv+78OkBGls/WzvDDVhdmn1TRHvRvmJy7cX1mCT56cnHrZM/
+ZBaFwVfiD9TcqqisyF1sqE5+cMHTWRbxc1+rtojr0eGYrNfK20awlD5KVj6Ejzot
+r9EDWAsL1bH/kGfMdnputcyMapLQpRVruO/jEdjSmhAE/sj1tmHcAXBT6j5al4Oa
+LiBaWnP++rune7rjimwfzp0549/rupQUM7nAZRDLyzXj3J/KEci6dXtjonBUFqDY
+4QIDAQAB
+-----END PUBLIC KEY-----
diff --git a/wireless-regdb-2011.04.28/regulatory.bin b/wireless-regdb-2011.04.28/regulatory.bin
new file mode 100644
index 0000000..15b9230
--- /dev/null
+++ b/wireless-regdb-2011.04.28/regulatory.bin
Binary files differ
diff --git a/wireless-regdb-2011.04.28/regulatory.bin.5 b/wireless-regdb-2011.04.28/regulatory.bin.5
new file mode 100644
index 0000000..430c65c
--- /dev/null
+++ b/wireless-regdb-2011.04.28/regulatory.bin.5
@@ -0,0 +1,37 @@
+.TH regulatory.bin 5 "23 January 2009" "regulatory.bin" "Linux"
+.SH NAME
+regulatory.bin \- The Linux wireless regulatory database
+
+.ad l
+.in +8
+.ti -8
+
+.SS
+.SH Description
+.B regulatory.bin
+is the file used by the Linux wireless subsystem to keep its regulatory
+database information. It is read by
+.B crda
+upon the Linux kernel's request for regulatory information for a specific
+ISO / IEC 3166 alpha2 country code. The regulatory database is kept in
+a small binary format for size and code efficiency. The
+.B regulatory.bin
+file can be parsed and read in human format by using the
+.B regdbdump
+command. The
+.B regulatory.bin
+file should be updated upon regulatory changes or corrections.
+
+.SH Upkeeping
+The regulatory database is maintained by the community as such
+you are encouraged to send any corrections or updates to the
+linux-wireless mailing list:
+.B linux-wireless@vger.kernel.org
+
+.SH SEE ALSO
+.BR regdbdump (8)
+.BR crda (8)
+.BR iw (8)
+
+.BR http://wireless.kernel.org/en/developers/Regulatory/
+
diff --git a/wireless-regdb-2011.04.28/sha1sum.txt b/wireless-regdb-2011.04.28/sha1sum.txt
new file mode 100644
index 0000000..01a75ea
--- /dev/null
+++ b/wireless-regdb-2011.04.28/sha1sum.txt
@@ -0,0 +1 @@
+a22131f5718777a60076b83b9dac03c7d2245cec db.txt
diff --git a/wireless-regdb-2011.04.28/web/Regulatory.py b/wireless-regdb-2011.04.28/web/Regulatory.py
new file mode 100644
index 0000000..f675921
--- /dev/null
+++ b/wireless-regdb-2011.04.28/web/Regulatory.py
@@ -0,0 +1,166 @@
+# -*- coding: iso-8859-1 -*-
+"""
+ Regulatory Database
+
+ @copyright: 2008 Johannes Berg
+ @license: ISC, see LICENSE for details.
+"""
+
+import codecs, math
+from dbparse import DBParser, flag_definitions
+
+Dependencies = ["time"]
+
+def _country(macro, countries, code):
+ result = []
+
+ f = macro.formatter
+
+ result.extend([
+ f.heading(1, 1),
+ f.text('Regulatory definition for %s' % _get_iso_code(code)),
+ f.heading(0, 1),
+ ])
+
+ try:
+ country = countries[code]
+ except:
+ result.append(f.text('No information available'))
+ return ''.join(result)
+
+
+ if country.comments:
+ result.extend([
+ f.preformatted(1),
+ f.text('\n'.join(country.comments)),
+ f.preformatted(0),
+ ])
+
+ result.append(f.table(1))
+ result.extend([
+ f.table_row(1),
+ f.table_cell(1), f.strong(1),
+ f.text('Band [MHz]'),
+ f.strong(0), f.table_cell(0),
+ f.table_cell(1), f.strong(1),
+ f.text('Max BW [MHz]'),
+ f.strong(0), f.table_cell(0),
+ f.table_cell(1), f.strong(1),
+ f.text('Flags'),
+ f.strong(0), f.table_cell(0),
+ f.table_cell(1), f.strong(1),
+ f.text('Max antenna gain [dBi]'),
+ f.strong(0), f.table_cell(0),
+ f.table_cell(1), f.strong(1),
+ f.text('Max EIRP [dBm'),
+ f.hardspace,
+ f.text('(mW)]'),
+ f.strong(0), f.table_cell(0),
+ f.table_row(0),
+ ])
+
+ for perm in country.permissions:
+ def str_or_na(val, dBm=False):
+ if val and not dBm:
+ return '%.2f' % val
+ elif val:
+ return '%.2f (%.2f)' % (val, math.pow(10, val/10.0))
+ return 'N/A'
+ result.extend([
+ f.table_row(1),
+ f.table_cell(1),
+ f.text('%.3f - %.3f' % (perm.freqband.start, perm.freqband.end)),
+ f.table_cell(0),
+ f.table_cell(1),
+ f.text('%.3f' % (perm.freqband.maxbw,)),
+ f.table_cell(0),
+ f.table_cell(1),
+ f.text(', '.join(perm.textflags)),
+ f.table_cell(0),
+ f.table_cell(1),
+ f.text(str_or_na(perm.power.max_ant_gain)),
+ f.table_cell(0),
+ f.table_cell(1),
+ f.text(str_or_na(perm.power.max_eirp, dBm=True)),
+ f.table_cell(0),
+ f.table_row(0),
+ ])
+
+ result.append(f.table(0))
+
+ result.append(f.linebreak(0))
+ result.append(f.linebreak(0))
+ result.append(macro.request.page.link_to(macro.request, 'return to country list'))
+ return ''.join(result)
+
+_iso_list = {}
+
+def _get_iso_code(code):
+ if not _iso_list:
+ for line in codecs.open('/usr/share/iso-codes/iso_3166.tab', encoding='utf-8'):
+ line = line.strip()
+ c, name = line.split('\t')
+ _iso_list[c] = name
+ return _iso_list.get(code, 'Unknown (%s)' % code)
+
+def macro_Regulatory(macro):
+ _ = macro.request.getText
+ request = macro.request
+ f = macro.formatter
+
+ country = request.form.get('alpha2', [None])[0]
+
+ dbpath = '/tmp/db.txt'
+ if hasattr(request.cfg, 'regdb_path'):
+ dbpath = request.cfg.regdb_path
+
+ result = []
+
+ if request.form.get('raw', [None])[0]:
+ result.append(f.code_area(1, 'db-raw', show=1, start=1, step=1))
+ for line in open(dbpath):
+ result.extend([
+ f.code_line(1),
+ f.text(line.rstrip()),
+ f.code_line(0),
+ ])
+ result.append(f.code_area(0, 'db-raw'))
+ result.append(macro.request.page.link_to(macro.request, 'return to country list'))
+ return ''.join(result)
+
+ warnings = []
+ countries = DBParser(warn=lambda x: warnings.append(x)).parse(open(dbpath))
+
+ if country:
+ return _country(macro, countries, country)
+
+ countries = countries.keys()
+ countries = [(_get_iso_code(code), code) for code in countries]
+ countries.sort()
+
+ result.extend([
+ f.heading(1, 1),
+ f.text('Countries'),
+ f.heading(0, 1),
+ ])
+
+ result.append(f.bullet_list(1))
+ for name, code in countries:
+ result.extend([
+ f.listitem(1),
+ request.page.link_to(request, name, querystr={'alpha2': code}),
+ f.listitem(0),
+ ])
+ result.append(f.bullet_list(0))
+
+ if warnings:
+ result.append(f.heading(1, 2))
+ result.append(f.text("Warnings"))
+ result.append(f.heading(0, 2))
+ result.append(f.preformatted(1))
+ result.extend(warnings)
+ result.append(f.preformatted(0))
+
+ result.append(request.page.link_to(request, 'view raw database', querystr={'raw': 1}))
+
+ return ''.join(result)
diff --git a/wireless-regdb-2011.04.28/wireless-regdb.spec b/wireless-regdb-2011.04.28/wireless-regdb.spec
new file mode 100644
index 0000000..b76d391
--- /dev/null
+++ b/wireless-regdb-2011.04.28/wireless-regdb.spec
@@ -0,0 +1,35 @@
+Summary: Linux wireless regulatory database
+Name: wireless-regdb
+Version: 2009.01.15
+Release: 1
+License: ISC
+Group: System Enviroment/Base
+Source: http://wireless.kernel.org/download/wireless-regdb/wireless-regdb-2009-01-15.tar.bz2
+URL: http://wireless.kernel.org/en/developers/Regulatory/
+Packager: Luis R. Rodriguez <mcgrof@gmail.com>
+BuildRoot : /var/tmp/%{name}-buildroot
+Requires: python
+BuildArch: noarch
+
+%define crda_lib /usr/lib/crda
+
+%description
+This package contains the wireless regulatory database used by all
+cfg80211 based Linux wireless drivers. The wireless database being
+used is maintained by John Linville, the Linux wireless kernel maintainer
+http://wireless.kernel.org/en/developers/Regulatory/
+
+%prep
+%setup -n %name-2009-01-15
+%build
+%install
+install -m 755 -d %buildroot/%crda_lib
+install -m 644 regulatory.bin %buildroot/%{crda_lib}/regulatory.bin
+%files
+%crda_lib/regulatory.bin
+%doc README LICENSE
+
+%changelog
+* Fri Jan 23 2009 - mcgrof@gmail.com
+- Started wireless-regdb package
+
diff --git a/wireless-regdb.patches/wireless-regdb-50.description b/wireless-regdb.patches/wireless-regdb-50.description
new file mode 100644
index 0000000..d8b7d58
--- /dev/null
+++ b/wireless-regdb.patches/wireless-regdb-50.description
@@ -0,0 +1 @@
+Use /usr/bin/python instead of /usr/bin/env python to prevent build errors with nest-python setup in your environment.
diff --git a/wireless-regdb.patches/wireless-regdb-50.patch b/wireless-regdb.patches/wireless-regdb-50.patch
new file mode 100644
index 0000000..a69dca4
--- /dev/null
+++ b/wireless-regdb.patches/wireless-regdb-50.patch
@@ -0,0 +1,9 @@
+diff -Naur a/db2bin.py b/db2bin.py
+--- a/db2bin.py 2011-04-28 12:17:40.000000000 -0700
++++ b/db2bin.py 2015-07-09 11:40:45.681967994 -0700
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/python
+
+ from cStringIO import StringIO
+ import struct
diff --git a/wireless-regdb.tar.bz2 b/wireless-regdb.tar.bz2
new file mode 100644
index 0000000..d808207
--- /dev/null
+++ b/wireless-regdb.tar.bz2
Binary files differ
diff --git a/wireless-regdb.url b/wireless-regdb.url
new file mode 100644
index 0000000..9872796
--- /dev/null
+++ b/wireless-regdb.url
@@ -0,0 +1 @@
+http://linuxwireless.org/download/wireless-regdb/wireless-regdb-2011.04.28.tar.bz2
diff --git a/wireless-regdb.version b/wireless-regdb.version
new file mode 100644
index 0000000..2f21b2d
--- /dev/null
+++ b/wireless-regdb.version
@@ -0,0 +1 @@
+2011.04.28