summaryrefslogtreecommitdiff
path: root/reglib.h
AgeCommit message (Collapse)AuthorFilesLines
2012-01-18crda: rename reglib_get_*() routinesv1.1.3upstream/1.1.3Luis R. Rodriguez1-4/+4
reglib_get_country_idx() --> reglib_get_rd_alpha2() reglib_get_country_alpha2() --> reglib_get_rd_alpha2() This reflects better what we provide back out. Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
2012-01-18crda: make usage of regdb.h exclusive to reglib.cLuis R. Rodriguez1-2/+0
The only other remaining user of regdb.h is regdbdump tool but as I see it this utility can exist in either a reglib library, or on each OS for its own specific adaptation of the reglib code. For now we just make regdbump use the local copy of nl80211.h. Later the reglib library can have its own print / dump utility if we deem it necessary. Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
2012-01-18crda: make country2rd() staticLuis R. Rodriguez1-4/+0
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
2012-01-18crda: add dfs_region to the ieee80211_regdomain data structureLuis R. Rodriguez1-0/+1
This will be used later once crda.c starts using the ieee80211_regdomain data structure passed on from reglib instead of using the mmap()'d regulatory file directly. Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
2012-01-18crda: add new reglib_get_country_alpha2()Luis R. Rodriguez1-0/+3
This will be used by CRDA to find the alpha2. Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
2012-01-18crda: add a reglib iterator reglib_for_each_country()Luis R. Rodriguez1-0/+9
To allow for a simple library on reglib.c we want to enable an iterator over the regulatory database that does not have to lock the file, or pass references to the file. We instead add an iterator reglib_get_country_idx() which will use a new reglib_get_country_idx(), that does an O(n) search for each new regulatory domain it needs to read. The trade off here is to allow for a simple reglib.c implementation at the cost that upon each iteration reglib_get_country_idx() we will will be opening the regdb, and verifying the db signature. Given that the only user of this iterator is regdbdump though and that this is used for debugging for now this is trade off I am willing to live with. Systems that want to use the regdb as a database for fine tuning radio parameters dynamically and reading this file very *often* (seconds, minutes, who knows what the future holds) may want to consider a slight optimization of exporting the direct mmap() through the library but we are I think light years away from that. Signed-off-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
2011-11-15crda: use stdint.h instead of linux/types.hLuis R. Rodriguez1-13/+13
Given that we may need to make a library out of some routines here to share with the regulatory simulator. Signed-off-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
2011-10-10crda: fix null string assumption for alpha2Luis R. Rodriguez1-13/+0
The wireless-regdb only accounts for two bytes for the country code but CRDA defined the alpha2 to be as a string of length 2, and so does the nl80211 attribute policy: [NL80211_ATTR_REG_ALPHA2] = { .type = NLA_STRING, .len = 2 }, The meaning of a string is it'll be null terminated, so if you do not add the null termination a country without the null termination will not match up with the nl80211 attribute policy. This has no impact for us unless we want to use the next available pad byte on the wireless-regdb. This fixes CRDA by using a local copy of the regdb's alpha2 that is properly null terminated and sending it. The implications of this change is that new wirelesss-regdb's that make use of the next pad byte for a country will get that country ignored for regulatory hints sent to the kernel. At this point we don't yet know what the next byte will be used for though so this has no impact. The second pad byte is being used for DFS and that is not impacted by this nor is this change required for it. Distributions should upgrade though in case we ever do decide to use this last precious country byte. I've tested that this indeed fixes the bogus issue I saw when instead of using the second pad byte we use the first pad byte. Thanks to Johannes for spotting the issue. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
2008-12-01Move is_valid_reg_rule() in intersect.c.Diego 'Flameeyes' Pettenò1-1/+0
The function is only ever used in that translation unit so it makes no sense to define it for all the binaries. Signed-off-by: Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com> Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
2008-12-01Mark functions static when not used outside their translation unit.Diego 'Flameeyes' Pettenò1-3/+0
Signed-off-by: Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com> Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
2008-10-29Double pointers obfuscate code, dieLuis R. Rodriguez1-3/+2
Lets make country2rd() easier to read by not using double pointers. Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
2008-10-28Add conversion utitlies, standardize printingLuis R. Rodriguez1-3/+56
This adds country2rd() and friends which allows us to use more friendlier data structures that are not big endian and standardizes printing this new rd structure. Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
2008-10-28Share common routines into a reg lib, other objects will later reuse.Luis R. Rodriguez1-0/+49
renamed: regdb.c -> reglib.c renamed: crda.h -> reglib.h Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>