xref: /freebsd/sys/net80211/ieee80211_regdomain.h (revision f5f7c05209ca2c3748fd8b27c5e80ffad49120eb)
1 /*-
2  * Copyright (c) 2005-2008 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 	CTRY_ANTARTICA		= 10,
47 	CTRY_ANTIGUA		= 28,	/* Antigua and Barbuda */
48 	CTRY_ARGENTINA		= 32,	/* Argentina */
49 	CTRY_ARMENIA		= 51,	/* Armenia */
50 	CTRY_ARUBA		= 533,	/* Aruba */
51 	CTRY_AUSTRALIA		= 36,	/* Australia */
52 	CTRY_AUSTRIA		= 40,	/* Austria */
53 	CTRY_AZERBAIJAN		= 31,	/* Azerbaijan */
54 	CTRY_BAHAMAS		= 44,	/* Bahamas */
55 	CTRY_BAHRAIN		= 48,	/* Bahrain */
56 	CTRY_BANGLADESH		= 50,	/* Bangladesh */
57 	CTRY_BARBADOS		= 52,
58 	CTRY_BELARUS		= 112,	/* Belarus */
59 	CTRY_BELGIUM		= 56,	/* Belgium */
60 	CTRY_BELIZE		= 84,
61 	CTRY_BENIN		= 204,
62 	CTRY_BERMUDA		= 60,
63 	CTRY_BHUTAN		= 64,
64 	CTRY_BOLIVIA		= 68,	/* Bolivia */
65 	CTRY_BOSNIA_AND_HERZEGOWINA = 70,
66 	CTRY_BOTSWANA		= 72,
67 	CTRY_BOUVET_ISLAND	= 74,
68 	CTRY_BRAZIL		= 76,	/* Brazil */
69 	CTRY_BRITISH_INDIAN_OCEAN_TERRITORY = 86,
70 	CTRY_BRUNEI_DARUSSALAM	= 96,	/* Brunei Darussalam */
71 	CTRY_BULGARIA		= 100,	/* Bulgaria */
72 	CTRY_BURKINA_FASO	= 854,
73 	CTRY_BURUNDI		= 108,
74 	CTRY_CAMBODIA		= 116,
75 	CTRY_CAMEROON		= 120,
76 	CTRY_CANADA		= 124,	/* Canada */
77 	CTRY_CAPE_VERDE		= 132,
78 	CTRY_CAYMAN_ISLANDS	= 136,
79 	CTRY_CENTRAL_AFRICAN_REPUBLIC = 140,
80 	CTRY_CHAD		= 148,
81 	CTRY_CHILE		= 152,	/* Chile */
82 	CTRY_CHINA		= 156,	/* People's Republic of China */
83 	CTRY_CHRISTMAS_ISLAND	= 162,
84 	CTRY_COCOS_ISLANDS	= 166,
85 	CTRY_COLOMBIA		= 170,	/* Colombia */
86 	CTRY_COMOROS		= 174,
87 	CTRY_CONGO		= 178,
88 	CTRY_COOK_ISLANDS	= 184,
89 	CTRY_COSTA_RICA		= 188,	/* Costa Rica */
90 	CTRY_COTE_DIVOIRE	= 384,
91 	CTRY_CROATIA		= 191,	/* Croatia (local name: Hrvatska) */
92 	CTRY_CYPRUS		= 196,	/* Cyprus */
93 	CTRY_CZECH		= 203,	/* Czech Republic */
94 	CTRY_DENMARK		= 208,	/* Denmark */
95 	CTRY_DJIBOUTI		= 262,
96 	CTRY_DOMINICA		= 212,
97 	CTRY_DOMINICAN_REPUBLIC	= 214,	/* Dominican Republic */
98 	CTRY_EAST_TIMOR		= 626,
99 	CTRY_ECUADOR		= 218,	/* Ecuador */
100 	CTRY_EGYPT		= 818,	/* Egypt */
101 	CTRY_EL_SALVADOR	= 222,	/* El Salvador */
102 	CTRY_EQUATORIAL_GUINEA	= 226,
103 	CTRY_ERITREA		= 232,
104 	CTRY_ESTONIA		= 233,	/* Estonia */
105 	CTRY_ETHIOPIA		= 210,
106 	CTRY_FALKLAND_ISLANDS	= 238,	/* (Malvinas) */
107 	CTRY_FAEROE_ISLANDS	= 234,	/* Faeroe Islands */
108 	CTRY_FIJI		= 242,
109 	CTRY_FINLAND		= 246,	/* Finland */
110 	CTRY_FRANCE		= 250,	/* France */
111 	CTRY_FRANCE2		= 255,	/* France (Metropolitan) */
112 	CTRY_FRENCH_GUIANA	= 254,
113 	CTRY_FRENCH_POLYNESIA	= 258,
114 	CTRY_FRENCH_SOUTHERN_TERRITORIES	= 260,
115 	CTRY_GABON		= 266,
116 	CTRY_GAMBIA		= 270,
117 	CTRY_GEORGIA		= 268,	/* Georgia */
118 	CTRY_GERMANY		= 276,	/* Germany */
119 	CTRY_GHANA		= 288,
120 	CTRY_GIBRALTAR		= 292,
121 	CTRY_GREECE		= 300,	/* Greece */
122 	CTRY_GREENLAND		= 304,
123 	CTRY_GRENADA		= 308,
124 	CTRY_GUADELOUPE		= 312,
125 	CTRY_GUAM		= 316,
126 	CTRY_GUATEMALA		= 320,	/* Guatemala */
127 	CTRY_GUINEA		= 324,
128 	CTRY_GUINEA_BISSAU	= 624,
129 	CTRY_GUYANA		= 328,
130 	/* XXX correct remainder */
131 	CTRY_HAITI		= 332,
132 	CTRY_HONDURAS		= 340,	/* Honduras */
133 	CTRY_HONG_KONG		= 344,	/* Hong Kong S.A.R., P.R.C. */
134 	CTRY_HUNGARY		= 348,	/* Hungary */
135 	CTRY_ICELAND		= 352,	/* Iceland */
136 	CTRY_INDIA		= 356,	/* India */
137 	CTRY_INDONESIA		= 360,	/* Indonesia */
138 	CTRY_IRAN		= 364,	/* Iran */
139 	CTRY_IRAQ		= 368,	/* Iraq */
140 	CTRY_IRELAND		= 372,	/* Ireland */
141 	CTRY_ISRAEL		= 376,	/* Israel */
142 	CTRY_ITALY		= 380,	/* Italy */
143 	CTRY_JAMAICA		= 388,	/* Jamaica */
144 	CTRY_JAPAN		= 392,	/* Japan */
145 	CTRY_JORDAN		= 400,	/* Jordan */
146 	CTRY_KAZAKHSTAN		= 398,	/* Kazakhstan */
147 	CTRY_KENYA		= 404,	/* Kenya */
148 	CTRY_KOREA_NORTH	= 408,	/* North Korea */
149 	CTRY_KOREA_ROC		= 410,	/* South Korea */
150 	CTRY_KOREA_ROC2		= 411,	/* South Korea */
151 	CTRY_KUWAIT		= 414,	/* Kuwait */
152 	CTRY_LATVIA		= 428,	/* Latvia */
153 	CTRY_LEBANON		= 422,	/* Lebanon */
154 	CTRY_LIBYA		= 434,	/* Libya */
155 	CTRY_LIECHTENSTEIN	= 438,	/* Liechtenstein */
156 	CTRY_LITHUANIA		= 440,	/* Lithuania */
157 	CTRY_LUXEMBOURG		= 442,	/* Luxembourg */
158 	CTRY_MACAU		= 446,	/* Macau */
159 	CTRY_MACEDONIA		= 807,	/* the Former Yugoslav Republic of Macedonia */
160 	CTRY_MALAYSIA		= 458,	/* Malaysia */
161 	CTRY_MALTA		= 470,	/* Malta */
162 	CTRY_MEXICO		= 484,	/* Mexico */
163 	CTRY_MONACO		= 492,	/* Principality of Monaco */
164 	CTRY_MOROCCO		= 504,	/* Morocco */
165 	CTRY_NEPAL		= 524,	/* Nepal */
166 	CTRY_NETHERLANDS	= 528,	/* Netherlands */
167 	CTRY_NEW_ZEALAND	= 554,	/* New Zealand */
168 	CTRY_NICARAGUA		= 558,	/* Nicaragua */
169 	CTRY_NORWAY		= 578,	/* Norway */
170 	CTRY_OMAN		= 512,	/* Oman */
171 	CTRY_PAKISTAN		= 586,	/* Islamic Republic of Pakistan */
172 	CTRY_PANAMA		= 591,	/* Panama */
173 	CTRY_PARAGUAY		= 600,	/* Paraguay */
174 	CTRY_PERU		= 604,	/* Peru */
175 	CTRY_PHILIPPINES	= 608,	/* Republic of the Philippines */
176 	CTRY_POLAND		= 616,	/* Poland */
177 	CTRY_PORTUGAL		= 620,	/* Portugal */
178 	CTRY_PUERTO_RICO	= 630,	/* Puerto Rico */
179 	CTRY_QATAR		= 634,	/* Qatar */
180 	CTRY_ROMANIA		= 642,	/* Romania */
181 	CTRY_RUSSIA		= 643,	/* Russia */
182 	CTRY_SAUDI_ARABIA	= 682,	/* Saudi Arabia */
183 	CTRY_SINGAPORE		= 702,	/* Singapore */
184 	CTRY_SLOVAKIA		= 703,	/* Slovak Republic */
185 	CTRY_SLOVENIA		= 705,	/* Slovenia */
186 	CTRY_SOUTH_AFRICA	= 710,	/* South Africa */
187 	CTRY_SPAIN		= 724,	/* Spain */
188 	CTRY_SRILANKA		= 144,	/* Sri Lanka */
189 	CTRY_SWEDEN		= 752,	/* Sweden */
190 	CTRY_SWITZERLAND	= 756,	/* Switzerland */
191 	CTRY_SYRIA		= 760,	/* Syria */
192 	CTRY_TAIWAN		= 158,	/* Taiwan */
193 	CTRY_THAILAND		= 764,	/* Thailand */
194 	CTRY_TRINIDAD_Y_TOBAGO	= 780,	/* Trinidad y Tobago */
195 	CTRY_TUNISIA		= 788,	/* Tunisia */
196 	CTRY_TURKEY		= 792,	/* Turkey */
197 	CTRY_UAE		= 784,	/* U.A.E. */
198 	CTRY_UKRAINE		= 804,	/* Ukraine */
199 	CTRY_UNITED_KINGDOM	= 826,	/* United Kingdom */
200 	CTRY_UNITED_STATES	= 840,	/* United States */
201 	CTRY_URUGUAY		= 858,	/* Uruguay */
202 	CTRY_UZBEKISTAN		= 860,	/* Uzbekistan */
203 	CTRY_VENEZUELA		= 862,	/* Venezuela */
204 	CTRY_VIET_NAM		= 704,	/* Viet Nam */
205 	CTRY_YEMEN		= 887,	/* Yemen */
206 	CTRY_ZIMBABWE		= 716,	/* Zimbabwe */
207 
208 	/* NB: from here down not listed in 3166; they come from Atheros */
209 	CTRY_DEBUG		= 0x1ff, /* debug */
210 	CTRY_DEFAULT		= 0,	 /* default */
211 
212 	CTRY_UNITED_STATES_FCC49 = 842,	/* United States (Public Safety)*/
213 	CTRY_KOREA_ROC3		= 412,	/* South Korea */
214 
215 	CTRY_JAPAN1		= 393,	/* Japan (JP1) */
216 	CTRY_JAPAN2		= 394,	/* Japan (JP0) */
217 	CTRY_JAPAN3		= 395,	/* Japan (JP1-1) */
218 	CTRY_JAPAN4		= 396,	/* Japan (JE1) */
219 	CTRY_JAPAN5		= 397,	/* Japan (JE2) */
220 	CTRY_JAPAN6		= 399,	/* Japan (JP6) */
221 	CTRY_JAPAN7		= 4007,	/* Japan (J7) */
222 	CTRY_JAPAN8		= 4008,	/* Japan (J8) */
223 	CTRY_JAPAN9		= 4009,	/* Japan (J9) */
224 	CTRY_JAPAN10		= 4010,	/* Japan (J10) */
225 	CTRY_JAPAN11		= 4011,	/* Japan (J11) */
226 	CTRY_JAPAN12		= 4012,	/* Japan (J12) */
227 	CTRY_JAPAN13		= 4013,	/* Japan (J13) */
228 	CTRY_JAPAN14		= 4014,	/* Japan (J14) */
229 	CTRY_JAPAN15		= 4015,	/* Japan (J15) */
230 	CTRY_JAPAN16		= 4016,	/* Japan (J16) */
231 	CTRY_JAPAN17		= 4017,	/* Japan (J17) */
232 	CTRY_JAPAN18		= 4018,	/* Japan (J18) */
233 	CTRY_JAPAN19		= 4019,	/* Japan (J19) */
234 	CTRY_JAPAN20		= 4020,	/* Japan (J20) */
235 	CTRY_JAPAN21		= 4021,	/* Japan (J21) */
236 	CTRY_JAPAN22		= 4022,	/* Japan (J22) */
237 	CTRY_JAPAN23		= 4023,	/* Japan (J23) */
238 	CTRY_JAPAN24		= 4024,	/* Japan (J24) */
239 };
240 
241 enum RegdomainCode {
242 	SKU_FCC			= 0x10,	/* FCC, aka United States */
243 	SKU_CA			= 0x20,	/* North America, aka Canada */
244 	SKU_ETSI		= 0x30,	/* Europe */
245 	SKU_ETSI2		= 0x32,	/* Europe w/o HT40 in 5GHz */
246 	SKU_ETSI3		= 0x33,	/* Europe - channel 36 */
247 	SKU_FCC3		= 0x3a,	/* FCC w/5470 band, 11h, DFS */
248 	SKU_JAPAN		= 0x40,
249 	SKU_KOREA		= 0x45,
250 	SKU_APAC		= 0x50,	/* Asia Pacific */
251 	SKU_APAC2		= 0x51,	/* Asia Pacific w/ DFS on mid-band */
252 	SKU_APAC3		= 0x5d,	/* Asia Pacific w/o ISM band */
253 	SKU_ROW			= 0x81,	/* China/Taiwan/Rest of World */
254 	SKU_NONE		= 0xf0,	/* "Region Free" */
255 	SKU_DEBUG		= 0x1ff,
256 
257 	/* NB: from here down private */
258 	SKU_SR9			= 0x0298, /* Ubiquiti SR9 (900MHz/GSM) */
259 	SKU_XR9			= 0x0299, /* Ubiquiti XR9 (900MHz/GSM) */
260 	SKU_GZ901		= 0x029a, /* Zcomax GZ-901 (900MHz/GSM) */
261 	SKU_XC900M		= 0x029b, /* Xagyl XC900M (900MHz/GSM) */
262 					  /*
263 					   * The XC900M by default uses the
264 					   * same mapping as the XR9.  It
265 					   * can optionally use a slightly
266 					   * offset channel spacing (905MHz-
267 					   * 925MHz) versus the XR9 (907MHz-
268 					   * 922MHz), giving an extra channel.
269 					   * This requires a jumper on the
270 					   * NIC to be changed.
271 					   */
272 };
273 
274 #if defined(__KERNEL__) || defined(_KERNEL)
275 struct ieee80211com;
276 void	ieee80211_regdomain_attach(struct ieee80211com *);
277 void	ieee80211_regdomain_detach(struct ieee80211com *);
278 struct ieee80211vap;
279 void	ieee80211_regdomain_vattach(struct ieee80211vap *);
280 void	ieee80211_regdomain_vdetach(struct ieee80211vap *);
281 
282 struct ieee80211_regdomain;
283 int	ieee80211_init_channels(struct ieee80211com *,
284 	    const struct ieee80211_regdomain *, const uint8_t bands[]);
285 struct ieee80211_channel;
286 void	ieee80211_sort_channels(struct ieee80211_channel *chans, int nchans);
287 struct ieee80211_appie;
288 struct ieee80211_appie *ieee80211_alloc_countryie(struct ieee80211com *);
289 struct ieee80211_regdomain_req;
290 int	ieee80211_setregdomain(struct ieee80211vap *,
291 	    struct ieee80211_regdomain_req *);
292 #endif /* defined(__KERNEL__) || defined(_KERNEL) */
293 #endif /* _NET80211_IEEE80211_REGDOMAIN_H_ */
294