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