xref: /freebsd/sys/net80211/ieee80211_regdomain.h (revision 1e413cf93298b5b97441a21d9a50fdcd0ee9945e)
1 /*-
2  * Copyright (c) 2005-2007 Sam Leffler, Errno Consulting
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  *
25  * $FreeBSD$
26  */
27 #ifndef _NET80211_IEEE80211_REGDOMAIN_H_
28 #define _NET80211_IEEE80211_REGDOMAIN_H_
29 
30 /*
31  * 802.11 regulatory domain definitions.
32  */
33 
34 /*
35  * ISO 3166 Country/Region Codes
36  * http://ftp.ics.uci.edu/pub/ietf/http/related/iso3166.txt
37  */
38 enum ISOCountryCode {
39 	CTRY_AFGHANISTAN	= 4,
40 	CTRY_ALBANIA		= 8,	/* Albania */
41 	CTRY_ALGERIA		= 12,	/* Algeria */
42 	CTRY_AMERICAN_SAMOA	= 16,
43 	CTRY_ANDORRA		= 20,
44 	CTRY_ANGOLA		= 24,
45 	CTRY_ANGUILLA		= 660,
46 	/* XXX correct remainder */
47 	CTRY_ARGENTINA		= 32,	/* Argentina */
48 	CTRY_ARMENIA		= 51,	/* Armenia */
49 	CTRY_AUSTRALIA		= 36,	/* Australia */
50 	CTRY_AUSTRIA		= 40,	/* Austria */
51 	CTRY_AZERBAIJAN		= 31,	/* Azerbaijan */
52 	CTRY_BAHRAIN		= 48,	/* Bahrain */
53 	CTRY_BELARUS		= 112,	/* Belarus */
54 	CTRY_BELGIUM		= 56,	/* Belgium */
55 	CTRY_BELIZE		= 84,	/* Belize */
56 	CTRY_BOLIVIA		= 68,	/* Bolivia */
57 	CTRY_BRAZIL		= 76,	/* Brazil */
58 	CTRY_BRUNEI_DARUSSALAM	= 96,	/* Brunei Darussalam */
59 	CTRY_BULGARIA		= 100,	/* Bulgaria */
60 	CTRY_CANADA		= 124,	/* Canada */
61 	CTRY_CHILE		= 152,	/* Chile */
62 	CTRY_CHINA		= 156,	/* People's Republic of China */
63 	CTRY_COLOMBIA		= 170,	/* Colombia */
64 	CTRY_COSTA_RICA		= 188,	/* Costa Rica */
65 	CTRY_CROATIA		= 191,	/* Croatia */
66 	CTRY_CYPRUS		= 196,	/* Cyprus */
67 	CTRY_CZECH		= 203,	/* Czech Republic */
68 	CTRY_DENMARK		= 208,	/* Denmark */
69 	CTRY_DOMINICAN_REPUBLIC	= 214,	/* Dominican Republic */
70 	CTRY_ECUADOR		= 218,	/* Ecuador */
71 	CTRY_EGYPT		= 818,	/* Egypt */
72 	CTRY_EL_SALVADOR	= 222,	/* El Salvador */
73 	CTRY_ESTONIA		= 233,	/* Estonia */
74 	CTRY_FAEROE_ISLANDS	= 234,	/* Faeroe Islands */
75 	CTRY_FINLAND		= 246,	/* Finland */
76 	CTRY_FRANCE		= 250,	/* France */
77 	CTRY_FRANCE2		= 255,	/* France2 */
78 	CTRY_GEORGIA		= 268,	/* Georgia */
79 	CTRY_GERMANY		= 276,	/* Germany */
80 	CTRY_GREECE		= 300,	/* Greece */
81 	CTRY_GUATEMALA		= 320,	/* Guatemala */
82 	CTRY_HONDURAS		= 340,	/* Honduras */
83 	CTRY_HONG_KONG		= 344,	/* Hong Kong S.A.R., P.R.C. */
84 	CTRY_HUNGARY		= 348,	/* Hungary */
85 	CTRY_ICELAND		= 352,	/* Iceland */
86 	CTRY_INDIA		= 356,	/* India */
87 	CTRY_INDONESIA		= 360,	/* Indonesia */
88 	CTRY_IRAN		= 364,	/* Iran */
89 	CTRY_IRAQ		= 368,	/* Iraq */
90 	CTRY_IRELAND		= 372,	/* Ireland */
91 	CTRY_ISRAEL		= 376,	/* Israel */
92 	CTRY_ITALY		= 380,	/* Italy */
93 	CTRY_JAMAICA		= 388,	/* Jamaica */
94 	CTRY_JAPAN		= 392,	/* Japan */
95 	CTRY_JAPAN1		= 393,	/* Japan (JP1) */
96 	CTRY_JAPAN2		= 394,	/* Japan (JP0) */
97 	CTRY_JAPAN3		= 395,	/* Japan (JP1-1) */
98 	CTRY_JAPAN4		= 396,	/* Japan (JE1) */
99 	CTRY_JAPAN5		= 397,	/* Japan (JE2) */
100 	CTRY_JORDAN		= 400,	/* Jordan */
101 	CTRY_KAZAKHSTAN		= 398,	/* Kazakhstan */
102 	CTRY_KENYA		= 404,	/* Kenya */
103 	CTRY_KOREA_NORTH	= 408,	/* North Korea */
104 	CTRY_KOREA_ROC		= 410,	/* South Korea */
105 	CTRY_KOREA_ROC2		= 411,	/* South Korea */
106 	CTRY_KUWAIT		= 414,	/* Kuwait */
107 	CTRY_LATVIA		= 428,	/* Latvia */
108 	CTRY_LEBANON		= 422,	/* Lebanon */
109 	CTRY_LIBYA		= 434,	/* Libya */
110 	CTRY_LIECHTENSTEIN	= 438,	/* Liechtenstein */
111 	CTRY_LITHUANIA		= 440,	/* Lithuania */
112 	CTRY_LUXEMBOURG		= 442,	/* Luxembourg */
113 	CTRY_MACAU		= 446,	/* Macau */
114 	CTRY_MACEDONIA		= 807,	/* the Former Yugoslav Republic of Macedonia */
115 	CTRY_MALAYSIA		= 458,	/* Malaysia */
116 	CTRY_MEXICO		= 484,	/* Mexico */
117 	CTRY_MONACO		= 492,	/* Principality of Monaco */
118 	CTRY_MOROCCO		= 504,	/* Morocco */
119 	CTRY_NETHERLANDS	= 528,	/* Netherlands */
120 	CTRY_NEW_ZEALAND	= 554,	/* New Zealand */
121 	CTRY_NICARAGUA		= 558,	/* Nicaragua */
122 	CTRY_NORWAY		= 578,	/* Norway */
123 	CTRY_OMAN		= 512,	/* Oman */
124 	CTRY_PAKISTAN		= 586,	/* Islamic Republic of Pakistan */
125 	CTRY_PANAMA		= 591,	/* Panama */
126 	CTRY_PARAGUAY		= 600,	/* Paraguay */
127 	CTRY_PERU		= 604,	/* Peru */
128 	CTRY_PHILIPPINES	= 608,	/* Republic of the Philippines */
129 	CTRY_POLAND		= 616,	/* Poland */
130 	CTRY_PORTUGAL		= 620,	/* Portugal */
131 	CTRY_PUERTO_RICO	= 630,	/* Puerto Rico */
132 	CTRY_QATAR		= 634,	/* Qatar */
133 	CTRY_ROMANIA		= 642,	/* Romania */
134 	CTRY_RUSSIA		= 643,	/* Russia */
135 	CTRY_SAUDI_ARABIA	= 682,	/* Saudi Arabia */
136 	CTRY_SINGAPORE		= 702,	/* Singapore */
137 	CTRY_SLOVAKIA		= 703,	/* Slovak Republic */
138 	CTRY_SLOVENIA		= 705,	/* Slovenia */
139 	CTRY_SOUTH_AFRICA	= 710,	/* South Africa */
140 	CTRY_SPAIN		= 724,	/* Spain */
141 	CTRY_SWEDEN		= 752,	/* Sweden */
142 	CTRY_SWITZERLAND	= 756,	/* Switzerland */
143 	CTRY_SYRIA		= 760,	/* Syria */
144 	CTRY_TAIWAN		= 158,	/* Taiwan */
145 	CTRY_THAILAND		= 764,	/* Thailand */
146 	CTRY_TRINIDAD_Y_TOBAGO	= 780,	/* Trinidad y Tobago */
147 	CTRY_TUNISIA		= 788,	/* Tunisia */
148 	CTRY_TURKEY		= 792,	/* Turkey */
149 	CTRY_UAE		= 784,	/* U.A.E. */
150 	CTRY_UKRAINE		= 804,	/* Ukraine */
151 	CTRY_UNITED_KINGDOM	= 826,	/* United Kingdom */
152 	CTRY_UNITED_STATES	= 840,	/* United States */
153 	CTRY_URUGUAY		= 858,	/* Uruguay */
154 	CTRY_UZBEKISTAN		= 860,	/* Uzbekistan */
155 	CTRY_VENEZUELA		= 862,	/* Venezuela */
156 	CTRY_VIET_NAM		= 704,	/* Viet Nam */
157 	CTRY_YEMEN		= 887,	/* Yemen */
158 	CTRY_ZIMBABWE		= 716,	/* Zimbabwe */
159 };
160 
161 #if defined(__KERNEL__) || defined(_KERNEL)
162 #define CTRY_DEBUG                0x1ff   /* debug */
163 #define CTRY_DEFAULT              0       /* default */
164 
165 void	ieee80211_regdomain_attach(struct ieee80211com *);
166 void	ieee80211_regdomain_detach(struct ieee80211com *);
167 
168 void	ieee80211_init_channels(struct ieee80211com *ic,
169 	    int rd, enum ISOCountryCode cc, int bands, int outdoor, int ecm);
170 uint8_t	*ieee80211_add_countryie(uint8_t *, struct ieee80211com *,
171 	    enum ISOCountryCode cc, int location);
172 const char *ieee80211_cctoiso(enum ISOCountryCode);
173 int	ieee80211_isotocc(const char iso[2]);
174 #endif /* defined(__KERNEL__) || defined(_KERNEL) */
175 #endif /* _NET80211_IEEE80211_REGDOMAIN_H_ */
176