Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Dec 2007 17:23:31 GMT
From:      Sam Leffler <sam@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 130277 for review
Message-ID:  <200712051723.lB5HNVuk084310@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=130277

Change 130277 by sam@sam_ebb on 2007/12/05 17:23:26

	sync vap code; missed first time 'round

Affected files ...

.. //depot/projects/vap/sys/net80211/ieee80211_power.h#3 edit
.. //depot/projects/vap/sys/net80211/ieee80211_regdomain.c#2 edit
.. //depot/projects/vap/sys/net80211/ieee80211_regdomain.h#2 edit

Differences ...

==== //depot/projects/vap/sys/net80211/ieee80211_power.h#3 (text+ko) ====

@@ -1,6 +1,5 @@
 /*-
- * Copyright (c) 2001 Atsushi Onoe
- * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
+ * Copyright (c) 2002-2007 Sam Leffler, Errno Consulting
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -39,8 +38,8 @@
 void	ieee80211_power_attach(struct ieee80211com *);
 void	ieee80211_power_detach(struct ieee80211com *);
 void	ieee80211_power_vattach(struct ieee80211vap *);
+void	ieee80211_power_vdetach(struct ieee80211vap *);
 void	ieee80211_power_latevattach(struct ieee80211vap *);
-void	ieee80211_power_vdetach(struct ieee80211vap *);
 
 int	ieee80211_node_saveq_drain(struct ieee80211_node *);
 int	ieee80211_node_saveq_age(struct ieee80211_node *);

==== //depot/projects/vap/sys/net80211/ieee80211_regdomain.c#2 (text+ko) ====

@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2005 Sam Leffler, Errno Consulting
+ * Copyright (c) 2005-2007 Sam Leffler, Errno Consulting
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -30,7 +30,9 @@
  */
 
 #include <sys/cdefs.h>
+#ifdef __FreeBSD__
 __FBSDID("$FreeBSD: src/sys/net80211/ieee80211.c,v 1.19 2005/01/27 17:39:17 sam Exp $");
+#endif
 
 /*
  * IEEE 802.11 regdomain support.
@@ -43,240 +45,234 @@
 #include <sys/socket.h>
 
 #include <net/if.h>
-#include <net/if_arp.h>
-#include <net/if_dl.h>
 #include <net/if_media.h>
-#include <net/if_types.h>
-#include <net/ethernet.h>
 
 #include <net80211/ieee80211_var.h>
 #include <net80211/ieee80211_regdomain.h>
 
+static int
+null_setregdomain(struct ieee80211com *ic,
+	struct ieee80211_regdomain *rd,
+	int nchans, struct ieee80211_channel chans[])
+{
+	return 0;		/* accept anything */
+}
+
+void
+ieee80211_regdomain_attach(struct ieee80211com *ic)
+{
+	if (ic->ic_regdomain.regdomain == 0 &&
+	    ic->ic_regdomain.country == CTRY_DEFAULT) {
+		ic->ic_regdomain.country = CTRY_UNITED_STATES;	/* XXX */
+		ic->ic_regdomain.location = ' ';		/* both */
+		ic->ic_regdomain.isocc[0] = 'U';		/* XXX */
+		ic->ic_regdomain.isocc[1] = 'S';		/* XXX */
+		/* XXX? too late to setup default channel list */
+	}
+	ic->ic_setregdomain = null_setregdomain;
+}
+
+void
+ieee80211_regdomain_detach(struct ieee80211com *ic)
+{
+}
+
+void
+ieee80211_regdomain_vattach(struct ieee80211vap *vap)
+{
+}
+
+void
+ieee80211_regdomain_vdetach(struct ieee80211vap *vap)
+{
+}
+
+static void
+addchan(struct ieee80211com *ic, int ieee, int flags)
+{
+	struct ieee80211_channel *c;
+
+	c = &ic->ic_channels[ic->ic_nchans++];
+	c->ic_freq = ieee80211_ieee2mhz(ieee, flags);
+	c->ic_ieee = ieee;
+	c->ic_flags = flags;
+	c->ic_extieee = 0;
+}
+
 /*
- * Country Code Table for code-to-string conversion.
+ * Setup the channel list for the specified regulatory domain,
+ * country code, and operating modes.  This interface is used
+ * when a driver does not obtain the channel list from another
+ * source (such as firmware).
  */
+int
+ieee80211_init_channels(struct ieee80211com *ic,
+	const struct ieee80211_regdomain *rd, const uint8_t bands[])
+{
+	int i;
+
+	/* XXX just do something for now */
+	ic->ic_nchans = 0;
+	if (isset(bands, IEEE80211_MODE_11B) ||
+	    isset(bands, IEEE80211_MODE_11G)) {
+		for (i = 1; i <= (rd->ecm ? 14 : 11); i++) {
+			if (isset(bands, IEEE80211_MODE_11B))
+				addchan(ic, i, IEEE80211_CHAN_B);
+			if (isset(bands, IEEE80211_MODE_11G))
+				addchan(ic, i, IEEE80211_CHAN_G);
+		}
+	}
+	if (isset(bands, IEEE80211_MODE_11A)) {
+		for (i = 36; i <= 64; i += 4)
+			addchan(ic, i, IEEE80211_CHAN_A);
+		for (i = 100; i <= 140; i += 4)
+			addchan(ic, i, IEEE80211_CHAN_A);
+		for (i = 149; i <= 161; i += 4)
+			addchan(ic, i, IEEE80211_CHAN_A);
+	}
+	ic->ic_regdomain = *rd;
+
+	return 0;
+}
 
-struct country_code_to_string{
-	u_int16_t	iso_code;	   
-	const char*	iso_name;
-};
+static __inline int
+chancompar(const void *a, const void *b)
+{
+	const struct ieee80211_channel *ca = a;
+	const struct ieee80211_channel *cb = b;
+
+	return (ca->ic_freq == cb->ic_freq) ?
+		(ca->ic_flags & IEEE80211_CHAN_ALL) -
+		    (cb->ic_flags & IEEE80211_CHAN_ALL) :
+		ca->ic_freq - cb->ic_freq;
+}
 
 /*
- * XXX: ugly, since must match define in other modules.
+ * Insertion sort.
  */
-#define CTRY_DEBUG                0x1ff   /* debug */
-#define CTRY_DEFAULT              0       /* default */
+#define swap(_a, _b, _size) {			\
+	uint8_t *s = _b;			\
+	int i = _size;				\
+	do {					\
+		uint8_t tmp = *_a;		\
+		*_a++ = *s;			\
+		*s++ = tmp;			\
+	} while (--i);				\
+	_a -= _size;				\
+}
+
+static void
+sort_channels(void *a, size_t n, size_t size)
+{
+	uint8_t *aa = a;
+	uint8_t *ai, *t;
 
-static const  struct country_code_to_string country_strings[] = {
-    {CTRY_DEBUG,	 	"DB" },
-    {CTRY_DEFAULT,	 	"NA" },
-    {CTRY_ALBANIA,		"AL" },
-    {CTRY_ALGERIA,		"DZ" },
-    {CTRY_ARGENTINA,		"AR" },
-    {CTRY_ARMENIA,		"AM" },
-    {CTRY_AUSTRALIA,		"AU" },
-    {CTRY_AUSTRIA,		"AT" },
-    {CTRY_AZERBAIJAN,		"AZ" },
-    {CTRY_BAHRAIN,		"BH" },
-    {CTRY_BELARUS,		"BY" },
-    {CTRY_BELGIUM,		"BE" },
-    {CTRY_BELIZE,		"BZ" },
-    {CTRY_BOLIVIA,		"BO" },
-    {CTRY_BRAZIL,		"BR" },
-    {CTRY_BRUNEI_DARUSSALAM,	"BN" },
-    {CTRY_BULGARIA,		"BG" },
-    {CTRY_CANADA,		"CA" },
-    {CTRY_CHILE,		"CL" },
-    {CTRY_CHINA,		"CN" },
-    {CTRY_COLOMBIA,		"CO" },
-    {CTRY_COSTA_RICA,		"CR" },
-    {CTRY_CROATIA,		"HR" },
-    {CTRY_CYPRUS,		"CY" },
-    {CTRY_CZECH,		"CZ" },
-    {CTRY_DENMARK,		"DK" },
-    {CTRY_DOMINICAN_REPUBLIC,	"DO" },
-    {CTRY_ECUADOR,		"EC" },
-    {CTRY_EGYPT,		"EG" },
-    {CTRY_EL_SALVADOR,		"SV" },    
-    {CTRY_ESTONIA,		"EE" },
-    {CTRY_FINLAND,		"FI" },
-    {CTRY_FRANCE,		"FR" },
-    {CTRY_FRANCE2,		"F2" },
-    {CTRY_GEORGIA,		"GE" },
-    {CTRY_GERMANY,		"DE" },
-    {CTRY_GREECE,		"GR" },
-    {CTRY_GUATEMALA,		"GT" },
-    {CTRY_HONDURAS,		"HN" },
-    {CTRY_HONG_KONG,		"HK" },
-    {CTRY_HUNGARY,		"HU" },
-    {CTRY_ICELAND,		"IS" },
-    {CTRY_INDIA,		"IN" },
-    {CTRY_INDONESIA,		"ID" },
-    {CTRY_IRAN,			"IR" },
-    {CTRY_IRELAND,		"IE" },
-    {CTRY_ISRAEL,		"IL" },
-    {CTRY_ITALY,		"IT" },
-    {CTRY_JAPAN,		"JP" },
-    {CTRY_JAPAN1,		"J1" },
-    {CTRY_JAPAN2,		"J2" },    
-    {CTRY_JAPAN3,		"J3" },
-    {CTRY_JAPAN4,		"J4" },
-    {CTRY_JAPAN5,		"J5" },    
-    {CTRY_JORDAN,		"JO" },
-    {CTRY_KAZAKHSTAN,		"KZ" },
-    {CTRY_KOREA_NORTH,		"KP" },
-    {CTRY_KOREA_ROC,		"KR" },
-    {CTRY_KOREA_ROC2,		"K2" },
-    {CTRY_KUWAIT,		"KW" },
-    {CTRY_LATVIA,		"LV" },
-    {CTRY_LEBANON,		"LB" },
-    {CTRY_LIECHTENSTEIN,	"LI" },
-    {CTRY_LITHUANIA,		"LT" },
-    {CTRY_LUXEMBOURG,		"LU" },
-    {CTRY_MACAU,		"MO" },
-    {CTRY_MACEDONIA,		"MK" },
-    {CTRY_MALAYSIA,		"MY" },
-    {CTRY_MEXICO,		"MX" },
-    {CTRY_MONACO,		"MC" },
-    {CTRY_MOROCCO,		"MA" },
-    {CTRY_NETHERLANDS,		"NL" },
-    {CTRY_NEW_ZEALAND,		"NZ" },
-    {CTRY_NORWAY,		"NO" },
-    {CTRY_OMAN,			"OM" },
-    {CTRY_PAKISTAN,		"PK" },
-    {CTRY_PANAMA,		"PA" },
-    {CTRY_PERU,			"PE" },
-    {CTRY_PHILIPPINES,		"PH" },
-    {CTRY_POLAND,		"PL" },
-    {CTRY_PORTUGAL,		"PT" },
-    {CTRY_PUERTO_RICO,		"PR" },
-    {CTRY_QATAR,		"QA" },
-    {CTRY_ROMANIA,		"RO" },
-    {CTRY_RUSSIA,		"RU" },
-    {CTRY_SAUDI_ARABIA,		"SA" },
-    {CTRY_SINGAPORE,		"SG" },
-    {CTRY_SLOVAKIA,		"SK" },
-    {CTRY_SLOVENIA,		"SI" },
-    {CTRY_SOUTH_AFRICA,		"ZA" },
-    {CTRY_SPAIN,		"ES" },
-    {CTRY_SWEDEN,		"SE" },
-    {CTRY_SWITZERLAND,		"CH" },
-    {CTRY_SYRIA,		"SY" },
-    {CTRY_TAIWAN,		"TW" },
-    {CTRY_THAILAND,		"TH" },
-    {CTRY_TRINIDAD_Y_TOBAGO,	"TT" },
-    {CTRY_TUNISIA,		"TN" },
-    {CTRY_TURKEY,		"TR" },
-    {CTRY_UKRAINE,		"UA" },
-    {CTRY_UAE,			"AE" },
-    {CTRY_UNITED_KINGDOM,	"GB" },
-    {CTRY_UNITED_STATES,	"US" },
-    {CTRY_URUGUAY,		"UY" },
-    {CTRY_UZBEKISTAN,		"UZ" },    
-    {CTRY_VENEZUELA,		"VE" },
-    {CTRY_VIET_NAM,		"VN" },
-    {CTRY_YEMEN,		"YE" },
-    {CTRY_ZIMBABWE,		"ZW" }    
-};
+	for (ai = aa+size; --n >= 1; ai += size)
+		for (t = ai; t > aa; t -= size) {
+			uint8_t *u = t - size;
+			if (chancompar(u, t) <= 0)
+				break;
+			swap(u, t, size);
+		}
+}
+#undef swap
 
+/*
+ * Order channels w/ the same frequency so that
+ * b < g < htg and a < hta.  This is used to optimize
+ * channel table lookups and some user applications
+ * may also depend on it (though they should not).
+ */
 void
-ieee80211_regdomain_attach(struct ieee80211com *ic)
+ieee80211_sort_channels(struct ieee80211_channel chans[], int nchans)
+{
+	sort_channels(chans, nchans, sizeof(struct ieee80211_channel));
+}
+
+/*
+ * Add Country Information IE.
+ */
+uint8_t *
+ieee80211_add_countryie(uint8_t *frm, struct ieee80211com *ic)
 {
-#define	N(a)	(sizeof(a)/sizeof(a[0]))
-	int i;
+#define	CHAN_UNINTERESTING \
+    (IEEE80211_CHAN_TURBO | IEEE80211_CHAN_STURBO | \
+     IEEE80211_CHAN_HALF | IEEE80211_CHAN_QUARTER)
+	/* XXX what about auto? */
+	/* flag set of channels to be excluded */
+	static const int skipflags[IEEE80211_MODE_MAX] = {
+	    CHAN_UNINTERESTING,				/* MODE_AUTO */
+	    CHAN_UNINTERESTING | IEEE80211_CHAN_2GHZ,	/* MODE_11A */
+	    CHAN_UNINTERESTING | IEEE80211_CHAN_5GHZ,	/* MODE_11B */
+	    CHAN_UNINTERESTING | IEEE80211_CHAN_5GHZ,	/* MODE_11G */
+	    CHAN_UNINTERESTING | IEEE80211_CHAN_OFDM |	/* MODE_FH */
+	        IEEE80211_CHAN_CCK | IEEE80211_CHAN_DYN,
+	    CHAN_UNINTERESTING | IEEE80211_CHAN_2GHZ,	/* MODE_TURBO_A */
+	    CHAN_UNINTERESTING | IEEE80211_CHAN_5GHZ,	/* MODE_TURBO_G */
+	    CHAN_UNINTERESTING | IEEE80211_CHAN_2GHZ,	/* MODE_STURBO_A */
+	    CHAN_UNINTERESTING | IEEE80211_CHAN_2GHZ,	/* MODE_11NA */
+	    CHAN_UNINTERESTING | IEEE80211_CHAN_5GHZ,	/* MODE_11NG */
+	};
+	struct ieee80211_country_ie *ie = (struct ieee80211_country_ie *)frm;
+	const struct ieee80211_regdomain *rd = &ic->ic_regdomain;
+	uint8_t nextchan, chans[IEEE80211_CHAN_BYTES];
+	int i, skip, nruns;
 
-	/*
-	 * Fill in country IE.
-	 */
-	memset(&ic->ic_country_ie, 0, sizeof(ic->ic_country_ie));  
-	ic->ic_country_ie.country_id = IEEE80211_ELEMID_COUNTRY;
-	ic->ic_country_ie.country_len = 0; /* init needed by following code */
-	{
-		int found = 0;
-		for (i=0; i < N(country_strings); i++) {
-			if (country_strings[i].iso_code == ic->ic_country_code) {
-				ic->ic_country_ie.country_str[0] = country_strings[i].iso_name[0];
-				ic->ic_country_ie.country_str[1] = country_strings[i].iso_name[1];
-				found = 1;
-				break;
-			}
-		}
-		if (!found) {
-			if_printf(ic->ic_ifp, "bad country string ignored: %d\n",
-					  ic->ic_country_code);
-				ic->ic_country_ie.country_str[0] = ' ';
-				ic->ic_country_ie.country_str[1] = ' ';			
-		}
+	ie->ie = IEEE80211_ELEMID_COUNTRY;
+	if (rd->isocc[0] == '\0') {
+		if_printf(ic->ic_ifp, "no ISO country string for cc %d; "
+			"using blanks\n", rd->country);
+		ie->cc[0] = ie->cc[1] = ' ';
+	} else {
+		ie->cc[0] = rd->isocc[0];
+		ie->cc[1] = rd->isocc[1];
 	}
 	/* 
-	 * indoor/outdoor portion if country string.
-	 * NB: this is not quite right, since we should have one of:
+	 * Indoor/Outdoor portion of country string:
 	 *     'I' indoor only
 	 *     'O' outdoor only
 	 *     ' ' all enviroments
-	 *  we currently can only provide 'I' or ' '.
 	 */
-	ic->ic_country_ie.country_str[2] = 'I';
-	if (ic->ic_country_outdoor)
-		ic->ic_country_ie.country_str[2] = ' ';
+	ie->cc[2] = (rd->location == 'I' ? 'I' :
+		     rd->location == 'O' ? 'O' : ' ');
 	/* 
-	 * runlength encoded channel max tx power info.
+	 * Run-length encoded channel+max tx power info.
 	 */
-	{
-		u_int8_t *cur_runlen = &ic->ic_country_ie.country_triplet[1];
-		u_int8_t *cur_chan = &ic->ic_country_ie.country_triplet[0];
-		u_int8_t *cur_pow = &ic->ic_country_ie.country_triplet[2];
-		u_int8_t prevchan = 0;
-		ic->ic_country_ie.country_len = 3; /* invalid, but just initialize */
-		/* XXX not right 'cuz of duplicate entries */
-		for (i = 0; i < ic->ic_nchans; i++) {
-			struct ieee80211_channel *c = &ic->ic_channels[i];
-			if (*cur_runlen == 0) {
-				(*cur_runlen)++;
-				*cur_pow = c->ic_maxregpower;
-				*cur_chan = c->ic_ieee;
-				prevchan = c->ic_ieee;
-				ic->ic_country_ie.country_len += 3;
-			} else if (*cur_pow == c->ic_maxregpower &&
-			    c->ic_ieee == prevchan + 1) {
-				(*cur_runlen)++;
-				prevchan = c->ic_ieee;
-			} else {
-				cur_runlen +=3;
-				cur_chan += 3;
-				cur_pow += 3;
-				(*cur_runlen)++;
-				*cur_pow = c->ic_maxregpower;
-				*cur_chan = c->ic_ieee;
-				prevchan = c->ic_ieee;
-				ic->ic_country_ie.country_len += 3;
+	frm = (uint8_t *)&ie->band[0];
+	nextchan = 0;			/* NB: impossible channel # */
+	nruns = 0;
+	memset(chans, 0, sizeof(chans));
+	skip = skipflags[ieee80211_chan2mode(ic->ic_bsschan)];
+	for (i = 0; i < ic->ic_nchans; i++) {
+		const struct ieee80211_channel *c = &ic->ic_channels[i];
+
+		if (isset(chans, c->ic_ieee))		/* suppress dup's */
+			continue;
+		if (c->ic_flags & skip)			/* skip band, etc. */
+			continue;
+		setbit(chans, c->ic_ieee);
+		if (c->ic_ieee != nextchan ||
+		    c->ic_maxregpower != frm[-1]) {	/* new run */
+			if (nruns == 10) {		/* XXX max runs */
+				/* XXX add msg but can't now 'cuz we're called too often */
+				break;
 			}
+			frm[0] = c->ic_ieee;		/* starting channel # */
+			frm[1] = 1;			/* # channels in run */
+			frm[2] = c->ic_maxregpower;	/* tx power cap */
+			frm += 3;
+			nextchan = c->ic_ieee + 1;	/* overflow? */
+			nruns++;
+		} else {				/* extend run */
+			frm[-2]++;
+			nextchan++;
 		}
-		/* pad */
-		if (ic->ic_country_ie.country_len & 1)
-			ic->ic_country_ie.country_len++;
+	}
+	ie->len = frm - ie->cc;
+	if (ie->len & 1) {		/* pad to multiple of 2 */
+		ie->len++;
+		*frm++ = 0;
 	}
-
-#if 0
-	ic->ic_country_ie.country_len=8;
-	ic->ic_country_ie.country_triplet[0] = 10;
-	ic->ic_country_ie.country_triplet[1] = 11;
-	ic->ic_country_ie.country_triplet[2] = 12;
-#endif
-#undef N
-}
-
-void
-ieee80211_regdomain_detach(struct ieee80211com *ic)
-{
-}
-
-void
-ieee80211_regdomain_vattach(struct ieee80211vap *vap)
-{
-}
-
-void
-ieee80211_regdomain_vdetach(struct ieee80211vap *vap)
-{
+	return frm;
+#undef CHAN_UNINTERESTING
 }

==== //depot/projects/vap/sys/net80211/ieee80211_regdomain.h#2 (text+ko) ====

@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2005 Sam Leffler, Errno Consulting
+ * Copyright (c) 2005-2007 Sam Leffler, Errno Consulting
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -41,7 +41,7 @@
  * ISO 3166 Country/Region Codes
  * http://ftp.ics.uci.edu/pub/ietf/http/related/iso3166.txt
  */
-enum CountryCode {
+enum ISOCountryCode {
 	CTRY_AFGHANISTAN	= 4,
 	CTRY_ALBANIA		= 8,	/* Albania */
 	CTRY_ALGERIA		= 12,	/* Algeria */
@@ -49,42 +49,92 @@
 	CTRY_ANDORRA		= 20,
 	CTRY_ANGOLA		= 24,
 	CTRY_ANGUILLA		= 660,
-	/* XXX correct remainder */
+	CTRY_ANTARTICA		= 10,
+	CTRY_ANTIGUA		= 28,	/* Antigua and Barbuda */
 	CTRY_ARGENTINA		= 32,	/* Argentina */
 	CTRY_ARMENIA		= 51,	/* Armenia */
+	CTRY_ARUBA		= 533,	/* Aruba */
 	CTRY_AUSTRALIA		= 36,	/* Australia */
 	CTRY_AUSTRIA		= 40,	/* Austria */
 	CTRY_AZERBAIJAN		= 31,	/* Azerbaijan */
+	CTRY_BAHAMAS		= 44,	/* Bahamas */
 	CTRY_BAHRAIN		= 48,	/* Bahrain */
+	CTRY_BANGLADESH		= 50,	/* Bangladesh */
+	CTRY_BARBADOS		= 52,
 	CTRY_BELARUS		= 112,	/* Belarus */
 	CTRY_BELGIUM		= 56,	/* Belgium */
-	CTRY_BELIZE		= 84,	/* Belize */
+	CTRY_BELIZE		= 84,
+	CTRY_BENIN		= 204,
+	CTRY_BERMUDA		= 60,
+	CTRY_BHUTAN		= 64,
 	CTRY_BOLIVIA		= 68,	/* Bolivia */
+	CTRY_BOSNIA_AND_HERZEGOWINA = 70,
+	CTRY_BOTSWANA		= 72,
+	CTRY_BOUVET_ISLAND	= 74,
 	CTRY_BRAZIL		= 76,	/* Brazil */
+	CTRY_BRITISH_INDIAN_OCEAN_TERRITORY = 86,
 	CTRY_BRUNEI_DARUSSALAM	= 96,	/* Brunei Darussalam */
 	CTRY_BULGARIA		= 100,	/* Bulgaria */
+	CTRY_BURKINA_FASO	= 854,
+	CTRY_BURUNDI		= 108,
+	CTRY_CAMBODIA		= 116,
+	CTRY_CAMEROON		= 120,
 	CTRY_CANADA		= 124,	/* Canada */
+	CTRY_CAPE_VERDE		= 132,
+	CTRY_CAYMAN_ISLANDS	= 136,
+	CTRY_CENTRAL_AFRICAN_REPUBLIC = 140,
+	CTRY_CHAD		= 148,
 	CTRY_CHILE		= 152,	/* Chile */
 	CTRY_CHINA		= 156,	/* People's Republic of China */
+	CTRY_CHRISTMAS_ISLAND	= 162,
+	CTRY_COCOS_ISLANDS	= 166,
 	CTRY_COLOMBIA		= 170,	/* Colombia */
+	CTRY_COMOROS		= 174,
+	CTRY_CONGO		= 178,
+	CTRY_COOK_ISLANDS	= 184,
 	CTRY_COSTA_RICA		= 188,	/* Costa Rica */
-	CTRY_CROATIA		= 191,	/* Croatia */
+	CTRY_COTE_DIVOIRE	= 384,
+	CTRY_CROATIA		= 191,	/* Croatia (local name: Hrvatska) */
 	CTRY_CYPRUS		= 196,	/* Cyprus */
 	CTRY_CZECH		= 203,	/* Czech Republic */
 	CTRY_DENMARK		= 208,	/* Denmark */
+	CTRY_DJIBOUTI		= 262,
+	CTRY_DOMINICA		= 212,
 	CTRY_DOMINICAN_REPUBLIC	= 214,	/* Dominican Republic */
+	CTRY_EAST_TIMOR		= 626,
 	CTRY_ECUADOR		= 218,	/* Ecuador */
 	CTRY_EGYPT		= 818,	/* Egypt */
 	CTRY_EL_SALVADOR	= 222,	/* El Salvador */
+	CTRY_EQUATORIAL_GUINEA	= 226,
+	CTRY_ERITREA		= 232,
 	CTRY_ESTONIA		= 233,	/* Estonia */
+	CTRY_ETHIOPIA		= 210,
+	CTRY_FALKLAND_ISLANDS	= 238,	/* (Malvinas) */
 	CTRY_FAEROE_ISLANDS	= 234,	/* Faeroe Islands */
+	CTRY_FIJI		= 242,
 	CTRY_FINLAND		= 246,	/* Finland */
 	CTRY_FRANCE		= 250,	/* France */
-	CTRY_FRANCE2		= 255,	/* France2 */
+	CTRY_FRANCE2		= 255,	/* France (Metropolitan) */
+	CTRY_FRENCH_GUIANA	= 254,
+	CTRY_FRENCH_POLYNESIA	= 258,
+	CTRY_FRENCH_SOUTHERN_TERRITORIES	= 260,
+	CTRY_GABON		= 266,
+	CTRY_GAMBIA		= 270,
 	CTRY_GEORGIA		= 268,	/* Georgia */
 	CTRY_GERMANY		= 276,	/* Germany */
+	CTRY_GHANA		= 288,
+	CTRY_GIBRALTAR		= 292,
 	CTRY_GREECE		= 300,	/* Greece */
+	CTRY_GREENLAND		= 304,
+	CTRY_GRENADA		= 308,
+	CTRY_GUADELOUPE		= 312,
+	CTRY_GUAM		= 316,
 	CTRY_GUATEMALA		= 320,	/* Guatemala */
+	CTRY_GUINEA		= 324,
+	CTRY_GUINEA_BISSAU	= 624,
+	CTRY_GUYANA		= 328,
+	/* XXX correct remainder */
+	CTRY_HAITI		= 332,
 	CTRY_HONDURAS		= 340,	/* Honduras */
 	CTRY_HONG_KONG		= 344,	/* Hong Kong S.A.R., P.R.C. */
 	CTRY_HUNGARY		= 348,	/* Hungary */
@@ -119,9 +169,11 @@
 	CTRY_MACAU		= 446,	/* Macau */
 	CTRY_MACEDONIA		= 807,	/* the Former Yugoslav Republic of Macedonia */
 	CTRY_MALAYSIA		= 458,	/* Malaysia */
+	CTRY_MALTA		= 470,	/* Malta */
 	CTRY_MEXICO		= 484,	/* Mexico */
 	CTRY_MONACO		= 492,	/* Principality of Monaco */
 	CTRY_MOROCCO		= 504,	/* Morocco */
+	CTRY_NEPAL		= 524,	/* Nepal */
 	CTRY_NETHERLANDS	= 528,	/* Netherlands */
 	CTRY_NEW_ZEALAND	= 554,	/* New Zealand */
 	CTRY_NICARAGUA		= 558,	/* Nicaragua */
@@ -144,6 +196,7 @@
 	CTRY_SLOVENIA		= 705,	/* Slovenia */
 	CTRY_SOUTH_AFRICA	= 710,	/* South Africa */
 	CTRY_SPAIN		= 724,	/* Spain */
+	CTRY_SRILANKA		= 144,	/* Sri Lanka */
 	CTRY_SWEDEN		= 752,	/* Sweden */
 	CTRY_SWITZERLAND	= 756,	/* Switzerland */
 	CTRY_SYRIA		= 760,	/* Syria */
@@ -164,10 +217,35 @@
 	CTRY_ZIMBABWE		= 716,	/* Zimbabwe */
 };
 
+enum RegdomainCode {
+	SKU_FCC			= 0x10,	/* FCC, aka United States */
+	SKU_CA			= 0x20,	/* North America, aka Canada */
+	SKU_ETSI		= 0x30,	/* Europe */
+	SKU_ETSI2		= 0x32,	/* Europe w/o HT40 in 5GHz */
+	SKU_ETSI3		= 0x33,	/* Europe - channel 36 */
+	SKU_FCC3		= 0x3a,	/* FCC w/5470 band, 11h, DFS */
+	SKU_JAPAN		= 0x40,
+	SKU_KOREA		= 0x45,
+	SKU_APAC		= 0x50,	/* Asia Pacific */
+	SKU_APAC2		= 0x51,	/* Asia Pacific w/ DFS on mid-band */
+	SKU_APAC3		= 0x5d,	/* Asia Pacific w/o ISM band */
+	SKU_ROW			= 0x81,	/* China/Taiwan/Rest of World */
+	SKU_NONE		= 0xf0,	/* "Region Free" */
+	SKU_DEBUG		= 0x1ff
+};
+
 #if defined(__KERNEL__) || defined(_KERNEL)
-void ieee80211_regdomain_attach(struct ieee80211com *);
-void ieee80211_regdomain_detach(struct ieee80211com *);
-void ieee80211_regdomain_vattach(struct ieee80211vap *);
-void ieee80211_regdomain_vdetach(struct ieee80211vap *);
+#define CTRY_DEBUG                0x1ff   /* debug */
+#define CTRY_DEFAULT              0       /* default */
+
+void	ieee80211_regdomain_attach(struct ieee80211com *);
+void	ieee80211_regdomain_detach(struct ieee80211com *);
+void	ieee80211_regdomain_vattach(struct ieee80211vap *);
+void	ieee80211_regdomain_vdetach(struct ieee80211vap *);
+
+int	ieee80211_init_channels(struct ieee80211com *,
+	    const struct ieee80211_regdomain *, const uint8_t bands[]);
+void	ieee80211_sort_channels(struct ieee80211_channel chans[], int nchans);
+uint8_t *ieee80211_add_countryie(uint8_t *, struct ieee80211com *);
 #endif /* defined(__KERNEL__) || defined(_KERNEL) */
 #endif /* _NET80211_IEEE80211_REGDOMAIN_H_ */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200712051723.lB5HNVuk084310>